/* ==========================================================================
   Home Alone Pop-Up Trivia - streamer page (/stream)
   --------------------------------------------------------------------------
   Builds on /static/shared/theme.css (ha-*). Everything here is prefixed st-.
   This page runs in a current Chrome (PC or Android), never on the Chromecast,
   so modern CSS (grid gap, clamp, container queries, aspect-ratio) is fine.

   Layout: one scrolling column on phones (360 px and up), two columns from
   1000 px. Panels are query containers (.st-cq), so their insides adapt to
   the width of the panel and not to the width of the window.
   ========================================================================== */

html { scroll-padding-top: 72px; }
/* This page scrolls, so the night-sky glow lives on a fixed layer (.st-sky)
   instead of being stretched down the whole length of the body. */
body { position: relative; background-image: none; }
html.st-noscroll, html.st-noscroll body { overflow: hidden; }

/* --------------------------------------------------------------------------
   Ambient layers
   -------------------------------------------------------------------------- */
.st-sky {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background-color: #0b1a2e;
  background-image: radial-gradient(ellipse 130% 75% at 50% 0%, #21467a 0%, #14305a 32%, #0b1a2e 68%, #060f1d 100%);
}
.st-lights { z-index: 2; }

/* --------------------------------------------------------------------------
   Page frame
   -------------------------------------------------------------------------- */
.st-page {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding:
    calc(var(--safe-t) + 54px)
    calc(var(--safe-r) + 16px)
    calc(var(--safe-b) + 48px)
    calc(var(--safe-l) + 16px);
}

.st-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 30px;
  align-items: start;
}
.st-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 30px;
  min-width: 0;
}
@media (min-width: 1000px) {
  .st-page { padding-left: calc(var(--safe-l) + 28px); padding-right: calc(var(--safe-r) + 28px); }
  .st-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; }
}

/* panels answer container queries; a little tighter on phones */
.st-cq { container-type: inline-size; }
@media (max-width: 520px) {
  .st-page .ha-panel { padding: 16px 14px 18px; border-radius: 22px; }
  .st-page .ha-panel.ha-snowcap { padding-top: 28px; }
}

.st-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 14px;
}
.st-head .ha-panel__title { flex: 1 1 auto; min-width: 0; margin: 0; }
.st-head__toggle { order: 2; }
.st-head__toggle .ha-icon { transition: transform 0.2s var(--ease-out); }
.st-head__toggle[aria-expanded="true"] .ha-icon { transform: rotate(180deg); }
.st-head__pill { order: 3; }
@container (min-width: 460px) {
  .st-head__pill { order: 1; }
}

/* full-width buttons with long labels: trim them on narrow panels so the label stays on one line */
@container (max-width: 430px) {
  .st-fit { padding-right: 12px; padding-left: 12px; font-size: 20px; }
  .st-fit.ha-btn--lg { font-size: 24px; }
}

.st-lead {
  margin: 0 0 16px;
  color: var(--snow-dim);
  font-size: 15px;
  line-height: 1.4;
}
.st-note {
  margin-top: 12px;
  color: var(--snow-dim);
  font-size: 14px;
  line-height: 1.4;
}
.st-empty {
  padding: 18px 8px 6px;
  color: var(--snow-dim);
  font-size: 16px;
  line-height: 1.4;
  text-align: center;
}
.st-error {
  padding: 10px 14px;
  border: 2px solid var(--red-bright);
  border-radius: 14px;
  background: #4a0f1b;
  color: #ffd3d8;
  font-size: 15px;
  line-height: 1.3;
}
.st-garland { margin-top: 40px; opacity: 0.9; }

kbd {
  display: inline-block;
  padding: 1px 7px;
  border: 2px solid var(--line);
  border-bottom-width: 4px;
  border-radius: 7px;
  background: #08142a;
  color: var(--snow);
  font: 900 13px/1.3 var(--font-body);
}
code {
  padding: 1px 6px;
  border-radius: 6px;
  background: #08142a;
  color: var(--gold);
  font: 700 0.92em/1.3 ui-monospace, "Cascadia Mono", Consolas, "Roboto Mono", monospace;
  overflow-wrap: anywhere;
}

/* --------------------------------------------------------------------------
   Status pill ("TV connected")
   -------------------------------------------------------------------------- */
