/* =============================================================
   BoardNook — dark neon theme
   ============================================================= */
:root {
  --bg: #0d0b1e;
  --bg-side: #120f27;
  --surface: #1a1634;
  --surface-2: #231e45;
  --surface-3: #2d2759;
  --line: #2f2960;
  --ink: #efedff;
  --muted: #aaa5d2;
  --accent: #b768ff;
  --accent-2: #ec5bff;
  --accent-ink: #fff;
  --grad: linear-gradient(135deg, #8b3dff, #d63cff);
  --focus: #f5a8ff;

  /* board/game tokens */
  --t-red: #ff3d7f;
  --t-gold: #ffd23f;
  --t-black: #15121f;
  --t-white: #f4f2ff;
  --t-wood: #e9c98f;
  --t-woodline: #9b6b34;
  --p1: #ff4fb0;
  --p2: #3df5ff;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font-head: "Orbitron", "Segoe UI", system-ui, sans-serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --side-w: 244px;
  color-scheme: dark;
}

/* per-language fonts (loaded in <head> from src/languages.js): Orbitron/Figtree have no Vietnamese or Japanese glyphs */
html[lang="vi"] { --font-head: "Chakra Petch", "Segoe UI", system-ui, sans-serif; --font-body: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif; }
html[lang="ja"] {
  --font-head: "Dela Gothic One", "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;
  --font-body: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  font-synthesis: none; line-break: strict;
}
html[lang="ja"] :is(h1, .sec-title, .slide-title, .card-title, .promo-big, .cta-title, .overlay-title, .side-h, .slide-tag) { letter-spacing: 0; font-weight: 400; }
html[lang="ja"] .brand { font-family: "Orbitron", var(--font-head); font-weight: 800; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0; color: var(--ink); font: 16px/1.6 var(--font-body); -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(139, 61, 255, .22), transparent 60%),
    radial-gradient(700px 500px at 0% 100%, rgba(214, 60, 255, .10), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
body.no-scroll { overflow: hidden; }
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; text-wrap: balance; }
/* long words (German compounds in uppercase display font) must wrap instead of widening the page */
h1, h2, h3, .slide-title, .card-title, .cta-title, .overlay-title { overflow-wrap: break-word; hyphens: auto; }
.card-title { overflow-wrap: anywhere; }
h1 { font: 800 clamp(1.5rem, 3.4vw, 2.2rem)/1.15 var(--font-head); text-transform: uppercase; letter-spacing: .02em; }
h2 { font-size: clamp(1.25rem, 2.4vw, 1.5rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.i { width: 20px; height: 20px; flex: none; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: #fff; padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- buttons & controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 700 .92rem var(--font-body); color: var(--accent-ink); background: var(--grad);
  border: 0; border-radius: var(--radius-sm); padding: 10px 18px; min-height: 42px; cursor: pointer;
  text-decoration: none; transition: filter .15s, transform .15s, box-shadow .15s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: scale(.97); }
.btn .i { width: 18px; height: 18px; }
.btn.ghost { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn.ghost:hover { box-shadow: inset 0 0 0 1px var(--accent); }
.btn[hidden], .icon-btn[hidden] { display: none; }
.btn:disabled { opacity: .45; cursor: default; filter: none; transform: none; }
.btn-glow { box-shadow: 0 0 0 1px rgba(255, 255, 255, .12) inset, 0 6px 22px rgba(190, 60, 255, .45); }
.btn-lg { font-size: 1rem; padding: 12px 24px; min-height: 48px; border-radius: 12px; }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: .88rem; }
.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; flex: none;
  border: 0; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink); cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .15s, background .15s;
}
.icon-btn:hover { box-shadow: inset 0 0 0 1px var(--accent); }

/* ---------- app layout: sidebar + main ---------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.main-col { display: flex; flex-direction: column; min-width: 0; }
.content { width: 100%; max-width: 1240px; margin: 0 auto; padding: 18px 24px 40px; flex: 1; }

.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg-side); border-right: 1px solid var(--line); padding: 14px 12px 20px;
  scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent;
}
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 14px; }
.side-close { display: none; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 800 1.02rem var(--font-head); letter-spacing: .03em; text-transform: uppercase; }
.brand-mark { width: 34px; height: 34px; filter: drop-shadow(0 0 10px rgba(190, 60, 255, .5)); }
.side-h { font: 700 .75rem var(--font-head); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 18px 10px 8px; }
.side-nav { display: grid; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 8px 12px; border-radius: var(--radius-sm);
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: .94rem; transition: background .15s;
}
.side-nav a .i { color: var(--muted); }
.side-nav a:hover { background: var(--surface-2); }
.side-nav a[aria-current="page"] { background: var(--grad); box-shadow: 0 4px 18px rgba(190, 60, 255, .35); }
.side-nav a[aria-current="page"] .i { color: #fff; }
.side-games img { width: 26px; height: 26px; border-radius: 7px; }
/* game count next to a category name */
.count {
  display: inline-grid; place-items: center; min-width: 24px; height: 20px; padding: 0 7px; border-radius: 999px;
  font: 700 .72rem/1 var(--font-body); font-variant-numeric: tabular-nums; color: var(--muted); background: var(--surface-2);
}
.side-nav a .label { flex: 1; min-width: 0; }
.side-nav a[aria-current="page"] .count { color: #fff; background: rgba(255, 255, 255, .2); }
.filters button .count { margin-left: 6px; height: 18px; min-width: 20px; padding: 0 6px; }
.filters button[aria-pressed="true"] .count { color: #fff; background: rgba(255, 255, 255, .22); }
.side-promo {
  display: grid; gap: 2px; margin-top: 20px; padding: 16px; border-radius: var(--radius); text-decoration: none; color: #fff;
  background: radial-gradient(circle at 85% 20%, rgba(255, 255, 255, .25), transparent 40%), var(--grad);
  box-shadow: 0 8px 26px rgba(190, 60, 255, .3);
}
.side-promo-t { font: 800 .9rem var(--font-head); text-transform: uppercase; }
.side-promo-d { font-size: .88rem; opacity: .9; }
.scrim { position: fixed; inset: 0; background: rgba(5, 3, 15, .65); z-index: 39; backdrop-filter: blur(2px); }
.scrim[hidden] { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: 12px 24px; background: rgba(13, 11, 30, .82); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.menu-btn, .brand-top { display: none; }
.brand-top { flex: none; }
.search { position: relative; flex: 1; min-width: 0; max-width: 460px; margin-right: auto; }
.search-box {
  display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px; border-radius: 999px;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); cursor: text;
}
.search-box:focus-within { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px rgba(183, 104, 255, .2); }
.search-box input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: 500 16px var(--font-body); outline: none; }
.search-box input::placeholder { color: var(--muted); }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 35; padding: 6px; border-radius: 14px;
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line), var(--shadow);
}
.search-results a { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 600; }
.search-results a:hover, .search-results a:focus-visible { background: var(--surface-3); outline: none; }
.search-results img { width: 32px; height: 32px; border-radius: 8px; }
.search-empty { padding: 10px; margin: 0; color: var(--muted); }
.random-btn { flex: none; }
[data-sound-toggle] .i-off, [data-sound-toggle][aria-pressed="false"] .i-on { display: none; }
[data-sound-toggle][aria-pressed="false"] .i-off { display: block; }
/* sidebar buttons that replace topbar buttons on phones */
.side-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 42px; padding: 8px 12px; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--ink); font: 600 .94rem var(--font-body); cursor: pointer; text-align: left;
}
.side-btn .i { color: var(--muted); }
.side-btn:hover { background: var(--surface-2); }
.side-btn[aria-pressed="false"] { color: var(--muted); }
.mobile-only { display: none; }
.sound-btn[aria-pressed="false"] { color: var(--muted); }
.i-sm { width: 16px; height: 16px; }

