:root {
  --bg: #7151a8;
  --bg-elevated: #8768ba;
  --bg-elevated-hover: #7e5db2;
  --accent: #3ddc7a;
  --accent-bright: #2bbd63;
  --accent-glow: rgba(61, 220, 122, 0.32);
  --accent-soft: #5a3f8a;
  --text: #fbf8ff;
  --text-muted: #d9cdee;
  --border: #9b7fc4;
  --shadow: rgba(30, 15, 55, 0.35);
  --icon-color: #000000;
  --cat-color: #000000;
  --filter-bg: #000000;
  --filter-text: #f5f5f5;
  --filter-border: #000000;

  --font-display: "Sour Gummy", "Comic Sans MS", sans-serif;
  --font-body: "Nunito", -apple-system, "Segoe UI", sans-serif;
}

html[data-theme="light"] {
  --bg: #f4f0fb;
  --bg-elevated: #ffffff;
  --bg-elevated-hover: #ece4fa;
  --accent: #7151a8;
  --accent-bright: #5d3f92;
  --accent-glow: rgba(113, 81, 168, 0.22);
  --accent-soft: #e6ddf7;
  --text: #251a3d;
  --text-muted: #6b5d8a;
  --border: #ddd0f2;
  --shadow: rgba(80, 60, 130, 0.12);
  --icon-color: #5d3f92;
  --cat-color: #5d3f92;
  --filter-bg: #ffffff;
  --filter-text: #251a3d;
  --filter-border: #ddd0f2;
}

html[data-theme="dark"] {
  --bg: #0a1f10;
  --bg-elevated: #123420;
  --bg-elevated-hover: #1a4429;
  --accent: #4ade80;
  --accent-bright: #7bf1a8;
  --accent-glow: rgba(74, 222, 128, 0.35);
  --accent-soft: #1f4a2c;
  --text: #eafbee;
  --text-muted: #86c99a;
  --border: #2c5c3a;
  --shadow: rgba(0, 0, 0, 0.45);
  --icon-color: #7bf1a8;
  --cat-color: #7bf1a8;
  --filter-bg: #123420;
  --filter-text: #86c99a;
  --filter-border: #2c5c3a;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  position: relative;
  cursor: var(--custom-cursor, url('/assets/cursor-greendot.png') 3 2, auto);
  transition: background 0.25s ease, color 0.25s ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-color: var(--bg);
  background-image:
    var(--wallpaper-image, none),
    radial-gradient(1100px 650px at 100% 0%, var(--accent-glow), transparent 60%),
    radial-gradient(800px 500px at 0% 100%, var(--accent-glow), transparent 65%);
  background-size: cover, auto, auto;
  background-position: center;
  background-repeat: no-repeat;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--bg);
  opacity: var(--wallpaper-scrim, 0);
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 20px clamp(16px, 4vw, 48px);
  flex-wrap: wrap;
  background: var(--bg-elevated);
  border-bottom: 2px solid var(--border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 30px;
  color: var(--accent-bright);
  text-decoration: none;
  flex-shrink: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  margin-left: auto;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1 1 auto;
  min-width: 0;
}

.site-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 12px 18px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  text-transform: lowercase;
  transition: all 0.15s ease;
}

.site-nav a .material-symbols-rounded { font-size: 24px; }

.site-nav a:hover { border-color: var(--accent); color: var(--accent-bright); }

.site-nav a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.search-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  transition: border-color 0.2s ease;
}

.search-wrapper:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow); }

.search-icon { color: var(--icon-color); font-size: 20px; }

.search-input {
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  width: 130px;
}

.search-input::placeholder { color: var(--text-muted); }

.scroll-top {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-elevated);
  color: var(--icon-color);
  cursor: pointer;
  box-shadow: 0 6px 16px var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.scroll-top.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.scroll-top:hover { background: var(--bg-elevated-hover); border-color: var(--accent); transform: translateY(-2px); }
.scroll-top .material-symbols-rounded { font-size: 22px; }

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-elevated);
  color: var(--icon-color);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease, border-color 0.2s ease;
}

