/* base.css — design tokens + shared chrome. Game pages override the tokens
   in their own skin stylesheet to get a per-game look on one backbone. */
:root {
  --bg: #15181e;            /* dark "paper" */
  --grid: rgb(232 230 225 / 0.06);
  --panel: #1b1f27;
  --panel-edge: #2c3240;
  --text: #ece9e2;          /* off-white ink */
  --muted: #9ea4ae;
  --accent: #a77bff;        /* twitch purple, lifted for dark paper */
  --accent-text: #ffffff;
  --marker: rgb(255 214 64 / 0.32); /* yellow highlighter */
  --live: #eb0400;
  --radius: 10px;
  --wobble: 255px 15px 225px 15px / 15px 225px 15px 255px; /* hand-drawn box */
  --max-width: 980px;
  --sidebar-w: 14.5rem;
  --font-body: system-ui, 'Segoe UI', sans-serif;
  --font-hand: 'Excalifont', 'Comic Sans MS', var(--font-body);
  --font-display: var(--font-hand);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
}
/* Grid paper only behind the site chrome; game pages paint their own world. */
body:has(> site-nav) {
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  min-height: 100vh;
  padding-left: var(--sidebar-w); /* room for the fixed sidebar */
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.2; }

.wrap { max-width: var(--max-width); margin: 0 auto; padding: 0 1rem; }

/* ---- header + sidebar (site-nav) ---- */
.site-header {
  display: flex; justify-content: center; align-items: center;
  padding: 1.4rem 1rem 0.6rem;
}
.nav-logo {
  font-family: var(--font-hand); font-size: 2rem; color: var(--text);
  letter-spacing: 0.02em; padding: 0 0.3em;
  background: linear-gradient(transparent 58%, var(--marker) 58%, var(--marker) 88%, transparent 88%);
}
.nav-logo:hover { text-decoration: none; color: var(--text); }

.site-sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  padding: 1.6rem 1rem; overflow-y: auto; z-index: 40;
  border-right: 2px dashed var(--panel-edge);
}
.side-list, .side-sub { list-style: none; margin: 0; padding: 0; }
.side-list > li { margin-bottom: 0.5rem; }
.side-link {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  width: 100%; padding: 0.45rem 0.8rem;
  font-family: var(--font-hand); font-size: 1.2rem; line-height: 1.3; text-align: left;
  color: var(--text); background: none; cursor: pointer;
  border: 2px solid transparent; border-radius: var(--wobble);
}
.side-list > li > .side-link { border-color: var(--panel-edge); }
.side-link:hover, .side-link:focus-visible {
  text-decoration: none; border-color: var(--text); outline: none;
  background: linear-gradient(transparent 62%, var(--marker) 62%, var(--marker) 90%, transparent 90%) no-repeat;
}
.side-link.is-current { color: var(--accent); }
.side-caret {
  width: 0.5rem; height: 0.5rem; margin-right: 0.2rem; flex: none;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px); transition: transform 0.15s;
}
.side-games[aria-expanded="true"] .side-caret { transform: rotate(225deg) translateY(-2px); }
.side-sub {
  margin: 0.3rem 0 0.2rem 0.9rem; padding-left: 0.5rem;
  border-left: 2px solid var(--panel-edge);
}
.side-sub[hidden] { display: none; }
.side-sub .side-link { font-size: 1.05rem; padding: 0.25rem 0.6rem; white-space: nowrap; }
.side-sub .nav-uc { color: var(--muted); }
.side-empty { color: var(--muted); padding: 0.25rem 0.6rem; }

site-footer { display: block; }

@media (max-width: 720px) {
  body:has(> site-nav) { padding-left: 0; }
  .site-header { padding: 1rem 16px 0.4rem; }
  .site-sidebar {
    position: static; width: auto; padding: 0.4rem 16px 0.8rem;
    border-right: 0; border-bottom: 2px dashed var(--panel-edge);
  }
  .side-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
  .side-list > li { margin: 0; }
  .side-link { width: auto; }
  .side-list > li:has(> .side-sub:not([hidden])) { flex-basis: 100%; }
  .side-sub { display: flex; flex-wrap: wrap; gap: 0.2rem 0.4rem; margin-left: 0.4rem; }
  .wrap { padding: 0 16px; }
}

