/* LEONIDA — the highway sign system.
   An asphalt-dark ground, read at night from the couch. Colour is borrowed from road signs and each one
   has a job: green panels are places, blue panels are shops and brands, brown panels are landmarks,
   white plates are vehicles, yellow diamonds are things to watch for. Fluorescent yellow-green belongs
   to the player: what he logged, what he selected, what he is about to save. */

@font-face {
  font-family: "Overpass";
  src: url("../fonts/overpass-latin.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
  /* Everything in Latin-1 except the middle dot, whose spacing in this face sits badly as a separator. */
  unicode-range: U+0000-00B6, U+00B8-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}

:root {
  color-scheme: dark;
  --asphalt: #15181a;
  --asphalt-2: #1f2427;
  --asphalt-3: #2b3237;
  --line: #3b4449;
  --paint: #f3f4ee;
  --muted: #a9b2b6;
  --green: #00694f;
  --blue: #0a4c9a;
  --brown: #6b4423;
  --yellow: #f7c51e;
  --white: #f3f4ee;
  --black: #111416;
  --mark: #c9e31b;
  --scrim: rgb(0 0 0 / 0.62);
  --lift: rgb(0 0 0 / 0.55);

  /* The car plate and its drawing. */
  --plate: #f3f4ee;
  --plate-ink: #15181a;
  --plate-muted: #8a9296;
  --plate-glass: #7ea7cc;
  --plate-mark: #f7c51e;

  /* Names the drawings still read. */
  --paper: var(--asphalt);
  --ink: var(--paint);
  --wash: var(--asphalt-2);
  --rule: var(--line);
  --accent: var(--mark);

  --sign-face: "Overpass", "Highway Gothic", "Interstate", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sans: "Overpass", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --margin: 18px;
  --tabbar: 58px;
}

/* ------------------------------------------------------------------ base */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior-y: none;
  scrollbar-color: var(--line) transparent;
  background: var(--asphalt);
}

body {
  margin: 0;
  background: var(--asphalt);
  color: var(--paint);
  font: 1.0625rem/1.45 var(--sans);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--mark);
}

::selection { background: var(--mark); color: var(--black); }
:focus-visible { outline: 2px solid var(--mark); outline-offset: 3px; border-radius: 4px; }
#page:focus { outline: none; }

h1, h2, h3, p, figure { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }

button, a, summary, label, [role="button"] {
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-align: inherit; }
input, textarea, select { font: inherit; font-size: max(16px, 1rem); color: inherit; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); }
.footnote { font-size: 0.8125rem; line-height: 1.4; color: var(--muted); }
.callout { font-size: 1rem; }
.measure { max-width: 36rem; }
.stack { display: flex; flex-direction: column; }
.gap-s { gap: 8px; } .gap-m { gap: 14px; } .gap-l { gap: 24px; }
.numerals { font-variant-numeric: tabular-nums; }

/* A thing to watch for sits beside a warning diamond. */
.lead { position: relative; padding-left: 34px; font-size: 1.0625rem; font-weight: 700; line-height: 1.35; }
.lead::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 0.22em;
  width: 15px;
  height: 15px;
  border-radius: 2.5px;
  background: var(--yellow);
  box-shadow: inset 0 0 0 1.5px var(--black), 0 0 0 1.5px var(--yellow);
  transform: rotate(45deg);
}

/* ------------------------------------------------------------------ shell */

#app { min-height: 100dvh; }

#page {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1120px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 12px)
           calc(env(safe-area-inset-right, 0px) + var(--margin))
           calc(env(safe-area-inset-bottom, 0px) + var(--tabbar) + 40px)
           calc(env(safe-area-inset-left, 0px) + var(--margin));
}

.tabbar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 0 max(8px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(8px, env(safe-area-inset-left, 0px));
  background: color-mix(in srgb, var(--asphalt) 90%, transparent);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: var(--tabbar);
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: color 160ms ease, transform 120ms var(--ease-out);
}
.tab:active { transform: scale(0.94); }
.tab[aria-current="page"] { color: var(--paint); }
/* The selected section sits under a lane dash. */
.tab::before {
  content: "";
  position: absolute;
  top: -1px;
  width: 28px;
  height: 3px;
  background: var(--mark);
  transform: scaleX(0);
  transition: transform 220ms var(--ease-out);
}
.tab[aria-current="page"]::before { transform: scaleX(1); }

