/* =========================================================
   GameWiki — design system
   ========================================================= */

:root {
  /* Light theme (default) */
  --bg: #FAFAF7;
  --bg-elev: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F4F4EF;
  --surface-glass: rgba(255, 255, 255, 0.72);
  --text-primary: #0F0F14;
  --text-secondary: #3B3B44;
  --text-muted: #6B6B74;
  --border: #E7E7EC;
  --border-strong: #D7D7DE;
  --accent: #6366F1;
  --accent-2: #D946EF;
  --accent-3: #F59E0B;
  --accent-contrast: #FFFFFF;
  --accent-glow: rgba(99, 102, 241, 0.22);
  --accent-soft: rgba(99, 102, 241, 0.08);
  --success: #10B981;
  --warn: #F59E0B;
  --danger: #EF4444;

  --shadow-xs: 0 1px 1px rgba(15, 15, 20, 0.04);
  --shadow-sm: 0 1px 2px rgba(15, 15, 20, 0.04), 0 2px 6px rgba(15, 15, 20, 0.06);
  --shadow-md: 0 4px 10px rgba(15, 15, 20, 0.05), 0 14px 32px rgba(15, 15, 20, 0.08);
  --shadow-lg: 0 20px 50px rgba(15, 15, 20, 0.14);

  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --dur-fast: 120ms;
  --dur-base: 200ms;
  --dur-slow: 320ms;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  --font-body: "SN Pro", ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif;
  --font-display: "SN Pro", ui-sans-serif, system-ui, sans-serif;

  --sidebar-w: 288px;
  --topbar-h: 56px;
  --container: 1060px;
}

[data-theme="dark"] {
  --bg: #0B0B0F;
  --bg-elev: #101017;
  --surface: #16161C;
  --surface-2: #1E1E26;
  --surface-glass: rgba(22, 22, 28, 0.72);
  --text-primary: #F4F4F7;
  --text-secondary: #CFCFD6;
  --text-muted: #9A9AA6;
  --border: #26262F;
  --border-strong: #32323D;
  --accent: #818CF8;
  --accent-2: #E879F9;
  --accent-3: #FBBF24;
  --accent-contrast: #0B0B0F;
  --accent-glow: rgba(129, 140, 248, 0.35);
  --accent-soft: rgba(129, 140, 248, 0.12);

  --shadow-xs: 0 1px 1px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.5), 0 20px 40px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.7);
}

/* =========================================================
   Base
   ========================================================= */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--dur-slow) var(--ease), color var(--dur-slow) var(--ease);
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin: 0 0 0.5em;
  color: var(--text-primary);
}
h1 { font-size: clamp(2rem, 3vw + 1rem, 3rem); font-weight: 700; letter-spacing: -0.025em; }
h2 { font-size: clamp(1.4rem, 1.4vw + 0.8rem, 1.8rem); font-weight: 600; letter-spacing: -0.02em; }
h3 { font-size: 1.15rem; font-weight: 600; }
p  { margin: 0 0 1em; color: var(--text-secondary); }
small { color: var(--text-muted); }

kbd {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-muted);
}

/* Grain */
.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 1;
  opacity: 0.035;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 1 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  mix-blend-mode: multiply;
}
[data-theme="dark"] .grain { opacity: 0.06; mix-blend-mode: screen; }

