:root {
  --bg: #0a0c10;
  --panel: #12151c;
  --card: #1a1f29;
  --fg: #f3f5f9;
  --dim: #9aa3b2;
  --line: #262c38;
  --acc: #8ab4ff;
  --pad: 80px;
  --font: 'Noto Sans', var(--script-font, sans-serif), system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; overflow: hidden; }
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; text-align: start; cursor: pointer; }
:focus { outline: none; }

#stage {
  position: absolute; left: 50%; top: 50%;
  width: 1920px; height: 1080px;
  transform: translate(-50%, -50%) scale(var(--s, 1));
  background: var(--bg); color: var(--fg);
  font: 400 26px/1.35 var(--font);
  overflow: hidden;
}
.ms {
  font-family: 'Material Symbols Rounded'; font-weight: 400; font-style: normal;
  font-size: 1.35em; line-height: 1; letter-spacing: normal; text-transform: none;
  display: inline-block; white-space: nowrap; direction: ltr;
  font-feature-settings: 'liga'; -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 40;
  vertical-align: middle; flex: none;
}
.ms.fill { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 40; }
.spin { animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- screens ---------- */
.screen { position: absolute; inset: 0; }
.screen[data-rail] { --pad: 150px; }
.hidden-screen { visibility: hidden; }
.center { display: grid; place-items: center; height: 100%; color: var(--dim); gap: 24px; align-content: center; text-align: center; }
.center .ms { font-size: 72px; }

/* ---------- rail ---------- */
#rail {
  position: absolute; inset-block: 0; inset-inline-start: 0; width: 108px; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
}
/* Scrim: the background colour, opaque from the screen edge to 90px (under the icons and the sync counter), fading out
   at 144px (content starts at 150px). Wider than the rail itself, full height, and it fades with the rail. */
#rail::before {
  content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: 144px; z-index: -1; pointer-events: none;
  background: linear-gradient(to right, var(--bg) 90px, transparent);
}
[dir=rtl] #rail::before { background: linear-gradient(to left, var(--bg) 90px, transparent); }
#stage.norail #rail { display: none; }
.rb { width: 68px; height: 68px; border-radius: 50%; display: grid; place-items: center; color: var(--dim); transition: .12s; }
.rb .ms { font-size: 34px; }
.rb.active { color: var(--fg); background: rgba(255,255,255,.1); }
.rb:focus { background: #fff; color: #000; transform: scale(1.08); }
#sync { position: absolute; bottom: 34px; display: grid; justify-items: center; gap: 2px; color: var(--dim); font-size: 15px; transition: opacity .6s; }
#sync .ms { font-size: 26px; }
#sync.done { opacity: 0; }

/* ---------- hero screens ---------- */
.hero .bg { position: absolute; top: 0; inset-inline-end: 0; width: 1340px; height: 670px; }
.hero .bg img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .45s; }
.hero .bg img.on { opacity: 1; }
.hero .shade { position: absolute; inset: 0; background:
  linear-gradient(to right, var(--bg) 30%, rgba(10,12,16,.72) 50%, rgba(10,12,16,0) 80%),
  linear-gradient(to top, var(--bg) 38%, rgba(10,12,16,0) 66%); }
[dir=rtl] .hero .shade { background:
  linear-gradient(to left, var(--bg) 30%, rgba(10,12,16,.72) 50%, rgba(10,12,16,0) 80%),
  linear-gradient(to top, var(--bg) 38%, rgba(10,12,16,0) 66%); }
