/* --- Tokens -----------------------------------------------------------------

   The same two layers as the qrcode project's stylesheet. The *roots* are the
   handful of colours a theme chooses; everything else is derived from them
   with `color-mix`, so the dark theme at the foot of this block redefines the
   roots and nothing else.

   The brand is the logo's hue (211°) at a step dark enough to carry text -
   the same blue the other diverd products use - and the one colour of our own
   is `--live`, the red of an on-air light. It is the same in both themes:
   white on it measures 4.6:1, and it has to read as the same signal whatever
   the ground.
   --------------------------------------------------------------------------- */
:root {
  color-scheme: light;

  --brand: #2f6094;
  --brand-dark: #26527f;
  --on-brand: #ffffff;
  --logo-blue-pale: #b9d7ea;

  --ink: #171e28;
  --ink-muted: #55636f;
  --surface: #ffffff;
  --canvas: #f4f6fa;

  --ok: #167048;
  --warn: #8a5600;
  --danger: #b3261e;
  --live: #d92d20;
  --on-danger: #ffffff;

  --shadow-rgb: 16 24 40;

  /* Derived */
  --line: color-mix(in srgb, var(--ink) 11%, var(--surface));
  --line-strong: color-mix(in srgb, var(--ink) 22%, var(--surface));
  --brand-tint: color-mix(in srgb, var(--brand) 7%, var(--surface));
  --brand-wash: color-mix(in srgb, var(--brand) 12%, transparent);
  --hover: color-mix(in srgb, var(--ink) 6%, transparent);
  --warn-tint: color-mix(in srgb, var(--warn) 11%, var(--surface));
  --danger-tint: color-mix(in srgb, var(--danger) 10%, var(--surface));
  --ok-tint: color-mix(in srgb, var(--ok) 10%, var(--surface));
  --shadow-sm: 0 1px 2px rgb(var(--shadow-rgb) / 0.06), 0 1px 3px rgb(var(--shadow-rgb) / 0.08);
  --shadow-md: 0 4px 12px rgb(var(--shadow-rgb) / 0.08), 0 2px 4px rgb(var(--shadow-rgb) / 0.06);
  --shadow-lg: 0 18px 40px rgb(var(--shadow-rgb) / 0.14);

  --radius: 12px;
  --radius-sm: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

/* Dark: chosen explicitly, or following the device when nothing was chosen.
   Written twice because a media query cannot be combined with an attribute
   selector into one rule - and both copies are the roots only. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --brand: #8db5e6;
  --brand-dark: #b4cff2;
  --on-brand: #0b1522;
  --ink: #e5eaf1;
  --ink-muted: #a2adba;
  --surface: #161c25;
  --canvas: #0d1117;
  --ok: #62c997;
  --warn: #e3b15a;
  --danger: #f2877e;
  --on-danger: #1a0907;
  --shadow-rgb: 0 0 0;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --brand: #8db5e6;
    --brand-dark: #b4cff2;
    --on-brand: #0b1522;
    --ink: #e5eaf1;
    --ink-muted: #a2adba;
    --surface: #161c25;
    --canvas: #0d1117;
    --ok: #62c997;
    --warn: #e3b15a;
    --danger: #f2877e;
    --on-danger: #1a0907;
    --shadow-rgb: 0 0 0;
  }
}

/* --- Base ------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  margin: 0 0 0.35em;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 1.6rem;
}

h2 {
  font-size: 1.05rem;
}

p {
  margin: 0 0 0.8em;
}

.muted {
  color: var(--ink-muted);
}

.small {
  font-size: 0.85rem;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.icon {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  fill: currentColor;
  overflow: visible;
  vertical-align: -0.125em;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* --- Buttons ---------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0.55em 1em;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none !important;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-sm {
  padding: 0.4em 0.7em;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 0.75em 1.4em;
  font-size: 1.05rem;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--brand);
  color: var(--on-brand);
}

.btn-primary:hover {
  background: var(--brand-dark);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-secondary:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.btn-ghost {
  color: var(--ink-muted);
}

.btn-ghost:hover {
  background: var(--hover);
  color: var(--ink);
}

.btn-danger {
  background: var(--danger);
  color: var(--on-danger);
}

.btn-danger:hover {
  filter: brightness(1.08);
}

.btn-live {
  background: var(--live);
  color: #fff;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 50%, transparent);
}

.btn-live:hover {
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--live) 20%, transparent);
}

/* --- The signed-in shell ------------------------------------------------------ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.6rem clamp(1rem, 3vw, 2rem);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  font-weight: 750;
  font-size: 1.1rem;
  text-decoration: none !important;
}

.topnav {
  display: flex;
  gap: 0.25rem;
}

.topnav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.4em 0.75em;
  border-radius: var(--radius-sm);
  color: var(--ink-muted);
  font-weight: 600;
  text-decoration: none !important;
}

.topnav-link:hover {
  background: var(--hover);
  color: var(--ink);
}

.topnav-link.is-active {
  background: var(--brand-wash);
  color: var(--brand);
}

.topbar-end {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-left: auto;
}

.signout {
  margin: 0;
}

.page {
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem);
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.page-head p {
  margin: 0;
}

.page-head-actions {
  display: flex;
  gap: 0.25rem;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  margin-bottom: 1rem;
  color: var(--ink-muted);
  font-size: 0.9rem;
  font-weight: 600;
}

/* --- Segmented controls: the theme and the language ---------------------------- */

.segmented {
  display: inline-flex;
  margin: 0;
  padding: 3px;
  gap: 2px;
  border-radius: 999px;
  background: var(--hover);
}

.segment {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 28px;
  padding: 0 0.5em;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--ink-muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.segment:hover {
  background: var(--brand-wash);
  color: var(--ink);
}

.segment.is-active {
  background: var(--surface);
  color: var(--brand);
  box-shadow: var(--shadow-sm);
}

/* --- Cards, forms, lists ----------------------------------------------------------- */

.card {
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card h2 {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin-bottom: 0.6rem;
}

.card h2 .icon {
  color: var(--brand);
}

.narrow {
  max-width: 520px;
}

.stack {
  display: grid;
  gap: 1rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  margin: 0.5rem 0 0;
}

.actions-start {
  justify-content: flex-start;
}

.actions form {
  margin: 0;
}

.field {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
}

.field label {
  font-size: 0.85rem;
  font-weight: 650;
}

input[type="text"],
input[type="email"],
input[type="password"],
select {
  width: 100%;
  padding: 0.6em 0.75em;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-wash);
}

select:disabled {
  opacity: 0.6;
}

.field-help {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.82rem;
}

.field-error,
.form-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 600;
}

.has-error input {
  border-color: var(--danger);
}

.copy-field {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 3px 3px 3px 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--brand-tint);
}

