:root {
  color-scheme: dark;
  --bg: #0e0e13;
  --panel: #15151d;
  --line: #2b2934;
  --ink: #f4eee8;
  --muted: #ada7b4;
  --accent: #ff916d;
  --accent-hot: #ff835c;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --serif: Georgia, "Times New Roman", serif;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 290px; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { color: #746f7d; cursor: default; }
a { color: inherit; }
svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 1.55; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.shell { width: min(100% - 104px, 1420px); margin-inline: auto; }
.masthead { border-bottom: 1px solid #24232b; }
.masthead-inner { height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.wordmark { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); font: 650 .75rem/1.12 var(--mono); letter-spacing: .13em; text-decoration: none; }
.wordmark svg { color: var(--accent); width: 32px; height: 32px; }
nav { display: flex; align-items: center; gap: 26px; }
.nav-link, nav a { padding: 10px 0; border: 0; background: none; text-decoration: none; color: var(--muted); font-size: .9rem; white-space: nowrap; }
nav a.nav-current { color: var(--ink); }
nav a:hover, .nav-link:hover, .text-button:not(:disabled):hover { color: var(--accent); }
#collection-count { display: inline-block; padding: 1px 5px; margin-left: 3px; border: 1px solid #3a3544; border-radius: 4px; color: var(--accent); font: .75rem/1.25 var(--mono); }
.intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 15px; padding: 31px 0 29px; }
h1 { font: 400 clamp(3rem, 5.5vw, 6rem)/1.05 var(--serif); letter-spacing: -.073em; margin: 0; }
h1 em { margin-left: .075em; font-weight: 400; letter-spacing: -.078em; color: var(--accent); }
.intro p { margin: 13px 0 0; font-size: 1rem; color: var(--muted); line-height: 1.55; }
.sound { background: #15141b; border: 1px solid var(--line); border-radius: 6px; min-height: 40px; display: flex; align-items: center; gap: 9px; padding: 0 12px; margin-bottom: 2px; color: var(--muted); font-size: .88rem; white-space: nowrap; }
.sound svg { color: var(--accent); width: 17px; height: 17px; }
.sound:hover, .sound[aria-pressed="true"] { color: var(--ink); border-color: #795647; }
.studio-grid { display: grid; grid-template-columns: minmax(0, 1fr) 318px; gap: 18px; align-items: stretch; }
.field-panel { display: flex; flex-direction: column; min-width: 0; border: 1px solid #3b3040; border-radius: 12px; overflow: hidden; background: #12121b; }
.stage { position: relative; flex: 1; min-height: 350px; background: #110e19; isolation: isolate; }
#field { display: block; width: 100%; height: 100%; position: absolute; inset: 0; touch-action: none; cursor: crosshair; }
#field:focus-visible { outline-offset: -3px; }
.stage-label, .seed-label, .stage-metrics { position: absolute; font: .75rem/1 var(--mono); letter-spacing: .08em; pointer-events: none; }
.stage-label { top: 17px; left: 17px; display: flex; align-items: center; gap: 8px; color: #e3cbd1; background: #15111de8; border: 1px solid #433644; border-radius: 5px; padding: 10px 11px; text-transform: uppercase; }
.field-dot { width: 6px; height: 6px; border-radius: 50%; background: #f79a77; box-shadow: 0 0 8px #d66b58; }
.seed-label { top: 24px; right: 21px; color: #b5a4b5; }
.seed-label span { color: #eee0df; }
.stage-metrics { bottom: 18px; right: 20px; color: #b5a4b5; }
.stage-metrics strong { color: #eee0df; font-weight: 400; }
.field-toolbar { min-height: 55px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid #322c3b; background: #15141d; padding: 5px 11px 5px 17px; }
.field-toolbar p { margin: 0; color: var(--muted); font-size: .87rem; line-height: 1.4; }
.field-actions { display: flex; align-items: center; gap: 4px; }
.icon-button { display: inline-grid; place-items: center; width: 40px; height: 40px; background: transparent; border: 1px solid transparent; border-radius: 6px; color: #d4c9d7; }
.icon-button:hover { background: #231e2a; border-color: #403343; color: var(--accent); }
.control-panel { min-width: 0; border: 1px solid var(--line); border-radius: 12px; padding: 20px 21px; background: var(--panel); display: flex; flex-direction: column; }
.control-heading { display: flex; align-items: center; justify-content: space-between; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.control-heading h2 { font: 400 1.65rem/1 var(--serif); letter-spacing: -.035em; margin: 0; }
.instrument-glyph { color: var(--accent); }
.control-group { border: 0; padding: 0; margin: 0; min-width: 0; }
.control-group legend, .slider label { color: #ddd4de; font-size: .88rem; font-weight: 540; }
.control-group legend { padding: 0 0 9px; }
.segments { display: flex; background: #111118; border: 1px solid #302c38; border-radius: 7px; padding: 3px; gap: 3px; }
.segments label { position: relative; flex: 1; min-width: 0; cursor: pointer; }
.segments input { opacity: 0; margin: 0; position: absolute; inset: 0; height: 100%; width: 100%; cursor: pointer; }
.segments span { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 34px; padding: 2px 4px; border-radius: 4px; color: #bdb4c1; border: 1px solid transparent; font-size: .875rem; }
.segments span svg { width: 15px; height: 15px; }
.segments label:hover span { color: var(--ink); }
.segments input:checked + span { color: #ffb59d; background: #38252b; border-color: #61404a; }
.segments input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.sliders { display: grid; gap: 11px; margin: 18px 0 15px; }
.slider > div { display: flex; justify-content: space-between; align-items: center; }
.slider output { color: #ffc2ae; font: .81rem var(--mono); }
.slider input { appearance: none; width: 100%; cursor: pointer; margin: 2px 0 0; display: block; height: 21px; background: transparent; --fill: 0%; }
.slider input::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: linear-gradient(to right, #e88264 var(--fill), #3a3343 var(--fill)); }
.slider input::-moz-range-track { height: 3px; border-radius: 3px; background: linear-gradient(to right, #e88264 var(--fill), #3a3343 var(--fill)); }
.slider input::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; margin-top: -4.5px; border-radius: 50%; border: 1px solid #f8c6b5; background: #fb936f; }
.slider input::-moz-range-thumb { width: 11px; height: 11px; border-radius: 50%; border: 1px solid #f8c6b5; background: #fb936f; }
.tool-group { border-top: 0; }
.text-button { border: 0; background: transparent; color: #c7a69f; padding: 4px 0; font-size: .88rem; text-underline-offset: 3px; text-decoration: underline; }
#clear { margin-top: 6px; }
.run-actions { display: flex; gap: 8px; padding-top: 15px; margin-top: auto; }
.primary, .seed-button { min-height: 45px; border-radius: 6px; }
.primary { flex: 1; min-width: 0; display: flex; gap: 8px; align-items: center; background: var(--accent-hot); border: 1px solid #ffa78a; color: #231116; font-weight: 700; padding: 0 11px; }
.primary:hover { background: #ffac91; }
.primary svg { width: 17px; height: 17px; }
kbd { font: .7rem var(--mono); margin-left: auto; padding: 3px 5px; border: 1px solid #67352885; border-radius: 4px; }
.seed-button { display: grid; place-items: center; width: 45px; border: 1px solid #3e3544; background: #1e1a25; color: #d1becd; }
.seed-button:hover { color: var(--accent); border-color: #795647; }
.footer { margin-top: 21px; padding: 0 0 21px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; color: var(--muted); font-size: .88rem; }
.footer p { margin: 0; line-height: 1.55; }
.footer .text-button { text-align: right; }
dialog { width: min(630px, 100% - 32px); max-height: min(84vh, 760px); overflow: auto; padding: 22px 27px 27px; border: 1px solid #4d3b4e; border-radius: 12px; background: #18151f; color: var(--ink); box-shadow: 0 22px 80px #0009; }
dialog::backdrop { background: #0a080ec9; backdrop-filter: blur(4px); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-bottom: 1px solid #3c303f; padding-bottom: 10px; }
.dialog-head h2 { font: 400 2.3rem/1.1 var(--serif); letter-spacing: -.055em; margin: 0; }
dialog p { color: #d3c7d4; line-height: 1.65; font-size: 1rem; }
dialog h3 { color: #f4d6ca; font-size: 1rem; padding-top: 7px; }
dialog .source, .collection-intro { font-size: .88rem; color: var(--muted); border-top: 1px solid #3c303f; padding-top: 13px; }
.collection-intro { border-top: 0; padding-top: 0; }
#collection-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
#collection-list > p { grid-column: 1 / -1; margin-bottom: 0; }
.study { overflow: hidden; border: 1px solid #443449; border-radius: 8px; background: #110f18; }
.study img { display: block; width: 100%; aspect-ratio: 1200/715; object-fit: cover; }
.study-body { padding: 10px 12px; }
.study-body h3 { margin: 0; padding: 0; color: var(--ink); font: 400 1.1rem var(--serif); }
.study-body p { margin: 4px 0; font: .75rem var(--mono); }
.study-actions { display: flex; justify-content: space-between; }
.notice { position: fixed; bottom: 22px; right: 22px; z-index: 2; max-width: min(350px, 100% - 44px); pointer-events: none; border-radius: 7px; font-size: .9rem; }
.notice:not(:empty) { padding: 12px 16px; border: 1px solid #765346; background: #251c27; color: #ffd9cb; box-shadow: 0 8px 30px #0008; }
@media (min-width: 1500px) { .stage { min-height: 590px; } }
@media (max-width: 1050px) { .shell { width: calc(100% - 48px); } .studio-grid { grid-template-columns: minmax(0,1fr) 264px; gap: 13px; } .control-panel { padding: 17px; } }
@media (max-width: 740px) {
  .studio-grid { grid-template-columns: 1fr; }
  .stage { min-height: 0; aspect-ratio: 1.55; }
  .control-panel { padding: 18px; }
  .masthead-inner { height: 64px; }
  nav { gap: 16px; }
  .intro { padding-top: 25px; padding-bottom: 22px; }
}
@media (max-width: 480px) {
  .shell { width: calc(100% - 28px); }
  .wordmark { gap: 6px; font-size: .65rem; }
  .wordmark svg { width: 25px; height: 25px; }
  nav { gap: 12px; }
  .nav-link, nav a { font-size: .81rem; }
  nav .nav-current { display: none; }
  .intro { align-items: flex-start; flex-direction: column; gap: 10px; }
  .intro p { margin-top: 10px; }
  h1 { font-size: clamp(2.6rem, 11.6vw, 4.5rem); }
  .sound { min-height: 34px; }
  .stage { aspect-ratio: 1.28; }
  .stage-label { top: 10px; left: 10px; font-size: .65rem; padding: 7px; }
  .seed-label { top: 16px; right: 12px; font-size: .65rem; }
  .stage-metrics { bottom: 13px; right: 12px; font-size: .65rem; }
  .field-toolbar { padding-left: 10px; padding-right: 5px; }
  .field-toolbar p { font-size: .8rem; }
  .field-actions { gap: 0; }
  .field-actions button { width: 33px; }
  .footer { margin-top: 15px; }
  dialog { padding: 16px; }
}

.export-options { display: grid; gap: 10px; padding-top: 17px; }
.export-option { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border: 1px solid #473643; border-radius: 7px; background: #201922; text-align: left; }
.export-option:hover { border-color: var(--accent); }
.export-option strong, .export-option small { display: block; }
.export-option strong { font-weight: 600; }
.export-option small { color: var(--muted); margin-top: 5px; font: .78rem/1.4 var(--mono); }
.export-option svg { color: var(--accent); }
[hidden] { display: none !important; }
#checkout-message { margin: 0; font-size: .88rem; color: #ffc4b0; }
#license-tools { padding-top: 6px; }
#restore-license { margin-top: 8px; font-size: .88rem; color: var(--muted); }
#restore-license > div { margin-top: 5px; display: flex; gap: 7px; }
#license-code, #restore-license button { min-height: 36px; padding: 5px 9px; border: 1px solid #564250; border-radius: 5px; background: #14101a; color: var(--ink); }
#license-code { flex: 1; min-width: 0; }
#restore-license button:hover { border-color: var(--accent); }
.analysis-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 7px 14px; min-height: 43px; padding: 5px 17px; border-top: 1px solid #322c3b; background: #15141d; }
.trace-comparison { display: flex; gap: 9px 14px; align-items: center; flex-wrap: wrap; }
#comparison-details, #receiver-readout { font: .72rem/1.2 var(--mono); color: #a9cddb; }
#receiver-readout { display: flex; align-items: center; gap: 8px; }
#receiver-readout meter { width: 62px; height: 12px; }
.field-tools-extra { display: flex; gap: 7px; margin-top: 7px; }
.mode-toggle { position: relative; flex: 1; }
.mode-toggle > input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; margin: 0; }
.mode-toggle > span { display: block; padding: 7px 5px; border: 1px solid #383040; border-radius: 5px; text-align: center; color: #cabfcd; font-size: .84rem; background: #14131a; }
.mode-toggle > input:checked + span, .mode-toggle:hover > span { border-color: #746073; color: #f3d7d0; }
.mode-toggle > input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.receiver-gain { padding-top: 10px; }
