/* Live — the Live Feed as the whole page's background. Same palette as ../credits/credits.css so it
   reads as one site. */

:root {
  --bg: #151816;
  --line: #3a413b;
  --ink: #e4e8e1;
  --muted: #99a397;
  --link: #8cc45e;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: dark; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  color: var(--ink); font: 16px/1.6 var(--sans);
  background: linear-gradient(180deg, rgba(21,24,22,.55), rgba(21,24,22,.92) 70%, var(--bg)),
              url("../support/backdrops/ride-07.webp") center 30% / cover fixed, var(--bg);
}
a { color: var(--link); }
.in { position: relative; z-index: 1; width: 100%; padding: 0 24px; }
main { flex: 1; display: flex; flex-direction: column; padding-top: 12px; pointer-events: none; }
main a { pointer-events: auto; }

.kicker { margin: 0 0 2px; text-transform: uppercase; letter-spacing: 0.12em; font-size: 12px; }
.kicker a { text-decoration: none; }
h1 {
  margin: 0; font-size: clamp(32px, 5vw, 48px); font-weight: 700; line-height: 1.05;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

/* The screen fills the window behind everything; the stream covers it (off air it is transparent,
   so the ride photo above shows through). The shade keeps the nav, heading and caption readable. */
.screen { position: fixed; inset: 0; z-index: 0; overflow: hidden; }
.screen video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity 1.6s ease;
}
.screen video.on { opacity: 1; }
/* Off air: the last 10 s of the newest stream, looping in black and white behind the note. */
.screen video.replay { filter: grayscale(1); }
/* Fit: the whole frame inside the window, dark bars instead of the ride photo around it. */
.screen.fit video { object-fit: contain; }
.screen.fit:has(video.on) { background: #0b0d0c; }
.screen::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(11,13,12,.7), rgba(11,13,12,0) 26%, rgba(11,13,12,0) 72%, rgba(11,13,12,.75));
}
.screen-note {
  position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4px; padding: 20px; text-align: center;
  /* Layered dark glow: readable even over a white stream frame. */
  text-shadow: 0 0 3px #000, 0 0 12px #000, 0 0 30px rgba(0, 0, 0, 0.9), 0 0 60px rgba(0, 0, 0, 0.85);
}
/* A wide soft dark pool behind the note (~a third of the stage or more), fading out at its edges. */
.screen-note::before {
  content: ""; position: absolute; left: 50%; top: 50%; z-index: -1; pointer-events: none;
  width: max(65%, 520px); height: max(60%, 260px); transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.55) 45%, rgba(0, 0, 0, 0.2) 75%, transparent);
}
.note-title { margin: 0; font-size: clamp(20px, 3vw, 28px); font-weight: 700; }
.note-sub { margin: 0; color: var(--muted); }
.play {
  margin-top: 14px; padding: 10px 22px; border: 1px solid var(--link); border-radius: 8px;
  background: rgba(140, 196, 94, 0.15); color: var(--ink); font: 600 16px/1 var(--sans); cursor: pointer;
}
.play:hover, .play:focus-visible { background: rgba(140, 196, 94, 0.3); }
.play:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

/* Bottom row over the stream: the caption on the left, the Fit/Fill button on the right. */
.bar { display: flex; align-items: center; gap: 12px; margin-top: auto; }
.caption {
  display: flex; align-items: center; gap: 8px; margin: 0; color: var(--ink); font-size: 15px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7);
}
.fit-toggle {
  margin-left: auto; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  padding: 0; border: 1px solid var(--link); border-radius: 999px;
  background: rgba(11, 13, 12, 0.55); color: var(--ink); cursor: pointer;
  pointer-events: auto;
}
/* Icon-only: live.js sets data-icon to the mode a click switches to. */
.fit-icon { width: 20px; height: 20px; }
.fit-toggle:not([data-icon="fill"]) .icon-fill, .fit-toggle[data-icon="fill"] .icon-fit { display: none; }
.fit-toggle:hover, .fit-toggle:focus-visible { background: rgba(140, 196, 94, 0.3); }
.fit-toggle:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
/* The viewer pill beside the caption, and its "where from" popover above it (live.js). Opens on hover,
   on keyboard focus, and on a tap (.open — phones have no hover). */
