:root {
  --void: #030408;
  --space: #080c14;
  --hull: #0e1218;
  --wood-dark: #1e140c;
  --wood: #3a2818;
  --wood-mid: #4e3420;
  --wood-light: #6b4a30;
  --wood-grain: #2a1c12;
  --metal: #2a3038;
  --metal-light: #4a5560;
  --brass: #9a7a40;
  --brass-bright: #c8a050;
  --copper: #8a5830;
  --rivet: #6a5a48;
  --crt-bg: #020804;
  --crt-phosphor: #4a9a68;
  --crt-phosphor-dim: #2a6a48;
  --crt-amber: #c89048;
  --nixie: #d08040;
  --engage: #48a058;
  --engage-glow: #68d080;
  --danger: #a04040;
  --caution: #908040;
  --text: #8a9aa8;
  --text-dim: #5a6470;
  --text-bright: #b8c8d8;
  --astral: #6080b8;
  --astral-dim: #3a5080;
  --border-wood: #1a1008;
  --border-metal: #1a2028;
  --font-ship: 'Orbitron', 'Helvetica Neue', sans-serif;
  --font-mono: 'Share Tech Mono', 'Courier New', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: clamp(16px, 1.65vh, 21px);
}

html, body {
  height: 100%;
  font-family: var(--font-mono);
  background: var(--void);
  color: var(--text);
  overflow: hidden;
}

/* ─── Deep space viewport ─── */
.cosmos {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 120% 80% at 50% 0%, #101828 0%, var(--void) 50%),
    radial-gradient(ellipse at 80% 20%, rgba(40,60,100,0.15), transparent 50%),
    var(--void);
}

.stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 8% 12%, rgba(200,210,255,0.7), transparent),
    radial-gradient(1px 1px at 22% 38%, rgba(180,200,255,0.5), transparent),
    radial-gradient(1.5px 1.5px at 35% 6%, rgba(220,230,255,0.6), transparent),
    radial-gradient(1px 1px at 52% 58%, rgba(160,180,220,0.45), transparent),
    radial-gradient(1px 1px at 68% 18%, rgba(200,210,255,0.55), transparent),
    radial-gradient(1px 1px at 84% 42%, rgba(180,200,255,0.4), transparent),
    radial-gradient(1px 1px at 94% 8%, rgba(220,230,255,0.5), transparent),
    radial-gradient(1px 1px at 12% 72%, rgba(160,180,220,0.35), transparent),
    radial-gradient(1px 1px at 45% 85%, rgba(200,210,255,0.4), transparent),
    radial-gradient(1px 1px at 78% 78%, rgba(180,200,255,0.3), transparent);
  opacity: 0.85;
}

.stars-far {
  background-image:
    radial-gradient(0.5px 0.5px at 15% 25%, rgba(255,255,255,0.3), transparent),
    radial-gradient(0.5px 0.5px at 40% 55%, rgba(255,255,255,0.25), transparent),
    radial-gradient(0.5px 0.5px at 60% 30%, rgba(255,255,255,0.2), transparent),
    radial-gradient(0.5px 0.5px at 85% 65%, rgba(255,255,255,0.25), transparent);
  opacity: 0.6;
}

.nebula {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.25;
}