/* =========================================================
   Layout: Sidebar + Main
   ========================================================= */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  padding: 16px;
  z-index: 40;
  background: var(--surface-glass);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-right: 1px solid var(--border);
  transition: transform var(--dur-base) var(--ease), background var(--dur-slow) var(--ease);
}
.sidebar-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}
.sidebar-inner::-webkit-scrollbar { width: 6px; }
.sidebar-inner::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; }

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-radius: var(--radius-md);
  transition: background var(--dur-fast) var(--ease);
}
.brand:hover { background: var(--accent-soft); }
.brand-mark {
  width: 36px; height: 36px; flex: 0 0 36px;
  display: grid; place-items: center;
  border-radius: 10px;
  box-shadow: 0 6px 18px var(--accent-glow);
}
.brand-mark svg { width: 36px; height: 36px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text { font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: -0.02em; }
.brand-text small { font-weight: 500; font-size: 11px; letter-spacing: 0.02em; text-transform: uppercase; color: var(--text-muted); }

/* Search */
.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  height: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease), background var(--dur-base) var(--ease);
}
.search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft), inset 0 0 0 1px var(--accent-soft);
}
.search svg { width: 16px; height: 16px; color: var(--text-muted); flex: none; }
.search input {
  flex: 1;
  height: 100%;
  background: transparent;
  border: 0;
  outline: 0;
  font: inherit;
  font-size: 13.5px;
  color: var(--text-primary);
}
.search input::placeholder { color: var(--text-muted); }
.search kbd { flex: none; }
.search-results {
  position: absolute;
  inset: calc(100% + 6px) 0 auto 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 50;
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
}
.search-results a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13.5px;
}
.search-results a:hover, .search-results a.active { background: var(--accent-soft); color: var(--text-primary); }
.search-results .hint { padding: 12px; font-size: 12.5px; color: var(--text-muted); }
.search-results .thumb {
  width: 22px; height: 22px; border-radius: 6px; flex: none;
}

/* Nav */
.nav-primary { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.nav-item svg { width: 17px; height: 17px; color: var(--text-muted); transition: color var(--dur-fast) var(--ease); }
.nav-item:hover { background: var(--accent-soft); color: var(--text-primary); }
.nav-item:hover svg { color: var(--accent); }
.nav-item.is-active {
  color: var(--text-primary);
  background: linear-gradient(135deg, var(--accent-soft), transparent 70%);
  font-weight: 600;
}
.nav-item.is-active::after {
  content: "";
  position: absolute;
  left: 10px; right: 10px; bottom: 4px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  opacity: 0.9;
}
.nav-item.is-active svg { color: var(--accent); }

/* Nav section */
.nav-section { display: flex; flex-direction: column; gap: 2px; }
.nav-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 10px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.nav-section-header .chev {
  width: 14px; height: 14px;
  transition: transform var(--dur-base) var(--ease);
}
.nav-section-header[aria-expanded="false"] .chev { transform: rotate(-90deg); }
.nav-section-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  transition: max-height var(--dur-slow) var(--ease);
}
.nav-section-body[hidden] { display: none; }

.game-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  position: relative;
}
.game-link:hover { background: var(--accent-soft); color: var(--text-primary); }
.game-swatch {
  width: 18px; height: 18px; flex: none;
  border-radius: 5px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}
.game-link.is-open > .sub-links { display: flex; }
.game-link-row {
  display: flex; align-items: center; gap: 10px; flex: 1;
  min-width: 0;
}
.game-link-row span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-group { display: flex; flex-direction: column; gap: 2px; }
.game-group.is-open .chev { transform: rotate(0); }
.game-group .chev {
  width: 13px; height: 13px; color: var(--text-muted);
  transition: transform var(--dur-base) var(--ease);
  transform: rotate(-90deg);
}
.sub-links {
  display: none;
  flex-direction: column;
  gap: 1px;
  margin: 2px 0 6px 26px;
  padding-left: 10px;
  border-left: 1px solid var(--border);
}
.game-group.is-open .sub-links { display: flex; }
.sub-link {
  padding: 5px 10px;
  font-size: 12.5px;
  border-radius: 8px;
  color: var(--text-muted);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.sub-link:hover { background: var(--accent-soft); color: var(--text-primary); }
.sub-link.is-active {
  color: var(--text-primary);
  background: var(--accent-soft);
  font-weight: 600;
}

/* Footer + theme toggle */
.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
.theme-toggle {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  height: 38px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.theme-toggle:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--text-primary); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: inline; color: var(--accent); }
[data-theme="dark"] .theme-toggle .icon-sun { display: inline; color: var(--accent-3); }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* =========================================================
   Main + Topbar
   ========================================================= */

