/* sabon.live. A dark theater for games: the player and chat side by side like a streaming
   platform, one accent, one set of radii and surfaces everywhere. */

:root {
  color-scheme: dark;
  --bg: #0c0c0c;
  --surface: #151515;
  --surface-2: #1e1e1e;
  --surface-3: #292929;
  --line: rgb(255 255 255 / 0.07);
  --line-2: rgb(255 255 255 / 0.12);
  --text: #f0f0f0;
  --muted: #9c9c9c;
  --dim: #646464;
  --live: #ff3d52;
  --accent: #fb7e14;
  --accent-hi: #ff9a45;
  --accent-ink: #1a0c00;
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --top: 56px;
  --chat-w: 340px;
  --pad: 24px;
  --display: "Chakra Petch", ui-sans-serif, system-ui, sans-serif;
  --body: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; }
img { display: block; }
h1, h2, h3 { font-family: var(--body); font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.grow { flex: 1; }

/* small caps label: section names, the line over a state card */
.label, .chap-label {
  font: 600 11px/1 var(--display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* LIVE / OFFLINE / PART 3 OF 10 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 6px 3px;
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--text);
  font: 700 11px/1 var(--display);
  letter-spacing: 0.1em;
  white-space: nowrap;
}
.badge.live { background: var(--live); color: #fff; }
.badge.live::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #fff; }
.badge.part { background: var(--accent); color: var(--accent-ink); }
/* someone else streaming on the channel: an orange outline, so it never reads as LIVE red */
.badge.guest { background: transparent; color: var(--accent-hi); box-shadow: inset 0 0 0 1px rgb(251 126 20 / 0.7); }
.card .when .badge.guest { margin-right: 7px; padding: 3px 5px 2px; font-size: 10px; vertical-align: 1px; }

/* The admin page's game art behind its header. */
.admin-page .backdrop {
  position: fixed;
  inset: 0 0 auto;
  height: 60vh;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.9s ease;
  mask-image: linear-gradient(to bottom, #000 30%, transparent);
}
.admin-page .backdrop::before {
  content: "";
  position: absolute;
  inset: -8%;
  background: var(--art, none) center 30% / cover no-repeat;
  filter: blur(28px) brightness(0.3) saturate(0.9);
}
.admin-page .backdrop.empty { opacity: 0; }

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

button, .btn {
  font: 500 14px/1 var(--body);
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  padding: 9px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background 0.15s, border-color 0.15s, color 0.15s, filter 0.15s, transform 0.15s;
}
button:hover, .btn:hover { background: var(--surface-3); border-color: rgb(255 255 255 / 0.2); }
button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: 0.4; cursor: default; }
.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.ghost:hover { background: rgb(255 255 255 / 0.06); border-color: transparent; color: var(--text); }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); }
.danger { color: var(--live); border-color: rgb(255 61 82 / 0.45); }
.danger:hover { background: rgb(255 61 82 / 0.12); border-color: var(--live); }
button svg, .btn svg { width: 18px; height: 18px; flex: none; }

input, select {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  padding: 10px 12px;
  width: 100%;
  min-width: 0;
}
input::placeholder { color: var(--dim); }

/* ---- header ---- */

.top {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--top);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px 0 16px;
  background: rgb(12 12 12 / 0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.top nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.top form { margin: 0; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 700 19px/1 var(--display);
  letter-spacing: 0.02em;
  text-decoration: none;
}
.brand em { font-style: normal; color: var(--accent); font-weight: 500; }
/* the mark: the favicon's play triangle on a tile; a red dot on its corner while live */
.brand .mark, .brand .dot {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #1a1a1a url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M12 9.5v13l11-6.5z' fill='%23fb7e14'/%3E%3C/svg%3E") center / 100% no-repeat;
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.brand .mark::after, .brand .dot::after {
  content: "";
  position: absolute;
  top: -3px;
  right: -3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 2px var(--bg);
  transform: scale(0);
  transition: transform 0.3s;
}
.brand .mark.on::after, .brand .dot.on::after { transform: scale(1); animation: pulse 1.8s ease-out infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 2px var(--bg), 0 0 0 2px rgb(255 61 82 / 0.7); }
  70% { box-shadow: 0 0 0 2px var(--bg), 0 0 0 9px rgb(255 61 82 / 0); }
  100% { box-shadow: 0 0 0 2px var(--bg), 0 0 0 2px rgb(255 61 82 / 0); }
}

/* the account button and its menu */
.acct {
  gap: 4px;
  padding: 8px 8px 8px 12px;
  border-radius: var(--r);
  border-color: transparent;
  background: transparent;
  color: var(--text);
  font-weight: 600;
}
.acct .caret { display: grid; color: var(--muted); }
.acct:hover, .acct[aria-expanded="true"] { background: var(--surface-2); border-color: transparent; }
.acctmenu { position: absolute; top: calc(var(--top) - 4px); right: 12px; min-width: 220px; z-index: 31; }
.acctmenu form { margin: 0; }
.acctmenu a, .acctmenu a:hover {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  font: 500 14px/1.2 var(--body);
  justify-content: flex-start;
}
.acctmenu a:hover { background: rgb(255 255 255 / 0.1); }
.acctmenu a svg { width: 22px; height: 22px; }

/* ---- page shell: the stream on the left, chat down the right ---- */

.shell { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
.main { min-width: 0; }
.wrap { position: relative; z-index: 1; margin: 0 auto; padding: 24px 28px 80px; }

/* ---- player ---- */
/* The column's full width, as tall as 16:9 allows while leaving the channel line in view. */

.player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: calc(100dvh - var(--top) - 104px);
  min-height: 200px;
  background: #000;
  overflow: hidden;
  user-select: none;
}
/* On air: a thin red line along the top edge with a soft light running across it. */
.player::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  z-index: 7;
  background: linear-gradient(90deg, var(--live) 0%, var(--live) 40%, #ffd1d6 50%, var(--live) 60%, var(--live) 100%) 0 0 / 300% 100%;
  opacity: 0;
  transition: opacity 0.6s;
  pointer-events: none;
}
.player.onair::before { opacity: 1; animation: onair 3.2s linear infinite; }
@keyframes onair { from { background-position: 100% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .player.onair::before { animation: none; } }
.player video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #000;
}
.player:fullscreen { width: 100vw; height: 100vh; max-height: none; aspect-ratio: auto; }
.player:-webkit-full-screen { width: 100vw; height: 100vh; max-height: none; }
.player.idle { cursor: none; }
.player.off .controls { display: none; }

/* centered state: spinner, messages, offline, no signal */
.state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  pointer-events: none;
  z-index: 1;
}
.state.dim { background: rgb(12 12 12 / 0.72); backdrop-filter: blur(4px); }
.state > * { pointer-events: auto; }
.card-msg { display: grid; gap: 12px; justify-items: center; max-width: 460px; }
.card-msg h3 { font-size: clamp(18px, 2.2vw, 26px); line-height: 1.2; }
.card-msg p { margin: 0; color: var(--muted); }
.spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid rgb(255 255 255 / 0.15);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Offline: the last stream to play and the playthrough to pick up, over the game's art when
   there's a big enough picture of it. */
