:root {
  color-scheme: dark;
  --bg: #111315;
  --panel: #1b1f23;
  --panel-2: #242a2f;
  --text: #f2f4f5;
  --muted: #aeb8be;
  --line: #394249;
  --accent: #f25545;
  --accent-2: #2cc7a4;
  --warn: #f0b84b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.pair-modal-open {
  overflow: hidden;
}

button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 16px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button.secondary {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

code {
  color: #ffcbc5;
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

.app {
  width: min(1180px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 22px 0 36px;
}

h2,
p {
  margin-top: 0;
}

h2 {
  margin-bottom: 6px;
  font-size: 1.05rem;
}

p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.log-panel,
.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.route-view {
  animation: viewIn 0.22s ease-out both;
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.landing-view {
  min-height: min(620px, calc(100vh - 150px));
  display: grid;
  align-content: center;
  gap: 30px;
  padding: 36px 0;
}

.landing-copy {
  max-width: 780px;
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.landing-copy h2,
.flow-card h2 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 5vw, 4.6rem);
  line-height: 0.98;
}

.flow-card h2 {
  font-size: clamp(1.6rem, 4vw, 3rem);
}

.landing-copy p:not(.eyebrow),
.flow-card p:not(.eyebrow) {
  max-width: 680px;
  font-size: 1.05rem;
}

.controller-intro {
  margin-bottom: 20px;
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button-link {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 0 18px;
  font-weight: 800;
  text-decoration: none;
}

.button-link.primary {
  background: var(--accent);
  color: #fff;
}

.button-link.secondary {
  border: 1px solid var(--line);
  color: var(--text);
}

.pair-view,
.controller-view {
  display: grid;
  min-height: min(560px, calc(100vh - 150px));
  align-items: center;
}

.controller-view {
  justify-items: center;
}

.pair-view {
  justify-items: center;
}

.flow-card {
  max-width: 760px;
}

.pair-form {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

.pair-code-input {
  width: min(100%, 260px);
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 16px;
  background: #0a0c0e;
  color: var(--text);
  font: inherit;
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-align: center;
}

.flow-status {
  min-height: 22px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.controller-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.controller-status-row .flow-status {
  flex: 1;
  margin-top: 0;
}

.controller-unpair-button {
  min-height: 38px;
  padding: 0 14px;
}

.pair-player-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.player-pair-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 10030;
  width: min(420px, calc(100vw - 28px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 52px 18px 18px;
  background: #0a0c0e;
  box-shadow:
    0 22px 60px rgba(0, 0, 0, 0.55),
    0 0 0 100vmax rgba(6, 8, 10, 0.62);
  transform: translate(-50%, -50%);
}

.player-pair-center {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.player-pair-close {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 6px;
  line-height: 0;
}

.player-pair-close svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  fill: none;
}

.player-pair-code {
  font-size: clamp(2.4rem, 7vw, 5rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.12em;
  text-align: center;
}

.player-pair-qr {
  width: 180px;
  height: 180px;
  border-radius: 6px;
  background: #fff;
}

.unpair-controllers {
  position: absolute;
  top: 8px;
  left: 8px;
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.78rem;
}

.card {
  padding: 16px;
}

.card-head,
.log-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

/* ── Player transport controls ── */
.player-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-play,
.btn-stop,
.btn-settings {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 18px;
  font: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-play {
  background: var(--accent-2);
  color: #0a0c0e;
  border-color: var(--accent-2);
}

.btn-play:hover:not(:disabled) {
  background: #3dd4b0;
}

.btn-play.paused {
  background: var(--accent-2);
}

.btn-play.playing,
.btn-play.buffering {
  background: var(--warn);
  border-color: var(--warn);
  color: #0a0c0e;
}

.btn-play.playing:hover:not(:disabled),
.btn-play.buffering:hover:not(:disabled) {
  background: #f5c96e;
}

.btn-play.buffering:disabled {
  opacity: 1;
  background: var(--warn);
  border-color: var(--warn);
  color: #0a0c0e;
}

.btn-stop {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

.btn-stop:hover:not(:disabled),
.pair-phone-button:hover:not(:disabled) {
  background: var(--panel-2);
  border-color: var(--muted);
}

.pair-phone-button {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

.pair-phone-button:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-settings {
  width: 44px;
  padding: 0;
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

.btn-settings:hover:not(:disabled) {
  background: var(--panel-2);
  border-color: var(--muted);
}

.resolution-picker-wrap {
  position: relative;
  margin-left: auto;
}

.resolution-picker {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  min-width: 94px;
  padding: 0 12px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.resolution-picker:hover:not(:disabled),
.resolution-picker.is-open {
  background-color: var(--panel-2);
  border-color: var(--muted);
}

.resolution-picker:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 2px rgba(44, 199, 164, 0.16);
}

.resolution-picker:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.resolution-picker-caret {
  color: var(--muted);
  font-size: 0.78rem;
}

.resolution-picker-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  gap: 6px;
  min-width: 100%;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.35);
  z-index: 10020;
  overflow-y: auto;
}

.resolution-picker-menu.open-up {
  top: auto;
  bottom: calc(100% + 8px);
}

.resolution-picker-menu.hidden {
  display: none;
}

.resolution-picker-option {
  min-height: 38px;
  padding: 0 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  text-align: left;
}

.resolution-picker-option:hover,
.resolution-picker-option.is-active {
  background: var(--panel-2);
  border-color: var(--muted);
}

/* ── FPS picker ── */
.fps-picker-wrap {
  position: relative;
}

.fps-picker {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  min-width: 78px;
  padding: 0 12px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.fps-picker:hover:not(:disabled),
.fps-picker.is-open {
  background-color: var(--panel-2);
  border-color: var(--muted);
}

.fps-picker:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 2px rgba(44, 199, 164, 0.16);
}

.fps-picker:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.fps-picker-caret {
  color: var(--muted);
  font-size: 0.78rem;
}

.fps-picker-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  gap: 6px;
  min-width: 100%;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.35);
  z-index: 10020;
  overflow-y: auto;
  max-height: 340px;
}

.fps-picker-menu.open-up {
  top: auto;
  bottom: calc(100% + 8px);
}

.fps-picker-menu.hidden {
  display: none;
}

.fps-picker-option {
  min-height: 34px;
  padding: 0 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  font-size: 0.78rem;
  text-align: left;
  white-space: nowrap;
}

.fps-picker-option:hover,
.fps-picker-option.is-active {
  background: var(--panel-2);
  border-color: var(--muted);
}

.resolution-picker-option.is-active {
  color: var(--accent-2);
}

.btn-play:disabled:not(.buffering),
.btn-stop:disabled,
.btn-settings:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.btn-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.btn-label {
  line-height: 1;
}

.video,
.youtube {
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #08090a;
}

.video-stage {
  position: relative;
  margin-bottom: 14px;
}

.video-stage.is-loading,
.video-stage.is-buffering {
  min-height: 220px;
}

.video-stage.is-loading:not(.canvas-visible),
.video-stage.is-buffering:not(.canvas-visible) {
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #08090a;
}

.video-stage.is-loading::before,
.video-stage.is-buffering::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(44, 199, 164, 0.22) 0%, rgba(44, 199, 164, 0.08) 42%, rgba(44, 199, 164, 0) 72%);
  transform: translate(-50%, -50%) scale(0.92);
  animation: stageSpinnerGlow 1.35s ease-in-out infinite;
  pointer-events: none;
}

.video-stage.is-loading::after,
.video-stage.is-buffering::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 6;
  width: 46px;
  height: 46px;
  border: 4px solid rgba(44, 199, 164, 0.12);
  border-top-color: rgba(44, 199, 164, 0.98);
  border-right-color: rgba(44, 199, 164, 0.72);
  border-radius: 50%;
  box-shadow:
    0 0 0 1px rgba(44, 199, 164, 0.08),
    0 0 20px rgba(44, 199, 164, 0.18);
  transform: translate(-50%, -50%);
  animation: stageSpinner 0.9s linear infinite;
  pointer-events: none;
}

.playback-buffer-bar {
  display: none;
  position: absolute;
  left: 1px;
  right: 1px;
  bottom: -4px;
  height: 14px;
  overflow: visible;
  border-radius: 999px;
  pointer-events: auto;
  touch-action: none;
  cursor: pointer;
}

.playback-buffer-bar::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  transform: translateY(-50%);
}

.video-stage.canvas-visible .playback-buffer-bar {
  display: block;
}

.buffer-progress,
.play-progress {
  position: absolute;
  left: 0;
  top: 50%;
  height: 4px;
  width: 0%;
  border-radius: 999px;
  transform: translateY(-50%);
  transition: width 0.16s linear;
}

.buffer-progress {
  background: rgba(190, 198, 204, 0.45);
}

.play-progress {
  background: #f25545;
}

.play-progress-thumb {
  position: absolute;
  left: 0%;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(8, 9, 10, 0.35);
  transform: translate(-50%, -50%);
  transition: left 0.16s linear;
  pointer-events: none;
}

.video-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #08090a;
}

/* Fullscreen: canvas fills the entire screen */
.video-canvas:fullscreen {
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
  border: none;
  border-radius: 0;
  object-fit: contain;
  background: #000;
}

/* Fullscreen active — applies to both native Fullscreen API and CSS fallback */
body.fullscreen-active {
  overflow: hidden;
}

body.fullscreen-active #playerView {
  animation: none;
  transform: none !important;
}

body.fullscreen-active .video-stage {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 9999;
  margin: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.fullscreen-active .video-canvas {
  width: 100%;
  height: auto;
  max-height: 100vh;
  border: none;
  border-radius: 0;
}

body.fullscreen-active .player-controls {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  background: rgba(0, 0, 0, 0.75);
  border-radius: 12px;
  padding: 6px 12px;
  gap: 6px;
  opacity: 1;
  transition: opacity 0.4s ease;
}

body.fullscreen-active .player-controls.idle {
  opacity: 0;
  pointer-events: none;
}

body.fullscreen-active .btn-play,
body.fullscreen-active .btn-stop,
body.fullscreen-active .btn-settings,
body.fullscreen-active #pairTeslaButton,
body.fullscreen-active .resolution-picker,
body.fullscreen-active .fps-picker {
  min-height: 36px;
  height: 36px;
  padding: 0 12px;
  font-size: 0.78rem;
  border-radius: 6px;
  gap: 4px;
}

body.fullscreen-active .btn-icon {
  font-size: 0.95rem;
}

body.fullscreen-active .btn-stop,
body.fullscreen-active .btn-settings,
body.fullscreen-active #pairTeslaButton,
body.fullscreen-active .resolution-picker,
body.fullscreen-active .fps-picker {
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}

body.fullscreen-active .resolution-picker-menu {
  background: rgba(12, 14, 16, 0.96);
  border-color: rgba(255, 255, 255, 0.18);
}

body.fullscreen-active .video-stage.canvas-visible .playback-buffer-bar {
  position: fixed;
  left: 18px;
  right: 18px;
  bottom: 64px;
  z-index: 10001;
  display: block;
}

/* Hide card chrome, log, meter, download row in fullscreen */
body.fullscreen-active .meter-panel,
body.fullscreen-active .log-panel,
body.fullscreen-active .card-head,
body.fullscreen-active .pair-player-row,
body.fullscreen-active .sync-input-row {
  display: none;
}

.youtube iframe {
  display: block;
  width: 100%;
  height: 100%;
}

.log-panel {
  margin-top: 16px;
  padding: 16px;
}

.log-panel.hidden {
  display: none;
}

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 11000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.62);
}

.settings-modal.hidden {
  display: none;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 11000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.62);
}

