:root {
  --bg: #060c1c;
  --bg2: #0a1328;
  --card: #0e1933;
  --card2: #13224a;
  --line: #1e3160;
  --text: #eef3ff;
  --muted: #8b9cc4;
  --blue: #2f8cff;
  --blue2: #61b3ff;
  --orange: #ff8a1f;
  --orange2: #ffb648;
  --danger: #ff6b6b;
  --r: 18px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); color-scheme: dark; }
body {
  margin: 0; min-height: 100vh; color: var(--text); background: var(--bg);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
.glow {
  position: fixed; inset: -20% -10% auto -10%; height: 70vh; pointer-events: none; z-index: 0;
  background:
    radial-gradient(40% 50% at 25% 30%, rgba(47, 140, 255, .22), transparent 70%),
    radial-gradient(35% 45% at 80% 20%, rgba(255, 138, 31, .16), transparent 70%);
  filter: blur(10px);
}
header, main, footer { position: relative; z-index: 1; }
a { color: var(--blue2); }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { opacity: .35; cursor: default; }
[hidden] { display: none !important; }
h1, h2 { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.link { background: none; border: 0; color: var(--blue2); padding: 6px 4px; font-size: 14px; }

/* header */
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + var(--safe-t)) 16px 8px; max-width: 760px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand img { border-radius: 10px; box-shadow: 0 0 14px rgba(47,140,255,.45); }
.word { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; line-height: 1; }
.word .the { font-weight: 600; font-size: 22px; letter-spacing: -.02em; }
.word .mixer { font-weight: 800; font-style: italic; font-size: 22px; letter-spacing: -.02em;
  background: linear-gradient(180deg, var(--orange2), var(--orange)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.word small { width: 100%; font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .04em; margin-top: 3px; }
.top-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  font-size: 20px; display: grid; place-items: center;
}

main { max-width: 760px; margin: 0 auto; padding: 0 16px 24px; }

/* pick screen */
.pick { padding-top: 6vh; text-align: center; }
.pick h1 { font-size: clamp(30px, 8vw, 46px); line-height: 1.08; letter-spacing: -.03em; font-weight: 800; }
.hl { background: linear-gradient(90deg, var(--blue2), var(--orange2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { color: var(--muted); font-size: 17px; margin: 12px auto 26px; max-width: 30em; }
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 34px 18px;
  border-radius: 24px; border: 1.5px dashed rgba(97,179,255,.5); cursor: pointer;
  background: linear-gradient(180deg, rgba(47,140,255,.10), rgba(255,138,31,.06));
  box-shadow: 0 0 0 1px rgba(255,255,255,.02) inset, 0 20px 60px -30px rgba(47,140,255,.6);
  transition: transform .15s, border-color .15s;
}
.drop:active, .drop.over { transform: scale(.985); border-color: var(--orange); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-icon { font-size: 40px; color: var(--orange2); text-shadow: 0 0 20px rgba(255,138,31,.6); }
.drop-title { font-size: 21px; font-weight: 700; }
.drop-sub { color: var(--muted); font-size: 14px; }
.promises { list-style: none; padding: 0; margin: 26px auto 0; text-align: left; max-width: 30em; display: grid; gap: 10px; }
.promises li { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; color: var(--muted); font-size: 15px; }
.promises b { color: var(--text); }
.ios-tip { margin: 18px auto 0; max-width: 30em; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--card2); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; font-size: 14px; text-align: left; }

/* cards */
.card { background: linear-gradient(180deg, var(--card), var(--bg2)); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-top: 12px; }
.song-head { display: flex; align-items: center; gap: 10px; }
.song-meta { min-width: 0; }
.song-title { font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-sub { color: var(--muted); font-size: 13px; }
.wave-wrap { position: relative; margin-top: 12px; }
#wave { width: 100%; height: 110px; display: block; border-radius: 12px; background: #081129; touch-action: none; }
.busy-chip { position: absolute; top: 8px; right: 8px; display: flex; gap: 8px; align-items: center; font-size: 13px;
  background: rgba(6,12,28,.85); border: 1px solid var(--line); padding: 5px 10px; border-radius: 999px; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--orange); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.times { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.transport { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.play {
  width: 58px; height: 58px; border-radius: 50%; border: 0; font-size: 22px; flex: none;
  background: radial-gradient(circle at 35% 30%, var(--orange2), var(--orange)); color: #1a0d00;
  box-shadow: 0 8px 26px -6px rgba(255,138,31,.7);
}
.ab { display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 3px; flex: 1; }
.seg { flex: 1; border: 0; background: none; border-radius: 9px; padding: 9px 4px; font-size: 14px; font-weight: 600; color: var(--muted); }
.seg.on { background: var(--card2); color: var(--text); box-shadow: 0 0 0 1px var(--line); }
#abMix.on { color: var(--orange2); }
.toggle { border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 10px 10px; font-size: 14px; color: var(--muted); flex: none; }
.toggle[aria-pressed="true"] { color: var(--blue2); border-color: var(--blue); background: rgba(47,140,255,.12); }
.warn { margin-top: 10px; font-size: 13px; color: var(--orange2); background: rgba(255,138,31,.08); border: 1px solid rgba(255,138,31,.3); padding: 8px 10px; border-radius: 10px; }

/* hero */
.hero-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.hero {
  display: flex; align-items: center; gap: 10px; text-align: left; padding: 14px 12px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--card); min-height: 72px;
}
.hero b { display: block; font-size: 16px; }
.hero small { display: block; color: var(--muted); font-size: 12px; }
.hero-ico { font-size: 24px; }
.hero.master { background: linear-gradient(135deg, rgba(47,140,255,.25), rgba(47,140,255,.06)); border-color: rgba(97,179,255,.45); }
.hero.night { background: linear-gradient(135deg, rgba(255,138,31,.25), rgba(255,138,31,.06)); border-color: rgba(255,182,72,.45); }
.hero.on { box-shadow: 0 0 0 2px var(--blue2), 0 10px 30px -10px rgba(47,140,255,.8); }
.hero.night.on { box-shadow: 0 0 0 2px var(--orange2), 0 10px 30px -10px rgba(255,138,31,.8); }
.master-notes ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
.mn-head { display: flex; justify-content: space-between; align-items: center; }

/* presets */
.presets { margin-top: 18px; }
.row-head { display: flex; justify-content: space-between; align-items: center; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 9px 14px; font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.chip.on { border-color: var(--orange); background: rgba(255,138,31,.14); color: var(--orange2); }
.chip.mine { border-style: dashed; }
.chip .x { margin-left: 2px; color: var(--muted); padding: 0 2px; }

/* studio */
.studio { margin-top: 20px; }
.studio details { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); margin-top: 10px; overflow: hidden; }
.studio summary { padding: 14px; font-weight: 700; list-style: none; display: flex; justify-content: space-between; cursor: pointer; }
.studio summary::-webkit-details-marker { display: none; }
.studio summary::after { content: "▾"; color: var(--muted); transition: transform .2s; }
.studio details[open] summary::after { transform: rotate(180deg); }
.ctl { padding: 0 14px 14px; display: grid; gap: 12px; }
.row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; }
.row label { font-size: 14px; }
.row .val { font-size: 13px; color: var(--orange2); font-variant-numeric: tabular-nums; background: none; border: 0; padding: 2px 0 2px 8px; }
.row input[type=range] { grid-column: 1 / -1; }
.row.disabled { opacity: .4; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.check input { width: 20px; height: 20px; accent-color: var(--orange); }
.selrow { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; }
.secondary { border: 1px solid var(--line); background: var(--card2); border-radius: 12px; padding: 10px 14px; font-size: 14px; font-weight: 600; text-align: center; text-decoration: none; color: var(--text); }
.reset-all { margin-top: 10px; color: var(--muted); }
.hint { font-size: 12px; color: var(--muted); margin: -4px 0 0; }

input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 30px; background: transparent; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--blue) var(--p, 50%), var(--line) var(--p, 50%)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; margin-top: -9px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.5), 0 0 0 3px rgba(47,140,255,.35); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line); }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--blue); }
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: #fff; }

