:root {
  --bg: #0b0b10;
  --panel: rgba(20, 20, 28, 0.82);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f4f4f7;
  --muted: #a3a3b2;
  --accent: #ff3d7f;
  --accent-2: #7c5cff;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow: hidden;
  overscroll-behavior: none; touch-action: manipulation; }
canvas#stage { position: fixed; inset: 0; width: 100vw; height: 100dvh; display: block; }

.panel { position: fixed; left: 50%; transform: translateX(-50%); width: min(480px, calc(100vw - 32px));
  background: var(--panel); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line); border-radius: 22px; padding: 20px; }
#setup { top: 50%; transform: translate(-50%, -50%); }
.bottom { bottom: calc(16px + env(safe-area-inset-bottom)); padding: 14px; transition: opacity .25s, transform .25s; }
.bottom.hidden-ui { opacity: 0; pointer-events: none; transform: translate(-50%, 20px); }

h1 { margin: 0 0 4px; font-size: 34px; letter-spacing: -0.02em;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sub { margin: 0 0 18px; color: var(--muted); }

.pick { display: flex; align-items: center; gap: 14px; padding: 12px; margin-bottom: 10px;
  border: 1px dashed var(--line); border-radius: 16px; cursor: pointer; }
.pick.done { border-style: solid; border-color: rgba(255, 61, 127, .5); }
.thumb { width: 52px; height: 52px; flex: none; border-radius: 12px; background: rgba(255,255,255,.06);
  display: grid; place-items: center; font-size: 24px; background-size: cover; background-position: center; }
.txt { display: flex; flex-direction: column; min-width: 0; }
.txt small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

button { font: inherit; color: var(--text); background: rgba(255,255,255,.08); border: 1px solid var(--line);
  border-radius: 999px; padding: 10px 14px; cursor: pointer; }
button:disabled { opacity: .4; cursor: default; }
button.primary { width: 100%; margin-top: 8px; padding: 14px; font-weight: 600; border: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.row > button.round, button.round { width: 46px; height: 46px; padding: 0; flex: none; font-size: 18px; border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
button.rec { background: #d11f3a; border-color: #d11f3a; }

.row { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.row > button { flex: 1; font-size: 14px; padding: 9px 8px; }
.sliders label { flex: 1; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.chips { gap: 6px; }
.chip { flex: 1; font-size: 13px; padding: 7px 4px; }
.chip.on { background: rgba(255, 61, 127, .25); border-color: var(--accent); }
.time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; min-width: 40px; text-align: right; }

input[type=range] { flex: 1; width: 100%; accent-color: var(--accent); }

#toast { position: fixed; top: calc(16px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px; font-size: 14px;
  max-width: calc(100vw - 32px); text-align: center; }

.status { margin: 2px 4px 0; min-height: 1.4em; font-size: 13px; color: var(--muted); }
.lbl { font-size: 12px; color: var(--muted); flex: none; min-width: 52px; }
.seg > button, .presets > button { flex: 1; font-size: 13px; padding: 7px 4px; }
.seg > button.on { background: rgba(255, 61, 127, .25); border-color: var(--accent); }
.bpm { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 54px; text-align: right; }
.sliders label.dim { opacity: .4; }
.sliders label span { color: var(--text); font-variant-numeric: tabular-nums; }
.fx-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0; }
.fx-grid .chip { font-size: 12.5px; padding: 7px 2px; }
.bottom { max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow-y: auto; }
.sliders .lab { white-space: nowrap; }
.fx-grid[hidden] { display: none; }
#fxToggle { flex: 1.3; }

/* song details + share */
button.pick { width: 100%; text-align: left; font: inherit; color: var(--text); background: none; border-radius: 16px; }
.details-pick.done { border-style: solid; border-color: rgba(255, 61, 127, .5); }
.actions { gap: 6px; }
.actions > button { font-size: 13px; padding: 9px 2px; white-space: nowrap; }
button.accent, .btn.accent { background: linear-gradient(90deg, var(--accent), var(--accent-2)); border: 0; font-weight: 600; }
.btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: var(--text);
  background: rgba(255,255,255,.08); border: 1px solid var(--line); border-radius: 999px; padding: 10px 14px; font-size: 14px; }

.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; justify-content: center;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
.sheet[hidden] { display: none; }
.sheet-card { position: static; transform: none; width: min(480px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; }
.sheet h2 { margin: 0 0 10px; font-size: 20px; }
.field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.field .opt { font-size: 11px; opacity: .7; }
.field input, .link { font: inherit; font-size: 16px; color: var(--text); background: rgba(255,255,255,.06); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; width: 100%; }
.field input:focus, .link:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; margin: 6px 0 12px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; margin: 0; }
.sheet .row > button, .sheet .row > .btn { flex: 1; }
.sheet .primary { margin-top: 0; }
.note { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.share-what { margin: 0 0 12px; }
.share-what span { color: var(--muted); font-size: 14px; }
.error { color: #ff8a9b; font-size: 14px; margin: 6px 0; }
.progress { margin: 8px 0; }
.progress .bar { height: 6px; border-radius: 3px; background: rgba(255,255,255,.1); overflow: hidden; }
.progress .bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .2s; }
.progress small { color: var(--muted); font-size: 12px; }

/* accounts */
.acct-btn { position: fixed; z-index: 6; top: calc(12px + env(safe-area-inset-top)); right: 12px; height: 38px; min-width: 38px;
  padding: 0 14px; border-radius: 999px; font-size: 14px; font-weight: 600; overflow: hidden;
  background: var(--panel); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.acct-btn.signed-in { width: 38px; padding: 0; background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: 2px solid rgba(255,255,255,.7); }
.acct-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.acct-btn[hidden] { display: none; }
.account-box { display: flex; gap: 12px; align-items: center; padding: 12px; margin: 0 0 12px; border-radius: 14px;
  background: rgba(124, 92, 255, .14); border: 1px solid rgba(124, 92, 255, .4); }
.account-box[hidden] { display: none; }
.account-box p { margin: 0; flex: 1; font-size: 14px; }
.account-box span { color: var(--muted); font-size: 13px; }
.account-box button { flex: none; }
.expiry { margin-top: 10px; }
button.wide { width: 100%; margin: 4px 0 6px; }
.acct-head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.acct-head small { color: var(--muted); }
.acct-avatar { width: 48px; height: 48px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); background-size: cover; background-position: center; }
.sheet h3 { margin: 14px 0 8px; font-size: 15px; color: var(--muted); font-weight: 600; }
.my-links { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow-y: auto; color: var(--muted); font-size: 14px; }
.link-row { display: grid; grid-template-columns: 48px 1fr; gap: 6px 10px; align-items: center; padding: 8px; border-radius: 12px; background: rgba(255,255,255,.05); }
.link-row img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; grid-row: span 2; }
.link-meta { min-width: 0; color: var(--text); }
.link-meta b, .link-meta small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-meta small { color: var(--muted); }
.link-actions { display: flex; gap: 6px; }
.link-actions > * { flex: 1; font-size: 13px; padding: 6px 4px; }
button.danger { color: #ff8a9b; border-color: rgba(255, 138, 155, .4); }
