:root {
  --bg: #0e0e10;
  --bg2: #17171a;
  --bg3: #222226;
  --line: rgba(255,255,255,.08);
  --fg: #f4f4f5;
  --fg2: #a5a5ad;
  --fg3: #6e6e77;
  --brand: #1ed760;
  --radius: 10px;
  --bar-h: 76px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Noto Sans CJK SC", "Microsoft YaHei", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font-family: var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
a { color: inherit; text-decoration: none; }
img { display: block; }
[hidden] { display: none !important; }
.ic { width: 24px; height: 24px; fill: currentColor; flex: none; }
.muted { color: var(--fg3); }
.pad { padding: 16px; }

/* ------------------------------------------------------------ gate */
#gate { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 20% 10%, #1d3b2a 0%, transparent 60%), radial-gradient(900px 600px at 90% 90%, #2a1d3b 0%, transparent 60%), var(--bg); }
.gate-card { max-width: 520px; text-align: center; }
.gate-card h1 { font-size: 44px; letter-spacing: -.02em; margin: 12px 0 6px; }
.gate-card p { color: var(--fg2); line-height: 1.6; }
.gate-card ol { text-align: left; line-height: 1.9; color: var(--fg2); }
.gate-card code { background: var(--bg3); padding: 2px 6px; border-radius: 6px; color: var(--fg); word-break: break-all; }
.gate-card a { color: var(--brand); }
.gate-logo, .logo { width: 72px; height: 72px; margin: 0 auto; border-radius: 22px; background: linear-gradient(135deg, #1ed760, #0aa1c2 60%, #7b5cff); box-shadow: 0 10px 40px rgba(30,215,96,.25); position: relative; }
.gate-logo::after, .logo::after { content: ""; position: absolute; inset: 26%; border-radius: 4px; background: repeating-linear-gradient(180deg, rgba(255,255,255,.95) 0 14%, transparent 14% 28%); }
.btn { height: 44px; padding: 0 22px; border-radius: 999px; background: var(--bg3); font-weight: 600; display: inline-flex; align-items: center; gap: 8px; transition: transform .15s, background .15s; }
.btn:hover { background: #2c2c31; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--brand); color: #04120a; }
.btn.primary:hover { background: #3be477; }
.btn .ic { width: 20px; height: 20px; }
#gate .btn { margin-top: 18px; height: 52px; padding: 0 32px; font-size: 17px; }

/* ------------------------------------------------------------ app shell */
#app { position: fixed; inset: 0; display: grid; grid-template-columns: 260px 1fr; grid-template-rows: 1fr calc(var(--bar-h) + var(--safe-b)); }
#side { grid-row: 1; background: #000; padding: calc(16px + var(--safe-t)) 10px 10px calc(10px + var(--safe-l)); display: flex; flex-direction: column; min-height: 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; padding: 6px 10px 18px; letter-spacing: -.01em; }
.brand .logo { width: 30px; height: 30px; margin: 0; border-radius: 9px; box-shadow: none; }
.nav-item { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: 8px; color: var(--fg2); font-weight: 600; width: 100%; }
.nav-item:hover, .nav-item.sel { color: var(--fg); background: var(--bg2); }
.side-title { color: var(--fg3); font-size: 12px; font-weight: 700; letter-spacing: .08em; padding: 18px 12px 8px; }
.side-list { flex: 1; overflow-y: auto; min-height: 0; scrollbar-width: thin; }
.side-pl { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px; color: var(--fg2); font-size: 14px; }
.side-pl span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-pl:hover, .side-pl.sel { background: var(--bg2); color: var(--fg); }
.pl-thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: var(--bg3); display: grid; place-items: center; flex: none; }
.pl-thumb .ic { width: 20px; height: 20px; }
.liked { background: linear-gradient(135deg, #4b2fd6, #8fb8e8); color: #fff; display: grid; place-items: center; }
.ghost { margin-top: 6px; font-size: 14px; }

#main { grid-row: 1; overflow-y: auto; min-height: 0; background: linear-gradient(180deg, #1b1b20 0, var(--bg) 340px); padding: calc(24px + var(--safe-t)) calc(32px + var(--safe-r)) 40px 32px; }
.page-head h1 { font-size: 30px; margin: 8px 0 22px; letter-spacing: -.02em; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 22px; }
.card { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: 12px; transition: background .2s; min-width: 0; }
.card:hover { background: var(--bg2); }
.card-art-wrap { position: relative; margin-bottom: 8px; }
.card-art { width: 100%; aspect-ratio: 1; border-radius: 8px; object-fit: cover; background: var(--bg3); display: grid; place-items: center; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.card-art .ic { width: 44%; height: 44%; }
.card b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card small { color: var(--fg2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-play { position: absolute; right: 8px; bottom: 8px; width: 48px; height: 48px; border-radius: 50%; background: var(--brand); color: #000; display: grid; place-items: center; opacity: 0; transform: translateY(8px); transition: .2s; box-shadow: 0 8px 16px rgba(0,0,0,.35); }
.card:hover .card-play { opacity: 1; transform: none; }
@media (hover: none) { .card-play { opacity: 1; transform: none; width: 40px; height: 40px; } }

.pl-head { display: flex; gap: 24px; align-items: flex-end; margin: 8px 0 24px; }
.pl-cover { width: 200px; height: 200px; border-radius: 10px; object-fit: cover; box-shadow: 0 16px 48px rgba(0,0,0,.5); flex: none; background: var(--bg3); display: grid; place-items: center; }
.pl-cover .ic { width: 40%; height: 40%; }
.pl-info { min-width: 0; }
.pl-info small { color: var(--fg2); font-weight: 600; }
.pl-info h1 { font-size: clamp(28px, 5vw, 64px); margin: 6px 0 10px; letter-spacing: -.03em; line-height: 1.05; overflow-wrap: anywhere; }
.pl-sub { color: var(--fg2); font-size: 14px; }
.pl-actions { display: flex; gap: 10px; margin-top: 18px; }
.notice { padding: 20px; border-radius: 12px; background: var(--bg2); color: var(--fg2); line-height: 1.6; }
.notice b { color: var(--fg); }

.tracks { display: flex; flex-direction: column; }
.trk { display: grid; grid-template-columns: 36px 44px minmax(0, 1.6fr) minmax(0, 1fr) 56px; gap: 14px; align-items: center; padding: 6px 12px; border-radius: 8px; cursor: pointer; min-height: 58px; content-visibility: auto; contain-intrinsic-size: auto 58px; }
.trk:hover { background: var(--bg2); }
.trk-n { color: var(--fg3); text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; }
.trk-n .eq { display: none; }
.trk.playing .trk-n .n { display: none; }
.trk.playing .trk-n .eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 14px; }
.eq i { width: 3px; background: var(--brand); border-radius: 1px; animation: eq 0.9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.3s; } .eq i:nth-child(3) { animation-delay: -.6s; }
@keyframes eq { 0%,100% { height: 4px; } 50% { height: 14px; } }
.trk.playing b { color: var(--brand); }
.trk-art { width: 44px; height: 44px; border-radius: 4px; object-fit: cover; background: var(--bg3); }
.trk-main { display: flex; flex-direction: column; min-width: 0; }
.trk-main b, .trk-main small, .trk-album { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trk-main b { font-weight: 500; font-size: 15px; }
.trk-main small, .trk-album { color: var(--fg2); font-size: 13px; }
.trk-dur { color: var(--fg3); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ bottom bar */
#bar { grid-column: 1 / -1; position: relative; display: flex; align-items: center; gap: 16px; padding: 0 calc(16px + var(--safe-r)) var(--safe-b) calc(16px + var(--safe-l)); background: #000; border-top: 1px solid var(--line); }
.bar-progress { position: absolute; left: 0; right: 0; top: -1px; height: 2px; background: transparent; }
.bar-progress i { display: block; height: 100%; background: var(--fg); transform-origin: left; transform: scaleX(0); }
.bar-track { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; text-align: left; }
.bar-art { width: 52px; height: 52px; border-radius: 6px; background: var(--bg3); object-fit: cover; flex: none; }
.bar-art:not([src]), .bar-art[src=""] { visibility: hidden; }
.bar-meta { display: flex; flex-direction: column; min-width: 0; }
.bar-title, .bar-artist { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-title { font-size: 15px; font-weight: 600; }
.bar-artist { font-size: 13px; color: var(--fg2); }
.bar-ctrl, .bar-right { display: flex; align-items: center; gap: 6px; }
.bar-right { flex: 1; justify-content: flex-end; }
.bar-time { color: var(--fg3); font-size: 12px; font-variant-numeric: tabular-nums; margin-right: 6px; }
.ib { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--fg2); transition: color .15s, background .15s, transform .12s; }
.ib:hover { color: var(--fg); background: rgba(255,255,255,.06); }
.ib:active { transform: scale(.92); }
.ib.on { color: var(--brand); }
.ib.play { background: var(--fg); color: #000; }
.ib.play:hover { background: #fff; transform: scale(1.04); }

/* ------------------------------------------------------------ now playing */
#np {
  --anchor: .38;
  --user-scale: 1;
  --fs: clamp(26px, min(3vw, 5.4vh), 60px);
  --hl: #fff;
  --dim: rgba(255,255,255,.34);
  --accent: #333;
  position: fixed; inset: 0; z-index: 10; overflow: hidden; background: #000; color: #fff;
  display: grid; opacity: 0; transform: translateY(24px); transition: opacity .28s ease, transform .35s cubic-bezier(.2,.8,.2,1);
  grid-template-columns: minmax(300px, 40%) 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas: "top top" "side lyrics";
}
#np.open { opacity: 1; transform: none; }
#np.light-bg { --dim: rgba(255,255,255,.42); }

.np-bg { position: absolute; inset: 0; z-index: -1; overflow: hidden; background: var(--accent); transition: background 1s; }
.np-bg .b1, .np-bg .b2 { position: absolute; left: 50%; top: 50%; width: 150vmax; height: 150vmax; margin: -75vmax 0 0 -75vmax; background-size: cover; background-position: center; opacity: 0; transition: opacity 1.2s ease; }
.np-bg .show { opacity: 1; }
#np.fx .np-bg .b1, #np.fx .np-bg .b2 { filter: blur(30px); animation: drift 40s linear infinite; }
#np.fx .np-bg .b2 { animation-direction: reverse; animation-duration: 52s; }
#np.fx.paused .np-bg .b1, #np.fx.paused .np-bg .b2 { animation-play-state: paused; }
@keyframes drift { from { transform: rotate(0deg) scale(1.1); } to { transform: rotate(360deg) scale(1.1); } }
.np-bg .shade { position: absolute; inset: 0; background: radial-gradient(120% 90% at 30% 40%, rgba(0,0,0,.18), rgba(0,0,0,.55)); }
#np.light-bg .np-bg .shade { background: radial-gradient(120% 90% at 30% 40%, rgba(0,0,0,.32), rgba(0,0,0,.62)); }

.np-top { grid-area: top; display: flex; align-items: center; gap: 8px; padding: calc(10px + var(--safe-t)) calc(14px + var(--safe-r)) 4px calc(14px + var(--safe-l)); transition: opacity .4s; z-index: 2; }
.np-top .ib, .np-ctrl .ib { color: rgba(255,255,255,.85); }
.np-top .ib:hover, .np-ctrl .ib:hover { background: rgba(255,255,255,.12); color: #fff; }
.np-top .ib.on, .np-ctrl .ib.on { color: #fff; background: rgba(255,255,255,.18); }
.np-device { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px; background: rgba(255,255,255,.12); font-size: 13px; color: rgba(255,255,255,.9); max-width: 40vw; }
.np-device .ic { width: 16px; height: 16px; }
.dev-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-ctx { max-width: 32vw; }
.pl-opt { padding: 4px 6px 4px 4px; }
.pl-opt-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; text-align: left; padding: 4px; }
.pl-opt .chip { height: 34px; min-width: 52px; font-size: 13px; }
.np-tools { margin-left: auto; display: flex; gap: 2px; }
#np.idle .np-top { opacity: 0; }
#np.idle { cursor: none; }

.np-side { grid-area: side; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2.2vh; padding: 2vh 3vw 5vh calc(3vw + var(--safe-l)); min-height: 0; min-width: 0; }
.np-art-wrap { width: min(100%, 52vh, 460px); aspect-ratio: 1; flex: none; }
.np-art { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; box-shadow: 0 24px 60px rgba(0,0,0,.45); transition: transform .5s cubic-bezier(.2,.8,.2,1); }
#np.paused .np-art { transform: scale(.94); }
.np-art:not([src]), .np-art[src=""] { visibility: hidden; }
.np-meta { width: min(100%, 52vh, 460px); min-width: 0; }
.np-title { font-size: clamp(18px, 2.6vh, 26px); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-artist { font-size: clamp(14px, 2vh, 19px); color: rgba(255,255,255,.7); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.np-progress { width: min(100%, 52vh, 460px); }
.seek { --v: 0%; width: 100%; height: 22px; margin: 0; -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer; }
.seek::-webkit-slider-runnable-track { height: 5px; border-radius: 3px; background: linear-gradient(90deg, rgba(255,255,255,.9) var(--v), rgba(255,255,255,.25) var(--v)); }
.seek::-moz-range-track { height: 5px; border-radius: 3px; background: linear-gradient(90deg, rgba(255,255,255,.9) var(--v), rgba(255,255,255,.25) var(--v)); }
.seek::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; margin-top: -4px; border-radius: 50%; background: #fff; opacity: 0; transition: opacity .2s; }
.seek::-moz-range-thumb { width: 13px; height: 13px; border: 0; border-radius: 50%; background: #fff; }
.seek:hover::-webkit-slider-thumb, .seek:active::-webkit-slider-thumb { opacity: 1; }
.np-times { display: flex; justify-content: space-between; font-size: 12px; color: rgba(255,255,255,.6); font-variant-numeric: tabular-nums; }
.np-ctrl { display: flex; align-items: center; justify-content: space-between; width: min(100%, 52vh, 460px); }
.np-ctrl .ib { width: 56px; height: 56px; }
.np-ctrl .ib .ic { width: 34px; height: 34px; }
.np-ctrl .ib.sm .ic { width: 22px; height: 22px; }
.np-ctrl .ib.sm { width: 44px; height: 44px; color: rgba(255,255,255,.6); }
.np-ctrl .ib.big { width: 72px; height: 72px; background: #fff; color: #000; }
.np-ctrl .ib.big .ic { width: 38px; height: 38px; }

/* ------------------------------------------------------------ lyrics */
.np-lyrics { grid-area: lyrics; position: relative; overflow: hidden; min-height: 0; min-width: 0;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 12%, #000 80%, transparent 100%);
          mask-image: linear-gradient(180deg, transparent 0, #000 12%, #000 80%, transparent 100%);
  padding: 0 calc(5vw + var(--safe-r)) 0 2vw; touch-action: none; }
.ly-inner { position: relative; padding: 0; }
.np-lyrics .line {
  font-size: calc(var(--fs) * var(--user-scale)); font-weight: 800; line-height: 1.22; letter-spacing: -.01em;
  padding: .34em .4em; margin: 0 -.4em; border-radius: .3em; color: var(--dim);
  transform-origin: left center; will-change: transform;
  transition: transform .72s cubic-bezier(.22,.86,.28,1), color .45s ease, filter .45s ease, opacity .45s ease;
  cursor: pointer; overflow-wrap: anywhere; text-wrap: balance;
}
#np.center .np-lyrics .line { text-align: center; transform-origin: center; }
.np-lyrics.synced .line:hover { background: rgba(255,255,255,.07); }
.np-lyrics .line .tr { font-size: .62em; font-weight: 600; margin-top: .25em; opacity: .9; line-height: 1.3; }
.np-lyrics.no-tr .line .tr { display: none; }
.np-lyrics .line.active { color: var(--hl); }
.np-lyrics.word .line.active { color: var(--dim); }
.np-lyrics.word .line.active .tr { color: rgba(255,255,255,.85); }
/* word sweep: a soft-edged gradient that moves across each word */
.np-lyrics .line.active .w {
  --p: 0;
  background-image: linear-gradient(90deg, var(--hl) calc(var(--p) * 130% - 30%), var(--dim) calc(var(--p) * 130%));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  display: inline-block; white-space: pre-wrap; transition: transform 1.2s cubic-bezier(.2,.8,.2,1);
}
#np.fx .np-lyrics .line.active .w.on { transform: translateY(-.04em); text-shadow: 0 0 .5em rgba(255,255,255,.0); }
.np-lyrics .line .w { white-space: pre-wrap; }

#np.fx .np-lyrics.synced:not(.manual) .line[data-d="2"] { filter: blur(.7px); }
#np.fx .np-lyrics.synced:not(.manual) .line[data-d="3"] { filter: blur(1.3px); }
#np.fx .np-lyrics.synced:not(.manual) .line[data-d="4"] { filter: blur(1.8px); }
#np.fx .np-lyrics.synced:not(.manual) .line[data-d="5"] { filter: blur(2.2px); }
.np-lyrics.synced .line[data-d="5"] { opacity: .75; }

/* interlude dots */
.np-lyrics .line.gap { height: calc(var(--fs) * var(--user-scale) * 1.1); padding-top: .2em; }
.dots { display: flex; gap: .28em; height: 100%; align-items: center; opacity: 0; transform: scale(.6); transform-origin: left center; transition: opacity .4s, transform .5s cubic-bezier(.2,.8,.2,1); }
#np.center .dots { justify-content: center; transform-origin: center; }
.dots i { width: .34em; height: .34em; border-radius: 50%; background: rgba(255,255,255,.3); }
.line.gap.active .dots { opacity: 1; transform: scale(1); animation: breathe 2.4s ease-in-out infinite; }
.line.gap.active .dots i:nth-child(1) { background: rgba(255,255,255, calc(.3 + min(1, var(--g, 0) * 3) * .7)); }
.line.gap.active .dots i:nth-child(2) { background: rgba(255,255,255, calc(.3 + clamp(0, var(--g, 0) * 3 - 1, 1) * .7)); }
.line.gap.active .dots i:nth-child(3) { background: rgba(255,255,255, calc(.3 + clamp(0, var(--g, 0) * 3 - 2, 1) * .7)); }
@keyframes breathe { 0%,100% { scale: 1; } 50% { scale: 1.12; } }

.ly-msg { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 8px; font-size: calc(var(--fs) * .8); font-weight: 800; color: rgba(255,255,255,.75); pointer-events: none; }
#np.center .ly-msg { align-items: center; }
.ly-msg small { font-size: 15px; font-weight: 500; color: rgba(255,255,255,.5); }
.ly-msg:empty { display: none; }
.np-lyrics.plain { overflow-y: auto; touch-action: pan-y; padding-top: 10vh; padding-bottom: 20vh; }
.np-lyrics.plain .line { color: rgba(255,255,255,.85); cursor: default; font-size: calc(var(--fs) * var(--user-scale) * .8); }
.ly-note { font-size: 13px; color: rgba(255,255,255,.5); margin-bottom: 1em; }

/* ---- layout: landscape (desktop / tablet) is the default above ---- */
#np[data-layout="landscape"] .np-lyrics { padding-left: 1vw; }

/* ---- layout: portrait (phones) ---- */
#np[data-layout="portrait"] {
  --anchor: .34;
  --fs: clamp(24px, 7.4vw, 40px);
  grid-template-columns: 1fr;
  grid-template-rows: auto auto 1fr auto;
  grid-template-areas: "top" "head" "lyrics" "ctrl";
}
#np[data-layout="portrait"] .np-side { display: contents; }
#np[data-layout="portrait"] .np-art-wrap { display: none; }
#np[data-layout="portrait"] .np-meta { grid-area: head; width: auto; padding: 6px 24px 4px; display: grid; grid-template-columns: 56px 1fr; column-gap: 12px; align-items: center; }
#np[data-layout="portrait"] .np-meta::before { content: ""; grid-row: 1 / 3; width: 56px; height: 56px; border-radius: 8px; background: var(--art) center / cover, rgba(255,255,255,.1); box-shadow: 0 6px 16px rgba(0,0,0,.35); }
#np[data-layout="portrait"] .np-title { font-size: 18px; }
#np[data-layout="portrait"] .np-artist { font-size: 15px; }
#np[data-layout="portrait"] .np-lyrics { padding: 0 24px; }
#np[data-layout="portrait"] .np-progress,
#np[data-layout="portrait"] .np-ctrl { grid-area: ctrl; width: auto; }
#np[data-layout="portrait"] .np-progress { align-self: start; padding: 4px 24px 0; }
#np[data-layout="portrait"] .np-ctrl { align-self: end; padding: 0 16px calc(18px + var(--safe-b)); margin-top: 44px; }
#np[data-layout="portrait"] .np-ctrl .ib.big { width: 68px; height: 68px; }
#np[data-layout="portrait"] .np-device:not(.np-ctx) .dev-name { display: none; }
#np[data-layout="portrait"] .np-device:not(.np-ctx) { padding: 0 9px; }
#np[data-layout="portrait"] .np-ctx { max-width: 38vw; }
#np[data-layout="portrait"] .np-top { gap: 4px; padding-left: calc(8px + var(--safe-l)); padding-right: calc(8px + var(--safe-r)); }
#np[data-layout="portrait"] .np-top .ib { width: 40px; height: 40px; }

/* ---- layout: wide (car head units, ultra-wide, short landscape) ---- */
#np[data-layout="wide"] {
  --anchor: .42;
  --fs: clamp(20px, min(7.4vh, 4vw), 64px);
  grid-template-columns: minmax(220px, 30%) 1fr;
  grid-template-rows: auto 1fr;
}
#np[data-layout="wide"] .np-top { padding-top: calc(4px + var(--safe-t)); padding-bottom: 0; }
#np[data-layout="wide"] .np-top .ib { width: 40px; height: 40px; }
#np[data-layout="wide"] .np-side { gap: 1.6vh; padding: 0 2vw 3vh calc(2.4vw + var(--safe-l)); justify-content: center; }
#np[data-layout="wide"] .np-art-wrap { width: min(100%, 40vh); }
#np[data-layout="wide"] .np-meta, #np[data-layout="wide"] .np-progress, #np[data-layout="wide"] .np-ctrl { width: min(100%, 46vh, 360px); }
#np[data-layout="wide"] .np-title { font-size: clamp(15px, 4vh, 24px); }
#np[data-layout="wide"] .np-artist { font-size: clamp(12px, 3vh, 18px); }
#np[data-layout="wide"] .np-ctrl .ib { width: clamp(40px, 11vh, 56px); height: clamp(40px, 11vh, 56px); }
#np[data-layout="wide"] .np-ctrl .ib.big { width: clamp(48px, 14vh, 68px); height: clamp(48px, 14vh, 68px); }
#np[data-layout="wide"] .np-ctrl .ib.sm { width: clamp(32px, 9vh, 44px); height: clamp(32px, 9vh, 44px); }
#np[data-layout="wide"] .np-lyrics { -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 16%, #000 78%, transparent 100%); mask-image: linear-gradient(180deg, transparent 0, #000 16%, #000 78%, transparent 100%); }
#np[data-layout="wide"] .np-lyrics .line .tr { font-size: .58em; }
/* very short screens: drop the art, keep a compact control column */
@media (max-height: 420px) {
  #np[data-layout="wide"] .np-art-wrap { width: min(100%, 34vh); }
}
@media (max-height: 330px) {
  #np[data-layout="wide"] .np-art-wrap { display: none; }
}

/* ------------------------------------------------------------ sheet + toast */
#sheet { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.5); display: grid; place-items: center; opacity: 0; transition: opacity .2s; padding: 16px; }
#sheet.open { opacity: 1; }
.sheet-card { width: min(520px, 100%); max-height: min(80vh, 720px); display: flex; flex-direction: column; background: #1c1c20; border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.6); transform: translateY(12px) scale(.98); transition: transform .25s cubic-bezier(.2,.8,.2,1); overflow: hidden; }
#sheet.open .sheet-card { transform: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 10px 4px 20px; }
.sheet-head b { font-size: 17px; }
.sheet-body { overflow-y: auto; padding: 4px 16px 18px; }
@media (max-width: 600px), (max-aspect-ratio: 9/10) {
  #sheet { place-items: end stretch; padding: 0; }
  .sheet-card { width: 100%; max-height: 85vh; border-radius: 18px 18px 0 0; padding-bottom: var(--safe-b); transform: translateY(40px); }
}
.opt-list { display: flex; flex-direction: column; gap: 2px; }
.opt { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; text-align: left; min-height: 52px; }
.opt:hover { background: rgba(255,255,255,.06); }
.opt.sel { background: rgba(30,215,96,.12); }
.opt.sel b { color: var(--brand); }
.opt-ic { color: var(--fg2); }
.opt-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.opt-main b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt-main small { color: var(--fg2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt-tag { font-size: 11px; font-weight: 700; padding: 3px 7px; border-radius: 6px; background: var(--bg3); color: var(--fg2); flex: none; min-width: 64px; text-align: center; }
.opt-score { font-size: 12px; color: var(--fg3); font-variant-numeric: tabular-nums; }
.group-title { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 700; color: var(--fg3); letter-spacing: .06em; margin: 14px 4px 8px; }
.link { color: var(--brand); font-size: 13px; font-weight: 600; letter-spacing: 0; }
.offset-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { height: 38px; min-width: 56px; padding: 0 12px; border-radius: 10px; background: var(--bg3); font-weight: 600; font-variant-numeric: tabular-nums; display: inline-grid; place-items: center; }
.chip:hover { background: #2e2e34; }
.offset-val { background: rgba(30,215,96,.15); color: var(--brand); min-width: 80px; }
.hint { color: var(--fg2); font-size: 13px; line-height: 1.55; margin: 8px 4px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.seg { display: flex; gap: 4px; background: var(--bg3); padding: 3px; border-radius: 10px; align-items: center; }
.seg button { height: 32px; padding: 0 12px; border-radius: 8px; font-size: 14px; color: var(--fg2); }
.seg button.on { background: #3a3a42; color: var(--fg); }
.seg .chip { height: 32px; background: none; min-width: 52px; }

#toast { position: fixed; left: 50%; bottom: calc(var(--bar-h) + 20px + var(--safe-b)); z-index: 40; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: rgba(240,240,245,.96); color: #111; padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; max-width: 90vw; text-align: center; transition: .25s cubic-bezier(.2,.8,.2,1); box-shadow: 0 10px 30px rgba(0,0,0,.4); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------------------------------------------------------------ responsive shell */
@media (max-width: 860px) {
  #app { grid-template-columns: 1fr; }
  #side { display: none; }
  #main { padding: calc(16px + var(--safe-t)) 16px 24px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
  .card { padding: 8px; }
  .pl-head { flex-direction: column; align-items: flex-start; gap: 16px; }
  .pl-cover { width: 160px; height: 160px; }
  .trk { grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 12px; padding: 6px 4px; }
  .trk-n, .trk-album { display: none; }
  .hide-sm { display: none !important; }
  #bar { gap: 8px; }
  .bar-right { flex: none; }
}
@media (max-height: 500px) and (min-aspect-ratio: 3/2) {
  /* short landscape library (car): compact chrome */
  :root { --bar-h: 64px; }
  .bar-art { width: 44px; height: 44px; }
  .pl-cover { width: 120px; height: 120px; }
  .pl-head { flex-direction: row; align-items: flex-end; }
  #side { display: flex; }
  #app { grid-template-columns: 220px 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  #np .np-lyrics .line { transition-duration: .01s; }
  #np.fx .np-bg .b1, #np.fx .np-bg .b2 { animation: none; }
}
