/* The route film maker, in the landing page's look (dashboard.css): paper and ink, square pixel stops on a
   dashed route, the globe floating on the paper and the engine's film beside it. The fonts are the Android
   app's files, as the editor uses them. */
@font-face { font-family: Geist; src: url(../../../android-app/app/src/main/res/font/geist_regular.ttf); font-weight: 400; }
@font-face { font-family: Geist; src: url(../../../android-app/app/src/main/res/font/geist_medium.ttf); font-weight: 500; }
@font-face { font-family: "Geist Mono"; src: url(../../../android-app/app/src/main/res/font/geist_mono.ttf); }

:root {
  --paper: #F2F0EA; --paper2: #EAE7DF; --card: #FBFAF7;
  --ink: #191917; --ink2: #55544D; --grey: #8C8A82; --grey2: #C9C5BB;
  --line: rgba(25, 25, 23, .09); --line2: rgba(25, 25, 23, .16);
  --deep: #123A40; --sea: #2C6563; --shallow: #8FB5AC; --ember: #E0733A; --danger: #C8553D;
  --sans: Geist, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, Menlo, monospace;
  --settle: cubic-bezier(.16, 1, .3, 1);
  --dash: repeating-linear-gradient(180deg, var(--grey2) 0 2px, transparent 2px 6px);
  --glass: rgba(242, 240, 234, .84); --go-hover: #000; --on-deep: #F2F0EA;
  color-scheme: light;
}
/* night: the same paper and ink, turned over; the sea and the route keep their colours */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0F0F0E; --paper2: #1A1A18; --card: #161614;
    --ink: #F2F0EA; --ink2: #B8B5AC; --grey: #85827A; --grey2: #3A3935;
    --line: rgba(242, 240, 234, .08); --line2: rgba(242, 240, 234, .15);
    --sea: #6FAFA8; --shallow: #5E8E86; --danger: #E2735C;
    --glass: rgba(22, 22, 20, .8); --go-hover: #fff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0F0F0E; --paper2: #1A1A18; --card: #161614;
  --ink: #F2F0EA; --ink2: #B8B5AC; --grey: #85827A; --grey2: #3A3935;
  --line: rgba(242, 240, 234, .08); --line2: rgba(242, 240, 234, .15);
  --sea: #6FAFA8; --shallow: #5E8E86; --danger: #E2735C;
  --glass: rgba(22, 22, 20, .8); --go-hover: #fff;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--paper); color: var(--ink); font: 400 14px/1.5 var(--sans); letter-spacing: -.005em; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; }
:focus-visible { outline: 2px solid var(--sea); outline-offset: 2px; }
.px { display: block; fill: currentColor; shape-rendering: crispEdges; }
.eyebrow { margin: 0; font-size: 12.5px; color: var(--grey); }
.arr { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: square; transition: transform .25s var(--settle); }

.app { display: grid; grid-template: "head head" 60px "side stage" minmax(0, 1fr) / 340px minmax(0, 1fr); height: 100vh; }

/* ---- the bar */
.head { grid-area: head; display: flex; align-items: center; gap: 12px; padding: 0 16px 0 20px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 500; font-size: 15px; white-space: nowrap; }
.brand svg { fill: currentColor; }
.slash { color: var(--grey2); font-size: 18px; }
.title { flex: 0 1 280px; min-width: 0; height: 34px; padding: 0 10px; margin-left: -4px; border-radius: 8px; border: 1px solid transparent; background: transparent; font-size: 15px; color: var(--ink2); transition: background .2s, border-color .2s; }
.title::placeholder { color: var(--grey); }
.title:hover { background: var(--paper2); }
.title:focus { border-color: var(--line2); background: var(--card); color: var(--ink); outline: none; }
.grow { flex: 1; }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--paper2); }
.seg button { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px; border-radius: 7px; color: var(--ink2); font-size: 13px; white-space: nowrap; transition: background .2s, color .2s; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(25, 25, 23, .08); }
.shape-ico { display: inline-block; width: calc(var(--w) / max(var(--w), var(--h)) * 12px); height: calc(var(--h) / max(var(--w), var(--h)) * 12px); border: 1.5px solid currentColor; border-radius: 1px; }

