:root {
  color-scheme: dark;
  --bg: #071018; --panel: #0d1822; --panel-soft: #101e2a; --text: #ecf5fb; --muted: #92a8b8;
  --line: #223847; --cyan: #55d7ff; --orange: #ffac4d; --green: #64e3a1; --purple: #b58cff;
  --shadow: 0 18px 50px rgba(0,0,0,.28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 30% -10%, #12354a 0, var(--bg) 36rem); color: var(--text); }
button, select { min-height: 42px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--panel-soft); font: inherit; }
button { padding: 0 14px; cursor: pointer; }
button:hover { border-color: #466276; background: #152634; }
button:focus-visible, select:focus-visible { outline: 3px solid rgba(85,215,255,.35); outline-offset: 2px; }
button.primary { border-color: transparent; color: #02131c; background: var(--cyan); font-weight: 700; }
button.primary:hover { background: #80e2ff; }
button.quiet { margin-left: auto; background: transparent; }
select { padding: 0 38px 0 12px; }
.app-shell { width: min(1440px, 100%); margin: 0 auto; padding: 28px clamp(16px, 3vw, 42px) 34px; }
.hero { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 22px; }
.eyebrow { margin: 0 0 7px; color: var(--cyan); letter-spacing: .14em; font-size: 12px; font-weight: 700; }
h1 { margin: 0; font-size: clamp(30px, 4vw, 52px); line-height: 1.02; letter-spacing: -.035em; }
.subtitle { max-width: 800px; margin: 12px 0 0; color: var(--muted); font-size: clamp(15px, 1.5vw, 18px); }
.proposal-badge { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; padding: 9px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(13,24,34,.72); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 15px var(--orange); }
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 14px; }
.mode-field { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }
.stepper { display: grid; grid-template-columns: repeat(8, minmax(92px, 1fr)); gap: 5px; margin-bottom: 14px; overflow-x: auto; padding-bottom: 3px; }
.step-button { min-height: 60px; padding: 8px 9px; text-align: left; color: var(--muted); background: rgba(13,24,34,.65); }
.step-button span { display: block; margin-bottom: 3px; color: #688297; font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; }
.step-button strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.step-button.active { border-color: var(--cyan); color: var(--text); background: rgba(85,215,255,.10); box-shadow: inset 0 0 0 1px rgba(85,215,255,.18); }
.step-button.active span { color: var(--cyan); }
.workspace { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(310px, .72fr); gap: 14px; align-items: stretch; }
.viewport-card, .explanation { border: 1px solid var(--line); border-radius: 16px; background: rgba(13,24,34,.92); box-shadow: var(--shadow); }
.viewport-card { position: relative; min-height: 610px; overflow: hidden; touch-action: none; }
#scene-canvas { display: block; width: 100%; height: 610px; }
.viewport-status { position: absolute; z-index: 2; top: 14px; left: 14px; right: 14px; display: flex; flex-wrap: wrap; gap: 7px; pointer-events: none; }
.viewport-status span { padding: 6px 9px; border: 1px solid rgba(146,168,184,.20); border-radius: 999px; color: #c8d8e3; background: rgba(7,16,24,.78); backdrop-filter: blur(8px); font-size: 12px; }
.canvas-help { position: absolute; left: 14px; bottom: 12px; color: var(--muted); font-size: 12px; pointer-events: none; }
.explanation { display: flex; flex-direction: column; padding: clamp(18px, 2.3vw, 28px); }
.step-number { margin: 0 0 8px; color: var(--cyan); font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; }
.explanation h2 { margin: 0; font-size: clamp(22px, 2.3vw, 32px); letter-spacing: -.025em; }
.explanation > p:not(.step-number) { margin: 10px 0 0; color: var(--muted); line-height: 1.55; }
.algorithm-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.algorithm-list span { padding: 5px 8px; border-radius: 999px; color: #bfeeff; background: rgba(85,215,255,.09); font-size: 12px; }
.data-panel { margin-top: 18px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #08121a; }
.data-heading { display: flex; justify-content: space-between; gap: 12px; padding: 9px 11px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
pre { min-height: 180px; max-height: 250px; margin: 0; padding: 13px; overflow: auto; color: #b9d9e9; font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.takeaway { margin-top: auto; padding-top: 18px; }
.takeaway > span { color: var(--orange); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.takeaway p { margin: 6px 0 0; line-height: 1.45; }
.route-summary { display: grid; grid-template-columns: repeat(11, auto); align-items: center; justify-content: center; gap: clamp(7px, 1.15vw, 18px); margin: 18px 0; padding: 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.route-summary div { text-align: center; }
.route-summary strong, .route-summary span { display: block; }
.route-summary strong { margin-bottom: 3px; }
.route-summary span { color: var(--muted); font-size: 12px; }
.route-summary i { color: var(--cyan); font-style: normal; }
footer { color: var(--muted); font-size: 13px; line-height: 1.5; }
footer strong { color: var(--text); }
@media (max-width: 980px) {
  .workspace { grid-template-columns: 1fr; }
  .viewport-card, #scene-canvas { min-height: 520px; height: 520px; }
  .takeaway { margin-top: 16px; }
  .route-summary { grid-template-columns: 1fr; gap: 7px; }
  .route-summary i { transform: rotate(90deg); }
}
@media (max-width: 620px) {
  .app-shell { padding-top: 20px; }
  .hero { display: grid; }
  .proposal-badge { justify-self: start; }
  .toolbar { align-items: stretch; }
  .mode-field { width: 100%; }
  button.quiet { margin-left: 0; }
  .button-row { width: 100%; }
  .button-row button { flex: 1 1 120px; }
  .viewport-card, #scene-canvas { min-height: 430px; height: 430px; }
}
