:root {
  --bg-void: #06080d;
  --bg-surface: rgba(13, 17, 26, 0.78);
  --bg-surface-strong: rgba(17, 23, 35, 0.9);
  --border-subtle: rgba(255, 255, 255, 0.075);
  --border-highlight: rgba(255, 255, 255, 0.14);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --blue: #60a5fa;
  --cyan: #38bdf8;
  --gold: #f59e0b;
  --gold-bright: #fcd34d;
  --emerald: #10b981;
  --emerald-bright: #34d399;
  --violet: #a78bfa;
  --coral: #fb7185;

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
  --font-serif: 'Instrument Serif', Georgia, serif;

  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

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

html,
body {
  height: 100%;
  background: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  user-select: none;
}

/* AMBIENT CINEMATIC BACKGROUND */
.ambient-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.24;
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.8s ease;
  will-change: transform, opacity;
}

.orb-gold {
  width: 680px;
  height: 680px;
  right: -120px;
  top: -160px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.72) 0%, rgba(245, 158, 11, 0) 70%);
}

.orb-cyan {
  width: 560px;
  height: 560px;
  left: -140px;
  bottom: -180px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.55) 0%, rgba(56, 189, 248, 0) 70%);
}

.ambient-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 70% at 55% 45%, #000 10%, transparent 100%);
}

/* APP SHELL */
.app-shell {
  position: relative;
  z-index: 1;
  height: 100vh;
  width: 100vw;
  max-width: 1920px;
  margin: 0 auto;
  padding: 16px 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: padding 0.35s ease;
}

.app-shell.cinema-mode {
  padding: 14px 24px 16px;
}

.app-shell.cinema-mode .shortcut-bar {
  display: none;
}

/* TOP STUDIO BAR */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 46px;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: grid;
  place-items: center;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.14);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-title {
  font-size: 0.94rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--text-primary);
}

.brand-sub {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  margin-top: 2px;
}

/* PRESET RIBBON */
.preset-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(15, 20, 30, 0.75);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(14px);
  overflow-x: auto;
  scrollbar-width: none;
}

.preset-bar::-webkit-scrollbar {
  display: none;
}

.preset-pill {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.preset-pill:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.preset-pill.active {
  color: #0b0f17;
  background: linear-gradient(135deg, #fde68a 0%, #f59e0b 100%);
  box-shadow: 0 2px 14px rgba(245, 158, 11, 0.35);
}

/* STUDIO ACTIONS */
.studio-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.action-btn,
.icon-btn {
  appearance: none;
  border: 1px solid var(--border-subtle);
  background: rgba(17, 23, 35, 0.75);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  backdrop-filter: blur(12px);
}

.action-btn {
  padding: 0 13px;
}

.icon-btn {
  width: 36px;
  padding: 0;
  color: var(--text-secondary);
}

.btn-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.action-btn:hover,
.icon-btn:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(28, 36, 54, 0.9);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.action-btn:active,
.icon-btn:active {
  transform: translateY(0);
}

.action-btn-primary {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(252, 211, 77, 0.1));
  border-color: rgba(245, 158, 11, 0.42);
  color: var(--gold-bright);
}

.action-btn-primary:hover {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(252, 211, 77, 0.18));
  border-color: rgba(252, 211, 77, 0.65);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.24);
}

.action-btn.baseline-active {
  background: rgba(167, 139, 250, 0.16);
  border-color: rgba(167, 139, 250, 0.55);
  color: #ddd6fe;
  box-shadow: 0 0 18px rgba(167, 139, 250, 0.22);
}

.icon-btn.active {
  border-color: rgba(56, 189, 248, 0.5);
  color: var(--cyan);
  background: rgba(56, 189, 248, 0.12);
}

/* MAIN STAGE GRID */
.stage {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 372px minmax(0, 1fr);
  gap: 18px;
}

/* LEFT CONTROL DECK */
.control-deck {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-height: 0;
}