.confirm-modal.hidden {
  display: none;
}

.settings-dialog {
  width: min(360px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  padding: 16px;
}

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.settings-head h2 {
  margin: 0;
}

.settings-close {
  min-width: 40px;
  min-height: 40px;
  padding: 0 12px;
}

.confirm-dialog {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  padding: 16px;
}

.confirm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.confirm-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.confirm-copy {
  margin: 0 0 18px;
  color: var(--muted);
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.settings-field {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 700;
}

.settings-description {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.35;
}

.settings-select {
  margin-top: 4px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #0a0c0e;
  color: var(--text);
  font: inherit;
  font-weight: 700;
}

  align-items: center;
}

.log-head h2 {
  margin: 0;
}

/* ── YouTube Download + Sync Card ── */
.card--full {
  grid-column: 1 / -1;
}

.sync-input-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.url-input {
  flex: 1;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  background: #0a0c0e;
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
}

.url-input::placeholder {
  color: var(--muted);
}

.sync-progress {
  --sync-progress-pct: 0%;
  position: relative;
  width: 100%;
  flex: 1;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  height: 44px;
  margin: 0;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(27, 31, 35, 0.9);
  color: var(--muted);
  font-size: 0.88rem;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.sync-progress::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--sync-progress-pct);
  background: rgba(44, 199, 164, 0.38);
  transition: width 0.28s ease;
  pointer-events: none;
}