.theme-toggle:hover { background: var(--bg-elevated-hover); border-color: var(--accent); transform: scale(1.05); }
.theme-toggle .material-symbols-rounded { font-size: 22px; }

main {
  max-width: 1800px;
  margin: 0 auto;
  padding: 20px clamp(16px, 4vw, 48px) 80px;
}

.hero {
  text-align: center;
  padding: 40px 0 20px;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(44px, 8vw, 84px);
  margin: 0;
  color: var(--text);
}

.hero h1 .dot { color: var(--accent-bright); }

.tagline {
  font-size: clamp(15px, 2vw, 18px);
  color: var(--text-muted);
  margin: 12px 0 0;
  min-height: 1.4em;
}

.user-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 700;
}

.user-stat {
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px 1px var(--accent-glow);
}

.caret {
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  background: var(--accent-bright);
  vertical-align: -0.15em;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.games-row {
  margin: 0 0 32px;
}

.row-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  text-transform: lowercase;
  margin: 0 0 14px;
}

.row-title .material-symbols-rounded {
  color: var(--icon-color);
  font-size: 20px;
}

.games-row .games-grid {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.controls {
  margin: 32px 0 24px;
}

.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.pill {
  border: 2px solid var(--filter-border);
  background: var(--filter-bg);
  color: var(--filter-text);
  border-radius: 999px;
  padding: 8px 18px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-transform: lowercase;
  transition: all 0.15s ease;
}

.pill:hover { border-color: var(--accent); color: var(--accent-bright); }

.pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
}

.loading-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 60px 0;
  color: var(--text-muted);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  border-radius: 22px;
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  box-shadow: 0 6px 16px var(--shadow);
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.18s ease, box-shadow 0.18s ease;
}

.controls-right {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
}
.game-count { font-size: 13px; font-weight: 700; color: var(--text-muted); }
#randomGame { display: inline-flex; align-items: center; gap: 6px; }
#randomGame .material-symbols-rounded { font-size: 18px; }

.card-fav {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.card-fav .material-symbols-rounded { font-size: 18px; }
.game-card:hover .card-fav, .card-fav:focus-visible { opacity: 1; }
.card-fav.on { opacity: 1; color: #ffd34d; }
.card-fav:hover { transform: scale(1.12); }

.card-report {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 3px 8px;
  font-size: 10.5px;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.game-card:hover .card-report, .card-report:focus-visible { opacity: 1; }
.card-report:disabled { opacity: 1; background: var(--accent); cursor: default; }

.game-card:hover, .game-card:focus-visible {
  transform: translateY(-6px) rotate(-0.5deg);
  border-color: var(--accent);
  box-shadow: 0 14px 28px var(--shadow);
}

.game-card .cover {
  width: 100%;
  aspect-ratio: 4 / 3;
  background-size: cover;
  background-position: center;
  background-color: var(--accent-soft);
}

.game-card .info {
  padding: 12px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.game-card .name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  line-height: 1.15;
}

.game-card .cat {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-bright);
  text-transform: lowercase;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 60px 0;
  font-size: 15px;
}

footer {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 13px;
}

@media (max-width: 560px) {
  .topbar { justify-content: center; }
  .search-input { width: 140px; }
}

:root.embed[data-theme] {
  --bg: #1c1418;
  --bg-elevated: #2a1f24;
  --bg-elevated-hover: #33262f;
  --accent: #e0824a;
  --accent-bright: #eb9560;
  --accent-glow: rgba(224, 130, 74, 0.30);
  --accent-soft: #3a2a2f;
  --text: #e6d3c6;
  --text-muted: #a98d80;
  --border: rgba(232, 200, 180, 0.14);
  --shadow: rgba(0, 0, 0, 0.45);
  --icon-color: #e0824a;
  --cat-color: #e0824a;
  --filter-bg: #2a1f24;
  --filter-text: #e6d3c6;
  --filter-border: rgba(232, 200, 180, 0.14);
}

html.embed body { background: var(--bg); }
html.embed .site-nav { display: none; }
html.embed .hero { display: none; }
html.embed .topbar { border-bottom: 0; }
html.embed main { padding-top: 16px; }
html.embed .games-grid,
html.embed .games-row .games-grid {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 22px;
}
html.embed .game-card { border-radius: 26px; }
html.embed .game-card .name { font-size: 19px; }
html.embed .game-card .info { padding: 14px 16px 18px; }

/* accessibility settings */
html.reduce-motion *,
html.reduce-motion *::before,
html.reduce-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}
html.high-contrast {
  --border: #000000;
  --text: #000000;
  --text-muted: #1a1a1a;
  --bg: #ffffff;
  --bg-elevated: #ffffff;
  --shadow: rgba(0, 0, 0, 0.55);
}
html.high-contrast[data-theme="dark"],
html.high-contrast[data-theme="midnight"] {
  --border: #ffffff;
  --text: #ffffff;
  --text-muted: #e6e6e6;
  --bg: #000000;
  --bg-elevated: #000000;
  --shadow: rgba(0, 0, 0, 0.9);
}
html.high-contrast .game-card,
html.high-contrast .pill,
html.high-contrast .settings-group { border-width: 2px; }

#page-transition {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
}