@media (min-width: 720px) {
  :root { --margin: 32px; }
  .tabbar { grid-template-columns: repeat(4, 132px); justify-content: center; }
}

/* ------------------------------------------------------------------ type */

.masthead { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.masthead-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.wordmark { font-family: var(--sign-face); font-size: 1.5rem; font-weight: 800; letter-spacing: 0.1em; line-height: 1; padding-top: 3px; }
/* The logged count rides in a route shield. */
.masthead-count {
  padding: 6px 9px 4px;
  border-radius: 5px 5px 11px 11px;
  background: var(--white);
  color: var(--black);
  font-size: 0.8125rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}
.masthead-actions { display: flex; gap: 2px; margin-right: -10px; }

.page-title, .folio-heading h1 {
  font-family: var(--sign-face);
  font-size: clamp(1.875rem, 8.2vw, 2.5rem);
  font-weight: 800;
  letter-spacing: 0.005em;
  line-height: 1.08;
}
.folio-heading .subtitle { margin-top: 6px; font-size: 0.9375rem; color: var(--muted); }
.folio-section { font-family: var(--sign-face); font-size: 1.25rem; font-weight: 800; letter-spacing: 0.01em; line-height: 1.2; }
.rule { border: 0; height: 1px; margin: 0; background: var(--line); }
.name-cue { background: none; color: inherit; padding: 0 0.16em; margin: 0 0.04em; border-radius: 0.25em; box-shadow: 0 0 0 2px var(--yellow); -webkit-box-decoration-break: clone; box-decoration-break: clone; }

/* ------------------------------------------------------------------ sign panels */

.sign {
  position: relative;
  padding: 20px 20px 18px;
  border-radius: 12px;
  background: var(--sign, var(--green));
  color: var(--sign-ink, var(--white));
}
/* Every sign carries its border line a little inside the edge. */
.sign::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 2px solid var(--sign-ink, var(--white));
  border-radius: 9px;
  pointer-events: none;
}
.sign-green { --sign: var(--green); --sign-ink: var(--white); }
.sign-blue { --sign: var(--blue); --sign-ink: var(--white); }
.sign-brown { --sign: var(--brown); --sign-ink: var(--white); }
.sign-white { --sign: var(--white); --sign-ink: var(--black); }
.sign-yellow { --sign: var(--yellow); --sign-ink: var(--black); }
.sign .subtitle, .sign .footnote, .sign .row-detail { color: color-mix(in srgb, var(--sign-ink) 82%, var(--sign)); }
.sign .folio-heading .subtitle { font-weight: 600; }
/* The tab above a guide sign names what kind of thing it is. */
.sign-tab {
  position: absolute;
  top: -15px;
  right: 16px;
  padding: 5px 11px 3px;
  border-radius: 6px 6px 0 0;
  background: var(--sign, var(--green));
  box-shadow: inset 0 2px 0 var(--sign-ink), inset 2px 0 0 var(--sign-ink), inset -2px 0 0 var(--sign-ink);
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.2;
}
.sign.has-tab { margin-top: 15px; }

/* A plain panel for the player's own totals. Sign colours are kept for guide entries. */
.panel { padding: 18px; border-radius: 10px; background: var(--asphalt-2); box-shadow: inset 0 0 0 1px var(--line); }

/* Totals set like a distance sign: a name on the left, a number on the right. */
.mileage { display: flex; flex-direction: column; gap: 9px; }
.mileage-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 1.125rem; font-weight: 700; line-height: 1.2; }
.mileage-row span:last-child { font-weight: 800; }

