﻿:root {
  --paper: #f6f1e8;
  --paper-2: #fff9f0;
  --ink: #1a2433;
  --muted: #617089;
  --line: rgba(26, 36, 51, 0.12);
  --accent: #1d4d73;
  --accent-soft: rgba(29, 77, 115, 0.12);
  --buy: #0e8a57;
  --buy-soft: rgba(14, 138, 87, 0.14);
  --sell: #c24e36;
  --sell-soft: rgba(194, 78, 54, 0.16);
  --stress: #8b2d3b;
  --stress-soft: rgba(139, 45, 59, 0.16);
  --card: rgba(255, 255, 255, 0.78);
  --shadow: 0 18px 60px rgba(26, 36, 51, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Aptos", "Segoe UI Variable Text", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(212, 181, 120, 0.22), transparent 28%),
    radial-gradient(circle at bottom right, rgba(29, 77, 115, 0.15), transparent 32%),
    linear-gradient(135deg, #efe2cb 0%, #f9f6ef 48%, #eef2f6 100%);
}

.app-shell {
  width: min(1540px, calc(100vw - 32px));
  margin: 24px auto 32px;
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 30px;
  border: 1px solid rgba(26, 36, 51, 0.08);
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(255, 249, 240, 0.88), rgba(255, 255, 255, 0.72));
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  font-size: 0.74rem;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 3.7vw, 3.8rem);
  line-height: 0.95;
  font-family: "Georgia", "Palatino Linotype", serif;
}

.hero-copy {
  max-width: 72ch;
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.hero-note {
  margin: 12px 0 0;
  color: var(--accent);
  font-size: 0.94rem;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.badge,
.value-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(26, 36, 51, 0.09);
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-size: 0.84rem;
  white-space: nowrap;
}

.value-chip[data-tone="success"] {
  color: var(--buy);
  background: rgba(14, 138, 87, 0.12);
  border-color: rgba(14, 138, 87, 0.18);
}

.value-chip[data-tone="error"] {
  color: var(--sell);
  background: rgba(194, 78, 54, 0.12);
  border-color: rgba(194, 78, 54, 0.18);
}

.value-chip[data-tone="info"] {
  color: var(--accent);
}

.dashboard {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr) 370px;
  gap: 18px;
}

.panel {
  border: 1px solid rgba(26, 36, 51, 0.08);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.controls-panel,
.side-panel {
  padding: 22px;
}

.center-panel {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
  z-index: 2;
  overflow: visible;
}

.side-panel {
  position: relative;
  z-index: 1;
}

.model-panel {
  margin-top: 18px;
  padding: 22px;
}

.story-panel {
  margin-top: 18px;
  padding: 22px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-header h2,
.control-group h3,
.subpanel h3,
.signal-card h3 {
  margin: 0;
  font-size: 1rem;
}

.control-group,
.subpanel,
.formula-card,
.chart-card,
.signal-card,
.equation-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.7);
}

.controls-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

label {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
  margin-top: 12px;
  color: var(--ink);
  font-size: 0.94rem;
}

label:first-of-type {
  margin-top: 10px;
}

