/* Runsheet. Design: Flighty-inspired calm layout, light + dark, liquid glass on floating parts. */
:root {
  --bg: #F2F2F7; --card: #FFFFFF; --fill: #EFEFF4; --fill-2: #E3E3E8;
  --text: #1C1C1E; --text-2: #6C6C70; --text-3: #8E8E93; --line: #E5E5EA;
  --accent: #E8590C; --accent-text: #C2410C; --on-accent: #FFFFFF;
  --blue: #0A60C9; --blue-bg: #E8F1FC; --amber: #9A5200; --amber-bg: #FFF3E0;
  --green: #1E7A45; --green-bg: #E7F6EC; --grey: #3A3A3C; --grey-bg: #EFEFF4;
  --glass: rgba(255,255,255,.58); --glass-strong: rgba(255,255,255,.78);
  --glass-edge: rgba(255,255,255,.75); --glass-shadow: 0 8px 28px rgba(0,0,0,.12);
  --sea: #B9DCEB; --shallow: #CBE6F1; --land: #F3F1EC; --inland: #ECE9E1; --label: #6C6C70;
  --pin-ring: #FFFFFF;
  --mono: 'SF Mono', 'JetBrains Mono', ui-monospace, monospace;
  --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --card: #1C1C1E; --fill: #2C2C2E; --fill-2: #3A3A3C;
    --text: #F2F2F7; --text-2: #AEAEB2; --text-3: #8E8E93; --line: #38383A;
    --accent: #FF6B1A; --accent-text: #FF9A5C; --on-accent: #1C0A00;
    --blue: #6AB0FF; --blue-bg: rgba(10,132,255,.18); --amber: #FFB547; --amber-bg: rgba(255,159,10,.16);
    --green: #4CD683; --green-bg: rgba(48,209,88,.16); --grey: #D1D1D6; --grey-bg: #2C2C2E;
    --glass: rgba(30,30,32,.55); --glass-strong: rgba(30,30,32,.78);
    --glass-edge: rgba(255,255,255,.14); --glass-shadow: 0 8px 28px rgba(0,0,0,.5);
    --sea: #0C2431; --shallow: #12323F; --land: #2A2A2D; --inland: #252528; --label: #9A9AA0;
    --pin-ring: #1C1C1E;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --card: #1C1C1E; --fill: #2C2C2E; --fill-2: #3A3A3C;
  --text: #F2F2F7; --text-2: #AEAEB2; --text-3: #8E8E93; --line: #38383A;
  --accent: #FF6B1A; --accent-text: #FF9A5C; --on-accent: #1C0A00;
  --blue: #6AB0FF; --blue-bg: rgba(10,132,255,.18); --amber: #FFB547; --amber-bg: rgba(255,159,10,.16);
  --green: #4CD683; --green-bg: rgba(48,209,88,.16); --grey: #D1D1D6; --grey-bg: #2C2C2E;
  --glass: rgba(30,30,32,.55); --glass-strong: rgba(30,30,32,.78);
  --glass-edge: rgba(255,255,255,.14); --glass-shadow: 0 8px 28px rgba(0,0,0,.5);
  --sea: #0C2431; --shallow: #12323F; --land: #2A2A2D; --inland: #252528; --label: #9A9AA0;
  --pin-ring: #1C1C1E;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: -apple-system, 'SF Pro Text', Inter, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#app { max-width: 520px; margin: 0 auto; min-height: 100%; position: relative; }
#view { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
#view.full { padding: 0; position: fixed; inset: 0; max-width: 520px; margin: 0 auto; }

/* Liquid glass: frosted, see-through, with a light edge on top */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-edge);
}

/* Tab bar: floating glass pill */
#tabs { position: fixed; z-index: 1000; left: 50%; transform: translateX(-50%);
  bottom: calc(12px + env(safe-area-inset-bottom)); width: min(500px, calc(100% - 24px));
  display: grid; grid-template-columns: repeat(4, 1fr); border-radius: 28px; padding: 6px; }
#tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 5px;
  border-radius: 22px; color: var(--text-3); text-decoration: none; font-size: 11px; font-weight: 600; }
#tabs a svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#tabs a[aria-current="page"] { color: var(--accent); background: var(--fill); }