.state.off {
  pointer-events: auto;
  grid-template-columns: minmax(0, 1fr) minmax(0, 42%);
  gap: 6%;
  place-items: center stretch;
  padding: 0 7%;
  text-align: left;
  background:
    radial-gradient(90% 120% at 100% 100%, rgb(251 126 20 / 0.07), transparent 60%),
    linear-gradient(160deg, #151515, #090909 70%);
}
.state.off::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgb(255 255 255 / 0.05) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to right, #000, transparent 70%);
  pointer-events: none;
}
.off-art { position: absolute; inset: 0; background: center 30% / cover no-repeat; opacity: 0.4; }
.off-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to right, #090909 25%, rgb(9 9 9 / 0.55) 70%, rgb(9 9 9 / 0.35)); }
.off-body { position: relative; display: grid; gap: 12px; justify-items: start; }
.off-body h3 { font-size: clamp(22px, 2.8vw, 38px); line-height: 1.1; letter-spacing: -0.02em; font-weight: 700; }
.off-body p { margin: -4px 0 6px; color: var(--muted); font-size: 15px; }
.off-body .row { gap: 10px; }
.off-last {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  color: var(--text);
}
.off-last:hover { background: none; border: 0; }
.off-last .thumb { margin-bottom: 8px; box-shadow: 0 0 0 1px var(--line-2), 0 24px 50px -20px rgb(0 0 0 / 0.9); }
.off-last:hover .thumb { box-shadow: 0 0 0 2px var(--accent), 0 24px 50px -20px rgb(0 0 0 / 0.9); }
.off-last:hover .play { opacity: 1; }
.off-title { font: 600 15px/1.35 var(--body); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.off-game { color: var(--muted); font-size: 13px; }

/* No signal: snow, scan lines and a shaky caption, while the site can't be reached. */
.state.lost { pointer-events: auto; background: #000; }
.state.lost::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(to bottom, rgb(0 0 0 / 0.38) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 45%, rgb(0 0 0 / 0.75));
  pointer-events: none;
}
canvas.static { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.5; }
.lost-card { position: relative; z-index: 1; display: grid; gap: 14px; justify-items: center; }
.lost-word {
  position: relative;
  padding: 10px calc(22px - 0.22em) 8px 22px;
  background: rgb(0 0 0 / 0.55);
  color: #fff;
  font: 700 clamp(26px, 5vw, 60px)/1 var(--display);
  letter-spacing: 0.22em;
  animation: shake 3.2s steps(1) infinite;
}
.lost-word::before, .lost-word::after {
  content: attr(data-text);
  position: absolute;
  inset: 10px calc(22px - 0.22em) 8px 22px;
  mix-blend-mode: screen;
  opacity: 0.8;
}
.lost-word::before { color: #ff2a55; transform: translateX(-3px); clip-path: inset(0 0 55% 0); animation: tear 2.6s steps(1) infinite; }
.lost-word::after { color: #2ad4ff; transform: translateX(3px); clip-path: inset(50% 0 0 0); animation: tear 1.9s steps(1) infinite reverse; }
@keyframes tear {
  0%, 100% { transform: translateX(-3px); clip-path: inset(0 0 55% 0); }
  20% { transform: translateX(4px); clip-path: inset(30% 0 40% 0); }
  40% { transform: translateX(-2px); clip-path: inset(70% 0 5% 0); }
  60% { transform: translateX(5px); clip-path: inset(10% 0 75% 0); }
  80% { transform: translateX(-4px); clip-path: inset(45% 0 25% 0); }
}
@keyframes shake {
  0%, 100% { transform: none; }
  47% { transform: translate(2px, -1px) skewX(-4deg); }
  48% { transform: translate(-3px, 1px); }
  49% { transform: none; }
  83% { transform: translate(-1px, 0) skewX(3deg); }
  84% { transform: none; }
}
@media (prefers-reduced-motion: reduce) { .lost-word, .lost-word::before, .lost-word::after { animation: none; } }

/* a quick icon that flashes in the middle on play, pause and skips */
.flash {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 76px;
  height: 76px;
  margin: -38px 0 0 -38px;
  border-radius: 50%;
  background: rgb(0 0 0 / 0.55);
  display: grid;
  place-items: center;
  color: #fff;
  font: 700 15px var(--display);
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}
.flash svg { width: 34px; height: 34px; }
.flash.go { animation: flash 0.55s ease-out; }
@keyframes flash {
  0% { opacity: 0.95; transform: scale(0.8); }
  100% { opacity: 0; transform: scale(1.25); }
}

.unmute {
  position: absolute;
  top: 16px;
  left: 16px;
  background: rgb(0 0 0 / 0.6);
  border-color: rgb(255 255 255 / 0.2);
  backdrop-filter: blur(8px);
  z-index: 3;
}

/* controls overlay */
.controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 56px 12px 6px;
  background: linear-gradient(to top, rgb(0 0 0 / 0.85), rgb(0 0 0 / 0.45) 50%, transparent);
  transition: opacity 0.25s;
  z-index: 3;
}
.player.idle .controls { opacity: 0; pointer-events: none; }
.bar { display: flex; align-items: center; gap: 2px; }
.bar .spacer { flex: 1; }
.icon {
  position: relative;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: #fff;
}
.icon:hover { background: rgb(255 255 255 / 0.13); border: 0; }
.icon svg { width: 22px; height: 22px; }
.icon[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 48px;
  left: 50%;
  transform: translateX(-50%);
  background: rgb(0 0 0 / 0.88);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 5px 8px;
  font: 500 12px/1 var(--body);
  white-space: nowrap;
  pointer-events: none;
}
.bar .icon:last-child[data-tip]:hover::after { left: auto; right: 0; transform: none; }
.time {
  font: 500 13px/1 var(--body);
  font-variant-numeric: tabular-nums;
  color: rgb(255 255 255 / 0.88);
  padding: 0 8px;
  white-space: nowrap;
}
.vol { display: flex; align-items: center; }
.vol input {
  width: 0;
  opacity: 0;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: #fff;
  transition: width 0.2s, opacity 0.2s, margin 0.2s;
}
.vol:hover input, .vol:focus-within input { width: 86px; opacity: 1; margin: 0 8px 0 2px; }

.livepill {
  font: 700 12px/1 var(--display);
  letter-spacing: 0.12em;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.14);
  border: 0;
  color: #fff;
  margin: 0 6px;
}
.livepill:hover { background: rgb(255 255 255 / 0.24); border: 0; }
.livepill i { width: 7px; height: 7px; border-radius: 50%; background: rgb(255 255 255 / 0.6); }
.livepill.at-live, .livepill.at-live:hover { background: var(--live); cursor: default; }
.livepill.at-live i { background: #fff; }

/* quality badge and stats panel */
.qpill {
  font: 700 12px/1 var(--display);
  letter-spacing: 0.06em;
  padding: 7px 9px;
  border-radius: var(--r-sm);
  background: transparent;
  border: 1px solid rgb(255 255 255 / 0.35);
  color: #fff;
  margin-left: 6px;
}
.qpill:hover { background: rgb(255 255 255 / 0.12); border-color: #fff; }
.qpill.on { background: #fff; color: #000; border-color: #fff; }
.stats {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 4;
  min-width: 230px;
  padding: 12px 14px;
  border-radius: var(--r);
  background: rgb(0 0 0 / 0.78);
  border: 1px solid var(--line-2);
  backdrop-filter: blur(8px);
  font: 500 12.5px/1.7 var(--body);
  font-variant-numeric: tabular-nums;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 16px;
}
.stats dt { color: var(--muted); }
.stats dd { margin: 0; text-align: right; }

/* the live feed connecting in the background while a rewind catches up (catchUp in app.js):
   on the page so it decodes, but not seen */
.warm { position: absolute; left: 0; top: 0; width: 2px; height: 2px; opacity: 0.01; pointer-events: none; }

/* chapter ticks on the scrub bar */
.marks { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.marks i {
  position: absolute;
  top: 50%;
  width: 3px;
  height: 8px;
  margin: -4px 0 0 -1.5px;
  border-radius: 1px;
  background: rgb(0 0 0 / 0.85);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.35);
}

/* menus: right-click on the player, speed, a card's ⋮, the account */
.ctxmenu {
  position: absolute;
  z-index: 6;
  min-width: 260px;
  padding: 6px 0;
  border-radius: 12px;
  background: rgb(22 22 22 / 0.94);
  box-shadow: 0 16px 44px rgb(0 0 0 / 0.6), 0 0 0 1px var(--line-2);
  backdrop-filter: blur(14px);
}
.ctxmenu button {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 10px 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  font: 500 14px/1.2 var(--body);
  font-variant-numeric: tabular-nums;
  text-align: left;
  justify-content: flex-start;
}
.ctxmenu button:hover, .ctxmenu button:focus-visible { background: rgb(255 255 255 / 0.1); outline: none; }
.ctxmenu button svg { width: 22px; height: 22px; flex: none; }
.ctxmenu button .check { margin-left: auto; color: var(--accent); }
.speedmenu { min-width: 170px; right: 70px; bottom: 70px; }
.speedmenu .head { padding: 6px 16px 8px; color: var(--muted); font: 600 12px/1 var(--display); letter-spacing: 0.12em; text-transform: uppercase; }
.cardmenu { position: fixed; z-index: 50; min-width: 220px; }
#bSpeed { font: 700 12px/1 var(--display); }

/* small in-player message with an optional action */
.toast {
  position: absolute;
  left: 16px;
  bottom: 86px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 14px;
  border-radius: var(--r);
  background: rgb(0 0 0 / 0.78);
  border: 1px solid var(--line-2);
  backdrop-filter: blur(8px);
  font-size: 13px;
}
.toast button { padding: 6px 10px; font-size: 13px; }

/* scrub bar */
.scrub { position: relative; height: 20px; display: flex; align-items: center; margin: 0 8px 2px; }
.scrub input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
  --pct: 0%;
  --buf: 0%;
}
.scrub input:focus-visible { outline: none; }
.scrub input::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(to right,
    var(--accent) var(--pct),
    rgb(255 255 255 / 0.45) var(--pct) var(--buf),
    rgb(255 255 255 / 0.2) var(--buf));
}
.scrub:hover input::-webkit-slider-runnable-track { height: 6px; }
.scrub input::-moz-range-track { height: 4px; border-radius: 4px; background: rgb(255 255 255 / 0.22); }
.scrub input::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
.scrub input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 5px rgb(251 126 20 / 0.35);
  transform: scale(0);
  transition: transform 0.12s;
}
.scrub:hover input::-webkit-slider-thumb, .scrub input:active::-webkit-slider-thumb { transform: scale(1); margin-top: -4px; }
.scrub input::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; }
.scrub-tip {
  position: absolute;
  bottom: 24px;
  transform: translateX(-50%);
  background: rgb(0 0 0 / 0.88);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 5px 8px;
  font: 600 12px/1 var(--body);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
}
.scrub-tip.has-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 3px 3px 7px;
  border-radius: var(--r);
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.5);
}
.scrub-thumb {
  width: clamp(150px, 20vw, 256px);
  aspect-ratio: 16 / 9;
  border-radius: var(--r-sm);
  background-color: #000;
  background-repeat: no-repeat;
}