.nebula-a {
  width: 500px;
  height: 350px;
  top: -100px;
  right: 10%;
  background: radial-gradient(circle, #284878, transparent 70%);
}

.nebula-b {
  width: 400px;
  height: 300px;
  bottom: 5%;
  left: -5%;
  background: radial-gradient(circle, #382858, transparent 70%);
}

.planet-glow {
  position: absolute;
  width: 180px;
  height: 180px;
  bottom: 15%;
  right: 8%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #6080a8, #304060 50%, transparent 70%);
  opacity: 0.2;
  filter: blur(2px);
}

/* ─── Bridge viewport HUD ─── */
.bridge {
  position: relative;
  z-index: 1;
  height: 100vh;
  height: 100dvh;
  padding: 0.2rem 0.35rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.viewport-hud {
  position: fixed;
  inset: 0.75rem;
  pointer-events: none;
  z-index: 0;
  border: 1px solid rgba(96,128,184,0.12);
  border-radius: 4px;
}

.hud-corner {
  position: absolute;
  width: 24px;
  height: 24px;
  border-color: rgba(96,128,184,0.25);
  border-style: solid;
}

.hud-corner.tl { top: 0; left: 0; border-width: 2px 0 0 2px; }
.hud-corner.tr { top: 0; right: 0; border-width: 2px 2px 0 0; }
.hud-corner.bl { bottom: 0; left: 0; border-width: 0 0 2px 2px; }
.hud-corner.br { bottom: 0; right: 0; border-width: 0 2px 2px 0; }

.hud-label {
  position: absolute;
  top: 8px;
  font-family: var(--font-ship);
  font-size: 0.45rem;
  letter-spacing: 0.2em;
  color: rgba(96,128,184,0.35);
}

.hud-label-l { left: 12px; }
.hud-label-r { right: 12px; }

.app {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.console-fit {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: stretch;
  justify-content: center;
  overflow: hidden;
}

.console-main-fit {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── Wooden console frame ─── */
.console-frame {
  width: 100%;
  max-width: 1380px;
  height: 100%;
  max-height: 100%;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  transform-origin: center top;
  background: var(--hull);
  border: 4px solid var(--metal);
  border-radius: 6px;
  box-shadow:
    0 20px 60px rgba(0,0,0,0.7),
    0 0 40px rgba(40,60,100,0.08),
    inset 0 1px 0 rgba(255,255,255,0.03);
  overflow: hidden;
}

.wood-cap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.3rem 0.85rem;
  flex-shrink: 0;
  background:
    repeating-linear-gradient(
      92deg,
      var(--wood-grain) 0 2px,
      var(--wood) 2px 6px,
      var(--wood-mid) 6px 10px,
      var(--wood) 10px 14px
    ),
    linear-gradient(180deg, var(--wood-light) 0%, var(--wood) 40%, var(--wood-dark) 100%);
  border-bottom: 3px solid var(--border-wood);
  box-shadow: inset 0 2px 4px rgba(255,200,120,0.06), inset 0 -4px 8px rgba(0,0,0,0.4);
}

.wood-cap.bottom {
  border-bottom: none;
  border-top: 3px solid var(--border-wood);
  justify-content: space-between;
  padding: 0.45rem 1.25rem;
}

.cap-plate {
  font-family: var(--font-ship);
  font-size: 0.55rem;
  letter-spacing: 0.28em;
  color: var(--brass-bright);
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

.ship-stamp {
  font-family: var(--font-ship);
  font-size: 0.48rem;
  letter-spacing: 0.18em;
  color: var(--text-dim);
}

.status-lamp {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2a1010;
  border: 1px solid #1a0808;
  box-shadow: inset 0 0 4px rgba(0,0,0,0.6);
  transition: all 0.25s;
}

body.session-active .status-lamp {
  background: radial-gradient(circle at 35% 30%, #aaffaa, var(--engage-glow) 50%, #1a4828);
  box-shadow: 0 0 10px rgba(104,208,128,0.6);
  border-color: #2a6838;
}

/* ─── Header (metal fascia on wood) ─── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 0.4rem;
  padding: 0.32rem 0.65rem;
  flex-shrink: 0;
  position: relative;
  z-index: 20;
  pointer-events: auto;
  background:
    linear-gradient(180deg, var(--metal-light) 0%, var(--metal) 50%, #1e242c 100%);
  border-bottom: 3px solid var(--border-metal);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark {
  font-size: 1.5rem;
  color: var(--astral);
  text-shadow: 0 0 16px rgba(96,128,184,0.5);
  animation: crystal-pulse 5s ease-in-out infinite;
}

@keyframes crystal-pulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; text-shadow: 0 0 24px rgba(96,128,184,0.7); }
}

.brand h1 {
  font-family: var(--font-ship);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-bright);
  text-transform: uppercase;
}

.tagline {
  font-size: 0.5rem;
  letter-spacing: 0.16em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.session-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.session-block label {
  font-size: 0.45rem;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.session-block select {
  padding: 0.3rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  background: var(--crt-bg);
  color: var(--crt-phosphor);
  border: 2px inset var(--border-metal);
  border-radius: 2px;
}

.timer-display {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  letter-spacing: 0.1em;
  color: var(--nixie);
  min-width: 4.5rem;
  text-align: center;
  padding: 0.25rem 0.5rem;
  background: var(--crt-bg);
  border: 3px inset var(--border-metal);
  box-shadow: inset 0 0 20px rgba(200,128,64,0.06);
  text-shadow: 0 0 10px rgba(208,128,64,0.3);
}

.timer-display.warning {
  color: var(--caution);
  text-shadow: 0 0 10px rgba(144,128,64,0.4);
}

.session-idle-hint {
  font-family: var(--font-ship);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: var(--crt-phosphor-dim);
  text-transform: uppercase;
  white-space: nowrap;
}

.engage-btn[hidden] {
  display: none !important;
}

.engage-btn.start-btn {
  background: linear-gradient(180deg, #1a3820, #0a2010);
  border-color: var(--engage);
  box-shadow: 0 0 16px rgba(72,160,88,0.25), 3px 4px 0 rgba(0,0,0,0.5);
}

.engage-btn.start-btn:hover {
  box-shadow: 0 0 22px rgba(72,160,88,0.4), 3px 4px 0 rgba(0,0,0,0.5);
}

.engage-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.2rem;
  font-family: var(--font-ship);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  background: linear-gradient(180deg, #4a2020, #2a1010);
  border: 3px solid #5a2020;
  border-radius: 4px;
  color: var(--text-bright);
  cursor: pointer;
  box-shadow: 3px 4px 0 rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,100,80,0.1);
  transition: transform 0.1s;
  position: relative;
  z-index: 10;
}

.engage-btn:hover { transform: translateY(-1px); }
.engage-btn:active { transform: translateY(2px); box-shadow: 1px 2px 0 rgba(0,0,0,0.5); }

.engage-btn.active {
  background: linear-gradient(180deg, #1a3820, #0a2010);
  border-color: var(--engage);
  box-shadow: 0 0 20px rgba(72,160,88,0.3), 3px 4px 0 rgba(0,0,0,0.5);
}

.power-led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2a1010;
  border: 2px solid #1a0808;
  box-shadow: inset 0 0 4px rgba(0,0,0,0.6);
  transition: all 0.2s;
}

.power-led.on {
  background: radial-gradient(circle at 35% 30%, #aaffaa, var(--engage-glow) 50%, #1a4828);
  box-shadow: 0 0 10px rgba(104,208,128,0.7);
  border-color: #2a6838;
}

/* ─── Tabs (wood channel strip) ─── */
.tabs {
  display: flex;
  gap: 2px;
  padding: 0.25rem 0.5rem 0;
  flex-shrink: 0;
  background:
    repeating-linear-gradient(90deg, var(--wood-grain) 0 3px, var(--wood) 3px 8px),
    linear-gradient(180deg, var(--wood-mid), var(--wood-dark));
  border-bottom: 2px solid var(--border-wood);
}

.tab {
  flex: 1;
  padding: 0.45rem 0.6rem;
  font-family: var(--font-ship);
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  background: linear-gradient(180deg, #2a2018, #1a1008);
  border: 2px solid var(--border-wood);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.12s;
}

.tab:hover { color: var(--brass-bright); }

.tab.active {
  background: linear-gradient(180deg, var(--wood-light), var(--wood));
  color: var(--brass-bright);
  border-color: var(--copper);
  box-shadow: inset 0 2px 0 rgba(255,200,120,0.08);
}

.tab-short { display: none; }

/* ─── Main console surface ─── */
.main {
  flex: 1;
  min-height: 0;
  padding: 0.35rem 0.5rem;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0 40px,
      rgba(0,0,0,0.03) 40px 41px
    ),
    linear-gradient(180deg, var(--wood) 0%, var(--wood-dark) 100%);
  border-top: 1px solid rgba(255,200,120,0.04);
  box-shadow: inset 0 4px 20px rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel { display: none; }

.panel.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.panel > h2 {
  font-family: var(--font-ship);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  color: var(--brass-bright);
  margin-bottom: 0.5rem;
}

.panel-desc {
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
  line-height: 1.35;
}

/* ─── Combined console deck ─── */
.deck-layout {
  flex: 1;
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  grid-template-rows: minmax(0, 18%) minmax(0, 1fr);
  gap: 0.35rem;
  overflow: hidden;
}

.deck-layout .patch-bay {
  grid-column: 1 / -1;
  grid-row: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.deck-layout .osc-controls {
  grid-column: 1;
  grid-row: 2;
  min-height: 0;
  overflow: hidden;
}

.deck-layout .osc-monitor {
  grid-column: 2;
  grid-row: 2;
  min-height: 0;
  overflow: hidden;
}

.osc-controls {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.osc-controls .module-face {
  flex: 1;
  min-height: 0;
  padding: 0.38rem 0.42rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow: hidden;
}

.osc-output-bus {
  flex-shrink: 0;
  margin-top: auto;
  padding: 0.35rem 0.4rem 0.32rem;
  background: linear-gradient(180deg, #1a1008, #0a0804);
  border: 3px inset var(--border-wood);
  border-radius: 4px;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.4);
}

.osc-output-bus .osc-section-label {
  margin-bottom: 0.3rem;
  text-align: center;
}

.osc-output-bus .bus-strips {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 1rem;
  padding: 0.2rem 0.35rem 0.25rem;
  background: linear-gradient(180deg, #12100c, #080604);
  border: 2px inset var(--border-wood);
  border-radius: 4px;
  box-shadow: inset 0 3px 12px rgba(0,0,0,0.55);
}

.osc-output-bus .fader-well,
.osc-output-bus .vu-window {
  height: 88px;
}

.osc-output-bus .fader-strip {
  gap: 0.25rem;
  padding: 0.28rem 0.32rem 0.2rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.osc-output-bus .fader-strip:first-child {
  flex: 0 0 auto;
}

.osc-output-bus .fader-strip:first-child::after {
  content: '';
  flex: 1 1 0;
  min-height: 0;
}

.osc-output-bus .ambient-strip {
  min-width: 0;
  flex: 1;
  max-width: 148px;
}

.osc-controls .module-title,
.osc-controls .mode-bar,
.osc-controls .freq-adjusters,
.osc-controls .lfo-panel {
  flex-shrink: 0;
}

.mode-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0;
}

.mode-bar .mode-lock,
.mode-bar .binaural-lock {
  margin-bottom: 0;
  padding: 0.28rem 0.55rem;
  font-size: 0.52rem;
  width: 100%;
  text-align: center;
  letter-spacing: 0.1em;
  color: var(--caution);
  border-color: rgba(144,128,64,0.45);
  background: linear-gradient(180deg, rgba(40,32,16,0.6), rgba(20,16,8,0.85));
}

.lfo-panel {
  flex-shrink: 0;
  padding: 0.3rem 0.4rem;
  background: linear-gradient(180deg, #1a1008, #0a0804);
  border: 3px inset var(--border-wood);
  border-radius: 4px;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.4);
}

.lfo-panel .osc-section-label {
  margin-bottom: 0.3rem;
  font-size: 0.55rem;
}

.lfo-panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem 0.5rem;
}

.lfo-panel .lfo-row {
  margin-bottom: 0;
}

.lfo-panel .lfo-targets {
  grid-column: 1 / -1;
  margin-top: 0.15rem;
}

.freq-adjusters {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.freq-adjuster {
  padding: 0.32rem 0.4rem;
  background: linear-gradient(180deg, #1a1008, #0a0804);
  border: 3px inset var(--border-wood);
  border-radius: 4px;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.4);
}

.freq-adjuster-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.freq-adjuster-head .osc-section-label {
  margin-bottom: 0;
  font-size: 0.55rem;
}

.freq-adjuster-readout {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--crt-phosphor);
  text-shadow: 0 0 8px rgba(74,154,104,0.35);
}

.freq-adjuster-readout span {
  min-width: 2.5rem;
  text-align: right;
}

.freq-slider {
  width: 100%;
  height: 14px;
  margin-bottom: 0.4rem;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(180deg, #0a0804, #1a1008);
  border: 2px inset var(--border-wood);
  border-radius: 3px;
}

.freq-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 22px;
  background: linear-gradient(180deg, #e8e0d0, #706860 45%, #403830);
  border: 2px solid #1a1814;
  border-radius: 3px;
  cursor: grab;
  box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.freq-slider::-moz-range-thumb {
  width: 18px;
  height: 22px;
  background: linear-gradient(180deg, #e8e0d0, #706860 45%, #403830);
  border: 2px solid #1a1814;
  border-radius: 3px;
  cursor: grab;
  box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.freq-adjuster .band-pills,
.freq-adjuster .carrier-pills {
  margin-top: 0;
}

.freq-adjuster .band-pills button,
.freq-adjuster .carrier-pills button {
  font-size: 0.52rem;
  padding: 0.28rem 0.15rem;
  letter-spacing: 0.04em;
}

.carrier-pills {
  display: flex;
  gap: 3px;
}

.carrier-pills button {
  flex: 1;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.1s;
  background: linear-gradient(180deg, #1a1008, #0a0804);
  border: 2px outset var(--border-wood);
  border-radius: 3px;
  color: var(--text-dim);
}

.carrier-pills button.active {
  background: linear-gradient(180deg, #3a3020, #2a2010);
  color: var(--brass-bright);
  border-style: inset;
}

.osc-controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem 0.55rem;
  min-height: 0;
  overflow: hidden;
  align-content: start;
}

.osc-block {
  min-width: 0;
}

.osc-controls-grid > .osc-block:not(.osc-block-lfo) {
  grid-column: 1 / -1;
}

.osc-block-lfo {
  grid-column: 1 / -1;
}

.osc-section-label {
  font-family: var(--font-ship);
  font-size: 0.48rem;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.osc-monitor {
  min-width: 0;
  min-height: 0;
}

.patch-bay .module-face {
  flex: 1;
  min-height: 0;
  padding: 0.32rem 0.45rem 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  overflow: hidden;
}

.patch-hint {
  font-size: 0.55rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.patch-bay .module-title {
  margin-bottom: 0.15rem;
  padding-bottom: 0.2rem;
}

.patch-bay .preset-grid {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

@media (max-width: 900px) {
  .preset-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }
}

.osc-telemetry {
  margin-top: 0.35rem;
}



/* ─── Wood panels (analog modules) ─── */
.module {
  position: relative;
  border-radius: 4px;
  overflow: hidden;
  box-shadow:
    3px 4px 0 rgba(0,0,0,0.45),
    inset 0 1px 0 rgba(255,200,120,0.06);
}

.wood-panel {
  background:
    repeating-linear-gradient(
      88deg,
      var(--wood-grain) 0 1px,
      transparent 1px 4px
    ),
    linear-gradient(165deg, var(--wood-light) 0%, var(--wood) 45%, var(--wood-dark) 100%);
  border: 3px solid var(--border-wood);
}

.metal-plate {
  position: absolute;
  top: 8px;
  right: 10px;
  font-family: var(--font-ship);
  font-size: 0.42rem;
  letter-spacing: 0.1em;
  color: var(--metal-light);
  background: linear-gradient(180deg, #4a5058, #2a3038);
  border: 1px solid #1a2028;
  padding: 0.15rem 0.35rem;
  border-radius: 2px;
  z-index: 2;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

.module-face {
  padding: 0.9rem;
  position: relative;
  z-index: 1;
}

.module-title {
  font-family: var(--font-ship);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--brass-bright);
  text-transform: uppercase;
  padding-bottom: 0.45rem;
  margin-bottom: 0.6rem;
  border-bottom: 2px solid rgba(0,0,0,0.25);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* ─── Controls ─── */
.mode-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 0.75rem;
}

.mode-btn,
.lfo-target,
.band-pills button,
.noise-btn {
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.1s;
}

.mode-btn {
  padding: 0.38rem 0.2rem;
  font-size: 0.5rem;
  letter-spacing: 0.05em;
  background: linear-gradient(180deg, #1a1008, #0a0804);
  border: 2px outset var(--border-wood);
  border-radius: 3px;
  color: var(--text-dim);
}

.mode-btn:hover { color: var(--text); }
.mode-lock {
  display: inline-block;
  font-family: var(--font-ship);
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  padding: 0.35rem 0.65rem;
  border: 2px inset var(--border-wood);
  background: linear-gradient(180deg, #2a2018 0%, #1a1410 100%);
  color: var(--brass-bright);
  text-align: center;
}

.mode-btn.active {
  background: linear-gradient(180deg, #2a3828, #1a2818);
  color: var(--crt-phosphor);
  border-style: inset;
  box-shadow: inset 0 0 8px rgba(74,154,104,0.15);
}

.freq-cluster { margin-bottom: 0.75rem; }
.freq-block { margin-bottom: 0.6rem; }

.freq-block label,
.lfo-section h3 {
  display: block;
  font-family: var(--font-ship);
  font-size: 0.48rem;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
}

.freq-readout {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--crt-phosphor);
}

.freq-readout span {
  min-width: 2.5rem;
  text-align: right;
  font-weight: 600;
  text-shadow: 0 0 6px rgba(74,154,104,0.25);
}

.band-pills {
  display: flex;
  gap: 3px;
  margin-top: 0.35rem;
}

.band-pills button {
  flex: 1;
  padding: 0.22rem;
  font-size: 0.65rem;
  background: linear-gradient(180deg, #1a1008, #0a0804);
  border: 2px outset var(--border-wood);
  border-radius: 3px;
  color: var(--text-dim);
}

.band-pills button.active {
  border-style: inset;
  font-weight: 600;
}

.band-pills button.active.band-delta {
  background: linear-gradient(180deg, #2a2848, #1a1838);
  color: #a8a0e8;
  box-shadow: 0 0 10px rgba(120,112,200,0.35);
}

.band-pills button.active.band-theta {
  background: linear-gradient(180deg, #283050, #182040);
  color: #88b0e8;
  box-shadow: 0 0 10px rgba(100,140,220,0.35);
}

.band-pills button.active.band-alpha {
  background: linear-gradient(180deg, #2a3828, #1a2818);
  color: var(--crt-phosphor);
  box-shadow: 0 0 10px rgba(74,154,104,0.4);
}

.band-pills button.active.band-beta {
  background: linear-gradient(180deg, #3a3020, #2a2010);
  color: var(--crt-amber);
  box-shadow: 0 0 10px rgba(200,144,72,0.35);
}

.band-pills button.active.band-gamma {
  background: linear-gradient(180deg, #3a3428, #2a2418);
  color: #f0e8d0;
  box-shadow: 0 0 10px rgba(240,220,160,0.35);
}

.beat-readout-wrap {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
}

.beat-band {
  font-family: var(--font-ship);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  padding: 0.12rem 0.35rem;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.08);
}

.beat-band-delta { color: #a8a0e8; background: rgba(120,112,200,0.15); }
.beat-band-theta { color: #88b0e8; background: rgba(100,140,220,0.15); }
.beat-band-alpha { color: var(--crt-phosphor); background: rgba(74,154,104,0.15); }
.beat-band-beta { color: var(--crt-amber); background: rgba(200,144,72,0.15); }
.beat-band-gamma { color: #f0e8d0; background: rgba(240,220,160,0.12); }

.beat-slider-bands {
  background:
    linear-gradient(90deg,
      rgba(120,112,200,0.35) 0%,
      rgba(120,112,200,0.35) 9.87%,
      rgba(100,140,220,0.35) 9.87%,
      rgba(100,140,220,0.35) 19.74%,
      rgba(74,154,104,0.35) 19.74%,
      rgba(74,154,104,0.35) 35.53%,
      rgba(200,144,72,0.35) 35.53%,
      rgba(200,144,72,0.35) 76.32%,
      rgba(240,220,160,0.3) 76.32%,
      rgba(240,220,160,0.3) 100%
    ),
    linear-gradient(180deg, #0a0804, #1a1008);
}

.readout-beat,
.tel-row-beat em {
  font-style: normal;
}

.tel-row-beat em {
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  margin-left: 0.2rem;
}

.tel-row-beat.beat-band-alpha strong,
.readout-beat.beat-band-alpha { color: var(--crt-phosphor); text-shadow: 0 0 8px rgba(74,154,104,0.35); }
.tel-row-beat.beat-band-delta strong,
.readout-beat.beat-band-delta { color: #a8a0e8; text-shadow: 0 0 8px rgba(120,112,200,0.35); }
.tel-row-beat.beat-band-theta strong,
.readout-beat.beat-band-theta { color: #88b0e8; text-shadow: 0 0 8px rgba(100,140,220,0.35); }
.tel-row-beat.beat-band-beta strong,
.readout-beat.beat-band-beta { color: var(--crt-amber); text-shadow: 0 0 8px rgba(200,144,72,0.35); }
.tel-row-beat.beat-band-gamma strong,
.readout-beat.beat-band-gamma { color: #f0e8d0; text-shadow: 0 0 8px rgba(240,220,160,0.35); }

.program-status-band {
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
  padding: 0.2rem 0.35rem;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.06);
}

input[type="range"]:not(.analog-fader) {
  flex: 1;
  height: 10px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(180deg, #0a0804, #1a1008);
  border: 2px inset var(--border-wood);
  border-radius: 3px;
}

input[type="range"]:not(.analog-fader)::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, var(--brass-bright), var(--brass) 55%, #4a3818);
  border: 2px solid #3a2810;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.lfo-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
  font-size: 0.65rem;
  color: var(--crt-phosphor);
}

.lfo-row label {
  width: 2.5rem;
  font-size: 0.48rem;
  color: var(--text-dim);
}

.lfo-targets {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 0.4rem;
  flex-wrap: wrap;
}

.lfo-label {
  font-size: 0.45rem;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-right: 0.2rem;
}

.lfo-target {
  padding: 0.22rem 0.4rem;
  font-size: 0.48rem;
  letter-spacing: 0.05em;
  background: linear-gradient(180deg, #1a1008, #0a0804);
  border: 2px outset var(--border-wood);
  border-radius: 3px;
  color: var(--text-dim);
}

.lfo-target.active {
  background: linear-gradient(180deg, #2a3828, #1a2818);
  color: var(--crt-phosphor);
  border-style: inset;
}

/* ─── CRT monitor ─── */
.scope-column {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 0.22rem;
}

.signal-readouts,
.signal-telemetry {
  flex-shrink: 0;
}

.crt-bezel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--metal-light), var(--metal));
  border: 4px solid var(--copper);
  border-radius: 6px;
  padding: 0.32rem;
  box-shadow:
    inset 0 0 24px rgba(0,0,0,0.4),
    3px 4px 0 rgba(0,0,0,0.4);
  position: relative;
}

.crt-label {
  font-family: var(--font-ship);
  font-size: 0.52rem;
  letter-spacing: 0.14em;
  color: var(--crt-amber);
  text-align: center;
  margin-bottom: 0.35rem;
  text-shadow: 0 0 8px rgba(200,144,72,0.25);
}

#visualizer {
  display: block;
  flex: 1;
  min-height: 0;
  width: 100%;
  height: auto;
  background: var(--crt-bg);
  border: 4px inset #0a1008;
  border-radius: 3px;
}

.crt-overlay {
  position: absolute;
  inset: 0.6rem;
  top: 1.5rem;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0,0,0,0.1) 2px 4px);
}

.scope-readouts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-top: 0.4rem;
  padding: 0.35rem 0.55rem;
  background: var(--crt-bg);
  border: 3px inset var(--border-metal);
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  color: var(--crt-phosphor);
  text-shadow: 0 0 6px rgba(74,154,104,0.2);
}

.signal-readouts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.28rem;
  padding: 0.32rem 0.4rem;
  margin-top: 0.22rem;
}

.signal-telemetry {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 0.5rem;
  padding: 0.28rem 0.4rem;
  margin-top: 0;
  margin-bottom: 0;
}

.signal-telemetry .tel-row {
  padding: 0.08rem 0;
  border-bottom: none;
}

.signal-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
  padding: 0.3rem 0.2rem;
  border: 1px solid rgba(74,154,104,0.12);
  border-radius: 2px;
  background: rgba(0,0,0,0.2);
  text-align: center;
}

.signal-label {
  font-size: 0.48rem;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.signal-value {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--crt-phosphor);
  text-shadow: 0 0 8px rgba(74,154,104,0.3);
}

.signal-sub {
  font-size: 0.44rem;
  letter-spacing: 0.06em;
  color: rgba(180,200,170,0.55);
}

.signal-metric-delta .signal-value {
  color: var(--crt-amber);
  text-shadow: 0 0 8px rgba(200,144,72,0.35);
}

.signal-metric-beat.beat-band-alpha .signal-value { color: var(--crt-phosphor); }
.signal-metric-beat.beat-band-delta .signal-value { color: #a8a0e8; }
.signal-metric-beat.beat-band-theta .signal-value { color: #88b0e8; }
.signal-metric-beat.beat-band-beta .signal-value { color: var(--crt-amber); }
.signal-metric-beat.beat-band-gamma .signal-value { color: #f0e8d0; }

.tel-row-delta strong {
  color: var(--crt-amber);
  text-shadow: 0 0 6px rgba(200,144,72,0.3);
}



/* ─── Signal chain ─── */
.chain-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.chain-node {
  padding: 0.25rem 0.45rem;
  font-size: 0.52rem;
  letter-spacing: 0.08em;
  background: linear-gradient(180deg, #1a1008, #0a0804);
  border: 2px outset var(--border-wood);
  border-radius: 3px;
  color: var(--text-dim);
}

.chain-node.active {
  background: linear-gradient(180deg, #2a3828, #1a2818);
  color: var(--crt-phosphor);
  border-style: inset;
}

.chain-arrow {
  font-size: 0.55rem;
  color: var(--brass);
  opacity: 0.7;
}

.telemetry {
  margin-bottom: 0.7rem;
  padding: 0.45rem;
  background: var(--crt-bg);
  border: 3px inset var(--border-metal);
}

.tel-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.55rem;
  padding: 0.15rem 0;
  color: var(--text-dim);
  border-bottom: 1px solid rgba(74,154,104,0.06);
}

.tel-row strong {
  color: var(--crt-phosphor);
  text-shadow: 0 0 6px rgba(74,154,104,0.2);
}

/* ─── Output bus (mixing strip) ─── */
.output-bus {
  flex-shrink: 0;
  padding: 0.55rem;
  background: linear-gradient(180deg, #1a1008, #0a0804);
  border: 3px inset var(--border-wood);
  border-radius: 4px;
  margin-bottom: 0.6rem;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.4);
  position: relative;
  z-index: 2;
}

.bus-title {
  font-family: var(--font-ship);
  font-size: 0.52rem;
  letter-spacing: 0.12em;
  color: var(--brass-bright);
  text-align: center;
  margin-bottom: 0.45rem;
}

.bus-strips {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  padding: 0.35rem 0.5rem;
  background: linear-gradient(180deg, #12100c, #080604);
  border: 2px inset var(--border-wood);
  border-radius: 4px;
  box-shadow: inset 0 3px 12px rgba(0,0,0,0.55);
}

.strip-body {
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
}

.fader-strip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  min-width: 88px;
  padding: 0.35rem 0.4rem 0.25rem;
  background: linear-gradient(180deg, #2a2820, #1a1814 40%, #12100c);
  border: 2px solid #0a0806;
  border-radius: 3px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.04),
    0 2px 4px rgba(0,0,0,0.35);
}

.strip-label {
  font-size: 0.45rem;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

/* ─── VU meters ─── */
.vu-window {
  width: 28px;
  height: 100px;
  background: #0a0804;
  border: 3px inset var(--border-wood);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.6);
}

.vu-window::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, transparent 0 5px, rgba(200,144,72,0.04) 5px 6px);
  pointer-events: none;
  z-index: 2;
}

.vu-bar {
  position: absolute;
  bottom: 0;
  left: 3px;
  right: 3px;
  height: 0%;
  background: linear-gradient(180deg, var(--danger) 0%, var(--crt-amber) 35%, var(--crt-phosphor) 100%);
  transition: height 0.05s ease-out;
  box-shadow: 0 0 6px rgba(200,144,72,0.25);
}

.fader-housing,
.fader-housing * {
  pointer-events: none;
}

.fader-well {
  position: relative;
  width: 48px;
  height: 100px;
  padding: 5px 4px;
  touch-action: none;
  cursor: ns-resize;
  flex-shrink: 0;
  z-index: 1;
  background:
    linear-gradient(180deg, #4a4438 0%, #2a2820 12%, #1a1814 88%, #3a3428 100%);
  border: 2px solid #1a1610;
  border-radius: 4px;
  box-shadow:
    inset 0 2px 5px rgba(255,255,255,0.06),
    inset 0 -3px 8px rgba(0,0,0,0.5),
    0 2px 5px rgba(0,0,0,0.45);
}

.fader-housing {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: stretch;
  gap: 3px;
}

.fader-ticks {
  width: 5px;
  flex-shrink: 0;
  background:
    repeating-linear-gradient(
      180deg,
      rgba(200,160,80,0.5) 0 1px,
      transparent 1px 7px
    ),
    repeating-linear-gradient(
      180deg,
      transparent 0 13px,
      rgba(200,160,80,0.75) 13px 14px,
      transparent 14px 28px
    );
  opacity: 0.7;
  border-radius: 1px;
}

.fader-slot {
  position: relative;
  flex: 1;
  min-width: 0;
  background: linear-gradient(90deg, #060504, #12100c 35%, #1a1814 50%, #12100c 65%, #060504);
  border-radius: 2px;
  box-shadow:
    inset 0 0 10px rgba(0,0,0,0.95),
    inset 2px 0 4px rgba(0,0,0,0.6),
    inset -2px 0 4px rgba(0,0,0,0.6);
}

.fader-slot::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 4px;
  bottom: 4px;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #2a2820, #0a0806 30%, #0a0806 70%, #2a2820);
  border-radius: 1px;
  pointer-events: none;
}

.fader-cap {
  position: absolute;
  left: 50%;
  bottom: var(--fader-pct, 70%);
  transform: translate(-50%, 50%);
  width: 34px;
  height: 18px;
  background:
    linear-gradient(
      180deg,
      #e8e0d0 0%,
      #c8c0b0 8%,
      #989080 22%,
      #706860 45%,
      #585048 70%,
      #403830 88%,
      #2a2820 100%
    );
  border: 1px solid #1a1814;
  border-radius: 2px;
  box-shadow:
    0 3px 6px rgba(0,0,0,0.65),
    inset 0 2px 0 rgba(255,255,255,0.35),
    inset 0 -2px 0 rgba(0,0,0,0.45);
  pointer-events: none;
  z-index: 2;
  transition: bottom 0.04s ease-out, box-shadow 0.08s ease;
}

.fader-well.is-dragging .fader-cap {
  transition: none;
  box-shadow:
    0 4px 8px rgba(0,0,0,0.75),
    inset 0 2px 0 rgba(255,255,255,0.45),
    inset 0 -2px 0 rgba(0,0,0,0.5);
}

.fader-cap::before {
  content: '';
  position: absolute;
  left: 5px;
  right: 5px;
  top: 50%;
  height: 2px;
  transform: translateY(-50%);
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.45) 20%, rgba(0,0,0,0.45) 80%, transparent);
  border-radius: 1px;
}

.fader-cap::after {
  content: '';
  position: absolute;
  left: 3px;
  right: 3px;
  top: 3px;
  bottom: 3px;
  border-top: 1px solid rgba(255,255,255,0.12);
  border-bottom: 1px solid rgba(0,0,0,0.25);
  border-radius: 1px;
  pointer-events: none;
}

.analog-fader {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  margin: 0;
  padding: 0;
  border: 0;
}

.fader-val {
  font-size: 0.52rem;
  color: var(--crt-phosphor);
}

.noise-toggles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  width: 100%;
}

.noise-btn {
  padding: 0.18rem 0;
  font-size: 0.4rem;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, #1a1008, #0a0804);
  border: 2px outset var(--border-wood);
  border-radius: 2px;
  color: var(--text-dim);
}

.noise-btn.active {
  background: linear-gradient(180deg, #2a3828, #1a2818);
  color: var(--crt-phosphor);
  border-style: inset;
}

.caution {
  font-size: 0.45rem;
  letter-spacing: 0.06em;
  color: var(--caution);
  line-height: 1.5;
  text-align: center;
  padding: 0.35rem;
  border: 1px dashed rgba(144,128,64,0.25);
  border-radius: 3px;
  background: rgba(0,0,0,0.15);
}

/* ─── Presets ─── */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr);
  gap: 0.3rem;
  overflow: hidden;
}

.preset-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.38rem 0.42rem;
  min-height: 0;
  text-align: left;
  background:
    repeating-linear-gradient(88deg, var(--wood-grain) 0 1px, transparent 1px 4px),
    linear-gradient(165deg, var(--wood-light), var(--wood-dark));
  border: 3px solid var(--border-wood);
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 3px 4px 0 rgba(0,0,0,0.4);
  transition: all 0.12s;
  position: relative;
}

.preset-card:hover {
  border-color: var(--copper);
  transform: translateY(-1px);
}

.preset-card.active {
  border-color: var(--crt-phosphor-dim);
  box-shadow: 0 0 12px rgba(74,154,104,0.15), 3px 4px 0 rgba(0,0,0,0.4);
}

.preset-card strong {
  font-family: var(--font-ship);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  color: var(--brass-bright);
}

.preset-card span {
  font-size: 0.62rem;
  color: var(--text-dim);
  line-height: 1.45;
}

.preset-meta {
  font-family: var(--font-mono);
  font-size: 0.58rem !important;
  color: var(--crt-phosphor) !important;
  letter-spacing: 0.04em;
}

.preset-card > span:last-child {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
}

/* ─── Automated programs ─── */
.program-controls {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  padding: 0.45rem 0.55rem;
  margin-bottom: 0.45rem;
  border-radius: 4px;
}

.program-volume-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}

.program-volume-row label {
  font-family: var(--font-ship);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--brass-bright);
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 0 10px rgba(200,160,80,0.15);
  min-width: 6.5rem;
}

.program-volume-row .freq-slider {
  margin-bottom: 0;
}

.program-volume-row span {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--crt-phosphor);
  min-width: 2.2rem;
  text-align: right;
}

#panel-programs.active {
  position: relative;
  overflow: hidden;
}

.programs-panel-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.35rem;
}

.program-grid {
  flex: none;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: none;
  gap: 0.5rem;
  overflow: visible;
  align-content: start;
}

.program-card-wrap {
  position: relative;
  min-height: 0;
  min-width: 0;
}

.program-card-wrap > .program-card {
  width: 100%;
  height: 100%;
}

.program-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.32rem 0.55rem;
  font-family: var(--font-ship);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brass-bright);
  background: linear-gradient(180deg, #2a2018, #1a1008);
  border: 2px solid var(--border-wood);
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  min-height: 1.75rem;
}

.program-share-btn:hover {
  border-color: var(--copper);
  color: var(--crt-phosphor);
}

.program-card-wrap > .program-share-btn {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  z-index: 2;
}

.program-share-icon {
  font-size: 0.9rem;
  line-height: 1;
}

.program-share-btn-status {
  margin-left: auto;
  font-size: 0.65rem;
  padding: 0.38rem 0.7rem;
  min-height: 2rem;
}

.program-share-btn-status .program-share-label,
.program-share-btn-status .program-share-icon {
  display: inline;
}

.program-share-toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  z-index: 1100;
  max-width: min(92vw, 24rem);
  padding: 0.45rem 0.65rem;
  font-size: 0.72rem;
  text-align: center;
  border-radius: 4px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}

.program-share-toast-ok {
  color: var(--crt-phosphor);
  background: rgba(20, 36, 24, 0.95);
  border: 1px solid rgba(74, 154, 104, 0.45);
}

.program-share-toast-error {
  color: #e8a0a0;
  background: rgba(36, 16, 16, 0.95);
  border: 1px solid rgba(160, 64, 64, 0.45);
}

.program-card {
  padding: 0.7rem 5.4rem 0.7rem 0.7rem;
  min-height: 5.75rem;
  gap: 0.3rem;
}

.program-card strong {
  font-size: 1.05rem;
  line-height: 1.3;
  letter-spacing: 0.05em;
}

.program-card span {
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text);
}

.program-card .preset-meta {
  color: var(--crt-amber) !important;
  font-size: 0.82rem !important;
  line-height: 1.35;
}

.program-card.active {
  border-color: var(--crt-phosphor);
  background:
    repeating-linear-gradient(88deg, rgba(74,154,104,0.1) 0 1px, transparent 1px 4px),
    linear-gradient(165deg, #2a4030, #1a2820);
  box-shadow:
    0 0 0 1px rgba(74,154,104,0.4),
    0 0 18px rgba(74,154,104,0.28),
    inset 0 0 24px rgba(74,154,104,0.1),
    3px 4px 0 rgba(0,0,0,0.4);
}

.program-card.active strong {
  color: var(--crt-phosphor);
  text-shadow: 0 0 10px rgba(74,154,104,0.45);
}

.program-card.active .preset-meta {
  color: var(--crt-phosphor) !important;
}

.program-status {
  flex-shrink: 0;
  padding: 0.5rem 0.65rem;
  margin-bottom: 0.45rem;
  background: linear-gradient(180deg, #1a1008, #0a0804);
  border: 3px inset var(--border-wood);
  border-radius: 4px;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.4);
}

.program-status-dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12;
  margin: 0;
  border-radius: 6px 6px 0 0;
  border-bottom: none;
  box-shadow:
    0 -6px 24px rgba(0, 0, 0, 0.55),
    inset 0 2px 10px rgba(0, 0, 0, 0.4);
}

.program-status-dock[hidden] {
  display: none !important;
}

.program-status-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 0.5rem;
  margin-bottom: 0.25rem;
}

.program-status-head strong {
  font-family: var(--font-ship);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--brass-bright);
}

.program-status-head span {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--crt-phosphor);
}

.program-status-phase {
  font-size: 0.62rem;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
  letter-spacing: 0.04em;
}

.program-progress {
  height: 6px;
  background: #0a0804;
  border: 2px inset var(--border-wood);
  border-radius: 3px;
  overflow: hidden;
}

.program-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--crt-phosphor-dim), var(--crt-phosphor));
  transition: width 1s linear;
  box-shadow: 0 0 8px rgba(74,154,104,0.35);
}

@media (max-width: 1100px) {
  .program-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .program-card strong {
    font-size: 0.98rem;
  }

  .program-card span {
    font-size: 0.84rem;
  }

  .program-card .preset-meta {
    font-size: 0.78rem !important;
  }
}

/* ─── Field Manual (detailed, auto-fit, no scroll) ─── */
.panel-manual {
  gap: 0.3rem;
  overflow: hidden;
}

.manual-header {
  flex-shrink: 0;
}

.manual-subtitle {
  margin-bottom: 0;
}

.panel-manual > .manual-binder {
  flex: 1;
  min-height: 0;
}

.manual-binder {
  display: flex;
  flex-direction: column;
  position: relative;
  border-radius: 4px;
  overflow: hidden;
}

.manual-fit-scaler {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 0.5rem 0.55rem 0.55rem;
  background:
    linear-gradient(180deg, rgba(2,8,4,0.32) 0%, transparent 14%),
    linear-gradient(0deg, rgba(0,0,0,0.2) 0%, transparent 8%);
}

.manual-fit {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  transform-origin: top left;
}

.manual-callout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.6rem;
  align-items: start;
  padding: 0.55rem 0.65rem;
  border: 2px solid rgba(74,154,104,0.35);
  border-radius: 4px;
  background:
    linear-gradient(135deg, rgba(74,154,104,0.12) 0%, rgba(0,0,0,0.25) 60%),
    var(--crt-bg);
  box-shadow: inset 0 0 20px rgba(74,154,104,0.06);
}

.manual-callout-mark {
  font-size: 1.05rem;
  color: var(--crt-phosphor);
  text-shadow: 0 0 12px rgba(74,154,104,0.45);
  line-height: 1;
  padding-top: 0.12rem;
}

.manual-callout-title {
  font-family: var(--font-ship);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--crt-phosphor);
  margin-bottom: 0.28rem;
}

.manual-callout-text {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-bright);
}

.manual-callout-text strong {
  color: var(--text-bright);
}

.manual-section {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
}

.manual-section-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid rgba(74,154,104,0.15);
}

.manual-section-code {
  font-family: var(--font-ship);
  font-size: 0.52rem;
  letter-spacing: 0.12em;
  color: var(--metal-light);
  background: linear-gradient(180deg, #3a4048, #222830);
  border: 1px solid #1a2028;
  padding: 0.16rem 0.36rem;
  border-radius: 2px;
  flex-shrink: 0;
}

.manual-section-head h3 {
  font-family: var(--font-ship);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--brass-bright);
  text-transform: uppercase;
}

.manual-lead {
  font-size: 0.76rem;
  line-height: 1.5;
  color: var(--text);
}

.manual-lead strong {
  color: var(--text-bright);
}

.band-spectrum {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.38rem;
}

.band-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.5rem 0.55rem;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.35);
  background: linear-gradient(180deg, rgba(0,0,0,0.28), rgba(0,0,0,0.42));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
  border-left-width: 3px;
}

.band-card-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.band-card-symbol {
  font-size: 1.1rem;
  line-height: 1;
  width: 1.5rem;
  text-align: center;
  flex-shrink: 0;
}

.band-card-name {
  display: block;
  font-family: var(--font-ship);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  line-height: 1.2;
}

.band-card-range {
  display: block;
  font-size: 0.64rem;
  color: var(--text-dim);
  margin-top: 0.06rem;
}

.band-card p {
  font-size: 0.72rem;
  line-height: 1.48;
  color: var(--text);
}

.band-card p em {
  color: var(--crt-amber);
  font-style: normal;
}

.band-card-delta {
  border-left-color: #a8a0e8;
}
.band-card-delta .band-card-symbol,
.band-card-delta .band-card-name { color: #a8a0e8; }

.band-card-theta {
  border-left-color: #88b0e8;
}
.band-card-theta .band-card-symbol,
.band-card-theta .band-card-name { color: #88b0e8; }

.band-card-alpha {
  border-left-color: var(--crt-phosphor);
}
.band-card-alpha .band-card-symbol,
.band-card-alpha .band-card-name { color: var(--crt-phosphor); }

.band-card-beta {
  border-left-color: var(--crt-amber);
}
.band-card-beta .band-card-symbol,
.band-card-beta .band-card-name { color: var(--crt-amber); }

.band-card-gamma {
  border-left-color: #f0e8d0;
}
.band-card-gamma .band-card-symbol,
.band-card-gamma .band-card-name { color: #f0e8d0; }

.ops-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
}

.ops-card {
  padding: 0.52rem 0.58rem;
  border-radius: 4px;
  border: 1px solid rgba(74,154,104,0.12);
  background:
    repeating-linear-gradient(88deg, rgba(42,28,18,0.4) 0 1px, transparent 1px 4px),
    linear-gradient(165deg, rgba(58,40,24,0.55), rgba(20,14,8,0.75));
  box-shadow: inset 0 0 14px rgba(0,0,0,0.18);
}

.ops-card-head {
  display: flex;
  align-items: center;
  gap: 0.38rem;
  margin-bottom: 0.3rem;
}

.ops-card-icon {
  font-size: 0.82rem;
  color: var(--crt-phosphor);
  width: 1.2rem;
  text-align: center;
  flex-shrink: 0;
}

.ops-card-head h4 {
  font-family: var(--font-ship);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--brass-bright);
  text-transform: uppercase;
}

.ops-card p {
  font-size: 0.74rem;
  line-height: 1.48;
  color: var(--text);
}

.ops-card p strong {
  color: var(--text-bright);
}

/* ─── Larger readable type ─── */
.hud-label { font-size: 0.58rem; }
.cap-plate { font-size: 0.72rem; }
.ship-stamp { font-size: 0.62rem; }
.tagline { font-size: 0.62rem; }
.session-block label { font-size: 0.58rem; }
.session-block select { font-size: 0.82rem; }
.engage-btn { font-size: 0.82rem; }
.tab { font-size: 0.72rem; padding: 0.38rem 0.5rem; }
.panel > h2 { font-size: 1rem; margin-bottom: 0.3rem; }
.panel-desc { font-size: 0.75rem; margin-bottom: 0.3rem; line-height: 1.3; }
.module-title { font-size: 0.78rem; margin-bottom: 0.4rem; padding-bottom: 0.3rem; }
.metal-plate { font-size: 0.58rem; }
.mode-btn { font-size: 0.65rem; }
.freq-block label,
.lfo-section h3 { font-size: 0.62rem; }
.freq-readout { font-size: 0.88rem; }
.band-pills button { font-size: 0.78rem; }
.lfo-row { font-size: 0.78rem; }
.lfo-row label { font-size: 0.62rem; }
.lfo-label { font-size: 0.58rem; }
.lfo-target { font-size: 0.62rem; }
.crt-label { font-size: 0.68rem; }
.scope-readouts { font-size: 0.72rem; }
.chain-node { font-size: 0.68rem; }
.tel-row { font-size: 0.68rem; }
.bus-title { font-size: 0.68rem; }
.strip-label { font-size: 0.58rem; }
.fader-val { font-size: 0.68rem; }
.noise-btn { font-size: 0.55rem; }
.caution { font-size: 0.58rem; padding: 0.25rem; }
.preset-card strong { font-size: 0.78rem; }
.preset-card span { font-size: 0.75rem; }
.preset-card { padding: 0.38rem 0.42rem; }
.patch-hint { font-size: 0.58rem; }

.mode-selector { margin-bottom: 0.45rem; }
.freq-cluster { margin-bottom: 0.45rem; }
.freq-block { margin-bottom: 0.4rem; }
.output-bus { margin-bottom: 0.35rem; padding: 0.4rem; }
.telemetry { margin-bottom: 0.4rem; padding: 0.35rem; }
.chain-flow { margin-bottom: 0.4rem; }
.scope-readouts { margin-top: 0.3rem; }
.osc-section-label { font-size: 0.62rem; }

.ambient-strip { min-width: 130px; }

/* ─── Access gate & community ─── */
.hidden { display: none !important; }

.access-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(3, 4, 8, 0.88);
  backdrop-filter: blur(6px);
}

.access-gate[hidden] {
  display: none !important;
}

.access-gate-panel {
  position: relative;
  width: min(100%, 420px);
  padding: 1.1rem 1.15rem 1rem;
  border-radius: 6px;
}

.access-gate-panel h2 {
  font-family: var(--font-ship);
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  color: var(--brass-bright);
  margin-bottom: 0.45rem;
}

.gate-lead {
  font-size: 0.74rem;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.gate-form {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.gate-label {
  font-family: var(--font-ship);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.gate-form input[type="email"],
.gate-form input[type="text"],
.gate-form select,
.gate-form textarea {
  width: 100%;
  padding: 0.45rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-bright);
  background: linear-gradient(180deg, #0a0804, #1a1008);
  border: 2px inset var(--border-wood);
  border-radius: 3px;
}

.gate-form textarea {
  resize: vertical;
  min-height: 4.5rem;
}

.gate-consent {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  font-size: 0.68rem;
  line-height: 1.4;
  color: var(--text);
  cursor: pointer;
}

.gate-consent input {
  margin-top: 0.15rem;
  flex-shrink: 0;
}

.gate-submit {
  width: 100%;
  margin-top: 0.25rem;
}

.gate-note {
  margin-top: 0.65rem;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--crt-phosphor);
  text-align: center;
}

.form-status {
  font-size: 0.68rem;
  line-height: 1.35;
  padding: 0.35rem 0.4rem;
  border-radius: 3px;
}

.form-status-error {
  color: #e8a0a0;
  background: rgba(160, 64, 64, 0.15);
  border: 1px solid rgba(160, 64, 64, 0.35);
}

.form-status-ok {
  color: var(--crt-phosphor);
  background: rgba(74, 154, 104, 0.12);
  border: 1px solid rgba(74, 154, 104, 0.3);
}

.app-gated .console-fit {
  filter: blur(4px);
  pointer-events: none;
  user-select: none;
}

.session-log-modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(3, 4, 8, 0.75);
}

.session-log-modal[hidden] {
  display: none !important;
}

.session-log-panel {
  position: relative;
  width: min(100%, 400px);
  padding: 0.9rem 1rem;
  border-radius: 6px;
}

.session-log-panel h3 {
  font-family: var(--font-ship);
  font-size: 0.82rem;
  color: var(--brass-bright);
  margin-bottom: 0.35rem;
}

.session-log-lead {
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--text);
  margin-bottom: 0.6rem;
}

.session-log-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.35rem;
}