/* Page basics */
.page { padding: calc(18px + env(safe-area-inset-top)) 16px 0; display: flex; flex-direction: column; gap: 14px; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--text-2); letter-spacing: .02em; }
.title { margin: 0; font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 0 4px; }
.card { background: var(--card); border-radius: var(--radius); }
.card-pad { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.muted { color: var(--text-2); }
.mono { font-family: var(--mono); }
.icon-btn { width: 36px; height: 36px; border-radius: 18px; border: 0; background: var(--fill);
  display: inline-flex; align-items: center; justify-content: center; }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }

/* Segmented control */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--fill); border-radius: 10px; padding: 3px; }
.seg button { height: 34px; border: 0; border-radius: 8px; background: transparent; font-size: 15px; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.14); }
.seg small { font-size: 12px; font-weight: 500; color: var(--text-2); }

.row-ctl { display: flex; justify-content: space-between; align-items: center; min-height: 44px; gap: 12px; }
.stepper { display: flex; align-items: center; background: var(--fill); border-radius: 10px; }
.stepper button { width: 40px; height: 34px; border: 0; background: transparent; font-size: 18px; }
.stepper span { min-width: 92px; text-align: center; font-weight: 600; font-size: 15px; }

/* Departure-board list */
.board { list-style: none; margin: 0; padding: 0; }
.board li { display: grid; grid-template-columns: 88px 1fr auto; gap: 10px; align-items: center;
  min-height: 60px; padding: 8px 16px; border-top: 1px solid var(--line); }
.board .name { font-size: 16px; font-weight: 600; }
.board .sub { font-size: 13px; color: var(--text-2); }
.tag { justify-self: start; align-self: flex-start; font-size: 11px; font-weight: 700; letter-spacing: .04em; padding: 4px 7px; border-radius: 6px; white-space: nowrap; }
.tag.live { color: var(--blue); background: var(--blue-bg); }
.tag.closing { color: var(--amber); background: var(--amber-bg); }
.tag.ready { color: var(--green); background: var(--green-bg); }
.tag.money, .tag.src { color: var(--grey); background: var(--grey-bg); }
.empty { padding: 18px 16px; color: var(--text-2); font-size: 14px; border-top: 1px solid var(--line); }