.go { display: inline-flex; align-items: center; gap: 9px; height: 36px; padding: 0 14px; border-radius: 8px; background: var(--ink); color: var(--paper); font-weight: 500; font-size: 14px; text-decoration: none; white-space: nowrap; transition: transform .25s var(--settle), background .2s, opacity .2s; }
.go:hover { background: var(--go-hover); transform: translateY(-1px); }
.go:hover .arr { transform: translate(1px, -1px); }
.go:disabled { opacity: .3; cursor: default; transform: none; }
.ghost { height: 34px; padding: 0 13px; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line2); color: var(--ink2); font-size: 13.5px; transition: background .2s, color .2s; }
.ghost:hover { background: var(--paper2); color: var(--ink); }

/* ---- the panel: stops, then the look */
.side { grid-area: side; display: flex; flex-direction: column; overflow-y: auto; border-right: 1px solid var(--line); }
.block { padding: 20px; }
.block + .block { border-top: 1px solid var(--line); }
.block > .eyebrow { margin-bottom: 8px; }
.block-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.hint-inline { margin: 0; font-size: 12px; color: var(--grey); }
.field { width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line2); background: var(--card); transition: border-color .2s, box-shadow .2s; }
.field::placeholder { color: var(--grey); }
.field:focus { outline: none; border-color: var(--sea); box-shadow: 0 0 0 3px rgba(44, 101, 99, .14); }
.field.small { width: auto; height: 32px; padding: 0 28px 0 10px; border-radius: 8px; font-size: 13px; -webkit-appearance: none; appearance: none; cursor: pointer;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 5 3' shape-rendering='crispEdges'%3E%3Cpath fill='%2355544D' d='M0 0h5v1H0zM1 1h3v1H1zM2 2h1v1H2z'/%3E%3C/svg%3E") no-repeat right 10px center / 7px 4px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; color: var(--ink2); }
.row + .row { border-top: 1px dashed var(--line2); }
.side-foot { margin: auto 20px 18px; padding-top: 24px; font-size: 12px; color: var(--grey); }

/* the route colour: a round swatch, the picker under it */
.swatch { position: relative; width: 26px; height: 26px; border-radius: 50%; background: var(--route, #00a9df); box-shadow: 0 0 0 1px var(--line2), inset 0 0 0 2px var(--card); cursor: pointer; }
.swatch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }

/* sliders: a thin track, a square pixel thumb */
input[type="range"] { -webkit-appearance: none; appearance: none; height: 18px; background: none; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: var(--grey2); }
input[type="range"]::-moz-range-track { height: 2px; background: var(--grey2); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: -5px; background: var(--ink); border: 0; border-radius: 1px; }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; background: var(--ink); border: 0; border-radius: 1px; }
.range { display: inline-flex; align-items: center; gap: 10px; }
.range input { width: 120px; }
.range output { width: 38px; text-align: right; font: 12px var(--mono); color: var(--ink); }

/* places found: under their box */
.place-field { position: relative; }
.search-ico { position: absolute; left: 13px; top: 50%; width: 11px; height: 11px; margin-top: -5.5px; fill: var(--grey); pointer-events: none; }
.place-field .field { padding-left: 34px; }
.place-results { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; right: 0; padding: 4px; border-radius: 12px; background: var(--card); box-shadow: 0 0 0 1px var(--line2), 0 18px 40px -18px rgba(18, 58, 64, .45); }
.place-results[hidden] { display: none; }
.place-results button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 8px 10px; border-radius: 8px; text-align: left; }
.place-results button.on, .place-results button:hover { background: var(--paper2); }
.place-results b { font-weight: 500; font-size: 13.5px; }
.place-results span { font: 11px var(--mono); color: var(--grey); }
.place-note { padding: 9px 10px; color: var(--grey); font-size: 13px; }

/* ---- the stops: cards on one dashed route, each leg's transport between two */
.stop-count { font: 11px var(--mono); color: var(--grey); }
/* the place search and the GPX button, one row */
.find-row { display: flex; gap: 8px; }
.find-row .place-field { flex: 1; min-width: 0; }
.gpx-btn { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 0 11px; border-radius: 10px; font: 500 11px var(--mono); letter-spacing: .04em;
  color: var(--ink2); box-shadow: inset 0 0 0 1px var(--line2); transition: background .2s, color .2s; }