.lang-menu { position: relative; flex: none; }
.lang-menu summary {
  display: flex; align-items: center; gap: 6px; height: 42px; padding: 0 12px; border-radius: var(--radius-sm); cursor: pointer;
  list-style: none; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); font: 700 .85rem var(--font-body); color: var(--ink);
}
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary:hover, .lang-menu[open] summary { box-shadow: inset 0 0 0 1px var(--accent); }
.lang-menu[open] summary .i-sm { transform: rotate(180deg); }
.lang-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 36; min-width: 190px; padding: 6px; border-radius: 14px;
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line), var(--shadow); display: grid;
}
.lang-list a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font: 600 .95rem system-ui, sans-serif; }
/* national flag in front of each language */
.flag { display: block; flex: none; width: 22px; height: 15px; border-radius: 3px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .25); }
.lang-list a:hover { background: var(--surface-3); }
.lang-list a[aria-current="true"] { background: var(--grad); color: #fff; }

@media (max-width: 1023px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(290px, 86vw); z-index: 40;
    transform: translateX(-100%); visibility: hidden; transition: transform .25s ease, visibility 0s .25s;
  }
  .sidebar.open { transform: none; visibility: visible; transition: transform .25s ease; }
  .side-close, .menu-btn { display: inline-grid; }
  .brand-top { display: inline-flex; }
  .topbar { padding: 10px 16px; gap: 10px; }
  .content { padding: 16px 16px 32px; }
}
@media (max-width: 680px) {
  .brand-top span { display: none; }
  .random-btn, .sound-btn, .lang-menu summary > .i-sm { display: none; }
  .lang-menu summary:has(.flag) > span { display: none; } /* the flag is enough on phones: more room for search */
  .mobile-only { display: flex; }
  .random-btn { width: 44px; padding: 0; }
  .lang-menu summary { padding: 0 9px; }
  .topbar { gap: 8px; }
  .search { max-width: none; }
}

