/* Deck: a terminal-style car player. Rules: every target is big (rows 88px, buttons 76px+),
   everything is always visible (no drawers, menus or overlays), and nothing blocks the screen. */
:root {
  --bg: #0e0e10;
  --raise: #18181b;
  --press: #2a2633;
  --line: #3f3f46;
  --rowline: #222226;
  --text: #ececec;
  --dim: #9a9aa2;
  --accent: #a78bfa;
  --accent-bg: #1c1730;
  --accent-line: #7c5cff;
  --green: #4ade80;
  --green-dim: #2c6b43;
  --red: #f87171;
  --amber: #fbbf24;
  --row: 88px;
  --btn: 76px;
  --rail: 128px;
  --font: "JetBrains Mono", "SF Mono", Menlo, "DejaVu Sans Mono", "Liberation Mono", Consolas, monospace;
  color-scheme: dark;
}

/* Day: the same terminal look, light, for bright sunlight. Picked by the Auto/Day/Night setting. */
html[data-theme="day"] {
  --bg: #f5f5f2;
  --raise: #e8e8e4;
  --press: #ddd6fb;
  --line: #b4b4bc;
  --rowline: #dededa;
  --text: #141417;
  --dim: #55555f;
  --accent: #6d28d9;
  --accent-bg: #ece5ff;
  --accent-line: #7c3aed;
  --green: #15803d;
  --green-dim: #9fcbae;
  --red: #dc2626;
  --amber: #b45309;
  color-scheme: light;
}
html[data-theme="day"] #q::-webkit-search-cancel-button { filter: none; }
html[data-theme="day"] #scrub { box-shadow: 0 -10px 40px #0003; }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 20px/1.3 var(--font);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
svg { width: 32px; height: 32px; fill: currentColor; display: block; flex: none; }
[hidden] { display: none !important; }
.box { border: 1px solid var(--line); border-radius: 6px; min-width: 0; min-height: 0; position: relative; }

/* ---------- frame: rail | right column ---------- */
#app {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: 10px;
  padding: 8px;
}
#right {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  container: right / inline-size;
}
body.on-now #browse { display: none; }
#browse, #now { grid-row: 1; }
#bar { grid-row: 2; }
#now { display: none; }
body.on-now #now { display: grid; overflow-y: auto; }  /* Scrolls rather than spilling over the bar. */

/* ---------- rail: always visible, one tap to any section ---------- */
#rail { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
#rail button {
  flex: 1 1 0;
  min-height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 15px;
  letter-spacing: .02em;
}
#rail svg { width: 36px; height: 36px; }
#rail button.on { border-color: var(--accent-line); color: var(--accent); background: var(--accent-bg); font-weight: 700; }
#rail button:active, .btn:active, .controls button:active, .pager button:active, .row:active {
  background: var(--press);
}

/* ---------- browse ---------- */
#browse { display: flex; flex-direction: column; overflow: hidden; }
#head {
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 8px; min-height: 96px; flex-wrap: wrap;
  border-bottom: 1px solid var(--rowline);
}
#head .htitle {
  flex: 1 1 12ch; min-width: 0; font-size: 24px; font-weight: 700; padding: 0 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#head .htitle .dim { font-weight: 400; color: var(--dim); }
.btn {
  min-height: var(--btn); min-width: var(--btn); padding: 0 22px; border: 1px solid var(--line); border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; white-space: nowrap; flex: none;
}
.btn svg { width: 28px; height: 28px; }
.btn.primary { border-color: var(--accent-line); color: var(--accent); font-weight: 700; }
.btn.icon-only { padding: 0; width: var(--btn); }
#head.two-rows .htitle { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; }
#head .hbreak { flex-basis: 100%; height: 0; }
.btn.icon-only svg { width: 34px; height: 34px; }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn.on { border-color: var(--accent-line); color: var(--accent); background: var(--accent-bg); font-weight: 700; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; border-bottom: 1px solid var(--rowline); }
.chips .btn { min-height: 64px; padding: 0 18px; flex: 1 0 auto; }
#searchbox { border-bottom: 1px solid var(--rowline); }
#searchbox .chips { border-bottom: 0; padding-top: 0; }
#q {
  display: block; width: calc(100% - 20px); margin: 10px; height: var(--btn); padding: 0 18px;
  background: var(--raise); border: 1px solid var(--accent-line); border-radius: 6px; outline: 0; font-size: 22px;
  -webkit-user-select: text; user-select: text;
}
#q::-webkit-search-cancel-button { filter: invert(1); height: 28px; width: 28px; }