.gpx-btn:hover { background: var(--paper2); color: var(--ink); }
.gpx-btn .px { width: 10px; height: 10px; }
.stops { list-style: none; margin: 14px 0 0; padding: 0; }
.stop { position: relative; padding: 8px 8px 8px 12px; border-radius: 12px; background: var(--card); box-shadow: 0 0 0 1px var(--line); }
.stop-top { display: flex; align-items: center; gap: 6px; }
/* a stop's country, quiet beside its name; its move and remove buttons come up with a pointer over it */
.stop-top .flag { flex: none; max-width: 38%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stop-acts { flex: none; display: flex; opacity: 0; transition: opacity .15s; }
.stop:hover .stop-acts, .stop:focus-within .stop-acts { opacity: 1; }
@media (hover: none) { .stop-acts { opacity: 1; } }
.num { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 3px; background: var(--route, #00a9df); color: #fff; font: 500 11px var(--mono); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .28); }
.name { flex: 1; min-width: 0; height: 30px; padding: 0 6px; border: 1px solid transparent; border-radius: 7px; background: transparent; font-weight: 500; }
.name:hover { background: var(--paper); }
.name:focus { border-color: var(--line2); background: var(--paper); outline: none; }
.icon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; color: var(--grey); transition: background .2s, color .2s; }
.icon:hover { background: var(--paper2); color: var(--ink); }
.icon:disabled { opacity: .25; cursor: default; background: none; }
.icon.del:hover { color: var(--danger); }
.stop-more { display: flex; align-items: center; gap: 6px; margin-top: 6px; padding-left: 28px; flex-wrap: wrap; }
.stop-more select { height: 28px; padding: 0 24px 0 9px; border-radius: 7px; border: 1px solid var(--line2); font-size: 12.5px; -webkit-appearance: none; appearance: none; cursor: pointer;
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 5 3' shape-rendering='crispEdges'%3E%3Cpath fill='%2355544D' d='M0 0h5v1H0zM1 1h3v1H1zM2 2h1v1H2z'/%3E%3C/svg%3E") no-repeat right 8px center / 7px 4px; }
.flag { font: 11px var(--mono); color: var(--grey); }
.photos { display: flex; gap: 4px; margin-left: auto; }
.thumb { position: relative; width: 30px; height: 30px; border-radius: 6px; background: center / cover; box-shadow: inset 0 0 0 1px var(--line2); }
.thumb button { position: absolute; inset: 0; opacity: 0; background: rgba(25, 25, 23, .6); color: #fff; border-radius: 6px; display: grid; place-items: center; transition: opacity .2s; }
.thumb:hover button { opacity: 1; }
.add-photo { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 6px; border: 1px dashed var(--grey2); color: var(--grey); transition: border-color .2s, color .2s; }
.add-photo:hover { border-color: var(--sea); color: var(--sea); }
/* a leg: on the dashed route between two stops, everything on it starting at one edge */
.leg { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 8px 0 8px 40px; position: relative; }
.leg::before { content: ""; position: absolute; left: 22px; top: 0; bottom: 0; width: 2px; background: var(--dash); }
.leg-row { display: flex; align-items: center; gap: 8px; max-width: 100%; }
.leg .seg { padding: 2px; background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.leg .seg button { height: 26px; padding: 0 8px; font-size: 12px; color: var(--grey); }
.leg .seg button.on { color: var(--ink); }
.leg .km { font: 11.5px var(--mono); color: var(--grey); }
.empty { padding: 26px 8px 8px; color: var(--grey); text-align: center; }
.empty p { margin: 0 0 14px; }
.empty[hidden] { display: none; }
.empty-art { width: 88px; height: 56px; margin: 0 auto 14px; display: block; animation: bob 3.2s ease-in-out infinite; }
.empty-art .sail { fill: var(--grey2); }
.empty-art .mast { fill: var(--ink2); }
.empty-art .hull { fill: var(--sea); }
.empty-art .sea { fill: var(--shallow); }
@keyframes bob { 50% { transform: translateY(2px); } }
@media (prefers-reduced-motion: reduce) { .empty-art { animation: none; } }

/* ---- the stage: the globe floating on the paper, the engine's film */
.stage { grid-area: stage; position: relative; overflow: hidden; padding: 12px; }
.tabs { position: absolute; z-index: 5; top: 24px; left: 50%; transform: translateX(-50%); background: var(--glass); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: 0 0 0 1px var(--line), 0 10px 30px -14px rgba(18, 58, 64, .35); }
/* under both panes: a faint chart (dashboard.js-style pixels in the paper's own tones), drawn by template.js */
.chart { position: absolute; inset: 12px; width: calc(100% - 24px); height: calc(100% - 24px); border-radius: 14px; background: var(--paper2); image-rendering: pixelated; }
.pane { position: absolute; inset: 12px; border-radius: 14px; overflow: hidden; transition: opacity .25s; }
.pane.hidden { opacity: 0; pointer-events: none; z-index: -1; }
/* (hidden, keeping its size: the preview isn't resized under the export dialog) */
.frame.hidden { visibility: hidden; }
#routeMap { position: absolute; inset: 0; }
.map-note { position: absolute; inset: 0; display: grid; place-content: center; gap: 6px; padding: 24px; max-width: 460px; margin: auto; text-align: center; color: var(--ink2); }
.map-note b { color: var(--ink); font-weight: 500; }
/* over the map: undo and redo, and what a tap or a drag does next */
.map-tools { position: absolute; z-index: 4; top: 12px; left: 12px; background: var(--glass); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: 0 0 0 1px var(--line); }
.map-tools button:disabled { opacity: .35; cursor: default; }
.map-hint { position: absolute; z-index: 4; left: 50%; bottom: 14px; transform: translateX(-50%); margin: 0; padding: 6px 12px; max-width: calc(100% - 140px); border-radius: 8px; background: var(--glass); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: 0 0 0 1px var(--line); font-size: 12.5px; color: var(--ink2); text-align: center; pointer-events: none; }
.maplibregl-ctrl-group { border-radius: 10px !important; box-shadow: 0 0 0 1px var(--line2) !important; background: var(--card) !important; }
.maplibregl-ctrl-attrib { background: var(--glass) !important; color: var(--ink2); font: 11px var(--sans) !important; }
#previewPane { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 64px 24px 20px; }
.frame { position: relative; aspect-ratio: var(--shape, 16 / 9); max-width: 100%; max-height: calc(100% - 52px); height: calc(100% - 52px); border-radius: 12px; overflow: hidden; background: var(--deep); box-shadow: 0 0 0 1px var(--line), 0 30px 60px -30px rgba(18, 58, 64, .55); }
.frame.portrait-fit { height: auto; width: 100%; }
.frame > canvas { display: block; width: 100%; height: 100%; }
/* while the engine starts or has something to say: a dithered sea under the words */
.veil { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; background: var(--deep); color: var(--on-deep); }
.veil[hidden] { display: none; }
.veil-sea { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 38%; image-rendering: pixelated; opacity: .9; }
.veil span { position: relative; max-width: 460px; font-size: 14px; }
.transport { display: flex; align-items: center; gap: 14px; width: min(720px, 100%); padding: 8px 10px 8px 8px; border-radius: 14px; background: var(--card); box-shadow: 0 0 0 1px var(--line); }
.play { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: var(--ink); color: var(--paper); transition: background .2s; }
.play:hover { background: var(--go-hover); }
.play:disabled { opacity: .3; cursor: default; background: var(--ink); }
.transport input:disabled { opacity: .35; }
/* what the preview is waiting on (the film rebuilt after a change, the map still loading), over its corner */
.busy { position: absolute; left: 12px; bottom: 12px; display: inline-flex; align-items: center; gap: 7px; padding: 4px 9px; border-radius: 6px; background: var(--glass); font: 11.5px var(--mono); color: var(--ink2); box-shadow: 0 0 0 1px var(--line); pointer-events: none; }
.busy[hidden] { display: none; }
.busy::before { content: ""; width: 6px; height: 6px; background: var(--ink2); animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }
.transport input { flex: 1; min-width: 0; }
.time { font: 12px var(--mono); color: var(--ink2); white-space: nowrap; }

/* the map's stop dots: square, numbered, in the route's colour (one on a recorded track stays where it is) */
.gpin.locked { cursor: default; }
.gpin { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 4px; border: 2px solid #fff; background: var(--route, #00a9df); color: #fff; font: 500 11px var(--mono); box-shadow: 0 6px 14px -4px rgba(0, 0, 0, .45); cursor: grab; transition: transform .2s var(--settle); }
.gpin:hover { transform: scale(1.12); }

/* ---- export */
dialog { width: min(420px, calc(100vw - 32px)); padding: 24px; border: 0; border-radius: 16px; background: var(--card); color: var(--ink); box-shadow: 0 0 0 1px var(--line), 0 40px 80px -30px rgba(18, 58, 64, .5); }
dialog[open] { animation: rise .35s var(--settle); }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.98); } }
dialog::backdrop { background: rgba(25, 25, 23, .32); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
dialog h2 { margin: 6px 0 14px; font-size: 24px; font-weight: 500; letter-spacing: -.025em; }
.note { min-height: 1em; margin: 10px 0; color: var(--grey); font-size: 12.5px; }
.note.err { color: var(--danger); }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.actions [hidden] { display: none; }

/* while it renders: a small pixel globe (export-globe.js), the numbers under it */
#run .art { position: relative; height: 196px; margin: -4px -4px 18px; border-radius: 12px; overflow: hidden; background: var(--paper2); box-shadow: inset 0 0 0 1px var(--line); }
#run .art canvas { width: 100%; height: 100%; image-rendering: pixelated; }
.art-tag { position: absolute; left: 10px; top: 10px; padding: 3px 7px; border-radius: 5px; background: var(--glass); font: 11px var(--mono); color: var(--ink2); box-shadow: 0 0 0 1px var(--line); }
.run-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.run-h h2 { margin: 0 0 12px; font-size: 20px; }
.pct { margin: 0; font-size: 14px; color: var(--grey); }
.pct b { font-size: 28px; font-weight: 500; letter-spacing: -.03em; color: var(--ink); font-variant-numeric: tabular-nums; }
/* the bar fills in square cells, like the page's pixels */
#run .bar { height: 10px; background: var(--paper2); border-radius: 2px; overflow: hidden; }
#run .bar i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--sea) 0 7px, transparent 7px 9px); transition: width .3s; }
.v-line { margin: 8px 0 0; min-height: 1.5em; font: 11.5px/1.5 var(--mono); color: var(--grey); overflow-wrap: anywhere; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 0 0; padding: 12px 0 0; border-top: 1px dashed var(--line2); }
.facts dt { font-size: 11.5px; color: var(--grey); }
.facts dd { margin: 2px 0 0; font: 13px var(--mono); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#run .actions { margin-top: 4px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; padding: 10px 16px; border-radius: 10px; background: var(--ink); color: var(--paper); font-size: 13.5px; max-width: calc(100vw - 32px); animation: rise .3s var(--settle); }
.toast[hidden] { display: none; }

@media (max-width: 760px) {
  .app { grid-template: "head" auto "stage" 58vh "side" auto / minmax(0, 1fr); height: auto; }
  .head { flex-wrap: wrap; padding: 10px 16px; gap: 8px; }
  .slash { display: none; }
  /* two rows: the name and Export, then the title and the shape */
  .head::after { content: ""; order: 1; flex-basis: 100%; height: 0; }
  .head .go { order: 1; }
  .title { order: 2; flex: 1 1 0; margin-left: -6px; }
  #shape { order: 2; }
  .side { border-right: 0; }
  .hint-inline { display: none; }
}

/* ---- light or dark: an icon button in the bar */
.icon-btn { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; color: var(--ink2); transition: background .2s, color .2s; }
.icon-btn:hover { background: var(--paper2); color: var(--ink); }
.icon-btn .px { width: 14px; height: 14px; }
button.brand { padding: 4px 6px; margin-left: -6px; border-radius: 8px; transition: background .2s; }
button.brand:hover { background: var(--paper2); }

/* a country's flag in the place search */
.place-results .flag-emoji { font-style: normal; margin-right: 7px; font-size: 15px; line-height: 1; }

/* ---- the home screen: over the editor, on the same chart as the stage */
.home { position: fixed; inset: 0; z-index: 30; overflow-y: auto; background: var(--paper); }
.home[hidden] { display: none; }
body.at-home { overflow: hidden; }
.home .chart { position: fixed; inset: 0; width: 100%; height: 100%; border-radius: 0; opacity: .9; }
.home-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; height: 60px; padding: 0 max(16px, calc(50vw - 588px)); background: color-mix(in srgb, var(--paper) 72%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.home-head .grow { flex: 1; }
.home-body { position: relative; max-width: 1208px; margin: 0 auto; padding: 0 16px 96px; }
.home-hero { padding: clamp(40px, 9vh, 104px) 0 clamp(36px, 7vh, 72px); max-width: 940px; animation: home-rise .7s var(--settle) both; }
.home-hero h1 { margin: 12px 0 0; font-size: clamp(40px, 6.2vw, 74px); font-weight: 500; line-height: 1.02; letter-spacing: -.035em; }
.home-hero .lede { margin: 18px 0 0; max-width: 500px; color: var(--ink2); font-size: 16px; line-height: 1.55; }
.home-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.go.big, .ghost.big { height: 44px; padding: 0 18px; border-radius: 10px; font-size: 14.5px; }
.ghost.big { background: var(--card); }
.home-sec-h { display: flex; align-items: baseline; gap: 10px; padding-bottom: 14px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.home-sec-h .count { font: 11.5px var(--mono); color: var(--grey); }
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 16px; }

/* a library card: its route on a pixel globe, its name, its stops, when it was last changed */
.lib-card { position: relative; display: flex; flex-direction: column; border-radius: 14px; background: var(--card); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(0, 0, 0, .04); overflow: hidden; cursor: pointer;
  animation: home-rise .6s var(--settle) both; animation-delay: calc(min(var(--i, 0), 12) * 40ms);
  transition: transform .35s var(--settle), box-shadow .35s var(--settle); }
.lib-card:hover { transform: translateY(-3px); box-shadow: 0 0 0 1px var(--line2), 0 16px 34px -16px rgba(0, 0, 0, .3); }
.lib-card:active { transform: translateY(-1px) scale(.99); }
.lib-card.gone { opacity: 0; transform: scale(.96); transition: opacity .22s, transform .22s; }
.lib-card .pic { position: relative; aspect-ratio: 16 / 10; background: var(--paper2); border-bottom: 1px solid var(--line); }
.lib-card .pic canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; image-rendering: pixelated; transition: transform .6s var(--settle); }
.lib-card:hover .pic canvas { transform: scale(1.04); }
.lib-card .tx { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 14px; min-width: 0; }
.lib-card .tx b { font-weight: 500; font-size: 15.5px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-card .meta { display: flex; gap: 8px; font: 11.5px var(--mono); color: var(--grey); min-width: 0; }
.lib-card .meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-card .meta i { font-style: normal; margin-left: auto; white-space: nowrap; }
.lib-card .del { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--glass); color: var(--ink2); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: 0 0 0 1px var(--line); opacity: 0; transform: translateY(-3px); transition: opacity .2s, transform .3s var(--settle), color .2s; }
.lib-card .del .px { width: 10px; height: 10px; }
.lib-card:hover .del, .lib-card:focus-within .del { opacity: 1; transform: none; }
.lib-card .del:hover { color: var(--danger); }
.lib-card .ask { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 14px; background: color-mix(in srgb, var(--card) 86%, transparent); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); font-size: 13.5px; text-align: center; animation: home-fade .2s both; }
.lib-card .ask[hidden] { display: none; }
.lib-card .ask div { display: flex; gap: 8px; }
.lib-card .ask button { height: 32px; padding: 0 13px; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line2); font-size: 13px; }
.lib-card .ask .yes { background: var(--danger); color: #fff; box-shadow: none; }
.home-empty { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; padding: 28px 24px; border-radius: 14px; border: 1px dashed var(--line2); background: color-mix(in srgb, var(--card) 70%, transparent); color: var(--ink2); }
.home-empty b { font-weight: 500; font-size: 18px; color: var(--ink); }
.home-empty span { max-width: 500px; }

@keyframes home-rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes home-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .home-hero, .lib-card { animation: none; }
  .lib-card, .lib-card .pic canvas { transition: none; }
}
@media (max-width: 560px) {
  .home-grid { grid-template-columns: 1fr; }
}

/* ---- templates: the one in use, named in the bar and on each library card */
.tpl-tag { flex: none; padding: 3px 8px; border-radius: 6px; background: var(--paper2); color: var(--ink2); font: 11.5px var(--mono); box-shadow: inset 0 0 0 1px var(--line); }
.tpl-tag:empty { display: none; }
.lib-card .tpl-tag.on-pic { position: absolute; top: 8px; left: 8px; background: var(--glass); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
/* the Region template's cameras, a small switch in the Look */
.seg.small button { height: 26px; padding: 0 9px; font-size: 12.5px; }
.seg[hidden], .row select[hidden] { display: none; }
/* what only the Orbit template uses: each leg's transport, each stop's marker and photos */
body.tpl-region .leg .seg, body.tpl-region .stop-more select, body.tpl-region .photos { display: none; }


/* the template chooser */
dialog.tpl-dlg { width: min(760px, calc(100vw - 32px)); }
.tpl-dlg h2 { margin: 6px 0 18px; font-weight: 500; font-size: 26px; letter-spacing: -.02em; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.tpl-card { display: flex; flex-direction: column; border-radius: 14px; background: var(--paper); box-shadow: 0 0 0 1px var(--line); overflow: hidden; animation: home-rise .5s var(--settle) both; }
.tpl-card + .tpl-card { animation-delay: 60ms; }
.tpl-card .pic { position: relative; aspect-ratio: 16 / 9; background: var(--paper2); border-bottom: 1px solid var(--line); }
.tpl-card .pic canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.tpl-card .tx { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 16px; flex: 1; }
.tpl-card .tx b { font-weight: 500; font-size: 18px; letter-spacing: -.01em; }
.tpl-card .tx p { margin: 0; color: var(--ink2); font-size: 13.5px; line-height: 1.5; flex: 1; }
.tpl-btns { display: flex; gap: 8px; margin-top: 10px; }
.tpl-btns .go, .tpl-btns .ghost { height: 34px; }

/* ---- GPX: the button under the search, a leg that follows a track, the panel taking a dropped file */
.gpx-row { display: flex; align-items: center; gap: 10px; margin: 10px 0 2px; }
.gpx-row .ghost { display: inline-flex; align-items: center; gap: 7px; height: 30px; flex: none; }
.gpx-row .ghost .px { width: 11px; height: 11px; }
.gpx-row .hint-inline { font-size: 12px; color: var(--grey); line-height: 1.35; }
.gpx-tag { display: inline-flex; align-items: center; gap: 4px; height: 26px; white-space: nowrap; padding: 2px 4px 2px 7px; border-radius: 5px; font: 500 10.5px var(--mono); letter-spacing: .04em; color: var(--sea); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--sea) 45%, transparent); }
.gpx-tag button { display: grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; color: var(--grey); }
.gpx-tag button:hover { color: var(--danger); background: var(--paper2); }
.gpx-tag .px { width: 7px; height: 7px; }

.side.dropping { box-shadow: inset 0 0 0 2px var(--sea); background: color-mix(in srgb, var(--sea) 7%, var(--paper)); }


/* a leg's Real route switch: off, finding, on (and which router found it), or none found */
/* a leg's way: its length, and the switch to the real roads (the road mark lit when on) */
.route-btn { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border-radius: 7px; font: 500 11px var(--mono); color: var(--grey); box-shadow: inset 0 0 0 1px var(--line); white-space: nowrap; transition: background .2s, color .2s, box-shadow .2s; }
.route-btn .px { width: 9px; height: 6.5px; opacity: .55; }
.route-btn.on .px { opacity: 1; }
.route-btn.flight { box-shadow: none; padding-left: 2px; }
.route-btn.flight .px { display: none; }
.route-btn:hover { background: var(--paper2); color: var(--ink); }
.route-btn.on { color: var(--sea); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--sea) 50%, transparent); background: color-mix(in srgb, var(--sea) 8%, transparent); }
.route-btn.failed { color: var(--danger); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger) 45%, transparent); background: transparent; }
.route-btn:disabled { opacity: .4; cursor: default; }
.row[hidden] { display: none; }
/* the Story template: its own block, and each leg's and stop's choices as chips that open the picker */
.story-only { display: none; }
body.tpl-story .story-only { display: block; }
body.tpl-story .row.not-story { display: none; }
.story-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 6px; }
.story-choice { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border-radius: 10px; text-align: left;
  background: var(--card); box-shadow: 0 0 0 1px var(--line); transition: box-shadow .2s, transform .15s; }
