/* ═══════════════════════════════════════════════════
   DROP//DESTINY — styles.css
   1. CSS 变量  2. 全局重置  3. 布局  4. Intro
   5. 选项卡  6. DNA 条  7. 宏观控制  8. Pattern 编辑器
   9. 结算页  10. 动画  11. 响应式  12. reduced-motion
   ═══════════════════════════════════════════════════ */

/* ── 1. CSS 变量 ──────────────────────────────────── */
:root {
  --bg: #D72F19;
  --bg-panel: #050505;
  --bg-card: #17110c;
  --bg-card-hover: #29160d;
  --bg-card-active: #38130a;
  --text: #F4E7C8;
  --text-dim: #BFA98B;
  --text-bright: #ffffff;
  --accent: #FFCE00;
  --accent-2: #D72F19;
  --accent-3: #FFFFFF;
  --accent-4: #FF6A00;
  --danger: #FF3217;
  --border: #5B1B0E;
  --radius: 3px;
  --radius-sm: 2px;
  --transition: 0.2s ease;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", Consolas, monospace;
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 0 2px #000, 0 0 0 4px rgba(255,206,0,0.72);
}

/* ── 2. 全局重置 ──────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background-color: var(--bg);
  background-image:
    linear-gradient(115deg, rgba(0,0,0,0.09) 25%, transparent 25% 75%, rgba(0,0,0,0.09) 75%),
    repeating-linear-gradient(0deg, transparent 0 7px, rgba(0,0,0,0.035) 8px);
  background-size: 44px 44px, auto;
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

button {
  font-family: var(--font);
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── 3. 布局 ──────────────────────────────────────── */

/* ── Music Workbench ─────────────────────────────── */
.workbench {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  margin-bottom: 12px;
  animation: slideUp 0.3s ease;
}

.wb-play-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  touch-action: manipulation;
}

.wb-play-btn:hover {
  opacity: 0.85;
  transform: scale(1.05);
}

.wb-play-btn:active {
  transform: scale(0.95);
}

.wb-play-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.wb-play-btn .wb-icon-pause { display: none; }
.wb-play-btn.playing .wb-icon-play { display: none; }
.wb-play-btn.playing .wb-icon-pause { display: inline; }

.wb-info {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  min-width: 90px;
}

.wb-bpm {
  color: var(--accent);
  font-weight: 600;
}

.wb-sep {
  color: var(--border);
}

.wb-position {
  color: var(--text);
}

.wb-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #05050b;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1640px;
  margin: 0 auto;
  padding: 0 20px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  gap: 12px;
}

.logo {
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 1px;
  color: var(--accent);
  white-space: nowrap;
}

.progress-dots {
  display: flex;
  gap: 8px;
  align-items: center;
}

.progress-dots .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  transition: var(--transition);
}

.progress-dots .dot.active {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.progress-dots .dot.done {
  background: var(--accent-4);
}

.mute-btn {
  font-size: 1.2rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  transition: var(--transition);
}

.mute-btn:hover {
  background: var(--bg-card-hover);
}

.mute-btn .icon-off { display: none; }
.mute-btn.muted .icon-on { display: none; }
.mute-btn.muted .icon-off { display: inline; }

.studio-shell {
  flex: 1;
  min-width: 0;
}

#app.visual-active .studio-shell {
  display: grid;
  grid-template-columns: minmax(520px, 1.62fr) minmax(390px, 0.9fr);
  gap: 18px;
  align-items: start;
}

main {
  flex: 1;
  position: relative;
  padding-bottom: 80px;
  min-width: 0;
}

#app.visual-active main {
  max-height: calc(100vh - 154px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  padding: 18px 18px 92px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(18,18,30,0.96), rgba(9,9,17,0.92));
  box-shadow: 0 18px 50px rgba(0,0,0,0.28);
}

#app.visual-active main::-webkit-scrollbar { width: 7px; }
#app.visual-active main::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }

/* ── Immersive audio-reactive stage ───────────────── */
.visual-stage {
  position: sticky;
  top: 72px;
  isolation: isolate;
  width: 100%;
  height: calc(100vh - 154px);
  min-height: 520px;
  max-height: 900px;
  padding: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(142,125,255,0.34);
  border-radius: 18px;
  background: #05050b;
  box-shadow: 0 22px 65px rgba(0,0,0,0.48), 0 0 40px rgba(102,68,255,0.08);
  animation: visualStageIn 0.45s ease;
}

.visual-stage::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04), inset 0 0 80px rgba(0,0,0,0.52);
}

.visual-stage .wb-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  min-width: 0;
}

.visual-scanlines {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.16;
  mix-blend-mode: soft-light;
  background: repeating-linear-gradient(180deg, transparent 0 3px, rgba(255,255,255,0.08) 4px);
}

.visual-hud {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  pointer-events: none;
  color: #fff;
  font-family: var(--font-mono);
  text-shadow: 0 2px 14px rgba(0,0,0,0.85);
}

.visual-hud-top,
.visual-hud-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.visual-readout {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.visual-kicker {
  color: rgba(255,255,255,0.52);
  font-size: 0.58rem;
  letter-spacing: 0.2em;
}

.visual-readout strong {
  font-size: clamp(0.85rem, 1.25vw, 1.08rem);
  letter-spacing: 0.16em;
  color: var(--accent);
}

.visual-stage-state {
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(255,255,255,0.74);
  font-size: 0.62rem;
  letter-spacing: 0.13em;
}

.visual-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 12px var(--accent-2);
  animation: livePulse 1.1s ease-in-out infinite;
}

.visual-reticle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 44px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 50%;
  opacity: 0.65;
}

.visual-reticle::before,
.visual-reticle::after,
.visual-reticle span::before,
.visual-reticle span::after {
  content: '';
  position: absolute;
  background: rgba(255,255,255,0.26);
}
.visual-reticle::before { left: 50%; top: -10px; width: 1px; height: 8px; }
.visual-reticle::after { left: 50%; bottom: -10px; width: 1px; height: 8px; }
.visual-reticle span::before { top: 50%; left: -10px; height: 1px; width: 8px; }
.visual-reticle span::after { top: 50%; right: -10px; height: 1px; width: 8px; }

.visual-hud-bottom {
  align-items: flex-end;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(5,5,12,0.78), rgba(5,5,12,0.38));
  backdrop-filter: blur(8px);
}

.visual-transport,
.visual-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

.visual-stage .wb-play-btn {
  width: 42px;
  height: 42px;
  box-shadow: 0 0 24px rgba(0,255,204,0.25);
}

.visual-stage .wb-info {
  min-width: 105px;
  color: rgba(255,255,255,0.66);
}

.visual-meters {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, 1fr));
  gap: 10px;
  flex: 1;
  max-width: 330px;
}

.visual-meter {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 6px;
  font-size: 0.54rem;
  letter-spacing: 0.09em;
  color: rgba(255,255,255,0.52);
}

.visual-meter i {
  display: block;
  height: 4px;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(255,255,255,0.12);
}

.visual-meter b {
  display: block;
  width: 2%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-4), var(--accent), #fff);
  box-shadow: 0 0 8px var(--accent);
  transition: width 80ms linear;
}

.visual-action-btn {
  min-width: 50px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 7px;
  background: rgba(8,8,18,0.7);
  color: rgba(255,255,255,0.72);
  font: 0.62rem var(--font-mono);
  letter-spacing: 0.08em;
  transition: var(--transition);
}

.visual-action-btn:hover,
.visual-action-btn:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(0,255,204,0.08);
}

.visual-fullscreen-btn {
  min-width: 36px;
  padding: 0;
  font-size: 1rem;
}

.visual-stage:fullscreen {
  width: 100vw;
  height: 100vh;
  max-height: none;
  min-height: 0;
  top: 0;
  border: 0;
  border-radius: 0;
}

.visual-stage.cursor-hidden,
.visual-stage.cursor-hidden button { cursor: none; }

#app.visual-active .option-grid { gap: 9px; }
#app.visual-active .option-card { padding: 14px; }
#app.visual-active .synth-selectors { grid-template-columns: repeat(2, minmax(110px, 1fr)); width: 100%; }
#app.visual-active .synth-header { flex-direction: column; }
#app.visual-active .wavetable-rack { grid-template-columns: 1fr; }
#app.visual-active .macro-grid { grid-template-columns: repeat(3, minmax(78px, 1fr)); }
#app.visual-active .synth-param-group-compact .macro-grid { grid-template-columns: repeat(3, minmax(72px, 1fr)); }
#app.visual-active .result-body { grid-template-columns: 1fr; }

.phase-section {
  display: none;
  animation: fadeIn 0.35s ease;
}

