:root {
  --paper: #faf8f2;
  --card: #fffdf8;
  --ink: #203a3e;
  --muted: #587073;
  --green: #13745e;
  --green-soft: #e3efe8;
  --line: #d4dfd7;
  --warn: #b5483a;
  font-family: Arimo, Arial, Helvetica, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--paper); color: var(--ink); }
body { font-size: 15px; line-height: 1.4; -webkit-text-size-adjust: 100%; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }

#app { display: grid; grid-template-columns: 410px 1fr; height: 100dvh; }
#side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--paper); }
#brand { padding: 16px 18px 10px; }
#brand h1 { margin: 0; font-size: 22px; font-weight: 400; letter-spacing: -0.02em; }
#brand h1 em { font-style: normal; color: var(--green); }
#brand p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }

#tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
#tabs button { flex: 0 0 auto; border: 0; background: none; padding: 9px 9px 8px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-size: 14px; }
#tabs button[aria-selected="true"] { color: var(--green); border-bottom-color: var(--green); }
#panel { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px 28px; }

#stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #f3f1e8; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#map.pick { cursor: crosshair; }

.float { position: absolute; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 2px 10px #203a3e1c; }
#runbar { position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 3px 14px #203a3e26; white-space: nowrap; }
#clock { font-variant-numeric: tabular-nums; font-size: 18px; color: var(--green); min-width: 84px; text-align: right; }
#zoom { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 4px; }
#zoom button { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); font-size: 19px; line-height: 1; }
#legend { position: absolute; left: 12px; top: 12px; padding: 8px 10px; background: #fffdf8f0; border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; min-width: 180px; max-width: 230px; }
#legend b { display: block; font-weight: 400; color: var(--ink); margin-bottom: 4px; }
#legend .ramp { height: 9px; border-radius: 3px; margin: 3px 0; }
#legend .ends { display: flex; justify-content: space-between; color: var(--muted); }
#legend .key { display: flex; align-items: center; gap: 6px; color: var(--muted); }
#legend .key i { width: 18px; height: 3px; border-radius: 2px; display: inline-block; }
#banner { position: absolute; left: 50%; bottom: 86px; z-index: 3; transform: translateX(-50%); background: var(--green); color: #fff; padding: 8px 10px 8px 14px; border-radius: 999px; font-size: 14px; display: flex; gap: 10px; align-items: center; max-width: calc(100% - 24px); white-space: nowrap; box-shadow: 0 3px 12px #203a3e33; }
#banner[hidden], #legend[hidden], #placecard[hidden] { display: none; }
#banner button { border: 0; background: #ffffff33; color: #fff; border-radius: 999px; padding: 3px 10px; }
#placecard { position: absolute; right: 12px; top: 140px; z-index: 2; width: min(300px, calc(100% - 24px)); padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 3px 14px #203a3e26; }
#placecard h3 { margin: 0 0 2px; font-size: 16px; font-weight: 400; }
#placecard p { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
#attrib { position: absolute; right: 8px; bottom: 4px; max-width: calc(100% - 16px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; color: var(--muted); background: #faf8f2c8; padding: 1px 6px; border-radius: 4px; }
#loading { position: absolute; inset: 0; display: grid; place-items: center; background: var(--paper); color: var(--muted); font-size: 17px; }

button.primary { background: var(--green); color: #fff; border: 1px solid var(--green); border-radius: 8px; padding: 8px 16px; }
button.ghost, select.ghost, #reset, #speed { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 7px 11px; }
button.ghost.on { background: var(--green-soft); border-color: var(--green); color: var(--green); }
button.link { border: 0; background: none; color: var(--green); padding: 0; text-decoration: underline; }
button.danger { color: var(--warn); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 10px; }
h2 { font-size: 12px; font-weight: 400; letter-spacing: 0.09em; text-transform: uppercase; color: var(--green); margin: 18px 0 8px; }
h2:first-child { margin-top: 0; }

.agent { border: 1px solid var(--line); border-radius: 10px; background: var(--card); margin-bottom: 8px; overflow: hidden; }
.agent.sel { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.agent > header { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; }
.agent .dot { width: 14px; height: 14px; border-radius: 50%; flex: 0 0 auto; }
.agent .who { flex: 1; min-width: 0; }
.agent .who b { font-weight: 400; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent .who span { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #edf0ec; color: var(--muted); white-space: nowrap; }
.chip.go { background: var(--green-soft); color: var(--green); }
.chip.stop { background: #f6e3df; color: var(--warn); }
.chip.rest { background: #e0ebf3; color: #2f6fa8; }
.editor { border-top: 1px solid var(--line); padding: 12px; }
.editor h3 { font-size: 13px; font-weight: 400; color: var(--green); margin: 16px 0 6px; }
.editor h3:first-child { margin-top: 0; }
.editor h3 small { color: var(--muted); font-size: 12px; display: block; }
.field { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; align-items: baseline; margin-bottom: 7px; }
.field label { font-size: 13.5px; }
.field output { font-size: 13px; color: var(--green); font-variant-numeric: tabular-nums; text-align: right; }
.field input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--green); margin: 2px 0 0; }
.field small { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.check { display: flex; gap: 8px; align-items: center; margin: 6px 0; font-size: 13.5px; }
.check input { accent-color: var(--green); width: 16px; height: 16px; flex: 0 0 auto; }
.editor input[type=text], .editor select, .wide { width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.journey { display: grid; grid-template-columns: 76px 1fr auto; gap: 6px 8px; align-items: center; font-size: 13.5px; }
.journey span.v { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.swatches { display: flex; gap: 6px; margin: 8px 0 2px; }
.swatches button { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); padding: 0; }
.swatches button.on { box-shadow: 0 0 0 2px var(--ink); }
.reachbox { background: var(--green-soft); border-radius: 8px; padding: 8px 10px; font-size: 13px; margin-top: 8px; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--card); }
.seg button { border: 0; background: none; padding: 7px 12px; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--green); color: #fff; }
.layer { display: flex; gap: 9px; align-items: flex-start; padding: 7px 0; border-bottom: 1px solid #e8ede8; }
.layer input { accent-color: var(--green); width: 16px; height: 16px; margin-top: 2px; flex: 0 0 auto; }
.layer div { flex: 1; }
.layer small { display: block; color: var(--muted); font-size: 12.5px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 5px 3px; border-bottom: 1px solid #e8ede8; white-space: nowrap; }
th { font-weight: 400; color: var(--muted); font-size: 12px; }
th:first-child, td:first-child { text-align: left; }
td small { color: var(--muted); display: block; font-size: 11.5px; }
td .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.scroll { overflow-x: auto; }
#chart { width: 100%; height: 170px; display: block; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
.log { font-size: 12.5px; color: var(--muted); margin: 0; padding-left: 16px; }
.big { font-size: 26px; color: var(--green); line-height: 1.1; }
.about p, .about li { font-size: 13.5px; }
.about ol, .about ul { padding-left: 18px; margin: 6px 0; }
.about code { background: #edf0ec; padding: 1px 4px; border-radius: 4px; font-size: 12.5px; }
.formula { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; font-size: 13px; margin: 8px 0; }

@media (max-width: 820px) {
  #app { grid-template-columns: 1fr; grid-template-rows: 54dvh 1fr; }
  #side { order: 2; border-right: 0; border-top: 1px solid var(--line); }
  #stage { order: 1; }
  #brand { padding: 10px 14px 6px; }
  #brand h1 { font-size: 18px; }
  #brand p { display: none; }
  #runbar { bottom: 20px; padding: 6px 8px; gap: 6px; }
  #clock { font-size: 16px; min-width: 74px; }
}

/* Layers and key panel that floats on the map, available from every tab */
#layers { position: absolute; left: 12px; top: 12px; width: 236px; max-height: calc(100% - 110px); display: flex; flex-direction: column; background: #fffdf8f5; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 2px 10px #203a3e1c; font-size: 12.5px; }
#layers > button { border: 0; background: none; padding: 9px 11px; text-align: left; display: flex; justify-content: space-between; color: var(--ink); font-size: 13.5px; }
#layers .body { overflow-y: auto; padding: 0 11px 10px; }
#layers.shut .body { display: none; }
#layers.shut { width: auto; }
#layers h4 { margin: 10px 0 5px; font-size: 11px; font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase; color: var(--green); }
#layers h4:first-child { margin-top: 2px; }
.pills { display: flex; flex-wrap: wrap; gap: 4px; }
.pills button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 3px 9px; font-size: 12.5px; }
.pills button.on { background: var(--green); border-color: var(--green); color: #fff; }
#layers input[type=range] { width: 100%; accent-color: var(--green); margin: 6px 0 0; }
.ramp { height: 9px; border-radius: 3px; margin: 6px 0 2px; }
.ends { display: flex; justify-content: space-between; color: var(--muted); }
.key { display: grid; grid-template-columns: 26px 1fr; gap: 3px 6px; align-items: center; color: var(--muted); }
.key i { justify-self: center; display: inline-block; }
.key .ln { width: 22px; height: 0; border-top: 3px solid; }
.key .dash { border-top-style: dashed; }
.key .dt { width: 10px; height: 10px; border-radius: 50%; }
.key .pin { width: 15px; height: 15px; border-radius: 50%; border: 2.5px solid var(--ink); font-style: normal; font-size: 9px; line-height: 10px; text-align: center; color: var(--ink); }
.cats { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 8px; color: var(--muted); }
.cats span { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.cats i { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }

/* City editing tools */
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tools button { text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 7px 9px; font-size: 13.5px; line-height: 1.25; }
.tools button small { display: block; color: var(--muted); font-size: 11.5px; }
.tools button.on { background: var(--green-soft); border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.edits { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.edits li { padding: 4px 0; border-bottom: 1px solid #e8ede8; color: var(--muted); }
.note { background: #f4efe2; border-radius: 8px; padding: 8px 10px; font-size: 12.5px; color: var(--muted); margin: 10px 0; }
.stepper { display: inline-flex; align-items: center; gap: 6px; }
.stepper button { width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--line); background: var(--card); }
#profile { width: 100%; height: 110px; display: block; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
#placecard .row { margin-top: 6px; }

@media (max-width: 820px) {
  #layers { max-height: calc(100% - 90px); width: 220px; }
}

/* Language switch and the "Why this route?" breakdown */
#brand { position: relative; }
#lang { position: absolute; right: 14px; top: 14px; padding: 4px 10px; font-size: 13px; }
#brand h1 { padding-right: 86px; }
.why { font-size: 13.5px; }
.why p { margin: 0 0 8px; }
.stack { display: flex; height: 14px; border-radius: 4px; overflow: hidden; margin: 2px 0 8px; background: #edf0ec; }
.stack i { display: block; min-width: 2px; }
.whykey { display: flex; flex-wrap: wrap; gap: 3px 12px; margin-bottom: 9px; color: var(--muted); font-size: 12.5px; }
.whykey span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.whykey i { width: 9px; height: 9px; border-radius: 2px; }
.whykey b { font-weight: 400; color: var(--ink); font-variant-numeric: tabular-nums; }
:lang(ko) body { word-break: keep-all; }

/* Collapsible sections keep the panels short */
details { border-top: 1px solid var(--line); }
details > summary { cursor: pointer; padding: 10px 0; font-size: 13px; color: var(--green); list-style: none; display: flex; justify-content: space-between; align-items: center; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: "+"; color: var(--muted); font-size: 16px; line-height: 1; }
details[open] > summary::after { content: "\2212"; }
details[open] { padding-bottom: 10px; }
.editor details .hint { margin-top: 0; }
.why details { margin-top: 2px; }
.why details summary { padding: 6px 0; color: var(--muted); }
#panel > details > summary { font-size: 12px; letter-spacing: 0.09em; text-transform: uppercase; }
#layers details { border-top: 0; padding-bottom: 0; }
#layers details > summary { padding: 10px 0 5px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.idea { background: var(--green-soft); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 13.5px; display: grid; gap: 2px; }
.idea small { color: var(--green); font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; }
.idea b { font-weight: 400; font-size: 15px; }
.idea span { color: var(--muted); }
.idea .link { justify-self: start; margin-top: 4px; text-decoration: none; }
.editor .journey { margin-top: 12px; }

/* The prompt floats over the map: taps go through it to the map, except on its Done button */
#banner { pointer-events: none; }
#banner button { pointer-events: auto; }

#closes { margin-top: 4px; font-size: 12.5px; color: var(--green); }
#closes:empty { display: none; }