.param-card,
.anatomy-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 12px 16px 11px;
  backdrop-filter: blur(20px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 12px 32px rgba(0, 0, 0, 0.35);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.param-card:hover,
.param-card:focus-within {
  border-color: rgba(255, 255, 255, 0.15);
}

.param-card[data-accent="blue"]:focus-within {
  box-shadow: inset 0 1px 0 rgba(96, 165, 250, 0.25), 0 0 28px rgba(96, 165, 250, 0.12);
}

.param-card[data-accent="cyan"]:focus-within {
  box-shadow: inset 0 1px 0 rgba(56, 189, 248, 0.25), 0 0 28px rgba(56, 189, 248, 0.12);
}

.param-card[data-accent="gold"]:focus-within {
  box-shadow: inset 0 1px 0 rgba(245, 158, 11, 0.3), 0 0 28px rgba(245, 158, 11, 0.14);
}

.param-card[data-accent="emerald"]:focus-within {
  box-shadow: inset 0 1px 0 rgba(16, 185, 129, 0.28), 0 0 28px rgba(16, 185, 129, 0.14);
}

.param-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 7px;
}

.param-label-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.param-index {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.param-label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.param-value-wrap {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  padding: 2px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.param-value-wrap:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

.param-value-wrap:focus-within {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.28);
}

.value-prefix,
.value-suffix {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.param-input {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.32rem;
  font-weight: 700;
  width: 108px;
  text-align: right;
  outline: none;
  letter-spacing: -0.02em;
  user-select: text;
}

.param-input-sm {
  width: 62px;
}

/* CUSTOM LUMINOUS RANGE SLIDERS */
.slider-wrap {
  position: relative;
  height: 20px;
  display: flex;
  align-items: center;
  margin-bottom: 7px;
}

.neon-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 7px;
  border-radius: 999px;
  outline: none;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.08);
  transition: height 0.15s ease;
}

.neon-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--thumb-color, #38bdf8);
  box-shadow:
    0 0 0 4px var(--thumb-glow, rgba(56, 189, 248, 0.22)),
    0 3px 10px rgba(0, 0, 0, 0.5);
  cursor: grab;
  transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.16s ease;
}

.neon-slider::-webkit-slider-thumb:hover {
  transform: scale(1.16);
  box-shadow:
    0 0 0 7px var(--thumb-glow, rgba(56, 189, 248, 0.32)),
    0 4px 14px rgba(0, 0, 0, 0.6);
}

.neon-slider:active::-webkit-slider-thumb {
  cursor: grabbing;
  transform: scale(1.22);
  box-shadow:
    0 0 0 9px var(--thumb-glow, rgba(56, 189, 248, 0.38)),
    0 4px 16px rgba(0, 0, 0, 0.65);
}

.neon-slider::-moz-range-thumb {
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--thumb-color, #38bdf8);
  box-shadow:
    0 0 0 4px var(--thumb-glow, rgba(56, 189, 248, 0.22)),
    0 3px 10px rgba(0, 0, 0, 0.5);
  cursor: grab;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.slider-blue {
  --thumb-color: #60a5fa;
  --thumb-glow: rgba(96, 165, 250, 0.28);
}

.slider-cyan {
  --thumb-color: #38bdf8;
  --thumb-glow: rgba(56, 189, 248, 0.28);
}

.slider-gold {
  --thumb-color: #f59e0b;
  --thumb-glow: rgba(245, 158, 11, 0.32);
}

.slider-emerald {
  --thumb-color: #10b981;
  --thumb-glow: rgba(16, 185, 129, 0.3);
}

.slider-violet {
  --thumb-color: #a78bfa;
  --thumb-glow: rgba(167, 139, 250, 0.32);
}

.slider-sm {
  height: 5px;
}

.slider-sm::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  border-width: 2.5px;
}

.slider-sm::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-width: 2.5px;
}

.param-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.param-meta {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.strong-cyan {
  color: #7dd3fc;
  font-weight: 600;
}

.quick-chips {
  display: flex;
  gap: 4px;
}

.chip {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.67rem;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.chip:hover {
  background: rgba(96, 165, 250, 0.15);
  border-color: rgba(96, 165, 250, 0.4);
  color: #bfdbfe;
}

.chip.active {
  background: rgba(96, 165, 250, 0.22);
  border-color: rgba(96, 165, 250, 0.6);
  color: #eff6ff;
}

.context-pill {
  font-size: 0.71rem;
  font-weight: 600;
  color: var(--gold-bright);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.26);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

/* WEALTH ANATOMY & ADVANCED STUDIO MODULE */
.anatomy-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 11px 16px 12px;
}

.deck-tab-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.deck-tabs {
  display: inline-flex;
  padding: 3px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.065);
}

