:root {
  --bg: #0b0c0f;
  --surface: #13151a;
  --surface-2: #1a1d23;
  --line: #262a32;
  --line-2: #323743;
  --text: #eceef2;
  --muted: #8b919d;
  --faint: #5d636e;
  --accent: #ff5b2e;
  --accent-ink: #140a06;
  --accent-soft: rgba(255, 91, 46, 0.14);
  --song: #5b6270;
  --ok: #3ddc97;
  --err: #ff6b6b;
  --radius: 14px;
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body::before {  /* soft glow behind the header */
  content: "";
  position: fixed; inset: -30vh -10vw auto;
  height: 70vh;
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 91, 46, 0.10), transparent 60%);
  pointer-events: none;
  z-index: -1;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-feature-settings: "tnum"; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 10px;
  max-width: 1160px; width: 100%; margin: 0 auto;
  padding: 20px 24px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: -0.01em; }
.logo svg { width: 28px; height: 28px; display: block; }
.logo rect { fill: var(--accent); }
.logo path { stroke: var(--accent-ink); stroke-width: 2.6; stroke-linecap: round; fill: none; }
.fb-open { margin-left: auto; }
.tag { font-size: 11px; font-weight: 600; color: var(--muted); border: 1px solid var(--line-2); border-radius: 99px; padding: 1px 8px; }

main { flex: 1; width: 100%; max-width: 1160px; margin: 0 auto; padding: 8px 24px 48px; }
.view { animation: in .35s ease both; }
@keyframes in { from { opacity: 0; transform: translateY(6px); } }

/* ---------- upload ---------- */
.hero { text-align: center; max-width: 680px; margin: 48px auto 32px; }
h1 { font-size: clamp(30px, 4.6vw, 48px); line-height: 1.08; letter-spacing: -0.03em; margin: 0 0 16px; font-weight: 700; }
.lede { color: var(--muted); font-size: 17px; margin: 0; }

.dropzone {
  max-width: 680px; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 48px 24px;
  border: 1.5px dashed var(--line-2);
  border-radius: 20px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
  text-align: center;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); outline: none; }
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.01); }
.dz-icon { width: 44px; height: 44px; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 8px; }
.dz-title { font-size: 18px; font-weight: 600; }
.dz-sub { color: var(--muted); font-size: 14px; }
.dz-sub u { color: var(--text); text-decoration-color: var(--accent); text-underline-offset: 3px; }

.how { list-style: none; padding: 0; margin: 40px auto 0; max-width: 900px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.how li { display: flex; gap: 12px; color: var(--muted); font-size: 14px; }
.how b { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); font-size: 12px; }
.how strong { color: var(--text); font-weight: 600; }
.privacy { text-align: center; color: var(--faint); font-size: 13px; margin-top: 32px; }

