/* Design tokens */
:root {
  --thermo-bg: #050509;
  --thermo-canvas-bg: #06060d;
  --thermo-panel: #0b0d18;
  --thermo-border: #1c2233;
  --thermo-border2: #2a3550;
  --thermo-text: #e6ebf5;
  --thermo-muted: #8b93a7;
  --thermo-dim: #6b7488;
  --thermo-dimmer: #4d5468;
  --thermo-orange: #ff7a1a;
  --thermo-teal: #38f0d0;
}

.thermo-page {
  max-width: 3840px;
  margin: 0 auto;
  padding: 0 20px 60px;
  font-family: 'Space Grotesk', sans-serif;
  color: var(--thermo-text);
  background: var(--thermo-bg);
}

/* Masthead */
.thermo-masthead {
  padding: 22px 0 8px;
}
.thermo-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--thermo-orange);
}
.thermo-title {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 6px 0 0;
  color: var(--thermo-text);
}
.thermo-desc {
  font-size: 14px;
  color: var(--thermo-muted);
  margin: 4px 0 0;
  max-width: 640px;
  line-height: 1.5;
}

/* Section */
.thermo-section {
  margin-top: 20px;
}

/* Reactor sidebar layout */
.thermo-reactor-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.thermo-sidebar {
  width: 164px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-top: 4px;
}
.thermo-sidebar .thermo-tabs {
  flex-direction: column;
  gap: 4px;
}
.thermo-sidebar .thermo-tab {
  width: 100%;
  text-align: left;
  padding: 7px 12px;
}
.thermo-sidebar-divider {
  border-top: 1px solid var(--thermo-border);
  margin: 12px 0;
}
.thermo-sidebar .thermo-ticker-search {
  flex-direction: column;
  gap: 6px;
}
.thermo-ticker-row {
  display: flex;
  gap: 6px;
  width: 100%;
}
.thermo-sidebar .thermo-ticker-input {
  flex: 1;
  width: 0; /* flex will size it */
}
.thermo-sidebar .thermo-ticker-btn {
  flex-shrink: 0;
}
.thermo-sidebar .thermo-ticker-status {
  font-size: 10px;
  min-width: unset;
}
.thermo-tab-ticker-lbl {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 1px;
  opacity: 0.55;
  margin-top: 1px;
}
.thermo-sidebar-spacer { flex: 1; }
.thermo-credits {
  margin-top: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--thermo-dimmer);
  line-height: 1.7;
}
.thermo-credits-label {
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--thermo-dim);
  margin-bottom: 3px;
}
.thermo-sidebar .thermo-footnote {
  margin-top: 16px;
  font-size: 10px;
  line-height: 1.55;
}
.thermo-main {
  flex: 1;
  min-width: 0;
}

.thermo-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.thermo-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  color: #050509;
  padding: 3px 9px;
  border-radius: 4px;
}
.thermo-badge--orange { background: var(--thermo-orange); }
.thermo-badge--teal   { background: var(--thermo-teal); }
.thermo-section-title {
  font-size: 15px;
  font-weight: 600;
}
.thermo-section-sub {
  font-size: 13px;
  color: var(--thermo-dim);
}

/* Tabs row */
.thermo-tabs-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.thermo-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.thermo-tab {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--thermo-border);
  background: var(--thermo-panel);
  color: var(--thermo-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.thermo-tab:hover { border-color: var(--thermo-border2); color: var(--thermo-text); }

/* Ticker search */
.thermo-ticker-search {
  display: flex;
  align-items: center;
  gap: 6px;
}
.thermo-ticker-input {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--thermo-border2);
  background: var(--thermo-panel);
  color: var(--thermo-text);
  width: 110px;
  outline: none;
}
.thermo-ticker-input::placeholder { color: var(--thermo-dimmer); }
.thermo-ticker-input:focus { border-color: var(--thermo-orange); }
.thermo-ticker-btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  background: var(--thermo-orange);
  color: #050509;
  cursor: pointer;
}
.thermo-ticker-status {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--thermo-dim);
  min-width: 80px;
}