.tab-like-btn {
  font-family: var(--font-ship);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  padding: 0.4rem 0.65rem;
  background: linear-gradient(180deg, #1a1008, #0a0804);
  border: 2px solid var(--border-wood);
  border-radius: 3px;
  color: var(--text-dim);
  cursor: pointer;
}

.tab-like-btn:hover {
  color: var(--brass-bright);
  border-color: var(--copper);
}

.panel-offline {
  gap: 0.35rem;
  overflow: hidden;
}

.offline-header {
  flex-shrink: 0;
}

.offline-layout {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 4px;
}

.offline-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.55rem 0.65rem 0.65rem;
}

.offline-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.offline-block {
  padding: 0.55rem 0.6rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(74, 154, 104, 0.12);
}

.offline-block-buy {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.offline-block-title {
  font-family: var(--font-ship);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--brass-bright);
  margin-bottom: 0.35rem;
}

.offline-list {
  margin: 0 0 0.5rem;
  padding-left: 1.1rem;
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--text);
}

.offline-list li {
  margin-bottom: 0.25rem;
}

.offline-list-excludes {
  opacity: 0.85;
  margin-bottom: 0;
}

.offline-note {
  font-size: 0.68rem;
  line-height: 1.45;
  color: var(--text);
  margin: 0;
}