.audience { position: relative; flex-shrink: 0; pointer-events: auto; }
.audience-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line);
  border-radius: 999px; background: rgba(11, 13, 12, 0.55); color: var(--ink); font: 600 14px/1 var(--sans);
  cursor: pointer; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.audience-pill:hover, .audience.open .audience-pill { border-color: var(--link); }
.audience-pill:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.audience-eye { font-size: 13px; }
.audience-pop {
  position: absolute; left: var(--pop-dx, 0px); bottom: calc(100% + 8px); z-index: 3; min-width: 168px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: rgba(11, 13, 12, 0.92);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  opacity: 0; visibility: hidden; transform: translateY(4px); transition: opacity 0.12s, transform 0.12s, visibility 0.12s;
}
.audience:hover .audience-pop, .audience:focus-within .audience-pop, .audience.open .audience-pop {
  opacity: 1; visibility: visible; transform: none;
}
.audience-head { margin: 0 0 6px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.audience-rows { margin: 0; padding: 0; list-style: none; }
.audience-row { display: flex; justify-content: space-between; gap: 18px; padding: 3px 0; color: var(--ink); font-size: 14px; }
.audience-row.none { color: var(--muted); opacity: 0.6; }
.audience-n { font-weight: 600; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .audience-pop { transition: none; } }
/* A phone's bottom row can hold more pills than fit beside the caption: let it wrap rather than run off the side. */
@media (max-width: 760px) { .bar { flex-wrap: wrap; row-gap: 8px; } }
.foot { padding: 8px 24px 18px; color: var(--muted); font-size: 14px; }
.foot p { margin: 0; }
.foot a { text-decoration: none; }
.foot a:hover { text-decoration: underline; }

/* The stream's chat room, Twitch-style, down the right of the window over the picture (live-chat.js).
   Clickable through main (which is pointer-events: none). Hidden → a small Chat button, bottom right. */
.chat {
  position: fixed; z-index: 2; right: 16px; top: 76px; bottom: 60px; width: min(340px, calc(100vw - 32px));
  display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px;
  background: rgba(11, 13, 12, 0.72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  pointer-events: auto; overflow: hidden;
}
.chat-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.chat-head h2 { margin: 0; flex: 1; font-size: 14px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.chat-hide, .chat-logout {
  border: 0; background: none; color: var(--muted); font: inherit; cursor: pointer; padding: 2px 6px; border-radius: 6px;
}
.chat-hide:hover, .chat-hide:focus-visible, .chat-logout:hover, .chat-logout:focus-visible { color: var(--ink); background: rgba(255, 255, 255, 0.08); }
/* The 🌐 toggle: the reader's language; pressed = lines show translated, own lines go out in English. */
.chat-translate {
  border: 1px solid var(--line); background: none; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer;
  padding: 2px 8px; border-radius: 999px; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-translate:hover, .chat-translate:focus-visible { color: var(--ink); background: rgba(255, 255, 255, 0.08); }
.chat-translate[aria-pressed="true"] { color: var(--ink); border-color: var(--ink); }
.chat-setup {
  margin-left: 4px; border: 1px solid var(--line); background: none; color: var(--ink); font: inherit; font-size: 12px;
  cursor: pointer; padding: 1px 8px; border-radius: 999px;
}
.chat-setup:hover, .chat-setup:focus-visible { background: rgba(255, 255, 255, 0.08); }
/* A translated line: a small mark after it; its text flips to the original on click. */
.chat-lines .line.translated .text, .chat-lines .line.untranslated .text { cursor: pointer; }
.chat-lines .line.translated .text::after { content: " \1F310"; font-size: 11px; opacity: 0.55; }
.chat-note { margin: 0; padding: 10px 12px; color: var(--muted); font-size: 14px; }
.chat-lines {
  flex: 1; margin: 0; padding: 6px 12px; list-style: none; overflow-y: auto; overscroll-behavior: contain;
  font-size: 14px; line-height: 1.45; word-break: break-word; scrollbar-width: thin;
}
.chat-lines .line { padding: 3px 0; }
.chat-lines .moment-photo { display: block; max-width: min(100%, 320px); max-height: 240px; margin: 4px 0 2px; }
.chat-lines .name { font-weight: 700; color: #5bc8e0; }
.chat-lines .name::after { content: ":"; color: var(--muted); font-weight: 400; }
.chat-lines .line.moment .name::after { content: none; }
.chat-lines .game .name { color: var(--link); }
.chat-lines .twitch .name { color: #c89bff; }
.chat-lines .system { opacity: 0.8; font-style: italic; }
.chat-lines .system .name { display: none; }
.chat-lines .system a { color: var(--link); text-decoration: underline; }
.chat-lines .poll { font-weight: 600; }
.chat-lines .poll .name { display: none; }
.chat-lines .private { white-space: pre-wrap; border-left: 2px dashed currentColor; padding-left: 6px; opacity: 0.9; }
.chat-lines .web .name { color: #f0c36a; }
.chat-lines .src { display: inline-block; width: 1.15em; text-align: center; font-size: 0.95em; line-height: 1; vertical-align: -0.1em; }
.chat-lines .src svg { width: 1em; height: 1em; fill: currentColor; vertical-align: -0.1em; }
.chat-lines .discord .src { color: #5865f2; }
.chat-lines .twitch .src { color: #9146ff; }
.chat-notice { margin: 0; padding: 6px 12px; color: #f0c36a; font-size: 13px; border-top: 1px solid var(--line); }
.chat-foot { padding: 10px 12px; border-top: 1px solid var(--line); }
.chat-form { display: flex; gap: 8px; }
.chat-input {
  flex: 1; min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: rgba(21, 24, 22, 0.8); color: var(--ink); font: 14px/1.3 var(--sans);
}
.chat-input:focus-visible { outline: 2px solid var(--link); outline-offset: 1px; }
.chat-input:disabled { color: var(--muted); }
.chat-send {
  padding: 9px 14px; border: 1px solid var(--link); border-radius: 8px; background: rgba(140, 196, 94, 0.15);
  color: var(--ink); font: 600 14px/1.3 var(--sans); cursor: pointer;
}
.chat-send:hover:not(:disabled), .chat-send:focus-visible { background: rgba(140, 196, 94, 0.3); }
.chat-send:disabled, .chat-send[aria-disabled="true"] { opacity: 0.5; cursor: default; }
/* Logged out: the Log in button stands where Send does, same size, same look. */
.chat-login { display: inline-flex; align-items: center; text-decoration: none; white-space: nowrap; }
.chat-login[aria-disabled="true"] { pointer-events: none; }
.chat-who { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.chat-who strong { color: var(--ink); }
/* The emoji button beside the box, and its picker floating above the foot (live-chat.js). */
.chat-foot { position: relative; }
.chat-emoji {
  flex: none; width: 38px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: rgba(21, 24, 22, 0.8);
  font-size: 18px; line-height: 1; cursor: pointer;
}
.chat-emoji:hover:not(:disabled), .chat-emoji:focus-visible, .chat-emoji[aria-expanded="true"] { background: rgba(255, 255, 255, 0.1); }
.chat-emoji:disabled { opacity: 0.5; cursor: default; }
.chat-picker {
  position: absolute; left: 8px; right: 8px; bottom: calc(100% + 6px); z-index: 5; max-height: 260px; overflow-y: auto;
  padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: #151816; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.picker-title { margin: 0 0 6px; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.picker-recent { padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.pick {
  aspect-ratio: 1; padding: 0; border: 0; border-radius: 6px; background: none; font-size: 20px; line-height: 1; cursor: pointer;
}
.pick:hover, .pick:focus-visible { background: rgba(255, 255, 255, 0.12); outline: none; }
/* Reactions under a line, and the React button that shows on hover / focus (always, faintly, on touch). */
.chat-lines .line { position: relative; }
.chat-lines .react-add {
  display: none; position: absolute; right: 0; top: 0; padding: 1px 5px; border: 1px solid var(--line); border-radius: 6px;
  background: #151816; color: var(--ink); font-size: 12px; line-height: 1.4; cursor: pointer; opacity: 0;
}
.chat.can-react .react-add { display: inline-block; }
.chat-lines .line:hover .react-add, .chat-lines .react-add:focus-visible { opacity: 1; }
@media (hover: none) { .chat.can-react .react-add { position: static; margin-left: 6px; opacity: 0.6; } }
.chat-lines .reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.chat-lines .reacts[hidden] { display: none; }
.chat-lines .chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border: 1px solid var(--line); border-radius: 999px;
  background: rgba(255, 255, 255, 0.05); color: var(--ink); font: 12px/1.5 var(--sans); cursor: pointer;
}
.chat-lines .chip:hover, .chat-lines .chip:focus-visible { background: rgba(255, 255, 255, 0.12); }
.chat-lines .chip[aria-pressed="true"] { border-color: #5865f2; background: rgba(88, 101, 242, 0.25); }
.chat-lines .chip .emo { font-size: 14px; }
.chat-lines .chip img { width: 16px; height: 16px; object-fit: contain; }
.chat-lines .chip .count { color: var(--muted); font-weight: 600; }
.chat-lines .chip[aria-pressed="true"] .count { color: var(--ink); }
/* Hidden chat: a Chat pill in the bottom row, beside Fit/Fill — never on top of it. */
.chat-open {
  margin-left: auto; padding: 6px 14px; border: 1px solid var(--link); border-radius: 999px;
  background: rgba(11, 13, 12, 0.55); color: var(--ink); font: 600 14px/1 var(--sans); cursor: pointer;
  pointer-events: auto;
}
/* The pills sit together at the right: only the first one showing takes the free space. */
.chat-open:not([hidden]) ~ .fit-toggle, .chat-open:not([hidden]) ~ .sound,
.sound:not([hidden]) ~ .fit-toggle { margin-left: 0; }
/* Sound: icon-only mute toggle (live.js); hover or keyboard focus pops a vertical volume slider up above
   it, Twitch-style. The pop's bottom padding bridges the gap so the pointer can travel up to it. */
.sound { position: relative; margin-left: auto; display: inline-flex; pointer-events: auto; }
.sound-toggle {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0;
  border: 1px solid var(--link); border-radius: 999px; background: rgba(11, 13, 12, 0.55); color: var(--ink); cursor: pointer;
}
.sound-toggle:hover, .sound-toggle:focus-visible { background: rgba(140, 196, 94, 0.3); }
.sound-toggle:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.sound-icon { width: 20px; height: 20px; }
.sound-toggle[aria-pressed="true"] .icon-muted, .sound-toggle[aria-pressed="false"] .icon-on { display: none; }
.sound-pop {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); padding-bottom: 8px;
  visibility: hidden; opacity: 0; transition: opacity 0.12s, visibility 0.12s;
}
.sound:hover .sound-pop, .sound:focus-within .sound-pop, .sound.open .sound-pop { visibility: visible; opacity: 1; }
/* iOS: the page can't set the loudness (hardware buttons do), so no slider — the button only mutes. */
.sound.no-volume .sound-pop { display: none; }
.sound-pop-box {
  padding: 12px 8px; border: 1px solid var(--line); border-radius: 999px; background: rgba(11, 13, 12, 0.85);
}
.sound-volume {
  display: block; width: 20px; height: 110px; margin: 0;
  writing-mode: vertical-lr; direction: rtl; accent-color: var(--link); cursor: pointer;
}
.sound-volume:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.chat-open:hover, .chat-open:focus-visible { background: rgba(140, 196, 94, 0.3); }
/* The bottom row keeps clear of the open panel. */
body.chat-open .bar { padding-right: calc(min(340px, calc(100vw - 32px)) + 8px); }
/* --kb (live-chat.js, from visualViewport): how much of the window an on-screen keyboard covers. The
   phone panel rides up above it, and shrinks so its head stays on screen. */
@media (max-width: 760px) {
  .chat {
    left: 12px; right: 12px; top: auto; bottom: max(56px, calc(var(--kb, 0px) + 8px)); width: auto; height: 42vh;
    max-height: calc(100vh - var(--kb, 0px) - 84px); max-height: calc(100dvh - var(--kb, 0px) - 84px);
  }
  body.chat-open .bar { padding-right: 0; padding-bottom: calc(42vh + 8px); }
  .chat-picker { max-height: calc(42vh - 120px); } /* stays inside the shorter phone panel */
  /* Phone: the Chat pill is just its icon, a circle like the sound and Fit/Fill buttons. */
  .chat-open { width: 36px; height: 36px; padding: 0; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; }
  .chat-open-text { display: none; }
}

/* The streamer's name in the caption is a link to their own Twitch channel when they linked one (live.js). */
.caption .streamer-channel { color: inherit; text-decoration: underline; text-decoration-color: rgba(255,255,255,0.45); text-underline-offset: 2px; }
.caption .streamer-channel:hover, .caption .streamer-channel:focus-visible { text-decoration-color: currentColor; }
