:root {
  color-scheme: dark;
  --background: #131719;
  --panel: #1b2124;
  --chart: #161c1f;
  --border: #323c3f;
  --text: #eff2eb;
  --muted: #acb8b5;
  --accent: #d1f88b;
  --blue: #8ebddd;
  --coral: #f29c84;
  --mono: "SFMono-Regular", "IBM Plex Mono", Consolas, monospace;
  --sans: "Avenir Next", "Inter", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--background); color: var(--text); font-family: var(--sans); }
button, input { font: inherit; }
a { color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.shell { width: min(1330px, calc(100% - 72px)); margin-inline: auto; }

.site-header { border-bottom: 1px solid var(--border); }
.site-bar { min-height: 60px; display: flex; justify-content: space-between; align-items: center; }
.brand { display: inline-flex; align-items: center; text-decoration: none; font-size: 1.16rem; font-weight: 780; letter-spacing: -.05em; }
.brand-period { color: var(--accent); }
.brand-mark { position: relative; display: inline-block; width: 24px; height: 22px; margin-right: 10px; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; transform-origin: left center; height: 2px; background: var(--accent); }
.brand-mark::before { top: 16px; left: 3px; width: 13px; transform: rotate(-51deg); }
.brand-mark::after { top: 6px; left: 11px; width: 11px; transform: rotate(21deg); }
.brand-mark i { position: absolute; z-index: 1; border-radius: 50%; width: 6px; height: 6px; background: var(--accent); }
.brand-mark i:nth-child(1) { top: 14px; left: 1px; }
.brand-mark i:nth-child(2) { top: 3px; left: 9px; }
.brand-mark i:nth-child(3) { top: 7px; left: 18px; }
.method-link { color: var(--muted); font-size: .83rem; font-weight: 620; text-decoration: none; }
.method-link:hover { color: var(--text); }
.method-link span { margin-left: 5px; color: var(--accent); }

.intro { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 36px 0 23px; }
.eyebrow, .field-title, .unit, .coordinate label { font-family: var(--mono); font-size: .69rem; letter-spacing: .07em; text-transform: uppercase; }
.eyebrow { display: flex; align-items: center; gap: 8px; color: var(--accent); margin: 0 0 9px; }
.live-dot { height: 7px; width: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px #d1f88650; }
h1, h2, h3, p, dl { margin-top: 0; }
h1 { font-size: clamp(2.05rem, 4.15vw, 4rem); line-height: 1.02; font-weight: 630; letter-spacing: -.074em; margin-bottom: 8px; }
.lede { color: var(--muted); font-size: clamp(.88rem, 1.4vw, 1rem); margin-bottom: 0; }
.scenario-control { flex: 0 0 auto; }
.field-title { display: block; color: var(--muted); margin-bottom: 6px; }
.segmented { border: 1px solid var(--border); background: #14191b; padding: 3px; border-radius: 9px; display: flex; gap: 2px; }
.segmented button { padding: 7px 11px; background: transparent; border: 1px solid transparent; border-radius: 6px; color: var(--muted); white-space: nowrap; font-size: .755rem; font-weight: 650; }
.segmented button:hover { color: var(--text); background: #263034; }
.segmented button[aria-pressed="true"] { background: #303b36; border-color: #51664c; color: var(--accent); }

.dashboard { display: grid; grid-template-columns: minmax(0, 2.55fr) minmax(310px, 1fr); gap: 16px; align-items: start; }
.card { min-width: 0; overflow: hidden; border: 1px solid var(--border); background: var(--panel); border-radius: 13px; }
.card-head { display: flex; justify-content: space-between; align-items: start; gap: 8px; padding: 15px 18px 13px; }
.card-head h2 { margin: 0 0 3px; font-size: 1rem; letter-spacing: -.026em; font-weight: 690; }
.card-head p { margin: 0; color: var(--muted); font-size: .75rem; line-height: 1.36; }
.unit { color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 5px 6px; white-space: nowrap; font-size: .60rem; }
.unit span { color: var(--accent); }
.workspace-plot { position: relative; height: clamp(425px, 47vw, 550px); background: var(--chart); border-block: 1px solid var(--border); }
canvas { display: block; width: 100%; height: 100%; }
#workspace { cursor: crosshair; }
.canvas-legend { position: absolute; z-index: 1; pointer-events: none; display: flex; gap: 13px; left: 13px; top: 13px; padding: 6px 8px; border: 1px solid #344044; border-radius: 6px; background: #1c2225ef; color: var(--muted); font-family: var(--mono); font-size: .65rem; }
.canvas-legend span, .joint-key span { display: flex; align-items: center; gap: 5px; }
.legend-line { display: inline-block; width: 12px; height: 2px; background: var(--blue); }
.legend-line.route { background: var(--accent); }
.legend-line.rejected { height: 0; background: none; border-top: 1px dashed var(--coral); }
.legend-obstacle { width: 9px; height: 9px; border: 1px solid var(--coral); border-radius: 50%; background: #53362f; }
.playback { padding: 12px 15px; display: flex; align-items: center; gap: 15px; }
.primary, .apply { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; gap: 8px; font-size: .77rem; font-weight: 730; border-radius: 6px; text-wrap: nowrap; }
.primary { color: #1b2519; background: var(--accent); border: 1px solid var(--accent); padding: 6px 11px; }
.primary:hover { background: #e2ffae; }
.primary:disabled { color: #a6ae9e; background: #303833; border-color: #3f4941; }
#play-icon { font-size: .75em; line-height: 1; }
.scrubber { display: flex; align-items: center; gap: 11px; flex: 1; min-width: 0; }
.scrubber input { width: 100%; min-width: 26px; margin: 0; accent-color: var(--accent); }
.scrubber input:disabled { opacity: .35; }
.scrubber output { width: 4ch; text-align: right; color: var(--muted); font: .70rem var(--mono); }

.sidebar { display: grid; gap: 16px; }
.planner-choices button { flex: 1; }
.control-body { padding: 0 15px 13px; }
#target-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) max-content; align-items: end; gap: 7px; margin-top: 12px; }
.coordinate label { display: block; color: var(--muted); margin-bottom: 5px; font-size: .62rem; }
.coordinate label span { text-transform: none; color: var(--blue); margin-left: 3px; }
.coordinate input { height: 34px; width: 100%; background: #14191b; border: 1px solid var(--border); border-radius: 6px; color: var(--text); font: .78rem var(--mono); padding: 0 6px; }
.coordinate input[aria-invalid="true"] { border-color: var(--coral); }
.apply { color: var(--text); background: #2e373a; border: 1px solid #465154; padding: 6px 8px; }
.apply:hover { background: #3a464a; }
.form-error { grid-column: 1 / -1; margin: 0; color: var(--coral); font-size: .72rem; }
.result { color: var(--accent); background: #263328; border: 1px solid #415541; border-radius: 7px; display: flex; gap: 8px; min-height: 59px; margin-top: 12px; padding: 8px 9px; }
.result[data-state="error"] { color: var(--coral); border-color: #65453e; background: #362724; }
.result-icon { display: grid; place-items: center; width: 18px; height: 18px; flex: 0 0 18px; border: 1px solid currentColor; border-radius: 50%; font: .69rem var(--mono); }
.result strong { display: block; font-size: .79rem; line-height: 1.35; margin-bottom: 2px; }
.result p { margin: 0; color: var(--text); font-size: .68rem; line-height: 1.42; }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 11px 0 0; }
.metrics > div { padding: 8px 8px 7px; border-top: 1px solid var(--border); }
.metrics > div:nth-child(odd) { padding-left: 0; border-right: 1px solid var(--border); }
.metrics > div:nth-child(even) { padding-right: 0; padding-left: 11px; }
.metrics dt { color: var(--muted); font-size: .64rem; margin-bottom: 4px; }
.metrics dd { margin: 0; color: var(--text); font: .91rem var(--mono); white-space: nowrap; }
.joint-plot { height: 170px; background: var(--chart); border-top: 1px solid var(--border); }
.joint-key { display: flex; justify-content: space-between; gap: 4px; border-top: 1px solid var(--border); padding: 9px 13px; margin: 0; color: var(--muted); font: .62rem var(--mono); }
.joint-key i { width: 8px; height: 8px; display: inline-block; border-radius: 2px; }
.key-collision { background: #8e5950; }
.key-search { background: #54809a; }
.key-path { background: var(--accent); }

.methodology { padding: 32px 0 31px; }
.methodology > h2 { margin-bottom: 10px; font-size: 1.25rem; letter-spacing: -.04em; }
.method-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.method-grid article { border-top: 1px solid var(--border); padding-top: 9px; }
.method-grid h3 { margin: 0 0 3px; font-size: .84rem; }
.method-grid p, .scope { color: var(--muted); font-size: .75rem; line-height: 1.55; margin-bottom: 0; }
.scope { margin-top: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 1050px) {
  .shell { width: calc(100% - 44px); }
  .intro { padding-top: 30px; align-items: start; flex-direction: column; gap: 16px; }
  .dashboard { grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); }
}
@media (max-width: 760px) {
  .shell { width: calc(100% - 28px); }
  .site-bar { min-height: 50px; }
  .intro { padding: 24px 0 16px; }
  .dashboard { grid-template-columns: 1fr; gap: 12px; }
  .workspace-plot { height: clamp(300px, 75vw, 465px); }
  .sidebar { gap: 12px; }
  .joint-plot { height: 194px; }
  .methodology { padding-top: 23px; }
}
@media (max-width: 435px) {
  .segmented button { padding-inline: 8px; }
  .card-head { padding: 11px 12px; }
  .canvas-legend { inset: 7px auto auto 7px; padding: 4px 6px; gap: 8px; font-size: .59rem; }
  .playback { padding: 10px; gap: 9px; }
  .method-grid { grid-template-columns: 1fr; gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
