/* SafeRoute - app styles (Tailwind handles utilities; this covers map/nav widgets). */
:root { --safe: #10b981; --safe-dark: #059669; --ink: #0f172a; --panel: #ffffff; --panel-fg: #0f172a;
        --muted: #64748b; --line: #e2e8f0; --chip: #f1f5f9; }
body.night { --panel: #111827; --panel-fg: #f1f5f9; --muted: #94a3b8; --line: #243044; --chip: #1f2937; }
html, body, #map { height: 100%; margin: 0; }
body { font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
       overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
.panel { background: var(--panel); color: var(--panel-fg); }
.muted { color: var(--muted); }
.hairline { border-color: var(--line); }
.chip { background: var(--chip); color: var(--panel-fg); }
.hidden { display: none !important; }
.maplibregl-ctrl-top-right { top: 70px; }
body.navigating .maplibregl-ctrl-top-right { top: 150px; }

/* layer chips: unmistakable on/off state */
#home button[aria-pressed] { transition: background .15s, color .15s, opacity .15s; }
#home button[aria-pressed="true"] { background: #059669; color: #fff; }
#home button[aria-pressed="false"] { opacity: .8; }
#home button[aria-pressed="false"]::before { content: "○ "; }
#home button[aria-pressed="true"]::before { content: "● "; }

/* pins */
.pin { width: 20px; height: 20px; border-radius: 9999px; border: 3px solid #fff;
       box-shadow: 0 1px 5px rgba(0,0,0,.5); }
.pin-a { background: #3b82f6; }
.pin-b { width: 26px; height: 26px; background: #ef4444; border-radius: 50% 50% 50% 0;
         transform: rotate(-45deg); margin-bottom: 10px; }
.shield { width: 18px; height: 20px; background: #2563eb; border: 2px solid #fff;
          clip-path: polygon(50% 0, 100% 15%, 100% 60%, 50% 100%, 0 60%, 0 15%); cursor: pointer; }

/* user puck */
.puck { position: relative; width: 26px; height: 26px; }
.puck-dot { position: absolute; inset: 3px; background: #2563eb; border: 3px solid #fff;
            border-radius: 9999px; box-shadow: 0 1px 6px rgba(0,0,0,.45); }
.puck-pulse { position: absolute; inset: -6px; border-radius: 9999px; background: rgba(59,130,246,.35);
              animation: pulse 2s ease-out infinite; }
.puck-arrow { display: none; position: absolute; inset: 0; width: 26px; height: 26px; z-index: 2;
              filter: drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.puck.nav { width: 38px; height: 38px; }
.puck.nav .puck-dot { inset: 0; background: #1d4ed8; border-width: 4px; }
.puck.nav .puck-arrow { display: block; width: 38px; height: 38px; padding: 9px; box-sizing: border-box; }
.puck.nav .puck-pulse { display: none; }
@keyframes pulse { 0% { transform: scale(.5); opacity: .9; } 100% { transform: scale(1.8); opacity: 0; } }

/* floating UI */
.float-card { border-radius: 14px; box-shadow: 0 6px 24px rgba(15,23,42,.28); }
#searchPill { cursor: text; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -30px 0 0 -15px;
             pointer-events: none; z-index: 20; }
#crosshair::before { content: ""; position: absolute; inset: 0; background: #ef4444; border: 3px solid #fff;
                     border-radius: 50% 50% 50% 0; transform: rotate(-45deg); box-shadow: 0 2px 8px rgba(0,0,0,.5); }

/* bottom sheet */
#sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 30; border-radius: 20px 20px 0 0;
         box-shadow: 0 -6px 28px rgba(15,23,42,.3); max-height: 82vh; display: flex; flex-direction: column;
         transition: max-height .22s ease; }
@media (min-width: 768px) { #sheet { left: 16px; right: auto; bottom: 16px; width: 420px; border-radius: 18px; } }
#sheetBody { overflow-y: auto; overscroll-behavior: contain; }
.grab { width: 44px; height: 5px; border-radius: 9999px; background: var(--line); margin: 8px auto 4px;
        touch-action: none; cursor: grab; }
.route-card { border: 2px solid var(--line); border-radius: 14px; padding: 10px; text-align: left;
              transition: border-color .15s, box-shadow .15s; background: var(--panel); }
.route-card.sel-safest { border-color: var(--safe); box-shadow: 0 0 0 3px rgba(16,185,129,.2); }
.route-card.sel-fastest { border-color: #64748b; box-shadow: 0 0 0 3px rgba(100,116,139,.2); }
.badge { font-size: 10px; font-weight: 700; border-radius: 9999px; padding: 2px 8px; }
.pill { font-size: 12px; border-radius: 9999px; padding: 4px 10px; background: var(--chip); }
.seg { display: inline-flex; border-radius: 9999px; background: var(--chip); padding: 3px; }
.seg button { padding: 5px 14px; border-radius: 9999px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--safe); color: #fff; }
.cta { background: linear-gradient(180deg, #10b981, #059669); color: #fff; font-weight: 800; letter-spacing: .3px;
       border-radius: 14px; padding: 14px; width: 100%; font-size: 17px; box-shadow: 0 4px 14px rgba(5,150,105,.45); }
.cta:active { transform: scale(.985); }

/* search view */
#searchView { position: absolute; inset: 0; z-index: 50; overflow-y: auto; }
.field { border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; width: 100%;
         background: var(--panel); color: var(--panel-fg); outline: none; }
.field:focus { border-color: var(--safe); }
.result { display: flex; gap: 10px; padding: 10px 6px; border-bottom: 1px solid var(--line); cursor: pointer; }
.result:hover, .result:active { background: var(--chip); }

/* navigation */
#navTop { position: absolute; left: 8px; right: 8px; top: 8px; z-index: 40; border-radius: 16px; color: #fff;
          background: linear-gradient(135deg, #065f46, #047857); box-shadow: 0 6px 24px rgba(0,0,0,.4); }
@media (min-width: 768px) { #navTop { left: 16px; right: auto; width: 420px; top: 16px; } }
.turn-icon { width: 58px; height: 58px; flex: none; display: grid; place-items: center; }
.turn-icon svg { width: 52px; height: 52px; stroke: #fff; fill: none; stroke-width: 3; stroke-linecap: round;
                 stroke-linejoin: round; }
.safe-pill { font-size: 12px; font-weight: 600; border-radius: 9999px; padding: 3px 10px; background: rgba(255,255,255,.18); }
.safe-pill.warn { background: #f59e0b; color: #1f2937; }
#navList { max-height: 45vh; overflow-y: auto; background: var(--panel); color: var(--panel-fg); }
#navBottom { position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 40; border-radius: 18px; }
@media (min-width: 768px) { #navBottom { left: 16px; right: auto; width: 420px; bottom: 16px; } }
#recenter { position: absolute; right: 12px; bottom: 120px; z-index: 41; border-radius: 9999px; padding: 10px 16px;
            font-weight: 700; box-shadow: 0 4px 16px rgba(0,0,0,.35); }
#toast { position: absolute; left: 50%; transform: translateX(-50%); top: 76px; z-index: 80; max-width: 90vw;
         background: #111827; color: #fff; border-radius: 9999px; padding: 9px 18px; font-size: 14px;
         box-shadow: 0 4px 18px rgba(0,0,0,.4); }
body.navigating #toast { top: 150px; }
#sim { position: absolute; right: 10px; top: 50%; z-index: 45; }
.sim-panel { width: 230px; border-radius: 14px; padding: 10px; font-size: 12px; }
.sim-btn { border-radius: 8px; padding: 5px 9px; background: var(--chip); font-weight: 600; font-size: 12px; }
.sim-btn.on { background: var(--safe); color: #fff; }

