/* Design tokens — see docs/DESIGN.md. Light is the default; dark follows the system
   unless the visitor picked a theme (html[data-theme]). */
:root {
  --bg: #f6f5f1;
  --bg-glow-1: rgb(91 140 255 / 0.16);
  --bg-glow-2: rgb(139 108 255 / 0.12);
  --surface: #ffffff;
  --surface-2: #f1efe9;
  --text: #17161a;
  --muted: #6b6875;
  --border: #e6e2d9;
  --accent: #3f6ef0;
  --accent-2: #7c5cff;
  --accent-text: #ffffff;
  --tile-bg: #ffffff;
  --tile-border: #dcd8ce;
  --tile-text: #17161a;
  --shadow: 0 1px 2px rgb(20 18 30 / 0.05), 0 12px 32px -12px rgb(20 18 30 / 0.12);
  --radius: 18px;
  --radius-sm: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0f13;
    --bg-glow-1: rgb(91 140 255 / 0.14);
    --bg-glow-2: rgb(139 108 255 / 0.12);
    --surface: #16171d;
    --surface-2: #1c1e26;
    --text: #ecebf1;
    --muted: #9b99a8;
    --border: #262833;
    --accent: #6f97ff;
    --accent-2: #a08bff;
    --accent-text: #0e0f13;
    --tile-bg: #1d1f28;
    --tile-border: #2f3240;
    --tile-text: #ecebf1;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 16px 40px -16px rgb(0 0 0 / 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0f13;
  --bg-glow-1: rgb(91 140 255 / 0.14);
  --bg-glow-2: rgb(139 108 255 / 0.12);
  --surface: #16171d;
  --surface-2: #1c1e26;
  --text: #ecebf1;
  --muted: #9b99a8;
  --border: #262833;
  --accent: #6f97ff;
  --accent-2: #a08bff;
  --accent-text: #0e0f13;
  --tile-bg: #1d1f28;
  --tile-border: #2f3240;
  --tile-text: #ecebf1;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 16px 40px -16px rgb(0 0 0 / 0.6);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base */
*,
*::before,
*::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(900px 480px at 85% -10%, var(--bg-glow-1), transparent 70%),
    radial-gradient(700px 420px at -10% 10%, var(--bg-glow-2), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
main { flex: 1; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; margin: 0; }
p { margin: 0; }

.container { width: min(1080px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 10;
  background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); text-decoration: none; transition: top 0.15s ease;
}
.skip-link:focus { top: 12px; }

/* ---------------------------------------------------------------- header */
.site-header { padding: 20px 0; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.brand { text-decoration: none; display: inline-flex; border-radius: 10px; }
.brand-tiles { display: inline-flex; gap: 4px; }
.brand-tile {
  display: grid; place-items: center;
  width: 30px; height: 34px;
  font-weight: 800; font-size: 1rem; text-transform: uppercase;
  background: var(--tile-bg); color: var(--tile-text);
  border: 1px solid var(--tile-border); border-radius: 8px;
  box-shadow: 0 1px 0 var(--tile-border);
  transition: transform 0.2s ease;
}
.brand-tile:first-child {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent; color: #fff; box-shadow: none;
}
.brand-gap { width: 8px; }
.brand:hover .brand-tile { transform: translateY(-2px); }
.brand:hover .brand-tile:nth-child(2) { transition-delay: 0.03s; }
.brand:hover .brand-tile:nth-child(3) { transition-delay: 0.06s; }
.brand:hover .brand-tile:nth-child(4) { transition-delay: 0.09s; }
.brand:hover .brand-tile:nth-child(5) { transition-delay: 0.12s; }

.header-nav { display: flex; align-items: center; gap: 8px; }
.nav-link {
  text-decoration: none; font-weight: 600; font-size: 0.95rem; color: var(--muted);
  padding: 6px 10px; border-radius: 8px;
}
.nav-link:hover { color: var(--text); background: var(--surface-2); }

.lang-select, .icon-btn {
  font: inherit; font-size: 0.85rem; font-weight: 700; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  height: 36px; cursor: pointer;
}
.lang-select { padding: 0 8px; }
.icon-btn { width: 36px; display: grid; place-items: center; padding: 0; }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .icon-moon { fill: currentColor; stroke: none; }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  padding: 11px 20px; border-radius: 12px; border: 1px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 8px 20px -10px var(--accent);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 26px -10px var(--accent); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); }

/* ---------------------------------------------------------------- hero */
.hero { padding: clamp(48px, 10vw, 112px) 0 clamp(40px, 7vw, 80px); max-width: 760px; }
.kicker {
  display: inline-block; margin-bottom: 18px;
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  padding: 6px 12px; border-radius: 999px;
}
.hero-title { font-size: clamp(2.3rem, 6.5vw, 4.2rem); font-weight: 800; letter-spacing: -0.035em; margin-bottom: 18px; }
.hero-subtitle { font-size: clamp(1.05rem, 2.2vw, 1.25rem); color: var(--muted); max-width: 600px; margin-bottom: 30px; }

/* ---------------------------------------------------------------- games */
.games { padding-bottom: clamp(56px, 9vw, 112px); scroll-margin-top: 24px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.section-head h2 { font-size: clamp(1.6rem, 3.5vw, 2.1rem); font-weight: 800; }

.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 20px; }

.game-card {
  --game-accent: var(--accent);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.game-card:not(.game-card--soon):hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--game-accent) 45%, var(--border)); }