.st-pill {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 4px 13px 4px 10px;
  border: 2px solid;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.05em;
  line-height: 1.1;
  text-transform: uppercase;
  white-space: nowrap;
}
.st-pill__dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
}
/* waiting = amber, connected = green */
.st-pill.is-off { border-color: #c98a10; background: #3a2c0d; color: var(--gold); }
.st-pill.is-on { border-color: #3ed087; background: var(--pine); color: #d9ffe9; }
.st-pill.is-on .st-pill__dot { background: #3ed087; box-shadow: 0 0 0 4px rgba(62, 208, 135, 0.25); }
.st-pill__short { display: none; }

/* small coloured dot used in the cast status line */
.st-dot {
  flex: none;
  width: 12px;
  height: 12px;
  margin-top: 4px;
  border-radius: 50%;
  background: #7d8b9c;
}

/* state chip colours (top bar) */
.st-statechip[data-state="LOBBY"] { background: var(--ans-3); color: #06283d; }
.st-statechip[data-state="MENU"] { background: var(--gold); color: #4a2f00; }
.st-statechip[data-state="PLAYING"] { background: var(--ans-1); color: #ffffff; }
.st-statechip[data-state="FINISHED"] { background: var(--snow); color: var(--ink); }

/* --------------------------------------------------------------------------
   Connection banner and the slide-in top bar
   -------------------------------------------------------------------------- */
.st-conn {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: calc(var(--safe-t) + 10px) 16px 10px;
  background-color: var(--red);
  background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.12) 50%, rgba(255, 255, 255, 0.12) 75%, transparent 75%);
  background-size: 36px 36px;
  color: #ffffff;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.35);
  animation: st-conn-in 0.25s var(--ease-out) both;
}
.st-conn[hidden] { display: none; }
@keyframes st-conn-in {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

.st-top {
  position: fixed;
  top: calc(var(--safe-t) + 8px);
  left: 50%;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 16px);
  padding: 7px 10px 8px;
  border: 3px solid rgba(255, 253, 247, 0.35);
  border-radius: 20px;
  background: #10213a;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.4), 0 14px 26px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, -180%);
  visibility: hidden;
  transition: transform 0.28s var(--ease-out), visibility 0s linear 0.28s;
}
.st-top.is-shown {
  transform: translate(-50%, 0);
  visibility: visible;
  transition: transform 0.28s var(--ease-out), visibility 0s;
}
.st-top .ha-code { margin-top: 3px; }
@media (max-width: 480px) {
  .st-top .st-pill__long { display: none; }
  .st-top .st-pill__short { display: inline; }
}

/* --------------------------------------------------------------------------
   Splash views: loading, stream key, fatal error
   -------------------------------------------------------------------------- */
.st-splash {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  min-height: calc(100vh - 160px);
  min-height: calc(100dvh - 160px);
  text-align: center;
}
.st-splash[hidden] { display: none; }
.st-splash__logo { width: min(340px, 74vw); }
.st-splash__logo--sm { width: min(280px, 70vw); }
.st-gate {
  display: grid;
  gap: 16px;
  width: 100%;
  max-width: 440px;
  text-align: left;
}
.st-gate .st-lead { margin: 0; }
.st-gate .ha-btn { margin-bottom: 6px; }
.st-gate h1 .ha-icon { width: 30px; height: 30px; vertical-align: -6px; }

/* --------------------------------------------------------------------------
   Hero: room code, join address, QR
   -------------------------------------------------------------------------- */
.st-hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  justify-items: center;
  text-align: center;
}
.st-hero__main {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-width: 0;
}
.st-hero__logo { width: min(250px, 72%); margin-bottom: 12px; }
.st-hero__code {
  margin: 8px 0 4px;
  font-size: clamp(34px, 11.5vw, 64px);
}
.st-hero__join {
  margin-top: 8px;
  color: var(--snow-dim);
  font-size: 16px;
  line-height: 1.3;
}
.st-hero__host {
  display: block;
  margin-top: 2px;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: clamp(20px, 6vw, 30px);
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1.15;
  overflow-wrap: anywhere;
  text-shadow: var(--shadow-text);
  -webkit-user-select: all;
  user-select: all;
}
.st-hero__acts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px 10px;
  margin-top: 16px;
  padding-bottom: 6px;
}
.st-hero__qr { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.st-hero__qr img {
  width: min(210px, 62vw);
  height: auto;
  aspect-ratio: 1 / 1;
  padding: 6px;
  border: 4px solid var(--red-bright);
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.35);
}
.st-hero__qr figcaption {
  color: var(--ice);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
@supports (font-size: 1cqi) {
  .st-hero__code { font-size: clamp(32px, 15cqi, 68px); }
  .st-hero__host { font-size: clamp(19px, 6.4cqi, 30px); }
  .st-hero__qr img { width: min(210px, 62cqi); }
}
/* room to spare: details on the left, QR on the right */
@container (min-width: 500px) {
  .st-hero__grid {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 24px;
    align-items: center;
    justify-items: start;
    text-align: left;
  }
  .st-hero__main { align-items: flex-start; }
  .st-hero__logo { width: 230px; }
  .st-hero__code { margin-left: -0.085em; font-size: clamp(32px, calc((100cqi - 190px) / 6), 68px); }
  .st-hero__host { font-size: clamp(19px, 4.6cqi, 30px); }
  .st-hero__acts { justify-content: flex-start; }
  .st-hero__qr img { width: 160px; }
}

/* --------------------------------------------------------------------------
   "Get it on the TV": three option cards
   -------------------------------------------------------------------------- */
.st-opt {
  padding: 16px;
  border: 2px solid var(--line);
  border-radius: 20px;
  background: rgba(6, 15, 29, 0.42);
}
.st-opt + .st-opt { margin-top: 14px; }
.st-opt--best {
  border-color: rgba(255, 209, 102, 0.75);
  background-image: linear-gradient(180deg, rgba(255, 209, 102, 0.14) 0%, rgba(255, 209, 102, 0) 55%);
}
.st-opt > p {
  color: var(--snow-dim);
  font-size: 15px;
  line-height: 1.4;
}
.st-opt strong { color: var(--snow); }
.st-opt__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-bottom: 8px;
}
.st-opt__head .ha-h3 { flex: 1 1 180px; min-width: 0; font-size: 21px; }
/* the option number sits in a little red bauble */
.st-opt__num {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 3px solid var(--snow);
  border-radius: 50%;
  background-color: var(--red-bright);
  background-image: radial-gradient(circle at 30% 26%, rgba(255, 255, 255, 0.55) 0, rgba(255, 255, 255, 0) 45%);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 400;
  line-height: 1;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}
.st-opt__btn { margin-top: 14px; margin-bottom: 8px; }
@media (max-width: 420px) {
  .st-opt { padding: 14px 12px; }
}

/* read-only address with a copy button */
.st-url {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  padding-bottom: 6px;
}
.st-url__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #08142a;
  color: var(--snow);
  /* 16px so Android / iOS never zoom the page when the field is tapped */
  font: 700 16px/1 ui-monospace, "Cascadia Mono", Consolas, "Roboto Mono", monospace;
  text-overflow: ellipsis;
  outline: none;
}
.st-url__input:focus { border-color: var(--gold); }
.st-url--big .st-url__input {
  height: 52px;
  border-color: rgba(255, 209, 102, 0.6);
  color: var(--gold);
  font-size: 18px;
}
.st-url--big .ha-btn { margin-top: 4px; }

.st-callout {
  padding: 12px 14px;
  border: 2px solid rgba(155, 224, 255, 0.5);
  border-radius: 14px;
  background: rgba(111, 205, 247, 0.12);
  font-size: 15px;
  line-height: 1.4;
}
.st-callout p + p { margin-top: 8px; }

.st-steps {
  margin-top: 14px;
  counter-reset: st-step;
}
.st-steps > li {
  position: relative;
  padding-left: 36px;
  color: var(--snow-dim);
  font-size: 15px;
  line-height: 1.4;
  counter-increment: st-step;
}
.st-steps > li + li { margin-top: 12px; }
.st-steps > li::before {
  content: counter(st-step);
  position: absolute;
  top: -1px;
  left: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--ans-3);
  color: #06283d;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 400;
  line-height: 26px;
  text-align: center;
}