.story-choice:hover { box-shadow: 0 0 0 1px var(--route, var(--sea)); transform: translateY(-1px); }
.story-choice span { font-size: 11.5px; color: var(--grey); }
.story-choice b { font-weight: 500; font-size: 13.5px; color: var(--ink); }
.leg-more { display: flex; gap: 6px; width: 100%; }
.leg-more .chip { flex: 0 1 auto; min-width: 0; }
.chip.follows b { font-weight: 400; color: var(--grey); }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--line2); font-size: 12.5px;
  background: var(--card); color: var(--ink); max-width: 100%; transition: border-color .2s; }
.chip:hover { border-color: var(--route, var(--sea)); }
.chip .px { flex: none; width: 10px; height: 10px; color: var(--grey); }
.chip b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the picker: over the side panel; the preview beside it shows what is pointed at */
.picker { position: fixed; top: 60px; left: 0; bottom: 0; width: 340px; z-index: 20; display: flex; flex-direction: column; background: var(--paper);
  border-right: 1px solid var(--line); box-shadow: 18px 0 40px -24px rgba(0, 0, 0, .35); animation: picker-in .22s var(--settle, ease-out) both; }
@keyframes picker-in { from { transform: translateX(-16px); opacity: 0; } }
.picker-h { padding: 18px 20px 10px; }
.picker-h h2 { margin: 4px 0 0; font-size: 20px; font-weight: 500; letter-spacing: -.01em; }
/* the choices: a grid of names (what each is shows in the preview's caption as it is pointed at); the one
   chosen ringed in the route's colour and ticked, the one showing lifted */