.copy-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  font-family: var(--mono);
  font-size: 0.82rem;
}

.copy-field input:focus {
  box-shadow: none;
}

.copy-field [data-copy].is-copied {
  color: var(--ok);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.2em 0.6em;
  border-radius: 999px;
  background: var(--hover);
  color: var(--ink-muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: middle;
}

.badge-live {
  background: var(--live);
  color: #fff;
}

.badge-warn {
  background: var(--warn-tint);
  color: var(--warn);
}

.dot {
  width: 0.55em;
  height: 0.55em;
  border-radius: 50%;
  background: currentColor;
}

.badge-live .dot {
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

.notice {
  display: flex;
  align-items: center;
  gap: 0.6em;
  margin: 1rem 0 0;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 550;
}

.notice-warn {
  background: var(--warn-tint);
  color: var(--warn);
}

.stream-list {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stream-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.stream-card.is-live {
  border-color: color-mix(in srgb, var(--live) 45%, var(--line));
}

.stream-card-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.stream-card-name {
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 700;
}

.empty {
  display: grid;
  justify-items: center;
  gap: 0.25rem;
  padding: 4rem 1rem;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 0.75rem;
  border-radius: 18px;
  background: var(--brand-wash);
  color: var(--brand);
  font-size: 1.8rem;
}

/* --- Toasts ---------------------------------------------------------------------- */

.toasts {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  transition: opacity 0.25s, transform 0.25s;
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(-4px);
}

.toast-success {
  border-left-color: var(--ok);
}

.toast-success .toast-icon {
  color: var(--ok);
}

.toast-warning {
  border-left-color: var(--warn);
}

.toast-warning .toast-icon {
  color: var(--warn);
}

.toast-error {
  border-left-color: var(--danger);
}

.toast-error .toast-icon {
  color: var(--danger);
}

.toast-info .toast-icon {
  color: var(--brand);
}

.toast span {
  flex: 1;
}

.toast-close {
  padding: 0.25rem;
  border: 0;
  background: none;
  color: var(--ink-muted);
  cursor: pointer;
}

/* --- Sign-in ------------------------------------------------------------------------- */

.auth-page {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1.25rem;
  min-height: 100vh;
  padding: 1.5rem;
}

.auth-card {
  width: min(400px, 100%);
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1.5rem;
  font-size: 1.25rem;
  font-weight: 750;
}

.auth-title {
  font-size: 1.35rem;
}

.auth-foot {
  display: flex;
  gap: 0.6rem;
}

/* --- The studio ---------------------------------------------------------------------

   `data-state` on `.studio` is idle, starting, live or reconnecting. What
   belongs to each is marked with a class and shown by the rules below, so the
   script moves between states by changing one attribute. */

.studio:not([data-state="idle"]) .when-idle,
.studio[data-state="idle"] .when-active,
.studio:not([data-state="live"]) .when-live,
.studio:not([data-state="starting"]) .when-starting,
.studio:not([data-state="reconnecting"]) .when-reconnecting {
  display: none !important;
}

.studio-status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 1.6em;
}

.studio-status [data-clock] {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  align-items: start;
  gap: 1.25rem;
}

.studio-side {
  display: grid;
  gap: 1rem;
}

.studio-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.studio-message {
  flex: 1;
  min-width: 14rem;
  margin: 0;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--brand-tint);
  font-size: 0.9rem;
  font-weight: 550;
}

.studio-message[data-tone="warn"] {
  background: var(--warn-tint);
  color: var(--warn);
}

.studio-message[data-tone="error"] {
  background: var(--danger-tint);
  color: var(--danger);
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 0;
}

.stats div {
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--brand-tint);
}

