:root {
  color-scheme: dark;
  --background: #17191b;
  --surface: #202326;
  --player-background: #111315;
  --text: #f2f0ec;
  --muted: #b5b6b7;
  --border: #393d41;
  --accent: #f4a261;
  --accent-hover: #ffb578;
  --ink: #21170f;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  line-height: 1.5;
  scrollbar-color: var(--border) var(--background);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--background); color: var(--text); }
::selection { background: var(--accent); color: var(--ink); }
a { color: inherit; text-underline-offset: 4px; }
button, select, input { font: inherit; accent-color: var(--accent); }
button, select { cursor: pointer; }
button { color: inherit; }
button:disabled, select:disabled, input:disabled { cursor: default; opacity: .4; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
.icon { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-definitions { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.app { width: min(100% - 64px, 1000px); margin-inline: auto; }

.site-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 30px 0 28px; border-bottom: 1px solid var(--border); }
.wordmark { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.wordmark h1 { font-size: 21px; letter-spacing: -.025em; font-weight: 700; margin: 0; white-space: nowrap; }
.brand-icon { color: var(--accent); width: 26px; height: 26px; }
.brand-period { color: var(--accent); }
.site-header p { margin: 0; font-size: 13px; color: var(--muted); }

.selection { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 28px 0 20px; }
.genre-field { display: grid; gap: 8px; width: min(420px, 100%); min-width: 0; }
.genre-field label { color: var(--muted); font-size: 13px; }
select { width: 100%; min-height: 48px; padding: 10px 40px 10px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); text-overflow: ellipsis; }
select:hover:enabled { border-color: var(--muted); }
.selection-count { padding-bottom: 13px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.notice { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 20px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); font-size: 14px; }
.notice p { margin: 0; overflow-wrap: anywhere; }
.notice[data-kind="error"] { border-color: var(--accent); }
.retry-button { flex: none; min-height: 44px; border: 1px solid var(--border); border-radius: 6px; padding: 8px 14px; background: transparent; }
.retry-button:hover { background: var(--border); }

.player-shell { background: var(--player-background); overflow: hidden; border-radius: 10px; }
.player-shell > iframe { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; min-height: 200px; border: 0; }
div#youtube-player:empty { display: none; }
.player-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; aspect-ratio: 16 / 9; min-height: 200px; padding: 24px; text-align: center; color: var(--muted); }
.placeholder-icon { width: 38px; height: 38px; color: var(--accent); }
.player-placeholder p { margin: 0; font-size: 14px; max-width: 45ch; }
.playback-status { display: flex; align-items: center; gap: 8px; padding: 14px 0 8px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.status-indicator { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); flex: none; }
.app[data-phase="playing"] .status-indicator { background: var(--accent); }
.app[data-phase="buffering"] .status-indicator, .app[data-phase="loading"] .status-indicator { animation: waiting 1.3s ease-out infinite; }
.queue-position { margin-left: auto; }

.set-info { padding: 8px 0 24px; }
.set-heading { display: flex; align-items: start; justify-content: space-between; gap: 24px; }
.set-heading h2 { font-size: clamp(24px, 3.2vw, 34px); font-weight: 650; line-height: 1.2; letter-spacing: -.025em; text-wrap: balance; overflow-wrap: anywhere; margin: 0; }
.youtube-link { display: inline-flex; align-items: center; gap: 7px; padding-block: 5px; min-height: 32px; flex: none; color: var(--muted); font-size: 12px; text-decoration: none; }
.youtube-link .icon { width: 15px; height: 15px; }
.youtube-link:hover { color: var(--accent); text-decoration: underline; }
.video-title { font-size: 15px; line-height: 1.55; color: var(--muted); margin: 10px 0 14px; overflow-wrap: anywhere; }
.set-details { display: flex; align-items: baseline; justify-content: space-between; gap: 12px 24px; }
.genre-tags { list-style: none; padding: 0; margin: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 10px; min-width: 0; }
.genre-tags li { padding: 4px 0; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.genre-tags li:first-child { padding-inline: 9px; border-radius: 4px; background: var(--surface); color: var(--accent); }
.location { color: var(--muted); font-size: 12px; margin: 0; text-align: right; overflow-wrap: anywhere; }

.controls { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 20px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.transport { display: flex; align-items: center; gap: 14px; }
.step-button, .play-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; border: 0; border-radius: 8px; padding: 10px 14px; font-size: 13px; transition: background-color 160ms ease-out, color 160ms ease-out; }
.step-button { background: transparent; color: var(--muted); }
.step-button:hover:enabled { background: var(--surface); color: var(--text); }
.play-button { min-width: 136px; background: var(--accent); color: var(--ink); font-weight: 650; }
.play-button:hover:enabled { background: var(--accent-hover); }
.play-button .icon { width: 20px; height: 20px; }
.volume-control { display: flex; align-items: center; gap: 12px; min-width: 0; }
.volume-control label { color: var(--muted); display: flex; align-items: center; }
input[type="range"] { width: 130px; min-width: 60px; height: 44px; margin: 0; cursor: pointer; }
input[type="range"]:disabled { cursor: default; }
.volume-control output { width: 42px; flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.system-volume { font-size: 12px; color: var(--muted); max-width: 26ch; margin: 0; }
.site-footer { display: flex; align-items: start; justify-content: space-between; gap: 20px; padding: 22px 0 32px; color: var(--muted); font-size: 11px; }
.site-footer p { margin: 0; }
.site-footer p:last-child { text-align: right; }

@keyframes waiting { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (min-width: 761px) {
  .player-shell > iframe, .player-placeholder { max-height: max(200px, calc(100svh - 470px)); }
}
@media (max-width: 760px) {
  .app { width: calc(100% - 40px); }
  .site-header p { max-width: 20ch; text-align: right; }
  .controls { flex-wrap: wrap; justify-content: center; gap: 12px; }
  .transport { justify-content: center; width: 100%; }
  .volume-control { justify-content: center; }
  input[type="range"] { width: 160px; }
  .set-details { flex-wrap: wrap; }
  .location { text-align: left; }
}
@media (max-width: 480px) {
  .app { width: calc(100% - 32px); }
  .site-header { padding: 22px 0 20px; }
  .site-header p { display: none; }
  .selection { flex-wrap: wrap; gap: 9px; padding: 22px 0 16px; }
  .genre-field { width: 100%; }
  .selection-count { padding: 0; font-size: 12px; }
  .set-heading { flex-wrap: wrap; gap: 5px; }
  .set-heading h2 { width: 100%; }
  .youtube-link { order: 1; }
  .set-info { padding-bottom: 20px; }
  .transport { gap: 4px; }
  .step-button { flex-direction: column; gap: 4px; padding: 8px; min-width: 70px; font-size: 11px; }
  .play-button { min-width: 120px; margin-inline: 4px; }
  .notice { align-items: start; flex-direction: column; gap: 8px; }
  .site-footer { flex-direction: column; gap: 5px; }
  .site-footer p:last-child { text-align: left; }
}
