/* Tunebun — soft UI (neumorphic) with capsule shapes and ripples */
:root {
  --bg: #eceff7;
  --text: #434868;
  --muted: #6c7294;
  --faint: #9aa0bd;
  --accent: #ff7fb4;
  --accent-2: #8c9cff;
  --accent-ink: #ffffff;
  --ok: #3fb68b;
  --bad: #e5617a;
  --sh-d: rgba(160, 169, 204, .55);
  --sh-l: rgba(255, 255, 255, .95);
  --raised: 7px 7px 16px var(--sh-d), -7px -7px 16px var(--sh-l);
  --raised-sm: 4px 4px 9px var(--sh-d), -4px -4px 9px var(--sh-l);
  --inset: inset 4px 4px 9px var(--sh-d), inset -4px -4px 9px var(--sh-l);
  --inset-sm: inset 2px 2px 5px var(--sh-d), inset -2px -2px 5px var(--sh-l);
  --grad: linear-gradient(135deg, #ff8fc0 0%, #9aa6ff 100%);
  --glow: 0 10px 22px -6px rgba(255, 127, 180, .55);
  --r: 28px;
  --ease: cubic-bezier(.22, .8, .24, 1);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #262a3f;
  --text: #dfe2f5;
  --muted: #a0a6c8;
  --faint: #6f7599;
  --sh-d: rgba(12, 14, 28, .7);
  --sh-l: rgba(72, 79, 118, .35);
  --glow: 0 10px 22px -8px rgba(255, 127, 180, .4);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #262a3f; --text: #dfe2f5; --muted: #a0a6c8; --faint: #6f7599;
    --sh-d: rgba(12, 14, 28, .7); --sh-l: rgba(72, 79, 118, .35);
    --glow: 0 10px 22px -8px rgba(255, 127, 180, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 500 15px/1.5 ui-rounded, "SF Pro Rounded", "Nunito", "Quicksand", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background .35s var(--ease), color .35s var(--ease);
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
svg.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.i.fill { fill: currentColor; stroke: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 3px; border-radius: 999px; }

/* ---------- layout ---------- */
.app { max-width: 1280px; margin: 0 auto; padding: 26px 24px 120px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand .logo { width: 54px; height: 54px; border-radius: 50%; box-shadow: var(--raised-sm); display: grid; place-items: center; background: var(--bg); }
.brand .logo svg { width: 36px; height: 36px; }
.brand b { font-size: 24px; letter-spacing: -.02em; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand small { display: block; color: var(--muted); font-size: 12.5px; margin-top: -3px; font-weight: 600; }
.top-right { display: flex; align-items: center; gap: 12px; }
.layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 28px; align-items: start; }
.card { background: var(--bg); border-radius: var(--r); box-shadow: var(--raised); padding: 24px; }
.side { position: sticky; top: 20px; padding: 20px; }
.stage { display: grid; gap: 24px; min-width: 0; }
.stage > * { min-width: 0; }
#editor { min-width: 0; }

/* ---------- buttons & pills ---------- */
.rip { position: relative; overflow: hidden; isolation: isolate; }
.ripple { position: absolute; border-radius: 50%; pointer-events: none; transform: scale(0); background: color-mix(in srgb, var(--accent) 38%, transparent); animation: ripple .7s var(--ease) forwards; z-index: -1; }
.btn.primary .ripple, .btn.grad .ripple { background: rgba(255, 255, 255, .5); z-index: 0; }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 44px; padding: 0 22px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--bg); color: var(--text); font-weight: 700; letter-spacing: .01em;
  box-shadow: var(--raised-sm); transition: box-shadow .2s var(--ease), transform .2s var(--ease), color .2s, opacity .2s;
  white-space: nowrap; user-select: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { box-shadow: var(--inset-sm); transform: none; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.primary { background: var(--grad); color: var(--accent-ink); box-shadow: var(--glow); }
.btn.primary:active { box-shadow: inset 2px 2px 8px rgba(0, 0, 0, .18); }
.btn.ghost { box-shadow: none; background: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); box-shadow: var(--raised-sm); }
.btn.danger { color: var(--bad); }
.btn.sm { height: 36px; padding: 0 16px; font-size: 13.5px; }
.btn.icon { width: 44px; padding: 0; }
.btn.icon.sm { width: 36px; }
.btn.busy { pointer-events: none; }
.btn.busy::after { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.pill { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 14px; border-radius: 999px; background: var(--bg); box-shadow: var(--inset-sm); color: var(--muted); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.pill.ok .dot { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.pill.warn .dot { background: #f3b04c; }

/* ---------- sidebar ---------- */
.drop { display: grid; place-items: center; text-align: center; gap: 6px; padding: 28px 18px; border-radius: 38px; cursor: pointer; background: var(--bg); box-shadow: var(--inset); transition: box-shadow .25s var(--ease), transform .25s var(--ease); position: relative; overflow: hidden; }
.drop .orb { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; box-shadow: var(--raised-sm); color: var(--accent); margin-bottom: 4px; transition: transform .3s var(--ease); }
.drop strong { font-size: 16px; }
.drop span { color: var(--muted); font-size: 13px; }
.drop:hover .orb, .drop.over .orb { transform: translateY(-3px) scale(1.06); }
.drop.over { box-shadow: var(--inset), 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; font-size: 0; }
.prog { height: 10px; border-radius: 999px; margin: 14px 4px 2px; box-shadow: var(--inset-sm); overflow: hidden; }
.prog i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--grad); transition: width .2s linear; }
.tracks { list-style: none; margin: 18px 0 0; padding: 4px; display: grid; gap: 12px; max-height: 58vh; overflow: auto; scrollbar-width: thin; }
.track { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 10px; border-radius: 999px; cursor: pointer; background: var(--bg); box-shadow: var(--raised-sm); transition: box-shadow .25s var(--ease), transform .25s var(--ease); animation: rise .4s var(--ease) both; }
.track:hover { transform: translateX(2px); }
.track.active { box-shadow: var(--inset-sm); }
.track .mini { width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden; background: var(--bg); box-shadow: var(--raised-sm); color: var(--accent); }
.track.active .mini { box-shadow: none; }
.track .mini img { width: 100%; height: 100%; object-fit: cover; display: block; }
.track .tx { min-width: 0; flex: 1; }
.track .tx b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track .tx small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track .x { border: 0; background: transparent; width: 30px; height: 30px; border-radius: 50%; color: var(--faint); cursor: pointer; display: grid; place-items: center; }
.track .x:hover { color: var(--bad); box-shadow: var(--raised-sm); }
.empty-note { text-align: center; color: var(--muted); font-size: 13px; padding: 16px 6px 4px; }

/* ---------- welcome ---------- */
.welcome { display: grid; place-items: center; text-align: center; gap: 14px; padding: 70px 24px; }
.welcome .big { width: 130px; height: 130px; border-radius: 50%; display: grid; place-items: center; box-shadow: var(--raised); }
.welcome .big svg { width: 84px; height: 84px; }
.welcome h1 { font-size: 30px; letter-spacing: -.02em; }
.welcome p { color: var(--muted); max-width: 46ch; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 8px; }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 26px; align-items: center; }
.cover { width: 150px; height: 150px; border-radius: 30px; background: var(--bg); box-shadow: var(--raised); display: grid; place-items: center; color: var(--accent); position: relative; overflow: hidden; cursor: pointer; border: 0; padding: 0; }
.cover .img { position: absolute; inset: 7px; border-radius: 24px; background-size: cover; background-position: center; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.cover .over { position: absolute; inset: 7px; border-radius: 24px; display: grid; place-items: center; background: rgba(40, 44, 70, .45); color: #fff; opacity: 0; transition: opacity .25s; font-size: 13px; font-weight: 700; backdrop-filter: blur(2px); }
.cover:hover .over, .cover:focus-visible .over { opacity: 1; }
.cover svg.i { width: 46px; height: 46px; }
.meta { min-width: 0; display: grid; gap: 14px; }
.meta h2 { font-size: 26px; line-height: 1.2; letter-spacing: -.02em; overflow-wrap: anywhere; }
.meta .sub { color: var(--muted); font-weight: 600; margin-top: 2px; overflow-wrap: anywhere; }
.meta .pills { display: flex; flex-wrap: wrap; gap: 8px; }
.player { display: flex; align-items: center; gap: 14px; padding: 8px 18px 8px 8px; border-radius: 999px; box-shadow: var(--inset); }
.play { width: 46px; height: 46px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--grad); color: #fff; cursor: pointer; box-shadow: var(--glow); flex: none; }
.play:active { transform: scale(.94); }
.player time { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--muted); font-weight: 700; min-width: 38px; }
input[type=range].seek { -webkit-appearance: none; appearance: none; flex: 1; height: 10px; border-radius: 999px; background: linear-gradient(90deg, var(--accent) var(--p, 0%), transparent var(--p, 0%)), var(--bg); box-shadow: var(--inset-sm); cursor: pointer; min-width: 60px; }
input[type=range].seek::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--bg); box-shadow: var(--raised-sm); border: 3px solid var(--accent); }
input[type=range].seek::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--bg); border: 3px solid var(--accent); box-shadow: var(--raised-sm); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 6px; padding: 7px; border-radius: 999px; box-shadow: var(--inset); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 1 0 auto; height: 42px; padding: 0 20px; border: 0; background: transparent; border-radius: 999px; font-weight: 700; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: color .2s, box-shadow .25s var(--ease); }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--bg); color: var(--accent); box-shadow: var(--raised-sm); }
.tab .badge { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.panel { animation: rise .45s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- forms ---------- */
.group + .group { margin-top: 30px; }
.group > h3 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 0 6px 14px; font-weight: 800; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field > label, .lbl { font-size: 12.5px; color: var(--muted); font-weight: 700; margin-left: 18px; }
.in, .field input[type=text], .field input[type=number], .field input:not([type]), .field textarea, .select { width: 100%; border: 0; background: var(--bg); box-shadow: var(--inset); border-radius: 999px; height: 46px; padding: 0 20px; outline: none; transition: box-shadow .2s var(--ease); min-width: 0; }
.field textarea, textarea.in { height: auto; border-radius: 26px; padding: 14px 20px; resize: vertical; line-height: 1.55; display: block; }
.in:focus, .field input:focus, .field textarea:focus, .select:focus { box-shadow: var(--inset), 0 0 0 3px color-mix(in srgb, var(--accent) 40%, transparent); }
.in::placeholder, input::placeholder, textarea::placeholder { color: var(--faint); }
.in:disabled, .field input:disabled, .field textarea:disabled { opacity: .45; cursor: not-allowed; }
.pair { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; }
.pair span { color: var(--faint); font-weight: 700; font-size: 13px; }
.rating { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.star { width: 44px; height: 44px; border: 0; border-radius: 50%; display: grid; place-items: center; background: var(--bg); box-shadow: var(--raised-sm); color: var(--faint); cursor: pointer; transition: color .2s, box-shadow .2s, transform .2s var(--ease); }
.star:hover { transform: translateY(-2px); }
.star.on { color: #ffb347; box-shadow: var(--inset-sm); }
.star.on svg { fill: currentColor; }
.extras { display: grid; gap: 12px; }
.extra { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) auto; gap: 12px; align-items: center; animation: rise .35s var(--ease) both; }
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-radius: 999px; box-shadow: var(--inset-sm); color: var(--muted); font-weight: 600; font-size: 13.5px; margin-bottom: 22px; }
.banner svg { color: var(--accent); }

.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; font-weight: 700; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .tr { width: 54px; height: 30px; border-radius: 999px; box-shadow: var(--inset-sm); position: relative; flex: none; transition: background .25s; }
.switch .tr::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--bg); box-shadow: var(--raised-sm); transition: transform .3s var(--ease), background .3s; }
.switch input:checked + .tr { background: color-mix(in srgb, var(--accent) 28%, var(--bg)); }
.switch input:checked + .tr::after { transform: translateX(24px); background: var(--accent); }
.switch input:focus-visible + .tr { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 3px; }
.switch small { display: block; color: var(--muted); font-weight: 600; font-size: 12.5px; }

