:root {
  color-scheme: dark;
  --bg: #080e13;
  --panel: #101920;
  --panel-2: #121e27;
  --panel-3: #182630;
  --line: rgba(167, 196, 207, .13);
  --line-strong: rgba(167, 196, 207, .22);
  --text: #e8f0f1;
  --muted: #8da1a8;
  --quiet: #61757d;
  --accent: #61d8d0;
  --accent-soft: rgba(97, 216, 208, .12);
  --amber: #e8b86c;
  --blue: #6da8e5;
  --red: #db896d;
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-width: 320px; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-height: 100vh; overflow-x: hidden; }
body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
.app-shell { width: 100%; min-width: 0; height: 100vh; height: 100dvh; min-height: 0; display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: 72px minmax(0, 1fr) 42px; padding: 0 24px; background: radial-gradient(ellipse at 30% -20%, rgba(41, 92, 96, .16), transparent 55%), var(--bg); }
.topbar { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); min-width: 0; }
.brand-lockup { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; color: #a8c3c5; border: 1px solid rgba(97,216,208,.22); border-radius: 11px; background: linear-gradient(145deg, rgba(97,216,208,.12), rgba(97,216,208,.02)); }
.brand-mark svg { width: 31px; height: 31px; }
.eyebrow, .panel-kicker { color: var(--muted); font-size: 9px; line-height: 1.3; font-weight: 750; letter-spacing: .16em; }
h1 { font-size: 19px; line-height: 1.2; letter-spacing: -.025em; font-weight: 650; margin: 3px 0 0; }
.top-actions { display: flex; align-items: center; gap: 16px; }
.era-chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 99px; padding: 7px 10px; color: #a9b9bd; font-size: 9px; font-weight: 750; letter-spacing: .12em; white-space: nowrap; }
.era-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 10px rgba(232,184,108,.55); }
.icon-button { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line-strong); background: rgba(255,255,255,.025); border-radius: 9px; padding: 8px 11px; color: #d8e5e6; font-size: 11px; cursor: pointer; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.icon-button:hover, .transport-btn:hover, .view-btn:hover, .quality-btn:hover { background: rgba(255,255,255,.07); border-color: rgba(97,216,208,.38); }
.icon-button:active, button:active { transform: translateY(1px); }
.icon-button svg { width: 15px; height: 15px; stroke: var(--accent); stroke-width: 1.6; fill: none; }
.workspace { min-width: 0; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 352px; gap: 16px; padding: 16px 0; }
.stage-card { min-width: 0; min-height: 0; overflow: hidden; display: grid; grid-template-rows: 48px minmax(0, 1fr) 36px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(19,31,39,.98), rgba(10,17,23,.98)); box-shadow: 0 16px 40px rgba(0,0,0,.22); }
.stage-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 0 14px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.012); }
.view-switch { display: flex; align-items: center; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: rgba(0,0,0,.18); }
.view-btn { padding: 6px 10px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); font-size: 10px; cursor: pointer; transition: .18s ease; }
.view-btn.active { background: rgba(97,216,208,.12); border-color: rgba(97,216,208,.18); color: #c9f4ef; }
.quality-btn { display: inline-flex; align-items: center; gap: 7px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: #a9b9bd; font-size: 9px; letter-spacing: .12em; font-weight: 750; cursor: pointer; }
.quality-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 9px rgba(97,216,208,.5); }
.quality-btn.low .quality-dot { background: var(--amber); box-shadow: 0 0 9px rgba(232,184,108,.45); }
.canvas-wrap { min-height: 0; position: relative; overflow: hidden; background: radial-gradient(ellipse at 50% 52%, rgba(29,55,62,.22), transparent 70%), #0b1319; }
#scene { width: 100%; height: 100%; display: block; }
.canvas-topline { position: absolute; top: 14px; left: 17px; right: 17px; display: flex; justify-content: space-between; pointer-events: none; }
.live-indicator { display: inline-flex; align-items: center; gap: 7px; color: #a9c3c3; font-size: 9px; font-weight: 750; letter-spacing: .15em; }
.live-indicator span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px rgba(97,216,208,.7); animation: pulse 1.8s infinite; }
.model-scale { color: #5e7279; font-size: 8px; letter-spacing: .14em; font-weight: 700; }
.scene-caption { position: absolute; left: 18px; bottom: 16px; width: min(390px, calc(100% - 36px)); padding: 10px 13px; border: 1px solid rgba(159,191,197,.13); border-radius: 9px; background: rgba(8,15,20,.82); backdrop-filter: blur(8px); display: grid; gap: 4px; pointer-events: none; }
.caption-kicker { color: var(--accent); font-size: 8px; font-weight: 800; letter-spacing: .16em; }
#sceneCaption { color: #c2d0d1; font-size: 10px; line-height: 1.45; }
.scene-compass { position: absolute; right: 19px; bottom: 17px; display: grid; justify-items: center; gap: 3px; color: #72868b; font-size: 8px; letter-spacing: .12em; pointer-events: none; }
.scene-compass i { width: 1px; height: 25px; background: linear-gradient(var(--accent), rgba(97,216,208,.06)); position: relative; }
.scene-compass i::before { content: ""; position: absolute; left: -3px; top: -1px; width: 7px; height: 7px; border-left: 1px solid var(--accent); border-top: 1px solid var(--accent); transform: rotate(45deg); }
.scene-compass small { font-size: 7px; color: #596e76; }
.stage-bottomline { display: flex; align-items: center; gap: 17px; padding: 0 15px; border-top: 1px solid var(--line); color: #879ba1; font-size: 9px; }
.stage-bottomline span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend-line { width: 13px; height: 2px; display: inline-block; border-radius: 2px; }
.legend-line.drive { background: var(--accent); }
.legend-line.delivery { background: var(--blue); }
.legend-line.waste { background: var(--amber); }
.stage-bottomline .stage-note { margin-left: auto; color: #5e737b; font-size: 8px; letter-spacing: .08em; }
.inspector { min-width: 0; min-height: 0; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: 12px; padding: 0 2px 2px 0; scrollbar-width: thin; scrollbar-color: #29404a transparent; }
.inspector::-webkit-scrollbar { width: 5px; }
.inspector::-webkit-scrollbar-thumb { background: #29404a; border-radius: 5px; }
.readouts { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.readout { min-width: 0; min-height: 78px; padding: 10px 11px 9px; border: 1px solid var(--line); border-radius: 10px; background: linear-gradient(145deg, rgba(19,31,39,.96), rgba(14,23,30,.96)); }
.primary-readout { border-color: rgba(97,216,208,.23); background: linear-gradient(145deg, rgba(25,55,58,.58), rgba(15,27,33,.95)); }
.readout-label { color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .12em; white-space: nowrap; }
.readout-value { margin-top: 7px; color: #e9f2f1; font-size: 22px; line-height: 1; font-weight: 620; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.primary-readout .readout-value { color: #b5f2e9; }
.readout-unit { margin-top: 5px; color: #6f848a; font-size: 8px; letter-spacing: .03em; }
.cycle-panel { padding: 11px 12px 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(16,26,33,.9); }
.cycle-head { display: flex; justify-content: space-between; align-items: center; }
.cycle-head > div { display: grid; gap: 3px; }
.cycle-head strong { font-size: 12px; font-weight: 620; }
.cycle-count { color: #6e848a; font-size: 8px; font-weight: 750; letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.phase-track { margin-top: 9px; height: 4px; border-radius: 4px; background: #26343b; overflow: hidden; }
.phase-track span { display: block; width: 20%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #3b8f8b, var(--accent)); transition: width .12s linear; }
.cycle-foot { display: flex; justify-content: space-between; margin-top: 7px; color: #789097; font-size: 9px; }
.control-section, .preset-section, .transport-section, .science-panel { border: 1px solid var(--line); border-radius: 10px; background: rgba(16,26,33,.78); }
.control-section { padding: 12px 12px 10px; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.section-title-row h2 { margin: 3px 0 0; font-size: 13px; font-weight: 640; letter-spacing: -.01em; }
.control-count { color: #647a81; font-size: 8px; letter-spacing: .12em; font-weight: 750; }
.control-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; margin-top: 13px; }
.control { min-width: 0; display: block; }
.control-top { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; color: #c2d0d1; font-size: 9px; font-weight: 570; }
.control-top em { color: #8ea6a8; font-family: Georgia, serif; font-style: italic; }
.control output { color: var(--accent); font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
input[type="range"] { width: 100%; display: block; height: 15px; margin: 7px 0 0; appearance: none; background: transparent; cursor: pointer; touch-action: pan-y; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, rgba(97,216,208,.8), rgba(97,216,208,.2)); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 4px; background: linear-gradient(90deg, rgba(97,216,208,.8), rgba(97,216,208,.2)); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 11px; height: 11px; margin-top: -4px; border: 2px solid #aaf0e9; border-radius: 50%; background: #173a3b; box-shadow: 0 0 0 3px rgba(97,216,208,.10); }
input[type="range"]::-moz-range-thumb { width: 8px; height: 8px; border: 2px solid #aaf0e9; border-radius: 50%; background: #173a3b; box-shadow: 0 0 0 3px rgba(97,216,208,.10); }
input[type="range"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 3px; }
.range-ends { display: flex; justify-content: space-between; margin-top: 1px; color: #5e7279; font-size: 7px; }
.preset-section { padding: 10px 11px; }
.section-title-row.compact h2 { margin: 0; font-size: 11px; }
.preset-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 9px; }
.preset-btn { display: flex; align-items: center; gap: 8px; min-width: 0; text-align: left; padding: 8px 8px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.018); cursor: pointer; transition: .18s ease; }
.preset-btn:hover { border-color: rgba(97,216,208,.3); background: rgba(97,216,208,.045); }
.preset-btn.selected { border-color: rgba(97,216,208,.3); background: rgba(97,216,208,.07); }
.preset-icon { flex: 0 0 20px; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 6px; color: var(--accent); background: rgba(97,216,208,.1); font-size: 13px; }
.preset-btn strong { display: block; overflow: hidden; color: #cbd9d9; font-size: 8px; font-weight: 650; white-space: nowrap; text-overflow: ellipsis; }
.preset-btn small { display: block; margin-top: 3px; color: #71858b; font-size: 7px; white-space: nowrap; }
.transport-section { padding: 9px 10px 8px; }
.transport-buttons { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 6px; }
.play-btn, .transport-btn { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 31px; border-radius: 7px; cursor: pointer; transition: .18s ease; }
.play-btn { border: 1px solid rgba(97,216,208,.3); background: rgba(97,216,208,.12); color: #c9f4ef; font-size: 9px; font-weight: 700; }
.play-btn:hover { background: rgba(97,216,208,.2); }
.play-icon { font-size: 12px; }
.transport-btn { border: 1px solid var(--line); background: rgba(255,255,255,.025); color: #9db0b4; font-size: 8px; font-weight: 750; letter-spacing: .1em; }
.transport-btn span { color: var(--accent); font-size: 12px; }
.sim-clock { display: flex; align-items: center; gap: 7px; margin-top: 8px; color: #6c8187; font-size: 8px; letter-spacing: .08em; }
.sim-clock strong { color: #b8c8c9; font-size: 9px; font-weight: 650; font-variant-numeric: tabular-nums; }
.sim-clock b { color: #9bb0b2; font-weight: 650; }
.clock-divider { height: 10px; width: 1px; margin: 0 2px; background: var(--line-strong); }
.science-panel { overflow: hidden; }
.science-panel summary { display: flex; align-items: center; justify-content: space-between; padding: 11px 12px; color: #d5e2e2; font-size: 10px; font-weight: 650; cursor: pointer; list-style: none; }
.science-panel summary::-webkit-details-marker { display: none; }
.science-panel summary > span:first-child { display: flex; align-items: center; gap: 8px; }
.science-icon { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; color: var(--accent); background: rgba(97,216,208,.1); font-family: Georgia, serif; font-size: 14px; }
.summary-chevron { color: #799097; font-size: 15px; transition: transform .2s ease; }
.science-panel[open] .summary-chevron { transform: rotate(180deg); }
.science-content { padding: 0 12px 13px; border-top: 1px solid var(--line); color: #9cb0b4; font-size: 9px; line-height: 1.55; }
.science-content h3 { margin: 12px 0 4px; color: #d5e2e2; font-size: 10px; font-weight: 700; }
.science-content p { margin: 5px 0; }
.science-content ul { margin: 5px 0 8px; padding-left: 17px; }
.science-content li { margin: 3px 0; }
.equation { margin: 7px 0; padding: 8px 9px; border: 1px solid rgba(97,216,208,.13); border-radius: 7px; background: rgba(97,216,208,.045); color: #c4eeea; font-family: Georgia, "Times New Roman", serif; font-size: 11px; text-align: center; }
.check-row { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px solid rgba(167,196,207,.07); }
.check-row strong { color: var(--accent); font-variant-numeric: tabular-nums; }
.model-note { margin-top: 10px !important; color: #c3d1d1; font-style: italic; }
.label-note { color: #70858a; font-size: 8px; }
.footerbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); color: #70848a; font-size: 9px; }
.footer-history { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.footer-status { display: inline-flex; align-items: center; gap: 7px; color: #81979b; font-size: 8px; font-weight: 750; letter-spacing: .12em; white-space: nowrap; }
.footer-status i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px rgba(97,216,208,.5); }
button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@keyframes pulse { 0%,100% { opacity: 1; box-shadow: 0 0 0 0 rgba(97,216,208,.25); } 50% { opacity: .65; box-shadow: 0 0 0 5px rgba(97,216,208,0); } }
@media (min-width: 1500px) { .app-shell { padding-inline: 32px; } .workspace { grid-template-columns: minmax(0,1fr) 390px; gap: 20px; } .inspector { gap: 14px; } }
@media (max-width: 1050px) and (min-width: 701px) { .app-shell { padding-inline: 14px; grid-template-rows: 66px minmax(0,1fr) 38px; } .workspace { grid-template-columns: minmax(0,1fr) 320px; gap: 10px; padding: 10px 0; } .stage-bottomline { gap: 10px; } .stage-note { display: none !important; } }
@media (max-width: 700px) {
  html, body { min-height: 100%; }
  body.embed-mode { height: 100vh; height: 100dvh; overflow: hidden; }
  .app-shell { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; grid-template-rows: 56px minmax(0,1fr) 32px; padding: 0 10px; }
  .topbar { gap: 8px; }
  .brand-lockup { gap: 8px; }
  .brand-mark { width: 32px; height: 32px; border-radius: 9px; }
  .brand-mark svg { width: 27px; height: 27px; }
  .eyebrow { font-size: 7px; letter-spacing: .12em; }
  h1 { margin-top: 2px; font-size: 15px; }
  .top-actions { gap: 6px; }
  .era-chip { padding: 6px 7px; font-size: 7px; letter-spacing: .07em; }
  .era-dot { width: 4px; height: 4px; }
  .icon-button { padding: 7px; border-radius: 8px; }
  .icon-button span { display: none; }
  .icon-button svg { width: 16px; height: 16px; }
  .workspace { display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(245px, 43%) minmax(0,1fr); gap: 8px; padding: 8px 0; overflow: hidden; }
  .stage-card { grid-template-rows: 42px minmax(0,1fr) 27px; border-radius: 11px; }
  .stage-toolbar { padding: 0 8px; }
  .view-switch { gap: 1px; padding: 2px; }
  .view-btn { padding: 6px 8px; font-size: 9px; }
  .quality-btn { padding: 5px 7px; font-size: 8px; }
  .canvas-topline { top: 8px; left: 10px; right: 10px; }
  .live-indicator { font-size: 7px; }
  .model-scale { font-size: 6px; }
  .scene-caption { left: 9px; bottom: 8px; width: min(280px, calc(100% - 18px)); padding: 7px 9px; gap: 3px; }
  .caption-kicker { font-size: 7px; }
  #sceneCaption { font-size: 8px; }
  .scene-compass { right: 10px; bottom: 10px; font-size: 7px; }
  .scene-compass i { height: 17px; }
  .stage-bottomline { gap: 9px; padding: 0 9px; font-size: 7px; }
  .stage-bottomline span { gap: 4px; }
  .legend-line { width: 9px; }
  .stage-bottomline .stage-note { display: none; }
  .inspector { padding: 0 1px 3px 0; gap: 7px; overscroll-behavior: contain; }
  .readouts { gap: 5px; }
  .readout { min-height: 62px; padding: 7px 8px 6px; border-radius: 8px; }
  .readout-label { font-size: 7px; }
  .readout-value { margin-top: 5px; font-size: 18px; }
  .readout-unit { margin-top: 3px; font-size: 7px; }
  .cycle-panel { padding: 8px 9px; border-radius: 8px; }
  .cycle-head strong { font-size: 10px; }
  .panel-kicker { font-size: 7px; }
  .cycle-count { font-size: 7px; }
  .phase-track { margin-top: 6px; }
  .cycle-foot { margin-top: 5px; font-size: 8px; }
  .control-section { padding: 9px 9px 8px; border-radius: 8px; }
  .section-title-row h2 { font-size: 11px; }
  .control-count { font-size: 7px; }
  .control-list { gap: 8px 12px; margin-top: 9px; }
  .control-top { font-size: 8px; }
  .control output { font-size: 9px; }
  input[type="range"] { margin-top: 4px; height: 14px; }
  .range-ends { font-size: 6px; }
  .preset-section { padding: 8px; border-radius: 8px; }
  .section-title-row.compact h2 { font-size: 10px; }
  .preset-buttons { gap: 5px; margin-top: 7px; }
  .preset-btn { gap: 6px; padding: 6px; border-radius: 7px; }
  .preset-icon { width: 17px; height: 17px; flex-basis: 17px; font-size: 11px; }
  .preset-btn strong { font-size: 7px; }
  .preset-btn small { font-size: 6px; }
  .transport-section { padding: 7px 8px 6px; border-radius: 8px; }
  .play-btn, .transport-btn { min-height: 28px; font-size: 8px; }
  .sim-clock { margin-top: 6px; font-size: 7px; }
  .science-panel { border-radius: 8px; }
  .science-panel summary { padding: 9px; font-size: 9px; }
  .science-content { padding: 0 9px 10px; font-size: 8px; }
  .science-content h3 { font-size: 9px; }
  .equation { font-size: 10px; }
  .footerbar { font-size: 7px; }
  .footer-status { font-size: 7px; }
}
@media (max-width: 380px) {
  .app-shell { padding-inline: 7px; grid-template-rows: 52px minmax(0,1fr) 29px; }
  .era-chip { display: none; }
  .workspace { grid-template-rows: minmax(225px, 40%) minmax(0,1fr); }
  .view-btn { padding-inline: 6px; }
  .control-list { gap: 7px 9px; }
  .readout-value { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