/* ---- under-construction popup ---- */
.uc-dialog {
  max-width: min(26rem, calc(100vw - 32px)); padding: 1.6rem 1.8rem 1.4rem;
  color: var(--text); background: var(--panel);
  border: 2px solid var(--text); border-radius: var(--wobble);
  box-shadow: 6px 7px 0 rgb(0 0 0 / 0.45);
}
.uc-dialog::backdrop { background: rgb(8 9 12 / 0.65); }
.uc-title { margin: 0 0 0.5rem; font-size: 1.6rem; }
.uc-dialog p { margin: 0 0 1.2rem; color: var(--muted); }
.uc-close {
  font-family: var(--font-hand); font-size: 1.15rem; padding: 0.35rem 1.1rem;
  color: var(--text); background: none; cursor: pointer;
  border: 2px solid var(--text); border-radius: var(--wobble);
}
.uc-close:hover, .uc-close:focus-visible { background: var(--marker); outline: none; }

/* ---- panels ---- */
.panel {
  background: var(--panel); border: 2px solid var(--panel-edge);
  border-radius: var(--wobble); padding: 1.2rem 1.4rem; margin: 1.2rem 0;
}

/* ---- now playing ---- */
.live-banner {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-weight: 700; color: var(--live); text-transform: uppercase; letter-spacing: 0.08em;
}
.live-dot {
  width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--live);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.35; } }
.offline-banner { color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.stream-title { margin: 0.4rem 0 0.2rem; }
.stream-game { color: var(--muted); margin-bottom: 0.8rem; }
.stream-embed { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--radius); }
.stream-notes {
  margin-top: 1rem; padding: 0.9rem 1.1rem; border-left: 3px solid var(--accent);
  background: rgb(145 70 255 / 0.08); border-radius: 0 var(--radius) var(--radius) 0;
}
.stream-notes h3 { margin: 0 0 0.3rem; font-size: 1rem; }
.stream-notes p { margin: 0; white-space: pre-line; }
.next-stream { margin-top: 0.6rem; }
.next-label { color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; }
.next-when { font-size: 1.3rem; font-weight: 600; }
.next-when .zone { color: var(--muted); font-size: 0.85rem; font-weight: 400; }
.next-count { color: var(--accent); font-weight: 600; margin: 0.15rem 0 0.4rem; }
.next-title { }
.next-game { color: var(--muted); }
.current-game { margin-top: 1rem; color: var(--muted); }

/* ---- schedule ---- */
.sched-zone { color: var(--muted); font-size: 0.85rem; margin-bottom: 0.6rem; }
.sched-list { list-style: none; margin: 0; padding: 0; }
.sched-item {
  display: grid; grid-template-columns: 11rem 8rem 1fr; gap: 0.6rem;
  padding: 0.6rem 0.2rem; border-bottom: 1px solid var(--panel-edge);
}
.sched-item:last-child { border-bottom: 0; }
.sched-day { font-weight: 600; }
.sched-time { color: var(--muted); }
.sched-game { color: var(--accent); margin-right: 0.6rem; }
.sched-flag {
  color: var(--live); font-size: 0.8rem; text-transform: uppercase; margin-left: 0.5rem;
}
.sched-item.is-canceled .sched-day,
.sched-item.is-canceled .sched-time,
.sched-item.is-canceled .sched-what .sched-title { text-decoration: line-through; color: var(--muted); }
.sched-empty { color: var(--muted); }
@media (max-width: 640px) {
  .sched-item { grid-template-columns: 1fr; gap: 0.1rem; }
}

/* ---- updates strip ---- */
.updates { display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem; padding: 0; margin: 0; list-style: none; }
.updates li { color: var(--muted); font-size: 0.9rem; }
.updates .u-date { color: var(--text); font-weight: 600; margin-right: 0.4rem; }

/* ---- footer ---- */
.footer {
  display: flex; justify-content: space-between; gap: 1rem;
  max-width: var(--max-width); margin: 3rem auto 0; padding: 1.2rem 1rem 2rem;
  color: var(--muted); font-size: 0.9rem; border-top: 2px dashed var(--panel-edge);
}

/* ---- game page shared bits ---- */
.game-header { margin: 1.4rem 0 0.6rem; }
.game-status { color: var(--muted); }
.map-frame {
  position: relative; overflow: hidden; touch-action: none;
  background: var(--panel); border: 1px solid var(--panel-edge);
  border-radius: var(--radius); height: 70vh; min-height: 320px;
}
.map-frame .map-inner { position: absolute; transform-origin: 0 0; will-change: transform; }
.map-empty { color: var(--muted); text-align: center; padding-top: 20vh; }
.map-history { display: flex; align-items: center; gap: 0.8rem; margin-top: 0.7rem; color: var(--muted); }
.map-history input[type=range] { width: min(20rem, 50vw); accent-color: var(--accent); }
.map-history-date { font-weight: 600; color: var(--text); }