/* a player button that's switched on: Clip while the editor is open, Loop on a clip's page */
.icon.on { color: var(--accent); }

/* ---- clip editor, under the player (app.js, "clips") ---- */

.clipper {
  margin: 14px var(--pad) 0;
  padding: 14px 16px 12px;
  display: grid;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
}
.clip-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.clip-top h2 { font-size: 15px; white-space: nowrap; }
.clip-len {
  padding: 5px 7px 4px;
  border-radius: 4px;
  background: rgb(251 126 20 / 0.14);
  color: var(--accent-hi);
  font: 700 12px/1 var(--display);
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}
.clip-range { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clip-top .icon { width: 34px; height: 34px; margin: -4px -6px -4px 0; color: var(--muted); }
.clip-top .icon:hover { color: var(--text); }
.clip-top .icon svg { width: 18px; height: 18px; }

.clip-track {
  position: relative;
  height: 60px;
  margin: 3px 12px;
  touch-action: none;
  user-select: none;
  cursor: pointer;
}
.clip-film {
  position: absolute;
  inset: 0;
  display: flex;
  overflow: hidden;
  border-radius: var(--r-sm);
  background: var(--bg);
  pointer-events: none;
}
.clip-film i {
  flex: 1;
  min-width: 0;
  background-color: #111;
  background-repeat: no-repeat;
  box-shadow: inset -1px 0 rgb(0 0 0 / 0.6);
}
.clip-film:not(.lit) { opacity: 0.35; filter: saturate(0.4); }
.clip-sel {
  position: absolute;
  top: -3px;
  bottom: -3px;
  border-block: 3px solid var(--accent);
  cursor: grab;
}
.clip-track.dragging, .clip-track.dragging .clip-sel { cursor: grabbing; }
.clip-h {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 12px;
  background: var(--accent);
  cursor: ew-resize;
  touch-action: none;
}
.clip-h.l { left: -12px; border-radius: 6px 0 0 6px; }
.clip-h.r { right: -12px; border-radius: 0 6px 6px 0; }
.clip-h::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 18px;
  margin: -9px 0 0 -1px;
  border-radius: 1px;
  background: var(--accent-ink);
  opacity: 0.6;
}
.clip-h:hover, .clip-h:focus-visible { background: var(--accent-hi); outline: none; }
/* a wider grip for fingers */
@media (pointer: coarse) { .clip-h::before { content: ""; position: absolute; inset: -6px -10px; } }
.clip-play {
  position: absolute;
  top: -7px;
  bottom: -7px;
  width: 2px;
  margin-left: -1px;
  border-radius: 1px;
  background: #fff;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.55);
  pointer-events: none;
}
.clip-form, .clip-done { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.clip-form input { flex: 1; min-width: 180px; }
.clip-done .secret { flex: 1; min-width: 220px; }
.clip-note { margin: -2px 0 0; color: var(--dim); font-size: 12.5px; }
.clip-note.bad { color: var(--live); }

/* the Clips shelf: one row until opened */
.clip-more { display: flex; width: fit-content; margin: 14px auto 0; }

/* ---- a clip's own page (/clip/<id>, clip.js), open to anyone with the link ---- */

.clip-main { --w: min(100%, max(480px, calc((100dvh - var(--top) - 190px) * 16 / 9)), 1280px); padding: 24px var(--pad) 0; }
.clip-main > .player, .clip-info, .clip-main > .foot { width: var(--w); margin-inline: auto; }
.clip-player { max-height: none; border-radius: var(--r-lg); box-shadow: 0 0 0 1px var(--line-2), 0 40px 90px -40px #000; }
.clip-info {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 18px 2px 0;
}
.clip-info h1 { font-size: clamp(18px, 1.6vw, 22px); line-height: 1.3; overflow-wrap: anywhere; }
.clip-info .ch-name .badge { padding: 4px 6px 3px; }
.clip-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.clip-page .foot { margin-top: 56px; }
.clip-gone { display: grid; gap: 6px; text-align: center; }
.clip-gone h1 { font-size: 22px; }
.clip-gone p { margin: 0; color: var(--muted); }
@media (max-width: 640px) {
  .clip-main { padding: 0; }
  .clip-main > .player, .clip-info, .clip-main > .foot { width: 100%; }
  .clip-player { border-radius: 0; box-shadow: none; }
  .clip-info { grid-template-columns: minmax(0, 1fr); padding: 14px var(--pad) 0; }
  .clip-actions { justify-content: flex-start; }
  .clip-main > .foot { width: auto; margin-inline: var(--pad); }
}

/* ---- channel line under the player ---- */

.channel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 18px var(--pad) 8px;
}
.ch-text { min-width: 0; display: grid; gap: 3px; }
.ch-name { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.ch-name b { font: 600 15px/1.2 var(--body); }
.kicker { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 13px; }
.channel h1 { font-size: clamp(18px, 1.6vw, 22px); line-height: 1.3; overflow-wrap: anywhere; }
.ch-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 14px; }
.ch-meta .game { display: inline-flex; align-items: center; gap: 8px; color: var(--accent-hi); font-weight: 600; }
.ch-meta .game img { width: 42px; aspect-ratio: 460 / 215; object-fit: cover; border-radius: 3px; box-shadow: 0 0 0 1px var(--line-2); }
.ch-when { font-variant-numeric: tabular-nums; }
.ch-side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.uptime {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font: 600 14px/1 var(--display);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
.uptime::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--live); }