.phase-section.active {
  display: block;
}

.phase-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-bright);
}

.phase-desc {
  color: var(--text-dim);
  margin-bottom: 20px;
  font-size: 0.95rem;
}

/* ── 4. Intro ─────────────────────────────────────── */
#intro {
  display: none;
  position: relative;
  min-height: 70vh;
  align-items: center;
  justify-content: center;
}

#intro.active {
  display: flex;
}

.intro-content {
  text-align: center;
  z-index: 1;
  max-width: 500px;
}

.intro-title {
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.intro-subtitle {
  font-size: 1.1rem;
  color: var(--text-dim);
  margin-bottom: 24px;
}

.intro-desc {
  color: var(--text);
  margin-bottom: 32px;
  line-height: 1.7;
}

.intro-hint {
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-top: 16px;
}

.bg-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.3;
  pointer-events: none;
}

/* ── 5. 选项卡 ────────────────────────────────────── */
.option-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.option-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.option-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.option-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.option-card.selected {
  background: var(--bg-card-active);
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

.option-card.selected::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 12px;
  color: var(--accent);
  font-weight: bold;
}

.option-card .opt-label {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-bright);
  margin-bottom: 4px;
}

.option-card .opt-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.option-card .opt-num {
  position: absolute;
  top: 8px;
  left: 12px;
  font-size: 0.7rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* ── 6. DNA 条 ────────────────────────────────────── */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  padding: 8px 16px;
  z-index: 100;
}

.dna-bars {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  max-width: 1200px;
  margin: 0 auto;
}

.dna-bar {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dna-bar .dna-name {
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dna-bar .dna-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.dna-bar .dna-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease, background 0.3s ease;
}

.dna-bar .dna-val {
  font-size: 0.65rem;
  color: var(--text);
  font-family: var(--font-mono);
}

.phase-label {
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ── 7. 宏观控制 ──────────────────────────────────── */
.macro-panel,
.density-panel,
.variation-panel,
.pattern-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
  animation: slideUp 0.3s ease;
}

.macro-title,
.density-title,
.variation-title,
.pattern-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-bright);
}

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

.synth-header .macro-title { margin-bottom: 2px; letter-spacing: 0.16em; }

.synth-subtitle {
  color: var(--text-dim);
  font-size: 0.72rem;
}

.filter-selector {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 132px;
}

.synth-selectors {
  display: grid;
  grid-template-columns: repeat(4, minmax(104px, 1fr));
  gap: 8px;
}

.filter-selector label {
  color: var(--text-dim);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
}

.filter-selector select {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--accent);
  padding: 8px 28px 8px 10px;
  font: 0.72rem var(--font-mono);
  cursor: pointer;
}

.wavetable-rack {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(240px, 1.3fr);
  gap: 12px;
  padding: 10px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #070710;
}

.synth-wave-canvas {
  width: 100%;
  height: 96px;
  border-radius: 7px;
  background: radial-gradient(circle at center, rgba(0,255,204,0.08), transparent 65%);
}

.waveform-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.waveform-btn {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  background: var(--bg-card);
  color: var(--text-dim);
  font: 0.66rem var(--font-mono);
  letter-spacing: 0.06em;
  transition: var(--transition);
}

.waveform-btn:hover,
.waveform-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(0,255,204,0.08);
  box-shadow: inset 0 0 18px rgba(0,255,204,0.05);
}

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

.synth-param-groups {
  display: grid;
  gap: 12px;
}

.synth-param-group {
  padding: 12px;
  border: 1px solid rgba(142,125,255,0.16);
  border-radius: 9px;
  background: rgba(7,7,16,0.55);
}

.synth-param-group h4 {
  margin: 0 0 12px;
  color: var(--text-dim);
  font: 0.62rem var(--font-mono);
  letter-spacing: 0.16em;
}

.synth-param-group-compact .macro-grid {
  grid-template-columns: repeat(3, minmax(96px, 1fr));
  max-width: 520px;
}