/* Canvas */
.thermo-canvas {
  display: block;
  border-radius: 12px;
  background: var(--thermo-canvas-bg);
  box-shadow: 0 0 0 1px #141b2e, 0 24px 60px rgba(0,0,0,0.6);
}
.thermo-canvas--hero {
  width: 100%;
  height: clamp(700px, 85vh, 1080px);
}

/* Fullscreen wrapper — invisible in normal layout */
#reactor-fs-wrap {
  display: contents;
}

/* Fullscreen: column flex so canvas fills and controls pin to bottom */
#reactor-fs-wrap:fullscreen,
#reactor-fs-wrap:-webkit-full-screen {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  background: #06060d;
}
#reactor-fs-wrap:fullscreen .thermo-canvas--hero,
#reactor-fs-wrap:-webkit-full-screen .thermo-canvas--hero {
  width: 100%;
  flex: 1;
  height: 0;
  min-height: 0;
  margin: 0;
  border-radius: 0;
  box-shadow: none;
}
#reactor-fs-wrap:fullscreen .thermo-controls,
#reactor-fs-wrap:-webkit-full-screen .thermo-controls {
  flex-shrink: 0;
  margin-top: 0;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
}

/* Exit hint — hidden normally, shown in fullscreen */
.thermo-fs-exit {
  display: none;
}
#reactor-fs-wrap:fullscreen .thermo-fs-exit,
#reactor-fs-wrap:-webkit-full-screen .thermo-fs-exit {
  display: block;
  position: fixed;
  top: 14px;
  right: 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(6,6,13,0.75);
  color: var(--thermo-muted);
  cursor: pointer;
  z-index: 10;
  backdrop-filter: blur(4px);
}
.thermo-fs-exit:hover { color: var(--thermo-text); border-color: rgba(255,255,255,0.28); }

/* Fullscreen button in controls bar */
.thermo-fs-btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--thermo-border2);
  background: var(--thermo-panel);
  color: var(--thermo-muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.thermo-fs-btn:hover { color: var(--thermo-text); border-color: var(--thermo-orange); }
.thermo-canvas--wall {
  width: 100%;
  height: auto;
  cursor: pointer;
}

/* Controls bar */
.thermo-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 14px;
  background: var(--thermo-panel);
  border: 1px solid var(--thermo-border);
  border-radius: 10px;
  padding: 12px 16px;
}
.thermo-play-btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  background: var(--thermo-orange);
  color: #050509;
  cursor: pointer;
  min-width: 96px;
}
.thermo-play-btn--teal { background: var(--thermo-teal); }
.thermo-year-bound {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--thermo-dim);
}
.thermo-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--thermo-orange), var(--thermo-teal));
  outline: none;
  cursor: pointer;
}
.thermo-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--thermo-orange);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(255,122,26,0.8);
}
.thermo-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--thermo-orange);
  cursor: pointer;
}
.thermo-year-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  font-weight: 700;
  color: var(--thermo-text);
  min-width: 96px;
  text-align: right;
}

/* Label editor (design-time, ?edit only) */
.thermo-label-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 50;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--thermo-border2);
  background: var(--thermo-panel);
  color: var(--thermo-text);
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
}
.thermo-label-panel {
  position: fixed;
  top: 56px;
  right: 16px;
  z-index: 50;
  width: 292px;
  max-height: 80vh;
  overflow: auto;
  background: rgba(11,13,24,0.97);
  border: 1px solid var(--thermo-border2);
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.65);
  font-family: 'JetBrains Mono', monospace;
}
.thermo-label-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
}
.thermo-label-close { cursor: pointer; color: var(--thermo-dim); font-size: 14px; }
.thermo-label-grid-header {
  display: grid;
  grid-template-columns: 106px 44px 44px 44px;
  gap: 6px;
  font-size: 9px;
  color: var(--thermo-dim);
  margin-bottom: 5px;
  text-align: center;
}
.thermo-label-row {
  display: grid;
  grid-template-columns: 106px 44px 44px 44px;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}