.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  position: relative;
  z-index: 2;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--topbar-h);
  padding: 0 28px;
  background: var(--surface-glass);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid var(--border);
}
.topbar-spacer { flex: 1; }
.topbar-meta {
  display: flex; align-items: center; gap: 10px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.topbar-meta .dot { width: 6px; height: 6px; border-radius: 99px; background: var(--success); box-shadow: 0 0 8px var(--success); }

.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; min-width: 0; }
.crumbs a, .crumbs span { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs a:hover { color: var(--text-primary); }
.crumbs .sep { color: var(--text-muted); opacity: 0.6; }
.crumbs .current { color: var(--text-primary); font-weight: 600; }

.view {
  padding: 36px 28px 80px;
  max-width: calc(var(--container) + 56px);
  margin: 0 auto;
  animation: viewIn var(--dur-slow) var(--ease) both;
}
.view:focus { outline: none; }

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

.footer {
  padding: 32px 28px 40px;
  max-width: calc(var(--container) + 56px);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--text-muted);
  font-size: 12.5px;
  border-top: 1px solid var(--border);
}

/* =========================================================
   Components
   ========================================================= */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid transparent;
  transition: transform var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
  white-space: nowrap;
}
.chip.neutral {
  background: var(--surface-2);
  color: var(--text-secondary);
  border-color: var(--border);
}
.chip.outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-strong);
}
.chip .dot { width: 6px; height: 6px; border-radius: 99px; background: currentColor; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-base) var(--ease), background var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease), color var(--dur-base) var(--ease);
  border: 1px solid transparent;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  box-shadow: 0 10px 24px var(--accent-glow);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 32px var(--accent-glow); }
.btn-ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-primary);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn svg { width: 16px; height: 16px; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease);
}
.card.interactive:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.card-body { padding: 20px; }

/* =========================================================
   HOME
   ========================================================= */

.hero {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  padding: 80px 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  isolation: isolate;
}
.hero-bg {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(60% 60% at 20% 10%, color-mix(in oklab, var(--accent) 55%, transparent) 0%, transparent 60%),
    radial-gradient(50% 60% at 80% 40%, color-mix(in oklab, var(--accent-2) 50%, transparent) 0%, transparent 55%),
    radial-gradient(60% 80% at 60% 100%, color-mix(in oklab, var(--accent-3) 45%, transparent) 0%, transparent 60%);
  filter: blur(30px) saturate(130%);
  opacity: 0.8;
  animation: heroFloat 14s ease-in-out infinite alternate;
}
[data-theme="dark"] .hero-bg { opacity: 0.55; }
@keyframes heroFloat {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(-2%, 1%, 0) scale(1.04); }
}
.hero h1 {
  max-width: 720px;
  margin-bottom: 0.4em;
}
.hero .gradient-text {
  background: linear-gradient(120deg, var(--accent), var(--accent-2) 55%, var(--accent-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p {
  max-width: 580px;
  font-size: 17px;
  color: var(--text-secondary);
}
.hero-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }

.section-title {
  display: flex; align-items: center; justify-content: space-between;
  margin: 48px 0 18px;
  gap: 12px;
}
.section-title h2 { margin: 0; }
.section-title .muted { font-size: 13px; color: var(--text-muted); }

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

.game-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease);
  position: relative;
}
.game-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md), 0 18px 40px var(--card-glow, var(--accent-glow));
  border-color: transparent;
}
.game-card .art {
  aspect-ratio: 16/10;
  background: var(--art-bg, linear-gradient(135deg, var(--accent), var(--accent-2)));
  position: relative;
  overflow: hidden;
}
.game-card .art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--dur-slow) var(--ease);
}
.game-card:hover .art img { transform: scale(1.04); }
.game-card .art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,0.2) 100%);
  z-index: 1;
  pointer-events: none;
}
.game-card .art .emblem {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 56px;
  color: rgba(255,255,255,0.92);
  letter-spacing: -0.04em;
  text-shadow: 0 4px 24px rgba(0,0,0,0.25);
  mix-blend-mode: overlay;
}
.game-card .body { padding: 16px 18px 18px; }
.game-card .body h3 { margin: 0 0 4px; font-size: 1.08rem; }
.game-card .body .meta { color: var(--text-muted); font-size: 12.5px; margin-bottom: 10px; }
.game-card .tag-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* Stats strip */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 24px;
}
.stat-card {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}
.stat-card .k { font-size: 12px; color: var(--text-muted); letter-spacing: 0.04em; text-transform: uppercase; font-weight: 600; }
.stat-card .v { font-family: var(--font-display); font-weight: 700; font-size: 26px; margin-top: 2px; letter-spacing: -0.02em; }
.stat-card .v span { background: linear-gradient(120deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* =========================================================
   GAME: Overview
   ========================================================= */

.game-hero {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  isolation: isolate;
  min-height: 280px;
}
.game-hero .bg {
  position: absolute; inset: 0; z-index: -2;
  background: var(--art-bg, linear-gradient(135deg, var(--accent), var(--accent-2)));
  transform: scale(1.1);
  filter: blur(30px) saturate(140%);
  opacity: 0.85;
}
.game-hero .hero-img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(6px) saturate(120%);
  transform: scale(1.08);
  opacity: 0.9;
}
.game-hero::before {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(0,0,0,0.15), rgba(0,0,0,0.45));
}
[data-theme="dark"] .game-hero::before { background: linear-gradient(180deg, rgba(0,0,0,0.35), rgba(0,0,0,0.65)); }

