/* Tourixx — Indian highway signage: signboard green, milestone yellow, asphalt and lane white. */
@font-face { font-family: 'Overpass'; font-weight: 400; font-display: swap; src: url(/vendor/fonts/overpass-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Overpass'; font-weight: 600; font-display: swap; src: url(/vendor/fonts/overpass-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Overpass'; font-weight: 700; font-display: swap; src: url(/vendor/fonts/overpass-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Overpass'; font-weight: 800; font-display: swap; src: url(/vendor/fonts/overpass-latin-800-normal.woff2) format('woff2'); }

:root {
  --sign: #0a5c45;        /* NH direction-board green */
  --sign-deep: #074534;
  --milestone: #f2b705;   /* milestone cap yellow */
  --asphalt: #2a2e33;
  --asphalt-soft: #5b6168;
  --lane: #ffffff;
  --verge: #e9eee9;
  --line: #d3dad4;
  --closed: #b9410c;
  --ok: #157a3a;
  --sheet: #ffffff;
  --shadow: 0 -2px 18px rgba(20, 30, 25, 0.16);
  --radius: 14px;
  --font: 'Overpass', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --asphalt: #eef1ee; --asphalt-soft: #a9b2ad; --lane: #1d2124; --verge: #15181a; --line: #30363a;
    --sheet: #1d2124; --sign: #127a5c; --sign-deep: #0d6049; --closed: #f08a5d; --ok: #4cc77a;
    --shadow: 0 -2px 18px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --asphalt: #eef1ee; --asphalt-soft: #a9b2ad; --lane: #1d2124; --verge: #15181a; --line: #30363a;
  --sheet: #1d2124; --sign: #127a5c; --sign-deep: #0d6049; --closed: #f08a5d; --ok: #4cc77a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 16px; line-height: 1.45; color: var(--asphalt); background: var(--verge);
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--sign); }
:focus-visible { outline: 3px solid var(--milestone); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.muted { color: var(--asphalt-soft); }
.small { font-size: 0.875rem; }

/* ---------- buttons ---------- */
.btn {
  border: 0; border-radius: 10px; padding: 0.7rem 1rem; font-weight: 700; background: var(--verge); color: var(--asphalt);
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; min-height: 44px; text-decoration: none;
}
.btn-primary { background: var(--sign); color: #fff; }
.btn-primary:active { background: var(--sign-deep); }
.btn-ghost { background: transparent; border: 1.5px solid var(--line); }
.btn-wide { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: default; }
.icon-btn { border: 0; background: transparent; width: 44px; height: 44px; border-radius: 50%; font-size: 1.25rem; display: grid; place-items: center; }

/* ---------- home: the direction board ---------- */
.home { min-height: 100%; display: flex; flex-direction: column; }
.board {
  background: var(--sign); color: #fff; padding: calc(env(safe-area-inset-top) + 18px) 16px 22px;
}
.board-inner { max-width: 560px; margin: 0 auto; border: 3px solid rgba(255, 255, 255, 0.92); border-radius: 12px; padding: 16px 14px 14px; }
.brand { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.brand h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: 0.01em; margin: 0; }
.brand a { color: #fff; opacity: 0.85; font-size: 0.9rem; font-weight: 600; text-decoration: none; }
.board p.lede { margin: 0 0 14px; font-size: 1rem; opacity: 0.95; }
.field { position: relative; display: flex; align-items: center; background: #fff; color: #1f2326; border-radius: 9px; margin-bottom: 8px; }
.field .dot { width: 34px; display: grid; place-items: center; font-weight: 800; color: var(--sign); flex: none; }
.field input { border: 0; background: transparent; padding: 0.8rem 0.4rem 0.7rem 0; width: 100%; color: #1f2326; outline: none; }
.field input::placeholder { color: #707a74; }
.field .use-gps { border: 0; background: transparent; color: var(--sign); font-weight: 700; padding: 0 12px; height: 44px; white-space: nowrap; }
.suggest-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; background: #fff; color: #1f2326; border-radius: 9px; margin-top: 4px; box-shadow: 0 8px 24px rgba(0,0,0,.2); overflow: hidden; }
.suggest-list button { display: block; width: 100%; text-align: left; border: 0; background: #fff; padding: 0.65rem 0.9rem; border-top: 1px solid #edf0ed; }
.suggest-list button:first-child { border-top: 0; }
.suggest-list small { display: block; color: #6b736f; }
.swap { position: absolute; right: -6px; top: 34px; }

.panel { max-width: 560px; width: 100%; margin: 0 auto; padding: 18px 16px 28px; }
.panel h2 { font-size: 1.05rem; margin: 18px 0 8px; font-weight: 800; }
.panel h2:first-child { margin-top: 0; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: var(--lane); padding: 5px; border-radius: 12px; border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; border-radius: 8px; padding: 0.6rem 0.3rem; font-weight: 700; min-height: 48px; }
.seg button span { display: block; font-size: 1.3rem; line-height: 1.1; }
.seg button[aria-pressed="true"] { background: var(--sign); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--line); background: var(--lane); border-radius: 999px; padding: 0.45rem 0.8rem; font-weight: 600; min-height: 40px; }
.chip[aria-pressed="true"] { border-color: var(--sign); background: color-mix(in srgb, var(--sign) 12%, var(--lane)); color: var(--asphalt); }
.slider { display: flex; align-items: center; gap: 12px; }
.slider input { flex: 1; accent-color: var(--sign); }
.slider output { font-weight: 800; min-width: 4.5em; text-align: right; }
.hint { font-size: 0.875rem; color: var(--asphalt-soft); margin: 6px 0 0; }
.go { margin-top: 22px; font-size: 1.1rem; min-height: 54px; }
.recent { margin-top: 26px; }
.recent a { display: flex; justify-content: space-between; gap: 10px; padding: 0.75rem 0; border-top: 1px solid var(--line); color: var(--asphalt); text-decoration: none; }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 26px; font-size: 0.9rem; }
.error { background: color-mix(in srgb, var(--closed) 14%, var(--lane)); color: var(--asphalt); border-left: 4px solid var(--closed); padding: 0.7rem 0.9rem; border-radius: 8px; margin-top: 12px; }

/* ---------- trip: map + sheet ---------- */
.trip { position: fixed; inset: 0; display: flex; flex-direction: column; }
.map { position: absolute; inset: 0; background: #dfe6df; }
.topbar {
  position: absolute; left: 10px; right: 10px; top: calc(env(safe-area-inset-top) + 10px); z-index: 10;
  background: var(--sign); color: #fff; border-radius: 12px; padding: 6px 6px 6px 4px; display: flex; align-items: center; gap: 4px;
  box-shadow: 0 4px 14px rgba(0,0,0,.22);
}
.topbar .icon-btn { color: #fff; }
.topbar .route { flex: 1; min-width: 0; }
.topbar .route b { display: block; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .route span { font-size: 0.85rem; opacity: 0.92; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.banner {
  position: absolute; left: 10px; right: 10px; top: calc(env(safe-area-inset-top) + 74px); z-index: 9;
  background: var(--milestone); color: #1f2326; border-radius: 12px; padding: 10px 12px; font-weight: 700; display: flex; gap: 10px; align-items: center;
  box-shadow: 0 4px 14px rgba(0,0,0,.2);
}
.banner .grow { flex: 1; min-width: 0; }
.banner small { display: block; font-weight: 600; }
.banner .btn { min-height: 38px; padding: 0.45rem 0.8rem; background: #1f2326; color: #fff; }
.banner.warn { background: #fde1d3; }

.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 12; background: var(--sheet); border-radius: 18px 18px 0 0; box-shadow: var(--shadow);
  display: flex; flex-direction: column; max-height: 88%; height: 46%; transition: height 0.22s ease;
}
.sheet.expanded { height: 88%; }
.sheet.collapsed { height: 132px; }
.grab { border: 0; background: transparent; padding: 8px 0 2px; width: 100%; display: grid; place-items: center; }
.grab i { width: 44px; height: 5px; border-radius: 3px; background: var(--line); display: block; }
.sheet-head { padding: 2px 14px 8px; }
.summary { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.summary b { font-size: 1.05rem; }
.spare { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: none; }
.spare .chip { flex: none; min-height: 36px; padding: 0.3rem 0.75rem; }
.list { overflow-y: auto; padding: 0 12px calc(env(safe-area-inset-bottom) + 16px); flex: 1; -webkit-overflow-scrolling: touch; }
.loading-row { padding: 12px 4px; color: var(--asphalt-soft); font-size: 0.9rem; display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* place row with its milestone */
.place { display: grid; grid-template-columns: 54px 1fr; gap: 10px; padding: 12px 2px; border-top: 1px solid var(--line); }
.place.is-skipped { opacity: 0.5; }
.place.is-added .stone { --cap: var(--sign); }
.place.is-added .stone .cap { color: #fff; }
.place.is-past { opacity: 0.45; }
.stone { --cap: var(--milestone); width: 54px; height: 62px; border-radius: 27px 27px 5px 5px; background: #fff; border: 1.5px solid #c9cfca; overflow: hidden; display: flex; flex-direction: column; align-items: center; color: #1f2326; flex: none; }
.stone .cap { background: var(--cap); width: 100%; height: 25px; display: grid; place-items: center; font-size: 0.95rem; }
.stone .km { font-weight: 800; font-size: 0.95rem; line-height: 1; margin-top: 7px; }
.stone .unit { font-size: 0.68rem; font-weight: 700; color: #5b6168; }
.place-main { min-width: 0; }
.place-name { border: 0; background: transparent; padding: 0; text-align: left; font-weight: 800; font-size: 1.02rem; line-height: 1.25; display: block; width: 100%; }
.place-sub { font-size: 0.85rem; color: var(--asphalt-soft); margin-top: 1px; }
.cost { display: flex; align-items: baseline; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.cost .total { font-weight: 800; font-size: 1.2rem; }
.cost .parts { font-size: 0.85rem; color: var(--asphalt-soft); }
.status { font-size: 0.88rem; margin-top: 3px; font-weight: 600; }
.status.open { color: var(--ok); }
.status.closed { color: var(--closed); }
.badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.badge { font-size: 0.78rem; font-weight: 700; border-radius: 6px; padding: 2px 7px; background: var(--verge); color: var(--asphalt); }
.badge.good { background: color-mix(in srgb, var(--ok) 16%, var(--lane)); }
.badge.bad { background: color-mix(in srgb, var(--closed) 18%, var(--lane)); }
.badge.star { background: var(--milestone); color: #1f2326; }
.actions { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.actions .btn { min-height: 40px; padding: 0.45rem 0.8rem; font-size: 0.92rem; }
.votes { display: flex; gap: 6px; align-items: center; margin-top: 9px; flex-wrap: wrap; }
.vote { border: 1.5px solid var(--line); background: var(--lane); border-radius: 10px; min-height: 40px; padding: 0.35rem 0.75rem; font-weight: 800; }
.vote[aria-pressed="true"].up { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 15%, var(--lane)); }
.vote[aria-pressed="true"].down { border-color: var(--closed); background: color-mix(in srgb, var(--closed) 15%, var(--lane)); }
.empty { padding: 22px 6px; text-align: center; color: var(--asphalt-soft); }

/* modal sheet */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.38); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--sheet); width: 100%; max-width: 620px; max-height: 90%; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 8px 16px calc(env(safe-area-inset-bottom) + 20px); }
.modal h3 { font-size: 1.3rem; margin: 6px 0 2px; font-weight: 800; }
.modal h4 { margin: 18px 0 6px; font-size: 1rem; }
.modal .close-row { display: flex; justify-content: flex-end; }
.modal .wiki img { width: 100%; max-height: 220px; object-fit: cover; border-radius: 10px; margin-top: 10px; }
.modal .row-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 0.93rem; }
.kv dt { color: var(--asphalt-soft); }
.kv dd { margin: 0; }
.share-url { width: 100%; border: 1.5px solid var(--line); border-radius: 8px; padding: 0.6rem; background: var(--verge); font-size: 0.9rem; }
.text-in { width: 100%; border: 1.5px solid var(--line); border-radius: 9px; padding: 0.7rem; background: var(--lane); }
label.lbl { display: block; font-weight: 700; margin: 14px 0 6px; }

.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); transform: translateX(-50%); z-index: 60; background: #1f2326; color: #fff; padding: 0.7rem 1.1rem; border-radius: 10px; font-weight: 600; max-width: 92%; }

/* map markers */
.pin { width: 30px; height: 30px; border-radius: 50%; border: 2.5px solid #fff; display: grid; place-items: center; font-size: 15px; box-shadow: 0 1px 5px rgba(0,0,0,.35); cursor: pointer; }
.pin.added { width: 36px; height: 36px; border-color: var(--milestone); border-width: 3.5px; }
.pin.skipped { opacity: 0.4; }
.me { width: 18px; height: 18px; border-radius: 50%; background: #1a73e8; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(26,115,232,.25); }
.end-pin { background: var(--sign); color: #fff; font-weight: 800; border-radius: 8px; padding: 2px 7px; border: 2px solid #fff; font-size: 13px; box-shadow: 0 1px 5px rgba(0,0,0,.35); }

/* driver view: big and simple */
.driver { padding: calc(env(safe-area-inset-top) + 16px) 16px 30px; max-width: 640px; margin: 0 auto; }
.driver .next { background: var(--sign); color: #fff; border-radius: 16px; padding: 18px; margin: 12px 0; }
.driver .next b { font-size: 1.7rem; display: block; line-height: 1.2; }
.driver ol { padding-left: 1.3rem; font-size: 1.1rem; }
.driver ol li { padding: 6px 0; }
.driver .navigate { font-size: 1.2rem; min-height: 60px; }

.simple-page { max-width: 620px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 14px) 16px 30px; }
.simple-page header { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.simple-page h1 { font-size: 1.35rem; margin: 0; }
.pick-map { height: 280px; border-radius: 12px; overflow: hidden; position: relative; border: 1.5px solid var(--line); }

@media (min-width: 900px) {
  .sheet { left: 12px; right: auto; width: 430px; top: 84px; bottom: 12px; height: auto !important; max-height: none; border-radius: 16px; }
  .grab { display: none; }
}
@media (prefers-reduced-motion: reduce) { .sheet { transition: none; } }