input[type="range"] {
  grid-column: 1 / 2;
  width: 100%;
  accent-color: var(--accent);
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.button-grid > * {
  position: relative;
}

button {
  border: 0;
  border-radius: 16px;
  font: inherit;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(26, 36, 51, 0.12);
}

.button-grid button:hover,
.button-grid button:focus-within {
  z-index: 12;
}

button:active {
  transform: translateY(1px);
}

.primary-button,
.action-button {
  padding: 12px 14px;
  font-weight: 600;
}

.primary-button {
  color: white;
  background: linear-gradient(135deg, #234f77, #173a56);
}

.action-button.buy {
  background: var(--buy-soft);
  color: var(--buy);
}

.action-button.sell {
  background: var(--sell-soft);
  color: var(--sell);
}

.action-button.neutral {
  background: var(--accent-soft);
  color: var(--accent);
}

.action-button.stress {
  background: var(--stress-soft);
  color: var(--stress);
}

.action-button.reset {
  background: rgba(26, 36, 51, 0.08);
  color: var(--ink);
}

.helper-text,
.signal-subtext {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.formula-card code {
  display: block;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(26, 36, 51, 0.06);
  color: var(--accent);
  font-family: "Cascadia Code", "Consolas", monospace;
}

.formula-title {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.info-target,
.gl-term {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  cursor: help;
  color: var(--accent);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  max-width: 100%;
}

.info-target::after,
.gl-term::after {
  content: "i";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(29, 77, 115, 0.12);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  box-shadow: 0 0 0 3px rgba(29, 77, 115, 0.06);
}

.tooltip-panel {
  position: absolute;
  left: 0;
  top: calc(100% + 12px);
  z-index: 20;
  width: min(320px, 70vw);
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(26, 36, 51, 0.1);
  background: rgba(255, 252, 246, 0.98);
  box-shadow: 0 16px 40px rgba(26, 36, 51, 0.16);
  color: var(--ink);
  line-height: 1.55;
  font-size: 0.92rem;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 150ms ease, transform 150ms ease;
}

button .gl-term,
button .info-target {
  width: 100%;
  justify-content: center;
  text-align: center;
}

button .gl-term .tooltip-panel,
button .info-target .tooltip-panel {
  left: 50%;
  top: auto;
  bottom: calc(100% + 12px);
  width: min(360px, 72vw);
  text-align: left;
  white-space: normal;
  transform: translate(-50%, 8px);
  box-shadow: 0 18px 46px rgba(26, 36, 51, 0.2);
}

.info-target:hover .tooltip-panel,
.info-target:focus-visible .tooltip-panel,
.gl-term:hover .tooltip-panel,
.gl-term:focus-visible .tooltip-panel {
  opacity: 1;
  transform: translateY(0);
}

button .info-target:hover .tooltip-panel,
button .info-target:focus-visible .tooltip-panel,
button .gl-term:hover .tooltip-panel,
button .gl-term:focus-visible .tooltip-panel {
  transform: translate(-50%, 0);
}

.info-target:focus-visible,
.gl-term:focus-visible {
  outline: 2px solid rgba(29, 77, 115, 0.28);
  outline-offset: 4px;
  border-radius: 10px;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.metric-card {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.metric-card strong {
  font-size: 1.15rem;
}

.chart-card {
  padding: 12px;
}

.market-chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.market-chart-pin-label {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(29, 77, 115, 0.12);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.market-chart-pin-label.is-hidden,
.market-chart-toggle.is-hidden {
  display: none;
}

#market-chart-card.is-collapsed {
  padding: 10px 12px;
  min-height: 0;
}

#market-chart-card.is-collapsed canvas {
  display: none;
}

#market-chart-card.is-collapsed .market-chart-toolbar {
  margin-bottom: 0;
  justify-content: center;
}

#market-chart-card.is-collapsed .market-chart-pin-label {
  display: none;
}

#price-chart {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(240, 245, 249, 0.85)),
    repeating-linear-gradient(
      to right,
      transparent 0,
      transparent 59px,
      rgba(26, 36, 51, 0.04) 60px
    ),
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 49px,
      rgba(26, 36, 51, 0.04) 50px
    );
}

.timeline-tools,
.overview-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
}

.timeline-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
}

.speed-control {
  margin: 0;
}

.timeline-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.timeline-buttons .action-button {
  min-width: 120px;
}

.timeline-buttons .action-button.is-active {
  background: linear-gradient(135deg, #234f77, #173a56);
  color: #fff;
}

.overview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.overview-header h3 {
  margin: 0;
  font-size: 1rem;
}

#overview-chart {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 18px;
  cursor: grab;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(240, 245, 249, 0.85)),
    repeating-linear-gradient(
      to right,
      transparent 0,
      transparent 59px,
      rgba(26, 36, 51, 0.04) 60px
    ),
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 39px,
      rgba(26, 36, 51, 0.04) 40px
    );
}

#overview-chart.is-dragging {
  cursor: grabbing;
}

.signal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.equation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.equation-card-wide {
  grid-column: 1 / -1;
}

.equation-code {
  display: block;
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(26, 36, 51, 0.08);
  background: rgba(26, 36, 51, 0.05);
  color: var(--accent);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "Cascadia Code", "Consolas", monospace;
}

.equation-values {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.control-mapping {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
}

.calculator-panel {
  margin-top: 18px;
  padding: 22px;
}

.calculator-inline {
  margin-top: 18px;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(246, 241, 232, 0.72));
  position: relative;
  z-index: 2;
  overflow: visible;
}

.calculator-grid-inline {
  margin-top: 12px;
}