.stats dt {
  color: var(--ink-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stats dd {
  margin: 0.15rem 0 0;
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.tips ul {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding-left: 1.1rem;
  color: var(--ink-muted);
  font-size: 0.88rem;
}

/* --- The player ----------------------------------------------------------------------

   Black in both themes: it is a screen, not a surface. The overlay, the
   unmute prompt and the control bar sit on top of the video, and the classes
   on `.player` - is-playing, is-muted, has-state, is-idle, is-live-edge,
   is-fullscreen - decide which of them shows. */

.player {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  width: 100%;
  background: #000;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  color: #fff;
  outline: none;
}

.player video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.player-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: radial-gradient(ellipse at center, #1b2433 0%, #07090d 75%);
  text-align: center;
}

[data-player] .player-state {
  display: none;
}

[data-player].has-state .player-state {
  display: grid;
}

.player-state-inner {
  display: grid;
  justify-items: center;
  gap: 0.9rem;
  max-width: 30rem;
}

.player-state-inner p {
  margin: 0;
  color: #d5dde8;
  font-size: 1.05rem;
}

.player-state-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.08);
  color: var(--logo-blue-pale);
  font-size: 2rem;
  animation: breathe 2.4s ease-in-out infinite;
}

@keyframes breathe {
  50% {
    transform: scale(1.06);
    background: rgb(255 255 255 / 0.13);
  }
}

.player.is-waiting::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  border: 3px solid rgb(255 255 255 / 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  pointer-events: none;
}

.player.has-state.is-waiting::after {
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.player-unmute {
  position: absolute;
  top: 1rem;
  left: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.6em 1em;
  border: 0;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.92);
  color: #0b1522;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.35);
}

.player-bar {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 2.5rem 0.75rem 0.6rem;
  background: linear-gradient(to top, rgb(0 0 0 / 0.75), transparent);
  transition: opacity 0.25s;
}

[data-player].has-state .player-bar {
  display: none;
}

.player.is-idle {
  cursor: none;
}

.player.is-idle .player-bar {
  opacity: 0;
}

.player-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: #fff;
  font-size: 1.25rem;
  cursor: pointer;
}