.thermo-label-row span {
  font-size: 10px;
  color: var(--thermo-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thermo-cfg-input {
  width: 100%;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  padding: 3px 4px;
  border-radius: 4px;
  border: 1px solid var(--thermo-border2);
  background: var(--thermo-canvas-bg);
  color: var(--thermo-text);
}
.thermo-label-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.thermo-label-actions button {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  padding: 7px;
  border-radius: 6px;
  cursor: pointer;
}
.thermo-label-actions button:first-child {
  border: 1px solid var(--thermo-border2);
  background: #141b2e;
  color: var(--thermo-text);
}
.thermo-label-actions button:last-child {
  border: none;
  background: var(--thermo-orange);
  color: #050509;
  font-weight: 700;
}
.thermo-label-hint {
  font-size: 9px;
  color: var(--thermo-dimmer);
  margin-top: 8px;
  line-height: 1.5;
}

/* Footnote */
.thermo-footnote {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--thermo-dimmer);
  margin-top: 14px;
  line-height: 1.6;
}

/* Autocomplete dropdown */
.thermo-ticker-search { position: relative; }
.thermo-autocomplete {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 100;
  background: var(--thermo-panel);
  border: 1px solid var(--thermo-border2);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  min-width: 220px;
  max-height: 260px;
  overflow-y: auto;
}
.thermo-autocomplete-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.1s;
}
.thermo-autocomplete-item:hover,
.thermo-autocomplete-item:focus {
  background: rgba(255, 122, 26, 0.12);
}
.thermo-autocomplete-ticker {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--thermo-orange);
  min-width: 52px;
}
.thermo-autocomplete-name {
  font-size: 12px;
  color: var(--thermo-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Admin modal overlay */
.thermo-admin-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(5,5,9,0.82);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.thermo-admin-modal {
  background: var(--thermo-panel);
  border: 1px solid var(--thermo-border2);
  border-radius: 14px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.7);
  width: min(560px, 94vw);
  max-height: 80vh;
  overflow-y: auto;
  padding: 22px 24px 26px;
  font-family: 'JetBrains Mono', monospace;
}
.thermo-admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.thermo-admin-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--thermo-text);
}
.thermo-admin-close {
  font-size: 16px;
  color: var(--thermo-dim);
  cursor: pointer;
}
.thermo-admin-close:hover { color: var(--thermo-text); }
.thermo-admin-section { margin-bottom: 12px; }
.thermo-admin-hint {
  font-size: 11px;
  color: var(--thermo-muted);
  line-height: 1.5;
}
.thermo-admin-err {
  font-size: 11px;
  color: #ff5a5a;
  margin-top: 6px;
}
.thermo-admin-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}
.thermo-admin-tab {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--thermo-border);
  background: var(--thermo-canvas-bg);
  color: var(--thermo-muted);
  cursor: pointer;
}
.thermo-admin-tab--active {
  border-color: var(--thermo-orange);
  color: var(--thermo-orange);
}
.thermo-admin-pane { font-size: 12px; }
.thermo-admin-loading { color: var(--thermo-dim); font-size: 11px; }
.thermo-admin-candidate {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--thermo-border);
}
.thermo-admin-candidate:last-child { border-bottom: none; }
.thermo-admin-cinfo { flex: 1; }
.thermo-admin-cyear {
  font-size: 10px;
  color: var(--thermo-orange);
  margin-bottom: 2px;
}
.thermo-admin-clabel {
  font-size: 12px;
  color: var(--thermo-text);
  line-height: 1.4;
}
.thermo-admin-cshort {
  font-size: 10px;
  color: var(--thermo-muted);
  margin-top: 2px;
}
.thermo-admin-cbtn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}
.thermo-admin-cbtn--approve { background: var(--thermo-teal); color: #050509; }
.thermo-admin-cbtn--reject  { background: var(--thermo-border2); color: var(--thermo-muted); }
.thermo-admin-cbtn:disabled { opacity: 0.4; cursor: default; }
.thermo-admin-pinrow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--thermo-border);
}
.thermo-admin-pinrow:last-child { border-bottom: none; }
.thermo-admin-pinticker {
  flex: 1;
  color: var(--thermo-text);
}
.thermo-admin-pinname {
  font-size: 11px;
  color: var(--thermo-muted);
}
.thermo-admin-unpinbtn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--thermo-border2);
  background: transparent;
  color: var(--thermo-dim);
  cursor: pointer;
}
.thermo-admin-unpinbtn:hover { color: #ff5a5a; border-color: #ff5a5a; }

/* Intro modal */
#thermo-intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(5,5,9,0.88);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
}
#thermo-intro-overlay.hidden { display: none; }
#thermo-intro-modal {
  background: var(--thermo-panel);
  border: 1px solid var(--thermo-border2);
  border-radius: 16px;
  box-shadow: 0 40px 100px rgba(0,0,0,0.75);
  width: min(620px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
  padding: 32px 32px 28px;
  font-family: 'Space Grotesk', sans-serif;
}
.thermo-intro-header { margin-bottom: 20px; }
.thermo-intro-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--thermo-text);
  margin: 0 0 4px;
  letter-spacing: -0.3px;
}
.thermo-intro-tagline {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--thermo-orange);
  margin: 0;
}
.thermo-intro-body { font-size: 14px; color: var(--thermo-muted); line-height: 1.65; }
.thermo-intro-body p { margin: 0 0 14px; }
.thermo-intro-body p:last-child { margin-bottom: 0; }
.thermo-intro-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0;
}
.thermo-intro-metric {
  background: var(--thermo-canvas-bg);
  border: 1px solid var(--thermo-border);
  border-radius: 10px;
  padding: 12px 14px;
}
.thermo-intro-metric-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--thermo-orange);
  margin-bottom: 4px;
}
.thermo-intro-metric-desc {
  font-size: 13px;
  color: var(--thermo-text);
  line-height: 1.45;
}
.thermo-intro-footer {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
}
#thermo-intro-close {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  padding: 11px 28px;
  border-radius: 8px;
  border: none;
  background: var(--thermo-orange);
  color: #050509;
  cursor: pointer;
  transition: opacity 0.15s;
}
#thermo-intro-close:hover { opacity: 0.88; }

