:root {
  --bg: #0e0b09;
  --bg-raised: #171310;
  --bg-sunken: #0a0807;
  --panel: #1b1613;
  --panel-edge: #2a221d;
  --line: #2e2620;
  --text: #f0e9e2;
  --text-dim: #a3948a;
  --text-faint: #6d6058;
  --accent: #e0a45c;
  --accent-hot: #f2c078;
  --accent-deep: #b8763a;
  --good: #7fc99a;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, .85);
}

* { box-sizing: border-box; }

/* Class selectors below set `display`, which would otherwise beat the
   user-agent `[hidden]` rule. SVG elements need this too — Chromium does
   not apply the UA rule to them at all. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 620px at 78% -12%, rgba(224, 164, 92, .12), transparent 62%),
    radial-gradient(760px 460px at 6% 8%, rgba(184, 118, 58, .09), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; }
.muted { color: var(--text-dim); }
.dot { color: var(--accent); }

h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.02em; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 14px clamp(18px, 4vw, 44px);
  background: rgba(14, 11, 9, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -.02em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  color: var(--accent);
  background: linear-gradient(160deg, rgba(224, 164, 92, .22), rgba(224, 164, 92, .05));
  border: 1px solid rgba(224, 164, 92, .28);
}

.brand-mark svg { width: 19px; height: 19px; }

.topnav {
  display: flex;
  gap: 22px;
  margin-left: auto;
}

.topnav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color .18s;
}

.topnav a:hover { color: var(--text); }

.badge {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(224, 164, 92, .3);
  background: rgba(224, 164, 92, .08);
  white-space: nowrap;
}

/* ---------- hero ---------- */

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(18px, 4vw, 44px) 90px;
}

.hero {
  padding: 74px 0 46px;
  max-width: 720px;
}

.hero h1 {
  font-size: clamp(34px, 5.2vw, 54px);
  font-weight: 700;
}

.hero h1 span {
  display: block;
  background: linear-gradient(96deg, var(--accent-hot), var(--accent-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  margin: 20px 0 0;
  font-size: 17px;
  color: var(--text-dim);
  max-width: 62ch;
}

/* ---------- panels ---------- */

.panel {
  background: linear-gradient(180deg, var(--panel), var(--bg-raised));
  border: 1px solid var(--panel-edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- dropzone ---------- */

.dropzone {
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 62px 24px;
  text-align: center;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(27, 22, 19, .7), rgba(10, 8, 7, .5));
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .2s;
}

.dropzone:hover,
.dropzone:focus-visible {
  border-color: rgba(224, 164, 92, .55);
  background: linear-gradient(180deg, rgba(38, 29, 22, .8), rgba(14, 11, 9, .6));
  outline: none;
}

.dropzone.over {
  border-color: var(--accent);
  background: rgba(224, 164, 92, .09);
  transform: scale(1.005);
}

.dz-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 12px;
  border-radius: 50%;
  color: var(--accent);
  background: rgba(224, 164, 92, .1);
  border: 1px solid rgba(224, 164, 92, .25);
}

.dz-icon svg { width: 24px; height: 24px; }
.dz-title { margin: 0; font-size: 18px; font-weight: 600; }
.dz-sub { margin: 0; font-size: 13.5px; color: var(--text-faint); }

/* ---------- track ---------- */

.workspace { display: grid; gap: 18px; }

.track { padding: 20px 22px 18px; }

.track-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.track-meta h2 {
  font-size: 17px;
  font-weight: 600;
  word-break: break-all;
}

.track-meta p { margin: 3px 0 0; font-size: 12.5px; }

.wave-wrap {
  position: relative;
  border-radius: var(--radius-sm);
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  overflow: hidden;
  cursor: crosshair;
}

#wave { display: block; width: 100%; height: 150px; }

.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1.5px;
  background: var(--accent-hot);
  box-shadow: 0 0 10px rgba(242, 192, 120, .8);
  pointer-events: none;
}

.transport {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.time { margin-left: auto; font-size: 13px; color: var(--text-dim); }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--panel-edge);
  background: var(--bg-raised);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .18s, border-color .18s, transform .1s, opacity .18s;
}

.btn:hover { border-color: #3d322a; background: #221b17; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn svg { width: 16px; height: 16px; }

.btn.primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  border-color: transparent;
  color: #21160c;
  font-weight: 600;
}

.btn.primary:hover {
  background: linear-gradient(180deg, var(--accent-hot), var(--accent));
}

.btn.ghost { background: transparent; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.large { padding: 12px 26px; font-size: 15px; }

/* ---------- switch ---------- */

.switch {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
}

.switch input { position: absolute; opacity: 0; width: 0; height: 0; }

.track-sw {
  position: relative;
  width: 38px;
  height: 21px;
  border-radius: 999px;
  background: #2a221d;
  border: 1px solid var(--line);
  transition: background .2s, border-color .2s;
}

.track-sw::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #6d6058;
  transition: transform .2s, background .2s;
}

.switch input:checked + .track-sw {
  background: rgba(224, 164, 92, .28);
  border-color: rgba(224, 164, 92, .5);
}