.game-hero-inner {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 22px;
  padding: 34px;
  align-items: center;
}
.game-hero .glass-card {
  grid-column: 1 / -1;
  margin-top: 0;
  padding: 24px 26px;
  border-radius: var(--radius-lg);
  background: var(--surface-glass);
  backdrop-filter: saturate(160%) blur(20px);
  -webkit-backdrop-filter: saturate(160%) blur(20px);
  border: 1px solid color-mix(in oklab, white 35%, transparent);
  box-shadow: var(--shadow-md);
}
[data-theme="dark"] .game-hero .glass-card { border-color: color-mix(in oklab, white 8%, transparent); }

.game-title {
  font-size: clamp(2rem, 2.4vw + 1rem, 2.8rem);
  margin: 0 0 4px;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.tab-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 20px 0 4px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.tab-bar .nav-item {
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
  border-radius: 10px;
}
.tab-bar .nav-item span { margin-left: 6px; }
.game-tagline {
  color: var(--text-secondary);
  font-size: 16px;
  margin: 4px 0 14px;
}
.info-row { display: flex; flex-wrap: wrap; gap: 6px; }

.about-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 28px;
  margin-top: 32px;
  align-items: start;
}
.poster {
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
  aspect-ratio: 3/4;
  border-radius: var(--radius-lg);
  background: var(--art-bg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  isolation: isolate;
  border: 1px solid var(--border);
}
.poster .emblem {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 84px;
  color: rgba(255,255,255,0.95);
  text-shadow: 0 6px 30px rgba(0,0,0,0.35);
  letter-spacing: -0.04em;
  z-index: 1;
  padding: 10px;
  text-align: center;
}
.poster img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
}
.poster::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(160deg, rgba(255,255,255,0.05), rgba(0,0,0,0.12));
  z-index: 3;
  pointer-events: none;
}

.about-body h3 { font-size: 1.08rem; margin-top: 24px; }
.about-body h3:first-child { margin-top: 0; }
.about-body p { line-height: 1.7; }

