/* Shared styles for index / food / house / services / medical */
*{box-sizing:border-box;margin:0;padding:0}
html{-webkit-text-size-adjust:100%}
body{font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;background:#f1f5f9;color:#0f172a;min-height:100vh;display:flex;flex-direction:column;-webkit-tap-highlight-color:transparent}
button{font:inherit;color:inherit;background:none;border:0;cursor:pointer}
a{color:inherit}

/* ---------- header (persistent across pages) ---------- */
header{position:sticky;top:0;z-index:50;padding-top:env(safe-area-inset-top);background:#0f172a}
.nav0,.nav1{background:#0f172a}
.nav0 ul,#flags{list-style:none;display:flex;justify-content:center;align-items:center;gap:14px;padding:10px 16px;flex-wrap:wrap}
.nav0{padding-bottom:0}
.nav0 ul{padding-bottom:0}

/* flags & emoji share the exact same round 44px button */
.flag-btn,.emo{width:44px;height:44px;border-radius:50%;display:grid;place-items:center;position:relative;transition:transform .15s}
.flag-btn svg{width:40px;height:40px;border-radius:50%;display:block;box-shadow:0 0 0 2.5px #64748b}
.flag-btn:hover,.emo:hover{transform:scale(1.06)}
.flag-btn.active svg{box-shadow:0 0 0 2.5px #38bdf8,0 0 0 6px rgba(56,189,248,.35)}

.emo{text-decoration:none}
.emo span{width:40px;height:40px;border-radius:50%;display:grid;place-items:center;font-size:22px;line-height:1;background:#1e293b;box-shadow:0 0 0 2.5px #64748b;transition:box-shadow .2s}
.emo.active span{box-shadow:0 0 0 2.5px #38bdf8,0 0 0 6px rgba(56,189,248,.35)}
.emo.flash span{animation:ring 1.6s ease-out}
@keyframes ring{
  0%,40%,80%{box-shadow:0 0 0 2.5px #38bdf8,0 0 0 6px rgba(56,189,248,.35)}
  20%,60%{box-shadow:0 0 0 3px #fff,0 0 0 10px rgba(56,189,248,.75)}
  100%{box-shadow:0 0 0 2.5px #38bdf8,0 0 0 6px rgba(56,189,248,.35)}
}

.nav2{background:#1e293b;display:flex;justify-content:center;padding:10px 16px;box-shadow:0 2px 8px rgba(0,0,0,.25)}
/* same 6-column grid as the flags, so the circle sits directly below the first flag */
.nav2 .cols{display:grid;grid-template-columns:repeat(6,44px);gap:14px;align-items:center}
.ctrl{width:44px;height:44px;border-radius:12px;background:#334155;display:grid;place-items:center;border:2.5px solid transparent;transition:background .15s,border-color .15s}
.ctrl:hover{background:#3b4a61}
.ctrl.set{border-color:#22c55e}
.ctrl svg{width:30px;height:30px}
#btnInitials{color:#fff;font-weight:900;font-size:16px;letter-spacing:.5px}
#btnHeart{border-radius:50%}
.gcircle{width:28px;height:28px;border-radius:50%;background:var(--g,#93c5fd);box-shadow:inset 0 -3px 0 rgba(0,0,0,.15);transition:background .2s}

/* ---------- main ---------- */
main{width:100%;max-width:640px;margin:0 auto;padding:24px 16px 32px;flex:1}

/* per-page block (the only part swapped by the SPA router) */
#view:empty{display:none}
.pagebar{display:flex;align-items:center;gap:12px;margin-bottom:16px}
.back{display:inline-flex;align-items:center;gap:6px;height:40px;padding:0 14px 0 10px;border-radius:999px;background:#0f172a;color:#fff;font-weight:600;font-size:15px;text-decoration:none}
.back:hover{background:#1e293b}
.back b{font-size:20px;line-height:1}
.pagebar h1{font-size:20px;font-weight:700;display:flex;align-items:center;gap:8px}

/* initials picker */
#picker{overflow:hidden;max-height:0;transition:max-height .3s ease,margin .3s;margin-bottom:0}
#picker.open{max-height:360px;margin-bottom:16px}
.card{background:#fff;border-radius:16px;box-shadow:0 4px 16px rgba(15,23,42,.08)}
.picker-head{display:flex;justify-content:space-between;align-items:center;padding:12px 12px 8px 18px;font-weight:600}
#pickerClose{width:32px;height:32px;border-radius:50%;font-size:22px;color:#64748b}
#pickerClose:hover{background:#f1f5f9}
.grid-wrap{height:239px;overflow-y:auto;padding:9px 21px 16px}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(42px,1fr));gap:6px}
.grid button{height:34px;border-radius:8px;background:#f8fafc;border:1px solid #e2e8f0;font-size:13px;font-weight:600;color:#334155}
.grid button:hover{background:#e0f2fe}
.grid button.sel{background:#38bdf8;border-color:#38bdf8;color:#fff}

/* map (persistent across pages) */
#mapBox{position:relative;width:100%;aspect-ratio:1/1;border-radius:14px;overflow:hidden;background:#0f172a;box-shadow:0 10px 30px rgba(15,23,42,.18)}
#mapImg{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block;user-select:none;-webkit-user-drag:none}
#mapMsg{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;background:rgba(15,23,42,.55);color:#fff;font-weight:500;transition:opacity .4s}
#mapMsg svg{width:46px;height:46px;animation:spin 1s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
#mapBox.ready #mapMsg{opacity:0;pointer-events:none}
.acc{position:absolute;border-radius:50%;background:radial-gradient(circle,rgba(147,197,253,.28),rgba(147,197,253,.1) 70%);border:1.5px solid rgba(147,197,253,.55);transform:translate(-50%,-50%);pointer-events:none;display:none}
.dot{position:absolute;width:44px;height:44px;border-radius:50%;transform:translate(-50%,-50%);background:var(--g,#93c5fd);border:3px solid #fff;color:#fff;font-weight:800;font-size:14px;display:none;place-items:center;box-shadow:0 2px 10px rgba(0,0,0,.4);transition:background .2s}
#mapBox.ready .acc{display:block}
#mapBox.ready .dot{display:grid}
.dot .tip{position:absolute;bottom:calc(100% + 8px);left:50%;transform:translateX(-50%);background:#0f172a;color:#fff;padding:6px 10px;border-radius:8px;font-size:13px;font-weight:600;white-space:nowrap;display:none;gap:6px;align-items:center}
.dot .tip.on{display:flex}
.dot .tip a{text-decoration:none}
.dot .lbl{position:absolute;top:calc(100% + 6px);left:50%;transform:translateX(-50%);background:rgba(15,23,42,.85);color:#fff;padding:4px 8px;border-radius:6px;font-size:11px;line-height:1.3;white-space:nowrap;display:flex;flex-direction:column}
.dot.edge-l .tip,.dot.edge-l .lbl{left:-4px;transform:none}
.dot.edge-r .tip,.dot.edge-r .lbl{left:auto;right:-4px;transform:none}
#mapCoords{position:absolute;left:50%;bottom:9%;transform:translateX(-50%);background:rgba(15,23,42,.9);color:#fff;border-radius:10px;padding:6px 12px;display:none;align-items:center;gap:8px;box-shadow:0 4px 14px rgba(0,0,0,.35)}
#mapCoords.show{display:flex}
#mapCoords svg{width:18px;height:18px;flex:none}
#mapCoords .ll{font-weight:700;font-size:15px;white-space:pre}
#mapCoords .meta{font-size:12px;color:#cbd5e1}
#mapCoords div{display:flex;flex-direction:column}
.coords{text-align:center;color:#64748b;font-size:14px;margin-top:10px;font-variant-numeric:tabular-nums}
.hint{text-align:center;color:#94a3b8;font-size:13px;margin-top:4px}

/* donate */
.donate-wrap{display:flex;justify-content:center;margin-top:24px}
.donate{display:inline-flex;align-items:center;gap:8px;height:48px;padding:0 28px;border-radius:999px;background:#635bff;color:#fff;font-weight:600;font-size:17px;text-decoration:none;box-shadow:0 8px 20px rgba(99,91,255,.35);transition:transform .15s,background .15s}
.donate:hover{background:#5249f0;transform:translateY(-1px)}

/* footer */
footer{background:#0f172a;color:#e2e8f0;padding:24px 16px calc(24px + env(safe-area-inset-bottom))}
.foot{max-width:640px;margin:0 auto;display:flex;justify-content:space-between;align-items:center;gap:20px}
.foot img{height:72px;width:auto;border-radius:10px;display:block}
.foot .contacts{text-align:right;line-height:1.6}
.foot .contacts h3{font-size:15px;font-weight:700;color:#fff}
.foot .contacts small{display:block;color:#94a3b8;font-size:12px;text-transform:uppercase;letter-spacing:.06em}
.foot .contacts a{color:#7dd3fc;text-decoration:none;font-weight:600}
.foot .contacts a:hover{text-decoration:underline}

/* phone sheet */
.sheet-bg{position:fixed;inset:0;background:rgba(15,23,42,.45);display:none;align-items:flex-start;justify-content:center;padding-top:146px;z-index:80}
.sheet-bg.open{display:flex}
.sheet{background:#fff;border-radius:16px;padding:18px;width:min(349px,calc(100% - 32px));box-shadow:0 20px 50px rgba(0,0,0,.3)}
.sheet h2{font-size:16px;margin-bottom:13px}
.sheet input{width:100%;height:48px;border:2px solid #38bdf8;border-radius:10px;padding:0 12px;font-size:17px;outline:none}
.sheet .row{display:flex;justify-content:flex-end;gap:8px;margin-top:15px}
.btn-ghost,.btn-pri{height:39px;padding:0 16px;border-radius:10px;font-weight:600}
.btn-ghost{background:#f1f5f9}
.btn-pri{background:#0f172a;color:#fff}

/* toasts */
#toasts{position:fixed;left:50%;bottom:16px;transform:translateX(-50%);display:flex;flex-direction:column;gap:8px;z-index:90;width:min(420px,calc(100% - 24px));pointer-events:none}
.toast{background:#0f172a;color:#fff;border-radius:10px;border-left:5px solid var(--g);padding:10px 14px;display:flex;align-items:center;gap:12px;font-size:15px;position:relative;overflow:hidden;box-shadow:0 8px 24px rgba(0,0,0,.3);animation:tin .25s ease-out}
.toast i{width:22px;height:22px;border-radius:50%;background:#1e293b;display:grid;place-items:center;flex:none}
.toast i::after{content:"";width:12px;height:12px;border-radius:50%;background:var(--g)}
.toast::after{content:"";position:absolute;left:0;bottom:0;height:3px;background:var(--g);width:100%;animation:tbar 3s linear forwards}
@keyframes tin{from{opacity:0;transform:translateY(10px)}}
@keyframes tbar{to{width:0}}

@media (max-width:420px){
  .nav0 ul,#flags{gap:8px}
  .nav2 .cols{gap:8px}
  .foot img{height:56px}
}

/* address box (nav2, columns 4-6) */
.addr{grid-column:4 / 7;position:relative}
.addr input{width:100%;height:44px;border-radius:12px;border:2.5px solid #475569;background:#0f172a;color:#fff;padding:0 30px 0 10px;font-size:14px;outline:none;transition:border-color .15s}
.addr input::placeholder{color:#94a3b8}
.addr input:focus{border-color:#38bdf8}
.addr.ok input{border-color:#22c55e}
.addr.bad input{border-color:#ef4444}
.addr .st{position:absolute;right:9px;top:50%;transform:translateY(-50%);font-size:14px;font-weight:700;pointer-events:none}
.addr.ok .st{color:#22c55e}.addr.bad .st{color:#ef4444}
.addr.busy .st{width:14px;height:14px;border-radius:50%;border:2px solid #475569;border-top-color:#38bdf8;animation:spin .8s linear infinite}
.sugg{position:absolute;top:calc(100% + 6px);right:0;width:min(380px,calc(100vw - 24px));background:#fff;color:#0f172a;border-radius:12px;box-shadow:0 14px 34px rgba(0,0,0,.35);list-style:none;padding:6px;display:none;z-index:60;max-height:320px;overflow-y:auto}
.sugg.open{display:block}
.sugg li{padding:9px 10px;border-radius:8px;cursor:pointer;font-size:14px;line-height:1.3}
.sugg li small{display:block;color:#64748b;font-size:12px}
.sugg li.hi,.sugg li:hover{background:#e0f2fe}
.sugg li.none{color:#64748b;cursor:default;background:none}
.sugg .src{font-size:10px;color:#94a3b8;text-align:right;padding:4px 8px 0}

/* map circle: hover swaps GPS coordinates for the user's address */
.dot{cursor:pointer}
.dot .lbl .ad{display:none;width:max-content;max-width:220px;white-space:normal;font-weight:600;font-size:12px}
.dot:hover .lbl .ll,.dot.hov .lbl .ll{display:none}
.dot:hover .lbl .ad,.dot.hov .lbl .ad{display:block}
#mapBox.hov #mapCoords .ll{display:none}
#mapCoords .ad{display:none;font-weight:700;font-size:14px;max-width:300px}
#mapBox.hov #mapCoords .ad{display:block}
.dot .lbl .ll{display:flex;flex-direction:column}