.game-art {
  display: grid; place-items: center; min-height: 168px;
  background:
    radial-gradient(120% 120% at 0% 0%, color-mix(in srgb, var(--game-accent) 30%, transparent), transparent 60%),
    radial-gradient(120% 120% at 100% 100%, color-mix(in srgb, var(--accent-2) 26%, transparent), transparent 60%),
    var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.tiles { display: flex; gap: 8px; perspective: 600px; }
.tile {
  display: grid; place-items: center;
  width: 52px; height: 58px;
  font: 800 1.7rem/1 var(--font); text-transform: uppercase;
  color: var(--tile-text); background: var(--tile-bg);
  border: 1px solid var(--tile-border); border-radius: 12px;
  box-shadow: 0 2px 0 var(--tile-border);
  transform-style: preserve-3d;
}
.tile.is-changing { animation: tile-flip 0.5s ease; }
.tile.is-new { background: linear-gradient(135deg, var(--game-accent), var(--accent-2)); color: #fff; border-color: transparent; box-shadow: none; }
@keyframes tile-flip {
  0% { transform: rotateX(0); }
  50% { transform: rotateX(90deg); }
  100% { transform: rotateX(0); }
}

.game-body { display: flex; flex-direction: column; gap: 12px; padding: 22px; flex: 1; }
.game-title { font-size: 1.35rem; font-weight: 800; }
.game-desc { color: var(--muted); }
.game-tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.game-tags li {
  font-size: 0.78rem; font-weight: 600; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px;
}
.game-body .btn { margin-top: auto; align-self: flex-start; }

.game-card--soon {
  background: transparent; box-shadow: none; border-style: dashed;
  justify-content: center; min-height: 220px; text-align: center;
}
.game-card--soon .game-body { align-items: center; justify-content: center; }
.game-card--soon .game-title { font-size: 1.1rem; color: var(--muted); }

/* ---------------------------------------------------------------- footer */
.site-footer { border-top: 1px solid var(--border); padding: 26px 0; font-size: 0.9rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- 404 */
.not-found { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; padding: clamp(48px, 10vw, 120px) 0; }
.not-found h1 { font-size: clamp(2rem, 5vw, 3rem); font-weight: 800; }
.tiles--lg .tile { width: 64px; height: 72px; font-size: 2.2rem; }
.tile--accent { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-color: transparent; box-shadow: none; }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 520px) {
  .site-header { padding: 14px 0; }
  .brand-tile { width: 26px; height: 30px; font-size: 0.9rem; }
  .nav-link { display: none; }
  .tile { width: 44px; height: 50px; font-size: 1.45rem; }
  .game-body { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
