:root {
  color-scheme: dark;
  --bg: #080a0d;
  --panel: #0f1319;
  --panel-soft: #111720;
  --stage: #050607;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #e8edf4;
  --muted: #8996a8;
  --faint: #5d6979;
  --accent: #ffb454;
  --accent-strong: #ffc678;
  --mint: #55e0c0;
  --danger: #ff7676;
  --sans: "Inter", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace;
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: var(--sans);
  background:
    radial-gradient(1100px 700px at 82% -10%, rgba(85, 224, 192, 0.08), transparent 60%),
    radial-gradient(900px 600px at -10% 20%, rgba(255, 180, 84, 0.07), transparent 55%),
    linear-gradient(180deg, #090c11 0%, #080a0d 45%, #07090c 100%);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
  color: var(--accent-strong);
}

.app {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 30px 0 34px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 15px;
}

.brand-mark {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  padding: 9px 12px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.2em;
  line-height: 1;
}

.brand-mark span {
  color: var(--accent);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-copy strong {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.brand-copy small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.01em;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.source-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.025);
}

.source-switch a {
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: background 140ms ease, color 140ms ease;
}

.source-switch a:hover {
  color: var(--text);
}

.source-switch a.is-active {
  color: #0a0c0f;
  background: var(--accent);
}

.quiet-link {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 1px;
  transition: color 140ms ease, border-color 140ms ease;
}

.quiet-link:hover {
  color: var(--text);
  border-color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 372px;
  gap: 18px;
  align-items: start;
}

.player-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.42);
}

.stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background:
    radial-gradient(60% 90% at 50% 0%, rgba(255, 180, 84, 0.06), transparent 70%),
    var(--stage);
}

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

.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 68%, rgba(0, 0, 0, 0.2) 100%);
}

.stage-state {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  background: radial-gradient(60% 60% at 50% 45%, rgba(17, 22, 30, 0.94), rgba(5, 6, 7, 0.98));
  transition: opacity 220ms ease, visibility 220ms ease;
}

body[data-ready="true"]:not([data-state="error"]) .stage-state {
  visibility: hidden;
  opacity: 0;
}

.loader {
  width: 30px;
  height: 30px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

body[data-ready="true"] .loader {
  display: none;
}

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

.phase {
  max-width: 70%;
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  text-align: center;
  line-height: 1.6;
}

.big-play {
  position: absolute;
  z-index: 3;
  display: grid;
  width: 72px;
  height: 72px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 50%;
  background: rgba(9, 11, 14, 0.68);
  backdrop-filter: blur(10px);
  cursor: pointer;
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 160ms ease, transform 160ms ease, background 160ms ease;
  pointer-events: none;
}

body[data-ready="true"][data-playing="false"]:not([data-state="error"]) .big-play {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.big-play:hover {
  background: rgba(255, 180, 84, 0.2);
}

.big-play-triangle {
  width: 0;
  height: 0;
  margin-left: 5px;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  border-left: 19px solid var(--accent);
}

.stage-error {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 8% 12%;
  background: rgba(9, 11, 14, 0.97);
}

.stage-error[hidden] {
  display: none;
}

.error-kicker {
  color: var(--danger);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.stage-error p {
  max-width: 640px;
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
}

error-hint,
.error-hint {
  color: var(--muted);
  font-size: 12px !important;
}

.seek-preview {
  position: absolute;
  bottom: 14px;
  z-index: 4;
  width: 184px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #050607;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
  transform: translateX(-50%);
  pointer-events: none;
}

.seek-preview[hidden] {
  display: none;
}

.seek-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #000;
}

.seek-preview span {
  display: block;
  padding: 6px 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.02em;
}

.controls {
  padding: 12px 16px 14px;
  background: linear-gradient(180deg, #0f1319, #0c1015);
}

.timeline {
  position: relative;
  height: 24px;
  cursor: pointer;
  touch-action: none;
}

.timeline-track {
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  height: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.11);
  transform: translateY(-50%);
}

.timeline-buffer,
.timeline-progress {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--fill, 0%);
  border-radius: inherit;
}

.timeline-buffer {
  width: var(--buffered, 0%);
  background: rgba(255, 255, 255, 0.19);
}

.timeline-progress {
  width: var(--progress, 0%);
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
}

#seek {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 24px;
  margin: 0;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

#seek::-webkit-slider-runnable-track {
  height: 24px;
  background: transparent;
}

#seek::-webkit-slider-thumb {
  width: 13px;
  height: 13px;
  margin-top: 5.5px;
  border: 2px solid #0c1015;
  border-radius: 50%;
  background: var(--accent-strong);
  appearance: none;
  -webkit-appearance: none;
  box-shadow: 0 0 0 1px rgba(255, 180, 84, 0.5);
}

#seek::-moz-range-track {
  height: 24px;
  background: transparent;
}

#seek::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 2px solid #0c1015;
  border-radius: 50%;
  background: var(--accent-strong);
}

.control-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 32px;
}

.control-spacer {
  flex: 1;
}

.control-btn {
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
}

.control-btn:hover {
  color: var(--text);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.control-btn:focus-visible,
.seg-seek:focus-visible,
.big-play:focus-visible,
.source-switch a:focus-visible,
.quiet-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.control-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.icon-pause,
.mute-slash {
  display: none;
}

body[data-playing="true"] .icon-play {
  display: none;
}

body[data-playing="true"] .icon-pause {
  display: block;
}

body[data-muted="true"] .sound-wave {
  display: none;
}

body[data-muted="true"] .mute-slash {
  display: block;
}

.timecode {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

#currentTime {
  color: var(--text);
}

.time-sep {
  padding: 0 5px;
  color: var(--faint);
}

.volume-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.volume {
  width: 58px;
  height: 16px;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}

.volume::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.15);
}