.calculator-grid {
  display: grid;
  grid-template-columns: minmax(360px, 480px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.calculator-card {
  min-width: 0;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.calculator-card h3 {
  margin: 0;
  font-size: 1rem;
}

.mini-header {
  margin-bottom: 12px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.mini-header h3,
.calculator-card h3,
.spoof-info-header h3 {
  min-width: 0;
  line-height: 1.35;
}

.mini-header .value-chip {
  white-space: normal;
}

.segmented-control {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
  padding: 6px;
  border-radius: 18px;
  border: 1px solid rgba(26, 36, 51, 0.08);
  background: rgba(26, 36, 51, 0.05);
}

.segment-button {
  padding: 11px 14px;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}

.segment-button.is-active {
  background: rgba(255, 255, 255, 0.92);
  color: var(--accent);
  box-shadow: 0 10px 24px rgba(26, 36, 51, 0.08);
}

.calculator-controls {
  margin-top: 10px;
}

.formula-editor {
  margin-top: 18px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(26, 36, 51, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(243, 247, 251, 0.72));
}

.formula-editor-header {
  margin-bottom: 10px;
}

.formula-editor-header .value-chip {
  white-space: normal;
}

.formula-editor-grid {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.formula-editor-field {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 0;
}

.formula-editor-label {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.formula-editor textarea {
  width: 100%;
  min-height: 72px;
  resize: vertical;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(26, 36, 51, 0.12);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font: 0.92rem/1.55 "Cascadia Code", "Consolas", monospace;
  overflow-wrap: anywhere;
}

.formula-editor textarea:focus {
  outline: 2px solid rgba(29, 77, 115, 0.18);
  outline-offset: 1px;
}

.formula-editor code {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(26, 36, 51, 0.06);
  color: var(--accent);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.formula-editor-buttons {
  margin-top: 14px;
}

.equation-stack {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.equation-stack > div,
.calculator-summary,
.calculator-results,
.calculator-metrics,
.metric-card {
  min-width: 0;
}

.calculator-results {
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: visible;
}

.calculator-info-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

#effectiveness-chart {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(244, 248, 252, 0.9)),
    repeating-linear-gradient(
      to right,
      transparent 0,
      transparent 51px,
      rgba(26, 36, 51, 0.04) 52px
    ),
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 39px,
      rgba(26, 36, 51, 0.04) 40px
    );
  border: 1px solid rgba(26, 36, 51, 0.08);
}

.calculator-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.calculator-summary {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(26, 36, 51, 0.08);
  background: linear-gradient(145deg, rgba(29, 77, 115, 0.08), rgba(255, 249, 240, 0.88));
}

.calculator-summary .helper-text,
.equation-values,
.metric-card strong,
.metric-label,
.book-status {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.equation-values {
  white-space: pre-line;
}

.metric-card strong {
  line-height: 1.35;
}

.spoof-info-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
}

.spoof-info-overlay.is-hidden {
  display: none;
}

.spoof-info-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 38, 0.48);
  backdrop-filter: blur(4px);
}

.spoof-info-panel {
  position: relative;
  z-index: 1;
  width: min(900px, calc(100vw - 32px));
  max-height: min(82vh, 920px);
  overflow: auto;
  padding: 20px;
  border-radius: 24px;
  border: 1px solid rgba(26, 36, 51, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 242, 233, 0.96));
  box-shadow: 0 28px 70px rgba(16, 24, 38, 0.24);
}

.spoof-info-header {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: -20px -20px 16px;
  padding: 18px 20px 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.92));
  border-bottom: 1px solid rgba(26, 36, 51, 0.08);
}

.spoof-info-content {
  display: grid;
  gap: 16px;
}

.spoof-info-card {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(26, 36, 51, 0.08);
  background: rgba(255, 255, 255, 0.84);
}

.spoof-info-card h4 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.spoof-info-card p,
.spoof-info-card li {
  margin: 0;
  line-height: 1.68;
}

.spoof-info-card ul,
.spoof-info-card ol {
  margin: 10px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
}

.spoof-info-math {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(26, 36, 51, 0.08);
  background: rgba(26, 36, 51, 0.05);
  overflow-x: auto;
}

.spoof-info-math mjx-container {
  margin: 0 !important;
}

.control-item {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(26, 36, 51, 0.08);
  background: rgba(255, 255, 255, 0.76);
}

.control-item strong {
  display: block;
  margin-bottom: 5px;
}

.story-kicker {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.story-deck {
  display: grid;
  gap: 18px;
}

.story-hero-card,
.story-slide,
.story-wide-panel,
.story-note-card {
  border-radius: 24px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(246, 241, 232, 0.74));
  box-shadow: 0 18px 38px rgba(26, 36, 51, 0.06);
}

.story-hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 18px;
  padding: 22px;
}

