/* laoPlay: a one-column audio deck. Controls on top, the required 200px video tile docked at the bottom. */
:root {
  --bg: #0b0b0d;
  --panel: #151518;
  --line: #26262b;
  --fg: #ecebe6;
  --muted: #8d8c88;
  --accent: #e2a14e;
  --accent-ink: #1a1206;
  --dock: 200px;
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --font: "Avenir Next", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font); }
body {
  min-height: 100dvh;
  padding-left: var(--gutter-l);
  padding-right: var(--gutter-r);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: calc(var(--dock) + env(safe-area-inset-bottom, 0px) + 16px);
}
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* top bar */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 6px; max-width: 560px; margin: 0 auto; }
.bar h1 { margin: 0; font-size: 1.25rem; font-weight: 600; letter-spacing: 0.02em; }
.bar h1 span { color: var(--accent); }
.bar-actions { display: flex; align-items: center; gap: 10px; }

.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--muted); cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.track { position: relative; width: 38px; height: 22px; border-radius: 11px; background: var(--line); transition: background .15s; }
.track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--fg); transition: transform .15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); background: var(--accent-ink); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

.chip { min-height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--panel); font-size: 0.85rem; }
.chip[aria-pressed="true"], .chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

main { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; padding-top: 8px; }

/* input */
#form { display: flex; gap: 8px; }
#url { flex: 1; min-width: 0; height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); font-size: 16px; }
#url::placeholder { color: var(--muted); }
.primary { height: 48px; padding: 0 20px; border: 0; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
#msg { margin: -8px 0 0; min-height: 1.2em; font-size: 0.85rem; color: var(--muted); }
#msg.err { color: #f08a7a; }

/* now playing */
.now { display: flex; flex-direction: column; gap: 14px; }
.art { width: 100%; aspect-ratio: 16 / 9; max-height: 34dvh; border-radius: 14px; background: var(--panel) center / cover no-repeat; border: 1px solid var(--line); }
.now h2 { margin: 0; font-size: 1.15rem; line-height: 1.3; text-wrap: balance; overflow-wrap: anywhere; }
.now p { margin: -8px 0 0; color: var(--muted); font-size: 0.85rem; }

.seek { display: flex; align-items: center; gap: 10px; }
.time { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 3.4ch; }
.time:last-child { text-align: right; }
input[type="range"] { flex: 1; min-width: 0; height: 32px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--accent) var(--pct, 0%), var(--line) var(--pct, 0%)); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border-radius: 50%; background: var(--fg); border: 0; }
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--fg); border: 0; }
input[type="range"]:disabled { opacity: .4; }

.transport { display: flex; align-items: center; justify-content: center; gap: 22px; }
.round { position: relative; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); padding: 0; }
.round svg { width: 28px; height: 28px; fill: var(--fg); }
.round b { position: absolute; font-size: 0.6rem; font-weight: 700; top: 50%; left: 50%; transform: translate(-50%, -38%); }
.round.big { width: 88px; height: 88px; background: var(--accent); border-color: var(--accent); }
.round.big svg { width: 38px; height: 38px; fill: var(--accent-ink); }
.round:disabled { opacity: .35; cursor: default; }
.round:active:not(:disabled) { transform: scale(.96); }

.options { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.speeds { display: flex; flex-wrap: wrap; gap: 6px; }
.speeds .chip { padding: 0 11px; font-variant-numeric: tabular-nums; }

/* recents */
.recent-head { display: flex; align-items: baseline; justify-content: space-between; }
.recent h3 { margin: 0 0 8px; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.link { background: none; border: 0; color: var(--muted); font-size: 0.8rem; padding: 6px 0; text-decoration: underline; }
#recents { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
#recents li { display: flex; align-items: stretch; gap: 8px; }
.item { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); text-align: left; }
.item img { width: 64px; height: 36px; border-radius: 6px; object-fit: cover; background: var(--line); flex: none; }
.item span { min-width: 0; font-size: 0.9rem; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.item.active { border-color: var(--accent); }
.del { width: 44px; flex: none; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 1.1rem; }
.empty { margin: 0; color: var(--muted); font-size: 0.85rem; }

/* video tile: YouTube requires at least 200x200 visible, so it stays small and out of the way */
#dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: center;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: #000;
  height: calc(var(--dock) + env(safe-area-inset-bottom, 0px));
}
#dock iframe, #yt { width: 200px; height: 200px; border: 0; background: #000; }

/* dim mode: black over everything except the video tile */
#dim {
  position: fixed; left: 0; right: 0; top: 0; z-index: 10;
  bottom: calc(var(--dock) + env(safe-area-inset-bottom, 0px));
  background: #000;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px;
}
#dim p { margin: 0; font-size: 0.8rem; color: #2e2e31; }
#dimPlay { width: 84px; height: 84px; border-radius: 50%; border: 1px solid #1d1d20; background: transparent; position: relative; }
#dimPlay::before { content: ""; position: absolute; inset: 0; margin: auto; }
#dimPlay.is-paused::before { width: 0; height: 0; border-style: solid; border-width: 13px 0 13px 22px; border-color: transparent transparent transparent #34343a; left: 6px; }
#dimPlay.is-playing::before { width: 22px; height: 26px; border-left: 7px solid #34343a; border-right: 7px solid #34343a; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
