:root {
  --bg: #0b1020; --panel: #141b32; --panel2: #1c2544; --line: #2a3560;
  --text: #f3f1ea; --muted: #9aa3c2; --gold: #ffc94d; --red: #ff5a5f; --green: #3ddc97; --blue: #59a8ff;
  --r: 14px; --tabs: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 500px at 80% -10%, #1d2a5c 0%, transparent 60%), var(--bg);
  color: var(--text); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--gold); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

/* header */
.top {
  position: sticky; top: 0; z-index: 500; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(10px + var(--safe-t)) 14px 10px; background: rgba(11, 16, 32, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .star { font-size: 26px; color: var(--gold); text-shadow: 0 0 12px rgba(255, 201, 77, .7); }
.brand h1 { font-size: 17px; margin: 0; white-space: nowrap; }
.brand p { margin: 0; font-size: 12.5px; color: var(--muted); }
.pill { border: 1px solid var(--line); background: var(--panel2); border-radius: 999px; padding: 8px 12px; font-size: 14px; white-space: nowrap; cursor: pointer; }
.pill.live { border-color: var(--green); color: var(--green); }
.top-btns { display: flex; gap: 6px; flex: none; }
.pill.help { width: 38px; padding: 8px 0; font-weight: 800; color: var(--gold); }
.brand > div { min-width: 0; }
.brand h1, .brand p { overflow: hidden; text-overflow: ellipsis; }
.howto { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; counter-reset: s; }
.howto li { position: relative; padding: 10px 12px 10px 46px; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; font-size: 14.5px; }
.howto li::before { counter-increment: s; content: counter(s); position: absolute; left: 10px; top: 10px; width: 26px; height: 26px; border-radius: 50%; background: var(--red); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 13px; }
.howto b { color: var(--gold); }
@media (max-width: 400px) { .brand h1 { font-size: 15px; } #locate { padding: 8px 10px; font-size: 13px; } }

main { padding-bottom: calc(var(--tabs) + var(--safe-b) + 8px); }
.view { display: none; }
.view.active { display: block; }

/* filters + list */
.filters { padding: 12px 14px 4px; display: grid; gap: 10px; }
input[type=search], select, #start-suburb {
  width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; outline: none;
}
input:focus, select:focus { border-color: var(--gold); }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; min-width: 0; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; flex-wrap: nowrap; }
#prefs.chips { flex-wrap: wrap; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 7px 12px; font-size: 14px; cursor: pointer; }
.chip.on { background: var(--gold); color: #1b1300; border-color: var(--gold); font-weight: 600; }
#count { padding: 4px 16px 0; margin: 0; }

.list { list-style: none; margin: 0; padding: 6px 10px; display: grid; gap: 8px; }
.item {
  display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 11px 12px; cursor: pointer;
}
.item.seen { opacity: .55; }
.item.off { opacity: .7; }
.item h3 { margin: 0 0 2px; font-size: 15.5px; line-height: 1.25; }
.item .meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.item .acts { display: flex; gap: 6px; }
.tier { color: var(--gold); letter-spacing: -1px; font-size: 13px; }
.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--panel2); color: var(--muted); }
.badge.on { background: rgba(61, 220, 151, .15); color: var(--green); }
.badge.soon { background: rgba(255, 201, 77, .14); color: var(--gold); }
.badge.off, .badge.later, .badge.done { background: rgba(255, 90, 95, .12); color: #ff9a9d; }
.ibtn {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2);
  display: grid; place-items: center; font-size: 19px; cursor: pointer;
}
.ibtn.nav { background: var(--blue); border-color: var(--blue); color: #001428; }
.ibtn.added { background: var(--green); border-color: var(--green); color: #002414; }
.list.compact .item { grid-template-columns: 1fr auto; }

/* buttons */
.btn { border: 1px solid var(--line); background: var(--panel2); border-radius: 12px; padding: 12px 14px; cursor: pointer; font-weight: 600; text-align: center; text-decoration: none; color: var(--text); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #1b1300; }
.btn.go { background: var(--blue); border-color: var(--blue); color: #001428; }
.btn.ok { background: var(--green); border-color: var(--green); color: #002414; }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; margin-top: 12px; }
.btn.big { padding: 16px; font-size: 18px; }
.btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-top: 10px; }

/* cards */
.card { margin: 12px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 14px; }
.card h2 { margin: 0 0 4px; font-size: 18px; }
.lbl { display: block; margin: 14px 0 6px; font-weight: 600; font-size: 14px; }
.seg { display: flex; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 9px 4px; border-radius: 9px; cursor: pointer; font-size: 14px; }
.seg button.on { background: var(--panel2); color: var(--gold); font-weight: 700; box-shadow: inset 0 0 0 1px var(--line); }
.tips ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 14px; display: grid; gap: 6px; }
.credit { padding: 0 16px 20px; }

/* plan output + trip */
.legs { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 0; }
.leg { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px dashed var(--line); }
.leg:first-child { border-top: 0; }
.num { width: 28px; height: 28px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.leg.done .num { background: var(--green); color: #002414; }
.leg.skip .num { background: var(--panel2); color: var(--muted); }
.leg.done h4, .leg.skip h4 { text-decoration: line-through; opacity: .6; }
.leg h4 { margin: 0; font-size: 15px; }
.leg .sub { font-size: 12.5px; color: var(--muted); }
.drive { font-size: 12px; color: var(--muted); padding: 2px 0 2px 40px; }
.summary { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; font-size: 14px; }
.summary b { color: var(--gold); }

.next {
  margin: 12px 10px; border-radius: 20px; padding: 16px; border: 1px solid #3b4a85;
  background: linear-gradient(160deg, #1f2b58, #141b32 70%);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .05);
}
.next .eyebrow { font-size: 13px; color: var(--gold); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.next h2 { margin: 6px 0 2px; font-size: 22px; line-height: 1.2; }
.next .addr { color: var(--muted); }
.next .far { font-size: 15px; margin-top: 8px; }
.feats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.feat { font-size: 12.5px; padding: 3px 9px; border-radius: 999px; background: rgba(255, 201, 77, .1); color: #ffe3a3; border: 1px solid rgba(255, 201, 77, .22); }
.hint { margin-top: 10px; font-size: 14px; background: rgba(89, 168, 255, .1); border: 1px solid rgba(89, 168, 255, .3); border-radius: 12px; padding: 8px 10px; }
.bonus { margin-top: 12px; font-size: 14px; }
.bonus button { background: none; border: 0; color: var(--gold); text-decoration: underline; padding: 0; cursor: pointer; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .big { font-size: 48px; }
.progress { height: 6px; background: var(--panel2); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--red), var(--gold)); }
.toggle { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-top: 10px; color: var(--muted); }

/* map */
#view-map.active { position: fixed; inset: 0; top: calc(58px + var(--safe-t)); bottom: calc(var(--tabs) + var(--safe-b)); padding: 0; }
#map { position: absolute; inset: 0; background: #0e1326; }
.legend {
  position: absolute; left: 10px; bottom: 12px; z-index: 450; display: flex; flex-wrap: wrap; gap: 4px 10px; max-width: calc(100% - 80px);
  background: rgba(11, 16, 32, .88); border: 1px solid var(--line); border-radius: 12px; padding: 6px 10px; font-size: 12px;
}
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.dot.must { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.dot.great { background: var(--red); }
.dot.good { background: var(--green); }
.dot.dim { background: #5b6280; }
.fab { position: absolute; right: 12px; bottom: 14px; z-index: 450; width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel2); font-size: 24px; color: var(--blue); cursor: pointer; }
.pin { width: 28px; height: 28px; border-radius: 50%; background: var(--red); color: #fff; font: 700 13px/28px system-ui; text-align: center; border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
.pin.done { background: var(--green); color: #002414; }
.leaflet-container { font: inherit; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--text); }

/* tabs */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 600; display: flex; height: calc(var(--tabs) + var(--safe-b));
  padding-bottom: var(--safe-b); background: rgba(11, 16, 32, .96); border-top: 1px solid var(--line); backdrop-filter: blur(8px);
}
.tabs button { flex: 1; border: 0; background: none; color: var(--muted); font-size: 12px; display: grid; place-items: center; align-content: center; gap: 1px; cursor: pointer; position: relative; }
.tabs button span { font-size: 21px; filter: grayscale(.7); }
.tabs button.on { color: var(--gold); }
.tabs button.on span { filter: none; }
.tabs b { position: absolute; top: 6px; left: calc(50% + 8px); background: var(--red); color: #fff; font-size: 11px; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }

/* sheet */
.sheet { position: fixed; inset: 0; z-index: 1000; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); }
.sheet-body {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; overflow: auto; background: var(--panel);
  border-radius: 22px 22px 0 0; border-top: 1px solid var(--line); padding: 18px 16px calc(20px + var(--safe-b));
  animation: up .22s ease-out;
}
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
.sheet-body h2 { margin: 0 34px 4px 0; font-size: 21px; }
.close { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin-top: 12px; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.nearby { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
.nearby button { width: 100%; text-align: left; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; cursor: pointer; font-size: 14px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs) + var(--safe-b) + 14px); transform: translateX(-50%); z-index: 1100;
  background: #f3f1ea; color: #111; padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; box-shadow: 0 6px 24px rgba(0, 0, 0, .4); max-width: 90vw;
}

@media (min-width: 760px) {
  main { max-width: 760px; margin: 0 auto; }
  .sheet-body { max-width: 640px; margin: 0 auto; border-radius: 22px 22px 0 0; }
}
.leaflet-tile-pane { filter: invert(1) hue-rotate(200deg) brightness(.85) contrast(.9); }
