:root {
  --bg-0: #070a10;
  --bg-1: #0a101b;
  --bg-2: #0d1523;
  --surface: #0e1522;
  --surface-2: #111b2b;
  --line: rgba(136, 176, 224, 0.2);
  --line-strong: rgba(55, 149, 255, 0.45);
  --text: #e9f1ff;
  --text-soft: #9eb2ce;
  --accent: #0eb4ff;
  --accent-2: #67e1ff;
  --chip-bg: rgba(14, 180, 255, 0.14);
  --chip-line: rgba(14, 180, 255, 0.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 85% 5%, rgba(14, 180, 255, 0.22), transparent 28%),
    radial-gradient(circle at 6% 22%, rgba(103, 225, 255, 0.12), transparent 36%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 30%, var(--bg-0) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 30px 30px;
  opacity: 0.22;
}

/* ── Topbar ────────────────────────────────────────── */
.topbar { position: sticky; top: 0; z-index: 30; backdrop-filter: blur(10px); background: rgba(8, 12, 20, 0.82); border-bottom: 1px solid var(--line); }
.bar-inner, .page { width: min(1280px, calc(100% - 32px)); margin: 0 auto; }
.bar-inner { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 1.4rem; font-weight: 700; letter-spacing: 0.01em; text-decoration: none; color: inherit; }
.brand span { color: var(--accent); }
.brand-icon { width: 22px; height: 22px; border-radius: 4px; object-fit: cover; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15); }
.top-actions { display: inline-flex; align-items: center; gap: 8px; }
.top-actions a { color: var(--text-soft); text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; font-size: 0.84rem; font-weight: 700; }
.top-actions a:hover { color: var(--accent-2); border-color: var(--line-strong); }

/* ── Layout ────────────────────────────────────────── */
.page { padding: 24px 0 70px; display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }

/* ── Sidebar ───────────────────────────────────────── */
.sidebar { position: sticky; top: 82px; background: linear-gradient(120deg, rgba(103, 225, 255, 0.06), transparent 40%), linear-gradient(180deg, var(--surface), var(--surface-2)); border: 1px solid var(--line); border-radius: 10px; padding: 14px; max-height: calc(100vh - 96px); overflow-y: auto; }
.sidebar-group + .sidebar-group { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(136, 176, 224, 0.15); }
.sidebar-title { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); font-weight: 800; margin-bottom: 8px; }
.side-link { display: block; color: var(--text-soft); text-decoration: none; font-size: 0.92rem; font-weight: 600; line-height: 1.3; padding: 6px 4px; border-radius: 6px; }
.side-link:hover { color: var(--accent-2); background: rgba(14, 180, 255, 0.09); }
.side-link.active { color: var(--accent-2); background: rgba(14, 180, 255, 0.12); }
.side-anchor { display: block; color: var(--text-soft); text-decoration: none; font-size: 0.8rem; font-weight: 500; line-height: 1.3; padding: 3px 4px 3px 14px; border-radius: 4px; opacity: 0.75; border-left: 2px solid rgba(14, 180, 255, 0.2); margin-left: 4px; }
.side-anchor:hover { color: var(--accent-2); opacity: 1; border-left-color: var(--accent-2); }
.page-toc { display: flex; flex-wrap: wrap; gap: 6px 8px; margin-bottom: 20px; }
.page-toc a { color: var(--accent-2); text-decoration: none; font-size: 0.85rem; font-weight: 600; padding: 4px 10px; background: rgba(14, 180, 255, 0.07); border-radius: 5px; border: 1px solid rgba(14, 180, 255, 0.18); white-space: nowrap; }
.page-toc a:hover { background: rgba(14, 180, 255, 0.14); }

/* ── Content ───────────────────────────────────────── */
.content { min-width: 0; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.8rem; font-weight: 700; margin-bottom: 12px; }
h1 { font-size: clamp(1.9rem, 4vw, 2.9rem); line-height: 1.15; margin-bottom: 12px; }
.lead { color: var(--text-soft); max-width: 980px; line-height: 1.65; margin-bottom: 24px; font-size: 1.05rem; }

