:root {
  color-scheme: dark;
  --bg: #071018;
  --panel: #0d1a24;
  --panel-2: #10212d;
  --panel-3: #142734;
  --line: rgba(169, 205, 220, .13);
  --line-strong: rgba(169, 205, 220, .22);
  --text: #e8f2f5;
  --muted: #92a9b4;
  --dim: #617985;
  --accent: #67e3d0;
  --accent-2: #f0b76a;
  --danger: #f17e78;
  --good: #7fe0b2;
  --radius: 16px;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; overflow: hidden; }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.app-shell { height: 100%; min-height: 0; display: grid; grid-template-rows: 68px minmax(0,1fr) 30px; overflow: hidden; background: radial-gradient(ellipse at 55% -30%, rgba(35,87,96,.22), transparent 50%), var(--bg); }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--line); min-width: 0; }
.brand-lockup, .brand-copy, .topbar-right, .species-chip, .scale-chip { display: flex; align-items: center; }
.brand-lockup { gap: 12px; min-width: 0; }
.brand-mark { width: 34px; height: 34px; border: 1px solid rgba(103,227,208,.35); border-radius: 11px; display: flex; align-items: center; justify-content: center; gap: 3px; background: rgba(103,227,208,.07); transform: rotate(-12deg); }
.brand-mark span { width: 4px; border-radius: 4px; background: var(--accent); display: block; }
.brand-mark span:nth-child(1) { height: 10px; opacity: .65; }
.brand-mark span:nth-child(2) { height: 18px; }
.brand-mark span:nth-child(3) { height: 13px; opacity: .8; }
.brand-copy { flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.eyebrow { color: #7c9aa7; font-size: 9px; letter-spacing: .17em; font-weight: 800; line-height: 1.2; }
h1 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -.025em; white-space: nowrap; }
h1 span { color: #8fa8b2; font-weight: 450; }
.topbar-right { gap: 10px; }
.species-chip, .scale-chip { height: 30px; padding: 0 10px; gap: 7px; border: 1px solid var(--line); border-radius: 20px; color: #a9c0c9; font-size: 10px; letter-spacing: .03em; white-space: nowrap; }
.species-chip em { font-style: italic; }
.chip-dot { width: 6px; height: 6px; background: var(--accent); border-radius: 50%; box-shadow: 0 0 9px rgba(103,227,208,.7); }
.scale-chip { color: #7f99a5; font-weight: 750; letter-spacing: .12em; }
.scale-chip span { color: var(--accent); }
.workspace { min-height: 0; display: grid; grid-template-columns: minmax(0,1fr) 376px; gap: 16px; padding: 16px 20px 12px; overflow: hidden; }
.stage-card { min-width: 0; min-height: 0; position: relative; overflow: hidden; border: 1px solid rgba(128,174,190,.18); border-radius: 18px; background: radial-gradient(ellipse at 52% 48%, rgba(27,60,67,.32), transparent 52%), linear-gradient(145deg,#0a1821,#08131c 70%); box-shadow: inset 0 1px 0 rgba(255,255,255,.025), 0 18px 48px rgba(0,0,0,.18); }
#simulation-canvas { display: block; width: 100%; height: 100%; }
.stage-topline { position: absolute; left: 18px; right: 18px; top: 16px; display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
.stage-label { display: flex; align-items: center; gap: 8px; color: #94aeb8; font-size: 9px; font-weight: 800; letter-spacing: .16em; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px rgba(103,227,208,.75); }
.state-pill { border: 1px solid rgba(103,227,208,.25); color: var(--accent); background: rgba(6,23,27,.72); border-radius: 20px; padding: 6px 10px; font-size: 9px; letter-spacing: .14em; font-weight: 850; backdrop-filter: blur(8px); }
.state-pill[data-state="slipping"], .state-pill[data-state="stalled"] { color: var(--danger); border-color: rgba(241,126,120,.3); }
.state-pill[data-state="powered"], .state-pill[data-state="coast"] { color: var(--accent-2); border-color: rgba(240,183,106,.32); }
.state-pill[data-state="impact"] { color: #f8e5ae; border-color: rgba(248,229,174,.4); }
.stage-caption { position: absolute; left: 18px; bottom: 55px; width: min(420px, calc(100% - 36px)); padding: 12px 14px; border: 1px solid rgba(152,190,202,.14); border-radius: 12px; background: rgba(6,17,24,.7); backdrop-filter: blur(10px); pointer-events: none; }
.caption-kicker { font-size: 8px; letter-spacing: .16em; color: #73909b; font-weight: 850; margin-bottom: 5px; }
.stage-caption p { margin: 0; font-size: 11px; line-height: 1.5; color: #c0d1d7; }
.stage-legend { position: absolute; left: 18px; bottom: 17px; display: flex; flex-wrap: wrap; gap: 12px; pointer-events: none; }
.stage-legend span { display: flex; align-items: center; gap: 6px; color: #7f98a3; font-size: 9px; }
.legend-swatch { display: inline-block; width: 7px; height: 7px; border-radius: 2px; }
.swatch-amber { background: var(--accent-2); box-shadow: 0 0 8px rgba(240,183,106,.5); }
.swatch-cyan { background: var(--accent); box-shadow: 0 0 8px rgba(103,227,208,.5); }
.swatch-white { background: #d7e5e8; }
.stage-scale { position: absolute; right: 18px; bottom: 19px; display: flex; align-items: center; gap: 8px; color: #536d78; font-size: 8px; letter-spacing: .13em; pointer-events: none; }
.scale-line { width: 26px; height: 1px; background: #536d78; position: relative; }
.scale-line::before, .scale-line::after { content: ""; position: absolute; top: -3px; height: 7px; width: 1px; background: #536d78; }
.scale-line::before { left: 0; }.scale-line::after { right: 0; }
.control-panel { min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 0 2px 2px 0; display: flex; flex-direction: column; gap: 12px; scrollbar-width: thin; scrollbar-color: #28404c transparent; }
.panel-section, .science-panel { background: linear-gradient(145deg, rgba(16,34,45,.96), rgba(11,25,35,.98)); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: 0 8px 22px rgba(0,0,0,.12); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.section-heading h2 { margin: 3px 0 0; font-size: 14px; letter-spacing: -.02em; font-weight: 680; }
.compact-heading { margin-bottom: 10px; }
.mode-indicator, .unit-note { color: #708a95; font-size: 8px; letter-spacing: .12em; font-weight: 800; white-space: nowrap; }
.mode-indicator { display: flex; align-items: center; gap: 6px; }
.mode-indicator span { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.button-row { display: flex; gap: 7px; }
.primary-actions { margin-bottom: 8px; }
.btn { border: 1px solid transparent; border-radius: 9px; height: 35px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; font-size: 10px; font-weight: 750; white-space: nowrap; transition: background .18s ease, border-color .18s ease, transform .18s ease, opacity .18s ease; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .38; cursor: not-allowed; }
.btn-primary { flex: 1.1; background: linear-gradient(110deg,#77ead6,#4fcbbd); color: #06201f; box-shadow: 0 4px 16px rgba(78,210,190,.13); }
.btn-primary:hover:not(:disabled) { background: #91f4e3; }
.btn-secondary { flex: .9; background: #1a303d; color: #c3d5da; border-color: rgba(156,196,208,.13); }
.btn-secondary:hover:not(:disabled), .btn-quiet:hover:not(:disabled) { background: #203b49; border-color: rgba(156,196,208,.28); }
.btn-quiet { background: #142834; color: #a5bbc3; border-color: rgba(156,196,208,.1); height: 30px; padding: 0 8px; font-size: 9px; }
.utility-actions { flex-wrap: wrap; }
.btn-icon { font-size: 14px; line-height: 1; }
kbd { font: inherit; color: #607985; border: 1px solid rgba(156,196,208,.16); border-radius: 4px; padding: 0 4px; }
.quality-btn { margin-left: auto; }
.quality-btn b { color: var(--accent); font-size: 9px; }
.shot-btn span { color: var(--accent); }
.metrics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.metric-card { min-width: 0; background: rgba(5,17,24,.44); border: 1px solid rgba(145,183,195,.09); border-radius: 10px; padding: 10px; }
.metric-featured { background: linear-gradient(120deg,rgba(31,77,77,.32),rgba(5,17,24,.48)); border-color: rgba(103,227,208,.18); }
.metric-label { color: #78939e; font-size: 8px; font-weight: 850; letter-spacing: .12em; }
.metric-value { margin-top: 6px; font-size: 19px; line-height: 1.1; letter-spacing: -.045em; font-weight: 680; font-variant-numeric: tabular-nums; white-space: nowrap; }
.metric-value small { color: #89a5af; font-size: 9px; font-weight: 600; letter-spacing: 0; }
.metric-foot { margin-top: 5px; color: #627d88; font-size: 8px; line-height: 1.25; }
.energy-track-wrap { margin-top: 11px; }
.track-heading { display: flex; justify-content: space-between; color: #7e98a2; font-size: 9px; margin-bottom: 6px; }
.track-heading strong { color: #b5cbd1; font-variant-numeric: tabular-nums; }
.energy-track { height: 5px; background: #203642; border-radius: 6px; overflow: hidden; }
.energy-fill { width: 100%; height: 100%; background: linear-gradient(90deg,#f0b76a,#67e3d0); border-radius: 6px; transition: width .1s linear; }
.text-button { background: none; border: 0; color: var(--accent); font-size: 9px; font-weight: 700; cursor: pointer; padding: 5px; }
.text-button:hover { color: #a2fff0; }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 12px; }
.preset-btn { display: flex; align-items: center; gap: 8px; text-align: left; border: 1px solid rgba(145,183,195,.12); background: rgba(5,17,24,.4); border-radius: 9px; padding: 8px; min-width: 0; cursor: pointer; }
.preset-btn.active { border-color: rgba(103,227,208,.42); background: rgba(48,118,111,.13); }
.preset-glyph { width: 25px; height: 25px; flex: 0 0 25px; display: grid; place-items: center; border-radius: 7px; background: rgba(103,227,208,.1); color: var(--accent); font-size: 15px; }
.preset-glyph-warn { color: var(--accent-2); background: rgba(240,183,106,.1); }
.preset-btn b, .preset-btn small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preset-btn b { font-size: 9px; color: #c6d7dc; }
.preset-btn small { color: #6f8994; font-size: 8px; margin-top: 3px; }
.parameter { margin-top: 10px; }
.parameter-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.parameter-name { display: flex; align-items: baseline; gap: 6px; min-width: 0; flex-wrap: wrap; }
.kind-tag { color: #a98d69; font-size: 6px; line-height: 1; letter-spacing: .12em; font-weight: 850; white-space: nowrap; }
.kind-textbook { color: #8abbb2; }
.kind-scaled { color: #8ea8db; }
.parameter-heading label { color: #b7c9cf; font-size: 10px; font-weight: 620; }
.parameter-heading output { color: var(--accent); font-size: 10px; font-weight: 760; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { appearance: none; width: 100%; height: 14px; background: transparent; display: block; margin: 5px 0 0; cursor: pointer; touch-action: pan-y; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; background: linear-gradient(90deg,rgba(103,227,208,.55),rgba(103,227,208,.13)); border-radius: 4px; }
input[type="range"]::-moz-range-track { height: 4px; background: linear-gradient(90deg,rgba(103,227,208,.55),rgba(103,227,208,.13)); border-radius: 4px; }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 12px; height: 12px; margin-top: -4px; border-radius: 50%; border: 2px solid #092329; background: var(--accent); box-shadow: 0 0 0 3px rgba(103,227,208,.12); }
input[type="range"]::-moz-range-thumb { width: 9px; height: 9px; border-radius: 50%; border: 2px solid #092329; background: var(--accent); box-shadow: 0 0 0 3px rgba(103,227,208,.12); }
.range-hints { display: flex; justify-content: space-between; color: #5f7984; font-size: 7px; letter-spacing: .01em; }
.threshold-card { display: flex; align-items: center; gap: 9px; border: 1px solid rgba(127,224,178,.18); background: rgba(44,107,84,.1); border-radius: 10px; padding: 9px; margin-top: 13px; }
.threshold-card[data-status="slipping"], .threshold-card[data-status="fail"] { border-color: rgba(241,126,120,.26); background: rgba(135,54,55,.12); }
.threshold-icon { width: 23px; height: 23px; display: grid; place-items: center; flex: 0 0 23px; border-radius: 7px; color: var(--good); background: rgba(127,224,178,.1); font-size: 12px; }
.threshold-card[data-status="slipping"] .threshold-icon, .threshold-card[data-status="fail"] .threshold-icon { color: var(--danger); background: rgba(241,126,120,.1); }
.threshold-copy { min-width: 0; flex: 1; }
.threshold-copy strong, .threshold-copy span { display: block; }
.threshold-copy strong { font-size: 9px; color: #c3d8d0; }
.threshold-copy span { font-size: 8px; color: #77948a; margin-top: 3px; line-height: 1.3; }
.threshold-card[data-status="slipping"] .threshold-copy strong, .threshold-card[data-status="fail"] .threshold-copy strong { color: #f0b0aa; }
.threshold-card[data-status="slipping"] .threshold-copy span, .threshold-card[data-status="fail"] .threshold-copy span { color: #b37f7b; }
.threshold-value { color: #9ce6c0; font-size: 10px; font-weight: 800; font-variant-numeric: tabular-nums; }
.threshold-card[data-status="slipping"] .threshold-value, .threshold-card[data-status="fail"] .threshold-value { color: #f19b92; }
.contact-card { margin-top: 7px; border-color: rgba(103,227,208,.17); background: rgba(33,100,102,.09); }
.contact-card .threshold-icon { color: var(--accent); background: rgba(103,227,208,.1); }
.contact-card .threshold-copy strong { color: #b4d9d8; }
.contact-card .threshold-copy span { color: #759b9b; }
.contact-card[data-status="fail"] .threshold-icon { color: var(--danger); background: rgba(241,126,120,.1); }
.science-panel { padding: 0; overflow: hidden; }
.science-panel summary { min-height: 54px; display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; list-style: none; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-icon { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 8px; color: var(--accent); background: rgba(103,227,208,.09); font-size: 15px; }
.science-panel summary b, .science-panel summary small { display: block; }
.science-panel summary b { font-size: 10px; color: #c7d9de; }
.science-panel summary small { font-size: 8px; color: #6f8994; margin-top: 3px; }
.summary-chevron { margin-left: auto; color: #7d9aa4; font-size: 16px; transition: transform .2s ease; }
.science-panel[open] .summary-chevron { transform: rotate(180deg); }
.science-content { border-top: 1px solid var(--line); padding: 13px 14px 15px; color: #93aab3; font-size: 9px; line-height: 1.5; }
.science-content h3 { color: #c7d9de; font-size: 10px; margin: 4px 0 6px; }
.science-content p { margin: 7px 0 4px; }
.science-content b { color: #c4d5da; }
.equation { background: rgba(4,15,21,.55); border: 1px solid rgba(145,183,195,.09); border-radius: 7px; padding: 7px 9px; color: #bce4de; font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .01em; overflow-wrap: anywhere; }
.science-content ul { margin: 6px 0 10px; padding-left: 16px; }
.science-content li { margin: 4px 0; }
.reference-box { padding: 9px; border: 1px solid rgba(240,183,106,.17); background: rgba(110,77,35,.09); border-radius: 8px; display: flex; flex-direction: column; gap: 4px; }
.reference-box b { color: #e9c58f; font-size: 9px; }
.reference-box span { color: #aebfc4; }
.reference-box small { color: #7e8e91; font-size: 8px; }
.check-box { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; padding: 9px; background: rgba(54,111,104,.1); border: 1px solid rgba(103,227,208,.16); border-radius: 8px; }
.check-box b, .check-box span { display: block; }
.check-box b { color: #bde5de; font-size: 9px; }
.check-box span { color: #7f9d9d; font-size: 8px; margin-top: 2px; }
.check-box strong { color: var(--accent); font-size: 10px; white-space: nowrap; }
.disclaimer { margin: 10px 0 0 !important; color: #748b94; font-style: italic; }
.footerbar { border-top: 1px solid var(--line); padding: 0 22px; display: flex; align-items: center; justify-content: space-between; color: #536c77; font-size: 8px; letter-spacing: .1em; }
.footerbar b { color: #79939e; font-weight: 800; }
.footerbar i { color: var(--accent); font-style: normal; }
@media (max-width: 900px) {
  .workspace { grid-template-columns: minmax(0,1fr) 340px; padding: 12px; gap: 12px; }
  .topbar { padding: 0 16px; }
  .stage-caption { width: min(370px,calc(100% - 32px)); }
}
@media (max-width: 700px) {
  .app-shell { grid-template-rows: 58px minmax(0,1fr) 24px; }
  .topbar { padding: 0 12px; }
  .brand-mark { width: 29px; height: 29px; border-radius: 9px; }
  .eyebrow { font-size: 8px; }
  h1 { font-size: 13px; }
  h1 span { display: none; }
  .topbar-right { gap: 0; }
  .species-chip { height: 26px; font-size: 8px; padding: 0 7px; }
  .scale-chip { display: none; }
  .workspace { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(235px, 37dvh) minmax(0,1fr); padding: 8px 8px 6px; gap: 8px; }
  .stage-card { border-radius: 13px; }
  .stage-topline { top: 10px; left: 11px; right: 11px; }
  .stage-label { font-size: 8px; }
  .state-pill { font-size: 8px; padding: 5px 8px; }
  .stage-caption { left: 10px; bottom: 40px; padding: 8px 10px; width: min(330px,calc(100% - 20px)); }
  .stage-caption p { font-size: 9px; line-height: 1.35; }
  .caption-kicker { font-size: 7px; margin-bottom: 3px; }
  .stage-legend { left: 10px; bottom: 10px; gap: 9px; }
  .stage-legend span { font-size: 7px; gap: 4px; }
  .stage-scale { display: none; }
  .control-panel { gap: 8px; padding: 0 1px 4px 0; }
  .panel-section { padding: 11px; border-radius: 12px; }
  .section-heading { margin-bottom: 9px; }
  .section-heading h2 { font-size: 13px; }
  .btn { height: 33px; }
  .btn-quiet { height: 29px; }
  .metric-value { font-size: 17px; }
  .metric-card { padding: 8px; }
  .metric-foot { font-size: 7px; }
  .parameter { margin-top: 9px; }
  .parameter-heading label, .parameter-heading output { font-size: 9px; }
  .range-hints { font-size: 7px; }
  .footerbar { padding: 0 10px; font-size: 7px; letter-spacing: .06em; }
  .footerbar span:last-child { display: none; }
}
@media (max-width: 380px) {
  .species-chip { display: none; }
  .workspace { grid-template-rows: minmax(220px, 35dvh) minmax(0,1fr); }
  .stage-legend { gap: 6px; }
  .stage-legend span { font-size: 6.5px; }
  .utility-actions { gap: 5px; }
  .btn-quiet { padding: 0 6px; font-size: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
