/* ==================================================================
   PUMP RADAR  -  app.css
   Sections: COLORS, PAGE, TOP BAR, MAP CONTROLS, PINS, LIST, STATION CARD,
             ROUTE CARD, PROFILE, POP-UPS, TAB BAR, LOADING SCREEN,
             ANIMATIONS, DARK MODE
   ================================================================== */

/* ---------- COLORS (change the look here) ---------- */
:root { --bg: #F5F7F8; --card: #fff; --ink: #1B2A33; --muted: #6B7A85; --line: #E3E8EB; --accent: #2563EB;
        --good: #15803D; --bad: #C0392B; --shadow: 0 2px 10px rgba(0,0,0,.18); color-scheme: light; }

/* ---------- PAGE ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
html.tl { font-size: 18px; }                 /* Large text */
html.txl { font-size: 20px; }                /* Extra large text */
body { font: 1rem/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg);
       display: flex; flex-direction: column; overflow: hidden; }
button, select { font: inherit; cursor: pointer; }
button:focus-visible, select:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #93B4FF; outline-offset: 2px; }
.small { color: var(--muted); font-size: .88rem; }
.empty { text-align: center; color: var(--muted); margin-top: 48px; line-height: 1.7; }
.beta { display: inline-block; font-size: .6rem; font-weight: 800; letter-spacing: .6px; color: #B45309; background: #FEF3C7;
        border: 1px solid #FCD34D; border-radius: 6px; padding: 1px 5px; vertical-align: middle; margin-left: 4px; }
.pill { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.pill.green { background: #DDF5E4; color: #166534; }
.pill.amber { background: #FDEFD0; color: #92400E; }
.pill.gray  { background: #E8ECEF; color: var(--muted); }
.pill.red   { background: #FBE0DD; color: #991B1B; }
.pill.blue  { background: #DCE8FD; color: #1D4ED8; margin-bottom: 6px; }

/* ---------- TOP BAR ---------- */
header { display: flex; align-items: center; gap: 10px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top));
         background: var(--card); border-bottom: 1px solid var(--line); box-shadow: 0 2px 10px rgba(0,0,0,.08);
         position: relative; z-index: 1200; }
h1 { font-size: 1.15rem; margin: 0 auto 0 0; font-weight: 800; white-space: nowrap; }
header select { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card);
                color: var(--ink); font-weight: 600; }

/* ---------- THE MAP AREA ---------- */
#stage { position: relative; flex: 1; min-height: 0; }
#map, #map3d { position: absolute; inset: 0; }
#map3d { z-index: 1; display: none; }
.leaflet-top, .maplibregl-ctrl-top-right { top: 104px; }     /* zoom buttons sit below the search bar */
.leaflet-control-attribution, .maplibregl-ctrl-attrib { font-size: 10px !important; opacity: .8; }
.leaflet-control-zoom { border: 0 !important; box-shadow: var(--shadow) !important; border-radius: 12px; overflow: hidden; }

#searchForm { position: absolute; top: 10px; left: 12px; right: 12px; z-index: 950; display: flex; align-items: center;
              background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 0 6px 0 12px; }
#searchForm svg { flex: none; color: var(--muted); }
#searchBox { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 1rem;
             padding: 12px 8px; color: var(--ink); }
#searchBox::-webkit-search-cancel-button { display: none; }
#searchClear { border: 0; background: none; color: var(--muted); font-size: 1.1rem; padding: 6px 8px; }
#searchBox:placeholder-shown + #searchClear { display: none; }
#suggest { position: absolute; top: 62px; left: 12px; right: 12px; z-index: 960; display: none; background: var(--card);
           border-radius: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.2); overflow: hidden; animation: dropIn .18s ease-out; }
#suggest button { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; border: 0;
                  border-bottom: 1px solid var(--line); background: none; padding: 11px 14px; font: inherit; color: var(--ink); }
#suggest button:last-child { border-bottom: 0; }
#suggest button:hover { background: var(--bg); }
.sicon { font-size: 1.1rem; line-height: 1.3; }