.offline-install-steps {
  margin: 0 0 0.5rem;
  padding-left: 1.15rem;
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--text-bright);
}

.offline-install-steps li {
  margin-bottom: 0.3rem;
}

.offline-install-steps code,
.offline-note code {
  font-size: 0.65rem;
  color: var(--crt-phosphor);
}

.offline-price {
  font-family: var(--font-ship);
  font-size: 1.1rem;
  color: var(--crt-amber);
  margin: 0;
}

.offline-free-btn,
.offline-donate-btn {
  align-self: flex-start;
  text-align: center;
  width: 100%;
}

.offline-free-note {
  font-size: 0.62rem;
  color: var(--crt-phosphor);
  margin: 0.25rem 0 0.65rem;
}

.offline-support-title {
  margin-top: 0.35rem;
}

.offline-letter {
  padding: 0.55rem 0.6rem;
  margin-bottom: 0.55rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.2);
}

.offline-letter p {
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--text);
  margin: 0 0 0.45rem;
}

.offline-letter p:last-child {
  margin-bottom: 0;
}

.offline-letter strong {
  color: var(--text-bright);
}

.offline-letter-sign {
  font-style: italic;
  color: var(--crt-phosphor);
  opacity: 0.9;
}

.crypto-checkout-letter {
  font-size: 0.68rem;
  line-height: 1.45;
  color: var(--text);
  margin: 0 0 0.55rem;
  padding: 0.45rem 0.5rem;
  background: rgba(0, 0, 0, 0.22);
  border-radius: 4px;
  border-left: 2px solid rgba(74, 154, 104, 0.35);
}

