:root {
  --bg: #0b0f14;
  --bg2: #111821;
  --panel: #151e29;
  --line: #24313f;
  --text: #e7eef6;
  --muted: #8ea0b3;
  --fx: #3ef0c4;
  --rec: #ff4d5e;
  --db: #ffc857;
  --f0: #7aa2ff;
  --warn: #ffb04d;
  --danger: #ff6b7a;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 "Space Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background-image: radial-gradient(1200px 500px at 80% -10%, rgba(62,240,196,.08), transparent 60%),
                    radial-gradient(900px 400px at -10% 10%, rgba(122,162,255,.07), transparent 60%);
}
.mono { font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace; }
.small { font-size: 13px; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
button, input, select { font: inherit; color: inherit; }
button { touch-action: manipulation; }

.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between;
  padding: 12px max(16px, env(safe-area-inset-left)); background: rgba(11,15,20,.88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; gap: 12px; align-items: center; min-width: 0; }
.brand svg { width: 38px; height: 38px; flex: none; fill: none; stroke: var(--fx); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; background: var(--panel); border-radius: 10px; padding: 4px; }
.brand h1 { font-size: 19px; letter-spacing: .2px; }
.brand p { margin: 0; color: var(--muted); font-size: 13px; }
.steps { display: flex; gap: 6px; flex-wrap: wrap; }
.steps a {
  display: inline-flex; gap: 8px; align-items: center; padding: 6px 12px 6px 6px; border-radius: 999px;
  color: var(--muted); text-decoration: none; border: 1px solid var(--line); font-size: 14px;
}
.steps a b { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--line); color: var(--text); font-size: 13px; }
.steps a.done { color: var(--text); }
.steps a.done b { background: var(--fx); color: #04261d; }

main { max-width: 1120px; margin: 0 auto; padding: 8px 16px 40px; }
.step { padding: 28px 0 8px; border-bottom: 1px dashed var(--line); scroll-margin-top: 90px; }
.step[aria-disabled="true"] { opacity: .45; pointer-events: none; filter: saturate(.4); }
.step h2 { display: flex; align-items: center; gap: 12px; font-size: 26px; margin-bottom: 8px; }
.step h2 .n { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--fx); color: #04261d; font-size: 20px; }
.hint { color: var(--muted); margin: 6px 0 14px; max-width: 75ch; }
.hint strong, .hint b { color: var(--text); }

.msg {
  position: sticky; top: 74px; z-index: 9; max-width: 1088px; margin: 10px auto 0; padding: 12px 16px;
  border-radius: 10px; background: #2a1d10; border: 1px solid var(--warn); color: #ffe2bf;
}
.msg.err { background: #2a1116; border-color: var(--danger); color: #ffd6db; }
.msg.ok { background: #0f2a22; border-color: var(--fx); color: #c9fff0; }

.capture { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.rec {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  width: 150px; height: 150px; border-radius: 50%; border: 2px solid var(--line); background: var(--bg2); cursor: pointer;
  transition: transform .15s, border-color .15s, box-shadow .2s;
}
.rec:hover { border-color: var(--rec); }
.rec:active { transform: scale(.97); }
.rec .dot { width: 46px; height: 46px; border-radius: 50%; background: var(--rec); box-shadow: 0 0 0 0 rgba(255,77,94,.5); transition: border-radius .2s, width .2s, height .2s; }
.rec .lbl { font-weight: 700; font-size: 14px; text-align: center; padding: 0 10px; }
.rec[aria-pressed="true"] { border-color: var(--rec); box-shadow: 0 0 30px rgba(255,77,94,.25); }
.rec[aria-pressed="true"] .dot { width: 34px; height: 34px; border-radius: 6px; animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,77,94,.55); } 100% { box-shadow: 0 0 0 18px rgba(255,77,94,0); } }
.live { min-width: 0; }
.meter { position: relative; height: 16px; border-radius: 8px; background: linear-gradient(90deg, #1b5e4e 0 70%, #7a6a1a 70% 88%, #7a2530 88%); overflow: hidden; }
.meter #meterBar { position: absolute; inset: 0 auto 0 0; width: 0; background: rgba(255,255,255,.55); mix-blend-mode: overlay; transition: width .05s; }
.meter #meterPeak { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; left: 0; }
.live-row { display: flex; justify-content: space-between; margin: 6px 0; color: var(--muted); font-size: 13px; }
#liveWave { width: 100%; height: 60px; display: block; background: var(--bg2); border-radius: 8px; }
.alt-sources { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0 0; }
.file-btn { position: relative; display: inline-block; padding: 9px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); cursor: pointer; font-size: 14px; }
.file-btn:hover { border-color: var(--muted); }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.privacy { color: var(--muted); font-size: 13px; flex: 1 1 260px; }

.analysis { margin-top: 22px; }
.tl-head { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); }
.sw { display: inline-block; width: 12px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.sw-db { background: var(--db); } .sw-f0 { background: var(--f0); } .sw-spec { background: linear-gradient(90deg, #13324a, #3ef0c4); height: 10px; }
.timeline-wrap { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
#timeline { width: 100%; height: 300px; display: block; touch-action: none; cursor: crosshair; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.row-btns button, .seg button {
  padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); cursor: pointer; font-size: 14px;
}
.row-btns button:hover:not(:disabled) { border-color: var(--muted); }
button:disabled { opacity: .4; cursor: not-allowed; }
button.primary { background: var(--fx); color: #04261d; border-color: var(--fx); font-weight: 700; }
button.danger { border-color: #5a2630; color: #ffb3bd; }
.note { padding: 10px 14px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); color: var(--muted); font-size: 14px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 14px 0 6px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.card h4 { margin: 0 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); font-weight: 500; }
.card .v { font-family: "JetBrains Mono", monospace; font-size: 20px; font-weight: 600; overflow-wrap: anywhere; }
.card .v.nd { color: var(--muted); font-size: 16px; font-weight: 400; font-style: italic; }
.card .s { color: var(--muted); font-size: 13px; margin-top: 2px; }
.conf { height: 6px; border-radius: 3px; background: var(--line); margin-top: 8px; overflow: hidden; }
.conf i { display: block; height: 100%; background: var(--f0); }
.dist { display: flex; align-items: flex-end; gap: 3px; height: 54px; margin-top: 6px; }
.dist i { flex: 1; background: linear-gradient(0deg, #1b6f5c, var(--fx)); border-radius: 2px 2px 0 0; min-height: 2px; }
.dist-l { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.card.wide { grid-column: span 2; }

.styles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 6px 0 16px; }
.style {
  text-align: left; padding: 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); cursor: pointer;
  display: flex; flex-direction: column; gap: 4px; min-height: 104px; transition: border-color .15s, transform .1s;
}
.style:hover { border-color: var(--muted); }
.style:active { transform: scale(.98); }
.style .ic { font-size: 24px; line-height: 1; }
.style b { font-size: 15px; }
.style span { color: var(--muted); font-size: 12.5px; }
.style[aria-checked="true"] { border-color: var(--fx); background: linear-gradient(180deg, rgba(62,240,196,.12), var(--panel)); box-shadow: inset 0 0 0 1px var(--fx); }

.transform-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 14px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.panel h3 { font-size: 16px; margin-bottom: 10px; }
.panel-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.panel-head h3 { margin: 0; }
.sliders { display: grid; gap: 4px; }
.slider { display: grid; grid-template-columns: 9.5em 1fr 4.5em; gap: 10px; align-items: center; min-height: 40px; }
.slider label { font-size: 14px; }
.slider output { text-align: right; font-size: 13px; color: var(--muted); }
input[type=range] { width: 100%; accent-color: var(--fx); height: 28px; touch-action: pan-y; }
.check { display: flex; gap: 10px; align-items: center; margin: 12px 0 4px; font-size: 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--fx); }
.check.big { font-size: 16px; font-weight: 700; margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; padding: 7px 12px; font-size: 13px; }
.seg button[aria-selected="true"] { background: var(--f0); color: #071233; font-weight: 700; }
#curve { width: 100%; height: 200px; display: block; background: var(--bg2); border-radius: 10px; touch-action: none; cursor: crosshair; }
.listen, .charge { margin-top: 14px; }
#effectWave { width: 100%; height: 90px; display: block; background: var(--bg2); border-radius: 10px; }
.parts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
.parts div { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.parts b { display: block; font-size: 12px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .6px; }
.hold {
  width: 100%; padding: 22px; border-radius: 14px; border: 2px dashed var(--fx); background: rgba(62,240,196,.06); cursor: pointer;
  font-weight: 700; font-size: 17px; user-select: none; -webkit-user-select: none; touch-action: none; -webkit-touch-callout: none;
}
.hold.on { background: var(--fx); color: #04261d; border-style: solid; }

.name-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 8px 0 14px; }
.name-row input { padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg2); min-width: 0; flex: 0 1 280px; }
.exports { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.exports button {
  text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel); cursor: pointer;
}
.exports button:hover:not(:disabled) { border-color: var(--fx); }
.exports b { font-size: 15px; }
.exports span { color: var(--muted); font-size: 13px; }
.code-preview { margin-top: 14px; }
.code-preview summary { cursor: pointer; color: var(--muted); }
.code-preview pre { max-height: 360px; overflow: auto; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 12px; white-space: pre; }
.foot { max-width: 1120px; margin: 0 auto; padding: 20px 16px 40px; color: var(--muted); font-size: 13px; }

@media (max-width: 900px) {
  .styles { grid-template-columns: repeat(3, 1fr); }
  .transform-grid { grid-template-columns: 1fr; }
  .exports { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .top { position: static; }
  .msg { top: 8px; }
  .brand p { display: none; }
  .capture { grid-template-columns: 1fr; justify-items: center; }
  .live { width: 100%; }
  .rec { width: 130px; height: 130px; }
  .styles { grid-template-columns: repeat(2, 1fr); }
  .slider { grid-template-columns: 1fr 4em; }
  .slider label { grid-column: 1 / -1; }
  .slider input { grid-column: 1; }
  .parts { grid-template-columns: repeat(2, 1fr); }
  .exports { grid-template-columns: 1fr; }
  .card.wide { grid-column: auto; }
  .step h2 { font-size: 22px; }
  #timeline { height: 240px; }
}