#quick { position: absolute; top: 64px; left: 12px; right: 12px; z-index: 945; display: flex; gap: 8px; justify-content: center; }
#quick button { border: 0; background: var(--card); color: var(--ink); font-weight: 700; font-size: .85rem;
                padding: 8px 14px; border-radius: 999px; box-shadow: var(--shadow); white-space: nowrap; }
#quick button:first-child { background: var(--accent); color: #fff; }

#maphint { position: absolute; top: 110px; left: 50%; transform: translateX(-50%); z-index: 940; display: none; align-items: center;
           gap: 8px; background: rgba(27,42,51,.88); color: #fff; font-size: .85rem; font-weight: 700; padding: 8px 14px;
           border-radius: 999px; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.2); pointer-events: none; animation: fadeIn .2s; }
.spin { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%;
        animation: spin .8s linear infinite; }

#btnRecenter, #btn3D { position: absolute; right: 12px; z-index: 900; width: 46px; height: 46px; border-radius: 50%; border: 0;
                       background: var(--card); box-shadow: 0 2px 10px rgba(0,0,0,.25); display: flex; align-items: center;
                       justify-content: center; transition: transform .15s, bottom .25s; }
#btnRecenter { bottom: 38px; color: var(--accent); }
#btn3D { bottom: 92px; color: var(--ink); font-weight: 800; font-size: 15px; }
#btn3D.on { background: #1B2A33; color: #fff; }
#btnRecenter:hover, #btn3D:hover { transform: scale(1.08); }

#legend { position: absolute; left: 12px; bottom: 12px; z-index: 900; background: var(--card); border-radius: 14px;
          padding: 10px 12px; box-shadow: var(--shadow); font-size: .8rem; min-width: 160px; }
#legend.none { display: none !important; }
#legend .ttl { font-weight: 700; margin-bottom: 6px; }
#legend .bar { height: 10px; border-radius: 6px; background: linear-gradient(90deg, hsl(140,65%,38%), hsl(70,65%,38%), hsl(0,65%,38%)); }
#legend .ends { display: flex; justify-content: space-between; gap: 12px; margin-top: 4px; color: var(--muted); }
#legend .ends b { color: var(--ink); }

/* ---------- PINS (Apple style) ---------- */
.tp { position: relative; width: 64px; height: 96px; display: flex; flex-direction: column; justify-content: flex-end;
      align-items: center; transform-origin: 50% 100%; transition: transform .15s ease; }
.tp > * { flex: none; }                       /* nothing gets squished */
.tp .price { background: #fff; border-radius: 999px; padding: 3px 9px; margin-bottom: 4px; font-size: 14px; font-weight: 800;
             letter-spacing: -.2px; white-space: nowrap; box-shadow: 0 1px 2px rgba(0,0,0,.16), 0 3px 8px rgba(0,0,0,.18); }
