/* ==========================================================================
   style.css — BeamLab (1967 Technical Book-Plate Aesthetic)
   Shared style language with Interchange Lab (road-intersections):
   Dark portfolio palette: Page (#090d16), Ink (#e9edf5), Vermilion (#ff7d61)
   ========================================================================== */
:root {
  color-scheme: dark;
  --bg-app: #090d16;
  --bg-panel: #0f151f;
  --bg-card: rgba(17, 23, 34, 0.94);
  --bg-card-solid: #111722;
  --bg-glass: rgba(15, 21, 31, 0.92);
  --bg-plate: #0e141e;
  --border: rgba(233, 237, 245, 0.19);
  --border-strong: rgba(255, 125, 97, 0.55);
  --text-main: #e9edf5;
  --text-muted: #a8b3c5;
  --text-dim: #7f8b9f;
  --accent: #ff7d61;
  --accent-warm: #ed864b;
  --accent-ok: #58b691;
  --accent-warn: #ff695d;
  --font-ui: var(--xt-text);
  --font-display: var(--xt-title);
  --font-mono: var(--xt-mono);
}

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

html, body {
  width: 100%;
  height: 100%;
  background: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-ui);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

#app {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

/* Custom Ink Scrollbar */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(233, 237, 245, 0.25);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 125, 97, 0.55);
}

/* Header */
#app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 30;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.back-chip {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.brand-badge-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 125, 97, 0.1);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  flex-shrink: 0;
}

.brand-text {
  min-width: 0;
}

.brand-text h1 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.15;
  white-space: nowrap;
}

.brand-text .sub-tag {
  font-weight: 600;
  color: var(--accent);
  margin-left: 6px;
}

.source-ref {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.main-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(233, 237, 245, 0.06);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.tab-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(233, 237, 245, 0.06);
}

.tab-btn.active {
  background: var(--accent);
  color: #111722;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 7px;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
  font-family: var(--font-ui);
  font-size: 0.77rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
}

.pill-btn:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.pill-btn.accent {
  background: rgba(255, 125, 97, 0.12);
  border-color: rgba(255, 125, 97, 0.45);
  color: #fb7158;
}

/* Main Workspace */
#workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
  position: relative;
}

#interactive-shell {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
}

#stage-column {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg-app);
}

/* Top Plate HUD Strip */
.plate-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}

.hud-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.hud-controls-right {
  margin-left: auto;
  justify-content: flex-end;
}

.fig-chip, .mini-btn, .mini-toggle, .hud-select {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.fig-chip:hover, .mini-btn:hover, .mini-toggle:hover {
  color: var(--text-main);
  border-color: var(--border-strong);
}

.fig-chip.active, .mini-btn.active, .mini-toggle.active {
  background: var(--accent);
  color: #111722;
  border-color: transparent;
}

.hud-select {
  color: var(--text-main);
  padding: 6px 8px;
  background: var(--bg-card-solid);
}

.hud-select.full-width {
  width: 100%;
}

.seg-mini {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 2px;
  gap: 2px;
}

.seg-mini .mini-btn {
  border: none;
  background: transparent;
  padding: 4px 8px;
  font-size: 0.72rem;
}

.seg-mini .mini-btn.active {
  background: var(--accent);
  color: #111722;
}

.status-pill {
  padding: 4px 9px;
  border-radius: 999px;
  font-family: var(--xt-small);
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
}

.status-pill.good {
  background: rgba(88, 182, 145, 0.11);
  border-color: rgba(88, 182, 145, 0.45);
  color: var(--accent-ok);
}

.status-pill.warn {
  background: rgba(255, 125, 97, 0.16);
  border-color: rgba(255, 125, 97, 0.6);
  color: #f27166;
}

/* Scrollable 4-Plate Diagram Stack */
#plates-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 12px 12px;
}

.plates-stack {
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-width: 960px;
  margin: 0 auto;
}

.plate-card {
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px 9px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.plate-card.tour-focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 125, 97, 0.2);
}

.plate-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.plate-title-group {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-wrap: wrap;
}

.plate-num {
  font-family: var(--xt-small);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: rgba(255, 125, 97, 0.1);
  border: 1px solid rgba(255, 125, 97, 0.32);
  padding: 1px 6px;
  border-radius: 4px;
}