.story-hero-copy h3,
.story-wide-header h3,
.story-note-card h3 {
  margin: 8px 0 10px;
  font-size: 1.4rem;
}

.story-hero-copy p,
.story-wide-header p,
.story-note-card p {
  margin: 0;
  line-height: 1.72;
}

.story-route {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.story-route-step,
.story-note-pill,
.story-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(26, 36, 51, 0.08);
  background: rgba(255, 255, 255, 0.9);
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 600;
}

.story-hero-visual {
  display: grid;
  gap: 12px;
}

.story-screen-frame,
.story-slide-visual {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid rgba(26, 36, 51, 0.08);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.95), rgba(237, 241, 247, 0.72)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(244, 238, 228, 0.82));
}

.story-screen-frame {
  min-height: 210px;
  padding: 18px;
}

.story-hero-caption {
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(29, 77, 115, 0.08);
  color: var(--accent);
}

.story-sparkline {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 88px;
  margin-bottom: 16px;
}

.spark-segment {
  flex: 1;
  border-radius: 14px 14px 6px 6px;
  background: linear-gradient(180deg, rgba(29, 77, 115, 0.22), rgba(29, 77, 115, 0.78));
}

.spark-up {
  height: 54%;
}

.spark-flat {
  height: 44%;
}

.spark-down {
  height: 26%;
}

.spark-bounce {
  height: 48%;
}

