:root {
  --bg: #0b0f16;
  --surface: #151c28;
  --surface-2: #1c2534;
  --line: rgba(255, 255, 255, 0.09);
  --text: #e8edf5;
  --muted: #96a3b7;
  --accent: #6ee7b7;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.wrap { width: min(1080px, calc(100% - 32px)); margin: 0 auto; }

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(11, 15, 22, 0.9);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
  flex-wrap: nowrap;
}

.brand { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; flex: none; }
.brand span { color: var(--accent); }

.nav { display: flex; gap: 18px; font-size: 14px; color: var(--muted); margin-right: auto; }
.nav a:hover { color: var(--text); }
.nav a.is-active { color: var(--text); }

[hidden] { display: none !important; }

/* Language dropdown — always pinned to the far right of the header */
.lang-menu { position: relative; margin-left: auto; flex: none; z-index: 20; }
.lang-menu > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 7px 11px;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  white-space: nowrap;
  user-select: none;
}
.lang-menu > summary::-webkit-details-marker { display: none; }
.lang-menu > summary::marker { content: ''; }
.lang-menu[open] > summary { border-color: var(--accent); }
.lang-menu .chev { color: var(--muted); font-size: 10px; transition: transform 0.15s ease; }
.lang-menu[open] .chev { transform: rotate(180deg); }
.lang-options {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 186px;
  padding: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.5);
}
.lang-options a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
}
.lang-options a:hover { background: rgba(255, 255, 255, 0.07); }
.lang-options a.is-active { color: var(--accent); }
.lang-code { font-size: 11px; letter-spacing: 0.06em; color: var(--muted); }
.lang-options a.is-active .lang-code { color: var(--accent); }

/* Non-blocking language suggestion. It never redirects the visitor. */
.lang-suggest {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  font-size: 13px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  text-align: center;
}
.lang-suggest-actions { display: inline-flex; align-items: center; gap: 8px; }
.lang-suggest-switch {
  padding: 5px 12px;
  border-radius: 8px;
  background: var(--accent);
  color: #07130e;
  font-weight: 600;
}
.lang-suggest-dismiss {
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.lang-suggest-dismiss:hover { color: var(--text); }

.hero { padding: 64px 0 40px; }
.hero h1 { font-size: clamp(30px, 5vw, 48px); line-height: 1.15; margin: 0 0 14px; letter-spacing: -0.03em; }
.hero p { color: var(--muted); font-size: 17px; max-width: 660px; margin: 0 0 24px; }

.eyebrow {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #07130e; border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }

.section { padding: 26px 0 10px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-head h2 { font-size: 22px; margin: 0; letter-spacing: -0.02em; }
.section-head a { font-size: 13px; color: var(--muted); }

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

.game-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.game-card:hover { transform: translateY(-3px); border-color: var(--accent); }

.thumb {
  height: 118px;
  display: grid;
  place-items: center;
  font-size: 46px;
  font-weight: 700;
  color: var(--accent);
  background:
    radial-gradient(circle at 25% 25%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 60%),
    var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.thumb span { opacity: 0.85; }

.game-card .body { padding: 14px 16px 16px; }
.game-card h3 { margin: 0 0 6px; font-size: 17px; }
.game-card p { margin: 0 0 12px; color: var(--muted); font-size: 13px; line-height: 1.5; min-height: 39px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font-size: 11px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }

.originals {
  margin: 24px 0 8px;
  padding: 26px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: var(--radius);
  background: linear-gradient(120deg, color-mix(in srgb, var(--accent) 10%, var(--surface)), var(--surface));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.originals h2 { margin: 0 0 8px; font-size: 20px; }
.originals p { margin: 0; color: var(--muted); font-size: 14px; max-width: 620px; }

.detail { padding: 44px 0 10px; }
.detail h1 { font-size: clamp(28px, 4vw, 40px); margin: 0 0 12px; letter-spacing: -0.03em; }
.detail .lead { color: var(--muted); font-size: 17px; max-width: 680px; margin: 0 0 22px; }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 30px; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 28px; }
.info-box { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.info-box h3 { margin: 0 0 8px; font-size: 14px; color: var(--accent); }
.info-box p { margin: 0; font-size: 13px; color: var(--muted); }

.prose { padding: 40px 0; max-width: 720px; }
.prose h1 { font-size: 30px; }
.prose p { color: var(--muted); }

.site-footer { border-top: 1px solid var(--line); margin-top: 44px; padding: 26px 0 36px; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.site-footer a:hover { color: var(--text); }

.game-page { width: min(760px, calc(100% - 24px)); margin: 0 auto; padding: 22px 0 40px; }
.game-page .back { display: inline-block; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.game-page .back:hover { color: var(--text); }
.game-page h1 { font-size: 28px; margin: 0 0 4px; letter-spacing: -0.02em; }
.game-page .sub { color: var(--muted); font-size: 14px; margin: 0 0 16px; }

.hud {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 13px;
}
.hud .stat { color: var(--muted); }
.hud .stat b { color: var(--text); font-size: 16px; margin-left: 5px; font-variant-numeric: tabular-nums; }
.hud .spacer { flex: 1 1 auto; }
.hud button { padding: 7px 13px; font-size: 13px; }

.board-wrap {
  position: relative;
  background: #070b12;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  display: grid;
  place-items: center;
}
canvas#board { display: block; width: 100%; height: auto; touch-action: none; }

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 12px;
  text-align: center;
  background: rgba(7, 11, 18, 0.84);
  padding: 20px;
}
.overlay[hidden] { display: none; }
.overlay h2 { margin: 0; font-size: 26px; }
.overlay p { margin: 0; color: var(--muted); font-size: 14px; }
.overlay .btn { margin: 0 auto; }

.game-hint { color: var(--muted); font-size: 13px; margin: 12px 0 0; }
.touchpad { display: none; gap: 8px; justify-content: center; margin-top: 12px; }
.touchpad button { width: 56px; height: 48px; font-size: 18px; }
.touchpad .pad-grid { display: grid; grid-template-columns: repeat(3, 56px); gap: 8px; }

.game-originals { margin-top: 22px; }
.game-originals .originals { margin: 0; }

@media (max-width: 640px) {
  .hero { padding: 38px 0 26px; }
  .hero p { font-size: 15px; }
  .touchpad { display: flex; }
  .hud { gap: 10px; }
  .hud .stat b { font-size: 14px; }
  .game-page h1 { font-size: 23px; }
  .site-header .wrap { gap: 10px; }
  .nav { gap: 12px; font-size: 13px; }
  .nav a:nth-child(n+3) { display: none; }
  .lang-menu > summary .lang-current { display: none; }
  .lang-suggest { font-size: 12px; padding: 9px 12px; }
}