.deck-tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.18s ease;
}

.deck-tab:hover {
  color: var(--text-primary);
}

.deck-tab.active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

.adv-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 8px var(--coral);
}

.deck-pane {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  justify-content: space-between;
}

.deck-pane.active {
  display: flex;
}

/* ADVANCED CONTROLS PANE */
.adv-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.adv-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.adv-label {
  font-size: 0.77rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.adv-val-group {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.adv-val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.88rem;
  font-weight: 700;
  min-width: 44px;
  text-align: right;
}

.val-violet {
  color: #c4b5fd;
}

.val-coral {
  color: #fda4af;
}

.adv-meta-tag {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.13);
  border: 1px solid rgba(52, 211, 153, 0.3);
  padding: 2px 6px;
  border-radius: 6px;
}

.cadence-pills {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.cad-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.cad-btn:hover {
  color: var(--text-primary);
}

.cad-btn.active {
  background: rgba(167, 139, 250, 0.24);
  color: #ede9fe;
}

.adv-mc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.065);
}

.adv-mc-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.adv-mc-sub {
  font-family: var(--font-mono);
  font-size: 0.67rem;
  color: var(--text-muted);
}

.adv-mc-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mini-icon-btn {
  appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.18s ease;
}

.mini-icon-btn svg {
  width: 14px;
  height: 14px;
}

.mini-icon-btn:hover {
  border-color: rgba(251, 113, 133, 0.5);
  color: #fecdd3;
  background: rgba(251, 113, 133, 0.14);
}

.toggle-switch {
  appearance: none;
  position: relative;
  width: 42px;
  height: 23px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: all 0.22s ease;
}

.toggle-switch .toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #e2e8f0;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), background 0.22s ease;
}

.toggle-switch.on {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.65), rgba(245, 158, 11, 0.65));
  border-color: rgba(251, 113, 133, 0.65);
  box-shadow: 0 0 16px rgba(244, 63, 94, 0.28);
}

.toggle-switch.on .toggle-knob {
  transform: translateX(19px);
  background: #ffffff;
}

.anatomy-top {
  display: flex;
  flex-direction: column;
}

.anatomy-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 11px;
}

.anatomy-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.anatomy-ratio {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--gold-bright);
  font-variant-numeric: tabular-nums;
}

.ratio-bar {
  height: 12px;
  width: 100%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  display: flex;
  gap: 2px;
  margin-bottom: 9px;
}

.ratio-seg {
  height: 100%;
  border-radius: 999px;
  will-change: width;
}

.ratio-contrib {
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
}

.ratio-growth {
  background: linear-gradient(90deg, #d97706, #fbbf24, #fde68a);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.4);
}

.ratio-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.73rem;
  color: var(--text-secondary);
}