.macro-control {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.macro-control label {
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.08em;
}

.macro-control label small {
  color: var(--text-dim);
  font-weight: 400;
  font-size: 0.75rem;
}

.synth-knob {
  --knob-angle: -135deg;
  position: relative;
  isolation: isolate;
  width: 68px;
  height: 68px;
  flex: 0 0 68px;
  border: 1px solid #3a3a58;
  border-radius: 50%;
  background:
    radial-gradient(circle at 42% 36%, #3a3a4f 0 8%, #20202d 30%, #0c0c14 72%),
    var(--bg-card);
  box-shadow: inset 0 0 0 6px #11111c, 0 5px 14px rgba(0,0,0,0.45);
  cursor: ns-resize;
  touch-action: none;
}

.synth-knob::before {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  background: conic-gradient(from 225deg, var(--accent) 0deg, var(--accent) var(--knob-fill, 0deg), #26263b var(--knob-fill, 0deg), #26263b 270deg, transparent 270deg);
  z-index: -1;
  opacity: 0.8;
}

.synth-knob:hover,
.synth-knob:focus-visible {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 6px #11111c, 0 0 16px rgba(0,255,204,0.25);
}

.knob-indicator {
  position: absolute;
  left: 50%;
  top: 8px;
  width: 3px;
  height: 18px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 7px var(--accent);
  transform-origin: 50% 26px;
  transform: translateX(-50%) rotate(var(--knob-angle));
}

.macro-value {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  min-height: 1.2em;
  text-align: center;
}

.macro-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 8px;
}

.macro-hint.adjusted {
  color: var(--accent);
}

/* ── 8. Pattern 编辑器 ───────────────────────────── */
.density-buttons,
.variation-buttons {
  display: flex;
  gap: 8px;
}

.density-btn,
.variation-btn {
  flex: 1;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  transition: var(--transition);
}

.density-btn:hover,
.variation-btn:hover {
  background: var(--bg-card-hover);
}

.density-btn.active,
.variation-btn.active {
  background: var(--bg-card-active);
  border-color: var(--accent);
  color: var(--accent);
}

.pattern-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.pattern-grid {
  display: grid;
  grid-template-columns: 90px repeat(8, 1fr);
  gap: 4px;
  margin-bottom: 12px;
}

.pattern-grid .pad-label {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--text-dim);
  padding-left: 4px;
  white-space: nowrap;
}

.pattern-grid .step-header {
  text-align: center;
  font-size: 0.65rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.pattern-grid .pad-cell {
  aspect-ratio: 1;
  border-radius: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  min-height: 32px;
}

.pattern-grid .pad-cell:hover {
  background: var(--bg-card-hover);
}

.pattern-grid .pad-cell.active {
  border-color: transparent;
}

.pattern-grid .pad-cell[data-pad="D"].active { background: var(--accent-4); }
.pattern-grid .pad-cell[data-pad="F"].active { background: var(--danger); }
.pattern-grid .pad-cell[data-pad="J"].active { background: var(--accent-3); }
.pattern-grid .pad-cell[data-pad="K"].active { background: var(--accent); }

.pattern-grid .pad-cell.playing {
  box-shadow: 0 0 12px var(--text-bright);
  transform: scale(1.1);
}

.pattern-grid .pad-cell.playhead {
  box-shadow: 0 0 8px var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.pattern-actions {
  display: flex;
  gap: 8px;
}

/* ── 9. 结算页 ────────────────────────────────────── */
.result-style {
  text-align: center;
  margin-bottom: 24px;
}

.result-style .style-label {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.result-style .style-name {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.result-style .style-secondary {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-top: 4px;
}

.result-style .hidden-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 12px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent-4));
  color: var(--text-bright);
  font-size: 0.75rem;
  font-weight: 700;
}

.result-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.result-radar {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.result-radar svg {
  max-width: 280px;
  width: 100%;
  height: auto;
}

.result-scores {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.result-scores h4 {
  font-size: 0.9rem;
  margin-bottom: 12px;
  color: var(--text-dim);
}

.score-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.score-row .score-name {
  font-size: 0.8rem;
  width: 100px;
  flex-shrink: 0;
}

.score-row .score-track {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.score-row .score-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.score-row .score-val {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  width: 36px;
  text-align: right;
  flex-shrink: 0;
}

.score-row.primary .score-name { color: var(--accent); font-weight: 700; }
.score-row.primary .score-fill { background: var(--accent); }
.score-row.secondary .score-name { color: var(--accent-2); }
.score-row.secondary .score-fill { background: var(--accent-2); }
.score-row .score-fill { background: var(--accent-4); }

.result-reaction {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}

.result-reaction .reaction-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.result-reaction .reaction-text {
  font-size: 1rem;
  color: var(--text);
  font-style: italic;
}

.result-nav {
  justify-content: center;
}

/* ── 10. 按钮 ────────────────────────────────────── */
.btn-primary,
.btn-secondary,
.btn-back,
.btn-next {
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  transition: var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-4));
  color: var(--bg);
}

.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
}

.btn-back {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.btn-back:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

.btn-next {
  background: var(--accent);
  color: var(--bg);
}

.btn-next:hover:not(:disabled) {
  opacity: 0.9;
}

.btn-next:disabled {
  background: var(--border);
  color: var(--text-dim);
  cursor: not-allowed;
}

.btn-start {
  font-size: 1.1rem;
  padding: 14px 40px;
}

.nav-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

/* ── 11. 动画 ─────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@keyframes visualStageIn {
  from { opacity: 0; transform: scale(0.985) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes livePulse {
  0%, 100% { opacity: 0.55; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.18); }
}

/* ── 12. 响应式 ───────────────────────────────────── */
@media (max-width: 768px) {
  #app {
    padding: 0 10px;
  }

  .workbench {
    padding: 6px 8px;
    gap: 8px;
  }

  .wb-play-btn {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
  }

  .wb-info {
    font-size: 0.7rem;
    min-width: 70px;
  }

  .wb-canvas {
    height: 32px;
  }

  .intro-title {
    font-size: 2.2rem;
  }

  .option-grid {
    grid-template-columns: 1fr;
  }

  .option-grid-3 {
    grid-template-columns: 1fr;
  }

  .macro-grid {
    grid-template-columns: repeat(4, minmax(70px, 1fr));
  }

  .synth-selectors { grid-template-columns: repeat(2, minmax(110px, 1fr)); width: 100%; }

  .wavetable-rack { grid-template-columns: 1fr; }

  .synth-knob { width: 58px; height: 58px; flex-basis: 58px; }
  .knob-indicator { top: 7px; height: 15px; transform-origin: 50% 22px; }

  .result-body {
    grid-template-columns: 1fr;
  }

  .dna-bars {
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
  }

  .pattern-grid {
    grid-template-columns: 70px repeat(8, 1fr);
    gap: 3px;
  }

  .pad-cell {
    min-height: 28px;
  }

  .nav-buttons {
    flex-wrap: wrap;
  }

  .btn-primary, .btn-secondary, .btn-back, .btn-next {
    padding: 10px 16px;
    font-size: 0.85rem;
  }
}

@media (max-width: 390px) {
  #app {
    padding: 0 8px;
  }

  .workbench {
    padding: 4px 6px;
    gap: 6px;
  }

  .wb-play-btn {
    width: 28px;
    height: 28px;
    font-size: 0.7rem;
  }

  .wb-info {
    font-size: 0.65rem;
    min-width: 60px;
  }

  .wb-canvas {
    height: 28px;
  }

  .logo {
    font-size: 0.9rem;
  }

  .intro-title {
    font-size: 1.8rem;
  }

  .phase-title {
    font-size: 1.3rem;
  }

  .dna-bars {
    grid-template-columns: repeat(2, 1fr);
  }

  .dna-bar .dna-name {
    font-size: 0.6rem;
  }

  .pattern-grid .pad-label {
    font-size: 0.6rem;
  }

  .pattern-grid .pad-cell {
    min-height: 24px;
    border-radius: 4px;
  }

  .synth-header { flex-direction: column; }
  .filter-selector { width: 100%; }
  .macro-grid { grid-template-columns: repeat(2, minmax(90px, 1fr)); }
  .synth-param-group-compact .macro-grid { grid-template-columns: repeat(3, minmax(72px, 1fr)); }
  .waveform-options { grid-template-columns: 1fr; }
}

/* ── 13. prefers-reduced-motion ───────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .phase-section.active {
    animation: none;
  }

  .bg-canvas {
    display: none;
  }
}
.final-song-error {
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 78, 126, 0.55);
  border-radius: 8px;
  background: rgba(255, 46, 105, 0.1);
  color: #ff9ab7;
  font-size: 0.86rem;
  line-height: 1.55;
}

@media (max-width: 1100px) {
  #app.visual-active .studio-shell {
    grid-template-columns: 1fr;
  }

  .visual-stage {
    position: relative;
    top: auto;
    height: min(60vh, 620px);
    min-height: 410px;
  }

  #app.visual-active main {
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 768px) {
  #app { padding: 0 10px; }

  .visual-stage {
    height: 52vh;
    min-height: 350px;
    padding: 0;
    gap: 0;
    border-radius: 13px;
  }

  .visual-stage .wb-canvas { width: 100%; height: 100%; }

  .visual-hud { padding: 11px; }
  .visual-hud-bottom { padding: 8px; gap: 8px; }
  .visual-stage .wb-play-btn { width: 34px; height: 34px; }
  .visual-stage .wb-info { min-width: 74px; font-size: 0.64rem; }
  .visual-meters { display: none; }
  .visual-action-btn { min-width: 44px; height: 31px; padding: 0 7px; }
  .visual-fullscreen-btn { min-width: 31px; }
  .visual-stage-state { font-size: 0.55rem; }
  .visual-kicker { font-size: 0.5rem; }

  #app.visual-active main {
    padding: 15px 12px 92px;
    border-radius: 13px;
  }

  #app.visual-active .macro-grid { grid-template-columns: repeat(3, minmax(70px, 1fr)); }
}

@media (max-width: 480px) {
  .visual-stage { height: 44vh; min-height: 300px; }
  .visual-readout strong { font-size: 0.72rem; letter-spacing: 0.08em; }
  .visual-stage-state { max-width: 112px; text-align: right; }
  .visual-reticle { width: 34px; height: 34px; }
  #app.visual-active .macro-grid { grid-template-columns: repeat(2, minmax(88px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .visual-live-dot { animation: none; }
  .visual-scanlines { opacity: 0.08; }
}

/* ═══════════════════════════════════════════════════
   BRUTAL FORGE — red / industrial yellow / black
   ═══════════════════════════════════════════════════ */
header {
  margin: 0 -20px 16px;
  padding: 13px 20px;
  background: #000;
  border-bottom: 6px solid #FFCE00;
  box-shadow: 0 5px 0 rgba(0,0,0,0.28);
}

.logo {
  color: #FFCE00;
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  transform: skew(-5deg);
}

.progress-dots { gap: 6px; }
.progress-dots .dot {
  width: 26px;
  height: 6px;
  border-radius: 0;
  background: #3c2b20;
  border: 1px solid #6e4c31;
}
.progress-dots .dot.active { background: #FFCE00; box-shadow: 0 0 12px rgba(255,206,0,0.72); }
.progress-dots .dot.done { background: #D72F19; }

.mute-btn {
  color: #FFCE00;
  background: #111;
  border: 1px solid #FFCE00;
  border-radius: 0;
}

#app.visual-active .studio-shell {
  grid-template-columns: minmax(520px, 1.28fr) minmax(500px, 1fr);
  gap: 20px;
}

#app.visual-active main {
  padding: 20px 20px 94px;
  border: 3px solid #FFCE00;
  border-radius: 0;
  background: #050505;
  box-shadow: 10px 10px 0 #000;
}

.visual-stage {
  border: 4px solid #000;
  border-radius: 0;
  box-shadow: 0 0 0 2px #FFCE00, 12px 12px 0 #000;
}

.visual-stage::before {
  border-radius: 0;
  box-shadow: inset 0 0 0 2px rgba(255,206,0,0.34), inset 0 0 110px rgba(0,0,0,0.72);
}

.visual-scanlines {
  opacity: 0.24;
  mix-blend-mode: hard-light;
  background:
    repeating-linear-gradient(180deg, transparent 0 4px, rgba(255,206,0,0.07) 5px),
    linear-gradient(90deg, rgba(215,47,25,0.08), transparent 38%, rgba(255,206,0,0.04));
}

.visual-hud { padding: 16px; }
.visual-kicker { color: rgba(255,206,0,0.72); }
.visual-readout strong { color: #FFCE00; text-shadow: 3px 3px 0 #000; }
.visual-live-dot { background: #D72F19; box-shadow: 0 0 12px #FF3217; }
.visual-reticle { border-color: rgba(255,206,0,0.26); border-radius: 0; transform: translate(-50%, -50%) rotate(45deg); }
.visual-hud-bottom {
  border: 2px solid #FFCE00;
  border-radius: 0;
  background: rgba(0,0,0,0.86);
  backdrop-filter: blur(4px);
  box-shadow: 5px 5px 0 rgba(215,47,25,0.7);
}
.visual-stage .wb-play-btn {
  border-radius: 0;
  background: #FFCE00;
  color: #000;
  box-shadow: 4px 4px 0 #D72F19;
}
.visual-meter b { background: linear-gradient(90deg, #D72F19, #FFCE00, #fff); box-shadow: 0 0 8px #FFCE00; }
.visual-action-btn {
  border: 1px solid #FFCE00;
  border-radius: 0;
  background: #000;
  color: #FFCE00;
}
.visual-action-btn:hover,
.visual-action-btn:focus-visible { color: #000; border-color: #FFCE00; background: #FFCE00; }

.phase-index,
.forge-core-heading,
.forge-rhythm-copy,
.forge-stamp,
.drive-eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.phase-index {
  display: inline-block;
  margin-bottom: 8px;
  padding: 3px 7px;
  color: #000;
  background: #FFCE00;
  font-size: 0.64rem;
  font-weight: 900;
}

.phase-title {
  margin-bottom: 2px;
  color: #FFF7E2;
  font-size: clamp(1.8rem, 2.5vw, 2.7rem);
  font-weight: 950;
  letter-spacing: -0.055em;
  line-height: 0.95;
  text-transform: uppercase;
}
.phase-desc { color: #BFA98B; border-left: 5px solid #D72F19; padding-left: 10px; }

.forge-core-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 18px 0 8px;
  color: #FFCE00;
  font-size: 0.68rem;
  font-weight: 900;
}
.forge-core-heading small { color: #8F7560; font-size: 0.58rem; letter-spacing: 0; text-transform: none; }

.option-grid { gap: 8px; }
.option-card {
  min-height: 82px;
  padding: 13px;
  border: 2px solid #432014;
  border-radius: 0;
  background: #130e0a;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,0.35);
}
.option-card:hover { background: #211209; border-color: #FFCE00; transform: translate(-2px, -2px); box-shadow: 4px 4px 0 #D72F19; }
.option-card.selected { background: #FFCE00; border-color: #000; box-shadow: 5px 5px 0 #D72F19; }
.option-card.selected .opt-label,
.option-card.selected .opt-desc,
.option-card.selected .opt-num { color: #000; }
.option-card.selected::after { color: #000; }
.option-card .opt-label { font-size: 1rem; text-transform: uppercase; }

.macro-panel {
  padding: 15px;
  border: 2px solid #FFCE00;
  border-radius: 0;
  background: #080604;
  box-shadow: 7px 7px 0 #D72F19;
}
.synth-header { display: grid; grid-template-columns: 1fr auto; align-items: end; }
.synth-header .synth-selectors { grid-column: 1 / -1; }
.forge-stamp { color: #D72F19; font-size: 0.58rem; font-weight: 900; }
.macro-title { color: #FFCE00; font-size: 1.15rem; }
.forge-actions { display: flex; gap: 7px; }
.forge-action-btn {
  padding: 9px 12px;
  border: 1px solid #FFCE00;
  border-radius: 0;
  background: #000;
  color: #FFCE00;
  font: 800 0.64rem var(--font-mono);
  letter-spacing: 0.08em;
}
.forge-action-btn:hover { background: #FFCE00; color: #000; }
.forge-hit-btn { background: #D72F19; color: #fff; border-color: #D72F19; }

.filter-selector select {
  border: 1px solid #5B1B0E;
  border-radius: 0;
  background: #000;
  color: #FFCE00;
}
.wavetable-rack {
  border: 2px solid #2E190E;
  border-radius: 0;
  background: #000;
}
.synth-wave-canvas { border-radius: 0; background: repeating-linear-gradient(0deg, transparent 0 15px, rgba(255,206,0,0.055) 16px); }
.waveform-btn { border-radius: 0; background: #120d08; }
.waveform-btn:hover,
.waveform-btn.active { color: #000; border-color: #FFCE00; background: #FFCE00; box-shadow: 3px 3px 0 #D72F19; }

.forge-rhythm-rack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 0 0 14px;
  padding: 12px;
  border: 2px solid #D72F19;
  background: #0c0805;
}
.forge-rhythm-copy { display: flex; justify-content: space-between; color: #FFCE00; font-size: 0.65rem; font-weight: 900; }
.forge-rhythm-copy small { color: #A58C71; font-size: 0.58rem; letter-spacing: 0; text-transform: none; }
.forge-rhythm-options { grid-template-columns: repeat(4, 1fr); margin: 0; }
.forge-rhythm-options .option-card { min-height: 52px; padding: 10px 7px; }
.forge-rhythm-options .opt-desc { display: none; }
.forge-rhythm-options .opt-label { font: 800 0.68rem var(--font-mono); }
.forge-rhythm-options .opt-num { font-size: 0.55rem; }
.forge-density-panel {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.density-title { margin: 0; color: #BFA98B; font: 0.58rem var(--font-mono); letter-spacing: 0.1em; }
.density-btn { padding: 8px 7px; border-radius: 0; background: #000; border-color: #51311d; font: 700 0.62rem var(--font-mono); }
.density-btn.active { background: #D72F19; color: #fff; border-color: #FFCE00; }

.drive-stage {
  --drive-level: 0.5;
  display: grid;
  grid-template-columns: 1fr 150px;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
  padding: 15px 18px;
  border: 3px solid #FFCE00;
  background:
    linear-gradient(105deg, rgba(0,0,0,0.78), rgba(0,0,0,0.2)),
    repeating-linear-gradient(-52deg, #D72F19 0 16px, #AE1D0C 17px 31px);
  box-shadow: inset 0 0 0 2px #000, 6px 6px 0 #000;
}
.drive-stage[data-heat="high"] { border-color: #fff; box-shadow: inset 0 0 0 2px #000, 7px 7px 0 #FFCE00; }
.drive-stage-copy h4 { margin: 2px 0 3px; color: #fff; font-size: 1.55rem; line-height: 1; letter-spacing: -0.04em; }
.drive-stage-copy p { max-width: 360px; color: #F4DDBB; font-size: 0.72rem; }
.drive-eyebrow { color: #FFCE00; font-size: 0.56rem; }
.drive-heat-readout { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 9px; margin-top: 11px; }
.drive-heat-track { height: 9px; border: 2px solid #000; background: #1a0c07; }
.drive-heat-track i { display: block; width: 50%; height: 100%; background: linear-gradient(90deg, #FFCE00 0 45%, #FF5A17 70%, #fff 100%); transition: width 100ms linear; }
.drive-heat-readout strong { color: #FFCE00; font: 900 0.64rem var(--font-mono); }
.macro-control-hero { gap: 5px; }
.macro-control-hero label { color: #fff; }
.synth-knob-hero { width: 106px; height: 106px; flex-basis: 106px; border-width: 3px; }
.synth-knob-hero .knob-indicator { top: 12px; height: 28px; transform-origin: 50% 40px; }

.synth-param-group {
  border: 1px solid #4C2816;
  border-radius: 0;
  background: #0b0806;
}
.synth-param-group h4 { color: #FFCE00; }
.synth-knob {
  border-color: #5C3820;
  background: radial-gradient(circle at 38% 32%, #594425 0 7%, #1b140c 28%, #050505 70%);
  box-shadow: inset 0 0 0 6px #0c0905, 4px 5px 0 #000;
}
.synth-knob::before { background: conic-gradient(from 225deg, #FFCE00 0deg, #FFCE00 var(--knob-fill, 0deg), #3b1a0c var(--knob-fill, 0deg), #3b1a0c 270deg, transparent 270deg); }
.synth-knob:hover,
.synth-knob:focus-visible { border-color: #FFCE00; box-shadow: inset 0 0 0 6px #0c0905, 0 0 0 3px #D72F19; }
.knob-indicator { background: #D72F19; box-shadow: 0 0 6px #FFCE00; }
.macro-value { color: #FFCE00; }
.macro-hint { padding: 9px; border-left: 4px solid #D72F19; background: #000; }
.macro-hint.adjusted { color: #FFCE00; }

.btn-primary,
.btn-secondary,
.btn-back,
.btn-next {
  border-radius: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.btn-primary,
.btn-next { background: #FFCE00; color: #000; box-shadow: 4px 4px 0 #D72F19; }
.btn-secondary { border-color: #FFCE00; background: #000; color: #FFCE00; }
.btn-back { border-color: #6A3D24; color: #C3AA8E; }

footer { background: #000; border-top: 4px solid #FFCE00; }
.dna-bar .dna-track { background: #2A160D; border-radius: 0; }
.dna-bar .dna-fill { border-radius: 0; }

#intro.active { min-height: 78vh; }
.intro-content { max-width: 740px; padding: 36px; border: 5px solid #000; background: rgba(215,47,25,0.72); box-shadow: 14px 14px 0 #000; }
.intro-title {
  color: #000;
  background: none;
  -webkit-text-fill-color: #000;
  font: 950 clamp(3.4rem, 8vw, 7.5rem)/0.78 Arial Black, Impact, sans-serif;
  letter-spacing: -0.09em;
  text-shadow: 5px 5px 0 #FFCE00;
  transform: skew(-5deg);
}
.intro-subtitle { margin-top: 24px; color: #FFCE00; background: #000; display: inline-block; padding: 5px 9px; font: 900 0.78rem var(--font-mono); letter-spacing: 0.12em; }
.intro-desc { color: #000; font-weight: 750; }
.btn-start { border: 3px solid #000; background: #FFCE00; box-shadow: 7px 7px 0 #000; }
.intro-hint { color: #330b04; font-weight: 700; }

.result-style .style-name { background: none; -webkit-text-fill-color: var(--accent); color: var(--accent); text-shadow: 3px 3px 0 #D72F19; }
.result-radar,
.result-scores,
.result-reaction { border-radius: 0; border-color: #6A2A16; background: #0a0705; }

#app[data-ending-style="melodicDubstep"] { --accent: #F6E7C1; --accent-2: #3E7CB1; --accent-4: #FFCE00; }
#app[data-ending-style="bassHouse"] { --accent: #FFE600; --accent-2: #FF5B17; --accent-4: #FFFFFF; }
#app[data-ending-style="brostep"] { --accent: #FF4A18; --accent-2: #FFCE00; --accent-4: #FFFFFF; }
#app[data-ending-style="hybridTrap"] { --accent: #FFCE00; --accent-2: #D72F19; --accent-4: #F6E7C1; }
#app[data-ending-style="riddimDubstep"] { --accent: #FFCE00; --accent-2: #111111; --accent-4: #F4E7C5; }

@media (max-width: 1250px) {
  #app.visual-active .studio-shell { grid-template-columns: minmax(460px, 1.05fr) minmax(470px, 1fr); }
}

@media (max-width: 1100px) {
  #app.visual-active .studio-shell { grid-template-columns: 1fr; }
  .synth-header { grid-template-columns: 1fr auto; }
}

@media (max-width: 768px) {
  header { margin: 0 -10px 12px; padding: 11px 10px; }
  #app.visual-active main { border-width: 2px; box-shadow: 5px 5px 0 #000; }
  .forge-rhythm-options { grid-template-columns: repeat(2, 1fr); }
  .drive-stage { grid-template-columns: 1fr 112px; padding: 12px; }
  .synth-knob-hero { width: 86px; height: 86px; flex-basis: 86px; }
  .synth-knob-hero .knob-indicator { top: 10px; height: 22px; transform-origin: 50% 32px; }
  .forge-rhythm-copy { flex-direction: column; gap: 3px; }
  .intro-content { padding: 24px 16px; border-width: 4px; box-shadow: 8px 8px 0 #000; }
}

@media (max-width: 480px) {
  .synth-header { grid-template-columns: 1fr; }
  .forge-actions { grid-row: 2; }
  .synth-header .synth-selectors { grid-column: 1; }
  .drive-stage { grid-template-columns: 1fr; }
  .macro-control-hero { flex-direction: row; justify-content: center; flex-wrap: wrap; }
  .forge-density-panel { grid-template-columns: 1fr; }
}

/* Poster refinement — flat red editorial system inspired by the supplied reference. */
body {
  background: #D72F19;
  color: #000;
}

header {
  background: #D72F19;
  border-bottom: 1px solid rgba(0,0,0,0.22);
  box-shadow: none;
}
.logo {
  color: #000;
  padding: 0 3px;
  border-top: 4px solid #000;
  border-bottom: 4px solid #000;
  transform: none;
  line-height: 0.92;
}
.progress-dots .dot { background: rgba(0,0,0,0.18); border-color: transparent; }
.progress-dots .dot.active,
.progress-dots .dot.done { background: #000; box-shadow: none; }
.mute-btn { color: #D72F19; background: #000; border-color: #000; }

#app.visual-active main {
  border: 2px solid #000;
  background: #D72F19;
  box-shadow: 8px 8px 0 #000;
}
.phase-index { color: #D72F19; background: #000; }
.phase-title { color: #000; font-family: Arial Black, Impact, sans-serif; }
.phase-desc { color: #260500; border-left-color: #000; }
.forge-core-heading { color: #000; border-top: 2px solid #000; padding-top: 8px; }
.forge-core-heading small { color: rgba(0,0,0,0.62); }

.option-card {
  border: 1px solid rgba(0,0,0,0.42);
  background: transparent;
  box-shadow: none;
}
.option-card .opt-label,
.option-card .opt-desc,
.option-card .opt-num { color: #000; }
.option-card:hover {
  color: #D72F19;
  background: #000;
  border-color: #000;
  box-shadow: none;
}
.option-card:hover .opt-label,
.option-card:hover .opt-desc,
.option-card:hover .opt-num { color: #D72F19; }
.option-card.selected {
  color: #D72F19;
  background: #000;
  border-color: #000;
  box-shadow: none;
}
.option-card.selected .opt-label,
.option-card.selected .opt-desc,
.option-card.selected .opt-num,
.option-card.selected::after { color: #D72F19; }

.macro-panel {
  border: 0;
  border-top: 6px solid #000;
  padding: 18px 0 0;
  background: transparent;
  box-shadow: none;
}
.forge-stamp { color: #000; }
.macro-title { color: #000; font-family: Arial Black, Impact, sans-serif; font-size: 1.45rem; }
.synth-subtitle { color: rgba(0,0,0,0.65); }
.forge-action-btn { border-color: #000; background: transparent; color: #000; }
.forge-action-btn:hover { background: #000; color: #D72F19; }
.forge-hit-btn { background: #000; color: #fff; }

.synth-selectors { border-top: 1px solid rgba(0,0,0,0.25); padding-top: 11px; }
.filter-selector label { color: #000; }
.filter-selector select { border-color: #000; background: #000; color: #FFCE00; }

.forge-rhythm-rack {
  border: 1px solid #000;
  background: transparent;
}
.forge-rhythm-copy { color: #000; }
.forge-rhythm-copy small { color: rgba(0,0,0,0.62); }
.forge-rhythm-options .option-card { border-color: rgba(0,0,0,0.4); }
.density-title { color: #000; }
.density-btn { color: #000; background: transparent; border-color: #000; }
.density-btn.active { background: #000; color: #FFCE00; border-color: #000; }

.drive-stage {
  border: 0;
  background: #000;
  box-shadow: none;
}
.drive-stage[data-heat="high"] { border: 0; box-shadow: inset 0 0 0 3px #FFCE00; }
.drive-stage-copy p { color: #d8b8a9; }

.synth-param-group { border: 0; background: #000; }
.synth-param-group h4 { padding-bottom: 7px; border-bottom: 1px solid #462117; }
.macro-control label { color: #F4E7C8; }
.macro-control label small { color: #9e8171; }
.macro-hint { color: #000; border-left-color: #000; background: transparent; font-weight: 750; }
.macro-hint.adjusted { color: #000; }

.btn-primary,
.btn-next { color: #fff; background: #000; box-shadow: none; }
.btn-primary:hover,
.btn-next:hover:not(:disabled) { color: #FFCE00; background: #000; }
.btn-next:disabled { color: rgba(0,0,0,0.38); background: rgba(0,0,0,0.13); }
.btn-back { color: #000; border-color: #000; }
.btn-secondary { color: #fff; background: #000; border-color: #000; }

footer { color: #000; background: #D72F19; border-top: 2px solid #000; }
.dna-bar .dna-name,
.dna-bar .dna-val,
.phase-label { color: #000; }
.dna-bar .dna-track { background: rgba(0,0,0,0.22); }

.intro-content { border: 0; background: transparent; box-shadow: none; }
.intro-title { text-shadow: none; }
.intro-subtitle { color: #D72F19; background: #000; }
.btn-start { color: #fff; background: #000; border-color: #000; box-shadow: none; }

.result-style .style-label,
.result-style .style-secondary { color: #1e0500; }
.result-style .style-name { color: #000; -webkit-text-fill-color: #000; text-shadow: none; }
.result-radar,
.result-scores,
.result-reaction { color: #F4E7C8; background: #000; border-color: #000; }
.result-reaction { border-left-color: #FFCE00; }

@media (max-width: 768px) {
  #app.visual-active main { box-shadow: 5px 5px 0 #000; }
  #app.visual-active footer { padding-left: 10px; padding-right: 10px; }
}

/* Cinema flow + dedicated synthesizer layout. */
body,
header,
#app.visual-active main,
footer { background-color: #EA0029; }

#app.visual-active .studio-shell {
  display: flex;
  flex-direction: column;
  gap: 28px;
  align-items: stretch;
}

.visual-stage:not(.synth-docked) {
  position: relative;
  top: auto;
  width: 100%;
  height: auto;
  min-height: 270px;
  max-height: 490px;
  aspect-ratio: 2.35 / 1;
  border: 5px solid #000;
  box-shadow: none;
}

#app.visual-active main {
  width: min(1120px, 100%);
  max-height: none;
  margin: 0 auto;
  padding: 4px 0 28px;
  overflow: visible;
  border: 0;
  box-shadow: none;
}

#app.visual-active footer {
  position: relative;
  left: auto;
  right: auto;
  width: auto;
  margin: 20px 0 0;
  padding: 10px 20px;
}

#app[data-phase="bassForge"] main { width: min(1540px, 100%); }

.phase-section:not(#bassForge):not(#result) {
  max-width: 960px;
  margin: 0 auto;
}

.option-grid {
  gap: 0;
  border-top: 1px solid rgba(0,0,0,0.28);
}
.option-card {
  min-height: 92px;
  border: 0;
  border-bottom: 1px solid rgba(0,0,0,0.28);
  background: transparent;
  box-shadow: none;
}
.option-card:hover { transform: none; box-shadow: none; }

.phase-index { background: #000; color: #EA0029; }
.phase-desc { max-width: 720px; }

.visual-stage,
.visual-stage::before,
.visual-stage .wb-canvas { border-radius: 0; }
.visual-stage::before { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.09), inset 0 0 100px rgba(0,0,0,0.68); }
.visual-readout strong { color: #fff; text-shadow: none; }
.visual-kicker { color: rgba(255,255,255,0.58); }
.visual-live-dot { background: #EA0029; box-shadow: 0 0 10px #EA0029; }
.visual-hud-bottom { border-color: rgba(255,255,255,0.4); box-shadow: none; }
.visual-stage .wb-play-btn { color: #000; background: #fff; box-shadow: none; }
.visual-meter b { background: linear-gradient(90deg, #EA0029, #fff); box-shadow: none; }
.visual-action-btn { color: #fff; border-color: rgba(255,255,255,0.56); }
.visual-action-btn:hover,
.visual-action-btn:focus-visible { color: #000; border-color: #fff; background: #fff; }
.visual-reticle { border-color: rgba(255,255,255,0.28); }

.rhythm-page-density {
  display: grid;
  grid-template-columns: auto minmax(300px, 1fr);
  align-items: center;
  gap: 28px;
  margin-top: 22px;
  padding: 16px 0;
  border: 0;
  border-top: 2px solid #000;
  border-bottom: 1px solid rgba(0,0,0,0.28);
  background: transparent;
}
.rhythm-page-density .density-title { color: #000; }
.rhythm-page-density .density-btn { color: #000; border-color: #000; }
.rhythm-page-density .density-btn.active { color: #EA0029; background: #000; }

#bassForge .macro-panel {
  display: block;
  padding: 18px;
  border: 3px solid #000;
  background: #080808;
}
#bassForge .forge-stamp { color: #EA0029; }
#bassForge .macro-title { color: #fff; }
#bassForge .synth-subtitle { color: #9d9d9d; }
#bassForge .synth-selectors { border-top-color: #282828; }
#bassForge .filter-selector label { color: #aaa; }
#bassForge .filter-selector select { color: #fff; border-color: #454545; }
#bassForge .forge-action-btn { color: #fff; border-color: #fff; }
#bassForge .forge-action-btn:hover { color: #000; background: #fff; }
#bassForge .forge-hit-btn { color: #fff; background: #EA0029; border-color: #EA0029; }
#bassForge .wavetable-rack { border-color: #2f2f2f; }
#bassForge .waveform-btn { color: #aaa; border-color: #333; }
#bassForge .waveform-btn:hover,
#bassForge .waveform-btn.active { color: #000; border-color: #fff; background: #fff; box-shadow: none; }

.synth-console-body {
  display: grid;
  grid-template-columns: minmax(220px, 0.86fr) minmax(330px, 1.1fr) minmax(250px, 0.96fr);
  gap: 14px;
  align-items: stretch;
}
.synth-console-bank { display: grid; gap: 12px; align-content: stretch; }
.synth-console-left { grid-template-rows: 1fr auto; }
.synth-console-right { grid-template-rows: 1fr auto; }
.synth-console-bank .synth-param-group { height: 100%; }
.synth-console-bank .macro-grid { grid-template-columns: repeat(2, minmax(82px, 1fr)); }
.synth-console-right .synth-param-group:first-child .macro-grid { grid-template-columns: repeat(2, minmax(78px, 1fr)); }
.synth-console-right .synth-param-group:first-child .macro-control:last-child { grid-column: 1 / -1; }
.synth-console-right .synth-param-group-compact .macro-grid { grid-template-columns: repeat(3, minmax(72px, 1fr)); }

.synth-visual-dock {
  position: relative;
  min-width: 0;
  aspect-ratio: 1 / 1;
  align-self: center;
  overflow: hidden;
  border: 8px solid #000;
  outline: 1px solid #383838;
  background: #000;
}
.synth-visual-dock::before {
  content: 'LIVE SIGNAL';
  position: absolute;
  top: 8px;
  left: 10px;
  z-index: 6;
  color: rgba(255,255,255,0.5);
  font: 0.52rem var(--font-mono);
  letter-spacing: 0.16em;
  pointer-events: none;
}
.synth-visual-dock .visual-stage.synth-docked {
  position: relative;
  top: auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  aspect-ratio: 1 / 1;
  border: 0;
  box-shadow: none;
}
.synth-docked .visual-hud { padding: 9px; }
.synth-docked .visual-hud-top { padding-top: 12px; }
.synth-docked .visual-kicker,
.synth-docked .visual-stage-state,
.synth-docked .visual-meters { display: none; }
.synth-docked .visual-readout strong { font-size: 0.68rem; letter-spacing: 0.08em; }
.synth-docked .visual-hud-bottom { padding: 6px; background: rgba(0,0,0,0.74); }
.synth-docked .visual-stage .wb-play-btn,
.synth-docked .wb-play-btn { width: 30px; height: 30px; }
.synth-docked .wb-info { min-width: 74px; font-size: 0.62rem; }
.synth-docked .visual-action-btn { height: 28px; min-width: 34px; font-size: 0.52rem; }

#bassForge .synth-param-group h4 { color: #fff; border-bottom-color: #333; }
#bassForge .synth-knob::before {
  background: conic-gradient(from 225deg, #fff 0deg, #fff var(--knob-fill, 0deg), #351111 var(--knob-fill, 0deg), #351111 270deg, transparent 270deg);
}
#bassForge .knob-indicator { background: #EA0029; box-shadow: none; }
#bassForge .macro-value { color: #fff; }
#bassForge .drive-stage { background: #111; box-shadow: inset 0 0 0 1px #333; }
#bassForge .drive-stage[data-heat="high"] { box-shadow: inset 0 0 0 2px #EA0029; }
#bassForge .drive-heat-track i { background: linear-gradient(90deg, #fff, #EA0029 75%, #FFCE00); }
#bassForge .drive-heat-readout strong { color: #fff; }
#bassForge .macro-hint { color: #fff; border-left-color: #EA0029; background: #111; }

@media (max-width: 1050px) {
  .synth-console-body { grid-template-columns: 1fr 1fr; }
  .synth-visual-dock { grid-column: 1 / -1; grid-row: 1; width: min(480px, 76vw); justify-self: center; }
  .synth-console-left { grid-column: 1; }
  .synth-console-right { grid-column: 2; }
}

@media (max-width: 720px) {
  .visual-stage:not(.synth-docked) { min-height: 190px; aspect-ratio: 1.75 / 1; }
  .rhythm-page-density { grid-template-columns: 1fr; gap: 10px; }
  .synth-console-body { grid-template-columns: 1fr; }
  .synth-visual-dock { grid-column: 1; width: min(100%, 430px); }
  .synth-console-left,
  .synth-console-right { grid-column: 1; }
}

#intro .bg-canvas {
  display: block;
  opacity: 1;
  mix-blend-mode: multiply;
}

@media (prefers-reduced-motion: reduce) {
  #intro .bg-canvas { display: none; }
}

/* Desktop single-screen pass — fewer frames, clearer hierarchy. */
.result-signature {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 auto 18px;
  border-top: 2px solid #000;
  border-bottom: 2px solid #000;
}

.result-trait {
  display: grid;
  gap: 3px;
  padding: 12px 18px;
  text-align: center;
}

.result-trait + .result-trait { border-left: 1px solid rgba(0,0,0,0.34); }
.result-trait span {
  font: 0.58rem var(--font-mono);
  letter-spacing: 0.14em;
  color: rgba(0,0,0,0.58);
}
.result-trait strong {
  color: #000;
  font-size: 0.92rem;
  text-transform: uppercase;
}

@media (min-width: 769px) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  body { min-height: 0; }

  #app {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    padding: 0 clamp(16px, 2vw, 32px);
    overflow: hidden;
  }

  header {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 8px 0;
  }

  .logo { font-size: 0.92rem; }
  .mute-btn { padding: 2px 7px; font-size: 1rem; }

  .studio-shell,
  #app.visual-active .studio-shell {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    overflow: hidden;
  }

  #app.visual-active .studio-shell {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .visual-stage:not(.synth-docked) {
    flex: 0 0 clamp(200px, 29dvh, 310px);
    width: min(1360px, 100%);
    height: clamp(200px, 29dvh, 310px);
    min-height: 0;
    max-height: none;
    align-self: center;
    aspect-ratio: auto;
    border-width: 3px;
  }

  .visual-hud { padding: 12px; }
  .visual-hud-top { align-items: flex-start; }
  .visual-readout strong { font-size: 0.76rem; letter-spacing: 0.11em; }
  .visual-stage-state { font-size: 0.56rem; }
  .visual-hud-bottom {
    padding: 0;
    border: 0;
    background: none;
    backdrop-filter: none;
  }
  .visual-stage .wb-play-btn { width: 34px; height: 34px; }
  .visual-stage .wb-info { min-width: 92px; font-size: 0.68rem; }
  .visual-action-btn { height: 30px; min-width: 44px; padding: 0 8px; }

  #app.visual-active main {
    flex: 1 1 auto;
    width: min(1240px, 100%);
    min-height: 0;
    max-height: none;
    margin: 0 auto;
    padding: 0 0 8px;
    overflow: hidden;
  }

  .phase-section.active {
    height: 100%;
    min-height: 0;
  }

  .phase-section:not(#bassForge):not(#result).active {
    display: grid;
    grid-template-rows: repeat(4, auto);
    align-content: center;
    gap: 9px;
    width: 100%;
    max-width: 1120px;
  }

  .phase-index {
    width: max-content;
    margin: 0;
    padding: 2px 6px;
    font-size: 0.56rem;
  }

  .phase-title {
    margin: 0;
    font-size: clamp(1.55rem, 2.25vw, 2.25rem);
    line-height: 0.95;
  }

  .option-grid,
  #app.visual-active .option-grid {
    align-self: start;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    width: 100%;
    margin: 0;
    border-top: 2px solid #000;
    border-bottom: 2px solid #000;
  }

  .option-card,
  #app.visual-active .option-card {
    min-height: 82px;
    padding: 11px 14px;
    border: 0;
    border-right: 1px solid rgba(0,0,0,0.32);
  }
  .option-card:last-child { border-right: 0; }
  .option-card .opt-label { font-size: 0.92rem; }
  .option-card .opt-desc {
    display: -webkit-box;
    overflow: hidden;
    font-size: 0.72rem;
    line-height: 1.25;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .rhythm-page-density {
    grid-template-columns: auto minmax(360px, 1fr);
    gap: 18px;
    margin: 0;
    padding: 7px 0;
    border-top: 0;
  }
  .density-btn { min-height: 32px; padding: 6px 12px; }

  .nav-buttons {
    min-height: 38px;
    margin: 0;
  }
  .btn-primary,
  .btn-secondary,
  .btn-back,
  .btn-next {
    min-height: 36px;
    padding: 7px 18px;
    font-size: 0.82rem;
  }

  #app[data-phase="intro"] .studio-shell {
    display: flex;
    flex-direction: column;
  }
  #app[data-phase="intro"] main {
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0;
    overflow: hidden;
  }
  #intro.active {
    height: 100%;
    min-height: 0;
    align-items: center;
    justify-content: center;
  }
  .intro-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto;
    column-gap: clamp(32px, 6vw, 96px);
    row-gap: 10px;
    width: min(1320px, 100%);
    max-width: none;
    padding: clamp(18px, 3vw, 42px);
    text-align: left;
  }
  .intro-title {
    grid-column: 1 / -1;
    margin: 0 0 clamp(14px, 2vh, 26px);
    font-size: clamp(4rem, 10.2vw, 10rem);
    line-height: 0.72;
    white-space: nowrap;
  }
  .intro-subtitle {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
    margin: 0;
  }
  .intro-desc {
    grid-column: 1;
    grid-row: 3;
    max-width: 600px;
    margin: 0;
    color: #000;
    font-size: clamp(0.92rem, 1.25vw, 1.08rem);
    line-height: 1.35;
  }
  .intro-content .btn-start {
    grid-column: 2;
    grid-row: 2 / 4;
    align-self: stretch;
    min-width: clamp(190px, 17vw, 250px);
    min-height: 94px;
    padding: 18px 24px;
  }

  #bassForge.active {
    display: grid;
    grid-template-rows: repeat(4, auto);
    align-content: start;
    gap: 5px;
  }

  #app[data-phase="bassForge"] main { width: min(1540px, 100%); }

  #bassForge .macro-panel {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: 7px;
    min-height: 0;
    height: auto;
    margin: 0;
    padding: 10px 12px;
    overflow: hidden;
    border: 0;
  }

  #bassForge .synth-header {
    display: grid;
    grid-template-columns: auto minmax(430px, 1fr) auto;
    gap: 14px;
    align-items: center;
    margin: 0;
  }
  #bassForge .synth-header .synth-selectors {
    grid-column: 2;
    grid-row: 1;
    grid-template-columns: repeat(4, minmax(92px, 1fr));
    gap: 6px;
    width: 100%;
    padding: 0;
    border: 0;
  }
  #bassForge .forge-actions { grid-column: 3; grid-row: 1; }
  #bassForge .macro-title { margin: 0; font-size: 1rem; }
  #bassForge .filter-selector { min-width: 0; gap: 2px; }
  #bassForge .filter-selector label { font-size: 0.52rem; }
  #bassForge .filter-selector select { height: 30px; padding: 4px 22px 4px 8px; font-size: 0.62rem; }
  #bassForge .forge-action-btn { min-height: 30px; padding: 6px 9px; font-size: 0.56rem; }

  #app.visual-active #bassForge .wavetable-rack {
    grid-template-columns: minmax(250px, 0.7fr) minmax(440px, 1.3fr);
    gap: 8px;
    min-height: 0;
    margin: 0;
    padding: 5px 7px;
    border: 0;
  }
  #bassForge .synth-wave-canvas { height: 52px; }
  #bassForge .waveform-options { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  #bassForge .waveform-btn { min-height: 24px; padding: 3px 5px; font-size: 0.54rem; }

  .synth-console-body {
    grid-template-columns: minmax(230px, 0.92fr) minmax(300px, 1.12fr) minmax(250px, 0.98fr);
    gap: 9px;
    min-height: 0;
    height: auto;
    align-self: stretch;
  }
  .synth-console-bank { min-height: 0; gap: 7px; }
  .synth-console-bank .synth-param-group {
    min-height: 0;
    padding: 7px;
    overflow: hidden;
    background: transparent;
  }
  #bassForge .synth-param-group h4 {
    margin: 0 0 6px;
    padding-bottom: 4px;
    font-size: 0.54rem;
  }
  .synth-console-bank .macro-grid { gap: 8px 6px; }
  .synth-console-right .synth-param-group:first-child .macro-grid {
    grid-template-columns: repeat(3, minmax(62px, 1fr));
  }
  .synth-console-right .synth-param-group:first-child .macro-control:last-child { grid-column: auto; }
  .synth-console-right .synth-param-group-compact .macro-grid { grid-template-columns: repeat(3, minmax(62px, 1fr)); }

  .macro-control { gap: 3px; }
  .macro-control label { font-size: 0.62rem; }
  .synth-knob {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
    box-shadow: inset 0 0 0 4px #0c0905, 2px 3px 0 #000;
  }
  .synth-knob::before { inset: -3px; }
  .knob-indicator { top: 6px; height: 14px; transform-origin: 50% 20px; }
  .macro-value { min-height: 1em; font-size: 0.66rem; }

  .drive-stage {
    grid-template-columns: 1fr 82px;
    gap: 8px;
    min-height: 0;
    margin: 0;
    padding: 8px 10px;
  }
  .drive-stage-copy h4 { margin: 0; font-size: 1rem; }
  .drive-heat-readout { display: block; margin-top: 5px; }
  .synth-knob-hero { width: 72px; height: 72px; flex-basis: 72px; }
  .synth-knob-hero .knob-indicator { top: 8px; height: 19px; transform-origin: 50% 27px; }

  .synth-visual-dock {
    width: min(100%, clamp(320px, calc(100dvh - 360px), 650px));
    height: auto;
    max-width: 100%;
    max-height: 100%;
    justify-self: center;
    align-self: center;
    border-width: 4px;
  }
  .synth-visual-dock::before { display: none; }
  .synth-docked .visual-hud-top { padding-top: 0; }
  .synth-docked .visual-readout strong { font-size: 0.58rem; }
  .synth-docked .visual-hud-bottom { padding: 0; background: none; }
  .synth-docked .visual-stage-state { display: flex; }
  .synth-docked .visual-action-btn { height: 26px; }

  #bassForge .macro-hint {
    min-height: 24px;
    margin: 0;
    padding: 4px 7px;
    font-size: 0.62rem;
  }

  #result.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
  }
  #resultContent { width: min(980px, 100%); margin: auto auto 0; }
  .result-style { margin: 0 0 14px; }
  .result-style .style-label { font: 0.6rem var(--font-mono); letter-spacing: 0.18em; }
  .result-style .style-name {
    font: 950 clamp(3.1rem, 6.5vw, 6.2rem)/0.88 Arial Black, Impact, sans-serif;
    letter-spacing: -0.07em;
    text-transform: uppercase;
  }
  .result-style .style-secondary { margin-top: 7px; font-size: 0.78rem; }
  .result-style .hidden-badge { border-radius: 0; background: #000; }
  .result-reaction {
    margin: 0;
    padding: 10px 0 0;
    border: 0;
    border-top: 2px solid #000;
    background: transparent;
    text-align: center;
  }
  .result-reaction .reaction-label { color: rgba(0,0,0,0.58); font: 0.56rem var(--font-mono); letter-spacing: 0.14em; }
  .result-reaction .reaction-text { color: #000; font-size: 0.92rem; font-style: normal; }
  .result-nav { flex: 0 0 auto; justify-content: center; margin: 0 auto auto; }
}

@media (min-width: 769px) and (max-height: 820px) {
  .visual-stage:not(.synth-docked) {
    flex-basis: clamp(180px, 27dvh, 220px);
    height: clamp(180px, 27dvh, 220px);
  }
  .option-card,
  #app.visual-active .option-card { min-height: 70px; padding: 8px 12px; }
  .option-card .opt-desc { font-size: 0.68rem; -webkit-line-clamp: 1; }
  .rhythm-page-density { padding: 4px 0; }
  #bassForge .macro-panel { gap: 5px; padding: 7px 9px; }
  #bassForge .synth-wave-canvas { height: 44px; }
  #bassForge .waveform-btn { min-height: 20px; }
  .synth-console-bank { gap: 5px; }
  .synth-console-bank .synth-param-group { padding: 5px; }
  #bassForge .synth-param-group h4 { margin-bottom: 4px; }
  .synth-knob { width: 46px; height: 46px; flex-basis: 46px; }
  .knob-indicator { top: 5px; height: 12px; transform-origin: 50% 18px; }
  .synth-knob-hero { width: 64px; height: 64px; flex-basis: 64px; }
  .synth-knob-hero .knob-indicator { top: 7px; height: 17px; transform-origin: 50% 24px; }
  .drive-stage { grid-template-columns: 1fr 72px; padding: 6px 8px; }
  .result-style .style-name { font-size: clamp(2.8rem, 6vw, 5rem); }
}

@media (max-width: 768px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }
  #app {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }
  .studio-shell,
  #app.visual-active .studio-shell,
  #app.visual-active main { overflow: visible; }
  .result-signature { grid-template-columns: 1fr; }
  .result-trait + .result-trait { border-left: 0; border-top: 1px solid rgba(0,0,0,0.34); }
}

@media (min-width: 769px) {
  #app[data-phase="soundWorld"] .visual-stage:not(.synth-docked),
  #app[data-phase="bassCore"] .visual-stage:not(.synth-docked),
  #app[data-phase="rhythm"] .visual-stage:not(.synth-docked) {
    flex-basis: clamp(320px, 46dvh, 470px);
    height: clamp(320px, 46dvh, 470px);
  }

}

@media (min-width: 769px) and (max-height: 820px) {
  #app[data-phase="soundWorld"] .visual-stage:not(.synth-docked),
  #app[data-phase="bassCore"] .visual-stage:not(.synth-docked),
  #app[data-phase="rhythm"] .visual-stage:not(.synth-docked) {
    flex-basis: clamp(320px, 45dvh, 360px);
    height: clamp(320px, 45dvh, 360px);
  }
}

/* Final cover/navigation polish. */
::selection {
  color: #000;
  background: #FFCE00;
}
::-moz-selection {
  color: #000;
  background: #FFCE00;
}

header { position: relative; }
.progress-dots {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.mute-btn,
.mute-btn:hover,
.mute-btn:active {
  color: #000;
  background: transparent;
  border: 0;
  box-shadow: none;
  transform: none;
}
.mute-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 3px;
}
.mute-btn svg {
  display: block;
  width: 22px;
  height: 22px;
}
.mute-btn .icon-on,
.mute-btn .icon-off { line-height: 0; }
.mute-btn:hover { opacity: 0.58; }

.option-card { isolation: isolate; }
.option-card:not(.selected)::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #000;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 170ms cubic-bezier(0.72, 0, 0.28, 1);
  pointer-events: none;
}
.option-card:not(.selected):hover::before { transform: scaleX(1); }
.option-card > * {
  position: relative;
  z-index: 1;
}
.option-card:not(.selected):hover {
  color: #fff;
  background: transparent;
  border-color: rgba(0,0,0,0.32);
}
.option-card:not(.selected) .opt-label,
.option-card:not(.selected) .opt-desc {
  transition: color 95ms linear;
}
.option-card:not(.selected):hover .opt-label,
.option-card:not(.selected):hover .opt-desc { color: #fff; }
.option-card.selected::after { z-index: 2; }

/* Keep every multiple-choice strip visually open at both outer edges. */
#app.visual-active .option-grid > .option-card:last-child,
.option-grid > .option-card:last-child {
  border-right: 0 !important;
}

/* Density uses the same left-to-right hover wipe as the main choices. */
.rhythm-page-density .density-btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  color: #000;
  background: transparent;
  border-color: #000;
}
.rhythm-page-density .density-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #000;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 170ms cubic-bezier(0.72, 0, 0.28, 1);
  pointer-events: none;
}
.rhythm-page-density .density-btn > span {
  position: relative;
  z-index: 1;
  color: inherit;
  transition: color 95ms linear;
}
.rhythm-page-density .density-btn:not(.active):hover {
  color: #fff;
  background: transparent;
}
.rhythm-page-density .density-btn:not(.active):hover > span {
  color: #fff;
}
.rhythm-page-density .density-btn:not(.active):hover::before {
  transform: scaleX(1);
}
.rhythm-page-density .density-btn.active {
  color: #EA0029;
  background: #000;
}
.rhythm-page-density .density-btn.active::before {
  display: none;
}

@media (min-width: 769px) {
  #intro { cursor: pointer; }
  #app[data-phase="intro"] .studio-shell,
  #app[data-phase="intro"] main,
  #app[data-phase="intro"] #intro.active {
    width: 100%;
    max-width: none;
    align-self: stretch;
  }
  #app[data-phase="intro"] #intro.active {
    margin: 0;
  }
  #app[data-phase="intro"] .intro-content {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    padding: 0;
    text-align: left;
    pointer-events: none;
  }
  #app[data-phase="intro"] .intro-title {
    position: absolute;
    left: 50%;
    top: 47%;
    width: calc(100% - clamp(36px, 5vw, 84px));
    margin: 0;
    color: #000;
    font: 950 clamp(12rem, 29vw, 30rem)/0.72 Arial Black, Impact, sans-serif;
    font-style: normal;
    letter-spacing: 0.025em;
    text-align: center;
    white-space: nowrap;
    transform: translate(-50%, -50%);
  }
  #app[data-phase="intro"] .intro-subtitle {
    position: absolute;
    left: clamp(20px, 4vw, 66px);
    bottom: clamp(34px, 7vh, 76px);
    margin: 0;
    padding: 5px 9px;
    color: #EA0029;
    background: #000;
    font: 900 0.72rem var(--font-mono);
    letter-spacing: 0.13em;
  }
}