.crypto-free-block {
  margin-bottom: 0.55rem;
}

.crypto-free-block .engage-btn {
  width: 100%;
}

.crypto-donation-heading {
  font-family: var(--font-ship);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--brass-bright);
  margin: 0 0 0.35rem;
}

.offline-donate-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.offline-buy-hint {
  font-size: 0.65rem;
  line-height: 1.4;
  color: var(--text);
  margin: 0;
}

.offline-buy-hint code {
  font-size: 0.62rem;
  color: var(--crt-phosphor);
}

.crypto-checkout-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.crypto-checkout-modal[hidden] {
  display: none;
}

.crypto-checkout-panel {
  width: min(100%, 420px);
  max-height: 90vh;
  overflow-y: auto;
  padding: 0.65rem 0.75rem 0.75rem;
  position: relative;
}

.crypto-checkout-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.crypto-checkout-head h3 {
  font-family: var(--font-ship);
  font-size: 0.82rem;
  color: var(--brass-bright);
  margin: 0;
}

.crypto-close {
  background: transparent;
  border: none;
  color: var(--text-bright);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.2rem;
}

.crypto-checkout-lead {
  font-size: 0.68rem;
  line-height: 1.45;
  color: var(--text);
  margin: 0 0 0.5rem;
}

.crypto-donation-block {
  margin-bottom: 0.5rem;
}