.btn { display: flex; justify-content: center; align-items: center; gap: 8px; height: 52px; border-radius: 14px; border: 0;
  font-size: 17px; font-weight: 700; text-decoration: none; width: 100%; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.secondary { background: var(--fill); color: var(--text); font-weight: 600; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.foot { font-size: 12px; color: var(--text-3); padding: 4px 4px 16px; line-height: 1.4; }

/* Progress */
.bar { display: block; height: 6px; border-radius: 3px; background: var(--fill); position: relative; overflow: hidden; }
.bar > i { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 3px; transition: width .4s ease; }
.bar.done > i { background: var(--green); }
.big-count { font-family: var(--mono); font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.big-count small { font-size: 16px; color: var(--text-3); font-weight: 500; }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .item { display: grid; grid-template-columns: 1fr 70px 56px 12px; gap: 10px; align-items: center; width: 100%;
  min-height: 50px; padding: 0 14px 0 16px; background: none; border: 0; text-align: left; }
.list .item .name { font-size: 16px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .item .bar { height: 4px; }
.list .count { font-family: var(--mono); font-size: 13px; font-weight: 700; text-align: right; }
.list .count small { color: var(--text-3); font-weight: 500; font-size: 13px; }
.chev { width: 8px; height: 14px; fill: none; stroke: var(--text-3); stroke-width: 2; }
.check-row { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: center; min-height: 52px; padding: 6px 14px 6px 16px; }
.check { width: 26px; height: 26px; border-radius: 13px; border: 2px solid var(--text-3); background: transparent; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; }
.check[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
.check svg { width: 14px; height: 14px; fill: none; stroke: var(--on-accent); stroke-width: 3; opacity: 0; }
.check[aria-pressed="true"] svg { opacity: 1; }
.check-row .name { font-size: 16px; font-weight: 500; }
.check-row .sub { font-size: 13px; color: var(--text-2); }
.check-row.done .name { color: var(--text-3); text-decoration: line-through; }
.link-btn { border: 0; background: none; color: var(--accent-text); font-size: 14px; font-weight: 600; padding: 8px 0 8px 8px; }
.section-h { margin: 6px 4px -4px; font-size: 13px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }

.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 17px;
  border: 0; font-size: 13px; font-weight: 600; color: var(--text); }
.chip .dot { width: 8px; height: 8px; border-radius: 4px; }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.page .chip { background: var(--card); }
.page .chip[aria-pressed="true"] { background: var(--text); color: var(--bg); }

/* Map */
#map { position: absolute; inset: 0; background: var(--sea); }
.leaflet-container { background: var(--sea); font-family: inherit; }
.leaflet-bottom.leaflet-right { bottom: calc(84px + env(safe-area-inset-bottom)); }
.leaflet-control-attribution { background: var(--glass) !important; color: var(--text-2) !important; border-radius: 8px 0 0 8px; font-size: 10px; }
.map-top { position: absolute; z-index: 600; left: 12px; right: 12px; top: calc(12px + env(safe-area-inset-top)); display: flex; flex-direction: column; gap: 10px; }
.search { display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 14px; border-radius: 24px; position: relative; }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--text-3); stroke-width: 2; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 16px; }
.results { position: absolute; top: 54px; left: 0; right: 0; border-radius: 18px; overflow: hidden; max-height: 50vh; overflow-y: auto; }
.results button { display: flex; justify-content: space-between; gap: 10px; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 15px; }
.results button span:last-child { color: var(--text-2); font-size: 13px; white-space: nowrap; }
.map-top .chip { background: var(--glass); -webkit-backdrop-filter: blur(22px) saturate(180%); backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid var(--glass-edge); }
.map-top .chip[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.map-ctl { position: absolute; z-index: 600; right: 12px; top: 42%; display: flex; flex-direction: column; border-radius: 22px; overflow: hidden; }
.map-ctl button { width: 44px; height: 44px; border: 0; background: transparent; font-size: 22px; color: var(--text); }
.map-ctl button + button { border-top: 1px solid var(--line); }
.map-ctl svg { width: 18px; height: 18px; fill: currentColor; }
.map-ctl .accent { color: var(--accent); }
.map-route { position: absolute; z-index: 600; left: 12px; bottom: calc(96px + env(safe-area-inset-bottom)); border-radius: 22px;
  height: 44px; padding: 0 16px; border: 0; font-size: 14px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.map-route b { color: var(--accent-text); }
.region-label { color: var(--label); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap;
  text-shadow: 0 0 3px var(--land), 0 0 3px var(--land); pointer-events: none; }
.leaflet-tooltip.place-tip { background: var(--glass-strong); color: var(--text); border: 1px solid var(--glass-edge); border-radius: 10px;
  box-shadow: var(--glass-shadow); font-weight: 600; -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.leaflet-tooltip.place-tip::before { display: none; }
.cluster { display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--card); color: var(--text);
  font-family: var(--mono); font-size: 12px; font-weight: 700; border: 2px solid var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,.2); }

/* Bottom sheet */
.sheet { position: fixed; z-index: 900; left: 50%; transform: translateX(-50%); width: min(520px, 100%); bottom: 0;
  border-radius: 24px 24px 0 0; padding: 8px 20px calc(100px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px;
  background: var(--glass-strong); animation: up .25s ease; }
.sheet .grab { align-self: center; width: 36px; height: 5px; border-radius: 3px; background: var(--fill-2); }
.sheet h2 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.01em; line-height: 1.1; }
.sheet .kind { font-size: 13px; font-weight: 600; color: var(--accent-text); }
.sheet .close { position: absolute; right: 14px; top: 14px; }
#sheet-root:has(.sheet) ~ #tabs, body:has(.sheet) .map-route { }
body:has(.sheet) .map-route, body:has(.sheet) .leaflet-control-attribution { display: none; }
@keyframes up { from { transform: translate(-50%, 30px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* Run view */
.run-map { position: absolute; inset: 0; }
.run-card { position: fixed; z-index: 800; left: 50%; transform: translateX(-50%); width: min(520px, 100%); bottom: 0; max-height: 60vh; overflow-y: auto;
  border-radius: 24px 24px 0 0; padding: 10px 20px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; background: var(--glass-strong); }
.run-line { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; }
.run-line .num { font-family: var(--mono); font-size: 22px; font-weight: 700; }
.run-line .track { height: 4px; border-radius: 2px; background: var(--fill); position: relative; }
.run-line .track i { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 2px; transition: width .4s ease; }
.run-line .track b { position: absolute; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 7px; background: var(--accent);
  border: 2.5px solid var(--card); box-shadow: 0 0 0 1px var(--accent); transition: left .4s ease; }
.run-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); margin-top: -8px; gap: 8px; }
.run-ends span:nth-child(2) { color: var(--text); font-weight: 600; }
.next h2 { margin: 2px 0 0; font-size: 26px; font-weight: 800; letter-spacing: -.01em; line-height: 1.1; }
.back { position: fixed; z-index: 850; left: max(12px, calc(50% - 248px)); top: calc(12px + env(safe-area-inset-top)); width: 44px; height: 44px; border-radius: 22px;
  display: flex; align-items: center; justify-content: center; color: var(--text); }
.back svg { width: 10px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.toast { position: fixed; z-index: 1100; left: 50%; transform: translateX(-50%); bottom: calc(100px + env(safe-area-inset-bottom));
  padding: 10px 16px; border-radius: 20px; font-size: 14px; font-weight: 600; animation: up .2s ease; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.credits { margin-bottom: 8px; }
.credits a.chip { color: var(--text); }

/* keep scrolling chip rows from widening their card */
.card-pad > * { min-width: 0; }
.chips { min-width: 0; max-width: 100%; }
.page > * { min-width: 0; }

/* ===== Review fixes (Nov 22) ===== */

/* 10. Contrast */
:root { --seg-on: #FFFFFF; --btn-fill: #C2410C; }
:root[data-theme="dark"] { --seg-on: #636366; --btn-fill: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --seg-on: #636366; --btn-fill: var(--accent); } }
.seg button[aria-pressed="true"] { background: var(--seg-on); }
.foot { color: var(--text-2); }
#tabs a { color: var(--text-2); }
#tabs a[aria-current="page"] { color: var(--accent-text); }
.btn.primary { background: var(--btn-fill); }
.chip .mono, .chip .muted { color: inherit !important; opacity: .72; }

/* 11. Tap targets: 44px hit areas without changing the look */
.icon-btn { width: 44px; height: 44px; border-radius: 22px; }
.stepper button { width: 44px; height: 44px; }
.check { position: relative; }
.check::after { content: ''; position: absolute; inset: -9px; }
.chip { position: relative; min-width: 44px; justify-content: center; }
.chip::after { content: ''; position: absolute; inset: -5px 0; }
.link-btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px 0 14px; }
.credits a.mono, .board a[data-showcat] { display: inline-flex; align-items: center; min-height: 44px; }

/* 2. Search results above chips and zoom buttons, solid box */
.map-top { z-index: 700; }
.search { z-index: 2; }
.results { background: var(--card); border: 1px solid var(--line); box-shadow: var(--glass-shadow); z-index: 3; }
body.searching .map-top .chips, body.searching .map-ctl, body.searching .map-route { visibility: hidden; }

/* 5. Pin card open: move map buttons above it (phones) */
body:has(.sheet) .map-ctl { top: calc(116px + env(safe-area-inset-top)); }
/* 6. Toast sits above any open card */
body:has(.sheet) .toast, body:has(.run-card) .toast { bottom: auto; top: calc(120px + env(safe-area-inset-top)); }

/* 8. Run card: fixed spot for buttons, header that never wraps */
.run-card .grab, .sheet .grab { align-self: center; width: 36px; height: 5px; border-radius: 3px; background: var(--fill-2); flex: none; }
.run-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.run-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.run-ends span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.run-ends span:nth-child(1), .run-ends span:nth-child(3) { flex: 1 1 0; min-width: 0; }
.run-ends span:nth-child(3) { text-align: right; }
.next { min-height: 92px; display: flex; flex-direction: column; }
.next h2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.2em; }
.next-sub { font-size: 14px; margin-top: 4px; min-height: 1.3em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 1. Tablet: wider column, full width map */
@media (min-width: 600px) and (max-width: 899px) {
  #app { max-width: 680px; }
  #view.full { max-width: none; }
  .sheet, .run-card { width: min(560px, 100%); }
}

/* 1. Desktop: left rail, full window map and run, side panel cards */
@media (min-width: 900px) {
  #app { max-width: none; }
  #tabs { left: 16px; top: 16px; bottom: 16px; transform: none; width: 84px; grid-template-columns: 1fr; grid-auto-rows: 72px; align-content: start; border-radius: 26px; padding: 8px; }
  #tabs a { justify-content: center; border-radius: 18px; }
  #view { padding: 0 32px 40px 132px; }
  #view.full { inset: 0 0 0 116px; max-width: none; margin: 0; padding: 0; }
  .page { max-width: 1040px; margin: 0 auto; padding-top: 32px; }
  .page.wide { max-width: 820px; }
  .plan-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 16px; align-items: start; }
  .plan-grid .col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
  .two-col { display: grid; grid-template-columns: 1fr 1fr; column-gap: 0; }
  .two-col li:nth-child(odd) { border-right: 1px solid var(--line); }
  .two-col li:nth-last-child(-n+2) { border-bottom: 0; }
  .chips { flex-wrap: wrap; overflow: visible; }
  .map-top .chips { flex-wrap: nowrap; overflow-x: auto; }
  .map-top { right: auto; width: min(560px, calc(100% - 460px)); left: 16px; }
  .map-route { bottom: 24px; left: 16px; }
  .leaflet-bottom.leaflet-right { bottom: 0; }
  .sheet, .run-card { left: auto; right: 16px; top: 16px; bottom: 16px; transform: none; width: 400px; max-height: none;
    border-radius: 24px; padding: 18px 20px 20px; overflow-y: auto; animation: side .25s ease; justify-content: flex-start; }
  .sheet .grab, .run-card .grab { display: none; }
  body:has(.sheet) .map-ctl { top: 42%; right: 432px; }
  body:has(.sheet) .toast, body:has(.run-card) .toast { top: auto; bottom: 24px; left: calc(50% - 200px); }
  .back { left: 132px; }
  .toast { left: calc(50% + 58px); }
}
@keyframes side { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.plan-grid .col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.plan-grid { display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 900px) { .plan-grid { display: grid; } }

@media (max-width: 359px) {
  .row-ctl { flex-wrap: wrap; }
  .row-ctl .seg, .row-ctl .stepper { width: 100% !important; }
}

/* Chip rows: wrap when there's room, swipeable with edge fade on phones */
@media (min-width: 600px) {
  .page .chips { flex-wrap: wrap; overflow: visible; row-gap: 8px; }
}
@media (max-width: 599px) {
  .page .chips { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); padding-right: 24px; }
}

/* pin card details */
.sheet .pc-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; max-height: calc(86vh - 230px); overflow-y: auto;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch; margin: 0 -20px; padding: 0 20px; }
.pc-head { display: flex; flex-direction: column; gap: 4px; padding-right: 48px; }
.pc-near { font-size: 14px; color: var(--text-2); }
.pc-img { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.pc-img img { display: block; width: 100%; aspect-ratio: 16 / 9; max-height: min(180px, 21vh); object-fit: cover; border-radius: 14px;
  background: var(--fill); border: 1px solid var(--line); }
.pc-img figcaption { font-size: 11px; color: var(--text-3); }
.pc-desc { margin: 0; font-size: 15px; line-height: 1.4; color: var(--text); }
.pc-desc.none { color: var(--text-2); font-size: 14px; }
.pc-src { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 13px; padding-top: 10px; border-top: 1px solid var(--line); }
.pc-src-h { font-size: 12px; font-weight: 600; color: var(--text-2); }
.pc-src a { color: var(--accent-text); font-weight: 600; text-decoration: none; }
.pc-src a:hover { text-decoration: underline; }
.pc-src .muted { font-size: 12px; }

/* map look: game map art tiles + our borders and zoom labels */
:root { --sea: #2F90AF; --map-border: #FFFFFF; --tile-filter: none;
  --ml-text: #1C1C1E; --ml-halo: rgba(255,255,255,.92); --ml-water: #EAF6FB; --ml-water-halo: rgba(20,80,105,.55); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --sea: #1B4D5E; --map-border: #E8E8ED;
  --tile-filter: brightness(.6) saturate(.8) contrast(1.08); --ml-text: #F2F2F7; --ml-halo: rgba(0,0,0,.78); --ml-water: #BFE3F0; --ml-water-halo: rgba(0,0,0,.6); } }
:root[data-theme="dark"] { --sea: #1B4D5E; --map-border: #E8E8ED;
  --tile-filter: brightness(.6) saturate(.8) contrast(1.08); --ml-text: #F2F2F7; --ml-halo: rgba(0,0,0,.78); --ml-water: #BFE3F0; --ml-water-halo: rgba(0,0,0,.6); }
.base-tiles { filter: var(--tile-filter); }
.map-label { pointer-events: none; }
.ml { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; color: var(--ml-text); font-weight: 600; font-size: 12px; line-height: 1;
  text-shadow: 0 0 2px var(--ml-halo), 0 0 3px var(--ml-halo), 0 0 6px var(--ml-halo); letter-spacing: .01em; }
.ml-region { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.ml-area { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .9; }
.ml-town { font-size: 12px; font-weight: 600; }
.ml-district { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .85; }
.ml-sea, .ml-water { color: var(--ml-water); font-style: italic; font-weight: 600; text-shadow: 0 0 4px var(--ml-water-halo), 0 1px 2px var(--ml-water-halo); }
.ml-sea { font-size: 12px; letter-spacing: .22em; text-transform: uppercase; }
.ml-water { font-size: 12px; }
.ml-peak { font-size: 11px; font-weight: 600; }
.ml-peak::before { content: '▲ '; font-size: 8px; vertical-align: 1px; opacity: .75; }
.ml-poi { font-size: 11px; font-weight: 500; opacity: .9; }
.ml-poi::before { content: ''; display: inline-block; width: 5px; height: 5px; border-radius: 3px; background: var(--ml-text); margin-right: 4px; vertical-align: 1px; opacity: .6; }
.cluster { cursor: pointer; background: var(--glass-strong); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 2px solid var(--accent); box-shadow: 0 2px 10px rgba(0,0,0,.25); }
@media (min-width: 900px) { .sheet .pc-body { max-height: none; overflow: visible; } } /* side panel scrolls as a whole */

/* map follow-ups */
.map-route { bottom: calc(104px + env(safe-area-inset-bottom)); }
.leaflet-control-attribution { white-space: nowrap; max-width: calc(100vw - 24px); overflow: hidden; text-overflow: ellipsis; }
/* tile seams: avoided by whole zoom steps (zoomSnap 1). No size hack: retina tiles are 128 px. */
@media (min-width: 900px) { .map-route { bottom: 24px; } }

/* icon pins: one glyph per category, lift on hover (desktop) */
.pin-wrap { display: flex; align-items: center; justify-content: center; }
.pin { width: 26px; height: 26px; border-radius: 50%; background: var(--c); color: #fff; border: 2px solid var(--pin-ring);
  display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 4px rgba(0,0,0,.35);
  transition: transform .18s cubic-bezier(.3,1.5,.6,1), box-shadow .18s; animation: pin-in .22s ease-out; }
.pin-ic { width: 14px; height: 14px; }
.pin.found { opacity: .45; filter: saturate(.35); }
.pin-wrap .cluster { transition: transform .18s cubic-bezier(.3,1.5,.6,1); animation: pin-in .22s ease-out; }
@media (hover: hover) {
  .pin-wrap:hover .pin { transform: translateY(-5px) scale(1.3); box-shadow: 0 8px 16px rgba(0,0,0,.35); }
  .pin-wrap:hover .cluster { transform: scale(1.12); }
}
@keyframes pin-in { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pin, .pin-wrap .cluster { animation: none; transition: none; } }

/* pin card v2 */
.pc-kind { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pc-ic { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--c); color: #fff; display: flex; align-items: center; justify-content: center; }
.pc-ic .pin-ic { width: 13px; height: 13px; }
.pc-prog { margin-left: auto; font-size: 11px; color: var(--text-2); white-space: nowrap; padding-right: 4px; }
.pc-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pc-near { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--text-2); }
.pc-near svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.4; flex: none; }
.pc-found { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--green); background: var(--green-bg); padding: 3px 8px; border-radius: 999px; }
.pc-found[hidden] { display: none; }
.pc-zoom { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 14px; }
.pc-img img { opacity: 0; transition: opacity .25s ease;
  background: linear-gradient(100deg, var(--fill) 30%, var(--fill-2) 50%, var(--fill) 70%) 0 0 / 300% 100%; animation: pc-shimmer 1.2s linear infinite; }
.pc-img img.ok { opacity: 1; animation: none; background: var(--fill); }
@keyframes pc-shimmer { to { background-position: -150% 0; } }
.pc-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.pc-tag { font-size: 12px; font-weight: 600; color: var(--text-2); background: var(--fill); padding: 4px 9px; border-radius: 999px; }
.pc-fact { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--fill); }
.pc-fact span { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.pc-fact b { font-size: 14px; font-weight: 500; color: var(--text); }
.pc-next { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.pc-next span { font-size: 12px; color: var(--text-2); white-space: nowrap; }
.pc-next b { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-next svg { width: 14px; height: 14px; fill: none; stroke: var(--accent-text); stroke-width: 1.8; }
.pc-src { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 13px; padding-top: 10px; border-top: 1px solid var(--line); }
.pc-src > span:first-child { font-size: 12px; font-weight: 600; color: var(--text-2); }
.pc-src a { display: inline-flex; align-items: center; gap: 3px; min-height: 32px; }
.pc-src a svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.pc-unv { font-size: 12px; color: var(--text-3); margin-left: auto; }
.lightbox { position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,.88); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 24px; cursor: zoom-out; animation: fade .2s ease; }
.lightbox img { max-width: 100%; max-height: calc(100% - 48px); border-radius: 12px; object-fit: contain; }
.lightbox span { color: rgba(255,255,255,.7); font-size: 12px; text-align: center; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* map filters: compact row + grouped panel */
.map-top .chip.filters-btn { gap: 6px; }
.filters-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.filters-btn b { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; }
.map-top .chip.on { padding-right: 8px; }
.chip .x { width: 12px; height: 12px; margin-left: 2px; fill: none; stroke: currentColor; stroke-width: 1.8; opacity: .6; }
.fl-scrim { position: fixed; inset: 0; z-index: 1040; background: rgba(0,0,0,.28); animation: fade .2s ease; }
.filters { position: fixed; z-index: 1050; left: 0; right: 0; bottom: 0; max-height: 82vh; display: flex; flex-direction: column;
  border-radius: 24px 24px 0 0; background: var(--glass-strong); animation: fl-up .25s ease; padding-bottom: env(safe-area-inset-bottom); }
@keyframes fl-up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.fl-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px 10px; }
.fl-head h2 { margin: 0 auto 0 0; font-size: 22px; font-weight: 800; }
.fl-done { flex: none; width: auto; height: 36px; padding: 0 18px; font-size: 14px; }
.fl-link { white-space: nowrap; border: 0; background: none; color: var(--accent-text); font-size: 14px; font-weight: 600; padding: 6px 2px; cursor: pointer; min-height: 32px; }
.fl-body { overflow-y: auto; overscroll-behavior: contain; padding: 0 20px 20px; }
.fl-group { margin-top: 12px; }
.fl-gh { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); padding: 4px 0; }
.fl-row { display: grid; grid-template-columns: 28px 1fr auto auto; align-items: center; gap: 10px; min-height: 48px; border-bottom: 1px solid var(--line); cursor: pointer; }
.fl-ic { width: 26px; height: 26px; border-radius: 50%; background: var(--c); color: #fff; display: flex; align-items: center; justify-content: center; }
.fl-ic .pin-ic { width: 14px; height: 14px; }
.fl-name { font-size: 15px; font-weight: 600; color: var(--text); }
.fl-count { font-size: 12px; color: var(--text-3); }
.sw { appearance: none; -webkit-appearance: none; width: 44px; height: 26px; border-radius: 13px; background: var(--fill-2); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.sw:checked { background: var(--accent); }
.sw:checked::after { transform: translateX(18px); }
.sw:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (min-width: 900px) {
  .fl-scrim { background: transparent; }
  .filters { position: fixed; left: 132px; right: auto; bottom: 16px; top: 116px; width: 380px; max-height: none; border-radius: 22px; }
}

/* category picker (Plan, Checklist): one button + grouped list, instead of a long chip row */
.pick-btn { display: grid; grid-template-columns: 28px 1fr auto 10px; align-items: center; gap: 10px; width: 100%; min-height: 52px;
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--fill); color: var(--text); text-align: left; cursor: pointer; }
.page .pick-btn { background: var(--card); }
.card .pick-btn { background: var(--fill); }
.pk-name { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-meta { font-size: 13px; color: var(--text-2); white-space: nowrap; }
.pk-chev { width: 8px; height: 14px; fill: none; stroke: var(--text-3); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pk-row { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: none; color: inherit; text-align: left; padding: 0; font: inherit; }
.pk-check { width: 16px; height: 16px; fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.pk-row[aria-pressed="true"] .pk-check { opacity: 1; }
.pk-row[aria-pressed="true"] .fl-name { color: var(--accent-text); }
.gd-ic { flex: none; display: inline-flex; width: 22px; height: 22px; margin-right: 10px; }
.gd-ic .pin-ic { width: 12px; height: 12px; }
@media (min-width: 900px) {
  .filters.picker { left: 50% !important; top: 50%; bottom: auto; transform: translate(-50%, -50%); width: 440px; max-height: 72vh; animation: fade .2s ease; }
  .picker ~ .fl-scrim, .fl-scrim:has(+ .picker) { background: rgba(0,0,0,.28); }
}
.list .item .name:has(.gd-ic) { display: flex; align-items: center; }
@media (max-width: 420px) { .list .item:has(.gd-ic) { grid-template-columns: 1fr 44px 52px 12px; } }

/* ---------- launch screen (same as the iPhone app) ---------- */
#loader { position: fixed; inset: 0; z-index: 9999; background: #000; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  --trace: 0; --fill: 0; transition: opacity .45s ease-out; cursor: pointer; -webkit-tap-highlight-color: transparent; }
#loader.out { opacity: 0; pointer-events: none; }
.ld-mark { position: relative; width: min(300px, 72vw); aspect-ratio: 1; margin-bottom: 26px; transform: scale(.92); transition: transform .7s cubic-bezier(.34,1.56,.64,1), filter .7s; }
#loader.loaded .ld-mark { transform: scale(1); filter: drop-shadow(0 0 30px rgba(255,107,26,.7)); }
.ld-mark svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ld-rise { transform-box: view-box; transform-origin: 50% 100%; transform: scaleY(var(--fill)); }
.ld-trace, .ld-r-trace { fill: none; stroke-dasharray: 1; stroke-dashoffset: calc(1 - var(--trace)); opacity: calc(1 - var(--fill)); filter: drop-shadow(0 0 6px #FF6B1A); }
.ld-trace { stroke: #FF6B1A; stroke-width: 2; }
.ld-r-trace { stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-dasharray: 1; }
.ld-edge { fill: none; stroke: #5A1A00; stroke-width: 10; stroke-linejoin: round; }
.ld-rim { fill: none; stroke: #FFD08A; stroke-width: 2; }
.ld-r-under { fill: none; stroke: #1C0A00; stroke-width: 12; stroke-linecap: round; }
.ld-r-top { fill: none; stroke: #fff; stroke-width: 6; stroke-linecap: round; }
.ld-name { font: 800 30px/1 Inter, system-ui, sans-serif; letter-spacing: 8px; padding-left: 8px; opacity: .85; transition: opacity .4s; }
#loader.loaded .ld-name { opacity: 1; }
.ld-pct { font: 700 13px/1 'JetBrains Mono', ui-monospace, monospace; letter-spacing: 3px; font-variant-numeric: tabular-nums; }
#loader.loaded .ld-pct { font-family: Inter, system-ui, sans-serif; color: rgba(255,255,255,.7); animation: ld-up .5s ease-out; }
@keyframes ld-up { from { opacity: 0; transform: translateY(8px); } }
.ld-foot { position: absolute; bottom: calc(18px + env(safe-area-inset-bottom)); left: 24px; right: 24px; margin: 0; text-align: center; font: 400 11px/1.4 Inter, system-ui, sans-serif; color: #8E8E93; }