.picker-list { flex: 1; overflow-y: auto; padding: 6px 12px 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: max-content; gap: 6px; align-content: start; }
.pick { position: relative; display: flex; align-items: center; min-height: 44px; padding: 10px 26px 10px 12px; border-radius: 10px; text-align: left; background: var(--card);
  box-shadow: 0 0 0 1px var(--line); transition: box-shadow .15s, background .15s; }
.pick b { font-weight: 500; font-size: 13.5px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pick:hover, .pick:focus-visible { box-shadow: 0 0 0 1px var(--grey2); outline: none; }
.pick.showing { background: var(--paper2); }
.pick.on { box-shadow: 0 0 0 2px var(--route, var(--sea)); }
.pick.on::after { content: ""; position: absolute; right: 10px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--route, var(--sea)); }
/* a choice with its picture (a vehicle, an effect): the picture over its name */
.pick.has-pic { flex-direction: column; align-items: stretch; gap: 4px; padding: 6px 8px 9px; }
.pick.has-pic > * { flex: none; }
.pick.has-pic img { display: block; width: 100%; height: 84px; object-fit: contain; }
.pick.has-pic b { padding: 0 4px; font-size: 12.5px; -webkit-line-clamp: 1; }
/* a map style's picture is the map itself: it fills its frame */
.pick-style.has-pic img { object-fit: cover; border-radius: 6px; }
.pick.has-pic.on::after { top: 12px; margin-top: 0; }
.picker-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
/* the choice showing: a lower third in the slanted place label's shape (Travel Animator's), in this page's
   own colours: a stripe of the route's colour, then the card, both leaning as one, the name on it */