/* A list with big page buttons beside it, so nobody has to aim a scroll. */
.scroller { flex: 1; display: flex; min-height: 0; }
.list { flex: 1; min-width: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.pager { width: 92px; flex: none; display: flex; flex-direction: column; gap: 8px; padding: 8px; }
.pager button { flex: 1; border: 1px solid var(--line); border-radius: 6px; display: grid; place-items: center; }
.pager button svg { width: 40px; height: 40px; }
.pager button:disabled { opacity: .25; }

.row {
  display: flex; align-items: center; gap: 18px; min-height: var(--row); padding: 10px 18px 10px 14px;
  border-bottom: 1px solid var(--rowline); border-left: 5px solid transparent; cursor: pointer;
  content-visibility: auto; contain-intrinsic-size: auto var(--row);
}
.row .thumb {
  width: 66px; height: 66px; flex: none; object-fit: cover; border-radius: 3px; background: var(--raise);
  image-rendering: pixelated;
}
.row .no { width: 66px; flex: none; text-align: center; color: var(--dim); font-size: 22px; }
.row .no svg { margin: 0 auto; width: 34px; height: 34px; color: var(--accent); }
.row .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.row .t, .row .s { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .t { font-size: 22px; }
.row .s { font-size: 17px; color: var(--dim); }
.row .end { flex: none; color: var(--dim); font-size: 19px; text-align: right; font-variant-numeric: tabular-nums; }
.row.on { border-left-color: var(--accent-line); background: var(--accent-bg); color: var(--accent); }
.row.on .t { font-weight: 700; }
.row.on .s, .row.on .end { color: var(--accent); opacity: .85; }
.row.done { opacity: .6; }
/* YouTube videos you already heard: green and dimmed when heard to the end, amber where you stopped. */
.row .mark { color: var(--green); font-weight: 700; margin-right: 12px; }
.row .mark.part { color: var(--amber); }
.row.seen:not(.on) .t { color: var(--dim); }
.row.seen:not(.on) .thumb { opacity: .45; }
.row.seen:not(.on) { border-left-color: var(--green-dim); }
.row.part:not(.on) { border-left-color: var(--amber); }
.empty { padding: 34px 28px; color: var(--dim); white-space: pre-line; line-height: 1.6; font-size: 20px; }

/* ---------- compact player bar ---------- */
/* Controls first: on the left, closest to the driver. */
#bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "controls meta cover";
  align-items: center;
  gap: 18px;
  padding: 10px 10px 10px 12px;
}
.cover { background: var(--raise); object-fit: cover; image-rendering: pixelated; border-radius: 4px; cursor: pointer; }
#bar-cover { grid-area: cover; width: 96px; height: 96px; }
#bar-meta { grid-area: meta; }
#bar-controls { grid-area: controls; }
.meta { min-width: 0; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.title { color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub.status { color: var(--green); }
#bar-title { font-size: 22px; }
#bar-sub { font-size: 17px; }
.prog { position: relative; overflow: hidden; white-space: pre; color: var(--green-dim); font-variant-numeric: tabular-nums; }
.prog .ascii { display: flex; align-items: center; width: 100%; min-width: 0; overflow: hidden; }
.prog .pre, .prog .suf, .prog .head { flex: none; }
.prog .track { flex: 1 1 0; min-width: 0; display: flex; overflow: hidden; position: relative; }
.prog .done { flex: none; overflow: hidden; color: var(--green); }
.prog .head { color: var(--green); }
.prog .rest { flex: 1 1 0; min-width: 0; overflow: hidden; }
.prog .label { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: var(--bg); color: var(--accent); }
.prog.busy .label { display: flex; }
#bar-prog { font-size: 15px; padding: 10px 0; margin: -8px 0 -10px; cursor: pointer; touch-action: none; }

/* Fine-seek panel above the player bar, only while a finger is on a seek bar. It never takes taps. */
#scrub {
  position: absolute; left: 0; right: 0; z-index: 30; pointer-events: none;
  background: var(--bg); border-color: var(--accent-line); padding: 14px 20px 12px;
  box-shadow: 0 -10px 40px #000d;
}
.scrub-top { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; }
#scrub-time { font-size: 40px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
#scrub-delta { font-size: 26px; color: var(--green); font-variant-numeric: tabular-nums; }
#scrub-zoom { font-size: 22px; height: 52px; display: flex; align-items: center; }
.scrub-scale { display: flex; justify-content: space-between; gap: 12px; color: var(--dim); font-size: 16px; }
.scrub-scale span:nth-child(2) { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.controls { display: flex; align-items: center; gap: 8px; }
.controls button {
  width: 88px; height: 88px; border: 1px solid var(--line); border-radius: 8px; display: grid; place-items: center; flex: none;
}
.controls svg { width: 38px; height: 38px; }
.controls .play { width: 112px; border-color: var(--accent-line); color: var(--accent); }
.controls .play svg { width: 46px; height: 46px; }
body:not(.long) .long-only { display: none !important; }
.controls .play.wake { background: var(--accent-bg); animation: wake 1.2s ease-in-out infinite; }
@keyframes wake { 50% { box-shadow: 0 0 0 6px #7c5cff55; } }
/* Waiting for sound (download, loading, reconnecting): the head of the progress bar slowly fades in and out.
   Nothing else moves, and the buttons keep their icons. */
body.loading .prog .head { animation: waiting 1.4s ease-in-out infinite; }
@keyframes waiting { 50% { opacity: .15; } }

/* The bar stays one row (buttons left, title right) as long as possible: first the small cover goes, then the
   buttons get narrower; only a really narrow window gets two rows. */
@container right (max-width: 900px) {
  #bar { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "controls meta"; }
  #bar-cover { display: none; }
}
@container right (max-width: 760px) {
  #bar-controls { gap: 6px; }
  #bar-controls button { width: 74px; }
  #bar-controls .play { width: 92px; }
}
@container right (max-width: 560px) {
  #bar { grid-template-columns: minmax(0, 1fr); grid-template-areas: "meta" "controls"; }
  #bar-controls { justify-content: flex-start; }
  #bar-controls button { flex: 1; width: auto; max-width: 140px; }
}

/* ---------- Now: the big player ---------- */
#now {
  /* Title, seek bar and buttons on the left, a small cover beside them; the queue below at full width. */
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "np cover" "queue queue";
  gap: 14px 28px;
  padding: 18px;
}
#media { grid-area: cover; position: relative; align-self: start; min-width: 0; width: min(240px, 26cqw); }
body.video #media { width: min(560px, 50cqw); }
#now-cover { display: block; width: 100%; aspect-ratio: 1; }
.np { grid-area: np; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
#now-title { font-size: clamp(24px, 3cqw, 34px); font-weight: 700; }
#now-sub { font-size: 20px; }
.seekrow { display: flex; align-items: center; gap: 14px; font-size: 18px; font-variant-numeric: tabular-nums; }
#seek { flex: 1; min-width: 0; height: 76px; display: flex; align-items: center; cursor: pointer; touch-action: none; font-size: 18px; }
#now-extras { padding: 4px 0 0; border: 0; }
#now-extras .btn { flex: 0 1 auto; }
.queue { grid-area: queue; min-height: 0; display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.qhead { display: flex; align-items: center; gap: 10px; min-height: 84px; padding: 4px 0; }
.qhead .legend-inline { flex: 1; font-weight: 700; font-size: 20px; }
.queue .pager { padding-right: 0; }

@container right (max-width: 820px) {
  /* Narrow: the cover gets smaller but always stays beside the title. */
  #now { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "np cover" "queue queue"; padding: 12px; gap: 12px 18px; }
  #media { width: min(150px, 24cqw); }
  body.video #now { grid-template-areas: "cover" "np" "queue"; grid-template-rows: auto auto minmax(0, 1fr); }
  body.video #media { display: block; width: auto; }
}

/* ---------- settings ---------- */
.settings { padding: 8px 24px 30px; line-height: 1.6; }
.settings h4 { margin: 26px 0 10px; font-size: 20px; }
.settings p { color: var(--dim); font-size: 17px; margin: 8px 0; }
.settings .chips { padding: 0; border: 0; }
.settings .chips .btn { flex: 0 1 220px; }
.settings .stat { color: var(--text); }
.settings .meter { color: var(--green); white-space: pre; }
.settings code { color: var(--green); word-break: break-all; font-size: 17px; -webkit-user-select: all; user-select: all; }

/* ---------- smaller windows ---------- */
@media (max-width: 760px) {
  :root { --rail: 96px; }
  #rail button { font-size: 13px; }
  #rail svg { width: 32px; height: 32px; }
  .pager { width: 80px; }
  .row .thumb, .row .no { width: 56px; height: 56px; }
}
@media (max-height: 620px) {
  :root { --row: 80px; --btn: 68px; }
  #head { min-height: 84px; padding: 6px 8px; }
  #bar-cover { width: 76px; height: 76px; }
  .controls button { height: 76px; }
  #seek { height: 64px; }
  #rail button { gap: 2px; }
}

/* ---------- login ---------- */
.login-page { display: grid; place-items: center; min-height: 100%; padding: 20px; overflow: auto; }
.login { width: min(460px, 100%); padding: 34px 28px 22px; display: flex; flex-direction: column; gap: 14px; }
.login .legend { position: absolute; top: -0.75em; left: 22px; background: var(--bg); padding: 0 8px; font-size: 16px; }
.login input {
  height: var(--btn); background: var(--raise); border: 1px solid var(--line); border-radius: 6px;
  padding: 0 16px; outline: 0; -webkit-user-select: text; user-select: text;
}
.login input:focus { border-color: var(--accent-line); }
.login .btn { border-color: var(--accent-line); color: var(--accent); font-weight: 700; width: 100%; }
.login .error { color: var(--red); margin: 0; min-height: 1.2em; }
.login .dim { color: var(--dim); }
.login .small { font-size: 15px; }

/* Short window (the browser card at half height): the player bar becomes one row so the list keeps room. */
@media (max-height: 620px) {
  #bar { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "controls meta"; gap: 14px; padding: 8px 14px 8px 8px; }
  #bar-cover, #bar-sub { display: none; }  /* Keep the seek bar, drop the artist line. */
  #bar.has-status #bar-sub { display: block; }  /* A message replaces the seek bar for a moment. */
  #bar.has-status #bar-prog { display: none; }
  #bar-title { font-size: 20px; }
  #bar-controls { justify-content: flex-start; gap: 6px; }
  #bar-controls button { flex: none; width: 76px; height: 76px; }
  #bar-controls .play { width: 96px; }
  #q { height: 64px; margin: 8px 10px; width: calc(100% - 20px); }
  .chips { padding: 8px 10px; }
  .chips .btn { min-height: 60px; }
}
@media (max-height: 620px) {
  /* The bar below already shows title and artist: give the queue the room. */
  #now { padding: 8px 12px; gap: 6px 20px; }
  #now-title, #now-sub { display: none; }
  .qhead { min-height: 68px; }
  .qhead .btn { min-height: 60px; }
}

/* Settings sits at the bottom of the rail, a little smaller than the main tabs. */
#rail button[data-tab="settings"] { flex: 0 0 auto; min-height: 64px; flex-direction: row; gap: 8px; }
#rail button[data-tab="settings"] svg { width: 28px; height: 28px; }
@media (max-width: 760px) {
  #rail button[data-tab="settings"] { flex-direction: column; gap: 2px; }
  #rail button[data-tab="settings"] span { font-size: 12px; }
}
@media (max-height: 620px) {
  #rail { gap: 6px; }
  #rail button { min-height: 56px; }
  #rail button[data-tab="settings"] { min-height: 52px; }
}

/* A row being held: it fills in, so you can see the long press is working. */
/* Swiping a queue row away. Vertical scrolling stays with the browser. */
#qlist .row { touch-action: pan-y; }
#qlist .row.snap { transition: transform .2s ease-out, opacity .2s ease-out; }
/* Added to the queue: the row flashes and a "+ queue" tag slides across it; the Now tab pulses. */
.row.queued, .btn.queued { position: relative; animation: queued 1.2s ease-out; }
.row.queued::after {
  content: "+ queue"; position: absolute; right: 18px; top: 50%; padding: 6px 14px; border-radius: 999px;
  background: var(--accent-line); color: #fff; font-size: 16px; font-weight: 700; pointer-events: none;
  animation: queued-tag 1.2s ease-out forwards;
}
@keyframes queued { 0% { background: var(--accent-bg); box-shadow: inset 0 0 0 2px var(--accent-line); } 100% { background: transparent; box-shadow: none; } }
@keyframes queued-tag {
  0% { opacity: 0; transform: translate(24px, -50%); }
  20%, 70% { opacity: 1; transform: translate(0, -50%); }
  100% { opacity: 0; transform: translate(-40px, -50%); }
}
#rail button.bump { animation: bump .6s ease-out; }
@keyframes bump { 35% { transform: scale(1.07); background: var(--accent-bg); border-color: var(--accent-line); } }
.row.pressing { background: var(--press); transition: background .55s ease-in; }

/* ---------- long-press menu ---------- */
#menu { position: fixed; inset: 0; z-index: 50; background: #000a; display: grid; place-items: center; padding: 16px; }
.menu-box { width: min(560px, 94vw); background: var(--bg); border-color: var(--accent-line); padding: 22px; }
.menu-title { font-size: 24px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.menu-sub { color: var(--dim); font-size: 18px; margin: 6px 0 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-actions { display: grid; gap: 10px; }
.menu-actions .btn { width: 100%; min-height: 84px; font-size: 22px; }
@media (max-height: 620px) {
  .menu-box { padding: 14px; }
  .menu-sub { margin-bottom: 10px; }
  .menu-actions { grid-template-columns: 1fr 1fr; gap: 8px; }
  .menu-actions .btn { min-height: 72px; font-size: 20px; }
}

/* ---------- YouTube channels ---------- */
.row .thumb.round { border-radius: 50%; }
.divider { padding: 18px 18px 8px 19px; font-size: 16px; font-weight: 700; color: var(--dim); letter-spacing: .04em; border-bottom: 1px solid var(--rowline); }

/* ---------- video (Now tab) ---------- */
#now-video { display: none; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 4px; }
body.video #now-video { display: block; }
body.video #now-cover { display: none; }
/* Wide: the video takes the bigger right column. Narrow: it sits on top, one column, never taller than ~40% of
   the window (inside a container query, so this can't override the narrow layout). */
@container right (min-width: 1100px) {
  body.video #now { grid-template-columns: minmax(0, 1fr) auto; }
}
@container right (max-width: 1099px) {
  body.video #now {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "cover" "np" "queue";
    grid-template-rows: auto auto minmax(0, 1fr);
  }
  body.video #media { display: block; width: auto; }
  body.video #now-video { width: min(100%, calc(32vh * 16 / 9)); margin: 0 auto; }
  /* The bar below already shows title and artist: the room goes to the buttons and the queue. */
  body.video #now-title, body.video #now-sub { display: none; }
}
#video-note {
  /* One small line in the corner of the picture while it loads; the thumbnail behind it stays as it is. */
  position: absolute; left: 10px; bottom: 10px; max-width: calc(100% - 20px); display: none; align-items: center;
  gap: 10px; padding: 6px 12px; pointer-events: none; white-space: nowrap; overflow: hidden;
  background: #000a; color: #fff; font-size: 16px; border-radius: 4px;
}
#video-note.on { display: flex; }
#video-note .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: currentColor; animation: waiting 1.4s ease-in-out infinite; }
body.cinema #video-note, #media:fullscreen #video-note { left: 16px; top: 16px; bottom: auto; }  /* The buttons are at the bottom. */

/* Full screen after Maximize: only the video, plus two big buttons. */
body.cinema #media { position: fixed; inset: 0; z-index: 60; background: #000; display: grid; place-items: center; }
body.cinema #now-video { width: 100vw; height: 100vh; aspect-ratio: auto; object-fit: contain; border-radius: 0; }
/* Bottom left, on the driver's side: Exit, the player controls (skip, seek for long items), Tesla full screen. */
#cinema-bar {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 61;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; pointer-events: none;
}
#cinema-bar > * { pointer-events: auto; }
#cinema-bar { transition: opacity .5s; }
#cinema-bar.faded { opacity: 0; }
#cinema-bar.faded > * { pointer-events: none; }
.cinema-seek {
  flex-basis: 100%; order: -1; min-width: 0; overflow: hidden;  /* Lets the long bar text be cut to fit. */ display: flex; align-items: center; gap: 14px; padding: 0 16px;
  background: #000b; border-radius: 8px; color: #fff; font-size: 18px; font-variant-numeric: tabular-nums;
}
#cin-seek { flex: 1; min-width: 0; height: 64px; display: flex; align-items: center; cursor: pointer; touch-action: none; font-size: 18px; color: #4ade8099; }
#cin-seek .done, #cin-seek .head { color: #4ade80; }
#cin-seek .label { background: #000; }
#cinema-bar .icon-btn {
  width: 88px; height: 88px; display: grid; place-items: center; border-radius: 8px;
  background: #000b; color: #fff; border: 1px solid #ffffff66; flex: none;
}
#cinema-bar .icon-btn svg { width: 40px; height: 40px; }
#cinema-bar .icon-btn:active { background: #ffffff33; }
body.cinema #scrub { position: fixed; left: 16px; right: 16px; z-index: 62; }
#now-video { cursor: pointer; }
#cinema-msg { flex-basis: 100%; order: -2; background: #000c; color: #fff; padding: 12px 16px; border-radius: 6px; font-size: 18px; }
#cinema-bar .btn, #cinema-bar .controls button { background: #000b; color: #fff; border-color: #ffffff66; }
#cinema-bar .btn { min-height: 88px; font-size: 20px; }
#cinema-bar .controls .play { color: #fff; border-color: #ffffffaa; }
/* In the browser's own full screen only #media is shown, so keep the video filling it. */
#media:fullscreen { background: #000; display: grid; place-items: center; }
#media:fullscreen #now-video { width: 100vw; height: 100vh; aspect-ratio: auto; object-fit: contain; }

/* ---------- minimal view (tap the cover in Now) ---------- */
/* Only the cover, the title and the artist; the player bar below keeps its buttons and the seek bar. Cheap on
   purpose: the background is one still gradient in the cover's colour (no blur, nothing moving), and the only
   animations are opacity fades when the track changes. */
#focus { display: none; }
body.focus #rail, body.focus #browse, body.focus #now { display: none; }
body.focus #app { grid-template-columns: minmax(0, 1fr); }
body.focus #focus {
  --th: 258; --ts: 28%;
  grid-row: 1; min-width: 0; min-height: 0; overflow: hidden; border-radius: 6px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: minmax(0, 1fr);
  align-items: center; gap: clamp(18px, 4cqw, 56px); padding: clamp(14px, 2.6cqw, 40px);
  background: linear-gradient(250deg, hsl(var(--th), var(--ts), 21%) 0%, var(--bg) 78%);
  touch-action: none;
}
html[data-theme="day"] body.focus #focus { background: linear-gradient(250deg, hsl(var(--th), var(--ts), 80%) 0%, var(--bg) 78%); }
#focus-cover {
  height: min(100%, 46cqw); aspect-ratio: 1; object-fit: cover; justify-self: end; cursor: pointer;
  border-radius: 10px; background: var(--raise); box-shadow: 0 10px 36px #0007; transition: opacity .35s;
}
#focus-cover.wide { height: min(100%, 26cqw); aspect-ratio: 16 / 9; }
#focus-cover.swap { opacity: 0; }
#focus-cover:active { opacity: .85; transition: none; }
.ftext { align-self: stretch; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.fmid { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; justify-content: center; padding-bottom: 4%; }
#focus-exit {
  flex: none; width: var(--btn); height: var(--btn); display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 8px; color: var(--dim);
}
#focus-exit:active { background: var(--press); }
#focus-title {
  font-size: clamp(30px, 5cqw, 60px); font-weight: 700; line-height: 1.12; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
#focus-sub {
  margin-top: 14px; font-size: clamp(20px, 2.5cqw, 30px); color: var(--dim); overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
#focus-sub.status { color: var(--green); }
#focus-next {
  margin-top: 18px; min-height: 1.3em; font-size: clamp(16px, 1.8cqw, 20px); color: var(--dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity .6s;
}
#focus-next.on { opacity: 1; }
/* The bar keeps the buttons and the seek bar; title and cover are already shown big above. */
body.focus #bar-title, body.focus #bar-sub, body.focus #bar-cover { display: none !important; }
body.focus #bar-prog { display: block !important; font-size: 18px; padding: 26px 0; margin: 0; }
body.focus #bar { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "controls meta"; }
@container right (max-width: 560px) {
  body.focus #bar { grid-template-columns: minmax(0, 1fr); grid-template-areas: "meta" "controls"; }
  body.focus #bar-prog { padding: 12px 0; }
}
@container right (max-width: 700px) {
  /* Narrow: the cover on top, the text below it. */
  body.focus #focus { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  #focus-cover { order: -1; justify-self: center; height: min(100%, 70cqw); }
  #focus-cover.wide { height: min(100%, 45cqw); }
  .ftext { flex-direction: row; align-items: center; gap: 16px; }
  .fmid { padding: 0; }
  #focus-next { margin-top: 8px; }
}
@media (max-height: 620px) {
  #focus-title { -webkit-line-clamp: 2; }
  #focus-next { margin-top: 10px; }
}
