/* ---------- tokens ---------- */
:root {
  --bg: #14101c;
  --bg-2: #1b1526;
  --surface: #241c31;
  --surface-2: #30263f;
  --text: #fff7ec;
  --muted: #c3b6c9;
  --accent: #e11d48;
  --accent-2: #ffb020;
  --accent-text: #ffffff;
  --border: #3a2f4a;
  --focus: #ffe066;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --wrap: 1240px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    --bg: #fffaf2;
    --bg-2: #fbf0df;
    --surface: #ffffff;
    --surface-2: #fdf1e1;
    --text: #24172a;
    --muted: #6b5870;
    --accent: #e11d48;
    --accent-2: #b45309;
    --border: #f0e0c8;
    --focus: #c2410c;
    --shadow: 0 6px 18px rgba(80, 40, 20, 0.08);
    color-scheme: light;
  }
}

/* ---------- base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
a:hover { color: var(--accent-2); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.7rem, 1.2rem + 2vw, 2.5rem); }
h2 { font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem); }
p { margin: 0 0 1em; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 820px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-text); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }
.lede { font-size: 1.075rem; color: var(--text); opacity: 0.92; max-width: 75ch; }
.spacer { flex: 1; }
kbd { font: inherit; font-size: 0.95em; background: var(--surface-2); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--border); }
.header-row { display: flex; align-items: center; gap: 12px; height: 60px; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.15rem; text-decoration: none; white-space: nowrap; }
.logo-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-size: 0.8rem; }
.search { position: relative; flex: 1; max-width: 460px; margin-left: auto; display: flex; align-items: center; }
.search svg { position: absolute; left: 12px; width: 18px; height: 18px; fill: var(--muted); pointer-events: none; }
.search input { width: 100%; height: 40px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 0 14px 0 38px; font: inherit; }
.search input::placeholder { color: var(--muted); }
.search-results { position: absolute; top: 46px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 6px; max-height: 70vh; overflow: auto; }
.search-results a { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 8px; text-decoration: none; }
.search-results a:hover, .search-results a[aria-selected='true'] { background: var(--surface-2); color: var(--text); }
.search-results img { width: 56px; height: 42px; object-fit: cover; border-radius: 6px; }
.search-results .empty { padding: 10px; color: var(--muted); }
.icon-btn { display: none; background: none; border: 0; color: var(--text); width: 40px; height: 40px; border-radius: 10px; cursor: pointer; }
.icon-btn svg { width: 24px; height: 24px; fill: currentColor; }
.cat-nav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.cat-nav::-webkit-scrollbar { display: none; }
.cat-nav a { flex: none; text-decoration: none; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 0.9rem; }
.cat-nav a[aria-current='page'] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

/* ---------- cards / grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.grid-compact { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.card { display: block; text-decoration: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent); color: var(--text); }
.thumb { display: block; aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-title { font-size: 0.95rem; margin: 10px 12px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { display: block; margin: 0 12px 12px; font-size: 0.8rem; color: var(--muted); }
.grid-item[hidden] { display: none; }

/* ---------- sections ---------- */
main { padding: 18px 0 48px; min-height: 60vh; }
.block { margin: 34px 0; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.more { color: var(--accent-2); text-decoration: none; font-weight: 600; white-space: nowrap; }
.hero { padding: 20px 0 6px; }
.hub-head { margin: 10px 0 22px; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 6px 0 14px; font-size: 0.85rem; color: var(--muted); }
.crumbs li + li::before { content: '›'; margin-right: 6px; }
.crumbs a { text-decoration: none; }
.series-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.series-card { display: flex; align-items: center; gap: 12px; padding: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; }
.series-card img { width: 84px; height: 63px; object-fit: cover; border-radius: 8px; }
.series-card span { display: flex; flex-direction: column; }
.tag { display: inline-block; margin: 0 6px 8px 0; padding: 4px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 0.85rem; text-decoration: none; }
.tag-plain { color: var(--muted); }
.prose { max-width: 75ch; }
.prose h2 { margin-top: 1.4em; }
.prose a { color: var(--accent-2); }
.order-list li { margin: 4px 0; }
.order-list a { color: var(--accent-2); font-weight: 600; }

/* ---------- game page ---------- */
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.game-head h1 { margin-bottom: 0.35em; }
.player { position: relative; width: 100%; aspect-ratio: var(--ratio, 16 / 9); max-height: 78vh; background: #000; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin: 14px auto 0; }
.player-portrait { max-width: min(100%, 460px); }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player:fullscreen, .player.is-fs { max-height: none; border-radius: 0; aspect-ratio: auto; }
.facade { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; cursor: pointer; background: #000; color: #fff; }
.facade img { width: 100%; height: 100%; object-fit: cover; filter: blur(2px) brightness(0.55); transform: scale(1.04); }
.facade-cta { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; font-weight: 700; font-size: 1.1rem; }
.facade-cta svg { width: 76px; height: 76px; padding: 18px; border-radius: 50%; fill: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 10px 30px rgba(225, 29, 72, 0.45); transition: transform 0.15s ease; }
.facade:hover .facade-cta svg { transform: scale(1.08); }
.player-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 4px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 0.9rem; cursor: pointer; }
.chip svg { width: 16px; height: 16px; fill: currentColor; }
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed='true'] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.facts dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0; }
.facts dl > div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.facts dt { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 600; }
.facts a { color: var(--accent-2); }
.controls { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius-sm); overflow: hidden; }
.controls th, .controls td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.controls th { background: var(--surface-2); font-size: 0.85rem; }
.controls tr:last-child td { border-bottom: 0; }
.tips { padding-left: 1.2em; }
.tips li { margin: 6px 0; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; }
.faq summary { cursor: pointer; padding: 12px 14px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--muted); font-weight: 400; }
.faq details[open] summary::after { content: '-'; }
.faq details p { padding: 0 14px 12px; margin: 0; color: var(--muted); }
.game-side { position: sticky; top: 120px; }
.side-h { font-size: 1.05rem; }
.side-list { display: grid; gap: 8px; }
.side-item { display: flex; gap: 10px; align-items: center; padding: 6px; border-radius: var(--radius-sm); text-decoration: none; }
.side-item:hover { background: var(--surface); color: var(--text); }
.side-item img { width: 96px; height: 72px; object-fit: cover; border-radius: 8px; flex: none; }
.side-item > span { display: flex; flex-direction: column; min-width: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-2); padding: 34px 0 18px; font-size: 0.92rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 24px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin: 5px 0; }
.footer-grid a { text-decoration: none; color: var(--muted); }
.footer-grid a:hover { color: var(--text); }
.footer-h { font-size: 0.95rem; }
.footer-bottom { margin-top: 24px; font-size: 0.82rem; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .game-layout { grid-template-columns: 1fr; }
  .game-side { position: static; }
  .side-list { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}
@media (max-width: 720px) {
  .header-row { gap: 8px; }
  .logo { font-size: 1rem; }
  .icon-btn { display: inline-grid; place-items: center; }
  .cat-nav { display: none; flex-wrap: wrap; }
  .cat-nav.open { display: flex; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .player { border-radius: var(--radius-sm); }
  /* phones: title → player → summary, so Play is above the fold */
  .game-main { display: flex; flex-direction: column; }
  .game-main > * { min-width: 0; }
  .game-head { display: contents; }
  .game-head h1, .player, .player-bar { order: -1; }
  .game-head .lede { margin-top: 10px; }
  .crumbs ol { margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- brand ---------- */
.logo-svg { flex: none; width: 32px; height: 32px; }
.wordmark { letter-spacing: -0.02em; }
.logo-accent { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
@media (max-width: 380px) { .wordmark { font-size: 0.95rem; } }