.showcase-cap { --lean: 13px; position: absolute; left: 18px; bottom: 18px; display: flex; height: 40px; max-width: calc(100% - 36px);
  pointer-events: none; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .32)); animation: cap-in .32s var(--settle, ease-out) both; }
.showcase-cap::before { content: ""; flex: none; width: 24px; background: var(--route, var(--sea));
  clip-path: polygon(var(--lean) 0, 100% 0, calc(100% - var(--lean)) 100%, 0 100%); }
.cap-body { display: flex; align-items: center; gap: 10px; min-width: 0; margin-left: calc(4px - var(--lean)); padding: 0 calc(var(--lean) + 16px) 0 calc(var(--lean) + 12px);
  background: var(--card); clip-path: polygon(var(--lean) 0, 100% 0, calc(100% - var(--lean)) 100%, 0 100%); white-space: nowrap; }
@keyframes cap-in { from { opacity: 0; transform: translateX(-10px); } }
.picker[hidden], .showcase-cap[hidden] { display: none; }
/* a showcase plays on its own: no timeline under it; dragging it turns the view */
body.picking .transport { visibility: hidden; }
body.picking #canvas { cursor: grab; touch-action: none; }
.showcase-cap b { font-weight: 700; font-style: italic; font-size: 14.5px; letter-spacing: -.01em; color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.showcase-cap .cap-note { font-size: 12px; color: var(--ink2); overflow: hidden; text-overflow: ellipsis; }
.showcase-cap .cap-note:empty { display: none; }
@media (max-width: 900px) { .picker { top: auto; left: 0; right: 0; width: auto; height: 46vh; border-right: 0; border-top: 1px solid var(--line); }
  .picker-list { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); } }
.leg-more select, .stop-more select { height: 28px; padding: 0 24px 0 9px; border-radius: 7px; border: 1px solid var(--line2); font-size: 12.5px;
  -webkit-appearance: none; appearance: none; cursor: pointer; background: var(--card); color: var(--ink); max-width: 100%; }
