:root {
  color-scheme: dark;
  --bg: #0b0c0f;
  --panel: #111318;
  --panel-2: #171a21;
  --panel-3: #1f232c;
  --text: #f4f7fb;
  --muted: #8e98a7;
  --line: #2a303a;
  --accent: #54f0c2;
  --accent-2: #ffcc66;
  --danger: #ff5f57;
  --shadow: 0 18px 70px rgba(0,0,0,.38);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
button, select, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .72; transform: none; }
.app-shell { width: min(1180px, calc(100vw - 32px)); margin: 0 auto; padding: 24px 0 40px; position: relative; }
.topbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; }
.eyebrow { margin: 0 0 6px; color: var(--accent); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(34px, 5vw, 56px); line-height: 1; letter-spacing: 0; }
.top-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.intro-btn { border: 2px solid rgba(255,204,102,.92); background: #171a21; color: #ffe0a3; font-weight: 900; box-shadow: 0 0 0 3px rgba(255,204,102,.14), inset 0 0 0 1px rgba(255,204,102,.28); white-space: nowrap; }
.ghost.intro-btn:hover { border-color: rgba(255,204,102,.72); background: #1b1f27; color: #ffe0a3; box-shadow: inset 0 0 0 1px rgba(255,204,102,.18); transform: none; }
.quick-setup-btn { border-color: rgba(84,240,194,.52); color: var(--accent); font-weight: 900; white-space: nowrap; }
.quick-setup-btn:hover { border-color: rgba(84,240,194,.78); background: #12191a; transform: none; }
.panel { background: rgba(17,19,24,.92); border: 1px solid var(--line); border-radius: 8px; padding: 18px; box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.routing-card { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.1fr) minmax(132px, .42fr) minmax(132px, .42fr); gap: 12px; margin-bottom: 14px; }
.field { display: grid; gap: 7px; }
label { color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
select { width: 100%; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 11px 12px; outline: none; }
select:focus, button:focus-visible, input:focus-visible, .knob:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.status-row { display: flex; align-items: center; gap: 10px; margin: 14px 0; flex-wrap: wrap; }
.power, .primary, .ghost { border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; color: var(--text); background: var(--panel-2); min-height: 42px; }
.power { min-width: 92px; font-weight: 800; background: var(--accent); color: #04100d; border-color: transparent; }
.power.active { background: var(--danger); color: white; }
.primary { background: var(--text); color: #080a0d; border: none; font-weight: 700; }
.ghost:hover, .primary:hover, .power:hover { border-color: rgba(255,255,255,.38); transform: translateY(-1px); }
button:disabled:hover { border-color: var(--line); transform: none; }
.run-status { min-height: 42px; display: flex; align-items: center; gap: 12px; padding: 0 12px; border: 1px solid var(--line); border-radius: 6px; background: #0c0e12; color: var(--muted); font-size: 11px; letter-spacing: .08em; white-space: nowrap; }
.run-status strong { color: var(--text); font-size: 12px; letter-spacing: .1em; }
.run-status[data-state="starting"] strong { color: var(--accent-2); }
.run-status[data-state="live"] strong { color: var(--accent); }
.run-status[data-state="error"] strong { color: var(--danger); }
.meter-wrap { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 240px; color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.meter-wrap span { white-space: nowrap; }
.meter { flex: 1; height: 9px; background: #090a0d; border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
#meterBar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; transition: width .08s linear; }
#meterBar.clipping { background: linear-gradient(90deg, var(--danger), var(--accent-2)); }
.clip-warning { min-height: 42px; min-width: 54px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid rgba(255,95,87,.58); border-radius: 6px; background: rgba(255,95,87,.12); color: #ffc0bc; font-size: 11px; font-weight: 900; letter-spacing: .1em; }
.analyzer-panel { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #0c0d10; margin-bottom: 14px; }
#analyzerCanvas { display: block; width: 100%; height: 170px; }
.knob-grid { display: grid; grid-template-columns: repeat(3, minmax(168px, 1fr)); gap: 12px; }
.knob-card { background: linear-gradient(180deg, #171a21, #101217); border: 1px solid var(--line); border-radius: 8px; padding: 15px; display: grid; gap: 12px; min-height: 218px; transition: border-color .15s ease, opacity .15s ease; }
.knob-card.bypassed { opacity: .58; }
.knob-card.bypassed .knob { cursor: not-allowed; }
.knob-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; min-height: 22px; }
.knob-name { font-weight: 900; letter-spacing: .08em; font-size: 13px; }
.knob-state { border: 1px solid rgba(84,240,194,.45); color: var(--accent); background: transparent; border-radius: 999px; padding: 3px 8px; font-size: 10px; font-weight: 800; min-height: 0; line-height: 1.2; }
.knob-state.off { border-color: rgba(255,255,255,.18); color: var(--muted); }
.knob-state:hover { border-color: rgba(255,255,255,.38); transform: none; }
.knob-detail { justify-self: start; border: 1px solid rgba(255,204,102,.36); color: var(--accent-2); background: rgba(255,204,102,.06); border-radius: 6px; padding: 6px 9px; font-size: 10px; font-weight: 900; letter-spacing: .1em; min-height: 0; line-height: 1; }
.knob-detail:hover { border-color: rgba(255,204,102,.7); transform: none; }
.knob { justify-self: center; width: 124px; height: 124px; border-radius: 50%; background: radial-gradient(circle at 34% 28%, #ffffff, #d8dde4 31%, #6f7784 63%, #161a21 100%); border: 8px solid #090b0f; box-shadow: inset 0 -12px 22px rgba(0,0,0,.36), 0 13px 26px rgba(0,0,0,.34); position: relative; cursor: grab; touch-action: none; }
.knob:active { cursor: grabbing; }
.knob::after { content: ""; position: absolute; inset: -14px; border-radius: 50%; border: 1px solid rgba(84,240,194,.22); }
.knob-pointer { position: absolute; inset: 0; transform: rotate(var(--angle)); }
.knob-pointer::before { content: ""; position: absolute; width: 8px; height: 39px; border-radius: 999px; background: #050608; left: 50%; top: 12px; transform: translateX(-50%); }
.knob-control { display: grid; grid-template-columns: 1fr 48px; gap: 10px; align-items: center; }
.knob-input { width: 100%; accent-color: var(--accent); }
.knob-value { color: var(--muted); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.empty-state { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: #0c0e12; padding: 18px; text-align: center; font-size: 13px; }
.hint { margin: 18px 2px 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.site-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 16px 2px 0; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.site-footer a { color: var(--accent); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.banner { margin-bottom: 12px; padding: 13px 14px; border: 1px solid rgba(255,204,102,.42); background: rgba(255,204,102,.08); color: #ffe0a3; border-radius: 6px; line-height: 1.6; }
.banner[data-tone="error"] { border-color: rgba(255,95,87,.48); background: rgba(255,95,87,.08); color: #ffc0bc; }
.hidden { display: none !important; }
.modal { width: min(760px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--text); padding: 0; box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(0,0,0,.68); backdrop-filter: blur(6px); }
.modal-card { max-height: inherit; overflow: auto; padding: 20px; }
.modal-card header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
h2 { margin: 0; font-size: 23px; letter-spacing: 0; }
h3 { margin: 18px 0 6px; font-size: 16px; }
.muted, .help-card p, .help-card li { color: var(--muted); line-height: 1.75; }
.help-card ul, .help-card ol { padding-left: 1.25rem; }
.help-card strong { color: var(--text); }
.help-section { padding-top: 2px; }
.help-section + .help-section { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.help-card h3 { margin: 0 0 10px; font-size: 15px; letter-spacing: .02em; }
.help-card h4 { margin: 0 0 6px; color: var(--text); font-size: 13px; letter-spacing: .02em; }
.help-hero { border: 1px solid rgba(255,204,102,.46); border-radius: 8px; background: rgba(255,204,102,.08); padding: 13px 14px; }
.help-hero strong { display: block; color: #ffe0a3; font-size: 14px; }
.help-hero p { margin: 6px 0 0; }
.help-step-grid, .help-info-grid, .trouble-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.help-info-grid, .trouble-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.help-step-grid article, .help-info-grid article, .trouble-grid article { border: 1px solid var(--line); border-radius: 8px; background: #0c0e12; padding: 13px; }
.help-step-grid article { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: start; }
.help-step-grid b { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: rgba(84,240,194,.12); color: var(--accent); font-size: 12px; }
.help-step-grid strong { align-self: center; font-size: 13px; }
.help-step-grid span { grid-column: 2; color: var(--muted); line-height: 1.55; font-size: 13px; }
.help-info-grid p, .trouble-grid p { margin: 0; }
.help-info-grid p + p, .trouble-grid p + p { margin-top: 8px; }
.knob-help-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.knob-help-list span { border: 1px solid rgba(255,255,255,.08); border-radius: 6px; background: rgba(255,255,255,.03); padding: 9px 10px; color: var(--muted); line-height: 1.5; font-size: 12px; }
.knob-help-list strong { display: block; color: var(--accent); font-size: 11px; letter-spacing: .08em; }
.help-note { margin: 12px 0 0; color: #ffe0a3 !important; font-size: 13px; }
.help-card details { border: 1px solid var(--line); border-radius: 8px; background: #0c0e12; padding: 0; overflow: hidden; }
.help-card details + details { margin-top: 10px; }
.help-card summary { list-style: none; cursor: pointer; padding: 13px 14px; color: var(--text); font-weight: 900; border-bottom: 1px solid transparent; }
.help-card summary::-webkit-details-marker { display: none; }
.help-card summary::after { content: "+"; float: right; color: var(--accent-2); }
.help-card details[open] summary { border-bottom-color: var(--line); }
.help-card details[open] summary::after { content: "-"; }
.help-card details ol { margin: 12px 14px 14px; }
.setup-accordion { display: grid; gap: 10px; margin-top: 12px; }
.quick-setup-modal { width: min(720px, calc(100vw - 28px)); }
.quick-tone-grid { display: grid; grid-template-columns: repeat(2, minmax(180px, 1fr)); gap: 10px; margin-top: 12px; }
.quick-tone-grid button { display: grid; gap: 5px; align-content: start; text-align: left; border: 1px solid rgba(84,240,194,.42); border-radius: 8px; background: #0c0e12; color: var(--text); min-height: 76px; padding: 12px 13px; font-weight: 900; }
.quick-tone-grid button strong { color: var(--text); font-size: 13px; line-height: 1.35; }
.quick-tone-grid button span { color: var(--muted); font-size: 12px; font-weight: 600; line-height: 1.5; }
.quick-tone-grid button:hover { border-color: rgba(84,240,194,.78); background: #12161c; transform: none; }
.quick-tone-status { min-height: 22px; color: var(--accent) !important; margin: 10px 0 0; font-size: 13px; }
.icon-btn { border: 1px solid var(--line); background: var(--panel-2); color: var(--text); border-radius: 50%; width: 36px; height: 36px; }
.settings-list { display: grid; gap: 10px; margin-top: 12px; }
.setting-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; padding: 13px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); }
.setting-item input { margin-top: 3px; accent-color: var(--accent); }
.setting-item strong { display: block; margin-bottom: 4px; color: var(--text); }
.setting-item p { margin: 0; color: var(--muted); line-height: 1.55; text-transform: none; letter-spacing: 0; }
.setting-item em { color: var(--accent); font-style: normal; font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.analyzer-setting { margin-top: 14px; }
menu { display: flex; justify-content: flex-end; gap: 10px; padding: 0; margin: 18px 0 0; }
.warning-box { border: 1px solid rgba(255,204,102,.42); background: rgba(255,204,102,.07); padding: 2px 14px 12px; border-radius: 6px; margin-top: 16px; }
.notice-modal { width: min(680px, calc(100vw - 28px)); }
.notice-card header { margin-bottom: 8px; }
.notice-list { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 10px; }
.notice-list li { display: grid; gap: 4px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 6px; background: #0c0e12; }
.notice-list strong { color: var(--text); font-size: 13px; }
.notice-list span { color: var(--muted); line-height: 1.65; font-size: 13px; }
.notice-note { margin: 14px 0 0; color: #ffe0a3; font-size: 13px; line-height: 1.65; }
.reverb-detail-modal { width: min(880px, calc(100vw - 28px)); }
.reverb-detail-card { display: grid; gap: 14px; }
.reverb-eq-stage { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #111217; }
#reverbEqCanvas { display: block; width: 100%; height: 300px; cursor: crosshair; touch-action: none; }
.reverb-band-bar { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.reverb-band-list { display: flex; gap: 8px; flex-wrap: wrap; }
.reverb-band-chip { border: 1px solid var(--line); border-radius: 999px; background: #0c0e12; color: var(--muted); padding: 7px 10px; min-height: 0; font-size: 11px; font-weight: 900; line-height: 1; }
.reverb-band-chip.active { border-color: rgba(84,240,194,.72); color: var(--accent); background: rgba(84,240,194,.08); }
.reverb-band-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.reverb-band-actions .ghost { min-height: 34px; padding: 7px 10px; font-size: 12px; }
.reverb-detail-controls { display: grid; grid-template-columns: repeat(3, minmax(130px, 1fr)); gap: 12px; align-items: stretch; }
.detail-knob { position: relative; display: grid; justify-items: center; gap: 8px; padding: 14px 12px; border: 1px solid var(--line); border-radius: 8px; background: #0c0e12; text-transform: none; letter-spacing: 0; }
.detail-knob span:first-child { color: var(--muted); font-size: 11px; font-weight: 900; letter-spacing: .12em; }
.detail-dial { width: 88px; height: 88px; border-radius: 50%; background: radial-gradient(circle at 34% 28%, #f4f6f8, #aeb5bf 42%, #303642 100%); border: 7px solid #07090d; box-shadow: inset 0 -9px 18px rgba(0,0,0,.4), 0 10px 24px rgba(0,0,0,.35); position: relative; cursor: grab; touch-action: none; user-select: none; }
.detail-dial:active { cursor: grabbing; }
.detail-dial:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 4px; }
.detail-dial i { position: absolute; inset: 0; transform: rotate(var(--angle)); }
.detail-dial i::before { content: ""; position: absolute; left: 50%; top: 9px; width: 5px; height: 27px; border-radius: 999px; background: #050608; transform: translateX(-50%); }
.detail-knob input { width: min(130px, 100%); accent-color: var(--accent-2); }
.detail-value { color: var(--text); font-style: normal; font-size: 13px; font-variant-numeric: tabular-nums; }
.reverb-detail-note { margin: 0; font-size: 13px; }

@media (max-width: 860px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .routing-card { grid-template-columns: 1fr; }
  .knob-grid { grid-template-columns: 1fr 1fr; }
  .help-step-grid, .help-info-grid, .trouble-grid, .knob-help-list { grid-template-columns: 1fr; }
  #reverbEqCanvas { height: 240px; }
}

@media (max-width: 560px) {
  .app-shell { width: min(100vw - 18px, 1180px); padding-top: 12px; }
  .panel { padding: 12px; }
  #analyzerCanvas { height: 136px; }
  .knob-grid { grid-template-columns: 1fr; }
  .knob-card { min-height: 212px; }
  .run-status { flex: 1; justify-content: space-between; min-width: 180px; }
  .meter-wrap { min-width: 100%; }
  .setting-item { grid-template-columns: auto 1fr; }
  .setting-item em { grid-column: 2; }
  .site-footer { align-items: flex-start; flex-direction: column; }
  .quick-tone-grid { grid-template-columns: 1fr; }
  .reverb-band-bar { align-items: stretch; flex-direction: column; }
  .reverb-detail-controls { grid-template-columns: 1fr; }
  #reverbEqCanvas { height: 220px; }
}