.player-btn:hover {
  background: rgb(255 255 255 / 0.14);
}

.player-volume {
  width: 90px;
  accent-color: #fff;
}

.player-live {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  margin-left: 0.5rem;
  padding: 0.3em 0.7em;
  border: 0;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.12);
  color: #fff;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.player-live .dot {
  background: #9aa4b1;
}

.player.is-live-edge .player-live {
  background: var(--live);
  cursor: default;
}

.player.is-live-edge .player-live .dot {
  background: #fff;
  animation: pulse 1.6s ease-in-out infinite;
}

.player-delay {
  color: #d5dde8;
  font-family: var(--mono);
  font-size: 0.8rem;
}

.player-spacer {
  flex: 1;
}

/* Which of a button's two glyphs shows. */
.player .when-playing,
.player.is-playing .when-paused,
.player .when-muted,
.player.is-muted .when-unmuted,
.player .when-fullscreen,
.player.is-fullscreen .when-windowed {
  display: none;
}

.player.is-playing .when-playing,
.player.is-muted .when-muted,
.player.is-fullscreen .when-fullscreen {
  display: block;
}

.player:fullscreen {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border-radius: 0;
}

/* The studio's preview is the same screen with nothing on top of it. */
.preview {
  box-shadow: var(--shadow-md);
}

/* --- The watch page ------------------------------------------------------------------ */

.watch {
  display: flex;
  flex-direction: column;
}

.watch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(1400px, 100%);
  margin: 0 auto;
  padding: 1rem clamp(1rem, 3vw, 2rem);
}

.watch-title {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.watch-title h1 {
  margin: 0;
  overflow: hidden;
  font-size: 1.25rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watch-head-end {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* On a phone the title gets its own line, and the viewers, language and
   theme sit under it rather than squeezing the name to nothing. */
@media (max-width: 560px) {
  .watch-head {
    flex-wrap: wrap;
    gap: 0.6rem;
  }

  .watch-head-end {
    width: 100%;
    justify-content: space-between;
  }
}

.watch-viewers {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  color: var(--ink-muted);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.watch-main {
  flex: 1;
  width: min(1400px, 100%);
  margin: 0 auto;
  padding: 0 clamp(0rem, 3vw, 2rem);
}

.watch-foot {
  padding: 1.25rem;
  text-align: center;
}

/* --- Narrow screens ------------------------------------------------------------------ */

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

  .stream-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .hide-narrow,
  .topnav-link span,
  .topbar .segmented:first-of-type {
    display: none;
  }

  .topbar {
    gap: 0.75rem;
  }

  .watch-main {
    padding: 0;
  }

  .watch-main .player {
    border-radius: 0;
  }

  .player-volume {
    display: none;
  }
}

/* --- Watch links in the studio --------------------------------------------- */

.share-link {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
}

.share-link-label {
  display: flex;
  align-items: center;
  gap: 0.45em;
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
}

.share-link-label .icon {
  color: var(--brand);
}

/* `?stats` on a watch link: the player's own numbers, over the picture. */
.player-stats {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  margin: 0;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  background: rgb(0 0 0 / 0.65);
  color: #e8edf3;
  font: 12px/1.45 var(--mono);
  white-space: pre;
  pointer-events: none;
}

/* Sound sync (Firefox): a small panel over the picture, above the bar. */
.player-sync {
  position: absolute;
  right: 0.75rem;
  bottom: 4rem;
  display: grid;
  gap: 0.5rem;
  max-width: min(22rem, calc(100% - 1.5rem));
  padding: 0.8rem 0.9rem;
  border-radius: var(--radius-sm);
  background: rgb(0 0 0 / 0.82);
  color: #fff;
}

.player-sync p {
  margin: 0;
}

.player-sync-title {
  font-weight: 700;
}

.player-sync-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.player-sync-row button {
  padding: 0.4em 0.8em;
  border: 1px solid rgb(255 255 255 / 0.35);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.1);
  color: #fff;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.player-sync-row span {
  font-family: var(--mono);
  font-size: 0.85rem;
  text-align: center;
}

.player-sync-help {
  color: #c9d2de;
  font-size: 0.8rem;
}