.plate-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}

.plate-hint {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.plate-drag-hint {
  font-family: var(--xt-small);
  font-size: 0.68rem;
  color: var(--accent-warm);
  font-weight: 600;
}

.plate-eq-badge {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-muted);
  background: rgba(233, 237, 245, 0.05);
  border: 1px solid rgba(233, 237, 245, 0.12);
  padding: 2px 7px;
  border-radius: 5px;
}

.plate-eq-badge .katex {
  font-size: 0.84em;
}

.diagram-viewport {
  width: 100%;
  background: var(--bg-plate);
  border: 1px solid rgba(233, 237, 245, 0.16);
  border-radius: 7px;
  overflow: hidden;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

.diagram-svg {
  width: 100%;
  height: auto;
  display: block;
}

/* Synchronized Bottom 2-Plate Insight Strip (Cut-Section & Cross-Section) */
#insight-strip {
  height: 204px;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
}

.canvas-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-plate);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.canvas-card.tour-focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 125, 97, 0.22);
}

.insight-viewport {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.insight-viewport .diagram-svg {
  width: 100%;
  height: 100%;
}

/* Guided Tour Floating Card (identical to Interchange Lab) */
.tour-card {
  position: absolute;
  bottom: 214px;
  left: 16px;
  right: 16px;
  max-width: 560px;
  z-index: 20;
  background: var(--bg-glass);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 13px 15px;
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 28px rgba(24, 23, 21, 0.22);
}

.tour-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.tour-badge {
  font-family: var(--xt-small);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tour-dots {
  display: flex;
  gap: 5px;
}

.tour-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  border: none;
  cursor: pointer;
}

.tour-dot.active {
  background: var(--accent);
  width: 18px;
  border-radius: 99px;
}

.icon-close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 2px 6px;
}

.tour-card h3 {
  font-family: var(--font-display);
  font-size: 0.98rem;
  margin-bottom: 4px;
}

.tour-card p {
  font-size: 0.8rem;
  line-height: 1.48;
  color: var(--text-muted);
}

.tour-takeaway {
  margin-top: 7px;
  padding: 6px 9px;
  border-left: 3px solid var(--accent);
  background: rgba(255, 125, 97, 0.08);
  font-size: 0.76rem;
  line-height: 1.42;
  border-radius: 0 6px 6px 0;
}

.tour-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  margin-top: 9px;
}

.tour-nav-btn {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 7px;
  cursor: pointer;
}

.tour-nav-btn.primary {
  background: var(--accent);
  color: #111722;
  border-color: transparent;
}

/* Right Sidebar (matching Interchange Lab 390px) */
#right-sidebar {
  width: 396px;
  flex-shrink: 0;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-pane {
  padding: 14px 15px 24px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.panel-header h2 {
  font-family: var(--font-display);
  font-size: 1.06rem;
  line-height: 1.25;
}

.kicker {
  display: block;
  font-family: var(--xt-small);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 3px;
}

.regime-tag {
  font-family: var(--xt-small);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(255, 125, 97, 0.1);
  border: 1px solid var(--border-strong);
  color: var(--accent);
  white-space: nowrap;
}

.book-quote {
  padding: 10px 12px;
  border-left: 3px solid var(--accent-warm);
  background: rgba(255, 125, 97, 0.06);
  border-radius: 0 8px 8px 0;
  font-size: 0.79rem;
  line-height: 1.5;
  color: var(--text-main);
  font-family: var(--xt-text);
}

.book-note-tag {
  display: block;
  margin-bottom: 4px;
  font-family: var(--xt-small);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-warm);
}

.reading-check-line {
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px dashed rgba(233, 237, 245, 0.15);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
}

.reading-check-line.good { color: var(--accent-ok); }
.reading-check-line.warn { color: var(--accent-warn); }
.reading-check-line.caution { color: var(--accent-warm); }