.section-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 36px;
}
.section-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  transition: transform var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease);
  color: inherit;
}
.section-card:hover {
  transform: translateY(-3px);
  border-color: transparent;
  box-shadow: var(--shadow-md), 0 20px 40px var(--card-glow, var(--accent-glow));
}
.section-card .ico {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}
.section-card .ico svg { width: 20px; height: 20px; }
.section-card h4 { margin: 0; font-size: 1.05rem; }
.section-card p { margin: 0; color: var(--text-muted); font-size: 13.5px; }
.section-card .arrow {
  margin-top: auto;
  font-size: 12.5px;
  color: var(--accent);
  font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
}

/* =========================================================
   GAME: Mechanics
   ========================================================= */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.feature {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex; flex-direction: column; gap: 8px;
  transition: transform var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.feature:hover { transform: translateY(-2px); border-color: var(--accent); }
.feature .ico {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
}
.feature .ico svg { width: 16px; height: 16px; }
.feature h4 { margin: 0; font-size: 15px; }
.feature p { margin: 0; font-size: 13px; color: var(--text-muted); line-height: 1.55; }

.spec-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.spec-table th, .spec-table td {
  padding: 12px 16px;
  text-align: left;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
}
.spec-table tr:last-child td { border-bottom: 0; }
.spec-table th {
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-2);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.spec-table td:first-child { font-weight: 600; color: var(--text-primary); width: 180px; }

.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.control-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
}
.control-row .label { color: var(--text-secondary); }
.control-row kbd { font-size: 11.5px; }

.section-block { margin-top: 32px; }
.section-block h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.section-block h2::before {
  content: "";
  width: 4px;
  height: 22px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}
.section-block > p { color: var(--text-muted); max-width: 720px; }

/* =========================================================
   GAME: Characters
   ========================================================= */

.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 18px;
}
.char-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease);
  text-align: left;
  width: 100%;
  display: flex;
  flex-direction: column;
}
.char-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md), 0 16px 30px var(--card-glow, var(--accent-glow));
  border-color: transparent;
}
.char-card .portrait {
  aspect-ratio: 1/1;
  position: relative;
  background: var(--char-bg, linear-gradient(135deg, var(--accent), var(--accent-2)));
  overflow: hidden;
}
.char-card .portrait .initial {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 84px;
  color: rgba(255,255,255,0.95);
  letter-spacing: -0.04em;
  text-shadow: 0 4px 20px rgba(0,0,0,0.35);
  z-index: 1;
}
.char-card .portrait img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
  transition: transform var(--dur-slow) var(--ease);
}
.char-card:hover .portrait img { transform: scale(1.04); }
.char-card .portrait::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0,0,0,0.35) 100%);
  z-index: 3;
  pointer-events: none;
}
.char-card .body { padding: 14px 16px; }
.char-card .name { font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; margin-bottom: 2px; }
.char-card .role { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.char-card .blurb { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(10, 10, 15, 0.48);
  backdrop-filter: blur(6px);
  z-index: 70;
  display: none;
  place-items: center;
  padding: 20px;
  animation: fadeIn var(--dur-base) var(--ease);
}
.modal-backdrop.is-open { display: grid; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: min(640px, 100%);
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  animation: modalIn var(--dur-base) var(--ease);
}
@keyframes modalIn {
  from { transform: translateY(12px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.modal-header {
  position: relative;
  aspect-ratio: 16/9;
  background: var(--char-bg);
  flex: none;
  overflow: hidden;
}
.modal-header .initial {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 110px;
  color: rgba(255,255,255,0.95);
  letter-spacing: -0.05em;
  text-shadow: 0 8px 30px rgba(0,0,0,0.35);
  z-index: 1;
}
.modal-header img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  z-index: 2;
}
.modal-header .close {
  position: absolute; top: 14px; right: 14px;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 99px;
  background: rgba(0,0,0,0.45);
  color: white;
  backdrop-filter: blur(10px);
  transition: background var(--dur-fast) var(--ease);
  z-index: 3;
}
.modal-header .close:hover { background: rgba(0,0,0,0.65); }
.modal-body { padding: 22px 26px 26px; overflow-y: auto; }
.modal-body h2 { margin: 0 0 2px; }
.modal-body .role { color: var(--text-muted); margin-bottom: 14px; font-size: 13.5px; }
.modal-body p { color: var(--text-secondary); line-height: 1.65; }

/* =========================================================
   GAME: Items
   ========================================================= */

.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.item-card {
  position: relative;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex; flex-direction: column; gap: 10px;
  transition: transform var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease);
}
.item-card:hover {
  transform: translateY(-3px);
  border-color: transparent;
  box-shadow: var(--shadow-md), 0 16px 30px var(--card-glow, var(--accent-glow));
}
.item-card .icon-wrap {
  aspect-ratio: 1/1;
  border-radius: var(--radius-md);
  background: var(--item-bg, linear-gradient(135deg, var(--accent), var(--accent-2)));
  display: grid; place-items: center;
  overflow: hidden;
  position: relative;
}
.item-card .icon-wrap::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.28), transparent 60%);
}
.item-card .icon-wrap .glyph {
  font-size: 54px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.2));
  position: relative;
  z-index: 1;
}
.item-card .icon-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 2;
  transition: transform var(--dur-slow) var(--ease);
}
.item-card:hover .icon-wrap img { transform: scale(1.04); }
.item-card.no-icon { padding: 18px 20px; gap: 6px; }
.item-card.no-icon h4 { font-size: 16px; margin-bottom: 2px; }
.item-card.no-icon .cat { margin-bottom: 4px; }