/* ---------- footer ---------- */
.site-footer { margin-top: 24px; border-top: 1px solid var(--line); padding: 26px 24px 20px; background: rgba(18, 15, 39, .6); }
.footer-in { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px 32px; max-width: 1240px; margin: 0 auto; }
.footer-in p { margin: 8px 0 0; font-size: .92rem; }
.brand-sm .brand-mark { width: 28px; height: 28px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 20px; align-content: start; }
.footer-links a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: .92rem; padding: 6px 0; }
.footer-links a:hover { color: var(--accent); }
.footer-base { max-width: 1240px; margin: 18px auto 0; color: var(--muted); font-size: .85rem; }

/* ---------- section titles ---------- */
.section { margin-top: 40px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; padding-bottom: 12px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.sec-title { font: 800 1.05rem var(--font-head); text-transform: uppercase; letter-spacing: .06em; margin: 0; }
.sec-title span { color: var(--accent-2); text-shadow: 0 0 18px rgba(236, 91, 255, .55); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters button, .seg button {
  font: 600 .88rem var(--font-body); color: var(--ink); background: var(--surface-2); border: 0;
  box-shadow: inset 0 0 0 1px var(--line); border-radius: 999px; padding: 8px 14px; min-height: 38px; cursor: pointer;
  transition: background .15s, box-shadow .15s;
}
.filters button:hover, .seg button:hover { box-shadow: inset 0 0 0 1px var(--accent); }
.filters button[aria-pressed="true"], .seg button[aria-pressed="true"] { background: var(--grad); box-shadow: 0 4px 16px rgba(190, 60, 255, .35); color: #fff; }

/* ---------- home ---------- */
.home-intro { display: flex; align-items: baseline; gap: 6px 14px; flex-wrap: wrap; margin: 4px 0 14px; }
.home-intro h1 { font-size: clamp(1.1rem, 2.2vw, 1.35rem); margin: 0; }
.home-intro p { margin: 0; color: var(--muted); }

.hero { position: relative; border-radius: 22px; overflow: hidden; background: var(--surface); box-shadow: 0 0 0 1px rgba(255, 255, 255, .06) inset, var(--shadow); }
.hero-track { display: grid; }
.slide {
  grid-area: 1 / 1; position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 20px;
  min-height: 330px; padding: 36px 48px 64px; overflow: hidden; isolation: isolate;
  background: radial-gradient(circle at 78% 45%, color-mix(in srgb, var(--glow) 40%, transparent), transparent 50%), linear-gradient(115deg, var(--c1), var(--c2) 75%);
  opacity: 0; visibility: hidden; transition: opacity .5s ease, visibility 0s .5s;
}
.slide.is-active { opacity: 1; visibility: visible; transition: opacity .5s ease; }
.slide::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: repeating-linear-gradient(115deg, transparent 0 70px, rgba(255, 255, 255, .035) 70px 140px);
}
.slide-tag { display: inline-flex; align-items: center; gap: 6px; font: 700 .75rem var(--font-head); letter-spacing: .12em; text-transform: uppercase; color: var(--glow); margin-bottom: 10px; }
.slide-tag .i { width: 16px; height: 16px; }
.slide-title { font: 800 clamp(1.7rem, 4.6vw, 3.2rem)/1.05 var(--font-head); text-transform: uppercase; letter-spacing: .02em; margin: 0 0 12px; text-shadow: 0 0 30px color-mix(in srgb, var(--glow) 60%, transparent); }
.slide-desc { font-size: 1.1rem; max-width: 34ch; color: #e6e2ff; margin-bottom: 22px; }
.slide-art img {
  width: 210px; height: auto; border-radius: 18px; transform: rotate(5deg);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .18), 0 24px 50px rgba(0, 0, 0, .5), 0 0 60px color-mix(in srgb, var(--glow) 55%, transparent);
}
.slide.is-active .slide-art img { animation: float 6s ease-in-out infinite; }
@keyframes float { 50% { transform: rotate(5deg) translateY(-8px); } }
.hero-ctrl { position: absolute; left: 48px; bottom: 16px; display: flex; align-items: center; gap: 8px; z-index: 2; }
.hero-ctrl .icon-btn { width: 36px; height: 36px; background: rgba(0, 0, 0, .25); }
.hero-dots { display: flex; gap: 2px; }
.hero-dots button { width: 28px; height: 28px; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; padding: 0; }
.hero-dots button::before { content: ""; width: 8px; height: 8px; border-radius: 999px; background: rgba(255, 255, 255, .4); transition: width .25s, background .25s; }
.hero-dots button[aria-current="true"]::before { width: 22px; background: #fff; }

.quick { display: flex; gap: 10px; overflow-x: auto; padding: 14px 2px 6px; margin-top: 4px; scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
.quick-chip {
  display: flex; align-items: center; gap: 10px; flex: none; padding: 6px 16px 6px 6px; border-radius: 14px;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); text-decoration: none; font-weight: 600; font-size: .94rem;
  transition: box-shadow .15s, transform .15s;
}
.quick-chip:hover { box-shadow: inset 0 0 0 1px var(--accent), 0 6px 18px rgba(190, 60, 255, .25); transform: translateY(-2px); }
.quick-chip img { width: 36px; height: 36px; border-radius: 10px; }

.promos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 16px; }
.promo {
  position: relative; overflow: hidden; min-height: 150px; padding: 20px 22px; border-radius: var(--radius);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .07) inset; isolation: isolate;
}
.promo::after { content: ""; position: absolute; inset: 0; z-index: -1; background: repeating-linear-gradient(120deg, transparent 0 50px, rgba(255, 255, 255, .04) 50px 100px); }
.promo-1 { background: linear-gradient(130deg, #5b21b6, #1e1150); }
.promo-2 { background: linear-gradient(130deg, #a21caf, #2a0f45); }
.promo-3 { background: linear-gradient(130deg, #3730a3, #120f3a); }
.promo-icon {
  position: absolute; right: 18px; top: 50%; transform: translateY(-50%); width: 84px; height: 84px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(255, 255, 255, .1); box-shadow: 0 0 40px rgba(236, 91, 255, .45); color: #fff;
}
.promo-icon .i { width: 40px; height: 40px; stroke-width: 1.6; }
.promo-big { font: 800 clamp(1.05rem, 1.6vw, 1.5rem)/1.1 var(--font-head); text-transform: uppercase; margin: 6px 0 8px; max-width: 64%; }
.promo-sub { font-size: .95rem; color: #ddd8ff; margin: 0; max-width: 58%; }

.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 18px 14px; }
.card { display: block; color: var(--ink); text-decoration: none; }
.card[hidden] { display: none; }
.card-art {
  position: relative; display: block; aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden; background: var(--surface-2);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .08) inset, 0 8px 20px rgba(0, 0, 0, .35); transition: transform .2s ease, box-shadow .2s ease;
}
.card-art img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.card-art::after { content: ""; position: absolute; inset: 55% 0 0; background: linear-gradient(transparent, rgba(8, 5, 20, .92)); }
.card-title {
  position: relative; z-index: 1; margin: -62px 8px 0; height: 50px; display: flex; align-items: center; justify-content: center; text-align: center;
  font: 800 .9rem/1.15 var(--font-head); text-transform: uppercase; letter-spacing: .03em; color: #fff;
  text-shadow: 0 0 16px color-mix(in srgb, var(--glow) 80%, transparent), 0 2px 4px rgba(0, 0, 0, .6);
}
.card-meta { display: flex; align-items: center; gap: 6px; margin-top: 18px; font-size: .84rem; color: var(--muted); }
.card-meta::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--glow); box-shadow: 0 0 8px var(--glow); }
.card:hover .card-art, .card:focus-visible .card-art { transform: translateY(-4px); box-shadow: 0 0 0 2px var(--glow), 0 14px 34px color-mix(in srgb, var(--glow) 35%, transparent); }
.card:hover .card-art img { transform: scale(1.05); }
.grid-empty { padding: 20px 0; }

.cta {
  position: relative; overflow: hidden; margin-top: 44px; border-radius: 22px; padding: 40px 24px; text-align: center; isolation: isolate;
  background: radial-gradient(circle at 50% 120%, rgba(255, 255, 255, .2), transparent 50%), linear-gradient(110deg, #3b0f80, #a21caf 55%, #4c1d95);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .08) inset, 0 20px 50px rgba(160, 40, 220, .25);
}
.cta-in { position: relative; z-index: 1; }
.cta-title { font: 800 clamp(1.6rem, 4vw, 2.6rem) var(--font-head); text-transform: uppercase; letter-spacing: .04em; margin: 0 0 6px; text-shadow: 0 0 30px rgba(255, 255, 255, .35); }
.cta p { color: #f0e9ff; margin-bottom: 20px; }
.cta-art { position: absolute; width: 150px; height: auto; border-radius: 16px; opacity: .9; box-shadow: 0 20px 40px rgba(0, 0, 0, .45); }
.cta-art-l { left: 4%; top: 22px; transform: rotate(-10deg); }
.cta-art-r { right: 4%; top: 30px; transform: rotate(9deg); }

/* ---------- faq ---------- */
.faq details { background: var(--surface); border-radius: 12px; margin-bottom: 8px; box-shadow: inset 0 0 0 1px var(--line); }
.faq details[open] { box-shadow: inset 0 0 0 1px var(--surface-3); }
.faq summary { cursor: pointer; padding: 14px 48px 14px 16px; font-weight: 600; list-style: none; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 1.3rem; color: var(--accent); }
.faq details[open] summary::after { content: "–"; }
.faq details p { padding: 0 16px 14px; margin: 0; color: var(--muted); }
.section.faq { max-width: 860px; }

/* ---------- game page ---------- */
.crumbs { display: flex; gap: 8px; font-size: .88rem; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--muted); }
.game-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.game-head-icon { width: 56px; height: 56px; border-radius: 14px; box-shadow: 0 0 26px color-mix(in srgb, var(--glow) 55%, transparent); }
.game-head-text { flex: 1; min-width: 200px; }
.game-head h1 { margin: 0 0 2px; }
.game-head p { margin: 0; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips span { font-size: .8rem; font-weight: 600; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); padding: 4px 11px; border-radius: 999px; }

.play-area {
  position: relative; padding: 14px; border-radius: 20px; background: var(--surface);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--glow, #b768ff) 30%, transparent) inset, 0 0 60px color-mix(in srgb, var(--glow, #b768ff) 12%, transparent), var(--shadow);
}
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.seg { display: inline-flex; background: var(--bg); border-radius: 999px; padding: 3px; gap: 2px; box-shadow: inset 0 0 0 1px var(--line); }
.seg button { box-shadow: none; background: transparent; padding: 6px 14px; min-height: 36px; }
.sel { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; color: var(--muted); font-weight: 600; }
.sel select {
  font: 600 .9rem var(--font-body); color: var(--ink); background-color: var(--surface-2); min-height: 38px;
  border: 0; box-shadow: inset 0 0 0 1px var(--line); border-radius: 10px; padding: 6px 30px 6px 12px; appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px; background-repeat: no-repeat;
}
.sel select option { background: var(--surface-2); }
.play-area.mode-2p .cpu-only { display: none; }
.extra-controls { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.extra-controls:empty { display: none; }
.toolbar-actions { display: flex; gap: 8px; margin-left: auto; }
@media (max-width: 600px) {
  .play-area { padding: 10px; border-radius: 16px; margin: 0 -6px; }
  .toolbar { gap: 8px; }
  .sel > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .toolbar-actions { margin-left: 0; width: 100%; }
  .toolbar-actions .btn { flex: 1; }
  .statusbar { gap: 8px; font-size: .92rem; }
}

.statusbar {
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  min-height: 46px; padding: 8px 12px; margin-bottom: 12px; border-radius: 12px; background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; text-align: center;
}
.statusbar .who { display: inline-flex; align-items: center; gap: 8px; }
.dot { display: inline-block; width: 16px; height: 16px; border-radius: 50%; flex: none; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .18); }
.score { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 999px; background: var(--surface-2); }
.score.active { box-shadow: 0 0 0 2px var(--accent); }
.thinking::after { content: ""; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

.board-wrap { position: relative; display: flex; justify-content: center; padding: 4px 0 6px; }
.board { position: relative; touch-action: manipulation; user-select: none; -webkit-user-select: none; }

.overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(8, 5, 20, .55); backdrop-filter: blur(2px); border-radius: 14px; z-index: 5; animation: fade .2s ease; }
.overlay[hidden] { display: none; }
.overlay-card { background: var(--surface-2); border-radius: 18px; padding: 24px 26px; text-align: center; max-width: 320px; animation: pop .25s ease; box-shadow: 0 0 0 1px var(--accent) inset, 0 0 50px rgba(190, 60, 255, .4); }
.overlay-title { font: 800 1.5rem var(--font-head); text-transform: uppercase; margin: 0 0 4px; }
.overlay-sub { color: var(--muted); margin: 0 0 16px; }
.overlay-card .btn { margin: 4px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.92); opacity: 0; } }

.info-tabs { margin-top: 32px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs [role="tab"] {
  display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 8px 16px; border: 0; border-radius: 12px; cursor: pointer;
  font: 700 .92rem var(--font-body); color: var(--muted); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line);
}
.tabs [role="tab"] .i { width: 18px; height: 18px; }
.tabs [role="tab"]:hover { color: var(--ink); }
.tabs [role="tab"][aria-selected="true"] { color: #fff; background: var(--grad); box-shadow: 0 4px 16px rgba(190, 60, 255, .35); }
.tab-panel { background: var(--surface); border-radius: var(--radius); padding: 22px 24px; box-shadow: inset 0 0 0 1px var(--line); }
.tab-panel + .tab-panel { margin-top: 12px; }
.js .tab-panel + .tab-panel { margin-top: 0; }
.js .tab-panel > h2:first-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.tab-panel.faq details { background: var(--surface-2); }

.prose { max-width: 75ch; overflow-wrap: break-word; }
.prose a { overflow-wrap: anywhere; }
.prose h2 { margin-top: 1.4em; font-size: 1.25rem; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin-top: 1.3em; color: var(--accent); font-size: 1.02rem; text-transform: uppercase; letter-spacing: .04em; }
.prose p, .prose li { color: #d9d5f3; }
.prose ol, .prose ul { padding-left: 1.3em; margin: 0 0 1em; }
.prose li { margin-bottom: .45em; }
.prose li::marker { color: var(--accent); }
.prose strong { color: var(--ink); }
.lede { font-size: 1.1rem; color: var(--muted); }

/* ---------- inner pages ---------- */
.page-head { margin: 6px 0 20px; }
.page-head p { color: var(--muted); margin: 0; }
.page-card { background: var(--surface); border-radius: 20px; padding: 28px 30px; box-shadow: inset 0 0 0 1px var(--line); max-width: 860px; }
.page-card h1 { margin-bottom: .6em; }
.howto-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.howto-item { display: flex; gap: 16px; align-items: center; background: var(--surface); border-radius: var(--radius); padding: 14px; box-shadow: inset 0 0 0 1px var(--line); }
.howto-art { width: 96px; height: auto; border-radius: 12px; flex: none; box-shadow: 0 0 22px color-mix(in srgb, var(--glow) 35%, transparent); }
.howto-item h2 { font-size: 1.08rem; margin-bottom: 4px; }
.howto-item h2 a { color: var(--ink); text-decoration: none; }
.howto-item p { color: var(--muted); margin-bottom: 10px; }
.howto-links { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 !important; }
.notfound { margin-bottom: 24px; }
.cat-head { display: flex; align-items: center; gap: 16px; }
.cat-icon { display: grid; place-items: center; width: 60px; height: 60px; flex: none; border-radius: 16px; background: var(--grad); color: #fff; box-shadow: 0 0 30px rgba(190, 60, 255, .45); }
.cat-icon .i { width: 30px; height: 30px; }
.cat-head h1 { margin-bottom: 4px; }
.cat-text { max-width: 760px; color: var(--muted); }
.ad-slot { margin: 28px 0; min-height: 100px; }

@media (max-width: 860px) {
  .promos { grid-template-columns: 1fr; gap: 10px; }
  .promo { min-height: 0; padding: 14px 18px; }
  .promo-big { font-size: 1.15rem; margin: 0 0 4px; }
  .promo-sub { font-size: .9rem; max-width: 72%; }
  .promo-icon { width: 54px; height: 54px; right: 14px; }
  .promo-icon .i { width: 26px; height: 26px; }
  .cta-art { display: none; }
}
@media (max-width: 680px) {
  .slide { grid-template-columns: minmax(0, 1fr) 104px; min-height: 260px; padding: 24px 20px 60px; gap: 12px; }
  .slide-art img { width: 104px; border-radius: 12px; }
  .slide-desc { font-size: 1rem; }
  .hero-ctrl { left: 20px; bottom: 12px; }
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
  .card-title { font-size: .82rem; }
  .tab-panel { padding: 18px 16px; }
  .page-card { padding: 22px 18px; }
  .howto-list { grid-template-columns: 1fr; }
  .chips { width: 100%; }
}

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

/* =============================================================
   Profile: avatar button + dialog (static/assets/profile.js)
   ============================================================= */
.avatar-btn {
  flex: none; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--surface-2); color: var(--muted); box-shadow: 0 0 0 2px var(--line); display: grid; place-items: center; overflow: hidden;
  transition: box-shadow .15s;
}
.avatar-btn:hover { box-shadow: 0 0 0 2px var(--accent), 0 0 16px rgba(190, 60, 255, .45); }
.avatar-btn .avatar-img, .avatar-btn img { display: grid; place-items: center; width: 100%; height: 100%; }
.avatar-btn img { object-fit: cover; }

.pf-dialog {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: 24px;
  background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line), 0 30px 80px rgba(0, 0, 0, .6), 0 0 80px rgba(190, 60, 255, .2);
}
.pf-dialog::backdrop { background: rgba(5, 3, 15, .7); backdrop-filter: blur(4px); }
.pf-dialog[open] { animation: pop .2s ease; }
.pf-body { padding: 22px 24px 20px; position: relative; }
.pf-loading { display: none; text-align: center; color: var(--muted); margin: 16px 0 0; }
.pf-body.loading .pf-loading { display: block; }
.pf-body.loading .pf-faces, .pf-body.loading .pf-styles { opacity: .3; }
.pf-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.pf-head h2 { flex: 1; margin: 0; font: 800 1.3rem var(--font-head); text-transform: uppercase; letter-spacing: .02em; }
.pf-x { width: 38px; height: 38px; font-size: 1rem; }
.pf-top { display: flex; gap: 18px; align-items: center; margin-bottom: 16px; }
.pf-preview { flex: none; width: 112px; height: 112px; border-radius: 50%; background: var(--surface-2); overflow: hidden; box-shadow: 0 0 0 3px var(--accent), 0 0 30px rgba(190, 60, 255, .45); }
.pf-preview img { width: 100%; height: 100%; }
.pf-preview.big { width: 150px; height: 150px; margin: 0 auto 16px; }
.pf-name { flex: 1; min-width: 0; }
.pf-name label { display: block; font: 700 .75rem var(--font-head); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.pf-name-row { display: flex; gap: 8px; }
.pf-name input {
  flex: 1; min-width: 0; height: 46px; padding: 0 14px; border: 0; border-radius: 12px; background: var(--bg); color: var(--ink);
  font: 600 16px var(--font-body); box-shadow: inset 0 0 0 1px var(--line); outline: none;
}
.pf-name input:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.pf-name .icon-btn { width: 46px; height: 46px; }
.pf-note { margin: 6px 0 0; font-size: .8rem; color: var(--muted); }
.pf-make {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border: 0; border-radius: 16px; cursor: pointer; text-align: left;
  background: var(--grad); color: #fff; box-shadow: 0 8px 26px rgba(190, 60, 255, .35); font: inherit; transition: filter .15s, transform .15s;
}
.pf-make:hover { filter: brightness(1.1); }
.pf-make:active { transform: scale(.99); }
.pf-make-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: rgba(255, 255, 255, .2); flex: none; }
.pf-make-text { flex: 1; display: grid; gap: 2px; }
.pf-make-text b { font-size: 1.02rem; }
.pf-make-text span { font-size: .85rem; opacity: .9; }
.pf-make > span:last-child { font-size: 1.6rem; line-height: 1; }
.pf-or { display: flex; align-items: center; gap: 12px; margin: 18px 0 6px; color: var(--muted); font-size: .85rem; }
.pf-or::before, .pf-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.pf-row { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.pf-link { border: 0; background: none; color: var(--accent); font: 600 .88rem var(--font-body); cursor: pointer; padding: 6px 4px; }
.pf-faces { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.pf-faces button, .pf-grid button {
  aspect-ratio: 1; padding: 0; border: 0; border-radius: 50%; overflow: hidden; cursor: pointer; background: var(--surface-2);
  box-shadow: 0 0 0 2px var(--line); transition: box-shadow .15s, transform .15s;
}
.pf-faces button:hover, .pf-grid button:hover { transform: translateY(-2px); box-shadow: 0 0 0 2px var(--accent); }
.pf-faces button[aria-selected="true"], .pf-grid button[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--accent-2), 0 0 18px rgba(236, 91, 255, .55); }
.pf-faces img, .pf-grid img, .pf-styles img { width: 100%; height: 100%; display: block; }
.pf-label { margin: 18px 0 8px; font: 700 .75rem var(--font-head); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pf-styles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.pf-styles button {
  display: grid; justify-items: center; gap: 6px; padding: 10px 6px 8px; border: 0; border-radius: 14px; cursor: pointer;
  background: var(--surface-2); color: var(--ink); font: 600 .78rem var(--font-body); box-shadow: inset 0 0 0 1px var(--line);
}
.pf-styles img { width: 52px; height: 52px; border-radius: 50%; }
.pf-styles button[aria-checked="true"] { box-shadow: inset 0 0 0 2px var(--accent-2), 0 0 16px rgba(236, 91, 255, .35); color: #fff; }
.pf-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.pf-parts { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; scrollbar-width: thin; }
.pf-parts button {
  flex: none; padding: 8px 14px; border: 0; border-radius: 999px; cursor: pointer; background: var(--surface-2); color: var(--muted);
  font: 600 .85rem var(--font-body); box-shadow: inset 0 0 0 1px var(--line);
}
.pf-parts button[aria-selected="true"] { background: var(--grad); color: #fff; box-shadow: none; }
.pf-options { max-height: min(42dvh, 340px); overflow-y: auto; padding: 4px; }
.pf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px; }
.pf-none { font: 700 .75rem var(--font-body); color: var(--muted); }
.pf-swatches { display: flex; flex-wrap: wrap; gap: 12px; }
.pf-swatches button { width: 44px; height: 44px; border: 0; border-radius: 50%; cursor: pointer; box-shadow: 0 0 0 2px var(--line); }
.pf-swatches button[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent-2); }
@media (max-width: 520px) {
  .pf-body { padding: 18px 16px 16px; }
  .pf-top { gap: 12px; }
  .pf-preview { width: 84px; height: 84px; }
  .pf-styles { grid-template-columns: repeat(2, 1fr); }
  .pf-faces { gap: 8px; }
}
@media (max-width: 680px) { .avatar-btn { width: 40px; height: 40px; } }

/* "View this page in <language>?" banner (common.js initLangSuggest) */
.lang-suggest {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin: 12px 24px 0; padding: 10px 14px; border-radius: 14px;
  background: linear-gradient(90deg, rgba(139, 61, 255, .22), rgba(214, 60, 255, .12)); box-shadow: inset 0 0 0 1px rgba(183, 104, 255, .45);
  animation: fade .3s ease;
}
.lang-suggest-q { flex: 1; min-width: 180px; font-weight: 600; }
@media (max-width: 1023px) { .lang-suggest { margin: 10px 16px 0; } }

/* =============================================================
   Installable app: "Install app" button (shown only when the browser offers it) + offline page
   ============================================================= */
.side-btn[hidden] { display: none; }
.offline-list { margin: 16px 0; }

/* very small phones (≤ 400px): long headings (German/French compounds in the uppercase display font) */
.cat-head > div, .howto-item > div { min-width: 0; }
.howto-links .btn { white-space: normal; }
@media (max-width: 400px) {
  h1 { font-size: 1.3rem; }
  .cat-head { gap: 12px; }
  .cat-icon { width: 46px; height: 46px; border-radius: 13px; }
  .cat-icon .i { width: 24px; height: 24px; }
  .howto-item { gap: 12px; padding: 12px; }
  .howto-art { width: 64px; }
}

/* tablets: the random button keeps only its icon so the search box has room */
@media (min-width: 681px) and (max-width: 1023px) {
  .random-btn span { display: none; }
  .random-btn { width: 44px; padding: 0; justify-content: center; }
}
/* phones held sideways: don't pin the top bar, the board needs the height */
@media (orientation: landscape) and (max-height: 500px) {
  .topbar { position: static; }
}