.hero .info { position: absolute; top: 96px; inset-inline-start: var(--pad); width: 860px; }
.info .eyebrow { color: var(--acc); font-size: 22px; font-weight: 600; min-height: 30px; }
.info h1 { font-size: 54px; line-height: 1.16; margin: 10px 0 18px; font-weight: 700;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.info .meta { display: flex; gap: 22px; align-items: center; color: var(--dim); font-size: 23px; }
.info .meta .tag { border: 2px solid var(--dim); border-radius: 6px; padding: 0 8px; font-size: 18px; font-weight: 700; }
.info p { color: var(--dim); margin: 0; font-size: 26px; max-width: 760px; }
.hero .rows { position: absolute; top: 470px; bottom: 0; inset-inline: 0; overflow: hidden; }
.rows::after { content: ''; display: block; height: 520px; }

.rowwrap h2 { margin: 0; padding-inline-start: var(--pad); font-size: 25px; font-weight: 600; display: flex; align-items: center; gap: 12px; height: 46px; }
.rowwrap h2 small { color: var(--dim); font-weight: 400; font-size: 19px; }
.rowwrap h2 .ms { font-size: 32px; color: var(--acc); }
.row { display: flex; gap: 24px; overflow: hidden; padding: 12px var(--pad) 22px; scroll-padding-inline: var(--pad); }

.card { width: 336px; flex: none; scroll-margin-block-start: 60px; }
.card .thumb { position: relative; aspect-ratio: 16/9; border-radius: 14px; background: var(--card); overflow: hidden; transition: transform .12s; display: block; }
.card.sq { width: 216px; }
.card.sq .thumb { aspect-ratio: 1; }
.card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .dur { position: absolute; inset-block-end: 8px; inset-inline-end: 8px; background: rgba(0,0,0,.78); border-radius: 6px; padding: 1px 8px; font-size: 17px; }
.card .bar { position: absolute; inset-inline: 0; bottom: 0; height: 6px; background: rgba(255,255,255,.25); }
.card .bar::after { content: ''; display: block; height: 100%; width: var(--p); background: var(--acc); }
.card .ttl { margin-top: 12px; font-size: 21px; line-height: 1.3; color: var(--dim);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card:focus .thumb { outline: 4px solid #fff; outline-offset: 4px; transform: scale(1.03); }
.card:focus .ttl { color: var(--fg); }
.card.action .thumb { display: grid; place-items: center; align-content: center; gap: 8px; color: var(--fg); font-size: 20px; text-align: center; padding: 10px; }
.card.action .ms { font-size: 56px; color: var(--acc); }
.card.sect .thumb { background: #20283a; }
.pill { display: inline-flex; align-items: center; gap: 12px; height: 62px; padding: 0 30px; border-radius: 31px; background: rgba(255,255,255,.1); font-weight: 600; flex: none; scroll-margin-block-start: 20px; }
.pill:focus { background: #fff; color: #000; }
.pill.on { background: var(--acc); color: #000; }

/* ---------- search ---------- */
.search, .settings { padding: 70px 80px 0 var(--pad); display: flex; flex-direction: column; }
.sbar { display: flex; gap: 16px; align-items: center; flex: none; }
.field { flex: 1; display: flex; align-items: center; gap: 16px; height: 72px; border-radius: 36px; background: var(--card); padding: 0 28px; border: 3px solid transparent; }
.field:focus-within { border-color: #fff; }
.field input { flex: 1; background: none; border: 0; outline: 0; font-size: 28px; min-width: 0; }
.field input::placeholder { color: var(--dim); }
.snote { color: var(--dim); font-size: 21px; height: 56px; display: flex; align-items: center; gap: 10px; flex: none; }
.grid { flex: 1; overflow: hidden; display: grid; grid-template-columns: repeat(5, 316px); gap: 30px 24px; align-content: start; padding: 10px 8px 300px; margin-inline: -8px; }
.grid .card { width: auto; scroll-margin-block: 20px 120px; }

/* ---------- settings ---------- */
.settings h1 { font-size: 48px; margin: 0 0 36px; }
.slist { display: grid; gap: 14px; width: 1100px; }
.setrow { display: flex; align-items: center; gap: 24px; height: 92px; padding: 0 30px; border-radius: 18px; background: var(--card); width: 100%; }
.setrow .ms { font-size: 38px; color: var(--acc); }
.setrow b { flex: 1; font-weight: 600; }
.setrow span.val { color: var(--dim); }
.setrow:focus { background: #fff; color: #000; }
.setrow:focus .ms, .setrow:focus .val { color: #000; }
.notice { margin-top: 40px; color: var(--dim); font-size: 21px; width: 1100px; display: flex; gap: 16px; }

/* ---------- overlays ---------- */
.overlay { background: rgba(0,0,0,.6); }
.sheet { position: absolute; inset-block: 0; inset-inline-end: 0; width: 780px; background: var(--panel); padding: 56px 44px 0; display: flex; flex-direction: column; gap: 20px; }
.sheet h2 { margin: 0; font-size: 34px; display: flex; gap: 14px; align-items: center; }
.sheet .field { flex: none; }
.llist { flex: 1; overflow: hidden; display: grid; gap: 8px; align-content: start; padding: 6px 6px 400px; margin-inline: -6px; }
.lrow { display: flex; align-items: center; gap: 16px; min-height: 76px; padding: 8px 24px; border-radius: 14px; width: 100%; scroll-margin-block: 90px 160px; }
.lrow b { font-weight: 600; font-size: 27px; }
.lrow small { color: var(--dim); font-size: 20px; display: block; }
.lrow div { flex: 1; min-width: 0; }
.lrow .ms { color: var(--acc); font-size: 30px; }
.lrow:focus { background: #fff; color: #000; }
.lrow:focus small, .lrow:focus .ms { color: #333; }
.lsep { color: var(--dim); font-size: 18px; padding: 10px 24px 0; display: flex; gap: 8px; align-items: center; }
.menu { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 600px; background: var(--panel); border-radius: 24px; padding: 34px; display: grid; gap: 10px; }
.menu h2 { margin: 0 0 12px; font-size: 30px; display: flex; gap: 14px; align-items: center; }
.menu p { margin: 0 0 12px; color: var(--dim); font-size: 22px; }

/* ---------- player ---------- */
.player { background: #000; }
.player video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; }
.player .art { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); width: 460px; height: 460px; border-radius: 24px; object-fit: cover; box-shadow: 0 30px 90px rgba(0,0,0,.7); }
.player .subs { position: absolute; inset-inline: 200px; bottom: 90px; display: grid; text-align: center; font-size: 42px; line-height: 58px; white-space: pre-line; transition: bottom .2s; pointer-events: none; }
/* Each line on its own rounded plate (black 62%, 18px corners, 20px sides). Plates are a little taller than the 58px line,
   so the lines of a multi-line cue touch; the overlap is invisible because the plate layer is faded as a whole. */
.player .subs > div { grid-area: 1 / 1; }
.player .subs span { padding: 0 20px 3px; border-radius: 18px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.player .subs .pl { opacity: .62; }
.player .subs .pl span { background: #000; color: transparent; }
.player .subs .tx { text-shadow: 0 2px 6px rgba(0,0,0,.6); }
.player.ui-on .subs { bottom: 300px; }
.pui { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 60px 90px 56px;
  background: linear-gradient(to top, rgba(0,0,0,.9), rgba(0,0,0,0) 42%), linear-gradient(to bottom, rgba(0,0,0,.75), rgba(0,0,0,0) 26%);
  opacity: 0; transition: opacity .25s; pointer-events: none; }
.player.ui-on .pui { opacity: 1; pointer-events: auto; }
.ptop { display: flex; justify-content: space-between; gap: 60px; align-items: flex-start; }
.ptop h1 { margin: 0; font-size: 40px; max-width: 1100px; }
.ptop .next { color: var(--dim); font-size: 21px; max-width: 480px; text-align: end; }
.ptop .next b { color: var(--fg); display: block; font-weight: 600; }
.seek { display: flex; align-items: center; gap: 22px; font-size: 22px; font-variant-numeric: tabular-nums; padding: 14px 0; width: 100%; }
.seek .track { flex: 1; height: 8px; border-radius: 4px; background: rgba(255,255,255,.28); position: relative; }
.seek .fillbar { position: absolute; inset-block: 0; inset-inline-start: 0; width: var(--p, 0%); background: var(--fg); border-radius: 4px; }
.seek:focus .track { height: 14px; border-radius: 7px; }
.seek:focus .fillbar { background: var(--acc); border-radius: 7px; }
[data-ltr] { direction: ltr; }
.pbtns { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-top: 12px; }
.grp { display: flex; gap: 18px; align-items: center; }
.grp.r { justify-content: flex-end; }
.pb { width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.1); transition: .12s; }
.pb .ms { font-size: 40px; }
.pb.wide { width: auto; padding: 0 26px; border-radius: 39px; display: flex; gap: 10px; font-weight: 600; font-size: 22px; }
.pb:focus { background: #fff; color: #000; transform: scale(1.08); }
.pb.on .ms { color: var(--acc); }
.pb:focus.on .ms { color: #000; }
.pb[hidden] { display: none; }
.pload { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 80px; color: #fff; opacity: .9; }
.pload[hidden] { display: none; }

#toast { position: absolute; left: 50%; bottom: 70px; transform: translateX(-50%); z-index: 20; background: #fff; color: #000; border-radius: 18px; padding: 18px 30px; max-width: 1100px; display: flex; gap: 16px; align-items: center; font-size: 23px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
#toast[hidden] { display: none; }
#toast b { display: block; }

/* ---------- background audio ---------- */
.rb[hidden], #np[hidden] { display: none; }
.rb.npb { position: relative; border: 3px solid var(--acc); color: #fff; overflow: hidden; }
.rb.npb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .55; }
.rb.npb .ms { position: relative; font-size: 30px; }
.rb.npb:focus { border-color: #fff; color: #000; }
.rb.npb:focus img { opacity: .25; }
#np { position: absolute; top: 36px; inset-inline-end: 60px; z-index: 6; display: flex; align-items: center; gap: 16px; padding: 8px; padding-inline-end: 22px;
  border-radius: 44px; background: rgba(18,21,28,.88); border: 1px solid var(--line); max-width: 560px; font-size: 21px; }
#stage.nonp #np { display: none; }
#np img { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; flex: none; }
#np div { min-width: 0; }
#np b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; max-width: 380px; }
#np .npbar { display: block; height: 4px; border-radius: 2px; background: rgba(255,255,255,.2); margin-top: 8px; position: relative; overflow: hidden; }
#np .npbar::after { content: ''; position: absolute; inset-block: 0; inset-inline-start: 0; width: var(--p, 0%); background: var(--acc); }
#np .ms { color: var(--acc); font-size: 30px; }
.player.audio { background: radial-gradient(circle at 50% 36%, #1c2638, #07090c 70%); }
.player.audio .art { top: 36%; width: 420px; height: 420px; }
.player.audio .pui { background: none; }
.player.audio h1 { text-align: center; font-size: 40px; margin: 0 0 22px; }

.pill[hidden] { display: none; }
.offerrow { min-height: 62px; margin-bottom: 14px; display: flex; }
.pill.offer { background: rgba(20,24,32,.85); border: 2px solid var(--acc); }
.pill.offer:focus { border-color: #fff; }

/* search: its own spot in the top corner of the rail column */
.rb.corner { position: absolute; top: 36px; inset-inline-start: 20px; }

/* rows: every card hangs from the same top edge, whatever its title length */
.row { align-items: flex-start; }
.card { display: flex; flex-direction: column; align-items: stretch; }
/* Play All / Shuffle: slim icon tiles, thumbnail height, a fraction of the width */
.card.action.slim { width: 96px; }
.card.action.slim .thumb { aspect-ratio: auto; height: 189px; padding: 0; background: rgba(255,255,255,.06); border-radius: 48px; }
.card.action.slim.sq .thumb { height: 216px; }
.card.action.slim .ms { font-size: 44px; color: var(--fg); }
.card.action.slim:focus .thumb { background: #fff; outline: none; transform: scale(1.05); }
.card.action.slim:focus .ms { color: #000; }


/* search: divider between title matches and subtitle matches */
.gsep { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; color: var(--dim); font-size: 22px; padding-top: 6px; border-top: 1px solid var(--line); }
.gsep .ms { color: var(--acc); font-size: 30px; }
.snote .txs { display: inline-flex; align-items: center; gap: 6px; margin-inline-start: 14px; opacity: .7; }

/* rail on sub-screens: hidden until it takes focus (Left at the start of a row) */
.screen[data-rail=reveal] { --pad: 80px; }
#rail { transition: opacity .15s; }
#stage.railhide #rail { opacity: 0; pointer-events: none; }
#stage.railhide #rail:focus-within { opacity: 1; pointer-events: auto; }
/* while the rail is revealed the content steps aside to the same inset the top-level screens use */
#stage.railhide:has(#rail:focus-within) .screen[data-rail=reveal] { --pad: 150px; }

/* microphone: leading control inside the search field */
.field .micin { width: 54px; height: 54px; margin-inline-start: -16px; background: none; flex: none; }
.field .micin .ms { font-size: 32px; }
.field .micin:focus { background: #fff; color: #000; transform: none; }
.field .micin.on, .field .micin.on:focus { background: #e5484d; color: #fff; animation: micpulse .65s ease-in-out infinite alternate; }
/* listening: the red background pulses (full to 55%), the icon stays solid */
@keyframes micpulse { to { background: rgba(229,72,77,.55); } }
.field .micin.on .ms { color: #fff; }

/* ---------- mini-player: focusable, expands to a queue peek ---------- */
#np { display: block; padding: 8px; border-radius: 44px; text-align: start; color: var(--fg); transition: background .12s; }
#np .nphead { display: flex; align-items: center; gap: 16px; padding-inline-end: 14px; }
#np .nptitle { min-width: 0; display: block; }
#np .npnext { display: none; }
#np:focus { background: #fff; color: #000; border-radius: 28px; border-color: #fff; width: 560px; max-width: none; box-shadow: 0 24px 70px rgba(0,0,0,.7); }
#np:focus .ms { color: #000; }
#np:focus .npbar { background: rgba(0,0,0,.15); }
#np:focus .npbar::after { background: #000; }
#np:focus .npnext { display: grid; gap: 10px; padding: 16px 10px 8px; }
#np .npnext small { color: #555; font-size: 18px; font-weight: 600; }
#np .npitem { display: flex; align-items: center; gap: 14px; font-size: 21px; }
#np .npitem img { width: 44px; height: 44px; border-radius: 8px; }
#np .npitem span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#np .npopen { display: flex; align-items: center; gap: 10px; margin-top: 6px; padding-top: 12px; border-top: 1px solid rgba(0,0,0,.12); font-weight: 600; font-size: 20px; }
#np .npopen .ms:last-child { margin-inline-start: auto; }
/* ---------- Now Playing: artwork on one side, the queue on the other ---------- */
.player.audio .art { left: 27%; top: 37%; }
[dir=rtl] .player.audio .art { left: 73%; }
.queue { position: absolute; top: 120px; inset-inline-end: 90px; width: 760px; height: 600px; display: flex; flex-direction: column; gap: 12px; }
.queue h2 { margin: 0; font-size: 24px; color: var(--dim); display: flex; align-items: center; gap: 12px; font-weight: 600; }
.qlist { flex: 1; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; align-content: start; padding: 6px; }
.qrow { min-height: 66px; padding: 6px 18px; scroll-margin-block: 70px; }
.qrow img { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; flex: none; }
.qrow b { font-size: 23px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.qrow .qn { width: 34px; text-align: center; color: var(--dim); font-size: 20px; flex: none; }
.qrow small { flex: none; }
.qrow.cur { background: rgba(255,255,255,.1); }
.qrow.cur .qn .ms { color: var(--acc); font-size: 26px; }
.qrow:focus { background: #fff; }
.qrow:focus .qn, .qrow:focus .qn .ms { color: #333; }

/* context menu: long titles wrap to two lines; the switch reads on/off at a glance */
.menu h2 { align-items: flex-start; }
.menu h2 .ms { margin-top: 4px; }
.menu .ms.trail { font-size: 46px; color: var(--dim); }
.menu .ms.trail.toggle_on { color: var(--acc); font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 40; }
.menu .lrow:focus .ms.trail { color: #000; }

/* ---------- progressive images ---------- */
.pic { opacity: 0; transition: opacity .28s; background: var(--card); }
.pic.on { opacity: 1; }
.card .thumb .pic { position: absolute; inset: 0; }
.hero .bg img.lo { filter: blur(22px); transform: scale(1.1); }
#np .pic, .qrow .pic { background: #1a1f29; }

/* ---------- favourites: Video / Audio tabs ---------- */
.favbar { min-height: 72px; gap: 18px; }
.favbar .favicon { font-size: 44px; color: var(--fg); margin-inline-end: 8px; }
.favbar .favcount { font-size: 34px; }
.favbar .pill small { opacity: .65; font-weight: 400; font-size: 20px; }
.grid.sqgrid { grid-template-columns: repeat(7, 216px); }