/* ---- Cast ---- */
.st-cast { margin-top: 14px; }
.st-cast__btn { margin-bottom: 8px; }
.st-cast__icon {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}
.st-cast__icon > .ha-icon { width: 36px; height: 36px; }
/* Google's launcher element draws the official Cast icon; the big button
   around it takes the taps, and the launcher must stay visible even when the
   SDK would hide it because no device has been found yet. */
.st-cast__icon > google-cast-launcher {
  display: block !important;
  width: 36px;
  height: 36px;
  pointer-events: none;
  --disconnected-color: #33210a;
  --connected-color: #0c5a31;
}
.st-cast__state {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
  font-size: 16px;
  line-height: 1.3;
}
.st-cast__state[data-state="ready"] .st-dot { background: var(--gold); }
.st-cast__state[data-state="connecting"] .st-dot { background: var(--ice); animation: ha-pulse 0.9s ease-in-out infinite; }
.st-cast__state[data-state="casting"] { color: #d9ffe9; }
.st-cast__state[data-state="casting"] .st-dot { background: #3ed087; box-shadow: 0 0 0 4px rgba(62, 208, 135, 0.25); }
.st-cast__live {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 10px;
  margin-top: 14px;
  padding-bottom: 6px;
}
.st-cast__live[hidden] { display: none; }

/* --------------------------------------------------------------------------
   Live room
   -------------------------------------------------------------------------- */
.st-state {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 18px;
  background: #0b1a33;
}
.st-state[data-state="MENU"] { border-color: rgba(255, 209, 102, 0.7); }
.st-state[data-state="PLAYING"] { border-color: #3ed087; background-image: linear-gradient(180deg, rgba(26, 122, 76, 0.55) 0%, rgba(15, 81, 50, 0.3) 100%); }
.st-state[data-state="FINISHED"] { border-color: var(--snow); }
.st-state__icon {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: #d9f0ff;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3);
}
.st-state__icon > .ha-icon { width: 30px; height: 30px; }
.st-state__body { flex: 1 1 auto; min-width: 0; }
.st-state__label {
  display: block;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.1;
}
.st-state__sub {
  display: block;
  margin-top: 2px;
  color: var(--snow-dim);
  font-size: 14px;
  line-height: 1.25;
}
.st-state__clock {
  flex: none;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-shadow: var(--shadow-text);
}
.st-state__clock.is-paused { color: var(--ice); }

.st-players {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px 16px;
  margin-top: 18px;
}
.st-players:empty { display: none; }
@container (min-width: 640px) {
  .st-players { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
.st-player {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  /* room for the gift tag's string, which loops out past its left edge */
  padding: 0 0 6px 10px;
  cursor: pointer;
}
.st-player .ha-tag { flex: 1 1 auto; min-width: 0; }
.st-player .ha-tag__name { padding: 2px 0; }
.st-player .ha-chip { margin-left: 6px; }
.st-player .ha-chip + .ha-tag__score { margin-left: 6px; }
.st-hostchip .ha-icon { margin-right: 4px; }
@container (max-width: 420px) {
  /* just the crown on narrow phones, so the name keeps its space */
  .st-hostchip { padding: 0 6px; }
  .st-hostchip .ha-icon { margin: 0; }
  .st-hostchip__txt { display: none; }
}

/* --------------------------------------------------------------------------
   Live question monitor
   -------------------------------------------------------------------------- */
.st-q__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.st-q__time {
  margin-left: auto;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.st-q__time.is-paused { color: var(--ice); }
.st-q__text {
  margin: 12px 0 14px;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.25;
  overflow-wrap: break-word;
}
/* the shared answer buttons, scaled down and display-only */
.st-q__answers {
  --u: 0.8px;
  margin-top: 20px;
  padding-bottom: 6px;
  pointer-events: none;
}
@container (min-width: 520px) {
  .st-q__answers { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
.st-q__progress {
  margin-top: 14px;
  color: var(--snow-dim);
  font-size: 15px;
}
.st-q__reveal {
  margin-top: 18px;
  padding: 14px;
  border: 2px solid #3ed087;
  border-radius: 16px;
  background: rgba(27, 148, 85, 0.18);
}
.st-q__explain {
  margin-bottom: 12px;
  font-size: 16px;
  line-height: 1.35;
}
.st-q__explain:empty { display: none; }
.st-q__names {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.st-q__names .ha-chip { letter-spacing: 0; text-transform: none; font-size: 14px; }

/* --------------------------------------------------------------------------
   Backup host controls
   -------------------------------------------------------------------------- */
.st-sub {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 26px 0 14px;
  color: var(--ice);
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 400;
  letter-spacing: 0.03em;
  line-height: 1.1;
}
.st-sub::after {
  content: "";
  flex: 1 1 auto;
  height: 2px;
  border-radius: 2px;
  background: var(--line);
}
.st-btns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px 12px;
  margin-top: 16px;
  padding-bottom: 6px;
}
.st-btns .ha-btn {
  width: 100%;
  min-width: 0;
  padding-right: 14px;
  padding-left: 14px;
  font-size: 19px;
}
@container (max-width: 430px) {
  .st-btns { grid-template-columns: minmax(0, 1fr); }
}
.st-transport {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding-bottom: 6px;
}
.st-transport .ha-btn {
  flex-direction: column;
  width: 100%;
  min-width: 0;
  min-height: 68px;
  padding: 8px 2px;
  font-size: 15px;
  letter-spacing: 0.02em;
}
.st-transport .ha-btn > * + * { margin: 4px 0 0; }
.st-transport .ha-btn > .ha-icon { width: 26px; height: 26px; }

.st-setting { padding-bottom: 2px; }
.st-setting__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.st-setting__name { font-size: 17px; font-weight: 800; line-height: 1.2; }
.st-setting__val {
  flex: none;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.st-toggles { margin-top: 6px; }
.st-toggles > .ha-toggle + .ha-toggle { border-top: 2px solid var(--line); }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.st-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px 12px;
  margin-top: 22px;
  padding-bottom: 8px;
}
.st-foot [hidden] { display: none; }

/* --------------------------------------------------------------------------
   Dialogs
   -------------------------------------------------------------------------- */
.st-modal-text {
  color: var(--snow-dim);
  font-size: 17px;
  line-height: 1.4;
  text-align: center;
}

/* bottom sheets become ordinary centred dialogs once there is room */
@media (min-width: 720px) {
  .st-sheet { align-items: center; padding: 24px; }
  .st-sheet .ha-modal__card {
    max-width: 440px;
    padding-bottom: 22px;
    border-bottom: 4px solid var(--snow);
    border-radius: 26px;
    box-shadow: 0 10px 0 rgba(0, 0, 0, 0.4);
    animation: ha-pop-in 0.42s var(--ease-spring) both;
  }
  .st-sheet--wide .ha-modal__card { max-width: 800px; }
  .st-sheet .ha-sheet__grip { display: none; }
}

/* player card */
.st-pcard {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.st-pcard__body { flex: 1 1 auto; min-width: 0; }
.st-pcard__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-pcard__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-top: 6px;
  color: var(--snow-dim);
  font-size: 15px;
}
.st-pcard__acts { display: grid; gap: 16px; padding-bottom: 6px; }

/* scene picker */
.st-scenes {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px 12px;
  padding: 4px 4px 8px;
}
@media (min-width: 720px) {
  .st-scenes { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 16px; }
}
.st-scene {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}
.st-scene:focus { outline: none; }
.st-scene:focus-visible .st-scene__thumb { outline: 3px solid var(--gold); outline-offset: 3px; }
.st-scene__thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 3px solid var(--snow);
  border-radius: 14px;
  /* shown when a thumbnail is missing: a festive card with a film icon */
  background-color: var(--pine);
  background-image:
    radial-gradient(circle at 18% 22%, rgba(255, 255, 255, 0.22) 0, rgba(255, 255, 255, 0) 30%),
    linear-gradient(135deg, #c8102e 0%, #c8102e 34%, #0f5132 34%, #1a7a4c 100%);
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.4);
  overflow: hidden;
  transition: transform 0.07s ease-out, box-shadow 0.07s ease-out;
}
.st-scene:active .st-scene__thumb { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4); }
@media (hover: hover) {
  .st-scene:hover .st-scene__thumb { border-color: var(--gold); }
}
.st-scene__ph {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.st-scene__ph > .ha-icon { width: 38%; height: auto; max-height: 70%; }
.st-scene__thumb img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.st-scene__num,
.st-scene__time {
  position: absolute;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(6, 15, 29, 0.86);
  color: var(--snow);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.st-scene__num { top: 6px; left: 6px; background: var(--gold); color: #33210a; }
.st-scene__time { right: 6px; bottom: 6px; }
.st-scene__title {
  display: -webkit-box;
  min-height: 2.4em;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.2;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.st-pager {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 12px;
  padding-bottom: 6px;
}
.st-pager[hidden] { display: none; }
.st-pager__label {
  min-width: 110px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 400;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .st-top,
  .st-head__toggle .ha-icon,
  .st-scene__thumb { transition: none; }
  .st-conn,
  .st-cast__state .st-dot { animation: none !important; }
}