.section-label {
  font-family: var(--xt-small);
  font-size: 0.69rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Compact KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.kpi-card {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 8px;
  padding: 7px 8px;
}

.kpi-label {
  font-size: 0.62rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 600;
  font-family: var(--xt-small);
}

.no-upper {
  text-transform: none;
}

.kpi-val {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  margin-top: 2px;
  color: var(--text-main);
}

.kpi-val.good { color: var(--accent-ok); }
.kpi-val.warn { color: var(--accent-warn); }
.kpi-val.accent { color: var(--accent); }

.kpi-sub-mini {
  font-family: var(--xt-small);
  font-size: 0.63rem;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-sub-mini.good { color: var(--accent-ok); font-weight: 700; }
.kpi-sub-mini.warn { color: var(--accent-warn); font-weight: 700; }

/* Control Groups & Sliders */
.control-group {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 10px;
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.group-title {
  font-family: var(--xt-small);
  font-size: 0.69rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.slider-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.slider-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.76rem;
}

.slider-label {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.74rem;
}

.slider-val {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-main);
}

.input-slider-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
  height: 5px;
}

.num-input {
  width: 78px;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card-solid);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  text-align: right;
  outline: none;
}

.num-input:focus {
  border-color: var(--accent);
}

.unit-tag {
  font-family: var(--xt-small);
  font-size: 0.7rem;
  color: var(--text-dim);
  min-width: 32px;
}

.preset-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.preset-btn {
  border: 1px solid var(--border);
  background: var(--bg-card-solid);
  color: var(--text-muted);
  font-family: var(--xt-small);
  font-size: 0.66rem;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.preset-btn:hover {
  color: var(--text-main);
  border-color: var(--border-strong);
}

.preset-btn.active {
  background: var(--accent);
  color: #111722;
  border-color: transparent;
}

.cs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 6px;
  padding: 8px;
  background: rgba(233, 237, 245, 0.04);
  border: 1px dashed var(--border);
  border-radius: 7px;
}

.cs-input-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cs-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-family: var(--xt-small);
}

.cs-input {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg-card-solid);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
}

.sec-props-strip {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 4px;
  padding-top: 5px;
  border-top: 1px solid rgba(233, 237, 245, 0.1);
  font-family: var(--xt-small);
  font-size: 0.7rem;
  color: var(--text-dim);
}

.sec-props-strip strong {
  color: var(--text-main);
}

/* Call-Out List */
.callout-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.callout-item {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 8px;
  padding: 7px 9px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.callout-item:hover, .callout-item.selected {
  border-color: var(--accent);
  background: rgba(255, 125, 97, 0.08);
}

.callout-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
}

.callout-badge {
  font-family: var(--xt-small);
  font-size: 0.65rem;
  color: var(--accent);
}

.callout-item-body {
  font-size: 0.73rem;
  line-height: 1.4;
  color: var(--text-muted);
  margin-top: 2px;
}

.cta-btn {
  width: 100%;
  padding: 10px 14px;
  border-radius: 9px;
  border: none;
  background: var(--accent);
  color: #111722;
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.cta-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

/* Editorial Views (Step-by-Step Math & Concepts) */
.editorial-view {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 24px 28px 48px;
}

.editorial-container {
  max-width: 1280px;
  margin: 0 auto;
}

.editorial-intro {
  margin-bottom: 20px;
}

.editorial-intro h2 {
  font-family: var(--font-display);
  font-size: 1.52rem;
  margin: 4px 0 6px;
}

.editorial-intro p {
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 78ch;
  line-height: 1.55;
}

.concepts-split {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 22px;
  align-items: start;
}

.concepts-col h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin-bottom: 12px;
}

/* Live Worked Math Cards */
.subst-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.subst-card {
  border: 1px solid var(--border);
  background: var(--bg-panel);
  border-radius: 10px;
  padding: 12px 14px;
}

.subst-step-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: #111722;
  font-family: var(--xt-small);
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.subst-step-eq {
  padding: 8px 11px;
  border-radius: 7px;
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  overflow-x: auto;
  overflow-y: hidden;
}

.subst-step-eq .katex-display {
  margin: 0.15em 0;
  text-align: left;
}

.subst-step-eq .katex {
  font-size: 0.96em;
  color: var(--text-main);
}

.subst-step-sub {
  margin-top: 6px;
  font-size: 0.78rem;
  line-height: 1.48;
  color: var(--text-muted);
}