/* ── Sections ──────────────────────────────────────── */
.section { background: linear-gradient(120deg, rgba(103, 225, 255, 0.05), transparent 35%), linear-gradient(180deg, var(--surface), var(--surface-2)); border: 1px solid var(--line); border-radius: 10px; padding: 20px 20px 18px; margin-bottom: 12px; }
.section h2 { font-size: 1.15rem; margin-bottom: 10px; }
.section h3 { font-size: 1rem; margin-top: 14px; margin-bottom: 8px; color: var(--accent-2); }
.section p { color: var(--text-soft); line-height: 1.55; margin-bottom: 8px; }
.section p:last-child { margin-bottom: 0; }

/* ── Lists ─────────────────────────────────────────── */
.list { display: grid; gap: 5px; margin-top: 8px; padding-left: 18px; }
.compact-list { display: grid; gap: 4px; margin-top: 8px; list-style: none; }
.list li, .compact-list li { color: var(--text-soft); line-height: 1.5; }

/* ── Tables ────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 0.92rem; }
th { text-align: left; color: var(--accent-2); font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; padding: 8px 10px; border-bottom: 1px solid var(--line-strong); }
td { padding: 7px 10px; border-bottom: 1px solid rgba(136, 176, 224, 0.1); color: var(--text-soft); vertical-align: top; }
tr:hover td { background: rgba(14, 180, 255, 0.04); }

/* ── Code / Mono ───────────────────────────────────── */
.mono { font-family: Consolas, "Courier New", monospace; }
code { font-family: Consolas, "Courier New", monospace; background: rgba(14, 180, 255, 0.08); padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }

/* ── Token grid ────────────────────────────────────── */
.token-grid { margin-top: 12px; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 8px; }
.token { border: 1px solid rgba(136, 176, 224, 0.2); border-radius: 8px; padding: 10px; background: rgba(6, 11, 18, 0.45); color: var(--text-soft); line-height: 1.45; }
.token strong { color: var(--text); }

/* ── Examples ──────────────────────────────────────── */
.example { margin-top: 12px; border: 1px solid rgba(136, 176, 224, 0.2); border-radius: 8px; padding: 12px; background: rgba(6, 11, 18, 0.45); }
.example + .example { margin-top: 8px; }
.example h3 { font-size: 1rem; margin-bottom: 8px; color: var(--text); }
.example p { margin-bottom: 4px; color: var(--text-soft); }