.notice {
  margin: 12px var(--pad) 0;
  padding: 12px 14px;
  border-radius: var(--r);
  background: rgb(255 61 82 / 0.08);
  border: 1px solid rgb(255 61 82 / 0.3);
  font-size: 14px;
}

/* reactions, beside the title while live */
.reacts {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}
.react {
  padding: 7px 12px 7px 9px;
  border-radius: 999px;
  border-color: var(--line);
  background: var(--surface-2);
  font-weight: 600;
  font-size: 13px;
  transition: transform 0.12s, background 0.15s, opacity 0.2s;
}
.react .e { font-size: 17px; line-height: 1; }
.react:hover { background: var(--surface-3); transform: translateY(-1px); }
.react:active { transform: scale(0.94); }
.reacts.cool .react { opacity: 0.4; pointer-events: none; }
.reacts .wait { order: -1; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; margin-right: 4px; }
.floaty {
  position: absolute;
  font-size: 30px;
  pointer-events: none;
  animation: floaty 1.3s ease-out forwards;
}
@keyframes floaty {
  0% { transform: translate(-50%, 0) scale(0.6); opacity: 0; }
  15% { transform: translate(-50%, -14px) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%, -120px) scale(1); opacity: 0; }
}

/* chapter list under the title */
.chapters {
  margin: 14px var(--pad) 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  gap: 8px 22px;
}
.chap-label { flex: none; padding-top: 5px; color: var(--dim); }
/* aligned columns, so a second row sits under the first like a table of contents */
.chap-list {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 2px 18px;
}
.chapters button,
.chapters button:hover {
  min-width: 0;
  padding: 2px 0;
  border: 0;
  border-radius: 4px;
  background: none;
  font: 500 13px/1.4 var(--body);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chapters button { color: var(--muted); transition: color 0.15s; }
.chapters button:hover, .chapters button.on { color: var(--text); }
.chapters button b {
  display: inline-block;
  min-width: var(--tw, 2.5em);
  margin-right: 10px;
  text-align: right;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--dim);
}
.chapters button.on b { color: var(--accent); }
.chap-tip {
  position: fixed;
  z-index: 40;
  width: 192px;
  aspect-ratio: 16 / 9;
  border-radius: var(--r);
  background-color: var(--surface-2);
  box-shadow: 0 0 0 1px var(--line-2), 0 14px 34px -12px rgb(0 0 0 / 0.9);
  pointer-events: none;
}
.chap-tip span {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 4px 6px;
  border-radius: 5px;
  background: rgb(0 0 0 / 0.8);
  color: #fff;
  font: 600 11px/1 var(--body);
  font-variant-numeric: tabular-nums;
}

/* ---- live chat ---- */

.chat {
  position: sticky;
  top: var(--top);
  width: var(--chat-w);
  height: calc(100dvh - var(--top));
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
}
.chat-head {
  flex: none;
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  height: 50px;
  padding: 0 6px;
  border-bottom: 1px solid var(--line);
}
.chat-head h2 { text-align: center; font: 600 12px/1 var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--text); }
.chat-head .icon { width: 36px; height: 36px; color: var(--muted); }
.chat-head .icon:hover { color: var(--text); }
.chat-head .icon svg { width: 20px; height: 20px; }
.chat-dot { justify-self: center; width: 7px; height: 7px; border-radius: 50%; background: var(--dim); }
.chat:not(.idle) .chat-dot { background: var(--live); }
.chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 0;
  padding: 10px 8px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}