.r-lbl {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.r-lbl strong {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.milestone-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.milestone-box {
  background: rgba(255, 255, 255, 0.028);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 11px;
  padding: 9px 11px;
}

.ms-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}

.ms-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.ms-dot-gold {
  background: var(--gold-bright);
  box-shadow: 0 0 10px var(--gold);
}

.ms-dot-emerald {
  background: var(--emerald-bright);
  box-shadow: 0 0 10px var(--emerald);
}

.ms-label {
  font-size: 0.69rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.ms-val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.ms-desc {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* RIGHT: VISUAL STAGE */
.visual-stage {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  min-height: 0;
}

/* TELEMETRY HERO HEADER */
.telemetry-strip {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  backdrop-filter: blur(20px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 12px 32px rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
}

.hero-kpi {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.kpi-eyebrow strong {
  color: var(--text-primary);
}

.delta-badge {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  text-transform: none;
  letter-spacing: 0;
}

.delta-badge.positive {
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(52, 211, 153, 0.42);
  color: #6ee7b7;
}

.delta-badge.negative {
  background: rgba(251, 113, 133, 0.16);
  border: 1px solid rgba(251, 113, 133, 0.42);
  color: #fda4af;
}

.delta-badge.neutral {
  background: rgba(167, 139, 250, 0.14);
  border: 1px solid rgba(167, 139, 250, 0.35);
  color: #ddd6fe;
}

.mc-pill-badge {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(251, 113, 133, 0.13);
  border: 1px solid rgba(251, 113, 133, 0.38);
  color: #fecdd3;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
}

.hero-number {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(2.15rem, 3.2vw, 3.15rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  background: linear-gradient(180deg, #ffffff 10%, #fde68a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 28px rgba(245, 158, 11, 0.22));
}

.sub-kpis {
  display: flex;
  align-items: center;
  gap: 26px;
}

.sub-kpi {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-left: 22px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.sub-kpi-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.sub-kpi-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sub-kpi-val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.24rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.sub-kpi-val small {
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-left: 2px;
}

.val-gold {
  color: var(--gold-bright);
}

.val-emerald {
  color: var(--emerald-bright);
}

.mult-pill {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(252, 211, 77, 0.35);
  color: #fde68a;
}

/* CHART CARD */
.chart-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 18px 44px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 18px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
  flex-shrink: 0;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mc-toolbar-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.mc-toggle-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.mc-toggle-btn:hover {
  color: var(--text-primary);
  border-color: rgba(251, 113, 133, 0.4);
  background: rgba(251, 113, 133, 0.09);
}

.mc-toggle-btn.active {
  color: #fff1f2;
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.24), rgba(245, 158, 11, 0.18));
  border-color: rgba(251, 113, 133, 0.58);
  box-shadow: 0 0 18px rgba(244, 63, 94, 0.22);
}

.mc-sigma-tag {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  color: #fda4af;
  background: rgba(251, 113, 133, 0.14);
  padding: 1px 5px;
  border-radius: 5px;
}

.mc-reshuffle-btn {
  appearance: none;
  width: 29px;
  height: 29px;
  border-radius: 8px;
  border: 1px solid rgba(251, 113, 133, 0.38);
  background: rgba(251, 113, 133, 0.12);
  color: #fecdd3;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.18s ease;
}

.mc-reshuffle-btn svg {
  width: 14px;
  height: 14px;
}

.mc-reshuffle-btn:hover {
  background: rgba(251, 113, 133, 0.24);
  transform: rotate(35deg);
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.seg-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 7px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.seg-btn:hover {
  color: var(--text-primary);
}

.seg-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.legend-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  overflow: hidden;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.73rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.legend-baseline {
  color: #ddd6fe;
  background: rgba(167, 139, 250, 0.12);
  border: 1px solid rgba(167, 139, 250, 0.35);
  padding: 2px 8px 2px 9px;
  border-radius: 999px;
}

.legend-clear {
  appearance: none;
  border: none;
  background: transparent;
  color: #c4b5fd;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  margin-left: 2px;
}

.legend-clear:hover {
  color: #ffffff;
}

.swatch {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 3px;
}

.swatch-cyan {
  background: linear-gradient(135deg, #0284c7, #38bdf8);
}

.swatch-gold {
  background: linear-gradient(135deg, #d97706, #fcd34d);
}

.swatch-violet {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: #a78bfa;
}

.swatch-rose {
  background: linear-gradient(135deg, rgba(251, 113, 133, 0.85), rgba(251, 191, 36, 0.65));
}

.horizon-group {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.hor-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.hor-btn:hover {
  color: var(--text-primary);
}

.hor-btn.active {
  background: rgba(245, 158, 11, 0.22);
  color: var(--gold-bright);
}

/* CANVAS CONTAINER */
.canvas-container {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  cursor: crosshair;
}

#wealthCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* FLOATING GLASS TOOLTIP */
.hover-tooltip {
  position: absolute;
  top: 0;
  left: 0;
  width: 248px;
  padding: 13px 15px;
  border-radius: 14px;
  background: rgba(11, 15, 25, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  pointer-events: none;
  opacity: 0;
  transform: translate3d(0, 6px, 0) scale(0.97);
  transition: opacity 0.16s ease;
  z-index: 10;
}

.hover-tooltip.visible {
  opacity: 1;
}

.tt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.tt-year {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.tt-share {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--gold-bright);
  background: rgba(245, 158, 11, 0.14);
  padding: 2px 7px;
  border-radius: 999px;
}

.tt-total {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.38rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.tt-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--text-secondary);
}

.tt-row span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tt-row strong {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text-primary);
}

.tt-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 2px 0;
}

/* SHARED DOTS */
.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-cyan {
  background: var(--cyan);
}

.dot-gold {
  background: var(--gold-bright);
}

.dot-emerald {
  background: var(--emerald-bright);
}

.dot-violet {
  background: var(--violet);
}

/* KEYBOARD SHORTCUT BAR */
.shortcut-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.shortcut-items {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.shortcut-items kbd {
  font-family: var(--font-mono);
  font-size: 0.67rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  padding: 1px 6px;
  margin-right: 4px;
}

/* RESPONSIVE FALLBACK FOR TABLETS & MOBILE (ZERO DESKTOP IMPACT > 1520px) */
@media (max-width: 1520px) and (min-width: 961px) {
  .telemetry-strip {
    padding: 14px 18px;
    gap: 14px;
  }
  .sub-kpis {
    gap: 16px;
  }
  .sub-kpi {
    padding-left: 14px;
  }
  .sub-kpi-val {
    font-size: 1.1rem;
  }
  .kpi-eyebrow {
    flex-wrap: wrap;
    white-space: normal;
    gap: 6px;
  }
}

@media (max-width: 1180px) and (min-width: 961px) {
  .stage {
    grid-template-columns: 332px minmax(0, 1fr);
    gap: 14px;
  }
  .sub-kpis {
    gap: 16px;
  }
  .sub-kpi {
    padding-left: 14px;
  }
}

@media (max-width: 960px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    overflow: visible;
    overflow-x: clip;
    -webkit-overflow-scrolling: touch;
  }

  .app-shell {
    height: auto;
    min-height: 100dvh;
    width: 100%;
    max-width: 100%;
    padding: 8px 12px 28px;
    gap: 8px;
    overflow-x: clip;
  }

  /* 2-row tidy topbar: Row 1 Brand + Actions, Row 2 Swipeable Presets */
  .topbar {
    flex-wrap: wrap;
    gap: 8px;
    min-height: 0;
  }

  .brand {
    order: 1;
    gap: 8px;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
  }

  .brand-title {
    font-size: 0.85rem;
  }

  .brand-sub {
    display: none;
  }

  .studio-actions {
    order: 2;
    gap: 6px;
  }

  .action-btn {
    height: 32px;
    padding: 0 10px;
    font-size: 0.72rem;
    gap: 5px;
  }

  .icon-btn {
    width: 32px;
    height: 32px;
  }

  /* Hide desktop-only Cinema button & keyboard shortcut footer on mobile */
  #btnCinema,
  .shortcut-bar {
    display: none !important;
  }

  .preset-bar {
    order: 3;
    flex: 1 0 100%;
    max-width: 100%;
    padding: 3px;
    gap: 4px;
  }

  .preset-pill {
    font-size: 0.72rem;
    padding: 5px 11px;
  }

  /* STAGE: Chart FIRST (sticky!) + Scrollable Parameter Deck BELOW */
  .stage {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
  }

  .visual-stage {
    order: 1;
    position: sticky;
    top: 0;
    z-index: 25;
    gap: 8px;
    padding-top: 4px;
    padding-bottom: 6px;
    background: linear-gradient(180deg, rgba(6, 8, 13, 0.98) 0%, rgba(6, 8, 13, 0.94) 92%, rgba(6, 8, 13, 0) 100%);
    backdrop-filter: blur(14px);
  }

  .control-deck {
    order: 2;
    gap: 10px;
  }

  /* Compact Telemetry Strip inside sticky visualizer */
  .telemetry-strip {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 9px 12px;
    border-radius: 13px;
  }

  .hero-kpi {
    gap: 1px;
  }

  .kpi-eyebrow {
    font-size: 0.64rem;
    flex-wrap: wrap;
    gap: 5px;
    white-space: normal;
  }

  .delta-badge,
  .mc-pill-badge {
    font-size: 0.62rem;
    padding: 1px 6px;
  }

  .hero-number {
    font-size: clamp(1.5rem, 6.5vw, 2.05rem);
  }

  .sub-kpis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.065);
  }

  .sub-kpi {
    padding-left: 0;
    border-left: none;
    gap: 1px;
    min-width: 0;
  }

  .sub-kpi-label {
    font-size: 0.6rem;
    gap: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sub-kpi-row {
    gap: 4px;
    flex-wrap: nowrap;
  }

  .sub-kpi-val {
    font-size: 0.82rem;
  }

  .sub-kpi-val small {
    font-size: 0.62rem;
  }

  .mult-pill {
    font-size: 0.58rem;
    padding: 1px 4px;
  }

  /* Compact Sticky Chart Card */
  .chart-card {
    border-radius: 13px;
  }

  .chart-toolbar {
    flex-wrap: wrap;
    padding: 6px 9px;
    gap: 5px 6px;
  }

  .toolbar-left {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: nowrap;
    flex: 1 1 auto;
    min-width: 0;
  }

  .seg-btn {
    font-size: 0.65rem;
    padding: 3px 7px;
  }

  .mc-toggle-btn {
    font-size: 0.65rem;
    padding: 3px 7px;
    gap: 4px;
  }

  .mc-toggle-btn .btn-icon {
    width: 12px;
    height: 12px;
  }

  .mc-sigma-tag {
    display: none;
  }

  .mc-reshuffle-btn {
    width: 24px;
    height: 24px;
  }

  /* Hide redundant legend on small screens */
  .legend-strip {
    display: none;
  }

  .horizon-group {
    margin-left: auto;
    padding: 2px;
    gap: 2px;
    flex-shrink: 0;
  }

  .hor-btn {
    font-size: 0.63rem;
    padding: 2px 6px;
  }

  .canvas-container {
    height: 174px;
    min-height: 158px;
    max-height: 24vh;
    touch-action: pan-y;
  }

  /* Compact Hover/Tap Tooltip on Mobile */
  .hover-tooltip {
    width: 204px;
    padding: 10px 12px;
    border-radius: 11px;
  }

  .tt-total {
    font-size: 1.08rem;
    margin-bottom: 6px;
  }

  .tt-row {
    font-size: 0.68rem;
  }

  /* Thumb-friendly Parameter Cards below sticky chart */
  .param-card,
  .anatomy-card {
    padding: 13px 14px;
    border-radius: 14px;
  }

  .param-top {
    margin-bottom: 8px;
  }

  .param-input {
    font-size: 1.24rem;
    width: 96px;
  }

  .param-input-sm {
    width: 56px;
  }

  .slider-wrap {
    height: 30px;
    margin-bottom: 8px;
  }

  .neon-slider {
    height: 8px;
  }

  .neon-slider::-webkit-slider-thumb {
    width: 25px;
    height: 25px;
  }

  .neon-slider::-moz-range-thumb {
    width: 25px;
    height: 25px;
  }

  .slider-sm {
    height: 7px;
  }

  .slider-sm::-webkit-slider-thumb {
    width: 22px;
    height: 22px;
  }

  .slider-sm::-moz-range-thumb {
    width: 22px;
    height: 22px;
  }

  .param-footer {
    flex-wrap: wrap;
    gap: 6px;
  }

  .param-meta {
    font-size: 0.7rem;
  }

  .anatomy-card {
    flex: none;
    gap: 12px;
  }

  .deck-pane.active {
    gap: 12px;
  }

  .adv-group {
    gap: 8px;
  }
}

@media (max-width: 440px) {
  .brand-title {
    letter-spacing: 0.12em;
    font-size: 0.8rem;
  }

  #baselineLabel {
    display: none;
  }

  #btnBaseline {
    padding: 0 9px;
  }

  .canvas-container {
    height: 162px;
  }

  .sub-kpi-val {
    font-size: 0.74rem;
  }
}