.volume::-webkit-slider-thumb {
  width: 9px;
  height: 9px;
  margin-top: -3px;
  border: 0;
  border-radius: 50%;
  background: var(--muted);
  appearance: none;
  -webkit-appearance: none;
}

.volume:hover::-webkit-slider-thumb {
  background: var(--accent);
}

.volume::-moz-range-track {
  height: 3px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.15);
}

.volume::-moz-range-thumb {
  width: 9px;
  height: 9px;
  border: 0;
  border-radius: 50%;
  background: var(--muted);
}

.player-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.status-dot {
  width: 5px;
  height: 5px;
  margin-right: 2px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 3px rgba(137, 150, 168, 0.09);
}

body[data-ready="true"]:not([data-state="error"]) .status-dot {
  background: var(--mint);
  box-shadow: 0 0 0 3px rgba(85, 224, 192, 0.1);
}

body[data-state="error"] .status-dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(255, 118, 118, 0.1);
}

.foot-status {
  margin-right: 4px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.02em;
}

.chip {
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.03em;
  text-transform: lowercase;
}

.host-chip {
  margin-left: auto;
  color: var(--accent);
  border-color: rgba(255, 180, 84, 0.24);
  background: rgba(255, 180, 84, 0.05);
}

.side {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(17, 23, 32, 0.96), rgba(13, 17, 23, 0.96));
}

.intro {
  padding: 20px;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.intro h1 {
  margin: 0 0 12px;
  font-size: 21px;
  font-weight: 630;
  line-height: 1.3;
  letter-spacing: -0.025em;
}

.intro p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: 12.2px;
  line-height: 1.72;
}

.intro-points {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 15px;
}

.intro-points span {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.02em;
}

.segments-panel {
  padding: 18px 18px 20px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.panel-head .eyebrow {
  margin-bottom: 4px;
}

.panel-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.panel-note {
  margin: 10px 0 14px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.6;
}

.seg-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.seg-grid::-webkit-scrollbar {
  width: 6px;
}

.seg-grid::-webkit-scrollbar-thumb {
  border-radius: 99px;
  background: var(--line-strong);
}

.seg-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #0a0e13;
  transition: border-color 150ms ease, transform 150ms ease;
}

.seg-card:hover {
  border-color: rgba(255, 180, 84, 0.33);
  transform: translateY(-1px);
}

.seg-card.is-active {
  border-color: rgba(255, 180, 84, 0.58);
}

.seg-link {
  position: relative;
  display: block;
  background: #000;
}

.seg-link img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #050607;
  opacity: 0;
  transition: opacity 220ms ease, transform 220ms ease;
}

.seg-link img.is-loaded {
  opacity: 1;
}

.seg-card:hover .seg-link img {
  transform: scale(1.02);
}

.seg-open-label {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 3px 5px;
  border-radius: 3px;
  color: #e9eef5;
  background: rgba(5, 7, 10, 0.78);
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.05em;
  opacity: 0;
  transition: opacity 150ms ease;
}

.seg-link:hover .seg-open-label {
  opacity: 1;
}

.seg-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 7px;
}

.seg-meta span {
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seg-seek {
  padding: 3px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  font-family: var(--mono);
  font-size: 8px;
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}

.seg-seek:hover {
  color: var(--accent);
  border-color: rgba(255, 180, 84, 0.35);
  background: rgba(255, 180, 84, 0.05);
}

.tech-panel {
  padding: 0 18px;
}

.tech-panel details {
  padding: 15px 0 17px;
}

.tech-panel summary {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  cursor: pointer;
  user-select: none;
}

.tech-panel summary:hover {
  color: var(--text);
}

.tech-list {
  display: grid;
  gap: 0;
  margin: 14px 0 0;
}

.tech-list > div {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
}

.tech-list dt {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.tech-list dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.6;
}

.tech-list dd a {
  color: var(--accent);
  text-decoration: none;
}

.tech-list dd a:hover {
  text-decoration: underline;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-top: 22px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.03em;
}

/* Fullscreen keeps the custom controls available. */
.player-card:fullscreen {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  padding: 12px;
  border: 0;
  border-radius: 0;
  background: #05070a;
}

.player-card:fullscreen .stage {
  flex: 1;
  aspect-ratio: auto;
}

.player-card:fullscreen .controls {
  flex: 0 0 auto;
}

@media (max-width: 1020px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) 330px;
  }

  .app {
    width: min(1240px, calc(100% - 28px));
  }
}

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

  .side {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }

  .intro {
    grid-column: 1 / -1;
  }

  .tech-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .app {
    width: min(100% - 20px, 1240px);
    padding-top: 18px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 15px;
    padding-bottom: 18px;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
  }

  .brand-copy small {
    display: none;
  }

  .side {
    display: flex;
  }

  .seg-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 380px;
  }

  .intro h1 {
    font-size: 19px;
  }

  .player-card {
    border-radius: 14px;
  }

  .stage {
    aspect-ratio: 16 / 10;
  }

  .controls {
    padding: 10px 11px 12px;
  }

  .volume-group {
    display: none;
  }

  .timecode {
    font-size: 9.5px;
  }

  .foot-status {
    max-width: 55%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .host-chip {
    display: none;
  }

  .tech-list > div {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .footer {
    flex-direction: column;
    gap: 5px;
  }
}