.tp .deal { position: relative; z-index: 1; margin-bottom: -6px; padding: 1px 7px; border-radius: 999px;
            background: linear-gradient(135deg, #22C55E, #15803D); color: #fff; font-size: 9px; font-weight: 800;
            letter-spacing: .5px; text-transform: uppercase; white-space: nowrap; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.tp .deal.best { background: linear-gradient(135deg, #FBBF24, #F59E0B); color: #3A2400; animation: dealGlow 2s ease-in-out infinite; }
.tp .badge { width: 34px; height: 34px; border: 3px solid #fff; border-radius: 50%; display: flex; align-items: center;
             justify-content: center; font-size: 13px; font-weight: 800; letter-spacing: -.3px;
             box-shadow: 0 1px 2px rgba(0,0,0,.25), 0 4px 10px rgba(0,0,0,.25); }
.tp .tip { width: 0; height: 0; margin-top: -1px; border: 6px solid transparent; border-top: 7px solid #fff; border-bottom: 0;
           filter: drop-shadow(0 2px 1px rgba(0,0,0,.18)); }
.tp .pump { position: absolute; right: 9px; bottom: 6px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
            color: #1F2A30; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.tp .pump svg { width: 9px; height: 9px; fill: currentColor; }
.tp .nm { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 3px; background: #fff;
          border-radius: 999px; padding: 1px 7px; font-size: 11px; font-weight: 700; white-space: nowrap; max-width: 130px;
          overflow: hidden; text-overflow: ellipsis; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.tp.stale { opacity: .6; }
.tp.stale .badge, .tp.stale .price, .tp.stale .pump { filter: grayscale(1); }
.tp.new { animation: pinIn .4s cubic-bezier(.2,.9,.3,1.25); }
.leaflet-marker-icon:hover .tp, .mk:hover .tp { transform: translateY(-4px) scale(1.07); }
.mk { width: 64px; height: 96px; cursor: pointer; }
.you3d { width: 18px; height: 18px; border-radius: 50%; background: #1A73E8; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(26,115,232,.25); }

/* ---------- LIST + SAVED ---------- */
#list { position: absolute; inset: 0; overflow-y: auto; padding: 14px; display: none; background: var(--bg); }
.sortbar { display: flex; gap: 8px; padding: 2px 0 10px; position: sticky; top: 0; z-index: 2; background: var(--bg); }
.sortbar button { flex: 1; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 9px 10px;
                  font-weight: 700; color: var(--muted); font-size: .85rem; }
.sortbar button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.row { display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: left; color: var(--ink);
       margin-bottom: 10px; padding: 14px; background: var(--card); border: 0; border-left: 6px solid var(--c);
       border-radius: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.08); animation: rowIn .3s ease-out backwards; }
.row:hover { box-shadow: 0 4px 12px rgba(0,0,0,.14); transform: translateY(-1px); }
.row b { font-size: 1.6rem; }
.row .rt { text-align: right; flex: none; margin-left: 10px; }
.row .tot { display: block; font-size: .72rem; color: var(--muted); font-weight: 600; }
.fav { color: #E0395B; }
.savetag { display: inline-block; margin-left: 6px; background: #E7F7EE; color: var(--good); font-size: .72rem; font-weight: 800;
           padding: 2px 7px; border-radius: 999px; vertical-align: middle; }

/* ---------- STATION CARD ---------- */
#detail { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1100; background: var(--card); display: none;
          border-radius: 26px 26px 0 0; padding: 26px 20px max(22px, env(safe-area-inset-bottom));
          box-shadow: 0 -10px 40px rgba(0,0,0,.25); max-height: 80%; overflow-y: auto;
          animation: sheetUp .38s cubic-bezier(.2,.9,.25,1); }
#detail.closing { animation: sheetDown .22s ease-in forwards; }
#detail::before { content: ""; display: block; width: 44px; height: 5px; border-radius: 3px; background: #D5DCE1; margin: -14px auto 12px; }
.dh { display: flex; align-items: center; gap: 14px; }
.dh .bdg { width: 56px; height: 56px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center;
           font-weight: 800; font-size: 20px; border: 4px solid #D8DEE2; }
.dh .nmv { flex: 1; min-width: 0; }
.dh h2 { font-size: 1.5rem; line-height: 1.15; margin: 0; }
.dh .x, .dh .heartbtn { border: 0; background: var(--bg); width: 36px; height: 36px; border-radius: 50%; color: var(--muted); flex: none; }
.dh .x { font-size: 16px; }
.dh .heartbtn { font-size: 18px; }
.dh .heartbtn.on { color: #E0395B; background: #FDE8EC; }
.hero { margin: 16px 0 12px; padding: 16px; border-radius: 18px; display: flex; align-items: center; justify-content: space-between;
        gap: 12px; background: linear-gradient(135deg, #EEF4FF, #F7FAFC); border: 1px solid #DCE6F7; }
.hero > div:last-child { max-width: 55%; text-align: right; }
.hero .big { font-size: 2.6rem; font-weight: 800; line-height: 1; letter-spacing: -1px; }
.hero .lab { color: var(--muted); font-size: .9rem; margin-bottom: 4px; }
.costbox { background: #F7FAFC; border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; margin: 10px 0; }
.mrow { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; font-size: .95rem; }
.mrow span { color: var(--muted); }
.mrow.total { border-top: 1px dashed #D5DCE1; margin-top: 4px; padding-top: 7px; font-weight: 800; }
.mrow.total span { color: var(--ink); }
.save { margin-top: 8px; padding: 8px 10px; border-radius: 10px; font-weight: 700; font-size: .92rem; background: #EEF1F3; color: var(--muted); }
.save.good { background: #E7F7EE; color: var(--good); }
.save.bad { background: #FDECEC; color: #B42318; }
.costbox .small { display: block; margin-top: 6px; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tile { border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 10px 2px; text-align: center;
        color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.tile:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,.12); }
.tile span { display: block; font-size: .78rem; color: var(--muted); }
.tile b { display: block; font-size: 1.25rem; margin: 2px 0; }
.tile em { display: block; font-style: normal; font-size: .72rem; color: var(--accent); font-weight: 600; }
.tile.sel { border-color: var(--accent); background: #F0F5FF; box-shadow: 0 0 0 2px var(--accent), 0 4px 12px rgba(37,99,235,.2); }
.info { margin: 16px 0 6px; display: grid; gap: 8px; }
.info .ln { display: flex; gap: 10px; align-items: flex-start; font-size: .98rem; }
.info .ln i { font-style: normal; width: 22px; text-align: center; }
.info a { color: var(--accent); font-weight: 600; text-decoration: none; }
.chipset { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.chipset span { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; font-size: .85rem; }
.rev { margin: 14px 0 4px; }
.rev .avg { display: flex; align-items: center; gap: 8px; }
.rev .avg b { font-size: 1.6rem; }
.stars { color: #F5A623; letter-spacing: 2px; }
.bubble { background: var(--bg); border-radius: 12px; padding: 8px 12px; margin-top: 6px; font-size: .92rem; }
.cta { display: flex; gap: 10px; margin: 16px 0 10px; }
.cta .primary, .cta .ghost { flex: 1; text-align: center; padding: 14px; border-radius: 14px; font-weight: 700; font-size: 1rem; text-decoration: none; }
.cta .primary { background: var(--accent); color: #fff; border: 0; box-shadow: 0 6px 16px rgba(37,99,235,.35); }
.cta .primary:hover { filter: brightness(1.08); }
.cta .ghost { background: var(--card); color: var(--accent); border: 2px solid var(--accent); }
.links { display: flex; gap: 8px; flex-wrap: wrap; }
.links a, .links button { padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card);
                          color: var(--ink); font-weight: 600; font-size: .9rem; text-decoration: none; }
.links a:hover, .links button:hover { background: var(--bg); }
.links .confirm { background: #DDF5E4; border-color: #BFE8CB; color: #166534; }
.del { margin-top: 14px; border: 0; background: none; color: var(--bad); font-weight: 600; }
.disclaim { margin: 14px 2px 0; font-size: .78rem; color: var(--muted); text-align: center; line-height: 1.4; }

/* ---------- ROUTE CARD ---------- */
#routeBar { position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 1000; display: none; align-items: center; gap: 12px;
            padding: 12px 12px 12px 14px; background: var(--card); color: var(--ink); border-radius: 18px;
            box-shadow: 0 8px 28px rgba(0,0,0,.22); animation: sheetUp .35s cubic-bezier(.2,.9,.25,1); }
.rt-icon { width: 40px; height: 40px; border-radius: 12px; background: rgba(37,99,235,.12); color: var(--accent);
           display: flex; align-items: center; justify-content: center; flex: none; }
.rt-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rt-text b { font-size: 1.35rem; line-height: 1.15; }
.rt-text span { color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rt-go { background: var(--accent); color: #fff; text-decoration: none; font-weight: 800; padding: 10px 16px; border-radius: 12px;
         box-shadow: 0 4px 12px rgba(37,99,235,.35); flex: none; }
.rt-x { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--bg); color: var(--muted); font-size: 1rem; flex: none; }
#stage.routing #legend { display: none !important; }
#stage.routing #btnRecenter { bottom: 100px; }
#stage.routing #btn3D { bottom: 154px; }

/* ---------- PROFILE ---------- */
#profile { position: absolute; inset: 0; z-index: 1050; overflow-y: auto; background: var(--bg); display: none; padding: 16px 16px 28px; }
.pcard { display: flex; align-items: center; gap: 14px; background: var(--card); border-radius: 20px; padding: 16px; box-shadow: 0 2px 10px rgba(0,0,0,.07); }
.avatar { width: 60px; height: 60px; border-radius: 50%; background: linear-gradient(135deg, #2563EB, #1D4ED8); color: #fff;
          display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 800; flex: none; }
.pinfo { flex: 1; min-width: 0; display: grid; gap: 4px; }
.pinfo input { border: 0; border-bottom: 2px solid var(--line); font: inherit; font-size: 1.2rem; font-weight: 800; padding: 2px 0;
               width: 100%; background: transparent; color: var(--ink); outline: none; }
.pinfo input:focus { border-color: var(--accent); }
.pstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0 6px; }
.pstats div { background: var(--card); border-radius: 16px; padding: 12px 4px; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.pstats b { display: block; font-size: 1.5rem; }
.pstats span { font-size: .75rem; color: var(--muted); }
#profile h4 { margin: 18px 4px 8px; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .6px; }
.plist { background: var(--card); border-radius: 18px; overflow: hidden; box-shadow: 0 1px 6px rgba(0,0,0,.06); }
.prow { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 14px 16px; border: 0;
        background: var(--card); font: inherit; font-weight: 600; color: var(--ink); text-align: left; text-decoration: none;
        border-bottom: 1px solid var(--line); gap: 10px; }
.prow:last-child { border-bottom: 0; }
button.prow:hover, a.prow:hover { background: var(--bg); }
.prow span { color: var(--muted); font-weight: 400; }
.prow select, .mini, .numwrap input { border: 0; background: var(--bg); border-radius: 10px; padding: 8px 10px; font: inherit;
                                      font-weight: 700; color: var(--ink); }
.prow select { font-weight: 600; max-width: 55%; }
.mini { font-size: .85rem; color: var(--accent); }
.prow.danger { color: var(--bad); }
.prow.about { display: block; font-weight: 700; }
.prow.about .small { font-weight: 400; display: block; margin-top: 4px; line-height: 1.4; }
.numwrap { display: flex; align-items: center; gap: 6px; }
.numwrap input { width: 76px; text-align: right; }
.sw { appearance: none; -webkit-appearance: none; width: 46px; height: 28px; border-radius: 14px; background: #D5DCE1;
      position: relative; cursor: pointer; transition: background .2s; flex: none; margin: 0; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff;
             box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .25s cubic-bezier(.3,1.4,.5,1); }
.sw:checked { background: var(--accent); }
.sw:checked::after { transform: translateX(18px); }
.pauth { padding: 16px; }
.pauth p { margin: 0 0 12px; color: var(--muted); font-size: .95rem; }
.pauth input { width: 100%; padding: 13px 14px; border: 2px solid var(--line); border-radius: 12px; font: inherit; font-size: 1rem;
               margin-bottom: 10px; outline: none; background: var(--card); color: var(--ink); }
.pauth input:focus { border-color: var(--accent); }
.pauth .wskip { width: 100%; }
.pauth button:disabled { opacity: .6; }
.prow.tip { align-items: center; }
.tipt { display: flex; flex-direction: column; gap: 2px; }
.tipt b { color: var(--ink); }

/* ---------- POP-UPS ---------- */
#modal { position: fixed; inset: 0; z-index: 2000; background: rgba(15,25,32,.5); display: none; align-items: center;
         justify-content: center; padding: 18px; animation: fadeIn .2s ease-out; }
.sheetbox { width: 100%; max-width: 380px; background: var(--card); border-radius: 22px; padding: 22px 20px 18px;
            box-shadow: 0 12px 40px rgba(0,0,0,.3); animation: pop .28s cubic-bezier(.2,.9,.3,1.15); }
.sheetbox h3 { margin: 0 0 4px; font-size: 1.25rem; }
.sheetbox .sub { margin: 0 0 14px; color: var(--muted); font-size: .92rem; }
.money { display: flex; align-items: center; gap: 6px; border: 2px solid var(--line); border-radius: 14px; padding: 8px 14px; margin-bottom: 8px; }
.money:focus-within { border-color: var(--accent); }
.money span { font-size: 1.8rem; font-weight: 700; color: var(--muted); }
.money input { border: 0; outline: 0; width: 100%; font-size: 2rem; font-weight: 800; background: transparent; color: var(--ink); }
.txt { width: 100%; border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; font: inherit; margin-bottom: 10px;
       outline: 0; resize: none; background: var(--card); color: var(--ink); }
.txt:focus { border-color: var(--accent); }
.bad { border-color: var(--bad) !important; animation: shake .3s; }
.starrow { display: flex; justify-content: center; gap: 6px; margin-bottom: 12px; }
.st { border: 0; background: none; font-size: 2.4rem; color: #D5DBDF; padding: 0 2px; transition: transform .15s, color .15s; }
.st.on { color: #F5A623; transform: scale(1.1); }
.sheetbtns { display: flex; gap: 10px; margin-top: 8px; }
.sheetbtns button { flex: 1; padding: 13px; border-radius: 14px; font-weight: 700; font-size: 1rem; border: 1px solid var(--line);
                    background: var(--card); color: var(--ink); }
.sheetbtns .primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.sheetbtns .danger { background: var(--bad); border-color: var(--bad); color: #fff; }
#toast { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); z-index: 3000; background: #1B2A33; color: #fff;
         padding: 12px 18px; border-radius: 999px; font-weight: 600; font-size: .95rem; max-width: 90%; text-align: center;
         box-shadow: 0 6px 20px rgba(0,0,0,.3); }
#toast.show { animation: toastIn .3s cubic-bezier(.2,.9,.3,1.2) both; }
#toast.hide { animation: toastOut .25s ease-in both; pointer-events: none; }
#welcome { position: fixed; inset: 0; z-index: 2500; background: rgba(15,25,32,.7); display: flex; align-items: center;
           justify-content: center; padding: 20px; animation: fadeIn .25s; }
#welcome.out { animation: fadeOut .25s forwards; }
.wcard { background: var(--card); border-radius: 26px; padding: 30px 24px 22px; width: 100%; max-width: 360px; text-align: center;
         box-shadow: 0 20px 60px rgba(0,0,0,.4); animation: pop .35s cubic-bezier(.2,.9,.3,1.15); }
.wicon { font-size: 56px; line-height: 1; margin-bottom: 10px; animation: bob 2.4s ease-in-out infinite; }
.wcard h2 { margin: 6px 0 8px; font-size: 1.5rem; }
.wcard p { margin: 0 0 18px; color: var(--muted); }
.dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 18px; }
.dots i { width: 8px; height: 8px; border-radius: 4px; background: #D5DCE1; transition: width .25s, background .25s; }
.dots i.on { background: var(--accent); width: 22px; }
.wnext { width: 100%; padding: 14px; border: 0; border-radius: 14px; background: var(--accent); color: #fff; font-weight: 700;
         font-size: 1rem; box-shadow: 0 6px 16px rgba(37,99,235,.35); }
.wskip { margin-top: 8px; border: 0; background: none; color: var(--muted); font-weight: 600; padding: 8px; }
#offline { position: fixed; top: 0; left: 0; right: 0; z-index: 2900; background: #B45309; color: #fff; text-align: center;
           font-size: .85rem; font-weight: 700; padding: 6px 10px; padding-top: max(6px, env(safe-area-inset-top)); display: none; }

/* ---------- BOTTOM TAB BAR (frosted glass) ---------- */
#tabs { display: flex; gap: 4px; position: relative; z-index: 1200; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
        background: rgba(255,255,255,.86); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
        border-top: 1px solid rgba(0,0,0,.06); box-shadow: 0 -6px 20px rgba(0,0,0,.06); }
#tabs button { flex: 1; border: 0; background: none; color: var(--muted); padding: 6px 0 5px; border-radius: 14px; display: flex;
               flex-direction: column; align-items: center; gap: 2px; font-size: .7rem; font-weight: 700; letter-spacing: .1px;
               transition: background .2s, color .2s, transform .12s; }
#tabs button svg { width: 23px; height: 23px; }
#tabs button.on { background: rgba(37,99,235,.10); color: var(--accent); }
#tabs button.on svg path, #tabs button.on svg circle { fill: currentColor; fill-opacity: .18; }
#tabs button.on svg { animation: tabPop .3s cubic-bezier(.2,.9,.3,1.4); }

/* ---------- LOADING SCREEN ---------- */
#splash { position: fixed; inset: 0; z-index: 4000; display: flex; flex-direction: column; align-items: center; justify-content: center;
          gap: 14px; background: linear-gradient(160deg, #2563EB, #1E3A8A); color: #fff; transition: opacity .35s, transform .35s; }
#splash .slogo { width: 96px; height: 96px; border-radius: 24px; background: #2563EB; border: 2px solid rgba(255,255,255,.25);
                display: flex; align-items: center; justify-content: center; font-size: 56px; line-height: 1;
                box-shadow: 0 12px 30px rgba(0,0,0,.3); animation: bob 1.6s ease-in-out infinite; }
#splash b { font-size: 1.6rem; letter-spacing: -.3px; }
#splash .spin { width: 22px; height: 22px; border-width: 3px; margin-top: 6px; }
#splash.out { opacity: 0; transform: scale(1.04); pointer-events: none; }

/* ---------- ANIMATIONS ---------- */
button, a { transition: background-color .15s, border-color .15s, color .15s, transform .12s, box-shadow .15s; }
button:active, .cta a:active, .links a:active, #quick button:active { transform: scale(.95); }
#tabs button:active { transform: scale(.92); }
#list.enter, #profile.enter { animation: viewIn .28s cubic-bezier(.2,.8,.2,1); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes pop { from { transform: translateY(14px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheetDown { to { transform: translateY(100%); } }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes dropIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes rowIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pinIn { from { opacity: 0; transform: translateY(-18px) scale(.7); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -16px) scale(.95); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes toastOut { to { opacity: 0; transform: translate(-50%, -10px); } }
@keyframes tabPop { 0% { transform: scale(.8); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes dealGlow { 0%, 100% { box-shadow: 0 0 0 0 rgba(245,166,35,0); } 50% { box-shadow: 0 0 10px 3px rgba(245,166,35,.65); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- DARK MODE ---------- */
html.dark { --bg: #0E1418; --card: #18212A; --ink: #E6EDF3; --muted: #93A1AD; --line: #2A3640; color-scheme: dark; }
html.dark .hero { background: linear-gradient(135deg, #17263A, #18212A); border-color: #25364D; }
html.dark .costbox { background: #121A20; }
html.dark .save { background: #22303A; }
html.dark .save.good, html.dark .savetag, html.dark .pill.green { background: #123222; color: #4ADE80; }
html.dark .save.bad, html.dark .pill.red { background: #3A1B1B; color: #F87171; }
html.dark .pill.amber { background: #3A2A10; color: #FBBF24; }
html.dark .pill.gray { background: #22303A; color: var(--muted); }
html.dark .pill.blue { background: #172A4D; color: #93B4FF; }
html.dark .tile.sel { background: #172A4D; }
html.dark .links .confirm { background: #123222; border-color: #1E4D33; color: #4ADE80; }
html.dark .cta .ghost { color: #7AA7FF; border-color: #3B6FE0; }
html.dark .prow select, html.dark .mini, html.dark .numwrap input, html.dark .rt-x, html.dark .dh .x, html.dark .dh .heartbtn { background: #22303A; }
html.dark .pauth input, html.dark .txt { background: #121A20; }
html.dark .sw { background: #3A4752; }
html.dark .rt-icon { background: rgba(91,140,255,.16); color: #7AA7FF; }
html.dark #toast { background: #E6EDF3; color: #0E1418; }
html.dark #tabs { background: rgba(20,28,35,.88); border-top-color: rgba(255,255,255,.06); }
html.dark #tabs button.on { background: rgba(91,140,255,.16); color: #7AA7FF; }
html.dark .tp .price, html.dark .tp .nm { background: #1E2A33; }
html.dark .tp .nm { color: #E6EDF3; }
html.dark .leaflet-container { background: #161E24; }
html.dark .leaflet-tile-pane .leaflet-tile { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.6); }  /* only the backup map */
html.dark .leaflet-control-zoom a { background: var(--card); color: var(--ink); border-color: var(--line); }
html.dark .leaflet-control-attribution { background: rgba(14,20,24,.7) !important; color: #8B98A5; }
html.dark .leaflet-control-attribution a { color: #9DB7E8; }
html.dark #splash { background: linear-gradient(160deg, #1E3A8A, #0E1418); }