.story-book-mini {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.story-book-side {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
}

.story-book-side.sell {
  border: 1px solid rgba(194, 78, 54, 0.16);
}

.story-book-side.buy {
  border: 1px solid rgba(14, 138, 87, 0.16);
}

.story-mini-bar,
.story-balance-bar,
.story-wall-bar,
.story-liquidity-bar {
  display: block;
  border-radius: 999px;
}

.story-mini-bar {
  height: 14px;
  background: rgba(29, 77, 115, 0.2);
}

.w-86 { width: 86%; }
.w-74 { width: 74%; }
.w-72 { width: 72%; }
.w-70 { width: 70%; }
.w-68 { width: 68%; }
.w-66 { width: 66%; }
.w-62 { width: 62%; }
.w-60 { width: 60%; }
.w-58 { width: 58%; }
.w-54 { width: 54%; }
.w-52 { width: 52%; }
.w-48 { width: 48%; }
.w-46 { width: 46%; }
.w-44 { width: 44%; }

.story-slide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.story-slide {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 18px;
  padding: 20px;
}

.story-slide h3 {
  margin: 8px 0 10px;
  font-size: 1.14rem;
}

.story-slide p {
  margin: 0;
  line-height: 1.72;
}

.story-inline-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.story-inline-image {
  width: 100%;
  height: 190px;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid rgba(26, 36, 51, 0.08);
  background: rgba(244, 248, 252, 0.92);
}

.story-visual-crash-rich {
  grid-template-columns: minmax(220px, 1fr) minmax(0, 1fr);
  align-items: stretch;
}

.story-visual-crash-rich .story-drop-board {
  height: auto;
  min-height: 190px;
}

.story-slide-wide {
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
}

.story-slide-visual {
  min-height: 190px;
  padding: 16px;
}

.story-visual-balance,
.story-visual-rebound,
.story-visual-person,
.story-visual-wall,
.story-visual-reaction,
.story-visual-complexity {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 14px;
}

.story-balance-book {
  width: 100%;
  display: grid;
  gap: 12px;
}

.story-balance-bar {
  height: 16px;
  background: rgba(29, 77, 115, 0.18);
}

.story-balance-bar.sell,
.story-wall-bar {
  justify-self: end;
  background: linear-gradient(90deg, rgba(194, 78, 54, 0.18), rgba(194, 78, 54, 0.82));
}

.story-balance-bar.buy {
  background: linear-gradient(90deg, rgba(14, 138, 87, 0.82), rgba(14, 138, 87, 0.16));
}

.story-avatar {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 40% 30%, #f7d8b5 0 22%, transparent 23%),
    radial-gradient(circle at 55% 38%, #f3c99c 0 30%, transparent 31%),
    linear-gradient(180deg, rgba(29, 77, 115, 0.92), rgba(29, 77, 115, 0.48));
  box-shadow: 0 16px 24px rgba(26, 36, 51, 0.12);
}

.story-tag-stack {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.story-visual-wall {
  align-items: stretch;
}

.story-wall-stack {
  display: grid;
  gap: 12px;
  width: 100%;
}

.story-wall-bar {
  height: 18px;
}

.story-wall-arrow {
  align-self: flex-end;
  color: var(--sell);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.story-visual-reaction {
  gap: 10px;
}

.story-flow-node {
  width: 100%;
  padding: 10px 12px;
  border-radius: 16px;
  text-align: center;
  font-weight: 600;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(26, 36, 51, 0.08);
}

.story-flow-arrow,
.story-cascade-arrow {
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.story-visual-crash {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  align-items: end;
  gap: 16px;
}

.story-liquidity-ladder {
  display: flex;
  align-items: end;
  gap: 10px;
  height: 150px;
  padding: 8px 0;
}

.story-liquidity-bar {
  width: 16px;
  background: linear-gradient(180deg, rgba(14, 138, 87, 0.78), rgba(194, 78, 54, 0.82));
}

.h-88 { height: 88%; }
.h-68 { height: 68%; }
.h-44 { height: 44%; }
.h-24 { height: 24%; }

.story-drop-board,
.story-rebound-track {
  display: flex;
  align-items: end;
  gap: 10px;
  height: 150px;
  width: 100%;
}

.story-drop-segment,
.story-rebound-segment {
  flex: 1;
  border-radius: 14px 14px 8px 8px;
  background: linear-gradient(180deg, rgba(29, 77, 115, 0.18), rgba(29, 77, 115, 0.82));
}

.drop-flat { height: 82%; }
.drop-slip { height: 62%; }
.drop-fall { height: 30%; }
.drop-panic {
  height: 10%;
  background: linear-gradient(180deg, rgba(194, 78, 54, 0.18), rgba(194, 78, 54, 0.86));
}

.story-visual-complexity {
  flex-direction: row;
  justify-content: space-between;
  align-items: stretch;
}

.story-complexity-side {
  flex: 1;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 8px;
  padding: 16px 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
}

.story-complexity-side strong {
  color: var(--accent);
}

.story-complexity-side span {
  color: var(--muted);
  line-height: 1.45;
}

.story-complexity-divider {
  width: 1px;
  background: rgba(26, 36, 51, 0.12);
}

.rebound-start { height: 72%; }
.rebound-drop {
  height: 20%;
  background: linear-gradient(180deg, rgba(194, 78, 54, 0.18), rgba(194, 78, 54, 0.86));
}
.rebound-bounce {
  height: 54%;
  background: linear-gradient(180deg, rgba(14, 138, 87, 0.2), rgba(14, 138, 87, 0.78));
}

.story-wide-panel {
  padding: 20px 22px;
}

.story-source-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(29, 77, 115, 0.16);
  background: rgba(29, 77, 115, 0.08);
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.story-source-link:hover {
  background: rgba(29, 77, 115, 0.14);
}

.story-cascade {
  display: grid;
  grid-template-columns: repeat(7, auto);
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.story-cascade-step {
  padding: 14px 16px;
  border-radius: 18px;
  text-align: center;
  font-weight: 600;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(26, 36, 51, 0.08);
}

.story-bottom-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.story-note-card {
  padding: 20px 22px;
}

.story-note-card-accent {
  background:
    linear-gradient(145deg, rgba(29, 77, 115, 0.14), rgba(255, 249, 240, 0.92));
  border-color: rgba(29, 77, 115, 0.16);
}

.story-bullet-list {
  margin: 14px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 10px;
  line-height: 1.68;
}

.equation-code mjx-container {
  margin: 0 !important;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.signal-text {
  margin: 14px 0 0;
  font-size: 1rem;
  line-height: 1.45;
}

.bar-track {
  margin-top: 14px;
  width: 100%;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(26, 36, 51, 0.08);
}

.bar-fill {
  width: 50%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sell), #f0c94f, var(--buy));
  transform-origin: center;
}

.book-ladder-shell {
  display: grid;
  gap: 10px;
}

.book-ladder-header,
.book-ladder-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 126px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.book-title-center {
  text-align: center;
}

.book-ladder {
  display: grid;
  gap: 8px;
}

.book-ladder-row {
  position: relative;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
}

.book-ladder-row::before,
.book-ladder-row::after {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  border-radius: 12px;
  opacity: 0.24;
  pointer-events: none;
}

.book-ladder-row.ask::before {
  left: 6px;
  width: var(--depth, 0%);
  background: linear-gradient(90deg, var(--sell), rgba(194, 78, 54, 0.12));
}

.book-ladder-row.bid::after {
  right: 6px;
  width: var(--depth, 0%);
  background: linear-gradient(90deg, rgba(14, 138, 87, 0.12), var(--buy));
}

.book-ladder-row.best-ask,
.book-ladder-row.best-bid {
  border-color: rgba(29, 77, 115, 0.18);
  box-shadow: inset 0 0 0 1px rgba(29, 77, 115, 0.06);
}

.book-ladder-row.is-swept {
  border-color: rgba(240, 201, 79, 0.58);
  box-shadow: 0 0 0 1px rgba(240, 201, 79, 0.34), 0 10px 24px rgba(240, 201, 79, 0.12);
}

.book-ladder-row.mid-row {
  background: linear-gradient(145deg, rgba(29, 77, 115, 0.1), rgba(255, 249, 240, 0.9));
  border-color: rgba(29, 77, 115, 0.14);
}

.book-ladder-row > span,
.book-mid-block {
  position: relative;
  z-index: 1;
}

.book-side-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

.book-side-cell.ask-cell {
  justify-content: flex-start;
}

.book-side-cell.bid-cell {
  justify-content: flex-end;
}

.book-size-value {
  font-weight: 700;
}

.book-side-kind {
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.book-price-cell {
  display: grid;
  justify-items: center;
  gap: 2px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.book-price-value {
  font-weight: 700;
  color: var(--accent);
}

.book-price-level {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.book-mid-block {
  display: grid;
  justify-items: center;
  gap: 3px;
}

.book-mid-price {
  font-weight: 800;
  color: var(--accent);
}

.book-mid-meta {
  color: var(--muted);
  font-size: 0.74rem;
}

.book-exec-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(240, 201, 79, 0.22);
  color: #8c6400;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.book-status {
  margin: 2px 0 0;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(26, 36, 51, 0.08);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  line-height: 1.6;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.book-title {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.ask-title {
  color: var(--sell);
}

.bid-title {
  color: var(--buy);
}

.book-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.book-row {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.9rem;
}

.book-row::before {
  content: "";
  position: absolute;
  inset: 0;
  width: var(--depth, 20%);
  opacity: 0.24;
}

.book-row.ask::before {
  background: linear-gradient(90deg, transparent, var(--sell));
}

.book-row.bid::before {
  background: linear-gradient(90deg, transparent, var(--buy));
}

.book-row span {
  position: relative;
  z-index: 1;
}

.subpanel {
  margin-top: 16px;
}

.snapshot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  margin: 16px 0 0;
}

.snapshot-grid dt {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.snapshot-grid dd {
  margin: 6px 0 0;
  font-size: 1rem;
  font-weight: 600;
}

.event-log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

.event-item {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.event-item.buy {
  border-left: 4px solid var(--buy);
}

.event-item.sell,
.event-item.stress {
  border-left: 4px solid var(--sell);
}

.event-item.info {
  border-left: 4px solid var(--accent);
}

.event-item small {
  display: block;
  color: var(--muted);
  margin-top: 5px;
}

@media (max-width: 1320px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .metric-row,
  .signal-grid,
  .equation-grid,
  .calculator-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .timeline-tools {
    grid-template-columns: 1fr;
  }

  .calculator-grid,
  .story-slide-grid,
  .story-bottom-grid,
  .story-hero-card,
  .story-slide,
  .story-slide-wide,
  .calculator-info-actions {
    grid-template-columns: 1fr;
  }

  .story-cascade {
    grid-template-columns: 1fr;
  }

  .story-cascade-arrow {
    justify-self: center;
  }
}

@media (max-width: 1680px) {
  .calculator-grid,
  .calculator-info-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 16px, 100%);
    margin: 8px auto 20px;
  }

  .hero,
  .panel {
    border-radius: 22px;
  }

  .hero {
    padding: 22px;
  }

  .metric-row,
  .signal-grid,
  .equation-grid,
  .button-grid,
  .book-grid,
  .snapshot-grid,
  .control-mapping,
  .timeline-buttons,
  .calculator-metrics {
    grid-template-columns: 1fr;
  }

  .timeline-buttons {
    display: grid;
  }

  .spoof-info-overlay {
    padding: 12px;
  }

  .spoof-info-panel {
    width: min(100vw - 24px, 900px);
    max-height: 86vh;
    padding: 16px;
  }

  .spoof-info-header {
    margin: -16px -16px 14px;
    padding: 14px 16px 12px;
  }

  .story-slide,
  .story-slide-wide,
  .story-hero-card,
  .story-bottom-grid,
  .story-source-grid,
  .story-source-card-photo,
  .story-media-grid {
    grid-template-columns: 1fr;
  }

  .story-visual-crash {
    grid-template-columns: 1fr;
  }

  .story-visual-complexity {
    flex-direction: column;
  }

  .story-complexity-divider {
    width: 100%;
    height: 1px;
  }
}




.formula-palette {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.formula-palette-group {
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(26, 36, 51, 0.08);
  background: rgba(255, 255, 255, 0.72);
}

.formula-palette-title {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.formula-token-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.formula-token,
.formula-fragment,
.formula-tool-button {
  border: 1px solid rgba(26, 36, 51, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--accent);
  font-weight: 700;
}

.formula-token {
  padding: 8px 12px;
  cursor: grab;
}

.formula-token.variable {
  background: rgba(29, 77, 115, 0.1);
}

.formula-token.operator {
  background: rgba(194, 78, 54, 0.08);
}

.formula-token.function {
  background: rgba(177, 140, 63, 0.14);
}

.formula-token.number {
  background: rgba(14, 138, 87, 0.1);
}

.formula-builder-stack {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.formula-builder-card {
  padding: 14px;
  border-radius: 20px;
  border: 1px solid rgba(26, 36, 51, 0.08);
  background: rgba(255, 255, 255, 0.72);
}

.formula-builder-card.is-active {
  border-color: rgba(29, 77, 115, 0.28);
  box-shadow: 0 0 0 2px rgba(29, 77, 115, 0.08);
}

.formula-builder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.formula-builder-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.formula-tool-button {
  padding: 6px 10px;
  font-size: 0.82rem;
}

.formula-dropzone {
  min-height: 62px;
  margin-top: 10px;
  padding: 10px;
  border-radius: 18px;
  border: 1px dashed rgba(29, 77, 115, 0.24);
  background: rgba(244, 248, 252, 0.92);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.formula-dropzone.is-active {
  border-color: rgba(29, 77, 115, 0.48);
  background: rgba(233, 241, 248, 0.96);
}

.formula-dropzone.is-empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  font-size: 0.9rem;
}

.formula-fragment {
  padding: 7px 11px;
  cursor: pointer;
}

.formula-preview {
  margin-top: 10px;
}

.formula-raw {
  margin: 10px 0 0;
  color: var(--muted);
  font-family: "Cascadia Code", "Consolas", monospace;
  font-size: 0.82rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.formula-builder-help {
  margin-top: 12px;
}

@media (max-width: 1320px) {
  .formula-builder-header {
    align-items: flex-start;
  }
}


.dashboard {
  transition: grid-template-columns 220ms ease, gap 220ms ease;
}

.side-panel {
  transition: width 220ms ease, opacity 220ms ease, transform 220ms ease;
}

.calculator-inline {
  transition: transform 220ms ease, box-shadow 220ms ease;
}

.calculator-grid {
  transition: grid-template-columns 220ms ease;
}

.dashboard.spoof-focus {
  grid-template-columns: 360px minmax(0, 1.22fr) 280px;
}

.dashboard.spoof-focus .calculator-inline {
  box-shadow: 0 24px 54px rgba(26, 36, 51, 0.12);
}

.dashboard.spoof-focus .calculator-grid {
  grid-template-columns: minmax(340px, 430px) minmax(0, 1.18fr);
}

@media (max-width: 1320px) {
  .dashboard.spoof-focus {
    grid-template-columns: 1fr;
  }

  .dashboard.spoof-focus .calculator-grid {
    grid-template-columns: 1fr;
  }
}

.spoof-compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.spoof-compare-card {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(26, 36, 51, 0.08);
  background: rgba(255, 255, 255, 0.88);
}

.spoof-compare-card.is-emphasis {
  background: linear-gradient(180deg, rgba(255, 249, 240, 0.94), rgba(243, 247, 251, 0.9));
  border-color: rgba(177, 140, 63, 0.22);
}

.spoof-compare-card h5 {
  margin: 0 0 10px;
  font-size: 0.98rem;
}

.spoof-compare-bars {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.spoof-compare-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.spoof-compare-row span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.spoof-compare-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(26, 36, 51, 0.08);
  overflow: hidden;
}

.spoof-compare-fill {
  height: 100%;
  border-radius: inherit;
}

.spoof-compare-fill.is-linear {
  background: linear-gradient(90deg, rgba(29, 77, 115, 0.62), rgba(29, 77, 115, 0.86));
}

.spoof-compare-fill.is-exp {
  background: linear-gradient(90deg, rgba(177, 140, 63, 0.48), rgba(194, 78, 54, 0.92));
}

.spoof-compare-caption {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

@media (max-width: 900px) {
  .spoof-compare-grid {
    grid-template-columns: 1fr;
  }
}

.book-ladder-row.is-spoof {
  border-color: rgba(177, 140, 63, 0.42);
  box-shadow: 0 0 0 1px rgba(177, 140, 63, 0.16), 0 12px 26px rgba(177, 140, 63, 0.10);
}

.book-ladder-row.is-spoof::before,
.book-ladder-row.is-spoof::after {
  opacity: 0.42;
}

.book-ladder-row.spoof-reposted {
  transform: translateX(2px);
}

.book-ladder-row.spoof-pulled {
  opacity: 0.78;
  border-style: dashed;
}

.book-spoof-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(177, 140, 63, 0.16);
  color: #8a6518;
}

.book-spoof-tag.reposted {
  background: rgba(29, 77, 115, 0.12);
  color: var(--accent);
}

.book-spoof-tag.pulled {
  background: rgba(194, 78, 54, 0.12);
  color: var(--sell);
}

.spoof-lab-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.action-button.compact {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
}

.formula-edit-toolbar {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(26, 36, 51, 0.08);
  background: rgba(255, 255, 255, 0.76);
}

.formula-edit-status {
  margin: 0 0 10px;
}

.formula-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.formula-tool-button.is-active {
  background: rgba(29, 77, 115, 0.12);
  border-color: rgba(29, 77, 115, 0.18);
}

.formula-tool-button.danger {
  background: rgba(194, 78, 54, 0.08);
  color: var(--sell);
}

.formula-fragment.is-selected {
  background: rgba(29, 77, 115, 0.16);
  border-color: rgba(29, 77, 115, 0.28);
  box-shadow: 0 0 0 2px rgba(29, 77, 115, 0.08);
}

.dashboard.spoof-focus .side-panel {
  opacity: 0.72;
}


.formula-edit-toolbar {
  display: none;
}

.formula-token-menu {
  position: fixed;
  z-index: 40;
  display: grid;
  gap: 6px;
  min-width: 160px;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid rgba(26, 36, 51, 0.1);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 40px rgba(16, 24, 38, 0.18);
}

.formula-token-menu.is-hidden {
  display: none;
}

.formula-token-menu-button {
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid rgba(26, 36, 51, 0.08);
  background: rgba(244, 248, 252, 0.92);
  color: var(--accent);
  text-align: left;
  font-weight: 600;
}

.formula-token-menu-button:hover {
  background: rgba(29, 77, 115, 0.1);
}

.formula-token-menu-button.danger {
  color: var(--sell);
  background: rgba(194, 78, 54, 0.08);
}

.center-panel.lab-market-pinned #market-chart-card {
  position: sticky;
  top: 12px;
  z-index: 28;
  isolation: isolate;
  box-shadow: 0 18px 42px rgba(26, 36, 51, 0.14);
  backdrop-filter: blur(12px);
}

@media (max-width: 900px) {
  .center-panel.lab-market-pinned #market-chart-card {
    position: static;
  }

  .market-chart-toolbar {
    flex-wrap: wrap;
  }
}

.formula-preset-strip {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(26, 36, 51, 0.08);
  background: rgba(255, 255, 255, 0.76);
}

.formula-preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.formula-preset-button {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(26, 36, 51, 0.08);
  background: rgba(244, 248, 252, 0.92);
  color: var(--accent);
  font-weight: 700;
}

.formula-preset-button.is-active {
  background: rgba(29, 77, 115, 0.12);
  border-color: rgba(29, 77, 115, 0.2);
}

.formula-preset-description {
  margin: 10px 0 0;
  color: rgba(26, 36, 51, 0.78);
  line-height: 1.5;
}
