/* NearStop main screen – everything on ONE screen: header, tabs, map, best 3. Touch targets >= 48px. */
:root{ --fs:18px; --bg:#fff; --fg:#111; --muted:#374151; --brand:#0a4f94; --brand-fg:#fff; --hdr:#0a2540; --hdr-fg:#fff;
       --amber:#ffc21a; --ok:#0a6b2d; --bad:#a30000; --line:#6b7280; --card:#f1f5fb; }
body.hc{ --bg:#000; --fg:#fff; --muted:#e5e7eb; --brand:#ffd400; --brand-fg:#000; --hdr:#000; --hdr-fg:#fff;
         --ok:#6bff9a; --bad:#ff9a9a; --line:#fff; --card:#111; }
*{ box-sizing:border-box }
html,body{ height:100%; margin:0 }
body{ font:var(--fs)/1.35 system-ui,-apple-system,Segoe UI,Roboto,sans-serif; background:var(--bg); color:var(--fg); overflow:hidden }
.app{ display:flex; flex-direction:column; height:100vh; height:100dvh; padding-bottom:env(safe-area-inset-bottom) }
.skip{ position:absolute; left:-999px; top:0; background:var(--amber); color:#000; padding:12px 16px; z-index:3000 }
.skip:focus{ left:8px; top:8px }
a{ color:var(--brand) }
button{ font:inherit; min-height:48px; min-width:48px; padding:6px 12px; border-radius:12px;
        border:2px solid var(--line); background:var(--bg); color:var(--fg); cursor:pointer }
button:focus-visible,a:focus-visible{ outline:4px solid var(--amber); outline-offset:2px; box-shadow:0 0 0 6px #0a2540 }
button:disabled{ opacity:.75; cursor:wait }
.primary{ background:var(--brand); color:var(--brand-fg); border-color:var(--brand); font-weight:700 }
.muted{ color:var(--muted) } .small{ font-size:.8em }
.row{ display:flex; gap:6px; flex-wrap:wrap; align-items:center }
[hidden]{ display:none !important }

header.top{ flex:none; background:var(--hdr); color:var(--hdr-fg); display:flex; align-items:center; justify-content:space-between; gap:6px;
            padding:4px 10px; padding-top:calc(4px + env(safe-area-inset-top)) }
.brand{ display:flex; align-items:center; gap:8px; color:var(--hdr-fg); text-decoration:none; font-weight:800; font-size:1.1em }
header.top button{ background:transparent; color:var(--hdr-fg); border-color:var(--hdr-fg); padding:2px 8px }
.banner{ flex:none; font-size:.72em; background:var(--amber); color:#000; padding:2px 10px; text-align:center; font-weight:600 }

.tabs{ flex:none; display:flex; gap:6px; padding:4px 10px; background:var(--card); border-bottom:2px solid var(--line) }
.tabs button{ flex:1; display:flex; align-items:center; justify-content:center; gap:5px; min-height:48px; padding:2px 4px; font-weight:700; font-size:.95em; white-space:nowrap }
.tabs [aria-selected=true]{ background:var(--brand); color:var(--brand-fg); border-color:var(--brand) }

main{ flex:1; min-height:0; display:flex; flex-direction:column }
#finder{ flex:1; min-height:0; display:flex; flex-direction:column }
.map-wrap{ position:relative; flex:1 1 auto; min-height:190px; overflow:hidden }
#map{ position:absolute; inset:0; z-index:1 }
.mapctl{ position:absolute; right:8px; top:8px; z-index:500; display:flex; flex-direction:column; gap:6px }
.mapctl button{ background:var(--bg); font-size:1.35em; font-weight:700; line-height:1; padding:0; width:48px; box-shadow:0 1px 4px rgba(0,0,0,.35) }
.mapctl button[aria-pressed=true]{ background:var(--brand); color:var(--brand-fg) }
.closeMap{ position:absolute; left:8px; top:8px; z-index:600; background:var(--bg); font-weight:700 }
.map-wrap.full{ position:fixed; inset:0; z-index:2000; background:var(--bg) }
.leaflet-container{ font:inherit }
.leaflet-control-attribution{ font-size:10px !important; line-height:1.3 }
.leaflet-control-scale-line{ font-size:10px }
.num{ width:34px; height:34px; border-radius:50%; background:#0a2540; color:#fff; border:3px solid var(--amber);
      font:800 16px/28px system-ui,sans-serif; text-align:center; box-shadow:0 1px 4px rgba(0,0,0,.5) }
.you{ width:18px; height:18px; border-radius:50%; background:#1a73e8; border:3px solid #fff; box-shadow:0 0 0 2px #1a73e8 }

.results{ flex:0 1 auto; max-height:64%; overflow:auto; padding:6px 10px 8px; border-top:2px solid var(--line); background:var(--bg) }
.rhead{ display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:4px }
.rhead h2{ margin:0; font-size:1.05em; line-height:1.2 }
.rhead p{ margin:0 }
.find{ width:100%; min-height:56px; font-size:1.1em; margin:2px 0 6px }
.card{ display:flex; gap:8px; align-items:stretch; background:var(--card); border:2px solid var(--line); border-radius:12px; padding:4px 6px 5px 8px; margin:0 0 6px }
.body{ flex:1; min-width:0 }
.card h3{ margin:0; font-size:1em; line-height:1.2 }
.nameBtn{ all:unset; box-sizing:border-box; display:flex; align-items:center; gap:7px; min-height:34px; width:100%; cursor:pointer; font-weight:800; font-size:1em; border-radius:8px }
.nameBtn:focus-visible{ outline:4px solid var(--amber); outline-offset:1px; box-shadow:0 0 0 6px #0a2540 }
.nameBtn .n{ flex:none; width:26px; height:26px; border-radius:50%; background:#0a2540; color:#fff; border:2.5px solid var(--amber); font-size:.8em; line-height:21px; text-align:center }
.meta{ font-size:.85em; display:flex; flex-wrap:wrap; gap:0 8px; align-items:center }
.dist{ font-weight:700 }
.badge{ padding:0 7px; border-radius:99px; border:2px solid currentColor; font-weight:700; font-size:.85em; white-space:nowrap }
.open{ color:var(--ok) } .closed{ color:var(--bad) }
.note{ margin:1px 0 0; color:var(--muted); font-size:.82em; line-height:1.25 }
.icons{ display:flex; gap:4px; flex-wrap:wrap; font-size:.72em; margin-top:3px; color:var(--muted) }
.icons span{ border:1px solid var(--line); border-radius:7px; padding:0 6px }
.icons .stale{ color:var(--bad); border-color:var(--bad) }
.detail[hidden]{ display:none }
.card.best{ border-color:var(--brand); border-width:3px }
.go{ flex:none; display:flex; text-decoration:none } .go button{ width:56px; height:100%; min-height:52px; padding:0; font-size:.9em; line-height:1.1 }
#more{ width:100%; min-height:44px; margin-top:0 }
@media (max-height:900px) and (max-width:899px){ .icons .fresh{ display:none } }   /* keep the phone view short; stale warnings always show */
#soon{ overflow:auto; padding:8px 12px }

dialog{ border:2px solid var(--line); border-radius:16px; background:var(--bg); color:var(--fg); max-width:min(92vw,480px); width:100%; padding:14px 16px; font-size:var(--fs) }
dialog::backdrop{ background:rgba(0,0,0,.55) }
dialog h2{ margin:0 0 8px; font-size:1.15em }
.chip[aria-pressed=true]{ background:var(--fg); color:var(--bg) }
ul.links{ list-style:none; padding:0; margin:8px 0 } ul.links a{ display:block; padding:12px 4px; font-weight:700 }
.leaflet-popup-content{ font-size:15px; margin:10px 12px } .leaflet-popup-content a{ font-weight:700 }

/* Wide screens: map on the left, results column on the right */
@media (min-width:900px){
  #finder{ flex-direction:row }
  .results{ flex:0 0 440px; max-height:none; border-top:0; border-left:2px solid var(--line); padding:10px 12px }
  .map-wrap{ flex:1 }
}
/* Short screens (landscape phones): put results beside the map instead of below it */
@media (max-height:520px) and (orientation:landscape){
  #finder{ flex-direction:row }
  .results{ flex:0 0 46%; max-height:none; border-top:0; border-left:2px solid var(--line) }
}

/* Short phones (about 700px tall or less): smaller map, more room for the list */
@media (max-height:700px) and (max-width:899px){
  .map-wrap{ min-height:140px }
  .results{ max-height:72% }
  .card.best{ padding-top:2px; padding-bottom:3px }
}

/* Keep the header on one line on narrow phones and the map buttons inside short maps */
header.top button{ min-width:44px; min-height:44px }
header.top .row{ flex-wrap:nowrap; gap:4px }
@media (max-height:780px) and (max-width:899px){
  .mapctl{ display:grid; grid-template-columns:repeat(2,46px); gap:5px }
  .mapctl button{ width:46px; min-height:46px; height:46px }
}

/* --- v0.4: question panel, freshness nudge, unknown-hours badge --- */
.ask{ padding:2px 0 6px }
.askLabel{ display:block; font-weight:800; margin:2px 0 4px }
.ask input{ flex:1; min-width:0; font:inherit; min-height:52px; padding:6px 12px; border-radius:12px; border:2px solid var(--line); background:var(--bg); color:var(--fg) }
.ask input:focus-visible{ outline:4px solid var(--amber); outline-offset:2px; box-shadow:0 0 0 6px #0a2540 }
.ask .row{ flex-wrap:nowrap }
#suggest{ margin:6px 0 }
.sugg{ display:block; width:100%; text-align:left; font-weight:700; margin:0 0 6px }
.warnNote{ background:#fff6dd; color:#4a2f00; border-left:5px solid #b97800; border-radius:8px; padding:6px 10px; margin:0 0 8px }
body.hc .warnNote{ background:#222; color:#ffd400 }
.oldNote{ width:100%; margin:0 0 6px; text-align:left; border-style:dashed; font-weight:700; min-height:48px }
.badge.unk{ color:var(--muted) }
.lockNote{ margin:6px 0 2px }

/* --- v0.5: reliability, feedback, dialogs --- */
.relRow{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-top:4px }
.rel{ font-size:.75em; font-weight:800; padding:1px 9px; border-radius:99px; border:2px solid currentColor }
.rel.high{ color:var(--ok) } .rel.medium{ color:#7a5a00 } .rel.low,.rel.none{ color:var(--bad) }
body.hc .rel.medium{ color:#ffd400 }
.linkBtn{ all:unset; cursor:pointer; color:var(--brand); text-decoration:underline; font-size:.8em; min-height:40px; display:inline-flex; align-items:center; padding:0 6px }
.linkBtn:focus-visible{ outline:4px solid var(--amber); outline-offset:1px; box-shadow:0 0 0 6px #0a2540 }
.why{ margin:4px 0 0; padding-left:18px; font-size:.78em; color:var(--muted) }
.fbBar{ display:flex; align-items:center; gap:6px; flex-wrap:wrap; margin-top:4px }
.fbLabel{ font-size:.85em; font-weight:700 }
.fbBtn{ min-height:48px; padding:2px 12px; font-size:.9em; font-weight:700 }
.reasons button{ display:block; width:100%; text-align:left; margin:0 0 8px; font-weight:700 }
.reasons .primary{ text-align:center }
#toast{ position:fixed; left:50%; bottom:calc(16px + env(safe-area-inset-bottom)); transform:translateX(-50%); z-index:4000; max-width:90vw;
        background:#0a2540; color:#fff; padding:12px 18px; border-radius:14px; font-weight:700; box-shadow:0 4px 14px rgba(0,0,0,.4) }

.relRow{ gap:4px 6px }
.fbGroup{ margin-left:auto; display:inline-flex; align-items:center; gap:6px }
.fbBtn{ min-width:48px; width:48px; padding:0; font-size:1.2em; line-height:1 }

/* --- v0.6: likely venues, distance units --- */
.rel.likely{ color:var(--muted) }
.dlgSub{ font-size:.9em; margin:8px 0 4px }

/* --- v0.7: add a toilet, restricted-access labels --- */
.addBtn{ width:100%; margin:0 0 6px; text-align:left; border-style:dashed; font-weight:700; min-height:48px }
.restrictedTxt{ color:var(--bad) }
.fld{ display:block; font-weight:700; margin:0 0 8px; font-size:.95em }
.fld input,.fld select,.fld textarea{ display:block; width:100%; margin-top:3px; font:inherit; font-weight:400; min-height:48px; padding:6px 10px; border-radius:10px; border:2px solid var(--line); background:var(--bg); color:var(--fg) }
.fld input:focus-visible,.fld select:focus-visible,.fld textarea:focus-visible{ outline:4px solid var(--amber); outline-offset:2px }
.fldRow{ display:flex; gap:8px; flex-wrap:wrap } .fldRow .fld{ flex:1 1 90px }
#addDlg{ max-height:92vh; overflow:auto }
.dupe{ margin:2px 0 }
.pickBanner{ position:fixed; left:8px; right:8px; top:calc(8px + env(safe-area-inset-top)); z-index:3500; background:#0a2540; color:#fff; border:3px solid var(--amber); border-radius:14px;
             padding:8px 12px; display:flex; align-items:center; justify-content:space-between; gap:10px; font-weight:800 }
.pickBanner button{ background:transparent; color:#fff; border-color:#fff }
@media (max-width:480px){ .fldRow .fld{ flex:1 1 100% } }
/* service-specific choices above the results (fuel type, sort order, plug type) */
.modeBar{ display:flex; flex-wrap:wrap; gap:8px 12px; margin:6px 0 10px }
.seg{ display:inline-flex; border:2px solid var(--brand); border-radius:12px; overflow:hidden }
.seg button{ border:0; border-radius:0; min-height:44px; padding:4px 14px; font-weight:700; background:var(--card); color:var(--brand) }
.seg button+button{ border-left:2px solid var(--brand) }
.seg [aria-pressed=true]{ background:var(--brand); color:var(--brand-fg) }
/* sign-in / subscription screen (shown only when the server enforces licences) */
.gate{ position:fixed; inset:0; z-index:2000; background:var(--bg); color:var(--fg); overflow:auto; display:flex; align-items:flex-start; justify-content:center; padding:20px 14px }
.gate[hidden]{ display:none }
body.gated .app{ visibility:hidden }
.gateCard{ width:100%; max-width:520px; display:flex; flex-direction:column; gap:12px; align-items:stretch }
.gateCard h1{ margin:4px 0 0; font-size:1.5em }
.gateIntro{ margin:0; font-size:1.05em }
.gateForm{ display:flex; flex-direction:column; gap:10px }
.gateForm input{ font:inherit; min-height:52px; padding:8px 12px; border-radius:12px; border:2px solid var(--line); background:var(--bg); color:var(--fg); font-size:1.15em; letter-spacing:.04em }
.gateLabel{ font-weight:700 }
.gateMsg{ margin:0; min-height:1.4em }
.gateMsg.bad{ color:var(--bad); font-weight:700 }
.gateButtons{ display:flex; flex-direction:column; gap:10px }
.gatePlans{ display:flex; flex-direction:column; gap:10px }
.gateLinks{ text-align:center }
.gateLink{ display:flex; align-items:center; justify-content:center; min-height:52px; padding:6px 12px; border-radius:12px; text-decoration:none; font-weight:700; text-align:center }
.gatePromo{ margin:0; font-weight:700; color:var(--ok); text-align:center }
