/* Travel-journal look: sand paper, ink navy, terracotta accent, magazine serif titles.
   Layout: one-screen phone app; city picker (postcards), then a card stack per city and a day-by-day route. */
:root {
  --bg: #f5efe4;
  --surface: #fffcf6;
  --surface-2: #efe5d3;
  --ink: #1f2a37;
  --muted: #6b6253;
  --line: #e2d6c1;
  --accent: #c8553d;
  --accent-ink: #ffffff;
  --accent-soft: #f6dcd2;
  --sea: #1f6f8b;
  --nope: #4b5563;
  --shadow: 0 12px 32px rgba(60, 42, 20, .16);
  --shadow-sm: 0 3px 10px rgba(60, 42, 20, .08);
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --body: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131b26; --surface: #1c2633; --surface-2: #243041; --ink: #f3ece0; --muted: #a99f8f; --line: #2e3a4a;
    --accent: #e7795d; --accent-ink: #1d0f0a; --accent-soft: #3b2722; --sea: #6cb8d4; --nope: #cbd2dc;
    --shadow: 0 12px 32px rgba(0, 0, 0, .5); --shadow-sm: 0 3px 10px rgba(0, 0, 0, .3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131b26; --surface: #1c2633; --surface-2: #243041; --ink: #f3ece0; --muted: #a99f8f; --line: #2e3a4a;
  --accent: #e7795d; --accent-ink: #1d0f0a; --accent-soft: #3b2722; --sea: #6cb8d4; --nope: #cbd2dc;
  --shadow: 0 12px 32px rgba(0, 0, 0, .5); --shadow-sm: 0 3px 10px rgba(0, 0, 0, .3); color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; height: 100dvh;
  background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 15px;
  padding: env(safe-area-inset-top, 0px) max(16px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(16px, env(safe-area-inset-left, 0px));
  overflow: hidden; overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
a { color: var(--accent); }
svg { flex: none; }

.app { max-width: 440px; height: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; padding-block: 14px 16px; }
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: none; }
.brand { font-family: var(--display); font-weight: 700; font-style: italic; font-size: 26px; display: flex; align-items: center; gap: 6px; }
.brand svg { width: 24px; height: 24px; color: var(--accent); }
.install-tip { margin: 0; font-size: 13px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.back { border: 0; background: none; display: flex; align-items: center; gap: 4px; padding: 4px 6px 4px 0; font-family: var(--display); font-weight: 700; font-size: 25px; min-width: 0; }
.back span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back svg { width: 22px; height: 22px; color: var(--accent); }
.tabs, .seg { display: flex; background: var(--surface-2); border-radius: 999px; padding: 3px; flex: none; }
.tabs button, .seg button { border: 0; background: none; padding: 7px 12px; border-radius: 999px; font-weight: 600; font-size: 13px; color: var(--muted); white-space: nowrap; }
.tabs button[aria-selected="true"], .seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; margin-left: 2px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-variant-numeric: tabular-nums; }

/* ---------- City picker ---------- */
.hero { flex: none; }
.eyebrow { margin: 0 0 2px; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.picker-title { margin: 0; font-family: var(--display); font-weight: 700; font-size: 36px; line-height: 1.02; letter-spacing: -.01em; }
.picker-title em { font-style: italic; font-weight: 500; color: var(--accent); }
.picker-sub { margin: 0; color: var(--muted); }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 16px; flex: none; box-shadow: var(--shadow-sm); }
.search:focus-within { outline: 3px solid var(--accent); outline-offset: 1px; }
.search svg { width: 18px; height: 18px; color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; background: none; padding: 12px 0; color: var(--ink); outline: none; }
.cities { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin-inline: -16px; padding: 0 16px 12px; scrollbar-width: none; }
.list-title { margin: 12px 0 4px; font-family: var(--display); font-size: 20px; font-weight: 700; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.list-title small { font-family: var(--body); font-size: 12px; font-weight: 500; color: var(--muted); }

/* Trips in progress: horizontal row of tickets */
.trips { list-style: none; margin: 0 -16px; padding: 2px 16px 6px; display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x mandatory; }
.trips li { flex: none; scroll-snap-align: start; }
.ticket { position: relative; display: flex; align-items: stretch; width: 260px; text-align: left; padding: 0; border: 0; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm); overflow: hidden; }
.ticket img { width: 84px; height: 92px; object-fit: cover; background: var(--line); }
.ticket .t-body { flex: 1; min-width: 0; padding: 10px 14px; display: flex; flex-direction: column; justify-content: center; gap: 2px; border-left: 2px dashed var(--line); }
.ticket small { font: 500 10px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.ticket b { font-family: var(--display); font-weight: 700; font-size: 20px; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket .t-count { font-size: 13px; color: var(--accent); font-weight: 600; }

/* All cities: postcards */
.postcards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.postcard { position: relative; display: block; width: 100%; aspect-ratio: 4 / 5; padding: 0; border: 0; border-radius: 18px; overflow: hidden; text-align: left; background: var(--surface-2); box-shadow: var(--shadow-sm); color: #fff; }
.postcard img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.postcard:hover img { transform: scale(1.04); }
.postcard::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(12,16,24,.85), rgba(12,16,24,.15) 55%, rgba(12,16,24,0)); }
.pc-rank { position: absolute; top: 10px; left: 10px; z-index: 1; font: 500 11px var(--mono); padding: 3px 8px; border-radius: 999px; background: rgba(255,252,246,.92); color: #1f2a37; }
.pc-mine { position: absolute; top: 10px; right: 10px; z-index: 1; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--accent); color: #fff; }
.pc-text { position: absolute; left: 12px; right: 12px; bottom: 11px; z-index: 1; display: flex; flex-direction: column; gap: 1px; }
.pc-text b { font-family: var(--display); font-weight: 700; font-size: 21px; line-height: 1.05; text-wrap: balance; text-shadow: 0 1px 8px rgba(0,0,0,.3); }
.pc-text small { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.city-note { margin: 0; font-size: 13px; line-height: 1.4; background: var(--accent-soft); border-radius: 12px; padding: 9px 12px; flex: none; }

/* ---------- Discover ---------- */
.filters { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; flex: none; margin-inline: -16px; padding-inline: 16px; }
.filters button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 13px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.filters button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--bg); }

.progress { display: flex; align-items: center; gap: 10px; font: 500 11px var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.bar { flex: 1; height: 3px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); transition: width .3s; }

.deck { position: relative; flex: 1; min-height: 0; }
.card {
  position: absolute; inset: 0; background: #1f2a37; border-radius: 26px; overflow: hidden; color: #fff;
  box-shadow: var(--shadow); touch-action: none; user-select: none;
  transition: transform .3s cubic-bezier(.2,.8,.3,1);
}
.card.top { cursor: grab; }
.card.top:active { cursor: grabbing; }
.pic { position: absolute; inset: 0; }
.pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; -webkit-user-drag: none; pointer-events: none; }
.pic::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(12,16,24,.94) 0%, rgba(12,16,24,.78) 34%, rgba(12,16,24,.1) 62%, rgba(12,16,24,0) 75%, rgba(12,16,24,.35) 100%); }
.cat { position: absolute; left: 14px; top: 14px; z-index: 1; display: flex; align-items: center; gap: 6px; background: rgba(255,252,246,.94); color: #1f2a37; font-size: 12px; font-weight: 600; padding: 5px 11px 5px 9px; border-radius: 999px; }
.cat i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.credit { position: absolute; right: 14px; top: 18px; z-index: 1; font-size: 10px; color: #fff; opacity: .8; max-width: 48%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.stamp {
  position: absolute; top: 70px; z-index: 2; font-family: var(--display); font-weight: 800; font-size: 26px; letter-spacing: .08em; text-transform: uppercase;
  padding: 6px 16px; border: 3px solid; outline: 2px solid; outline-offset: 3px; border-radius: 12px; opacity: 0; background: rgba(255,252,246,.9);
}
.stamp.like { left: 22px; color: #b7432c; transform: rotate(-14deg); }
.stamp.nope { right: 22px; color: #37414f; transform: rotate(12deg); }
.info { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 20px 20px 18px; display: flex; flex-direction: column; gap: 8px; }
.where { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #f2cfa6; }
.info h2 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1.02; text-wrap: balance; }
.info p { margin: 0; line-height: 1.45; font-size: 14px; color: rgba(255,255,255,.88); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden; }
.meta { display: flex; gap: 6px; flex-wrap: wrap; padding-top: 4px; }
.meta span { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 5px 10px; border-radius: 999px; background: rgba(255,255,255,.14); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.meta svg { width: 13px; height: 13px; }

.actions { display: flex; justify-content: center; align-items: center; gap: 20px; flex: none; }
.btn-round { border: 0; background: var(--surface); border-radius: 50%; display: grid; place-items: center; box-shadow: var(--shadow); transition: transform .15s; }
.btn-round:active { transform: scale(.92); }
.btn-round:disabled { opacity: .4; cursor: default; }
.btn-round svg { width: 44%; height: 44%; }
.big { width: 66px; height: 66px; }
.small { width: 46px; height: 46px; color: var(--muted); }
.nope-btn { color: var(--nope); }
.like-btn { background: var(--accent); color: #fff; }
.hint { font-size: 12px; color: var(--muted); text-align: center; flex: none; }

.empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; padding: 24px; border: 2px dashed var(--line); border-radius: 26px; background: var(--surface); }
.empty.static { position: static; flex: 1; }
.empty h3 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 24px; text-wrap: balance; }
.empty p { margin: 0; color: var(--muted); max-width: 30ch; line-height: 1.45; }
.btn { border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 600; padding: 10px 18px; border-radius: 999px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 14px; text-align: center; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.small-btn { padding: 7px 12px; font-size: 13px; }
.btn svg { width: 15px; height: 15px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.row.left { justify-content: flex-start; }

/* ---------- Lists ---------- */
.list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; padding-bottom: 12px; margin-inline: -16px; padding-inline: 16px; scrollbar-width: none; }
.group h3, .sub-title { margin: 0 0 8px; font-family: var(--display); font-size: 18px; font-weight: 700; }
.group ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 16px; padding: 8px; box-shadow: var(--shadow-sm); min-width: 0; }
.thumb { width: 60px; height: 52px; border-radius: 11px; object-fit: cover; flex: none; background: var(--line); }
.item > div { flex: 1; min-width: 0; }
.item strong { display: block; font-family: var(--display); font-size: 16px; font-weight: 600; line-height: 1.15; }
.item > div > span { font-size: 12px; color: var(--muted); }
.icon-btn { border: 0; background: none; color: var(--muted); padding: 8px; border-radius: 10px; flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; display: block; }
.icon-btn[aria-expanded="true"] { background: var(--surface-2); color: var(--ink); }

/* ---------- Route ---------- */
/* Boarding pass summary */
.pass { background: var(--ink); color: var(--bg); border-radius: 20px; flex: none; position: relative; }
.pass-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 14px; }
.pass small { display: block; font: 500 10px var(--mono); letter-spacing: .14em; text-transform: uppercase; opacity: .65; }
.pass-top b { font-family: var(--display); font-size: 26px; font-weight: 700; line-height: 1.05; }
.pass-top svg { width: 30px; height: 30px; color: var(--accent); }
.pass-cut { position: relative; height: 0; border-top: 2px dashed color-mix(in srgb, var(--bg) 30%, transparent); margin: 0 14px; }
.pass-cut::before, .pass-cut::after { content: ""; position: absolute; top: -11px; width: 20px; height: 20px; border-radius: 50%; background: var(--bg); }
.pass-cut::before { left: -24px; } .pass-cut::after { right: -24px; }
.pass-stats { display: grid; grid-template-columns: repeat(3, 1fr); padding: 12px 18px 16px; gap: 8px; }
.pass-stats b { display: block; font-family: var(--display); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }

.settings { background: var(--surface); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow-sm); flex: none; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field select, .field input, .hotel-btn { width: 100%; padding: 9px 10px; border-radius: 11px; border: 1px solid var(--line); background: var(--bg); min-width: 0; font-size: 14px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--ink); }
.hotel-btn { display: flex; align-items: center; gap: 8px; text-align: left; }
.hotel-btn svg { width: 18px; height: 18px; color: var(--sea); }
.hotel-btn span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hotel-btn em { font-style: normal; font-size: 12px; color: var(--accent); font-weight: 600; }
.hotel-panel { display: flex; flex-direction: column; gap: 8px; border-top: 1px dashed var(--line); padding-top: 12px; }
.hotel-search { display: flex; gap: 6px; }
.hotel-search input { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.hotel-results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.hotel-results button { width: 100%; text-align: left; border: 0; background: var(--bg); border-radius: 10px; padding: 8px 10px; font-size: 13px; line-height: 1.3; }
.hotel-results button:hover { background: var(--surface-2); }
.hotel-results b { display: block; font-size: 14px; }
.hotel-results span { color: var(--muted); }
.fine { font-size: 11px; color: var(--muted); margin: 0; line-height: 1.4; }
.edited { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; background: var(--accent-soft); border-radius: 12px; padding: 8px 8px 8px 12px; }

.map { background: var(--surface); border-radius: 18px; overflow: hidden; flex: none; box-shadow: var(--shadow-sm); }
.map svg { display: block; width: 100%; height: auto; }
.map .paper { fill: var(--surface); }
.map .grid { stroke: var(--line); stroke-width: 1; }
.map .gridlabel { fill: var(--muted); font: 500 9px var(--mono); }
.map .path { stroke-width: 2.5; fill: none; stroke-dasharray: 6 5; stroke-linecap: round; }
.map .dot { stroke: var(--surface); stroke-width: 2; }
.map .num { fill: #fff; font: 700 9px var(--body); text-anchor: middle; dominant-baseline: central; }
.map .home { fill: var(--ink); stroke: var(--surface); stroke-width: 2; }
.map .home-t { fill: var(--bg); font: 700 9px var(--body); text-anchor: middle; dominant-baseline: central; }

.day { display: flex; flex-direction: column; gap: 10px; }
.day-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.day-head h3 { margin: 0; font-family: var(--display); font-size: 24px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.day-tag { font: 700 16px var(--display); letter-spacing: 0; color: #fff; padding: 3px 13px 4px; border-radius: 999px; }
.day-head > span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Timeline: numbered dots on a dashed rail, walking legs between them */
.stops { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; position: relative; }
.stops::before { content: ""; position: absolute; left: 13px; top: 20px; bottom: 20px; border-left: 2px dashed var(--line); }
.stop { display: grid; grid-template-columns: 28px 1fr; gap: 0 10px; align-items: center; position: relative; }
.badge { width: 28px; height: 28px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; font-variant-numeric: tabular-nums; box-shadow: 0 0 0 3px var(--bg); z-index: 1; }
.badge.home { background: var(--ink); color: var(--bg); }
.badge.home svg { width: 15px; height: 15px; }
.stop.hotel .item { box-shadow: none; background: var(--surface-2); padding: 9px 12px; }
.stop.hotel strong { font-size: 14px; }
.leg { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; padding: 2px 0; }
.leg svg { width: 14px; height: 14px; justify-self: center; background: var(--bg); padding: 1px 0; z-index: 1; position: relative; }
.stop-actions { grid-column: 2; display: flex; flex-direction: column; gap: 8px; margin-top: 6px; background: var(--surface-2); border-radius: 14px; padding: 10px; }
.stop-actions .row { justify-content: flex-start; gap: 6px; }
.stop-actions .lbl { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 11px; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 5px; }
.chip:disabled { opacity: .4; cursor: default; }
.chip svg { width: 14px; height: 14px; }
.chip .sw { width: 9px; height: 9px; border-radius: 50%; }
.chip.danger { color: #b7432c; }
.out-list .item { opacity: .85; }

.note { font-size: 12px; color: var(--muted); line-height: 1.45; margin: 0; }
.credits { font-size: 11px; color: var(--muted); line-height: 1.5; }
.credits summary { cursor: pointer; font-weight: 600; }
.credits ul { padding-left: 16px; margin: 6px 0 0; }

@media (prefers-reduced-motion: reduce) { .card, .bar i, .postcard img { transition: none !important; } }
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cities > *, .list > * { flex: none; }