/* ------------------------------------------------------------------ controls */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 120ms var(--ease-out), opacity 120ms ease, background-color 160ms ease;
}
.btn .icon { flex: none; }
.btn:disabled { opacity: 0.38; cursor: default; }
.btn-primary {
  justify-content: center;
  min-height: 48px;
  padding: 12px 20px 10px;
  border-radius: 8px;
  background: var(--mark);
  color: var(--black);
  font-size: 1.0625rem;
  font-weight: 800;
}
.btn-primary:active:not(:disabled) { transform: scale(0.97); opacity: 0.86; }
.btn-quiet { font-size: 0.9375rem; color: var(--paint); }
.btn-quiet:active:not(:disabled) { opacity: 0.55; }
.btn-quiet[aria-pressed="true"] { color: var(--mark); }
.sign .btn-quiet { color: inherit; }

.icon-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: var(--paint); transition: transform 120ms var(--ease-out), opacity 120ms ease; }
.icon-btn:active { transform: scale(0.9); opacity: 0.6; }
.icon-btn:disabled { opacity: 0.3; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; }

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--mark) 88%, white); }
  .btn-quiet:hover:not(:disabled), .row:hover .row-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
  .icon-btn:hover { background: var(--asphalt-2); }
  .tab:hover { color: var(--paint); }
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 4px 0 14px;
  border-radius: 8px;
  background: var(--asphalt-2);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--muted);
  transition: box-shadow 160ms ease, color 160ms ease;
}
.search:focus-within { box-shadow: inset 0 0 0 2px var(--paint); color: var(--paint); }
.search input { flex: 1; min-width: 0; height: 52px; padding: 2px 0 0; border: 0; background: none; color: var(--paint); outline: none; }
.search input::placeholder { color: var(--muted); opacity: 1; }
.search input::-webkit-search-cancel-button { display: none; }
.search .icon-btn { color: var(--muted); }

.row { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; padding: 9px 0; transition: opacity 120ms ease, transform 120ms var(--ease-out); }
.row:active { opacity: 0.6; transform: scale(0.99); }
.row-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.row-title { font-family: var(--sign-face); font-size: 1.125rem; font-weight: 700; line-height: 1.22; }
.row-detail { font-size: 0.8125rem; color: var(--muted); }
.row > .icon { flex: none; color: var(--muted); }
.rows > * + * { border-top: 1px solid var(--line); }
/* The small colour chip that says which kind of sign a row is. */
.kind-chip { flex: none; width: 10px; height: 34px; border-radius: 3px; background: var(--sign, var(--line)); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--sign-ink, var(--white)) 70%, transparent); }
.row > .car { flex: none; width: 84px; padding: 3px 5px; border-radius: 5px; background: var(--plate); }

.disclosure summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; font-size: 0.9375rem; font-weight: 700; cursor: pointer; list-style: none; }
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary .icon { color: var(--muted); transition: transform 200ms var(--ease-out); }
.disclosure[open] summary .icon { transform: rotate(180deg); }
.disclosure-body { padding: 4px 0 14px; font-size: 1rem; color: var(--muted); }
.disclosure + .disclosure { border-top: 1px solid var(--line); }
.source { padding: 12px 0; display: flex; flex-direction: column; gap: 5px; color: var(--paint); }
.source + .source { border-top: 1px solid var(--line); }
.source-title { font-size: 0.9375rem; font-weight: 700; }

/* ------------------------------------------------------------------ plates, decals, tallies */

/* A vehicle sits on a white plate, like a registration plate with its drawing pressed in. */
.plate {
  position: relative;
  padding: 34px 16px 12px;
  border-radius: 10px;
  background: var(--plate);
  box-shadow: inset 0 0 0 3px var(--plate), inset 0 0 0 4.5px #b3b9b5;
}
.plate::before {
  content: "LEONIDA";
  position: absolute;
  top: 11px;
  left: 0;
  right: 0;
  text-align: center;
  color: var(--plate-muted);
  font-family: var(--sign-face);
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.34em;
  line-height: 1;
}
.plate-compact { padding: 26px 8px 8px; border-radius: 8px; }
.plate-compact::before { top: 9px; font-size: 0.5625rem; }
.car { width: 100%; height: auto; }
.car-body { fill: var(--plate-ink); stroke: var(--plate-ink); }
.car-ghost { opacity: 0.2; }
.plate > .stamp { position: absolute; top: 7px; right: 8px; }
.plate-compact > .stamp { top: 5px; right: 5px; }