/* ── Callouts ──────────────────────────────────────── */
.tip { border-left: 3px solid var(--accent); background: rgba(14, 180, 255, 0.06); padding: 12px 14px; border-radius: 0 8px 8px 0; margin: 10px 0; color: var(--text-soft); line-height: 1.5; }
.tip strong { color: var(--accent-2); }
.warn { border-left: 3px solid #f5a623; background: rgba(245, 166, 35, 0.06); padding: 12px 14px; border-radius: 0 8px 8px 0; margin: 10px 0; color: var(--text-soft); line-height: 1.5; }
.warn strong { color: #f5a623; }

/* ── Cards (overview) ──────────────────────────────── */
.card-grid { margin-top: 26px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.home-grid { grid-template-columns: repeat(2, 1fr); }
.card { background: linear-gradient(120deg, rgba(103, 225, 255, 0.06), transparent 32%), linear-gradient(180deg, var(--surface), var(--surface-2)); border: 1px solid var(--line); border-radius: 10px; padding: 22px 22px 20px; min-height: 130px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03); }
.card-link { display: block; text-decoration: none; color: inherit; transition: border-color 0.16s, box-shadow 0.16s, transform 0.16s; }
.card-link:hover { border-color: var(--line-strong); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), inset 0 0 0 1px rgba(103, 225, 255, 0.3), 0 0 0 1px rgba(14, 180, 255, 0.32), 0 0 18px rgba(14, 180, 255, 0.28); transform: translateY(-1px); }
.card-icon { color: var(--accent); font-size: 0.8rem; font-weight: 800; margin-bottom: 8px; letter-spacing: 0.08em; }
.card h2 { font-size: 1.35rem; margin-bottom: 6px; }
.card h3 { font-size: 1.25rem; margin-bottom: 6px; }
.card p { color: var(--text-soft); line-height: 1.5; font-size: 0.95rem; }
.card.wide { grid-column: 1 / -1; min-height: 100px; }
.card.card-featured { grid-column: span 2; background: linear-gradient(130deg, rgba(14, 180, 255, 0.1), transparent 45%), linear-gradient(180deg, var(--surface), var(--surface-2)); border-color: rgba(136, 176, 224, 0.28); }
.card-chips { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.card-chips span { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; padding: 3px 10px; border-radius: 999px; background: rgba(14, 180, 255, 0.1); border: 1px solid rgba(14, 180, 255, 0.25); color: var(--accent-2); }
.card.card-bar { grid-column: 1 / -1; min-height: unset; padding: 14px 22px; display: flex; align-items: center; gap: 20px; }
.card.card-bar .card-icon { margin-bottom: 0; white-space: nowrap; }
.card.card-bar h3 { margin-bottom: 0; white-space: nowrap; }
.card.card-bar p { margin: 0; }

/* Hide requested docs areas + remove bubble chips */
.card-chips { display: none; }
a.side-link[href="/docs/controls"],
a.side-link[href="/docs/game-modes"],
a.side-link[href="/docs/installation"],
a.side-link[href="/docs/probability-overlay"],
a.side-link[href="/docs/replays"],
a.side-link[href="/docs/skins"],
a.card-link[href="/docs/controls"],
a.card-link[href="/docs/game-modes"],
a.card-link[href="/docs/probability-overlay"],
a.card-link[href="/docs/replays"],
a.card-link[href="/docs/skins"] {
  display: none;
}
.sidebar .sidebar-group:nth-child(2) {
  display: none;
}

/* ── Changelog ─────────────────────────────────────── */
.release { background: linear-gradient(120deg, rgba(103, 225, 255, 0.05), transparent 35%), linear-gradient(180deg, var(--surface), var(--surface-2)); border: 1px solid var(--line); border-radius: 10px; padding: 20px 20px 16px; margin-bottom: 12px; }
.release h2 { font-size: 1.3rem; margin-bottom: 8px; }
.release h3 { font-size: 1.02rem; margin-top: 10px; margin-bottom: 8px; }
.release p { color: var(--text-soft); line-height: 1.55; }
.release ul { margin-top: 8px; padding-left: 18px; display: grid; gap: 5px; }
.release li { color: var(--text-soft); line-height: 1.5; }
.note { font-style: italic; }

/* ── Footer ────────────────────────────────────────── */
footer { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--text-soft); font-size: 0.9rem; }
footer a { color: var(--accent-2); text-decoration: none; font-weight: 700; }

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 980px) {
  .page { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; }
  .sidebar-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
  .sidebar-group + .sidebar-group { margin-top: 10px; padding-top: 10px; }
  .sidebar-title { width: 100%; margin-bottom: 2px; }
  .side-link { padding: 6px 8px; border: 1px solid rgba(136, 176, 224, 0.18); border-radius: 999px; font-size: 0.85rem; }
  .card-grid { grid-template-columns: 1fr 1fr; }
  .card.card-featured { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .bar-inner, .page { width: calc(100% - 18px); }
  .bar-inner { min-height: 58px; }
  .brand { font-size: 1.14rem; }
  .brand-icon { width: 18px; height: 18px; }
  .top-actions { display: none; }
  .lead { font-size: 1rem; }
  .card-grid { grid-template-columns: 1fr; }
  .card.card-bar { flex-wrap: wrap; gap: 8px; }
  table { font-size: 0.82rem; }
  th, td { padding: 6px 6px; }
}
