:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #10131a;
  color: #f4f6fb;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 15% 0%, rgb(70 91 157 / 18%), transparent 36rem),
    #10131a;
}

button,
textarea {
  font: inherit;
}

.page {
  width: min(100% - 2rem, 1100px);
  margin: 0 auto;
  padding: 2.5rem 0 1.5rem;
}

.header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: #9ba9d1;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.25rem);
  letter-spacing: -0.045em;
}

.intro {
  max-width: 38rem;
  margin: 0.6rem 0 0;
  color: #a9b0c1;
  line-height: 1.55;
}

.status {
  flex: 0 0 auto;
  padding: 0.55rem 0.8rem;
  border: 1px solid #343b4d;
  border-radius: 999px;
  color: #c2cada;
  font-size: 0.85rem;
}

.status[data-state="connected"] {
  border-color: #267e61;
  color: #79e0b4;
}

.status[data-state="error"] {
  border-color: #873f49;
  color: #ff9ca7;
}

.player-panel {
  position: relative;
  display: grid;
  min-height: min(58vw, 590px);
  place-items: center;
  overflow: hidden;
  border: 1px solid #303748;
  border-radius: 1rem;
  background: #07090d;
}

video {
  display: block;
  width: 100%;
  max-height: min(72vh, 720px);
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #07090d;
}

.player-hint {
  position: absolute;
  max-width: 24rem;
  padding: 1rem;
  color: #80899b;
  text-align: center;
  line-height: 1.5;
  pointer-events: none;
}

.controls {
  display: grid;
  gap: 0.75rem;
  max-width: 48rem;
  margin: 1.75rem auto 2rem;
}

.player-actions {
  display: flex;
  justify-content: center;
  gap: 0.65rem;
  margin: -0.5rem 0 2rem;
}

label {
  margin-top: 0.35rem;
  font-size: 0.95rem;
  font-weight: 650;
}

code {
  color: #b4c7ff;
}

textarea {
  width: 100%;
  min-height: 8rem;
  resize: vertical;
  padding: 0.85rem;
  border: 1px solid #343b4d;
  border-radius: 0.65rem;
  outline: none;
  background: #171b25;
  color: #e0e6f3;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.5;
}

textarea:focus {
  border-color: #8299e7;
  box-shadow: 0 0 0 3px rgb(130 153 231 / 15%);
}

textarea::placeholder {
  color: #727b8c;
}

.actions {
  display: flex;
  gap: 0.65rem;
}

button {
  min-height: 2.75rem;
  padding: 0.65rem 1rem;
  border: 0;
  border-radius: 0.6rem;
  cursor: pointer;
  font-weight: 700;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.primary {
  background: #91a8ff;
  color: #101525;
}

.primary:hover:not(:disabled) {
  background: #afbdff;
}

.secondary {
  border: 1px solid #3c4559;
  background: #1b202c;
  color: #d5dbea;
}

.secondary:hover:not(:disabled) {
  background: #272e3d;
}

.copy {
  justify-self: start;
}

.message {
  min-height: 1.5em;
  margin: 0;
  color: #aeb8cc;
  line-height: 1.5;
}

footer {
  padding-top: 1rem;
  border-top: 1px solid #292f3b;
  color: #7d8798;
  font-size: 0.85rem;
  text-align: center;
}

@media (max-width: 650px) {
  .page {
    width: min(100% - 1.25rem, 1100px);
    padding-top: 1.25rem;
  }

  .header {
    align-items: flex-start;
    flex-direction: column;
    gap: 1rem;
  }

  .player-panel {
    min-height: 55vw;
    border-radius: 0.7rem;
  }

  video {
    max-height: 55vh;
  }
}