/* The decal a save leaves behind: a registration sticker in the player's colour. */
.stamp {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 5px 9px 3px;
  border-radius: 4px;
  background: var(--mark);
  color: var(--black);
  box-shadow: inset 0 0 0 1.5px var(--black);
  font-family: var(--sign-face);
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}
.stamp-word { font-size: 0.8125rem; letter-spacing: 0.08em; text-transform: uppercase; }
.stamp-detail { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.02em; }
.stamp-small { padding: 4px 7px 2px; }
.stamp-small .stamp-word { font-size: 0.6875rem; }
.stamp-large { padding: 9px 16px 6px; border-radius: 6px; box-shadow: inset 0 0 0 2.5px var(--black); }
.stamp-large .stamp-word { font-size: 1.625rem; letter-spacing: 0.1em; }
.stamp-large .stamp-detail { font-size: 0.8125rem; }
.stamp-row { display: flex; flex-wrap: wrap; gap: 8px 10px; padding: 4px 0; }

.tally { display: flex; flex-direction: column; gap: 8px; }
.tally-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 0.9375rem; }
.tally-label { font-weight: 700; }
.tally-count { color: var(--muted); font-weight: 700; }
.tally-ticks { display: flex; gap: 3px; }
.tally-ticks i { flex: 1; height: 6px; border-radius: 1px; background: var(--asphalt-3); transition: background-color 300ms ease; }
.tally-ticks i.on { background: var(--mark); }
.tally-bar { height: 6px; border-radius: 1px; background: var(--asphalt-3); overflow: hidden; }
.tally-bar i { display: block; height: 100%; background: var(--mark); transform-origin: left; transition: transform 400ms var(--ease-out); }
.sign .tally-count { color: inherit; }
.sign .tally-ticks i, .sign .tally-bar { background: color-mix(in srgb, var(--sign-ink) 22%, transparent); }

.activity { display: inline-flex; align-items: center; gap: 6px; font-size: 0.9375rem; color: var(--muted); }

.reference { display: flex; flex-direction: column; gap: 8px; }
.reference-frame { position: relative; border-radius: 8px; overflow: hidden; background: var(--asphalt-2); }
.reference-frame img { width: 100%; height: auto; }
.reference figcaption { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 0.75rem; color: var(--muted); }
.reference figcaption a { color: var(--paint); padding: 6px 0; margin: -6px 0; }
.photo-mark {
  position: absolute;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  border: 3px solid var(--yellow);
  box-shadow: 0 0 0 2px var(--black), inset 0 0 0 2px var(--black);
  pointer-events: none;
  animation: mark-in 320ms var(--ease-out) both;
}
.cue-ring { transform-box: fill-box; transform-origin: center; animation: mark-in 320ms var(--ease-out) both; }
@keyframes mark-in { from { opacity: 0; transform: scale(1.7); } }

/* ------------------------------------------------------------------ motion */