/* Concepts Cards */
.concepts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.concept-card {
  border: 1px solid var(--border);
  background: var(--bg-panel);
  border-radius: 12px;
  padding: 14px 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.concept-card h4 {
  font-family: var(--font-display);
  font-size: 0.96rem;
}

.concept-card p {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.concept-math {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 125, 97, 0.05);
  border: 1px solid var(--border);
  overflow-x: auto;
  font-size: 0.82rem;
}

.concept-math .katex-display {
  margin: 0.18em 0;
}

.concept-math .katex {
  font-size: 0.94em;
}

.try-btn {
  align-self: flex-start;
  margin-top: auto;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
}

.try-btn:hover {
  background: var(--accent);
  color: #111722;
}

/* Faithful 1967 Book Page Card */
.book-page-card {
  background: #0f151f;
  color: #e9edf5;
  border: 1px solid rgba(233, 237, 245, 0.25);
  border-radius: 10px;
  padding: 20px 22px;
  box-shadow: 0 10px 24px rgba(24, 23, 21, 0.14);
}

.book-page-head {
  display: flex;
  justify-content: space-between;
  font-family: var(--xt-small);
  font-size: 0.68rem;
  color: #9ca7ba;
  border-bottom: 1px solid rgba(233, 237, 245, 0.16);
  padding-bottom: 6px;
  margin-bottom: 12px;
}

.book-page-card h3 {
  text-align: center;
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  font-size: 1.05rem;
}

.book-page-note {
  margin: 0 0 12px;
  font-size: 0.75rem;
  font-style: italic;
  color: var(--text-muted);
  text-align: center;
}

.ref-formula-item {
  margin-bottom: 10px;
}

.ref-formula-head {
  display: flex;
  justify-content: space-between;
  font-family: var(--xt-small);
  font-size: 0.67rem;
  font-weight: 700;
  color: #fb7158;
  margin-bottom: 4px;
}

.book-para {
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 8px;
  transition: background 0.15s ease;
}

.book-para:hover {
  background: rgba(255, 125, 97, 0.07);
}

.book-para-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.book-para-tag {
  font-family: var(--xt-small);
  font-size: 0.68rem;
  font-weight: 700;
  color: #fb7158;
}

.book-jump-btn {
  border: 1px solid rgba(255, 125, 97, 0.45);
  background: transparent;
  color: #fb7158;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--xt-small);
}

.book-jump-btn:hover {
  background: #ff7d61;
  color: #151b26;
}

.book-para p {
  font-size: 0.84rem;
  line-height: 1.56;
  font-family: var(--xt-text);
}

.book-page-foot {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(233, 237, 245, 0.14);
  color: #abb5c7;
}

/* Non-blocking Toast */
.toast {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 60;
  padding: 9px 14px;
  border-radius: 8px;
  background: #1a2230;
  color: var(--text-main);
  border: 1px solid rgba(233, 237, 245, 0.18);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(24, 23, 21, 0.28);
}

/* Responsive */
@media (max-width: 1120px) {
  html, body {
    overflow: auto;
    height: auto;
  }
  #app {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }
  #app-header {
    flex-wrap: wrap;
  }
  #workspace, #interactive-shell {
    overflow: visible;
    height: auto;
  }
  #interactive-shell {
    flex-direction: column;
  }
  #plates-scroll {
    overflow: visible;
  }
  #right-sidebar {
    width: 100%;
    height: auto;
    border-left: none;
    border-top: 1px solid var(--border);
  }
  #insight-strip {
    height: auto;
    grid-template-columns: 1fr;
  }
  .canvas-card {
    height: 190px;
  }
  .concepts-split {
    grid-template-columns: 1fr;
  }
  .tour-card {
    position: fixed;
    bottom: 14px;
    left: 14px;
    right: 14px;
  }
}

/* Print / PDF Engineering Sheet */
@media print {
  html, body, #app, #workspace, #interactive-shell, #plates-scroll {
    height: auto !important;
    overflow: visible !important;
    background: #151b26 !important;
  }
  #app-header .main-tabs,
  #app-header .header-right,
  .back-chip,
  .plate-hud,
  .tour-card,
  #right-sidebar .control-group,
  .panel-cta-row {
    display: none !important;
  }
  #interactive-shell {
    display: block !important;
  }
  #right-sidebar {
    width: 100% !important;
    border: none !important;
  }
  #insight-strip {
    height: auto !important;
    border: none !important;
  }
}