/* export */
.export { margin-top: 18px; }
.primary {
  display: block; width: 100%; border: 0; border-radius: 16px; padding: 16px; font-size: 17px; font-weight: 800; text-align: center; text-decoration: none;
  color: #1a0d00; background: linear-gradient(180deg, var(--orange2), var(--orange)); box-shadow: 0 10px 30px -12px rgba(255,138,31,.9);
}
.progress { margin-top: 12px; display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--orange)); transition: width .2s; }
.result { margin-top: 14px; display: grid; gap: 10px; }
.result audio { width: 100%; }
.result-actions { display: grid; gap: 8px; }

/* footer */
.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 20px 16px calc(28px + var(--safe-b)); }
.foot p { margin: 4px 0; }
.toast { position: fixed; left: 50%; bottom: calc(20px + var(--safe-b)); transform: translateX(-50%); z-index: 10;
  background: var(--card2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: calc(100% - 32px); box-shadow: 0 10px 30px rgba(0,0,0,.5); }

/* legal pages */
.doc { max-width: 720px; margin: 0 auto; padding: 8px 16px 40px; }
.doc h1 { font-size: 30px; margin: 12px 0 4px; }
.doc h2 { margin-top: 26px; text-transform: none; letter-spacing: 0; color: var(--text); font-size: 18px; }
.doc p, .doc li { color: #c9d5f2; }