.crypto-donation-input {
  width: 100%;
  margin-bottom: 0.35rem;
  padding: 0.35rem 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(74, 154, 104, 0.25);
  border-radius: 3px;
  color: var(--crt-amber);
}

.crypto-donation-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.45rem;
}

.offline-donation-presets {
  margin-bottom: 0.5rem;
}

.crypto-donate-continue {
  width: 100%;
  margin-top: 0.15rem;
}

.crypto-payment-section {
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid rgba(74, 154, 104, 0.15);
}

.crypto-payment-section[hidden] {
  display: none;
}

.crypto-chain-select {
  width: 100%;
  margin-bottom: 0.5rem;
  padding: 0.35rem 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(74, 154, 104, 0.25);
  border-radius: 3px;
  color: var(--text-bright);
}

.crypto-chain-panel {
  margin-bottom: 0.45rem;
}

.crypto-wallet-label {
  font-size: 0.62rem;
  color: var(--text);
  margin: 0 0 0.2rem;
}

.crypto-wallet-row {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  margin-bottom: 0.45rem;
}

.crypto-wallet {
  flex: 1;
  font-size: 0.58rem;
  word-break: break-all;
  padding: 0.35rem 0.4rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(74, 154, 104, 0.15);
  border-radius: 3px;
  color: var(--crt-phosphor);
}