.faq { max-width: 720px; margin: 72px auto 0; }
.faq h3 { font-size: 22px; letter-spacing: -0.02em; margin: 0 0 16px; text-align: center; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; list-style: none; padding: 16px 32px 16px 0; font-weight: 600; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 13px; font-size: 20px; color: var(--muted); font-weight: 400; transition: transform .15s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { color: var(--muted); margin: 0 0 18px; font-size: 14.5px; }

/* ---------- cards / progress ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.progress-card { max-width: 560px; margin: 80px auto; }
.track-title { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; margin-bottom: 20px; overflow-wrap: anywhere; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.pulse { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.bar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .4s ease; }
.progress-meta { display: flex; justify-content: space-between; margin-top: 10px; color: var(--muted); font-size: 14px; }
.hint { color: var(--faint); font-size: 13px; margin: 20px 0 0; }

/* ---------- studio ---------- */
.track-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 24px 0 20px; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
h2 { font-size: 26px; letter-spacing: -0.02em; margin: 4px 0 10px; overflow-wrap: anywhere; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { font-size: 12px; padding: 4px 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.chip:first-child { color: var(--accent); border-color: rgba(255, 91, 46, .35); }

.grid { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 20px; align-items: start; }

/* controls */
.controls { display: flex; flex-direction: column; gap: 22px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-size: 13px; font-weight: 600; margin-bottom: 10px; padding: 0; }
.help { color: var(--faint); font-size: 12px; margin: 8px 0 0; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 8px 4px; border-radius: 7px; font-size: 13px; font-weight: 500; transition: background .12s, color .12s; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.seg-4 button { display: flex; flex-direction: column; align-items: center; line-height: 1.2; padding: 9px 4px; }
.seg-4 span { font-size: 18px; font-weight: 700; font-family: var(--mono); }
.seg-4 small { font-size: 10.5px; color: var(--faint); margin-top: 2px; }
.seg-4 button.on span { color: var(--accent); }

.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.presets button { border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 12px; padding: 4px 10px; border-radius: 99px; }
.presets button:hover { color: var(--text); border-color: var(--line-2); }
.presets button.on { color: var(--text); border-color: var(--accent); }

.stems { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stem {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 4px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  font-size: 12px; font-weight: 500;
  transition: border-color .12s, background .12s, color .12s;
}
.stem svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.stem:hover { color: var(--text); border-color: var(--line-2); }
.stem.on { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.stem.on svg { stroke: var(--accent); }
.stem .order { position: absolute; top: 5px; right: 6px; font-style: normal; font-family: var(--mono); font-size: 10px; color: var(--accent); }

.legend-row { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.mini { border: 1px solid var(--line); background: transparent; color: var(--accent); font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 99px; }
.mini:hover { border-color: var(--accent); }
.fx { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.fx-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; padding: 11px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--muted); font-size: 12.5px; font-weight: 600; transition: border-color .12s, background .12s, color .12s; }
.fx-tile svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.fx-tile small { display: block; font-weight: 400; font-size: 11px; color: var(--faint); margin-top: 2px; line-height: 1.3; }
.fx-tile:hover { color: var(--text); border-color: var(--line-2); }
.fx-tile.on { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.fx-tile.on svg { stroke: var(--accent); }
@media (max-width: 420px) { .fx { grid-template-columns: 1fr; } .fx-tile { flex-direction: row; align-items: center; } }
.switch { display: flex; align-items: center; gap: 12px; margin-top: 14px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch .track { flex: none; width: 38px; height: 22px; border-radius: 99px; background: var(--line-2); position: relative; transition: background .15s; }
.switch .thumb { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--text); transition: transform .15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track .thumb { transform: translateX(16px); background: var(--accent-ink); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-label { font-size: 13px; font-weight: 600; display: flex; flex-direction: column; }
.switch-label small { font-weight: 400; color: var(--faint); font-size: 12px; }

.advanced { border-top: 1px solid var(--line); padding-top: 16px; }
.advanced summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); list-style: none; display: flex; align-items: center; gap: 6px; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::before { content: "›"; display: inline-block; transition: transform .15s; font-size: 16px; }
.advanced[open] summary::before { transform: rotate(90deg); }
.advanced[open] summary { margin-bottom: 16px; }
.advanced fieldset + .row2, .advanced .row2 + fieldset { margin-top: 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 500; }
.field input { background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; font-family: var(--mono); font-size: 14px; width: 100%; }
.field input:focus { outline: none; border-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 10px; padding: 12px 18px;
  font-weight: 600; font-size: 14px;
  border: 1px solid transparent; text-decoration: none; color: var(--text);
  transition: filter .12s, background .12s, border-color .12s, opacity .12s;
}
.btn small { font-weight: 500; opacity: .7; font-size: 12px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.outline { border-color: var(--line-2); }
.btn.outline:hover { border-color: var(--text); }
.btn.ghost { background: var(--surface-2); border-color: var(--line); color: var(--muted); }
.btn.ghost:hover { color: var(--text); }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
#btn-render { width: 100%; padding: 14px; font-size: 15px; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(0,0,0,.25); border-top-color: var(--accent-ink); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.error { color: var(--err); font-size: 13px; margin: 0; text-align: center; }
#upload-error { margin-top: 14px; }

/* result */
.result { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.result-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.result-title { font-weight: 600; margin-top: 4px; overflow-wrap: anywhere; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex: none; }
.legend span { display: flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw-intro { background: var(--accent); }
.sw-song { background: var(--song); }

.wave-wrap { position: relative; height: 150px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; cursor: pointer; }
#wave { width: 100%; height: 100%; display: block; }
.marker { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px solid var(--text); pointer-events: none; }
.marker span { position: absolute; top: 8px; left: 6px; white-space: nowrap; font-size: 11px; font-weight: 600; background: var(--text); color: var(--bg); padding: 2px 7px; border-radius: 5px; }
.marker.flip span { left: auto; right: 6px; }

.transport { display: flex; align-items: center; gap: 14px; }
.play { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--text); display: grid; place-items: center; flex: none; transition: transform .1s; }
.play:hover:not(:disabled) { transform: scale(1.05); }
.play:disabled { opacity: .35; cursor: not-allowed; }
.play svg { width: 20px; height: 20px; fill: var(--bg); }
.play .i-pause, .play.playing .i-play { display: none; }
.play.playing .i-pause { display: block; }
.time { color: var(--muted); font-size: 13px; }
.transport .btn { margin-left: auto; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; margin: 0; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.facts div { background: var(--surface); padding: 12px 14px; }
.facts dt { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.facts dd { margin: 4px 0 0; font-size: 14px; font-weight: 500; }
.facts dd small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }

.downloads { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.versions { border-top: 1px solid var(--line); padding-top: 16px; }
.versions-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.versions-list button { border: 1px solid var(--line); background: var(--bg); color: var(--muted); font-size: 12px; padding: 6px 10px; border-radius: 8px; }
.versions-list button:hover { color: var(--text); }
.versions-list button.on { color: var(--text); border-color: var(--accent); }

.foot { text-align: center; color: var(--faint); font-size: 12px; padding: 24px; border-top: 1px solid var(--line); }
.foot nav { display: flex; justify-content: center; gap: 18px; margin-bottom: 10px; }
.foot nav a, .foot nav button { color: var(--muted); text-decoration: none; background: none; border: 0; padding: 0; font-size: 13px; }
.foot nav a:hover, .foot nav button:hover { color: var(--text); }

.rate { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.rate button { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; font-size: 15px; }
.rate button:hover { border-color: var(--line-2); }
.rate button.on { border-color: var(--accent); background: var(--accent-soft); }
.rate-thanks { color: var(--ok); }

.fb { background: var(--surface); color: var(--text); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 24px; width: min(460px, calc(100vw - 32px)); }
.fb::backdrop { background: rgba(0, 0, 0, .6); backdrop-filter: blur(2px); }
.fb h3 { margin: 0 0 4px; font-size: 18px; }
.fb-sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.fb textarea, .fb input { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px; resize: vertical; margin-bottom: 10px; }
.fb textarea:focus, .fb input:focus { outline: none; border-color: var(--accent); }
.fb-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.fb .error { text-align: left; margin-bottom: 8px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .result { order: -1; }
}
@media (max-width: 640px) {
  main, .topbar { padding-left: 16px; padding-right: 16px; }
  .hero { margin-top: 24px; }
  .how { grid-template-columns: 1fr; }
  .card { padding: 18px; }
  .track-head { flex-direction: column; align-items: flex-start; }
  .downloads { grid-template-columns: 1fr; }
  .wave-wrap { height: 120px; }
  .legend { display: none; }
}

/* ---------- legal pages ---------- */
.doc { max-width: 720px; margin: 24px auto 0; }
.doc h1 { font-size: 34px; margin-bottom: 6px; }
.doc .updated { color: var(--faint); font-size: 13px; margin: 0 0 28px; }
.doc h2 { font-size: 18px; margin: 32px 0 8px; }
.doc p, .doc li { color: var(--muted); font-size: 15px; }
.doc strong { color: var(--text); }
.doc a { color: var(--text); text-decoration-color: var(--accent); text-underline-offset: 3px; }
.doc ul { padding-left: 20px; }
