/* WTF is this game about?! — graphite.
   A dark viewport: the map is a lit sheet on a near-black desk, the HUD is a
   set of hairline panels with corner brackets, signal yellow marks the things
   that matter (you, the countdown, the button to press), and red is kept
   for revisions. The title is the one hand-drawn thing. */

:root {
  --bg: #0a0b0d;              /* the desk around the map */
  --sheet: #111316;           /* the map */
  --panel: #0e1013;           /* side panel */
  --surface: rgba(16, 18, 21, 0.92); /* HUD panels over the map */
  --raised: #16191d;          /* cards, inputs */
  --raised-2: #1d2126;        /* hover */
  --raised-3: #272c32;        /* pressed */
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);
  --line-bright: rgba(255, 255, 255, 0.34);
  --ink: #eceef1;
  --muted: #9ba2ab;
  --faint: #666d77;
  --accent: #ffd23f;          /* signal yellow: you, the clock, the button */
  --accent-hover: #ffe06e;
  --accent-soft: rgba(255, 210, 63, 0.1);
  --accent-line: rgba(255, 210, 63, 0.42);
  --on-accent: #17140b;
  --red: #ff5a4e;             /* revisions, late, errors */
  --red-soft: rgba(255, 90, 78, 0.12);
  --green: #46e3a0;           /* built and ready */
  --green-soft: rgba(70, 227, 160, 0.12);
  --twitch: #9147ff;
  --scrim: rgba(5, 6, 8, 0.78);
  --radius: 3px;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.4);
  --body: 'Archivo', system-ui, sans-serif;
  --marker: 'Caveat Brush', 'Archivo', cursive;
  color-scheme: dark;
}
/* Dark in both themes; restated for the theme contract. */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: #0a0b0d; color-scheme: dark; } }
:root[data-theme="dark"] { --bg: #0a0b0d; color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
::selection { background: rgba(255, 210, 63, 0.3); }
button, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
kbd { font: inherit; font-size: 12px; font-weight: 700; padding: 1px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 3px; background: var(--raised); }
svg { flex: none; }
* { scrollbar-width: thin; scrollbar-color: var(--raised-3) transparent; }

.app { display: grid; grid-template-columns: minmax(0, 1fr) var(--side-w, 440px); height: 100%; }
.app.side-collapsed { grid-template-columns: minmax(0, 1fr) 58px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Small caps label used across the HUD */
.label, .notes-title, .coming-label, .host-label, .rv-kicker, .idea-votes span {
  font-size: 11px; font-weight: 650; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-stretch: 100%;
}

/* ---------------------------------------------------------------- HUD --- */

/* A hairline panel with bright corner brackets. */
.hud {
  --bk: var(--line-bright);
  --bl: 12px;
  background:
    linear-gradient(var(--bk) 0 0) left top / var(--bl) 1px,
    linear-gradient(var(--bk) 0 0) left top / 1px var(--bl),
    linear-gradient(var(--bk) 0 0) right top / var(--bl) 1px,
    linear-gradient(var(--bk) 0 0) right top / 1px var(--bl),
    linear-gradient(var(--bk) 0 0) left bottom / var(--bl) 1px,
    linear-gradient(var(--bk) 0 0) left bottom / 1px var(--bl),
    linear-gradient(var(--bk) 0 0) right bottom / var(--bl) 1px,
    linear-gradient(var(--bk) 0 0) right bottom / 1px var(--bl),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 60%),
    var(--surface);
  background-repeat: no-repeat;
  background-origin: border-box;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  backdrop-filter: blur(14px) saturate(1.15);
}
.hud-accent { --bk: var(--accent); --bl: 16px; }

/* -------------------------------------------------------------- buttons --- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--raised);
  font-weight: 650; font-size: 14px; white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.08s;
}
.btn:hover:not(:disabled) { background: var(--raised-2); border-color: var(--line-bright); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 750;
  clip-path: polygon(9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%, 0 9px);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary:focus-visible { background: #fff; border-color: #fff; }
.btn-twitch { background: var(--twitch); border-color: var(--twitch); color: #fff; font-weight: 750; }
.btn-twitch:hover:not(:disabled) { background: #a366ff; border-color: #a366ff; }
.btn-small { height: 32px; padding: 0 12px; font-size: 13px; }
.btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.btn[aria-pressed="true"]::before {
  content: ''; width: 14px; height: 14px; margin-left: -2px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius);
  color: var(--ink); transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.icon-btn:hover { background: var(--raised-2); border-color: var(--line-bright); }
.icon-btn svg, .chip-btn svg, .search svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn[aria-pressed="true"] { color: var(--accent); border-color: var(--accent-line); }

.chip-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px 0 11px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius);
  font-size: 13.5px; font-weight: 650; color: var(--ink);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: background-color 0.15s, border-color 0.15s;
}
.chip-btn:hover { background: var(--raised-2); border-color: var(--line-bright); }
.chip-btn svg { color: var(--accent); }

.link-btn { all: unset; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line-strong); transition: color 0.15s, border-color 0.15s; }
.link-btn:hover { color: var(--ink); border-color: var(--ink); }
.link-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ------------------------------------------------------------- board --- */

.board { position: relative; overflow: hidden; background: var(--bg); touch-action: none; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
#map.dragging { cursor: grabbing; }
/* life in the empty squares, drawn square by square on its own canvas (board.js drawCells) */
.fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.hint {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%); z-index: 3;
  margin: 0; max-width: min(520px, calc(100% - 380px));
  padding: 10px 18px; background: var(--accent); color: var(--on-accent);
  font-weight: 700; font-size: 14px; text-align: center; text-wrap: balance;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  pointer-events: none;
  animation: hint-in 0.35s ease-out;
}
@keyframes hint-in { from { opacity: 0; transform: translate(-50%, -6px); } }

.corner { position: absolute; left: 16px; top: 16px; z-index: 4; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.corner-row { display: flex; gap: 6px; }

/* Notes: the top ideas, shown in the OBS view (players see them in the Ideas tab) */
.notes { display: none; padding: 16px 22px 18px; border-bottom: 1px solid var(--line); }
.notes-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 4px; }
.notes-title { margin: 0; }
.round-chip { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); padding: 2px 7px; background: var(--accent-soft); border-radius: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.notes-list { margin: 0; padding: 0; list-style: none; }
.notes-list li { display: grid; grid-template-columns: 22px 1fr auto; gap: 6px 8px; align-items: baseline; padding: 9px 0 8px; border-bottom: 1px solid var(--line); }
.notes-list li:last-child { border-bottom: 0; }
.notes-list .n { font-size: 11px; font-weight: 700; color: var(--faint); font-variant-numeric: tabular-nums; }
.notes-list button {
  all: unset; cursor: pointer; font-size: 14.5px; font-weight: 600; line-height: 1.3; color: var(--ink); overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.notes-list button:hover, .notes-list button:focus-visible { color: var(--accent); }
.notes-list b { font-size: 18px; line-height: 1; font-weight: 800; font-stretch: 75%; font-variant-numeric: tabular-nums; color: var(--ink); }
.notes-list .bar { grid-column: 2 / 4; height: 2px; background: var(--line); overflow: hidden; }
.notes-list .bar i { display: block; height: 100%; background: var(--faint); transition: width 0.6s cubic-bezier(.2, .8, .2, 1); }
.notes-list li:first-child .n, .notes-list li:first-child b { color: var(--accent); }
.notes-list li:first-child .bar i { background: var(--accent); box-shadow: 0 0 10px rgba(255, 210, 63, 0.6); }
.notes-list .empty { grid-column: 1 / -1; color: var(--muted); font-size: 14px; padding: 4px 0; }

/* Bottom-left: overview + zoom */
.nav { position: absolute; left: 16px; bottom: 16px; z-index: 3; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.keyplan { width: 144px; height: 144px; border: 1px solid var(--line-strong); background: var(--sheet); cursor: pointer; box-shadow: var(--shadow); }
.zoom { display: flex; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.zoom .icon-btn { background: none; border: 0; border-radius: 0; border-right: 1px solid var(--line); }
.zoom .icon-btn:last-child { border-right: 0; }
.zoom .icon-btn:hover { background: var(--raised-2); }
#zoom-me { color: var(--accent); }

/* ------------------------------------------------------------- side --- */

/* The right column: logo, the clock everyone watches, then the panel. Nothing sits on the map. */
.side { position: relative; display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-left: 1px solid var(--line-strong); box-shadow: -24px 0 48px rgba(0, 0, 0, 0.35); z-index: 5; }
/* drag the left edge to resize; the tab hides the panel down to a slim rail with the clock */
.side-grip { position: absolute; left: -5px; top: 0; bottom: 0; width: 10px; z-index: 7; cursor: col-resize; touch-action: none; }
.side-grip::after { content: ''; position: absolute; left: 4px; top: 0; bottom: 0; width: 2px; background: var(--accent); opacity: 0; transition: opacity 0.15s; }
.side-grip:hover::after, .side-grip:focus-visible::after, .side-grip.dragging::after { opacity: 0.7; }
.side-grip:focus-visible { outline: none; }
.side-tab { position: absolute; left: -22px; top: 50%; z-index: 8; width: 22px; height: 56px; margin-top: -28px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line-strong); border-right: 0; border-radius: var(--radius) 0 0 var(--radius); background: var(--panel); color: var(--muted); }
.side-tab:hover { color: var(--ink); background: var(--raised-2); }
.side-tab svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.side-collapsed .side-tab svg { transform: rotate(180deg); }
.rail { display: none; }
.side-collapsed .side > :not(.rail):not(.side-tab) { display: none; }
.side-collapsed .rail { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px 0; cursor: pointer; }
.rail-label { font-size: 9px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); text-align: center; }
.rail-clock { margin-bottom: 14px; font-size: 22px; line-height: 1.05; font-weight: 800; font-stretch: 70%; font-variant-numeric: tabular-nums; text-align: center; color: var(--accent); text-shadow: 0 0 18px rgba(255, 210, 63, 0.35); }
.rail-rev { font-size: 26px; line-height: 1; font-weight: 800; font-stretch: 70%; color: var(--ink); }
body.resizing { cursor: col-resize; user-select: none; }
body.resizing #map { pointer-events: none; }
.hq { flex: none; border-bottom: 1px solid var(--line-strong); background: radial-gradient(ellipse at 20% 0%, rgba(255, 210, 63, 0.06), transparent 60%), linear-gradient(180deg, #121417, var(--panel)); }
.brand { margin: 0; padding: 14px 22px 6px; line-height: 0; }
/* The logo is live text that keeps getting patched (logo.js): each block can change font, size, tilt, case or punctuation. */
.logo { --lg: 64px; --sm: 14px; position: relative; display: block; line-height: 1; color: var(--ink); }
.logo-row { display: flex; align-items: center; white-space: nowrap; transform-origin: left center; transition: transform 0.25s; }
.logo-row-0 { height: var(--lg); font-size: var(--lg); gap: 0.04em; }
.logo-row-1 { height: calc(var(--sm) * 1.9); font-size: var(--sm); gap: 0.55em; margin-top: 4px; }
.logo-block { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.logo-glyph { display: inline-block; line-height: 1; transition: transform 0.25s; }
.logo-glyph.track { letter-spacing: 0.16em; margin-right: -0.16em; }
.logo-glyph[data-color="ink"] { color: var(--ink); }
.logo-glyph[data-color="soft"] { color: #c9cdd3; }
.logo-glyph[data-color="accent"] { color: var(--accent); text-shadow: 0 0 24px rgba(255, 210, 63, 0.35); }
.logo-glyph[data-color="outline"] { color: transparent; -webkit-text-stroke: 1.5px var(--ink); }
.logo-row-0 .logo-letter .logo-glyph { margin: 0 -0.01em; }
.logo-punct { margin-left: 0.08em; }
/* a patch: a yellow bar wipes over the block, the block changes under it, the bar wipes off */
.logo-block::after { content: ''; position: absolute; inset: -6% -8%; background: var(--accent); transform: scaleX(0); transform-origin: left; pointer-events: none; }
.logo-block.cover::after { transform: scaleX(1); transition: transform 0.17s cubic-bezier(.5, 0, .3, 1); }
.logo-block.uncover::after { transform: scaleX(0); transform-origin: right; transition: transform 0.24s cubic-bezier(.3, 0, .2, 1); }
.brand-logo { max-width: 330px; }

/* The season: day and end (the leader shows in the OBS view only) */
.season { margin: 4px 14px 8px; padding: 0 2px; }
.season-row { display: flex; align-items: baseline; gap: 10px; font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.season-name { color: var(--ink); font-weight: 800; }
.season-ends { margin-left: auto; white-space: nowrap; }
.season-meter { display: block; height: 2px; margin: 7px 0 4px; background: var(--line); }
.season-meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--muted), var(--ink)); }
.season-lead { display: none; align-items: center; gap: 8px; min-height: 20px; font-size: 13px; color: var(--muted); }
.season-lead canvas, .season-lead img { width: 18px; height: 18px; image-rendering: pixelated; border-radius: 2px; background: var(--raised); }
.season-lead strong { color: var(--ink); font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 170px; }
.season-lead .pts { margin-left: auto; font-weight: 800; font-stretch: 80%; font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }
.season-lead .you { color: var(--accent); }

.status { margin: 6px 14px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: rgba(255, 255, 255, 0.02); position: relative; }
.status::before, .status::after { content: ''; position: absolute; width: 14px; height: 14px; border: 0 solid var(--accent); pointer-events: none; }
.status::before { left: -1px; top: -1px; border-left-width: 1px; border-top-width: 1px; }
.status::after { right: -1px; bottom: -1px; border-right-width: 1px; border-bottom-width: 1px; }
.st-main { display: grid; grid-template-columns: 1fr; }
.st-countdown { padding: 13px 16px 14px; min-width: 0; }
.st-label { display: block; font-size: 11px; font-weight: 650; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.st-clock {
  display: block; margin: 3px 0 6px; font-size: 52px; line-height: 1; font-weight: 800; font-stretch: 70%;
  font-variant-numeric: tabular-nums; letter-spacing: 0.01em; color: var(--accent);
  text-shadow: 0 0 30px rgba(255, 210, 63, 0.3);
}
.st-line { display: block; font-size: 14px; font-weight: 550; line-height: 1.35; color: var(--muted); overflow-wrap: anywhere; }
.st-line b { color: var(--ink); font-weight: 700; }
.st-line[data-state="late"] b { color: var(--red); }
/* the revision count sits next to the clock in the OBS view; players see it on the Rules button */
.st-rev { display: none; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-left: 1px solid var(--line); background: rgba(255, 255, 255, 0.02); }
.st-rev .st-label { font-size: 10px; }
.st-revnum { display: block; font-size: 50px; line-height: 1; font-weight: 800; font-stretch: 70%; font-variant-numeric: tabular-nums; color: var(--ink); }
.chip-rev { margin-left: 2px; padding: 1px 6px; border-radius: 2px; font-size: 10.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); background: var(--raised-3); }

/* Square inspector */
.inspector { position: absolute; z-index: 6; width: 284px; padding: 14px 16px 16px; animation: pop 0.18s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(4px) scale(0.98); } }
.inspector .who { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; padding-right: 22px; }
.inspector .who canvas, .inspector .who img { width: 44px; height: 44px; flex: none; image-rendering: pixelated; padding: 5px; border: 1px solid var(--line-strong); border-radius: 2px; background: var(--raised); }
.inspector .who img { padding: 0; }
.inspector .name { font-weight: 750; font-size: 17px; line-height: 1.2; overflow-wrap: anywhere; }
.inspector .where { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.inspector dl { margin: 6px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 0; font-size: 14px; }
.inspector dt, .inspector dd { padding: 6px 0; border-top: 1px solid var(--line); }
.inspector dt { color: var(--muted); }
.inspector dd { margin: 0; text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.inspector p { margin: 6px 0 10px; color: var(--muted); }
.inspector p strong { color: var(--ink); }
.inspector .close { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border: 0; background: none; color: var(--muted); }
.inspector .close:hover { color: var(--ink); background: var(--raised-2); }
.inspector .close svg { width: 16px; height: 16px; }
.inspector .btn { width: 100%; margin-top: 8px; }

/* ------------------------------------------------------------- panel --- */

.panel { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--panel); }
.sheet-handle { display: none; }

.me { padding: 12px 20px; border-bottom: 1px solid var(--line); }
.me-row { display: flex; align-items: center; gap: 14px; }
.me-avatar { width: 48px; height: 48px; flex: none; image-rendering: pixelated; padding: 6px; border: 1px solid var(--accent-line); border-radius: 2px; background: var(--raised); box-shadow: 0 0 0 3px var(--accent-soft), 0 0 22px rgba(255, 210, 63, 0.15); }
img.me-avatar { padding: 0; }
.me-name { font-weight: 750; font-size: 18px; line-height: 1.2; overflow-wrap: anywhere; }
.me-sub { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.me-points { margin-left: auto; text-align: right; }
.me-points strong { display: block; font-size: 34px; line-height: 0.95; font-weight: 800; font-stretch: 70%; font-variant-numeric: tabular-nums; }
.me-points span { display: block; margin-top: 3px; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.me-points.bump strong { animation: bump 0.6s ease-out; }
@keyframes bump { 0% { color: var(--accent); transform: translateY(-4px); text-shadow: 0 0 20px rgba(255, 210, 63, 0.7); } 100% { color: var(--ink); transform: none; text-shadow: none; } }
.me p { margin: 0 0 12px; color: var(--muted); }
.me-login { display: flex; gap: 8px; }
.me-login input, .host-login input {
  flex: 1; min-width: 0; height: 40px; padding: 0 12px;
  background: var(--raised); border: 1px solid var(--line-strong); border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.me-login input:focus, .host-login input:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.me-out { margin-top: 8px; background: none; border: 0; padding: 0; color: var(--faint); font-size: 12.5px; font-weight: 600; }
.me-out:hover { color: var(--ink); }

.tabs { display: flex; padding: 0 12px; border-bottom: 1px solid var(--line); }
.tabs button {
  position: relative; flex: 1; height: 46px; background: none; border: 0;
  font-weight: 700; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint);
  transition: color 0.15s;
}
.tabs button:hover { color: var(--muted); }
.tabs button[aria-selected="true"] { color: var(--ink); background: linear-gradient(0deg, rgba(255, 210, 63, 0.07), transparent 70%); }
.tabs button[aria-selected="true"]::after { content: ''; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px; background: var(--accent); box-shadow: 0 0 12px rgba(255, 210, 63, 0.6); }

.tab { flex: 1; overflow-y: auto; padding: 14px 20px 40px; }
.tab-title { margin: 0 0 12px; font-size: 22px; font-weight: 800; font-stretch: 85%; text-wrap: balance; letter-spacing: -0.005em; }
.sub-title { margin: 28px 0 10px; font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

/* Ideas tab header: the title and the button to add one */
.ideas-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 32px; margin-bottom: 10px; }
.ideas-head .tab-title { margin: 0; font-size: 18px; }
.ideas-head .btn { flex: none; }

.compose { margin: 0 0 6px; padding: 14px 14px 14px; background: var(--raised); border: 1px solid var(--accent-line); border-radius: var(--radius); animation: rise 0.22s ease-out; }
.field + .field { margin-top: 12px; }
.field-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.field label { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.compose input, .compose textarea {
  width: 100%; padding: 10px 12px;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius); line-height: 1.4;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.compose input { height: 42px; font-weight: 650; font-size: 15.5px; }
.compose textarea { resize: vertical; min-height: 96px; max-height: 260px; }
.compose input::placeholder, .compose textarea::placeholder, .me-login input::placeholder, .search input::placeholder { color: var(--faint); }
.compose input:focus, .compose textarea:focus { border-color: var(--accent-line); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.compose-row { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.count { font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; font-weight: 600; }
.compose-note { margin: 10px 0 0; font-size: 14px; color: var(--muted); }
.compose-note.error { color: var(--red); }
.decree { margin: 0 0 14px; padding: 14px; border-radius: var(--radius); border: 1px solid var(--accent-line); background: linear-gradient(135deg, rgba(255, 210, 63, 0.12), rgba(255, 210, 63, 0.02) 70%), var(--raised); }
.decree h3 { margin: 0 0 4px; font-size: 17px; font-weight: 800; }
.decree p { margin: 0 0 10px; font-size: 13.5px; color: var(--muted); }
.decree.info { border-color: var(--line-strong); background: var(--raised); }
.decree.info p { margin: 0; }
.decree .compose { margin: 0; padding: 0; border: 0; background: none; animation: none; }
.compose-done { margin: 0 0 6px; padding: 10px 14px; font-size: 14px; color: var(--ink); background: var(--green-soft); border: 1px solid rgba(70, 227, 160, 0.35); border-radius: var(--radius); }
.callout { display: flex; align-items: center; gap: 10px; margin: 0; padding: 11px 14px; border-radius: var(--radius); background: var(--raised); border: 1px solid var(--line-strong); font-size: 14px; font-weight: 600; color: var(--ink); }
.callout::before { content: ''; flex: none; width: 8px; height: 8px; background: var(--accent); box-shadow: 0 0 10px rgba(255, 210, 63, 0.7); }
.similar { margin-top: 12px; padding: 10px 12px; background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius); }
.similar p { margin: 0 0 6px; font-size: 12px; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.similar-item { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 14px; }
.similar-item span { flex: 1; }

.browse { position: sticky; top: -14px; z-index: 2; margin: 10px -20px 0; padding: 8px 20px 8px; background: rgba(14, 16, 19, 0.96); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.search { position: relative; display: block; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.search input { width: 100%; height: 38px; padding: 0 12px 0 36px; background: var(--raised); border: 1px solid var(--line-strong); border-radius: var(--radius); transition: border-color 0.15s, box-shadow 0.15s; }
.search input:focus { border-color: var(--accent-line); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.browse-row { display: flex; gap: 6px; align-items: stretch; }
.browse-row .filters { flex: 1; margin: 0; }
.search-toggle { width: 38px; height: auto; background: var(--raised); border-color: var(--line); }
.search-toggle[aria-expanded="true"] { color: var(--accent); border-color: var(--accent-line); }
.search-toggle svg { width: 16px; height: 16px; }
.browse .search { margin-top: 8px; }
.filters { display: flex; gap: 2px; margin-top: 8px; padding: 3px; background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius); }
.filters button { flex: 1; height: 30px; padding: 0 10px; border: 0; border-radius: 2px; background: none; font-size: 12.5px; font-weight: 700; color: var(--muted); transition: background-color 0.15s, color 0.15s; }
.filters button:hover { color: var(--ink); }
.filters button[aria-pressed="true"] { background: var(--raised-3); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }

.ideas { list-style: none; margin: 0; padding: 0; }
.idea { display: grid; grid-template-columns: 54px 1fr; gap: 0 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.idea-votes { grid-row: span 3; text-align: center; padding-top: 2px; }
.idea-votes strong { display: block; font-size: 30px; line-height: 1; font-weight: 800; font-stretch: 70%; font-variant-numeric: tabular-nums; }
.idea-votes span { font-size: 10px; color: var(--faint); }
.idea-text { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; width: 100%; padding: 0; border: 0; background: none; text-align: left; font-weight: 700; font-size: 15.5px; line-height: 1.3; color: var(--ink); overflow-wrap: anywhere; }
.idea-text span { min-width: 0; }
.idea-text svg { width: 16px; height: 16px; margin-top: 2px; fill: none; stroke: var(--faint); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transform: rotate(90deg); transition: transform 0.2s, stroke 0.15s; }
.idea-text:hover svg { stroke: var(--ink); }
.idea.open .idea-text svg { transform: rotate(-90deg); }
.idea-body { display: none; grid-column: 2; margin: 10px 0 0; padding: 10px 12px; font-size: 14px; line-height: 1.5; color: #c9cdd3; overflow-wrap: anywhere; white-space: pre-line; background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius); }
.idea.open .idea-body:not(:empty) { display: block; }
.take-back { margin-left: auto; font-size: 12px; color: var(--faint); border-bottom-color: transparent; }
.take-back.confirm { color: var(--red); border-bottom-color: var(--red); }
.compose-cost { margin: 10px 0 0; padding: 9px 12px; font-size: 13px; color: var(--muted); background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius); }
.idea-meta { grid-column: 2; margin-top: 2px; font-size: 12.5px; color: var(--faint); }
.idea-actions { grid-column: 2; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 9px; }
.idea-actions .mine { font-size: 12px; font-weight: 700; color: var(--accent); }
.idea.is-new { animation: arrive 0.7s ease-out; }
.idea.flash { animation: arrive 1.6s ease-out; }
@keyframes arrive { from { background: rgba(255, 210, 63, 0.12); } to { background: transparent; } }

.stamp { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border: 1px solid currentColor; border-radius: 2px; font-weight: 800; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; }
.stamp-shipped { color: var(--accent); background: var(--accent-soft); }
.stamp-chosen { color: var(--green); background: var(--green-soft); }
.stamp-declined { color: var(--red); background: var(--red-soft); }
.stamp-withdrawn { color: var(--faint); background: rgba(255, 255, 255, 0.03); }
.idea-note { grid-column: 2; font-size: 13px; color: var(--muted); margin: 6px 0 0; padding: 7px 10px; background: var(--raised); border: 1px solid var(--line); border-radius: var(--radius); }
.empty { color: var(--muted); padding: 18px 0; }

/* Rules */
.coming {
  position: relative; margin-bottom: 24px; padding: 16px 18px;
  background: linear-gradient(135deg, rgba(255, 210, 63, 0.09), rgba(255, 210, 63, 0.02) 60%), var(--raised);
  border: 1px solid var(--accent-line); border-radius: var(--radius);
}
.coming-label { margin: 0 0 6px; }
.coming p { margin: 4px 0 0; color: var(--muted); }
.coming .idea-quote { font-family: var(--marker); font-size: 24px; line-height: 1.2; color: var(--ink); }
.coming .idea-quote-body { margin-top: 2px; font-size: 13.5px; color: #c3c7cd; }
.rev { margin: 0 0 24px; }
.rev-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rev-num { font-weight: 800; font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); padding: 2px 7px; border: 1px solid var(--line-strong); border-radius: 2px; }
.rev-title { margin: 0; font-size: 18px; font-weight: 800; font-stretch: 88%; }
.rev-credit { width: 100%; font-size: 12.5px; color: var(--faint); }
.rev ol { margin: 10px 0 0; padding-left: 26px; color: var(--ink); }
.rev li { margin: 5px 0; }
.rev li::marker { color: var(--faint); font-weight: 700; font-variant-numeric: tabular-nums; }
.rev-off { opacity: 0.5; }
.rev-off .rev-title::after { content: ' (switched off)'; font-weight: 600; color: var(--red); font-size: 14px; }
.rev-new { padding: 14px 16px; background: rgba(255, 90, 78, 0.05); border: 1px solid rgba(255, 90, 78, 0.35); border-radius: var(--radius); }
.rev-new .rev-num { color: var(--red); border-color: rgba(255, 90, 78, 0.5); }
.rev-tag { padding: 2px 7px; border-radius: 2px; font-size: 10px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--red); background: var(--red-soft); }
.constitution { margin: 0; padding-left: 20px; color: var(--muted); }
.constitution li { margin: 4px 0; }
.constitution li::marker { color: var(--red); }
.constitution-note { margin: 12px 0 14px; font-size: 13.5px; color: var(--muted); }

/* Ranks: the season race and the hall of fame */
.race-sub { margin: -6px 0 10px; font-size: 13px; color: var(--muted); }
.race-catchup { margin: 0 0 12px; padding: 9px 12px; font-size: 13px; color: var(--muted); background: var(--raised); border: 1px solid var(--line-strong); border-radius: var(--radius); }
.race-catchup b { color: var(--ink); }
.fame { list-style: none; margin: 0; padding: 0; }
.fame li { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.fame .s { font-size: 10.5px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.fame b { font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fame span:last-child { font-weight: 800; font-stretch: 80%; font-variant-numeric: tabular-nums; }
.fame .empty { display: block; grid-column: 1 / -1; padding: 6px 0; color: var(--muted); }
.rank .cu { margin-left: 6px; font-size: 10.5px; font-weight: 700; color: var(--faint); }

/* Ranks */
.ranks { list-style: none; margin: 0; padding: 0; }
.rank { display: grid; grid-template-columns: 30px 30px 1fr auto; gap: 12px; align-items: center; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.rank-n { color: var(--faint); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.rank:nth-child(-n+3) .rank-n { color: var(--accent); }
.rank canvas, .rank img { width: 30px; height: 30px; image-rendering: pixelated; padding: 3px; border-radius: 2px; background: var(--raised); border: 1px solid var(--line); }
.rank img { padding: 0; }
.rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.rank-pts { font-weight: 800; font-size: 16px; font-stretch: 80%; font-variant-numeric: tabular-nums; }
.rank.is-me { background: var(--accent-soft); border-radius: var(--radius); border-bottom-color: transparent; box-shadow: inset 0 0 0 1px var(--accent-line); }
.rank.is-me .rank-name { color: var(--accent); font-weight: 750; }

/* ------------------------------------------------------------ modals --- */

.modal { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; padding: 16px; background: var(--scrim); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); overflow-y: auto; animation: fade 0.2s ease-out; }
@keyframes fade { from { opacity: 0; } }
.modal-card { position: relative; width: 100%; max-width: 560px; padding: 30px 32px 26px; animation: rise 0.32s cubic-bezier(.2, .9, .3, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(0.985); } }
.modal-close { position: absolute; top: 10px; right: 10px; background: none; border-color: transparent; color: var(--muted); }
.modal-close:hover { color: var(--ink); }
.welcome { --bk: var(--accent); --bl: 18px; }
.wl-title { margin: 0; line-height: 0; }
.wl-logo { --lg: 96px; --sm: 21px; max-width: 460px; }
.wl-lead { margin: 14px 0 20px; font-size: 18px; font-weight: 600; text-wrap: balance; }
.wl-demo { margin: -10px 0 20px; font-size: 14px; color: var(--muted); }
.wl-steps { margin: 0 0 20px; padding: 0; list-style: none; counter-reset: wl; display: grid; gap: 2px; }
.wl-steps li { position: relative; padding: 11px 14px 11px 56px; counter-increment: wl; background: rgba(255, 255, 255, 0.03); color: var(--muted); }
.wl-steps li strong { color: var(--ink); }
.wl-steps li::before { content: '0' counter(wl); position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 20px; font-weight: 800; font-stretch: 70%; color: var(--accent); }
.wl-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.wl-actions .me-login { flex: 1 1 100%; }
.wl-actions .me-login input { height: 42px; }
.wl-actions .btn { height: 42px; }
.doc { max-width: 700px; max-height: calc(100dvh - 32px); overflow-y: auto; }
.doc h1 { margin: 0 0 6px; font-size: 26px; line-height: 1.15; font-weight: 800; font-stretch: 85%; padding-right: 36px; }
.doc h2 { margin: 26px 0 8px; font-size: 12px; font-weight: 750; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.doc p, .doc li { max-width: 66ch; color: #c9cdd3; }
.doc strong { color: var(--ink); }
.doc ol { padding-left: 24px; }
.doc li { margin: 0 0 8px; }
.doc li::marker { color: var(--faint); font-weight: 700; }
.doc code { font-size: 0.9em; padding: 1px 5px; background: var(--raised-2); border-radius: 2px; color: var(--ink); }

/* The rules window */
.rules-card { max-width: 980px; max-height: calc(100dvh - 32px); overflow-y: auto; padding: 30px 32px 28px; }
.rules-head { margin-bottom: 18px; padding-right: 40px; }
.rules-head h2 { margin: 4px 0 6px; font-size: 28px; line-height: 1.1; font-weight: 800; font-stretch: 85%; }
.rules-lead { margin: 0; color: var(--muted); }
.rules-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.rules-side { position: sticky; top: 0; }
.rules-side .sub-title:first-of-type { margin-top: 4px; }

/* How to play: the details under the welcome steps */
.welcome { max-width: 620px; max-height: calc(100dvh - 32px); overflow-y: auto; }
.wl-more { margin-top: 26px; padding-top: 4px; border-top: 1px solid var(--line); }
.wl-faq { margin: 0; }
.wl-faq dt { margin: 16px 0 4px; font-size: 14px; font-weight: 800; color: var(--ink); }
.wl-faq dd { margin: 0; font-size: 14px; line-height: 1.5; color: #c3c7cd; }

/* ------------------------------------------------------------ reveal --- */

.reveal {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; overflow-y: auto;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255, 90, 78, 0.12), transparent 60%),
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 40px 40px,
    rgba(8, 9, 11, 0.96);
  animation: fade 0.25s ease-out;
}
.rv-card { --bk: var(--red); --bl: 22px; position: relative; max-width: 740px; width: 100%; padding: 40px 46px 36px; overflow: hidden; }
.rv-card::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.07) 50%, transparent 70%); transform: translateX(-100%); animation: shine 1.2s 0.5s ease-out forwards; pointer-events: none; }
@keyframes shine { to { transform: translateX(100%); } }
.rv-kicker { margin: 0; color: var(--red); font-size: 12px; }
/* "Revision N": red corner brackets snap in around the number */
.rv-num { position: relative; display: inline-block; margin: 30px 0 28px; padding: 14px 22px 16px; font-size: clamp(64px, 12vw, 124px); line-height: 0.95; font-weight: 800; font-stretch: 68%; letter-spacing: -0.005em; }
.rv-num::before, .rv-num::after { content: ''; position: absolute; width: 0; height: 0; border: 0 solid var(--red); filter: drop-shadow(0 0 8px rgba(255, 90, 78, 0.6)); animation: bracket 0.5s 0.45s cubic-bezier(.2, .9, .3, 1) forwards; }
.rv-num::before { left: 0; top: 0; border-left-width: 3px; border-top-width: 3px; }
.rv-num::after { right: 0; bottom: 0; border-right-width: 3px; border-bottom-width: 3px; }
@keyframes bracket { to { width: 34px; height: 34px; } }
.rv-title { margin: 6px 0 14px; font-size: clamp(30px, 5vw, 46px); line-height: 1.05; font-weight: 800; font-stretch: 85%; }
.rv-idea { margin: 0; font-family: var(--marker); font-size: 32px; line-height: 1.2; color: var(--accent); text-shadow: 0 0 28px rgba(255, 210, 63, 0.3); }
.rv-body { margin: 6px 0 0; font-size: 16px; color: #c3c7cd; max-width: 60ch; }
.rv-credit { margin: 4px 0 24px; color: var(--muted); }
.rv-change { margin: 0 0 28px; padding: 16px 18px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line-strong); border-radius: var(--radius); font-size: 17px; }
.rv-change h3 { margin: 0 0 6px; font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.rv-change p { margin: 0; }
.rv-change p + p { margin-top: 6px; }
/* Season finale */
.rv-card.finale { --bk: var(--accent); }
.finale .rv-kicker { color: var(--accent); }
.fin-winner { display: flex; align-items: center; gap: 18px; margin: 26px 0 8px; }
.fin-winner canvas, .fin-winner img { width: 84px; height: 84px; flex: none; image-rendering: pixelated; padding: 8px; border: 1px solid var(--accent-line); border-radius: 3px; background: var(--raised); box-shadow: 0 0 0 4px var(--accent-soft), 0 0 40px rgba(255, 210, 63, 0.25); }
.fin-winner img { padding: 0; }
.fin-name { margin: 0; font-size: clamp(36px, 7vw, 64px); line-height: 1; font-weight: 800; font-stretch: 75%; overflow-wrap: anywhere; }
.fin-pts { display: block; margin-top: 6px; font-size: 15px; font-weight: 700; color: var(--accent); letter-spacing: 0.08em; text-transform: uppercase; }
.fin-top { list-style: none; margin: 18px 0 22px; padding: 0; counter-reset: fin; }
.fin-top li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 15px; counter-increment: fin; }
.fin-top li::before { content: counter(fin); width: 22px; color: var(--faint); font-weight: 800; }
.fin-top li span:first-of-type { flex: 1; }
.fin-top b { font-variant-numeric: tabular-nums; }
.rv-card.slam { animation: slam 0.55s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes slam { from { transform: scale(1.06); opacity: 0; filter: blur(6px); } to { transform: none; opacity: 1; filter: none; } }

/* ------------------------------------------------------------- toast --- */

.toast {
  position: fixed; left: 50%; top: 76px; z-index: 60; transform: translate(-50%, -12px);
  max-width: min(540px, calc(100% - 32px)); padding: 11px 16px 11px 18px; border-radius: var(--radius);
  background: var(--raised-2); color: var(--ink); font-weight: 600; font-size: 14px;
  border: 1px solid var(--accent-line); box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(255, 90, 78, 0.6); }

/* Host / demo controls (inside .corner) */
.hostbar { display: flex; flex-direction: column; gap: 6px; align-items: stretch; padding: 4px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); font-size: 13px; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); max-height: calc(100vh - 360px); overflow-y: auto; }
.host-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 30px; padding: 0 8px; border: 0; background: none; color: var(--muted); font-weight: 700; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; }
.host-toggle:hover { color: var(--ink); }
.host-toggle::after { content: '+'; font-size: 15px; letter-spacing: 0; }
.hostbar.open .host-toggle::after { content: '\2212'; }
.host-items { display: none; flex-direction: column; gap: 6px; align-items: stretch; padding: 2px 6px 6px; min-width: 250px; }
.hostbar.open .host-items { display: flex; }
.hostbar .btn { height: 32px; padding: 0 10px; font-size: 12.5px; justify-content: flex-start; }
.host-row { display: flex; gap: 4px; }
.host-row .btn { flex: 1; justify-content: center; }
.host-label { margin-top: 6px; font-size: 10px; }
.host-login label { color: var(--muted); font-weight: 700; }

/* ---------------------------------------------------------- OBS view --- */

body.obs .app { grid-template-columns: minmax(0, 1fr) 560px; }
body.obs .side-grip, body.obs .side-tab { display: none; }
body.obs .panel, body.obs .nav, body.obs .hint, body.obs .corner { display: none !important; }
body.obs .brand { padding: 26px 30px 8px; }
body.obs .brand-logo { --lg: 92px; --sm: 20px; max-width: 480px; }
body.obs .status { margin: 8px 22px 22px; }
body.obs .season { margin: 6px 24px 10px; }
body.obs .season-row { font-size: 14px; }
body.obs .season-lead { display: flex; font-size: 17px; }
body.obs .season-lead .pts { font-size: 20px; }
body.obs .st-clock { font-size: 80px; }
body.obs .st-line { font-size: 19px; }
body.obs .st-label { font-size: 14px; }
body.obs .st-main { grid-template-columns: 1fr 130px; }
body.obs .st-rev { display: flex; }
body.obs .st-revnum { font-size: 76px; }
body.obs .notes { display: block; flex: 1; padding: 22px 30px; }
body.obs .notes-title, body.obs .round-chip { font-size: 15px; }
body.obs .notes-list li { grid-template-columns: 34px 1fr auto; padding: 14px 0; }
body.obs .notes-list .n { font-size: 16px; }
body.obs .notes-list button { font-size: 25px; }
body.obs .notes-list b { font-size: 34px; }
body.obs .notes-list .bar { height: 3px; }

/* ------------------------------------------------------------ mobile --- */

@media (max-width: 1100px) {
  .app { grid-template-columns: minmax(0, 1fr) var(--side-w, 380px); }
  .st-clock { font-size: 44px; }
}

@media (max-width: 820px) {
  .app { display: block; }
  .side { display: contents; }
  .side-grip, .side-tab, .rail { display: none !important; }
  .sheet-handle { touch-action: none; cursor: grab; }
  .panel.dragging { transition: none; }
  /* phone: a slim bar on top with the logo and the clock; the map in between; the panel as a bottom sheet */
  .hq { position: fixed; left: 0; right: 0; top: 0; z-index: 15; display: flex; align-items: center; gap: 10px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); }
  .brand { flex: none; padding: 0; }
  .brand-logo { --lg: 30px; --sm: 8px; width: 150px; }
  .logo-row-1 { margin-top: 2px; }
  .status { flex: 1; margin: 0; border: 0; background: none; }
  .status::before, .status::after { display: none; }
  .st-countdown { padding: 0; text-align: right; }
  .st-label { font-size: 9.5px; letter-spacing: 0.1em; white-space: nowrap; }
  .st-clock { font-size: 30px; margin: 1px 0 0; }
  .st-line { display: none; }
  .season { display: none; }
  .board { position: fixed; left: 0; right: 0; top: var(--hq, 76px); bottom: var(--peek, 132px); }
  .hint { top: auto; bottom: 64px; max-width: calc(100% - 32px); font-size: 13.5px; padding: 8px 14px; }
  .toast { top: calc(var(--hq, 76px) + 10px); }
  .corner { left: auto; right: 8px; top: auto; bottom: 8px; align-items: flex-end; flex-direction: column-reverse; }
  .chip-btn span { display: none; }
  .chip-btn { width: 40px; padding: 0; justify-content: center; }
  .hostbar { display: none !important; } /* demo and host controls are for desktop */
  .nav { left: 8px; bottom: 8px; }
  .keyplan { width: 96px; height: 96px; }
  .inspector { left: 8px !important; right: 8px; bottom: 60px; top: auto !important; width: auto; }
  .panel {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: 80dvh;
    border-top: 1px solid var(--line-strong); border-radius: 12px 12px 0 0;
    box-shadow: 0 -18px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(calc(80dvh - var(--peek, 132px))); transition: transform 0.28s cubic-bezier(.2, .9, .3, 1);
  }
  .panel.open { transform: none; }
  .sheet-handle { display: block; height: 18px; border: 0; background: none; position: relative; flex: none; }
  .sheet-handle::after { content: ''; position: absolute; left: 50%; top: 7px; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--line-bright); }
  .me { padding: 2px 16px 10px; }
  .me-avatar { width: 42px; height: 42px; padding: 4px; }
  .me-points strong { font-size: 30px; }
  .tabs { padding: 0 6px; }
  .tabs button { font-size: 11.5px; letter-spacing: 0.1em; }
  .tab { padding: 14px 16px 40px; }
  .browse { margin: 14px -16px 0; padding: 10px 16px 8px; top: -14px; }
  .modal-card { padding: 24px 20px 20px; }
  .rv-card { padding: 28px 22px 24px; }
  .rules-grid { grid-template-columns: 1fr; }
  .rules-side { position: static; }
  .rules-card { padding: 24px 18px 20px; }
  #open-rules .chip-rev { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-delay: 0s !important; transition-duration: 0.001ms !important; }
}