/* An answer comes down like an overhead sign, then the rest of the page follows in reading order. */
.arrive > * { animation: arrive 420ms var(--ease-out) both; }
.arrive > :first-child { animation-name: drop; }
.arrive > :nth-child(2) { animation-delay: 60ms; }
.arrive > :nth-child(3) { animation-delay: 110ms; }
.arrive > :nth-child(n + 4) { animation-delay: 160ms; }
@keyframes arrive { from { opacity: 0; transform: translateY(10px); } }
@keyframes drop { from { opacity: 0; transform: translateY(-14px); } }
.swap { animation: swap 200ms var(--ease-out) both; }
@keyframes swap { from { opacity: 0; } }
/* The decal goes on large, presses flat, and stays. */
.landing { animation: strike 340ms var(--ease-out) both; }
@keyframes strike {
  0% { opacity: 0; transform: scale(2); }
  45% { opacity: 1; transform: scale(0.95); }
  100% { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .arrive > *, .landing, .photo-mark, .cue-ring { animation: swap 160ms ease both; animation-delay: 0ms; }
  .road { animation: none; }
  .tab, .tab::before, .btn, .row, .icon-btn, .chip, .segmented button, .lot-card, .album-card, .browse-card, .pin, .pin-dot, .map-layer, .tally-bar i, .switch input::after { transition: none; }
}

/* ------------------------------------------------------------------ lookup */

.lookup-start { display: flex; flex-direction: column; gap: 26px; }
.feature { display: flex; flex-direction: column; gap: 14px; max-width: 34rem; }
.feature-plate { display: block; width: 100%; border-radius: 10px; transition: transform 140ms var(--ease-out); }
.feature-plate:active { transform: scale(0.985); }
.feature-name { display: flex; align-items: center; gap: 16px; }
.feature-name .row-title { font-size: 1.375rem; font-weight: 800; }

/* Four signs to browse the guide by. */
.browse { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.browse-card { display: flex; flex-direction: column; justify-content: space-between; gap: 18px; min-height: 104px; padding: 16px 16px 14px; text-align: left; transition: transform 140ms var(--ease-out), opacity 120ms ease; }
.browse-card:active { transform: scale(0.97); opacity: 0.85; }
.browse-name { font-family: var(--sign-face); font-size: 1.1875rem; font-weight: 800; line-height: 1.15; }
.browse-count { font-size: 0.8125rem; font-weight: 700; }
@media (min-width: 720px) { .browse { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.lot { display: flex; flex-direction: column; gap: 14px; }
.lot-strip { display: flex; gap: 10px; margin: 0 calc(var(--margin) * -1); padding: 2px var(--margin) 6px; overflow-x: auto; scroll-snap-type: x proximity; scroll-padding-left: var(--margin); scrollbar-width: none; }
.lot-strip::-webkit-scrollbar { display: none; }
.lot-card { flex: none; width: 148px; display: flex; flex-direction: column; gap: 7px; scroll-snap-align: start; transition: transform 140ms var(--ease-out), opacity 120ms ease; }
.lot-card:active { transform: scale(0.97); opacity: 0.8; }
.lot-card span { font-size: 0.8125rem; font-weight: 700; line-height: 1.25; }

.listing { display: flex; flex-direction: column; gap: 26px; }
.listing-group { display: flex; flex-direction: column; }
.listing-group > h2 { padding-bottom: 6px; border-bottom: 2px solid var(--paint); }
.filter-row { display: flex; gap: 8px; margin: 0 calc(var(--margin) * -1); padding: 2px var(--margin); overflow-x: auto; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }

.result { display: flex; flex-direction: column; gap: 22px; }
.answer { display: flex; flex-direction: column; gap: 14px; max-width: 36rem; }
.answer .body { color: var(--muted); }
.cue-detail { font-size: 1rem; animation: swap 240ms var(--ease-out) both; }
.plates { display: flex; flex-direction: column; gap: 16px; }
.plate-figure { display: flex; flex-direction: column; gap: 8px; }
.plate-figure figcaption, .caption { font-size: 0.75rem; color: var(--muted); }
.reading { display: flex; flex-direction: column; max-width: 36rem; }
.capture-photo { position: relative; border-radius: 8px; overflow: hidden; }
.capture-photo img { width: 100%; }
.capture-photo.marking { cursor: crosshair; }

@media (min-width: 760px) {
  .result { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px 40px; align-items: start; }
  .result > .reading { grid-column: 1; }
  .result > .plates { grid-column: 2; grid-row: 1 / span 2; position: sticky; top: 24px; }
}

/* ------------------------------------------------------------------ atlas */

.atlas { display: flex; flex-direction: column; gap: 20px; }
.atlas-spread { display: flex; flex-direction: column; gap: 22px; }
.atlas-standing { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.map {
  /* A night road map: dark land, darker water, white roads. */
  --water: #0e2430;
  --water-ink: #6fb1c8;
  --wash: #222c29;
  --paper: #15181a;
  --ink: #f3f4ee;
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: var(--water);
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}
.map.zoomed { touch-action: none; cursor: grab; }
.map-layer { position: absolute; inset: 0; transform-origin: 50% 50%; transition: transform 380ms var(--ease-out); will-change: transform; }
.map.dragging .map-layer { transition: none; }
.map-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.map::after { content: ""; position: absolute; inset: 0; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--line); pointer-events: none; }
.map-label { font-family: var(--sign-face); font-size: 30px; font-weight: 600; letter-spacing: 0.06em; fill: var(--water-ink); }
.road { fill: none; stroke: var(--ink); stroke-opacity: 0.22; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; animation: ink 1100ms var(--ease-out) both; }
.road-major { stroke-opacity: 0.9; stroke-width: 3.4; }
.road-case { fill: none; stroke: var(--paper); stroke-width: 11; stroke-linecap: round; stroke-linejoin: round; }
.road-walk { stroke-opacity: 0.7; stroke-width: 3; }
.still .road { animation: none; }
@keyframes ink { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

.pin { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 44px; min-height: 44px; justify-content: center; transform: translate(-50%, -50%) scale(calc(1 / var(--zoom, 1))); transition: transform 380ms var(--ease-out); }
.map.dragging .pin { transition: none; }
.pin-dot { position: relative; width: 22px; height: 22px; display: grid; place-items: center; transition: transform 260ms var(--ease-out); }
.pin-dot::before { content: ""; width: 11px; height: 11px; border-radius: 50%; background: var(--asphalt); box-shadow: 0 0 0 2px var(--paint); }
.pin.visited .pin-dot::before { background: var(--mark); box-shadow: 0 0 0 2px var(--black), 0 0 0 4px var(--mark); }
.pin[aria-pressed="true"] .pin-dot { transform: scale(1.3); }
.pin[aria-pressed="true"] .pin-dot::before { background: var(--paint); box-shadow: 0 0 0 2px var(--black), 0 0 0 4px var(--paint); }
/* A pin's name is a small guide sign of its own. */
.pin-name { padding: 3px 7px 1px; border-radius: 4px; background: var(--green); box-shadow: inset 0 0 0 1px rgb(243 244 238 / 0.85); color: var(--white); font-size: 0.75rem; font-weight: 700; line-height: 1.3; text-align: center; white-space: nowrap; }
.pin[aria-pressed="true"] .pin-name { background: var(--white); color: var(--black); box-shadow: inset 0 0 0 1px var(--black); }
.pin:active .pin-dot { transform: scale(0.9); }

.map-bar { display: flex; align-items: center; gap: 4px; margin-top: -8px; }
.map-bar .caption { flex: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.75rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 9px; }
.legend i { width: 9px; height: 9px; border-radius: 50%; background: var(--asphalt); box-shadow: 0 0 0 2px var(--paint); }
.legend i.visited { background: var(--mark); box-shadow: 0 0 0 2px var(--black), 0 0 0 4px var(--mark); margin: 0 3px; }
.legend i.selected { background: var(--paint); box-shadow: 0 0 0 2px var(--black), 0 0 0 4px var(--paint); margin: 0 3px; }

.segmented { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px; border-radius: 9px; background: var(--asphalt-2); }
.segmented button { min-height: 44px; padding: 2px 16px 0; border-radius: 7px; font-size: 0.9375rem; font-weight: 600; text-align: center; color: var(--muted); transition: background-color 180ms ease, color 180ms ease, transform 120ms var(--ease-out); }
.segmented button[aria-pressed="true"], .segmented button[aria-selected="true"] { background: var(--asphalt-3); color: var(--paint); font-weight: 800; box-shadow: inset 0 -3px 0 var(--mark); }
.segmented button:active { transform: scale(0.97); }
.segmented-full { display: grid; width: 100%; }

.features .row { min-height: 48px; }
.features .row-title { font-size: 1rem; font-weight: 600; }
.features .row[aria-pressed="true"] .row-title { font-weight: 800; }
.radio { flex: none; width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--muted); }
.row[aria-pressed="true"] .radio { box-shadow: inset 0 0 0 2px var(--mark), inset 0 0 0 5px var(--asphalt), inset 0 0 0 9px var(--mark); }

.facing { display: flex; flex-direction: column; gap: 14px; max-width: 35rem; }
@media (min-width: 760px) {
  .atlas-spread { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 40px; align-items: start; }
  .atlas-spread .facing { padding-left: 28px; border-left: 1px solid var(--line); }
}

/* ------------------------------------------------------------------ journal */

.day { display: flex; flex-direction: column; }
.day-head { display: flex; flex-direction: column; gap: 3px; padding-bottom: 8px; border-bottom: 2px solid var(--paint); }
.day-title { font-family: var(--sign-face); font-size: 1.1875rem; font-weight: 800; }
.entry { display: flex; align-items: flex-start; gap: 14px; width: 100%; padding: 14px 0; border-bottom: 1px solid var(--line); transition: opacity 120ms ease; }
.entry:active { opacity: 0.6; }
.entry-thumb { flex: none; width: 96px; height: 62px; border-radius: 5px; object-fit: cover; background: var(--asphalt-2); }
.entry-text { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.entry-title { font-family: var(--sign-face); font-size: 1.1875rem; font-weight: 700; line-height: 1.2; }
.entry-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 0.8125rem; color: var(--muted); }
.entry-note { font-size: 0.9375rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.entry > .stamp { flex: none; margin-top: 2px; }
.entry-text > .stamp { align-self: flex-start; margin-top: 6px; }

.album { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 20px 12px; }
.album-card { display: flex; flex-direction: column; gap: 7px; transition: transform 140ms var(--ease-out), opacity 120ms ease; }
.album-card:active { transform: scale(0.97); opacity: 0.8; }
.album-name { font-family: var(--sign-face); font-size: 1rem; font-weight: 700; line-height: 1.2; }

.milestone { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 10px 0; border-top: 1px solid var(--line); }
.milestone-text { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.milestone-title { font-size: 0.9375rem; font-weight: 700; }
.milestone-progress { font-size: 0.8125rem; color: var(--muted); font-weight: 700; }

.notice { padding: 12px 14px; border-radius: 8px; background: var(--asphalt-2); box-shadow: inset 0 0 0 1px var(--line); font-size: 0.9375rem; font-weight: 700; display: flex; gap: 10px; align-items: flex-start; }
.empty { color: var(--muted); max-width: 32rem; }

/* ------------------------------------------------------------------ sheets and forms */

dialog.sheet {
  width: 100%;
  max-width: 560px;
  max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 24px);
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 16px 16px 0 0;
  background: var(--asphalt);
  color: var(--paint);
  box-shadow: 0 -1px 0 var(--line), 0 -12px 40px var(--lift);
  overflow: hidden;
}
dialog.sheet[open] { display: flex; flex-direction: column; }
dialog.sheet::backdrop { background: var(--scrim); animation: swap 260ms ease both; }
dialog.sheet.closing::backdrop { opacity: 0; transition: opacity 200ms ease; }
dialog.sheet-wide { max-width: 760px; }
@media (min-width: 720px) {
  dialog.sheet { margin: auto; border-radius: 16px; max-height: min(86dvh, 860px); box-shadow: 0 0 0 1px var(--line), 0 20px 60px var(--lift); }
}
.sheet-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 54px; padding: 4px var(--margin); border-bottom: 1px solid var(--line); }
.sheet-bar h2 { font-family: var(--sign-face); font-size: 1.0625rem; font-weight: 800; }
.sheet-bar .btn { padding: 0 2px; }
.sheet-body { display: flex; flex-direction: column; gap: 20px; padding: 20px var(--margin) calc(env(safe-area-inset-bottom, 0px) + 28px); overflow-y: auto; overscroll-behavior: contain; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field > label, .field > .label { font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.02em; color: var(--muted); -webkit-user-select: none; user-select: none; }
.field input[type="text"], .field input[type="datetime-local"], .field input[type="number"], .field textarea, .field select {
  width: 100%;
  min-height: 48px;
  padding: 12px 13px 10px;
  border: 0;
  border-radius: 8px;
  background: var(--asphalt-2);
  box-shadow: inset 0 0 0 1px var(--line);
  outline: none;
  transition: box-shadow 160ms ease;
  -webkit-appearance: none;
  appearance: none;
  color-scheme: dark;
}
.field textarea { min-height: 84px; resize: vertical; line-height: 1.4; }
.field select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 14px) 21px; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }
.field :is(input, textarea, select):focus-visible { box-shadow: inset 0 0 0 2px var(--paint); }
.field ::placeholder { color: var(--muted); opacity: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 2px 14px 0; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line); font-size: 0.9375rem; font-weight: 600; white-space: nowrap; transition: background-color 160ms ease, transform 120ms var(--ease-out); }
.chip[aria-pressed="true"] { background: var(--mark); color: var(--black); box-shadow: none; font-weight: 800; }
.chip:active { transform: scale(0.95); }
.capture-preview { max-height: 190px; width: auto; border-radius: 8px; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; justify-content: space-between; }
.sheet-actions .btn-primary { flex: 1 1 200px; }

input[type="range"] { width: 100%; accent-color: var(--mark); min-height: 44px; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 48px; font-size: 1rem; }
.switch input { width: 51px; height: 31px; -webkit-appearance: none; appearance: none; border-radius: 99px; background: var(--asphalt-3); position: relative; transition: background-color 200ms ease; cursor: pointer; flex: none; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: var(--paint); box-shadow: 0 1px 3px var(--lift); transition: transform 220ms var(--ease-out); }
.switch input:checked { background: var(--mark); }
.switch input:checked::after { transform: translateX(20px); background: var(--black); }
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.stepper-controls { display: flex; border-radius: 8px; background: var(--asphalt-2); }
.stepper-controls .icon-btn { border-radius: 8px; width: 48px; height: 44px; }
.setting-line { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; font-size: 1rem; }
.setting-line span:last-child { color: var(--muted); font-weight: 700; }
.setting-group { display: flex; flex-direction: column; gap: 6px; }
.setting-group > h3 { font-family: var(--sign-face); font-size: 1.125rem; font-weight: 800; margin-bottom: 4px; }

video.clip { width: 100%; border-radius: 8px; background: var(--black); aspect-ratio: 16 / 9; }
.detail-media { width: 100%; max-height: 340px; object-fit: contain; border-radius: 8px; background: var(--asphalt-2); }

/* ------------------------------------------------------------------ the save slip */

#slip { position: fixed; inset: auto 0 calc(env(safe-area-inset-bottom, 0px) + var(--tabbar) + 14px) 0; z-index: 60; display: grid; place-items: center; padding: 0 var(--margin); pointer-events: none; }
/* A white regulatory sign: plain statement, black border. */
.slip { position: relative; width: min(100%, 372px); display: flex; flex-direction: column; gap: 12px; padding: 22px 22px 16px; border-radius: 12px; background: var(--white); color: var(--black); box-shadow: 0 14px 34px var(--lift); }
.slip::before { content: ""; position: absolute; inset: 4px; border: 2px solid var(--black); border-radius: 9px; pointer-events: none; }
.slip-title { font-family: var(--sign-face); font-size: 1.375rem; font-weight: 800; line-height: 1.15; }
.slip .footnote { color: #3c4448; font-weight: 600; }
.slip .rule { background: var(--black); height: 2px; }
.slip-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 70px; }
.slip-foot p { font-size: 0.8125rem; font-weight: 700; color: #3c4448; }

/* ------------------------------------------------------------------ kickstand */

dialog.kickstand { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; border: 0; }
dialog.kickstand[open] { display: flex; }
.kickstand {
  flex-direction: column;
  gap: 22px;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) max(24px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 22px) max(24px, env(safe-area-inset-left, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--asphalt);
  color: var(--paint);
}
.kickstand-watch { display: flex; flex-direction: column; gap: 20px; }
.kickstand-inner:focus { outline: none; }
.kickstand-inner { display: flex; flex-direction: column; gap: 20px; width: 100%; max-width: 620px; margin: 0 auto; flex: 1; }
.kickstand-bar { display: flex; justify-content: flex-end; min-height: 44px; }
.kickstand .cue { position: relative; padding-left: 40px; font-size: clamp(1.4rem, 6vw, 1.875rem); font-weight: 700; line-height: 1.24; text-wrap: pretty; }
.kickstand .cue::before { content: ""; position: absolute; left: 6px; top: 0.28em; width: 19px; height: 19px; border-radius: 3px; background: var(--yellow); box-shadow: inset 0 0 0 2px var(--black), 0 0 0 2px var(--yellow); transform: rotate(45deg); }
.kickstand .spacer { flex: 1; min-height: 4px; }
@media (min-width: 760px) and (orientation: landscape) {
  .kickstand-watch { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; align-items: center; }
  .kickstand-inner { max-width: 1040px; }
}