.chat-log:empty { display: none; }
.chat-log li { padding: 4px 8px; border-radius: var(--r-sm); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.chat-log li:hover { background: rgb(255 255 255 / 0.04); }
.chat-log .who { font-weight: 700; color: hsl(var(--h, 232) 80% 72%); }
.chat-log .who::after { content: ":"; margin-right: 6px; color: var(--text); font-weight: 400; }
.chat-log .admin .who { color: var(--text); }
.chat-log .badge {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: 6px;
  padding: 0;
  border-radius: 4px;
  background: var(--live);
  color: #fff;
  vertical-align: -4px;
}
.chat-log .badge svg { width: 14px; height: 14px; }
.chat-log .at { font-weight: 600; color: var(--text); }
.chat-log .mention { background: rgb(255 61 82 / 0.12); box-shadow: inset 2px 0 0 var(--live); }
.chat-log .mention:hover { background: rgb(255 61 82 / 0.16); }
.chat-log .fresh { animation: chatIn 0.25s ease-out; }
@keyframes chatIn { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .chat-log .fresh { animation: none; } }
.chat-more {
  position: absolute;
  left: 50%;
  bottom: 110px;
  transform: translateX(-50%);
  z-index: 2;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  background: var(--surface-3);
  box-shadow: 0 8px 24px -8px rgb(0 0 0 / 0.8);
}
.chat-idle {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.chat-idle svg {
  width: 52px;
  height: 52px;
  padding: 14px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--dim);
}
.chat:not(.idle) .chat-idle svg { color: var(--accent); }
.chat-idle b { color: var(--text); font-size: 15px; font-weight: 600; }
.chat-dock { flex: none; padding: 10px 10px 8px; border-top: 1px solid var(--line); }
.chat .chat-form { position: relative; display: flex; }
.chat .chat-form input {
  padding: 11px 48px 11px 12px;
  background: var(--surface-2);
  border-color: transparent;
  transition: border-color 0.15s, background 0.15s;
}
.chat .chat-form input:focus { background: var(--bg); border-color: var(--accent); outline: none; }
.chat .chat-form input:disabled { cursor: not-allowed; }
.chat .send {
  position: absolute;
  right: 5px;
  top: 50%;
  width: 34px;
  height: 34px;
  margin-top: -17px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
}
.chat .send:hover { background: var(--accent-hi); }
.chat .send:disabled { background: var(--surface-3); color: var(--dim); opacity: 1; }
.chat .send svg { width: 17px; height: 17px; }
.chat-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 32px; padding-top: 4px; font-size: 12.5px; }
.chat-as {
  min-width: 0;
  padding: 5px 8px 5px 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  gap: 6px;
}
.chat-as span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-as svg { width: 15px; height: 15px; }
.chat-as:hover { background: rgb(255 255 255 / 0.06); border: 0; color: var(--text); }
.chat-as:disabled { opacity: 1; cursor: default; }
.chat-as:disabled:hover { background: transparent; color: var(--muted); }
.chat-note { color: var(--muted); text-align: right; }
.chat-note.bad { color: var(--live); }

.chat.shut { width: 50px; }
.chat.shut .chat-head { grid-template-columns: 1fr; justify-items: center; padding: 0; border-bottom: 0; }
.chat.shut .chat-head h2, .chat.shut .chat-dot, .chat.shut .chat-log, .chat.shut .chat-idle,
.chat.shut .chat-dock, .chat.shut .chat-more { display: none; }
.chat.shut #chatHide svg { transform: scaleX(-1); }


/* ---- playthrough rail under the player ---- */

.rail {
  margin: 18px var(--pad) 0;
  padding: 16px;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line);
}
.rail-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 14px; }
.rail-title { display: grid; gap: 5px; }
.rail-title h3 { font-size: 17px; }
.rail-pos { color: var(--muted); font: 600 13px/1 var(--display); letter-spacing: 0.06em; }
.rail-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(200px, 230px);
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding-bottom: 6px;
  scrollbar-width: thin;
}
.rail-item {
  display: grid;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  scroll-snap-align: start;
  cursor: pointer;
  color: inherit;
}
.rail-item:hover { background: transparent; border: 0; }
.rail-item .thumb { pointer-events: none; }
.rail-item:hover .thumb { box-shadow: 0 0 0 2px var(--accent), 0 18px 40px -22px rgb(0 0 0 / 0.9); }
.rail-item.on .thumb { box-shadow: 0 0 0 2px var(--accent); }
.rail-item .nowtag {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgb(0 0 0 / 0.55);
  font: 700 12px/1 var(--display);
  letter-spacing: 0.16em;
  color: #fff;
}
.rail-item .when { font-weight: 600; font-size: 14px; }
.rail-item .len { color: var(--muted); font-size: 12px; }

/* ---- playthroughs ---- */

.ptgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }
.ptcard {
  position: relative;
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 12px;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
  text-align: left;
  width: 100%;
  font: inherit;
  color: inherit;
  border: 0;
  overflow: hidden;
}
.ptcard:hover { background: var(--surface-2); box-shadow: 0 0 0 1px var(--line-2); border: 0; }
.ptcard img { width: 160px; aspect-ratio: 460 / 215; object-fit: cover; border-radius: var(--r-sm); }
.ptcard .name { font: 600 16px/1.25 var(--body); }
.ptcard .meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.ptcard .go { margin-top: 10px; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; color: var(--accent-hi); }
.ptcard .go svg { width: 14px; height: 14px; }
.ptcard .ptbar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgb(255 255 255 / 0.06); }
.ptcard .ptbar i { display: block; height: 100%; background: var(--accent); }
.ptcard .status { font: 700 10px/1 var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); margin-left: 8px; }
.partstrip button.on { border-color: var(--accent); }
.partstrip button.seen b { color: var(--dim); }

/* ---- library ---- */

.library { margin: 44px var(--pad) 0; }
.lib-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
  margin: 0 0 16px;
}
.lib-head h2 { font-size: 19px; }
.count { color: var(--dim); font: 600 14px/1 var(--display); }

