:root {
  --sign: #00674a;
  --paint: #f3f5f0;
  --asphalt: rgba(20, 23, 28, 0.84);
  --muted: #9aa3ad;
  --calm: #45d483;
  --lane: #b8dc4f;
  --busy: #f5a524;
  --danger: #e5484d;
  --car: #aab2bc;
}

html, body { margin: 0; height: 100%; background: #14171c; color: var(--paint); font-family: 'Overpass', system-ui, sans-serif; }
#map { position: absolute; inset: 0; }
p { margin: 0; text-wrap: pretty; }

/* Freeway guide sign: green panel, white inset border. */
.sign {
  position: absolute;
  background: var(--sign);
  border: 3px solid var(--paint);
  border-radius: 12px;
  box-shadow: 0 0 0 5px var(--sign), 0 20px 44px rgba(0, 0, 0, 0.5);
  padding: 18px 22px 20px;
}

#intro { top: 28px; left: 28px; width: 360px; }
#intro .brand { font-weight: 800; font-size: 15px; opacity: 0.8; margin-bottom: 4px; }
#intro h1 { font-weight: 800; font-size: 36px; line-height: 1.02; letter-spacing: -0.01em; margin: 0 0 12px; }
#intro p:not(.brand) { font-size: 15px; line-height: 1.45; margin-bottom: 16px; }
#intro #status { margin: 10px 0 0; font-size: 14px; }
#intro #status:empty { display: none; }

button {
  font: inherit; font-weight: 800; font-size: 16px;
  color: var(--sign); background: var(--paint);
  border: 0; border-radius: 6px; padding: 10px 18px 8px; cursor: pointer;
}
button:disabled { opacity: 0.75; cursor: progress; }
button.link {
  background: none; color: var(--paint); padding: 0;
  font-weight: 600; font-size: 15px; text-decoration: underline; text-underline-offset: 3px;
}
button.link:disabled { cursor: default; }

.actions { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }

#trip { display: grid; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 2px solid rgba(243, 245, 240, 0.35); }
#trip[hidden] { display: none; }
#trip label { display: grid; gap: 4px; font-weight: 800; font-size: 14px; }
#trip input {
  font: inherit; font-weight: 400; font-size: 16px; color: var(--paint);
  background: rgba(0, 0, 0, 0.18); border: 2px solid rgba(243, 245, 240, 0.6); border-radius: 6px; padding: 8px 10px 6px;
}
#trip input::placeholder { color: rgba(243, 245, 240, 0.6); }
#trip input:focus-visible { outline: 3px solid var(--busy); outline-offset: 1px; }
#trip [type=submit] { justify-self: start; margin-top: 4px; }
.presets { font-size: 14px; }
.presets button.link { font-size: 14px; }
button:focus-visible { outline: 3px solid var(--busy); outline-offset: 3px; }

#verdict { top: 28px; right: 28px; width: 320px; transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.5s; }
#verdict.enter { transform: translateX(40px); opacity: 0; }
#verdict .big { font-size: 64px; font-weight: 900; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
#verdict .sub { text-wrap: balance; font-size: 18px; font-weight: 600; line-height: 1.3; margin: 8px 0 14px; }
#verdict .fine { font-size: 14px; line-height: 1.5; opacity: 0.9; }

#board {
  position: absolute; left: 28px; bottom: 36px; width: 440px; box-sizing: border-box;
  background: var(--asphalt); backdrop-filter: blur(10px);
  border-radius: 10px; padding: 14px 18px;
}
.lane {
  display: grid; grid-template-columns: 12px 1fr 72px 48px 104px; gap: 12px; align-items: baseline;
  font-size: 16px; padding: 5px 0; font-variant-numeric: tabular-nums;
}
.lane .time { color: var(--muted); text-align: right; }
.lane .calm { text-align: right; }
.lane.done .time { color: var(--paint); }
.lane .cost { text-align: right; font-weight: 800; }
.swatch { width: 12px; height: 12px; border-radius: 50%; align-self: center; }

.lane.head { font-size: 13px; color: var(--muted); padding-bottom: 2px; }
.lane.head .cost { font-weight: 600; }

button.info {
  display: inline-grid; place-items: center; width: 18px; height: 18px; padding: 0; margin-left: 4px;
  border-radius: 50%; border: 1.5px solid currentColor; background: none; color: inherit;
  font-size: 12px; font-weight: 800; line-height: 1; vertical-align: 1px; cursor: help;
}

#math, #about {
  width: min(520px, calc(100vw - 32px)); box-sizing: border-box; max-height: calc(100vh - 32px); overflow: auto;
  background: #1b1f26; color: var(--paint); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 12px;
  padding: 22px 24px; font-size: 15px; line-height: 1.5; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}
#math::backdrop, #about::backdrop { background: rgba(0, 0, 0, 0.45); }
#math h2, #about h2 { font-size: 20px; font-weight: 800; margin: 0 0 8px; }
#math h3, #about h3 { font-size: 15px; font-weight: 800; margin: 16px 0 2px; }
#about p + p { margin-top: 10px; }
#about button { margin-top: 18px; }
#math ul { margin: 4px 0 16px; padding-left: 18px; color: var(--muted); font-size: 14px; }
#math b { font-weight: 800; }
[data-id="car"] .swatch { background: var(--car); }
[data-id="safe"] .swatch { background: var(--calm); }
[data-id="fast"] .swatch { background: var(--busy); }

.legend {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12.5px; color: var(--muted);
}
.legend i { display: inline-block; width: 16px; height: 4px; border-radius: 2px; vertical-align: middle; margin: -2px 6px 0 0; }

.maplibregl-ctrl-attrib { font-family: system-ui, sans-serif; }

@media (max-width: 760px) {
  .sign { padding: 14px 16px 16px; }
  #intro { top: 16px; left: 16px; right: 16px; width: auto; }
  #intro h1 { font-size: 26px; }
  #intro p:not(.brand):not(#status) { display: none; }
  #board { left: 16px; right: 16px; bottom: 16px; width: auto; padding: 12px 14px; }
  .lane { font-size: 14px; grid-template-columns: 10px 1fr 48px 36px 84px; gap: 6px; }
  /* One compact row: the table below already shows the time and calm share the sentence repeats. */
  #verdict { top: auto; bottom: 230px; left: 16px; right: 16px; width: auto; display: flex; align-items: center; gap: 14px; padding: 10px 14px 12px; }
  #verdict .big { font-size: 36px; }
  #verdict .sub { font-size: 14px; margin: 0; }
  #verdict .fine { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  #verdict { transition: none; }
}