#page-transition.pt-visible {
  animation: ptFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: all;
}

#page-transition.pt-out {
  animation: ptFadeOut 0.38s cubic-bezier(0.4, 0, 1, 1) forwards;
  pointer-events: none;
}

@keyframes ptFadeIn {
  from { opacity: 0; transform: scale(1.04); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes ptFadeOut {
  to { opacity: 0; transform: scale(0.95); }
}

.pt-spinner {
  position: relative;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pt-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--accent);
  border-right-color: var(--accent-bright);
  animation: ptSpin 1.1s cubic-bezier(0.6, 0.2, 0.4, 0.8) infinite;
}

.pt-ring2 {
  inset: 9px;
  border-top-color: transparent;
  border-right-color: transparent;
  border-bottom-color: var(--accent);
  border-left-color: var(--accent-bright);
  animation-duration: 0.8s;
  animation-direction: reverse;
}

@keyframes ptSpin { to { transform: rotate(360deg); } }

.pt-msg {
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

.pt-msg.pt-msg-in {
  animation: ptMsgFade 0.35s ease;
}

@keyframes ptMsgFade {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.click-glow {
  position: fixed;
  z-index: 99999;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  margin-top: -6px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-bright) 0%, var(--accent) 40%, transparent 72%);
  box-shadow: 0 0 16px 4px var(--accent-glow);
  pointer-events: none;
  animation: clickGlowPulse 0.55s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}

@keyframes clickGlowPulse {
  0%   { transform: scale(0.3); opacity: 0.9; }
  70%  { opacity: 0.5; }
  100% { transform: scale(3.2); opacity: 0; }
}

.cloud-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 2px 8px var(--shadow);
}

.cloud-badge .material-symbols-rounded { font-size: 16px; }

#stickyNav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px clamp(16px, 4vw, 32px);
  background: var(--bg-elevated);
  border-bottom: 2px solid var(--border);
  box-shadow: 0 6px 16px var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

#stickyNav.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }

.sticky-nav-brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  color: var(--accent-bright);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.sticky-nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.sticky-nav-links::-webkit-scrollbar { display: none; }

.sticky-nav-links a {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 6px 12px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12px;
  text-decoration: none;
  text-transform: lowercase;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.sticky-nav-links a .material-symbols-rounded { font-size: 16px; }
.sticky-nav-links a:hover { border-color: var(--accent); color: var(--accent-bright); }
.sticky-nav-links a.active { background: var(--accent); border-color: var(--accent); color: #ffffff; }

.sticky-nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}

.sticky-nav-search { padding: 6px 12px; }
.sticky-nav-search .search-input { width: 130px; font-size: 13px; }
.sticky-nav-search .search-icon { font-size: 17px; }

#stickyNavTheme { width: 34px; height: 34px; }
#stickyNavTheme .material-symbols-rounded { font-size: 18px; }

@media (max-width: 900px) {
  .sticky-nav-links a .sticky-nav-label { display: none; }
  .sticky-nav-search { display: none; }
}