.grid { display: grid; gap: 40px; }
.grid-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 28px 16px;
}
.game-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
}
.game-head img { width: 64px; aspect-ratio: 460 / 215; object-fit: cover; border-radius: 3px; box-shadow: 0 0 0 1px var(--line-2); }
.game-head h3 { font: 600 16px/1.25 var(--body); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-meta { color: var(--dim); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.game-more {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 10px 7px 12px;
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}
.game-more:hover { color: var(--text); background: var(--surface-2); border-color: transparent; }
.game-more svg { width: 16px; height: 16px; transition: transform 0.15s; }
.game-row.open .game-more svg { transform: rotate(180deg); }
.empty-lib {
  grid-column: 1 / -1;
  padding: 44px 20px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-lg);
  color: var(--muted);
  text-align: center;
}

.card { min-width: 0; }
.thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0;
  border: 0;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--line);
  transition: box-shadow 0.2s, transform 0.2s;
}
.thumb:hover { background: var(--surface-2); border: 0; }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.thumb img.art { filter: saturate(0.9) brightness(0.75); }
.thumb:hover img { transform: scale(1.04); }
.card.playing .thumb, .card .thumb:hover {
  box-shadow: 0 0 0 2px var(--accent), 0 18px 40px -22px rgb(0 0 0 / 0.9);
}
.thumb .pill {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgb(0 0 0 / 0.8);
  color: #fff;
  font: 600 12px/1 var(--body);
  font-variant-numeric: tabular-nums;
  padding: 4px 6px;
  border-radius: 4px;
}
.thumb .pill.live { background: var(--live); font: 700 11px/1 var(--display); letter-spacing: 0.1em; }
.thumb .pill.now { right: 8px; top: 8px; bottom: auto; background: var(--accent); color: var(--accent-ink); font: 700 11px/1 var(--display); letter-spacing: 0.1em; }
.thumb .badge-part {
  position: absolute;
  left: 8px;
  top: 8px;
  padding: 4px 6px;
  border-radius: 4px;
  background: rgb(0 0 0 / 0.8);
  font: 700 11px/1 var(--display);
  letter-spacing: 0.1em;
  color: #fff;
}
.thumb .badge-part b { color: var(--accent-hi); font-weight: 700; }
.thumb .play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.2s;
  background: rgb(0 0 0 / 0.22);
}
.thumb .play svg {
  width: 56px;
  height: 56px;
  padding: 16px;
  border-radius: 50%;
  background: rgb(0 0 0 / 0.55);
  backdrop-filter: blur(6px);
  color: #fff;
}
.thumb:hover .play, .thumb:focus-visible .play { opacity: 1; }
/* how far a friend got through a recording */
.thumb .progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgb(255 255 255 / 0.25); }
.thumb .progress i { display: block; height: 100%; background: var(--accent); }
.thumb .pill.seen { right: 8px; top: 8px; bottom: auto; background: rgb(0 0 0 / 0.8); font: 700 11px/1 var(--display); letter-spacing: 0.1em; }