.item-card.image-only {
  padding: 0;
  overflow: hidden;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.item-card.image-only img {
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  display: block;
  transition: transform var(--dur-slow) var(--ease);
}
.item-card.image-only:hover img { transform: scale(1.03); }
.item-card.image-only .fallback {
  display: grid;
  place-items: center;
  height: 100%;
  padding: 18px;
  font-family: var(--font-display);
  font-weight: 600;
  text-align: center;
  color: var(--text-muted);
}
.item-card h4 { margin: 0; font-size: 14.5px; }
.item-card .cat { font-size: 11.5px; color: var(--text-muted); }
.item-card .desc { font-size: 12.5px; color: var(--text-secondary); margin: 0; line-height: 1.55; }

/* =========================================================
   Categories + About
   ========================================================= */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.cat-tile {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex; flex-direction: column; gap: 10px;
  cursor: pointer;
  transition: transform var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
  text-align: left;
}
.cat-tile:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow-sm); }
.cat-tile h4 { margin: 0; }
.cat-tile small { font-size: 12px; color: var(--text-muted); }

/* Mobile nav */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 60;
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--surface-glass);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  place-items: center;
  box-shadow: var(--shadow-sm);
}
.mobile-menu-btn svg { width: 18px; height: 18px; color: var(--text-primary); }

.scrim {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(3px);
  z-index: 35;
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease);
}
.scrim.is-open { display: block; opacity: 1; }

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 1100px) {
  :root { --sidebar-w: 240px; }
  .about-grid { grid-template-columns: 220px 1fr; gap: 24px; }
  .section-cards { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .main { margin-left: 0; }
  .view { padding: 28px 20px 60px; }
  .hero { padding: 56px 24px; }
  .topbar { padding: 0 20px 0 64px; }
  .game-hero-inner { padding: 22px; grid-template-columns: 1fr; }
  .about-grid { grid-template-columns: 1fr; }
  .poster { position: static; aspect-ratio: 16/10; max-width: 420px; margin-bottom: 10px; }
  .footer { padding: 28px 20px 30px; flex-direction: column; }

  .sidebar {
    transform: translateX(-105%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.is-open { transform: translateX(0); }
  .mobile-menu-btn { display: grid; }
}

@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .char-grid { grid-template-columns: repeat(2, 1fr); }
  .char-card .portrait .initial { font-size: 56px; }
  .hero { padding: 40px 20px; }
  .hero p { font-size: 15px; }
  .hero-actions .btn { flex: 1; justify-content: center; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