.switch input:checked + .track-sw::after {
  transform: translateX(17px);
  background: var(--accent-hot);
}

.switch input:disabled + .track-sw { opacity: .5; cursor: not-allowed; }

.switch-label { font-size: 13.5px; color: var(--text-dim); }

/* ---------- rack ---------- */

.rack {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(272px, 1fr));
  gap: 18px;
}

.module { padding: 18px 20px 20px; display: flex; flex-direction: column; }

.module-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.module-head h3 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.module.off .knobs { opacity: .35; pointer-events: none; }
.module.off .meter { opacity: .35; }

.knobs {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 14px;
  transition: opacity .2s;
}

/* ---------- knob ---------- */

.knob {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  width: 62px;
  cursor: ns-resize;
  touch-action: none;
}

.knob-dial {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 38%, #2c2320, #17120f 70%);
  border: 1px solid #382d26;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, .6), 0 3px 8px rgba(0, 0, 0, .45);
  display: grid;
  place-items: center;
  transition: border-color .18s;
}

.knob:hover .knob-dial,
.knob.active .knob-dial { border-color: rgba(224, 164, 92, .5); }

.knob-dial::before {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  background: conic-gradient(from 220deg,
      var(--accent-deep) 0deg,
      var(--accent-hot) calc(var(--sweep) * 1deg),
      #241d19 calc(var(--sweep) * 1deg),
      #241d19 280deg,
      transparent 280deg);
  -webkit-mask: radial-gradient(circle, transparent 0 25px, #000 25px);
  mask: radial-gradient(circle, transparent 0 25px, #000 25px);
  transition: background .06s linear;
}

.knob-pointer {
  position: absolute;
  top: 7px;
  left: 50%;
  width: 2px;
  height: 15px;
  margin-left: -1px;
  border-radius: 2px;
  background: var(--accent-hot);
  transform-origin: 50% 19px;
}

.knob-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.knob-value {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11.5px;
  color: var(--text-dim);
  white-space: nowrap;
}

.knob.active .knob-value { color: var(--accent-hot); }

/* ---------- meter ---------- */

.meter {
  position: relative;
  margin-top: auto;
  padding-top: 16px;
  height: 10px;
  box-sizing: content-box;
}

.meter::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 10px;
  border-radius: 5px;
  background: var(--bg-sunken);
  border: 1px solid var(--line);
}

.meter-fill {
  position: absolute;
  left: 1px;
  bottom: 1px;
  height: 8px;
  width: 0;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--good), var(--accent-hot));
  transition: width .06s linear;
}

.meter-label {
  position: absolute;
  top: 0;
  left: 0;
  font-size: 10px;
  letter-spacing: .1em;
  color: var(--text-faint);
}

/* ---------- export ---------- */

.export {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  padding: 20px 22px;
}

.export-fields { display: flex; flex-wrap: wrap; gap: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; }

.field span {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.field select {
  appearance: none;
  padding: 9px 34px 9px 12px;
  min-width: 168px;
  border-radius: 10px;
  border: 1px solid var(--panel-edge);
  background: var(--bg-sunken)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 4.5 6 8.5 10 4.5' fill='none' stroke='%23a3948a' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E")
    no-repeat right 12px center / 12px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.field select:focus { outline: 1px solid rgba(224, 164, 92, .5); }

.export-action { display: flex; align-items: center; gap: 14px; }
.status { font-size: 12.5px; min-height: 1.2em; }
.status.error { color: #e08b7c; }
.status.done { color: var(--good); }

.hint {
  margin: 16px 0 0;
  font-size: 12.5px;
  color: var(--text-faint);
}

/* ---------- info sections ---------- */

.info { padding-top: 76px; }
.info h2 { font-size: 24px; margin-bottom: 22px; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(248px, 1fr));
  gap: 16px;
}

.card {
  padding: 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-edge);
  background: rgba(27, 22, 19, .5);
}

.card h3 { font-size: 15px; margin-bottom: 8px; }
.card p { margin: 0; font-size: 14px; color: var(--text-dim); }

.faq { display: grid; gap: 10px; }

.faq details {
  padding: 15px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-edge);
  background: rgba(27, 22, 19, .5);
}

.faq summary {
  cursor: pointer;
  font-weight: 500;
  list-style: none;
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::before {
  content: "+";
  display: inline-block;
  width: 18px;
  color: var(--accent);
  font-weight: 600;
}

.faq details[open] summary::before { content: "\2212"; }

.faq p {
  margin: 10px 0 0 18px;
  font-size: 14px;
  color: var(--text-dim);
}

/* ---------- footer ---------- */

.footer {
  border-top: 1px solid var(--line);
  padding: 26px clamp(18px, 4vw, 44px);
  text-align: center;
}

.footer p { margin: 0; font-size: 13px; color: var(--text-faint); }

@media (max-width: 620px) {
  .topnav { display: none; }
  .badge { margin-left: auto; }
  .export { flex-direction: column; align-items: stretch; }
  .export-action { justify-content: space-between; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto; }
}