.chipset { display: flex; flex-wrap: wrap; gap: 12px; }
.chip { height: 40px; padding: 0 20px; border-radius: 999px; border: 0; background: var(--bg); box-shadow: var(--raised-sm); color: var(--text); font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: box-shadow .25s var(--ease), color .2s; }
.chip[aria-pressed="true"] { box-shadow: var(--inset-sm); color: var(--accent); }
.chip[aria-pressed="true"]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* ---------- lyrics / cover / details / raw ---------- */
.lyrics-wrap textarea { min-height: 340px; font-size: 15px; width: 100%; }
.lyr-top { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.lyr-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 14px 8px 0; color: var(--muted); font-size: 12.5px; font-weight: 600; flex-wrap: wrap; }
.lang { width: 92px !important; text-align: center; text-transform: lowercase; }
.found { margin-top: 18px; padding: 18px 22px; border-radius: 26px; box-shadow: var(--inset); display: grid; gap: 12px; animation: rise .35s var(--ease) both; }
.found p { color: var(--muted); font-size: 13.5px; }

.cover-pane { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 32px; align-items: center; }
.cover-big { width: 280px; height: 280px; border-radius: 40px; box-shadow: var(--raised); display: grid; place-items: center; color: var(--accent); position: relative; background: var(--bg); transition: box-shadow .25s; }
.cover-big .img { position: absolute; inset: 10px; border-radius: 32px; background-size: cover; background-position: center; }
.cover-big.over { box-shadow: var(--raised), 0 0 0 3px color-mix(in srgb, var(--accent) 50%, transparent); }
.cover-big svg.i { width: 64px; height: 64px; }
.cover-info { display: grid; gap: 18px; }
.cover-info .note { color: var(--muted); font-size: 13.5px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.fact { padding: 14px 20px; border-radius: 26px; box-shadow: var(--inset-sm); min-width: 0; }
.fact small { display: block; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em; font-weight: 800; }
.fact b { display: block; margin-top: 2px; overflow-wrap: anywhere; font-size: 14.5px; }
.rawtools { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.rawtools .in { max-width: 320px; }
.rows { display: grid; gap: 10px; }
.row { display: grid; grid-template-columns: 76px 150px minmax(0, 1fr); gap: 14px; align-items: baseline; padding: 11px 20px; border-radius: 24px; box-shadow: var(--inset-sm); }
.row code { font: 800 12px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--accent); }
.row span { color: var(--muted); font-weight: 700; font-size: 13px; }
.row p { overflow-wrap: anywhere; white-space: pre-wrap; font-size: 13.5px; }

/* ---------- save bar / toasts / modal ---------- */
.savebar { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%); opacity: 0; visibility: hidden; pointer-events: none; display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 24px; border-radius: 999px; background: var(--bg); box-shadow: var(--raised), 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent); transition: transform .5s var(--ease), opacity .3s, visibility 0s .5s; z-index: 40; max-width: calc(100vw - 24px); }
.savebar.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; pointer-events: auto; transition: transform .5s var(--ease), opacity .3s, visibility 0s; }
.savebar .msg { font-weight: 700; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.savebar .msg::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.7); opacity: .6; } }
.toasts { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 12px; z-index: 80; width: max-content; max-width: calc(100vw - 24px); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 22px 12px 14px; border-radius: 999px; background: var(--bg); box-shadow: var(--raised); font-weight: 700; animation: toast-in .5s var(--ease) both; pointer-events: auto; max-width: 560px; }
.toast.out { animation: toast-out .35s var(--ease) forwards; }
.toast .tdot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none; background: var(--grad); }
.toast.err .tdot { background: linear-gradient(135deg, #ff8a8a, var(--bad)); }
.toast.ok .tdot { background: linear-gradient(135deg, #7be0b5, var(--ok)); }
.toast svg.i { width: 16px; height: 16px; stroke-width: 3; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-18px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px) scale(.96); } }
.veil { position: fixed; inset: 0; background: color-mix(in srgb, var(--bg) 55%, transparent); backdrop-filter: blur(8px); display: grid; place-items: center; z-index: 90; padding: 20px; animation: fade .25s both; }
@keyframes fade { from { opacity: 0; } }
.modal { max-width: 420px; width: 100%; text-align: center; display: grid; gap: 14px; animation: rise .4s var(--ease) both; }
.modal h3 { font-size: 20px; }
.modal p { color: var(--muted); }
.modal .actions { justify-content: center; margin-top: 8px; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; }
  .tracks { max-height: 260px; }
}
@media (max-width: 640px) {
  .app { padding: 18px 14px 120px; }
  .top { gap: 10px; margin-bottom: 20px; }
  .brand { min-width: 0; }
  .brand b { font-size: 21px; }
  .brand .logo { width: 46px; height: 46px; }
  .brand .logo svg { width: 30px; height: 30px; }
  #capPill span { display: none; }
  #capPill { width: 30px; padding: 0; justify-content: center; }
  .top-right { gap: 10px; }
  .tracks { padding: 6px; }
  .card { padding: 18px; border-radius: 24px; }
  .hero { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 18px; }
  .meta .pills { justify-content: center; }
  .grid { grid-template-columns: 1fr; }
  .cover-pane { grid-template-columns: 1fr; justify-items: center; }
  .cover-big { width: 220px; height: 220px; }
  .row { grid-template-columns: 1fr; gap: 2px; }
  .extra { grid-template-columns: 1fr; }
  .brand small { display: none; }
  .savebar { padding-left: 16px; }
  .savebar .msg { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ===================================================== Sing (timed lyrics) */
.sing-panel { padding: 14px; }
.stage-sing {
  position: relative; overflow: hidden; isolation: isolate; border-radius: 24px; color: #fff;
  height: clamp(420px, 66vh, 640px); display: flex; flex-direction: column;
  background: #1c1f33; box-shadow: var(--inset-sm);
  --beat: 0;
}
.stage-sing:fullscreen { height: 100vh; border-radius: 0; }
.sg-bg { position: absolute; inset: -40px; z-index: -3; background: var(--grad) center/cover; filter: blur(46px) saturate(1.5); transform: scale(1.15); transition: background-image .6s; }
.stage-sing::before { content: ""; position: absolute; inset: 0; z-index: -2; background: linear-gradient(180deg, rgba(18,20,38,.62), rgba(18,20,38,.82)); }
.sg-glow {
  position: absolute; left: 50%; top: 52%; width: 70%; aspect-ratio: 1; z-index: -1; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255,140,200,.34), rgba(150,165,255,.14) 55%, transparent 72%);
  transform: translate(-50%, -50%) scale(calc(.9 + var(--beat) * .16)); opacity: calc(.55 + var(--beat) * .45);
}
.sg-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 6px; position: relative; z-index: 2; }
.sg-title { display: grid; min-width: 0; line-height: 1.25; }
.sg-title b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-title span { font-size: 12.5px; opacity: .68; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.sg-bpm { font-size: 12px; padding: 6px 12px; border-radius: 99px; background: rgba(255,255,255,.12); backdrop-filter: blur(8px); white-space: nowrap; }
.sg-btn { position: relative; overflow: hidden; width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; color: #fff; background: rgba(255,255,255,.16); backdrop-filter: blur(8px); transition: transform .2s var(--ease), background .2s; }
.sg-btn:hover { background: rgba(255,255,255,.26); }
.sg-btn:active { transform: scale(.92); }
.sg-btn .i { width: 18px; height: 18px; }
.sg-scroll { position: relative; flex: 1; overflow: hidden; -webkit-mask-image: linear-gradient(180deg, transparent, #000 18%, #000 78%, transparent); mask-image: linear-gradient(180deg, transparent, #000 18%, #000 78%, transparent); }
.sg-lines { position: absolute; left: 0; right: 0; top: 0; padding: 0 clamp(18px, 5vw, 56px); transition: transform .85s var(--ease); will-change: transform; }
.ln {
  --g: .15; margin: 0 0 clamp(14px, 2.6vh, 26px); font-weight: 700; letter-spacing: -.01em; line-height: 1.22;
  font-size: clamp(22px, 3.6vw, 40px); text-align: left; cursor: pointer; opacity: .42; transform-origin: left center;
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.stage-sing:fullscreen .ln { font-size: clamp(28px, 4.4vw, 60px); }
.ln.past { opacity: .5; }
.ln.on { opacity: 1; transform: scale(calc(1 + var(--beat) * .018)); filter: drop-shadow(0 0 16px rgba(255,150,210,.32)); transition: opacity .35s, transform .12s linear; }
.ln.gap { font-size: .8em; opacity: .35; min-height: 1em; }
.ln.gap.on { opacity: .9; }
.ln:hover:not(.on) { opacity: .8; }
.w {
  display: inline-block; margin: 0; padding: 0 .02em; white-space: pre;
  color: transparent; -webkit-text-fill-color: transparent;
  background-image: linear-gradient(105deg, #fff 0%, #fff 36%, #ffd9ec 44%, #fff 50%, #cfd7ff 56%, #fff 64%, #fff 100%);
  background-size: 300% 100%; -webkit-background-clip: text; background-clip: text;
  animation: sgShimmer 3.4s linear infinite; animation-delay: calc(var(--i, 0) * -.21s);
  --p: 0; opacity: calc(var(--g) + var(--p) * (1 - var(--g)));
  filter: blur(calc((1 - var(--p)) * 11px));
  transform: translateY(calc((1 - var(--p)) * .3em)) scale(calc(.93 + var(--p) * .07));
}
.w.done { filter: none; }
.ln:not(.on):not(.past) .w { animation: none; }
@keyframes sgShimmer { from { background-position: 100% 0; } to { background-position: -200% 0; } }
.sg-bar { height: 3px; background: rgba(255,255,255,.14); position: relative; z-index: 2; }
.sg-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ff8fc0, #9aa6ff); border-radius: 3px; }
.sg-note { margin: 12px 6px 0; font-size: 12.5px; color: var(--muted); }
.sg-empty { color: rgba(255,255,255,.7); padding: 30px 0; font-size: 18px; font-weight: 600; }
@media (max-width: 640px) {
  .stage-sing { height: 62vh; }
  .sg-bpm { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .w { animation: none; filter: none; transform: none; }
  .sg-lines, .ln { transition: none; }
  .sg-glow { transform: translate(-50%, -50%); opacity: .6; }
}

/* ===================================================== 8D spatial audio */
.sp-top { display: flex; align-items: center; gap: 34px; flex-wrap: wrap; margin-bottom: 30px; }
.sp-orbit { position: relative; width: 132px; height: 132px; border-radius: 50%; box-shadow: var(--inset); flex: none; }
.sp-ring { position: absolute; inset: 20px; border-radius: 50%; border: 2px dashed color-mix(in srgb, var(--faint) 55%, transparent); }
.sp-head { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; background: var(--bg); box-shadow: var(--raised-sm); }
.sp-head::before { content: ""; position: absolute; left: 50%; top: -5px; margin-left: -4px; border: 4px solid transparent; border-bottom: 6px solid var(--faint); border-top: 0; }
.sp-dot { position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; background: var(--grad); box-shadow: var(--glow); transform: translate(var(--dx, 0px), var(--dy, -46px)); }
.sp-orbit.live .sp-dot { box-shadow: 0 0 18px rgba(255, 127, 180, .75); }
.sp-main { flex: 1; min-width: 240px; }
.sp-sliders { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.sp-sl { display: grid; gap: 10px; font-weight: 700; font-size: 13.5px; color: var(--muted); }
.sp-sl b { float: right; color: var(--text); font-weight: 800; }
.sp-sl input { width: 100%; accent-color: var(--accent); height: 22px; cursor: pointer; }
.sp-sl input { -webkit-appearance: none; appearance: none; background: transparent; }
.sp-sl input::-webkit-slider-runnable-track { height: 8px; border-radius: 99px; background: var(--bg); box-shadow: var(--inset-sm); }
.sp-sl input::-moz-range-track { height: 8px; border-radius: 99px; background: var(--bg); box-shadow: var(--inset-sm); }
.sp-sl input::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -7px; border-radius: 50%; border: 0; background: var(--grad); box-shadow: var(--glow); }
.sp-sl input::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--grad); box-shadow: var(--glow); }
.sp-sl input:disabled { opacity: .4; cursor: default; }
#p-spatial > .actions:last-child { margin-top: 34px !important; }

/* ---------- plan, quota and locked controls ---------- */
.quota { margin: 12px 4px 0; text-align: center; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.quota.low { color: var(--bad); }
.pill.plan { text-decoration: none; color: var(--accent); font-weight: 800; cursor: default; position: relative; overflow: hidden; }
.pill.plan[href] { cursor: pointer; }
.toast .tlink { margin-left: 4px; color: var(--accent); font-weight: 800; text-decoration: none; white-space: nowrap; }
.banner a { color: var(--accent); font-weight: 800; }
.locked { opacity: .55; cursor: not-allowed !important; }
.locked * { cursor: not-allowed !important; }
.sp-sl.locked > span::after, .switch.locked > span:last-child::after { content: " 🔒"; font-size: 12px; }
.btn.locked { filter: grayscale(.6); }