.thumb .noimg {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--dim);
  font: 600 12px var(--display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.card-body { display: flex; gap: 8px; align-items: flex-start; padding: 10px 2px 0; }
.card-text { min-width: 0; flex: 1; }
.card h3 {
  font: 600 15px/1.35 var(--body);
  letter-spacing: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.card p { margin: 3px 0 0; color: var(--muted); font-size: 13px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card p.game { display: flex; align-items: center; gap: 7px; margin-top: 5px; }
.card p.game span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.card p.when { margin-top: 2px; font-variant-numeric: tabular-nums; }
.mini {
  width: 34px;
  aspect-ratio: 460 / 215;
  object-fit: cover;
  border-radius: 3px;
  flex: none;
  box-shadow: 0 0 0 1px var(--line-2);
}
.card .more {
  width: 30px;
  height: 30px;
  margin: 0 -6px 0 0;
  padding: 0;
  flex: none;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  opacity: 0;
  transition: opacity 0.15s;
}
.card .more svg { width: 20px; height: 20px; }
.card:hover .more, .card .more:focus-visible { opacity: 1; }
.card .more:hover { color: var(--text); background: rgb(255 255 255 / 0.08); }
@media (hover: none) { .card .more { opacity: 1; } }

/* ---- "site updated" note ---- */

.update-note {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 40;
  background: var(--surface-2);
  border-color: var(--line-2);
  box-shadow: 0 16px 40px -16px rgb(0 0 0 / 0.9);
}

/* ---- name prompt ---- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(5 5 5 / 0.72);
  backdrop-filter: blur(6px);
}
.modal-card {
  width: min(400px, 100%);
  display: grid;
  gap: 12px;
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: 0 30px 80px -30px rgb(0 0 0 / 0.9);
}
.modal-card h3 { font-size: 21px; }
.modal-card p { margin: 0; color: var(--muted); font-size: 14px; }
.modal-card input { padding: 12px 14px; font-size: 16px; }
.name-card { width: min(520px, 100%); gap: 14px; }
.name-card .row { margin-top: 4px; }

/* The voice picker: a tile per voice; a tap picks it and plays its sample. */
.voices { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.voice-group {
  grid-column: 1 / -1;
  margin: 6px 0 -2px;
  color: var(--muted);
  font: 600 11px/1 var(--display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.voice {
  --p: 0;
  position: relative;
  overflow: hidden;
  display: grid;
  justify-content: stretch;
  justify-items: start;
  gap: 4px;
  min-width: 0;
  padding: 12px 26px 13px 12px;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.voice:hover { background: var(--surface-3); border-color: rgb(255 255 255 / 0.2); }
.voice .v-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-size: 15px; font-weight: 600; color: var(--text); }
.voice .v-meta { font-size: 12px; color: var(--muted); }
.voice[aria-checked="true"] {
  background: rgb(251 126 20 / 0.1);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.voice[aria-checked="true"] .v-name { color: var(--accent-hi); }

/* Four bars in the corner: still at rest, moving while the sample plays. */
.v-eq { position: absolute; top: 13px; right: 10px; display: flex; align-items: flex-end; gap: 2px; height: 12px; }
.v-eq i { width: 2px; height: 4px; border-radius: 1px; background: var(--dim); transition: background 0.15s; }
.v-eq i:nth-child(2) { height: 8px; }
.v-eq i:nth-child(3) { height: 6px; }
.voice[aria-checked="true"] .v-eq i { background: var(--accent); }
.voice.playing .v-eq i { background: var(--accent); animation: v-eq 0.9s ease-in-out infinite; }
.voice.playing .v-eq i:nth-child(2) { animation-delay: -0.3s; }
.voice.playing .v-eq i:nth-child(3) { animation-delay: -0.6s; }
.voice.playing .v-eq i:nth-child(4) { animation-delay: -0.15s; }
@keyframes v-eq { 0%, 100% { height: 3px; } 50% { height: 12px; } }
.v-prog {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background: var(--accent);
  transform: scaleX(var(--p));
  transform-origin: left;
}
@media (prefers-reduced-motion: reduce) {
  .voice.playing .v-eq i { animation: none; height: 10px; }
}
@media (max-width: 420px) {
  .voices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- footer: the publisher credit, the quietest thing on the page ---- */

.foot { margin: 64px var(--pad) 0; padding: 20px 0 32px; border-top: 1px solid var(--line); }
.foot img { width: 114px; height: auto; opacity: 0.8; transition: opacity 0.15s; }
.foot img:hover { opacity: 1; }
.admin-page .foot { margin: 48px 0 0; padding-bottom: 0; }
.login .foot { margin: 8px 0 0; padding: 0; border: 0; justify-self: center; }
.login .foot img { width: 96px; opacity: 0.6; }

/* ---- login ---- */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(60vw 50vh at 50% 0%, rgb(251 126 20 / 0.12), transparent 70%),
    var(--bg);
}
.login { width: min(380px, 100%); display: grid; gap: 24px; }
.login .brand { font-size: 30px; justify-self: center; gap: 12px; }
.login .brand .dot, .login .brand .mark { width: 38px; height: 38px; border-radius: 10px; }
.login form {
  display: grid;
  gap: 12px;
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: 0 30px 80px -30px rgb(0 0 0 / 0.9);
}
.login p { margin: 0 0 4px; color: var(--muted); font-size: 14px; }
.login input { padding: 13px 14px; font-size: 16px; }
.login button { padding: 14px; font-size: 15px; }
.login .error { color: var(--live); font-size: 14px; min-height: 1.3em; margin: 0; }

/* ---- guest streamer's setup page (/guest/<key>) ---- */

.login.guest { width: min(540px, 100%); }
.guest-card {
  display: grid;
  gap: 22px;
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: 0 30px 80px -30px rgb(0 0 0 / 0.9);
}
.guest-status {
  display: grid;
  gap: 2px;
  padding: 14px 16px 14px 40px;
  position: relative;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
}
.guest-status::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 21px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--dim);
}
.guest-status b { font: 600 17px/1.3 var(--display); letter-spacing: 0.01em; }
.guest-status span { color: var(--muted); font-size: 14px; }
.guest-status[data-state="live"] { border-color: rgb(255 61 82 / 0.45); }
.guest-status[data-state="live"]::before { background: var(--live); animation: pulse 1.8s ease-out infinite; }
.guest-status[data-state="low"]::before, .guest-status[data-state="busy"]::before { background: var(--accent); }
.guest-status[data-state="low"] span, .guest-status[data-state="error"] span { color: var(--accent-hi); }
.guest-status[data-state="error"]::before { background: var(--accent); }
.guest-steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 20px; }
.guest-steps li { counter-increment: step; display: grid; gap: 10px; padding-left: 40px; position: relative; }
.guest-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -1px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--surface-3);
  color: var(--accent);
  font: 700 14px/1 var(--display);
}
.guest-steps h2 { margin: 0; font: 600 16px/1.5 var(--display); letter-spacing: 0.01em; }
.guest .guest-steps p { margin: 0; color: var(--muted); font-size: 14px; }
.guest .guest-steps p b { color: var(--text); font-weight: 600; }
.guest-info { display: grid; gap: 12px; }
.login .guest-info { padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; }
/* grid items default to their content's width; long codes and names must wrap instead */
.login.guest, .guest-card, .guest-card > *, .guest-steps li, .guest-info, .guest-info > * { min-width: 0; }
.guest-info label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.guest-info .picks { margin-top: -4px; }
.guest-info .chosen img { width: 120px; }
.guest-saved { font-size: 13px; color: var(--muted); }
.guest-invite { display: grid; gap: 10px; padding-top: 20px; border-top: 1px solid var(--line); }
.guest-invite h2 { margin: 0; font: 600 16px/1.5 var(--display); letter-spacing: 0.01em; }
.guest .guest-invite p { margin: 0; color: var(--muted); font-size: 14px; }
.guest .guest-tip { margin: 0; padding-top: 18px; border-top: 1px solid var(--line); font-size: 13px; color: var(--dim); }
@media (max-width: 520px) {
  .guest-card { padding: 20px 16px; }
  .guest-steps li { padding-left: 36px; }
}

/* ---- phones and narrow windows: one column, chat right under the channel line ---- */

@media (max-width: 960px) {
  .shell { display: flex; flex-direction: column; align-items: stretch; }
  .main { display: contents; }
  .player { order: 1; max-height: none; }
  .channel, .clipper { order: 2; }
  .notice { order: 3; }
  .chat { order: 4; }
  .chapters, .rail, .shelf, .library { order: 5; }
  .clipper { margin-top: 12px; }
  .library:last-child { padding-bottom: 60px; }
  .chat {
    position: static;
    width: auto;
    height: min(440px, 62vh);
    margin: 12px var(--pad) 0;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    overflow: hidden;
  }
  /* between streams a phone gets a short note, not an empty box */
  .chat.idle, .chat.shut { height: auto; }
  .chat.shut { width: auto; }
  .chat.shut .chat-head { grid-template-columns: 40px 1fr 40px; justify-items: stretch; padding: 0 6px; }
  .chat.shut .chat-head h2 { display: block; }
  .chat.idle .chat-idle { flex-direction: row; justify-content: flex-start; gap: 4px 10px; flex-wrap: wrap; padding: 14px 16px; text-align: left; }
  .chat.idle .chat-idle svg { display: none; }
  .chat.idle .chat-dock { display: none; }
  .state.off { grid-template-columns: 1fr; padding: 0 8%; }
  .off-last { display: none; }
}

@media (max-width: 640px) {
  :root { --pad: 16px; }
  body { font-size: 14px; }
  .top { padding: 0 8px 0 14px; }
  .chapters { flex-direction: column; }
  .chap-label { padding-top: 0; }
  .channel { grid-template-columns: minmax(0, 1fr); gap: 12px; padding-top: 14px; }
  .ch-side { align-items: stretch; }
  .uptime { display: none; }
  .reacts { justify-content: flex-start; }
  .off-body h3 { font-size: 20px; }
  .off-body p { font-size: 13px; margin-bottom: 0; }
  .off-body .row button { padding: 8px 12px; font-size: 13px; }
  .off-body .row button:nth-child(2) { display: none; }
  .ptgrid { grid-template-columns: 1fr; }
  .ptcard { grid-template-columns: 110px minmax(0, 1fr); }
  .ptcard img { width: 110px; }
  .rail { padding: 12px; }
  .rail-head button { flex: 1; }
  .lib-head { margin: 0 0 14px; }
  .grid { gap: 32px; }
  .grid-row { grid-template-columns: 1fr; gap: 24px; }
  .vol input, .icon[data-tip]:hover::after { display: none; }
  .icon { width: 44px; height: 44px; }
}

/* ---- admin ---- */

.admin-page .wrap { max-width: 1400px; }

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.panel {
  background: rgb(18 18 18 / 0.86);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: grid;
  gap: 14px;
  backdrop-filter: blur(10px);
}
.panel + .panel { margin-top: 20px; }
.panel-sub { display: grid; gap: 14px; }
.panel h2 { font-size: 16px; }
.panel .hint { margin: 0; color: var(--muted); font-size: 13px; }
.panel label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; }
.row .grow { flex: 1; }
/* chat in the admin page: replies, deletes, read-aloud switch */
.admin-chat {
  height: 260px;
  flex: none;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.admin-chat li { display: flex; align-items: baseline; gap: 0; }
.admin-chat .t { flex: none; width: 5.8em; color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; }
.admin-chat .who { flex: none; margin-right: 7px; font-weight: 600; color: var(--accent); }
.admin-chat .admin .who { color: var(--text); }
.admin-chat .del { margin-left: auto; padding: 0 6px; font-size: 16px; line-height: 1.2; opacity: 0.45; flex: none; }
.admin-chat li:hover .del, .admin-chat .del:focus-visible { opacity: 1; }
.panel .chat-form { padding: 0; border: 0; }
.panel label.switch { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
.panel label.switch input { width: 16px; height: 16px; accent-color: var(--accent); }
.statline { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.statline .big { font: 600 20px/1 var(--display); }

.picks { display: grid; gap: 4px; margin-top: -6px; }
.picks:empty { display: none; }
.pick { justify-content: flex-start; text-align: left; padding: 6px 8px; background: var(--bg); }
.pick img { width: 92px; height: 34px; object-fit: cover; border-radius: 4px; }
.custom {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px dashed var(--line-2);
  border-radius: 12px;
}
.custom input[type="file"] { padding: 8px; font-size: 13px; }
.chosen { display: flex; align-items: center; gap: 12px; }
.chosen img { width: 150px; border-radius: 8px; box-shadow: 0 0 0 1px var(--line-2); }
.chosen .name { flex: 1; min-width: 0; font-weight: 600; }

.reactrows { display: grid; gap: 8px; }
.reactrow { display: grid; grid-template-columns: 56px 110px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.reactrow input:first-child { text-align: center; font-size: 18px; padding: 8px 4px; }
.reactrow button { padding: 8px 10px; }
.reactlog { display: grid; gap: 4px; font-size: 13px; }
.reactlog div { display: flex; gap: 8px; }
.reactlog .t { color: var(--dim); margin-left: auto; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) {
  .reactrow { grid-template-columns: 48px minmax(0, 1fr) auto; }
  .reactrow input:nth-child(3) { grid-column: 1 / -1; grid-row: 2; }
}
.secret {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 6px 6px 6px 12px;
}
.secret code {
  flex: 1;
  min-width: 0;
  font: 500 13px/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace;
  overflow-wrap: anywhere;
}
.secret button { padding: 7px 10px; font-size: 13px; }
.kv { display: grid; gap: 6px; }
.kv > span { font-size: 13px; color: var(--muted); }

/* stream health and upload, on the admin page */
.health {
  --ug-live: #d96a0c; /* the accent, a step deeper so a filled area holds its own */
  --ug-rec: #4a9fd8;
  --ug-surface: #101010;
  display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: rgb(9 9 9 / 0.5);
}
.hstat { display: flex; align-items: baseline; gap: 6px 12px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.hstat > span { width: 76px; font-size: 13px; color: var(--muted); }
.hstat b { font: 600 17px/1 var(--display); }
.hstat b.warn { color: #ffd23f; }
.hstat b.bad { color: var(--live); }
.hstat em { font-style: normal; font-size: 13px; color: var(--muted); }
.upgraph { display: grid; gap: 6px; }
.ug-legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); }
.ug-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.sw.s-live { background: var(--ug-live); }
.sw.s-rec { background: var(--ug-rec); }
.ug-plot { position: relative; height: 96px; border-bottom: 1px solid var(--line-2); touch-action: pan-y; cursor: crosshair; }
.ug-plot svg { display: block; overflow: visible; }
.ug-plot .grid { stroke: var(--line); stroke-width: 1; }
.ug-plot .cap { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; opacity: 0.7; }
.ug-plot .a-live { fill: var(--ug-live); }
.ug-plot .a-rec { fill: var(--ug-rec); }
.ug-plot .a-gap { fill: none; stroke: var(--ug-surface); stroke-width: 2; stroke-linejoin: round; }
.ug-plot .cross { stroke: var(--text); stroke-width: 1; opacity: 0.6; visibility: hidden; }
.ug-plot .cross.on { visibility: visible; }
.ug-cap { position: absolute; right: 0; transform: translateY(-100%); padding-bottom: 2px; font-size: 11px; color: var(--muted); pointer-events: none; }
.ug-tip {
  position: absolute; bottom: calc(100% + 6px); z-index: 2; display: grid; gap: 3px; min-width: 150px;
  padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface-2);
  font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; pointer-events: none; white-space: nowrap;
}
.ug-tip .when { color: var(--text); font-weight: 600; }
.ug-tip div { display: flex; align-items: center; gap: 6px; }
.ug-tip b { margin-left: auto; color: var(--text); font-weight: 600; }
.ug-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--dim); }
.hviewers { display: grid; gap: 2px; margin-top: 4px; }
.hv {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto 72px 84px;
  gap: 2px 10px;
  align-items: center;
  padding: 7px 8px;
  border-radius: 8px;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.hv:nth-child(odd) { background: rgb(255 255 255 / 0.03); }
.hv .dot { width: 8px; height: 8px; border-radius: 50%; background: #3ddc84; }
.hv.warn .dot { background: #ffd23f; }
.hv.bad .dot { background: var(--live); }
.hv .who { display: grid; gap: 2px; min-width: 0; }
.hv .who b { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hv .who em { font-style: normal; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hv .net { font-size: 12.5px; white-space: nowrap; }
.hv .rate { color: var(--text); text-align: right; white-space: nowrap; }
.hv .spark { justify-self: end; }
.hv .spark polyline { fill: none; stroke-width: 1.5; stroke-linejoin: round; }
.hv .spark.s-live polyline { stroke: var(--ug-live); }
.hv .spark.s-rec polyline { stroke: var(--ug-rec); }
.hv .note { grid-column: 2 / -1; font-size: 12.5px; }
.hv.bad .note { color: #ff8a97; }
@media (max-width: 520px) {
  .hv { grid-template-columns: 10px minmax(0, 1fr) 64px 84px; }
  .hv .net { display: none; }
}

.pt { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: rgb(9 9 9 / 0.5); }
.pt + .pt { margin-top: 12px; }
.pt .head { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.pt select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 10px; }
.pt label.tick { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.ptparts { display: grid; gap: 6px; }
.ptpart {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 78px 78px auto;
  gap: 6px;
  align-items: center;
  font-size: 13px;
}
.ptpart .n { font: 600 13px/1 var(--display); color: var(--accent); }
.ptpart .what { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ptpart .what small { color: var(--muted); }
.ptpart input { padding: 7px 8px; font-size: 13px; }
.ptpart .btns { display: flex; gap: 2px; }
.ptpart .btns button { padding: 6px 8px; font-size: 12px; }
@media (max-width: 520px) {
  .pt .head { grid-template-columns: 1fr; }
  .ptpart { grid-template-columns: 50px minmax(0, 1fr); }
  .ptpart input, .ptpart .btns { grid-column: span 1; }
}
.recs { display: grid; gap: 12px; }
.rec {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgb(9 9 9 / 0.5);
}
.rec img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: var(--surface-2); }
.rec .fields { display: grid; gap: 8px; align-content: start; }
.rec .when { font-size: 13px; color: var(--muted); }
.rec .when b { color: var(--text); font-weight: 600; }

@media (max-width: 980px) {
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .rec { grid-template-columns: 1fr; }
  .admin-page .wrap { padding: 16px 12px 60px; }
}

/* narrow OBS dock */
@media (max-width: 420px) {
  .panel { padding: 14px; }
  .chosen img { width: 110px; }
}