.crypto-amount {
  font-size: 0.72rem;
  color: var(--text-bright);
  margin: 0 0 0.45rem;
}

.crypto-amount-note,
.crypto-chain-note {
  font-size: 0.62rem;
  color: var(--text);
  opacity: 0.85;
}

.crypto-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.crypto-status {
  font-size: 0.68rem;
  line-height: 1.4;
  margin: 0.35rem 0 0;
  padding: 0.35rem 0.45rem;
  border-radius: 3px;
}

.crypto-status-ok {
  color: var(--crt-phosphor);
  border: 1px solid rgba(74, 154, 104, 0.35);
  background: rgba(74, 154, 104, 0.1);
}

.crypto-status-pending {
  color: var(--crt-amber);
  border: 1px solid rgba(200, 160, 80, 0.35);
  background: rgba(200, 160, 80, 0.08);
}

.crypto-status-error {
  color: #e8a0a0;
  border: 1px solid rgba(200, 80, 80, 0.35);
  background: rgba(200, 80, 80, 0.1);
}

.crypto-download {
  margin-top: 0.5rem;
}

.crypto-download a {
  display: inline-block;
  text-decoration: none;
}

.crypto-wallets-label,
.crypto-wallet-label {
  font-size: 0.62rem;
  color: var(--text);
  margin: 0 0 0.3rem;
}

.crypto-wallets-empty {
  font-size: 0.68rem;
  line-height: 1.45;
  color: var(--text);
  margin: 0 0 0.45rem;
}

.crypto-wallet-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.3rem;
  margin-bottom: 0.5rem;
}

.crypto-wallet-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.35rem 0.25rem;
  border-radius: 4px;
  border: 1px solid rgba(74, 154, 104, 0.22);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text-bright);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.crypto-wallet-btn:hover {
  border-color: var(--crt-phosphor);
  background: rgba(74, 154, 104, 0.12);
}

.crypto-wallet-icon {
  font-family: var(--font-ship);
  font-size: 0.75rem;
  color: var(--crt-amber);
}

.crypto-wallet-name {
  text-align: center;
  line-height: 1.2;
}

.crypto-live-badge {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.62rem;
  color: var(--crt-phosphor);
  margin: 0.45rem 0 0;
}

.crypto-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--crt-phosphor);
  box-shadow: 0 0 6px var(--crt-phosphor);
  animation: crypto-pulse 1.4s ease-in-out infinite;
}

@keyframes crypto-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@media (max-width: 420px) {
  .crypto-wallet-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .offline-grid {
    grid-template-columns: 1fr;
  }
}

.panel-experiences {
  gap: 0.35rem;
  overflow: hidden;
}

.experiences-header {
  flex-shrink: 0;
}

.experiences-layout {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 4px;
}

.experiences-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.55rem 0.65rem 0.65rem;
}

.experiences-section {
  margin-bottom: 0.85rem;
}

.experiences-signup {
  padding-bottom: 0.65rem;
  border-bottom: 1px solid rgba(74, 154, 104, 0.15);
}

.experiences-optional-tag {
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 400;
  text-transform: uppercase;
}

.experiences-signup-form {
  max-width: 28rem;
}

.signup-subscribed {
  max-width: 28rem;
}

.experiences-section-title {
  font-family: var(--font-ship);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--brass-bright);
  margin-bottom: 0.4rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid rgba(74, 154, 104, 0.12);
}

.experiences-lead {
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.experiences-feed-hint {
  font-size: 0.68rem;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 0.45rem;
}

.experiences-feed-section {
  padding-top: 0.35rem;
  border-top: 1px solid rgba(74, 154, 104, 0.15);
}

.experiences-feed {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.experiences-loading,
.experiences-empty {
  font-size: 0.72rem;
  color: var(--text);
  text-align: center;
  padding: 0.75rem 0.5rem;
}

.experience-card {
  padding: 0.55rem 0.6rem;
  border-radius: 4px;
}

.experience-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.45rem;
  margin-bottom: 0.3rem;
}

.experience-card-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.experience-card-meta strong {
  font-family: var(--font-ship);
  font-size: 0.68rem;
  color: var(--brass-bright);
}

.experience-date {
  font-size: 0.58rem;
  color: var(--text);
  opacity: 0.75;
}

.experience-rating {
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  flex-shrink: 0;
  line-height: 1;
}

.experience-rating .stars-lit {
  color: var(--crt-amber);
}

.experience-rating .stars-dim {
  color: rgba(200, 160, 80, 0.22);
}

.experience-program {
  display: inline-block;
  font-size: 0.62rem;
  color: var(--crt-amber);
  margin-bottom: 0.3rem;
}

.experience-card p {
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--text);
  margin: 0;
}

.star-rating-input {
  display: inline-flex;
  flex-direction: row-reverse;
  justify-content: flex-end;
  gap: 0.12rem;
}

.star-rating-input input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.star-rating-input label {
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
  color: rgba(200, 160, 80, 0.28);
  transition: color 0.12s ease, transform 0.12s ease;
}

.star-rating-input label:hover,
.star-rating-input label:hover ~ label,
.star-rating-input input:checked + label,
.star-rating-input input:checked ~ label {
  color: var(--crt-amber);
}

.star-rating-input input:focus-visible + label {
  outline: 1px solid var(--crt-phosphor);
  outline-offset: 2px;
  border-radius: 2px;
}

.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;
}

.testimonial-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
}

.testimonial-card {
  padding: 0.55rem 0.6rem;
  border-radius: 4px;
}

.review-notice {
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--text-bright);
  padding: 0.45rem 0.55rem;
  margin-bottom: 0.65rem;
  border: 1px solid rgba(200, 160, 80, 0.35);
  border-radius: 4px;
  background: rgba(200, 160, 80, 0.08);
}

.review-notice strong {
  color: var(--crt-amber);
}

.testimonial-head {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  margin-bottom: 0.35rem;
}

.testimonial-head-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
}

.testimonial-badge {
  font-family: var(--font-ship);
  font-size: 0.48rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.12rem 0.32rem;
  border-radius: 2px;
  flex-shrink: 0;
}

.testimonial-badge-curated {
  color: var(--crt-amber);
  border: 1px solid rgba(200, 144, 72, 0.45);
  background: rgba(200, 144, 72, 0.12);
}

.testimonial-badge-approved {
  color: var(--crt-phosphor);
  border: 1px solid rgba(74, 154, 104, 0.45);
  background: rgba(74, 154, 104, 0.12);
}

.testimonial-head strong {
  font-family: var(--font-ship);
  font-size: 0.68rem;
  color: var(--brass-bright);
}

.testimonial-program {
  font-size: 0.62rem;
  color: var(--crt-amber);
}