.sync-progress > * {
  position: relative;
  z-index: 1;
}

.sync-progress.hidden {
  display: none;
}

.video-stage > .sync-progress {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  width: auto;
  z-index: 7;
}

.buffering-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 7;
  padding: 11px 18px;
  border: 1px solid rgba(240, 184, 75, 0.55);
  border-radius: 6px;
  background: rgba(8, 9, 10, 0.72);
  color: #ffd37a;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: bufferingPulse 1.05s ease-in-out infinite;
}

.buffering-overlay.hidden {
  display: none;
}

.skip-feedback {
  position: absolute;
  top: 50%;
  z-index: 8;
  min-width: 86px;
  padding: 10px 14px;
  border-radius: 6px;
  background: rgba(8, 9, 10, 0.72);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 800;
  text-align: center;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.skip-feedback.left {
  left: 25%;
}

.skip-feedback.right {
  left: 75%;
}

.skip-feedback.center {
  left: 50%;
}

.skip-feedback.fade {
  animation: skipFade 1s ease-out forwards;
}

.skip-feedback.hidden {
  display: none;
}

@keyframes bufferingPulse {
  0%, 100% {
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
}

@keyframes skipFade {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -56%) scale(1.04);
  }
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid var(--line);
  border-top-color: var(--accent-2);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

@keyframes stageSpinner {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes stageSpinnerGlow {
  0%, 100% {
    opacity: 0.72;
    transform: translate(-50%, -50%) scale(0.92);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.08);
  }
}

#log {
  min-height: 220px;
  max-height: 360px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  color: #d8dee2;
  font-size: 0.9rem;
  line-height: 1.55;
}

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

  .landing-actions,
  .pair-form,
  .sync-input-row,
  .player-pair-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .button-link,
  .pair-form button,
  #sendToCar {
    width: 100%;
  }

  .pair-code-input {
    width: 100%;
  }

  .controller-status-row,
  .confirm-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .controller-unpair-button {
    width: 100%;
  }

  .player-pair-qr {
    width: 100%;
    max-width: 220px;
    height: auto;
    align-self: center;
  }

  .status {
    white-space: normal;
  }
}