/* Intro formula block */
.thermo-intro-formula {
  margin-top: 16px;
  border: 1px solid var(--thermo-border);
  border-radius: 8px;
  overflow: hidden;
}
.thermo-intro-formula summary {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--thermo-dim);
  padding: 9px 14px;
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.thermo-intro-formula summary::-webkit-details-marker { display: none; }
.thermo-intro-formula summary::before {
  content: '▶ ';
  font-size: 9px;
  color: var(--thermo-dimmer);
}
.thermo-intro-formula[open] summary::before { content: '▼ '; }
.thermo-intro-formula summary:hover { color: var(--thermo-muted); }
.thermo-intro-formula-body {
  padding: 4px 14px 14px;
  border-top: 1px solid var(--thermo-border);
  background: var(--thermo-canvas-bg);
}
.thermo-intro-formula-line {
  display: grid;
  grid-template-columns: 44px 1fr 1fr;
  gap: 8px;
  align-items: baseline;
  padding: 5px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}
.thermo-intro-formula-line:last-of-type { border-bottom: none; }
.thermo-intro-formula-weight {
  color: var(--thermo-orange);
  font-weight: 700;
  text-align: right;
}
.thermo-intro-formula-weight--neg { color: var(--thermo-teal); }
.thermo-intro-formula-term { color: var(--thermo-text); }
.thermo-intro-formula-note { color: var(--thermo-dim); font-size: 10px; }
.thermo-intro-formula-footnote {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--thermo-dimmer);
  margin: 10px 0 0;
  line-height: 1.6;
}