.testimonial-card p {
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.testimonial-band {
  font-size: 0.58rem;
  color: var(--crt-phosphor);
  letter-spacing: 0.04em;
}

.testimonial-form-row {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

@media (max-width: 900px) {
  .testimonial-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── Laptop viewport tuning ─── */
@media (max-height: 900px) {
  .bridge { padding: 0.15rem 0.3rem; }
  .wood-cap { padding: 0.18rem 0.55rem; }
  .wood-cap.bottom { padding: 0.28rem 0.85rem; }
  .header { padding: 0.22rem 0.5rem; gap: 0.35rem; }
  .brand h1 { font-size: 0.82rem; }
  .brand-mark { font-size: 1.15rem; }
  .tagline { font-size: 0.48rem; }
  .tabs { padding: 0.12rem 0.35rem 0; }
  .tab { padding: 0.28rem 0.4rem; }
  .main { padding: 0.28rem 0.4rem; }
  .patch-hint { display: none; }
  .module-title { margin-bottom: 0.1rem; padding-bottom: 0.15rem; }
  .deck-layout { grid-template-rows: minmax(0, 16%) minmax(0, 1fr); }
  .preset-card strong { font-size: 0.58rem; }
  .preset-card span { font-size: 0.54rem; }
  .manual-fit-scaler { padding: 0.38rem 0.42rem 0.42rem; }
  .manual-fit { gap: 0.42rem; }
  .osc-output-bus .fader-well,
  .osc-output-bus .vu-window { height: 72px; }
  .osc-output-bus .bus-strips { gap: 0.65rem; padding: 0.18rem 0.28rem 0.22rem; }
}

.osc-telemetry { margin-bottom: 0; }
.osc-controls .mode-selector { margin-bottom: 0; }
.osc-block .mode-lock { margin-bottom: 0.2rem; }
.osc-block .caution { margin-top: 0; margin-bottom: 0; }
.osc-controls .caution { margin-top: 0; }

/* ─── Phone / mobile layout ─── */
@media (max-width: 768px) {
  html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
  }

  html, body {
    overflow: hidden;
    height: 100%;
    height: 100dvh;
  }

  .cosmos .nebula-a,
  .cosmos .nebula-b,
  .cosmos .planet-glow {
    opacity: 0.12;
  }

  .viewport-hud {
    display: none;
  }

  .bridge {
    padding:
      max(0.35rem, env(safe-area-inset-top))
      max(0.35rem, env(safe-area-inset-right))
      max(0.2rem, env(safe-area-inset-bottom))
      max(0.35rem, env(safe-area-inset-left));
  }

  .console-frame {
    max-width: none;
    max-height: none;
    border-width: 3px;
    border-radius: 4px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
  }

  .wood-cap.top {
    padding: 0.35rem 0.55rem;
  }

  .cap-plate {
    font-size: 0.48rem;
    letter-spacing: 0.18em;
  }

  .wood-cap.bottom {
    display: none;
  }

  .header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
    padding: 0.45rem 0.55rem 0.35rem;
  }

  .brand {
    justify-content: center;
    text-align: center;
    gap: 0.55rem;
  }

  .brand h1 {
    font-size: 0.82rem;
  }

  .tagline {
    font-size: 0.48rem;
  }

  .header-controls {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.45rem 0.55rem;
    padding:
      0.55rem max(0.65rem, env(safe-area-inset-right))
      calc(0.55rem + env(safe-area-inset-bottom))
      max(0.65rem, env(safe-area-inset-left));
    background:
      linear-gradient(180deg, rgba(14, 18, 24, 0.92), rgba(8, 10, 14, 0.98));
    border-top: 2px solid var(--border-metal);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(10px);
  }

  .session-block {
    flex: 1 1 7.5rem;
    min-width: 6.5rem;
  }

  .session-block select {
    width: 100%;
    min-height: 2.5rem;
    font-size: 0.82rem;
  }

  .timer-display {
    font-size: 1.1rem;
    min-width: 4.25rem;
    padding: 0.35rem 0.45rem;
  }

  .session-idle-hint {
    display: none;
  }

  .engage-btn {
    min-height: 2.85rem;
    padding: 0.6rem 1.1rem;
    font-size: 0.78rem;
    touch-action: manipulation;
  }

  .engage-btn.start-btn,
  .engage-btn.halt-btn {
    flex: 1 1 8.5rem;
    justify-content: center;
    max-width: 11rem;
  }

  .tabs {
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    gap: 4px;
    padding: 0.35rem 0.45rem 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab {
    flex: 0 0 auto;
    min-height: 2.65rem;
    padding: 0.5rem 0.85rem;
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    touch-action: manipulation;
  }

  .tab-long { display: none; }
  .tab-short { display: inline; }

  .main {
    padding: 0.45rem 0.45rem calc(5.25rem + env(safe-area-inset-bottom));
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .panel.active {
    overflow: visible;
    min-height: min-content;
  }

  .deck-layout {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .deck-layout .patch-bay,
  .deck-layout .osc-controls,
  .deck-layout .osc-monitor {
    grid-column: auto;
    grid-row: auto;
    min-height: 0;
    overflow: visible;
  }

  .patch-bay .module-face {
    overflow: visible;
    padding: 0.55rem 0.55rem 0.6rem;
  }

  .patch-hint {
    font-size: 0.62rem;
    line-height: 1.35;
  }

  .preset-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
    gap: 0.4rem;
    overflow: visible;
  }

  .preset-card {
    min-height: 4.5rem;
    padding: 0.55rem 0.55rem;
  }

  .preset-card strong {
    font-size: 0.68rem;
  }

  .preset-card span,
  .preset-card .preset-meta {
    font-size: 0.62rem !important;
  }

  .deck-layout .patch-bay { order: 1; }
  .deck-layout .osc-monitor { order: 2; min-height: 10.5rem; }
  .deck-layout .osc-controls { order: 3; }

  .crt-bezel {
    min-height: 8.5rem;
    flex: none;
  }

  #visualizer {
    min-height: 6.5rem;
  }

  .signal-readouts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
  }

  .signal-telemetry {
    grid-template-columns: 1fr 1fr;
  }

  .osc-controls .module-face {
    overflow: visible;
    padding: 0.55rem 0.55rem 0.6rem;
    gap: 0.45rem;
  }

  .mode-bar .mode-lock,
  .mode-bar .binaural-lock {
    font-size: 0.58rem;
    padding: 0.38rem 0.5rem;
  }

  .freq-adjusters {
    grid-template-columns: 1fr;
    gap: 0.45rem;
  }

  .freq-adjuster {
    padding: 0.5rem 0.55rem;
  }

  .freq-adjuster-head .osc-section-label {
    font-size: 0.62rem;
  }

  .freq-adjuster-readout {
    font-size: 1.05rem;
  }

  .freq-slider {
    height: 1.35rem;
    margin-bottom: 0.5rem;
  }

  .freq-slider::-webkit-slider-thumb {
    width: 1.65rem;
    height: 1.85rem;
  }

  .freq-slider::-moz-range-thumb {
    width: 1.65rem;
    height: 1.85rem;
  }

  .freq-adjuster .band-pills button,
  .freq-adjuster .carrier-pills button,
  .band-pills button,
  .carrier-pills button,
  .lfo-target,
  .noise-btn,
  .mode-btn {
    min-height: 2.45rem;
    font-size: 0.62rem;
    touch-action: manipulation;
  }

  .lfo-panel-grid {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }

  .lfo-panel .lfo-targets {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem;
  }

  .osc-output-bus {
    padding: 0.5rem 0.45rem 0.45rem;
  }

  .osc-output-bus .bus-strips {
    gap: 1.25rem;
    padding: 0.35rem 0.4rem 0.4rem;
  }

  .osc-output-bus .fader-well,
  .osc-output-bus .vu-window {
    height: 6.5rem;
  }

  .osc-output-bus .ambient-strip {
    max-width: none;
    flex: 1;
  }

  .noise-toggles {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.3rem;
  }

  .noise-btn {
    min-width: 2.6rem;
  }

  .panel > h2,
  .manual-header h2,
  .offline-header h2,
  .experiences-header h2 {
    font-size: 0.92rem;
  }

  .panel-desc {
    font-size: 0.74rem;
    line-height: 1.45;
  }

  .program-controls {
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }

  .program-volume-row label {
    min-width: 0;
    font-size: 0.62rem;
  }

  .program-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: none;
    gap: 0.4rem;
    overflow: visible;
    flex: none;
  }

  .program-card {
    min-height: 6.75rem;
    padding: 0.75rem 5.5rem 0.75rem 0.75rem;
  }

  .program-card strong {
    font-size: 1rem;
  }

  .program-card span {
    font-size: 0.86rem;
  }

  .program-card .preset-meta {
    font-size: 0.8rem !important;
  }

  .program-card-wrap > .program-share-btn {
    top: 0.4rem;
    right: 0.4rem;
    font-size: 0.58rem;
    padding: 0.34rem 0.5rem;
  }

  .program-share-btn-status {
    font-size: 0.62rem;
    padding: 0.4rem 0.65rem;
    width: 100%;
    justify-content: center;
    margin-left: 0;
  }

  .manual-fit-scaler {
    overflow-y: visible;
    padding: 0.55rem 0.55rem 0.65rem;
  }

  .manual-fit {
    gap: 0.65rem;
  }

  .band-spectrum,
  .ops-grid {
    grid-template-columns: 1fr;
  }

  .experiences-scroll {
    padding: 0.65rem 0.65rem 0.75rem;
  }

  .access-gate,
  .session-log-modal,
  .crypto-checkout-modal {
    padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right)) max(0.75rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
    align-items: flex-end;
  }

  .access-gate-panel,
  .session-log-panel,
  .crypto-checkout-panel {
    width: 100%;
    max-height: calc(100dvh - 1.5rem - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .gate-form input[type="email"],
  .gate-form input[type="text"],
  .gate-form select,
  .gate-form textarea,
  .crypto-donation-input,
  .crypto-chain-select {
    min-height: 2.75rem;
    font-size: 16px;
  }

  .engage-btn,
  .tab-like-btn,
  .preset-card,
  .program-card {
    touch-action: manipulation;
  }
}

@media (max-width: 380px) {
  .preset-grid,
  .program-grid {
    grid-template-columns: 1fr;
  }

  .engage-btn.start-btn,
  .engage-btn.halt-btn {
    flex: 1 1 100%;
    max-width: none;
  }

  .timer-display {
    order: -1;
    flex: 1 1 100%;
  }
}