/* aapdaAlert citizen app.
   White theme. SF Pro on Apple devices, Inter elsewhere. 8-point spacing. Large touch targets. */
:root {
  /* colour */
  --bg: #ffffff; --fill: #f5f5f7; --fill-2: #ebebf0; --line: rgba(0, 0, 0, .1);
  --text: #1d1d1f; --text-2: #6e6e73; --text-3: #8e8e93;
  --red: #e0281e; --red-press: #c11f17; --red-soft: #fdeceb;
  --blue: #0071e3; --blue-soft: #e8f2fd;
  --green: #1d8a44; --green-soft: #e7f6ec;
  --orange: #c25e00; --orange-soft: #fff3e3;
  --purple: #7d4cdb; --purple-soft: #f1ebfd;
  --teal: #0b7f8c; --teal-soft: #e3f5f7;
  /* shape and space */
  --r-s: 10px; --r-m: 14px; --r-l: 18px; --r-xl: 24px;
  --gutter: 20px; --nav-h: 60px; --top-h: 52px;
  --app-h: 100dvh; /* the app's visible height: the whole screen on phones, the phone frame on wide screens */
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .06);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", system-ui, "Segoe UI", Roboto,
    "Noto Sans", "Noto Sans Devanagari", "Noto Sans Bengali", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 400 17px/1.47 var(--font); letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
body.has-overlay { overflow: hidden; }

/* ---------- type ---------- */
h1 { font-size: 32px; line-height: 1.15; font-weight: 700; letter-spacing: -.025em; margin: 8px 0 8px; }
h2 { font-size: 22px; line-height: 1.25; font-weight: 700; letter-spacing: -.02em; margin: 0 0 8px; }
h3 { font-size: 13px; line-height: 1.4; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--text-2); margin: 32px 0 8px; padding: 0 4px; }
p { margin: 0 0 12px; }
a { color: var(--blue); }
.muted { color: var(--text-2); } .small { font-size: 13px; line-height: 1.4; } .center { text-align: center; }
.big { font-size: 20px; font-weight: 600; letter-spacing: -.015em; }
.lead { font-size: 17px; color: var(--text-2); margin-bottom: 24px; }
.grow { flex: 1; min-width: 0; }

/* ---------- icons ---------- */
.ic { width: 1.3em; height: 1.3em; fill: currentColor; flex: none; display: inline-block; vertical-align: -.28em; }

/* ---------- layout helpers ---------- */
.row { display: flex; gap: 12px; align-items: center; margin-top: 16px; }
.row > .btn { flex: 1; }
.row.between { justify-content: space-between; margin-top: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.grid2 .btn { font-size: 15px; padding: 12px 10px; }
.grid2 .span2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.notice { display: flex; gap: 10px; background: var(--orange-soft); color: var(--text); padding: 12px 14px; border-radius: var(--r-m); font-size: 15px; line-height: 1.4; }
.notice .ic { color: var(--orange); margin-top: 1px; }

/* ---------- shell ---------- */
#app { max-width: 560px; margin: 0 auto; min-height: 100%; position: relative; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--top-h); display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--gutter); background: rgba(255, 255, 255, .86); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
}
#topleft { display: flex; align-items: center; }
.mark img { width: 32px; height: 32px; border-radius: 8px; display: block; }
.back { width: 36px; height: 36px; border-radius: 50%; background: var(--fill); color: var(--text); display: grid; place-items: center; margin-left: -4px; }
.back:active { background: var(--fill-2); }
.back .ic { width: 22px; height: 22px; }
.topright { display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--text); color: #fff; display: grid; place-items: center; font-size: 14px; font-weight: 600; text-decoration: none; }
.avatar .ic { width: 18px; height: 18px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); background: var(--fill); padding: 6px 11px 6px 9px; border-radius: 99px; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.pill.off::before { background: var(--orange); }
main { padding: 16px var(--gutter) calc(var(--nav-h) + env(safe-area-inset-bottom) + 32px); outline: none; }
.bottomnav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 560px; z-index: 20;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(255, 255, 255, .9); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--line);
}
.bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--text-3); font-size: 10.5px; font-weight: 500; letter-spacing: 0; }
.bottomnav a .ic { width: 25px; height: 25px; }
.bottomnav a.active { color: var(--red); font-weight: 600; }
.bottomnav a .ic-fill, .bottomnav a.active .ic-line { display: none; }
.bottomnav a.active .ic-fill { display: inline-block; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 12px 18px;
  border-radius: var(--r-m); border: 0; background: var(--fill); color: var(--text);
  font: 600 17px/1.2 var(--font); letter-spacing: -.01em; cursor: pointer; text-decoration: none; text-align: center;
  transition: transform .12s ease, background .12s ease;
}
.btn:active { transform: scale(.97); background: var(--fill-2); }
.btn.primary { background: var(--red); color: #fff; }
.btn.primary:active { background: var(--red-press); }
.btn.blue { background: var(--blue); color: #fff; }
.btn.call { background: var(--green); color: #fff; }
.btn.tint { background: var(--red-soft); color: var(--red); }
.btn.ghost { background: transparent; color: var(--blue); }
.btn.wide { width: 100%; margin-top: 12px; }
.btn.big-btn { min-height: 64px; font-size: 19px; border-radius: var(--r-l); }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: var(--text-2); cursor: pointer; font-size: 17px; flex: none; }
.icon-btn:active { background: var(--fill); }
.icon-btn .ic { width: 24px; height: 24px; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid rgba(0, 113, 227, .45); outline-offset: 2px; }

/* ---------- cards and lists ---------- */
.card { background: var(--bg); border: .5px solid var(--line); border-radius: var(--r-l); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.list { background: var(--fill); border-radius: var(--r-l); overflow: hidden; margin: 8px 0 24px; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; min-height: 60px; text-decoration: none; color: var(--text); position: relative; }
.list-row + .list-row::before { content: ""; position: absolute; top: 0; left: 66px; right: 0; border-top: .5px solid var(--line); }
.list-row:active { background: var(--fill-2); }
.list-row .sub { display: block; font-size: 13px; color: var(--text-2); line-height: 1.35; }
.list-row .end { color: var(--text-3); font-size: 15px; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.chip-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--bg); color: var(--text-2); }
.chip-ic .ic { width: 22px; height: 22px; }
.chip-ic.red { background: var(--red-soft); color: var(--red); } .chip-ic.blue { background: var(--blue-soft); color: var(--blue); }
.chip-ic.green { background: var(--green-soft); color: var(--green); } .chip-ic.orange { background: var(--orange-soft); color: var(--orange); }
.chip-ic.purple { background: var(--purple-soft); color: var(--purple); } .chip-ic.teal { background: var(--teal-soft); color: var(--teal); }
.num { font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; }

/* ---------- home ---------- */
.greet { margin: 4px 0 20px; }
.greet p { margin: 0 0 2px; font-size: 13px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--text-2); }
.greet h1 { margin: 0; }
.hero { display: flex; flex-direction: column; align-items: center; padding: 36px 0 8px; }
.sos-btn {
  width: min(58vw, 220px); aspect-ratio: 1; border-radius: 50%; border: 0; cursor: pointer; color: #fff;
  background: linear-gradient(160deg, #ff4b3e, var(--red) 55%, #c11f17);
  box-shadow: 0 0 0 12px rgba(224, 40, 30, .1), 0 0 0 28px rgba(224, 40, 30, .05), 0 18px 40px rgba(224, 40, 30, .32);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-family: var(--font); transition: transform .12s ease; animation: breathe 3s ease-in-out infinite;
}
.sos-btn:active { transform: scale(.96); }
.sos-text { font-size: 52px; font-weight: 800; letter-spacing: .04em; line-height: 1; }
.sos-sub { font-size: 14px; font-weight: 500; opacity: .92; max-width: 72%; line-height: 1.3; margin-top: 6px; }
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 12px rgba(224, 40, 30, .1), 0 0 0 28px rgba(224, 40, 30, .05), 0 18px 40px rgba(224, 40, 30, .32); }
  50% { box-shadow: 0 0 0 16px rgba(224, 40, 30, .1), 0 0 0 36px rgba(224, 40, 30, .04), 0 18px 40px rgba(224, 40, 30, .32); }
}
@media (prefers-reduced-motion: reduce) { .sos-btn { animation: none; } }
.locline { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 44px 0 0; font-size: 13px; color: var(--text-2); text-align: center; }
.locline .ic { width: 16px; height: 16px; color: var(--text-3); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 28px; }
.tile {
  background: var(--fill); border-radius: var(--r-l); padding: 16px; min-height: 104px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px; text-decoration: none; color: var(--text);
  font-size: 15px; font-weight: 600; line-height: 1.25; letter-spacing: -.01em; transition: transform .12s ease, background .12s ease;
}
.tile:active { transform: scale(.97); background: var(--fill-2); }
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-l); margin-bottom: 16px; background: var(--orange-soft); font-size: 15px; line-height: 1.4; }
.alert .ic { color: var(--orange); width: 22px; height: 22px; margin-top: 1px; }
.alert.severe { background: var(--red-soft); } .alert.severe .ic { color: var(--red); }
.alert b { display: block; font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: var(--orange); margin-bottom: 2px; }
.alert.severe b { color: var(--red); }
.sos-card h2 { display: flex; align-items: center; gap: 8px; font-size: 19px; margin: 0; }
.sos-card h2 .ic { color: var(--red); }
.badge { background: var(--red-soft); color: var(--red); padding: 5px 10px; border-radius: 99px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.sos-card.dispatched .badge { background: var(--blue-soft); color: var(--blue); }
.sos-card.rescued .badge { background: var(--green-soft); color: var(--green); }
.sos-card.cancelled .badge { background: var(--fill); color: var(--text-2); }
.track { list-style: none; padding: 0; margin: 20px 0 12px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; font-size: 11.5px; line-height: 1.3; }
.track li { border-top: 4px solid var(--fill-2); border-radius: 2px; padding-top: 8px; color: var(--text-3); }
.track li.done { border-color: var(--green); color: var(--text); font-weight: 600; }

/* ---------- tabs, guides ---------- */
.tabs { display: flex; padding: 3px; background: var(--fill); border-radius: 12px; margin: 16px 0 24px; }
.tab { flex: 1; min-height: 38px; border-radius: 9px; border: 0; background: transparent; color: var(--text); font: 500 14px var(--font); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; padding: 0 6px; }
.tab.on { background: var(--bg); font-weight: 600; box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.tab .ic { width: 18px; height: 18px; }
.guide { padding: 20px 20px 12px; }
.guide-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px; }
.tile-sub { display: block; font-size: 12px; font-weight: 400; color: var(--text-2); margin-top: 2px; }
.guide-head { display: flex; align-items: center; gap: 12px; margin: 8px 0 16px; }
.guide-head h1 { margin: 0; font-size: 26px; }
.guide-head .chip-ic { width: 48px; height: 48px; border-radius: 14px; }
.guide-head .chip-ic .ic { width: 28px; height: 28px; }
.guide .steps li { line-height: 1.45; }
.guide.topic { position: relative; padding-top: 16px; }
.guide.topic .read { position: absolute; top: 6px; right: 6px; }
.guide.topic .steps { margin-top: 0; padding-right: 36px; }
.guide h2 { font-size: 19px; display: flex; align-items: center; gap: 8px; margin: 0; }
.guide .dot-mark { width: 10px; height: 10px; border-radius: 50%; background: var(--text-3); }
.guide.before .dot-mark { background: var(--blue); } .guide.during .dot-mark { background: var(--red); } .guide.after .dot-mark { background: var(--green); }
.steps { list-style: none; counter-reset: s; padding: 0; margin: 12px 0 0; }
.steps li { counter-increment: s; position: relative; padding: 0 0 14px 40px; line-height: 1.4; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: -1px; width: 26px; height: 26px; border-radius: 50%; background: var(--fill); color: var(--text-2); font-size: 13px; font-weight: 700; display: grid; place-items: center; }

/* ---------- intro and forms ---------- */
.intro { min-height: calc(var(--app-h) - var(--top-h) - 32px); display: flex; }
.intro-card { width: 100%; display: flex; flex-direction: column; text-align: center; padding: 24px 0 112px; }
.intro-card.left { text-align: left; }
.intro-body { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.hero-ic { width: 88px; height: 88px; margin: 0 auto 28px; border-radius: 24px; display: grid; place-items: center; background: var(--red-soft); color: var(--red); }
.hero-ic .ic { width: 46px; height: 46px; }
.hero-ic.blue { background: var(--blue-soft); color: var(--blue); } .hero-ic.green { background: var(--green-soft); color: var(--green); }
.hero-logo { width: 88px; height: 88px; border-radius: 22px; margin: 0 auto 24px; display: block; box-shadow: 0 12px 28px rgba(224, 40, 30, .28); }
.wordmark { font-size: 34px; font-weight: 600; letter-spacing: -.03em; margin: 0 0 6px; }
.wordmark b { color: var(--red); font-weight: 700; }
.consent { display: flex; gap: 12px; background: var(--fill); padding: 16px; border-radius: var(--r-l); text-align: left; font-size: 14px; line-height: 1.45; color: var(--text-2); margin: 8px 0 24px; }
.consent .ic { color: var(--blue); width: 22px; height: 22px; }
.choice { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 0 16px; border: 0; background: transparent; color: var(--text); font: 500 17px var(--font); cursor: pointer; text-align: left; position: relative; }
.choice + .choice::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--line); }
.choice .ic { color: var(--red); margin-left: auto; visibility: hidden; }
.choice.on .ic { visibility: visible; }
.choice.on { font-weight: 600; }
.dots { display: flex; gap: 6px; justify-content: center; margin: 28px 0; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--fill-2); transition: width .2s ease; }
.dot.now { background: var(--text); width: 20px; border-radius: 99px; } .dot.done { background: var(--green); }
.form { display: flex; flex-direction: column; gap: 16px; margin-top: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
input, textarea, select {
  font: 400 17px/1.3 var(--font); color: var(--text); background: var(--fill); border: 0; border-radius: var(--r-m); padding: 14px 14px; min-height: 50px; width: 100%;
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
textarea { resize: vertical; }
.counter { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; font-size: 16px; font-weight: 500; color: var(--text); background: var(--fill); border-radius: var(--r-m); padding: 6px 6px 6px 14px; min-height: 56px; }
.stepper { display: flex; align-items: center; gap: 2px; }
.stepper button { width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--bg); color: var(--text); cursor: pointer; display: grid; place-items: center; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.stepper button:active { background: var(--fill-2); }
.stepper input { width: 44px; min-height: 40px; padding: 0; text-align: center; background: transparent; font-weight: 600; -moz-appearance: textfield; appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.counters { display: flex; flex-direction: column; gap: 8px; }
.contact { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sos-float {
  position: fixed; right: 20px; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 30; width: 68px; height: 68px; border-radius: 50%; border: 0;
  background: var(--red); color: #fff; font: 800 18px var(--font); letter-spacing: .03em; box-shadow: 0 10px 24px rgba(224, 40, 30, .4); cursor: pointer;
}

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: var(--bg); overflow-y: auto; display: flex; justify-content: center; }
.overlay > * { width: 100%; max-width: 560px; }
.overlay.sheet { background: rgba(0, 0, 0, .4); align-items: flex-end; }
.overlay.sheet > .card { margin: 0; border: 0; border-radius: var(--r-xl) var(--r-xl) 0 0; max-height: calc(var(--app-h) * .92); overflow-y: auto; padding: 12px var(--gutter) calc(24px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 40px rgba(0, 0, 0, .18); }
.sheet > .card::before { content: ""; display: block; width: 36px; height: 5px; border-radius: 3px; background: var(--fill-2); margin: 0 auto 20px; }
.overlay.heli { background: rgba(0, 0, 0, .45); align-items: center; padding: var(--gutter); }
.heli-card { text-align: center; padding: 28px 20px 20px; border-radius: var(--r-xl); }
.heli-card .steps { text-align: left; margin-top: 20px; }

/* danger mode */
.danger { padding: 16px var(--gutter) calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; min-height: 100%; }
.danger-bar { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.danger-bar .back { border: 0; cursor: pointer; margin-left: 0; flex: none; }
.progress { display: flex; gap: 6px; flex: 1; }
.progress span { flex: 1; height: 5px; border-radius: 3px; background: var(--fill-2); }
.progress span.done { background: var(--green); } .progress span.now { background: var(--text); }
.danger-hint { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 14px; font-weight: 500; color: var(--text-2); }
.danger-hint.sent { color: var(--green); }
.danger-hint .ic { width: 18px; height: 18px; }
.danger-q { font-size: 30px; line-height: 1.15; font-weight: 700; letter-spacing: -.025em; margin: 20px 0 24px; }
.danger-wait { display: grid; place-items: center; min-height: calc(var(--app-h) * .6); }
.opts { display: flex; flex-direction: column; gap: 10px; }
.opts.compact { display: grid; grid-template-columns: 1fr 1fr; }
.opt {
  display: flex; align-items: center; gap: 14px; min-height: 68px; padding: 12px 16px; text-align: left;
  border-radius: var(--r-l); border: 2px solid transparent; background: var(--fill); color: var(--text);
  font: 600 18px/1.25 var(--font); letter-spacing: -.01em; cursor: pointer; transition: transform .1s ease, background .1s ease;
}
.opt:active { transform: scale(.98); background: var(--fill-2); }
.opt.on { border-color: var(--red); background: var(--red-soft); }
.opt .chip-ic { width: 44px; height: 44px; border-radius: 12px; }
.opt .chip-ic .ic { width: 26px; height: 26px; }
.opt.on .chip-ic { color: var(--red); }
.opts.compact .opt { min-height: 60px; font-size: 15px; padding: 10px 12px; gap: 10px; }
.opts.compact .opt .chip-ic { width: 36px; height: 36px; }
.danger-foot { margin-top: auto; padding-top: 24px; display: flex; flex-direction: column; gap: 10px; }
.danger-actions { display: flex; gap: 10px; }
.danger-actions .btn { flex: 1; min-height: 56px; }
.dothis h2 { display: flex; align-items: center; gap: 8px; font-size: 26px; margin-bottom: 16px; }
.dothis h2 .ic { color: var(--red); }
.dothis .steps li { font-size: 17px; font-weight: 500; }
.dothis .steps li::before { background: var(--red-soft); color: var(--red); }
.spinner { width: 34px; height: 34px; margin: 40px auto; border-radius: 50%; border: 3px solid var(--fill-2); border-top-color: var(--text-2); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* strobe */
.strobe-layer { background: #000; }
.strobe { position: fixed; inset: 0; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; }
.strobe.lit { background: #fff; color: #000; }
.strobe-msg { text-align: center; padding: 16px 28px; max-width: 520px; }
.strobe-msg h2 { font-size: 36px; margin-bottom: 16px; }
.strobe-msg p { font-size: 17px; }
.strobe-stop { position: absolute; bottom: calc(32px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); min-width: 180px; background: #1d1d1f; color: #fff; }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; height: calc(var(--app-h) - var(--top-h) - var(--nav-h) - env(safe-area-inset-bottom) - 48px); }
.chat-head { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: .5px solid var(--line); }
.chat-head h1 { font-size: 22px; margin: 0 0 2px; }
.companion { width: 28px; height: 28px; border-radius: 50%; flex: none; display: block; }
.companion.big { width: 48px; height: 48px; }
.companion.gap { visibility: hidden; }
.msg-row { display: flex; align-items: flex-end; gap: 8px; align-self: flex-start; max-width: 92%; }
.msg-row .msg { max-width: 100%; }
.chat-head p { display: flex; align-items: center; gap: 6px; margin: 0; }
.chat-head p .ic { width: 14px; height: 14px; }
.chat-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 12px 0; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 20px; font-size: 16px; line-height: 1.4; display: flex; gap: 6px; align-items: flex-end; flex-wrap: wrap; }
.msg.ai { background: var(--fill); align-self: flex-start; border-bottom-left-radius: 6px; }
.msg.me { background: var(--blue); color: #fff; align-self: flex-end; border-bottom-right-radius: 6px; }
.msg.danger-msg.ai { background: var(--red-soft); }
.msg.danger-msg.me { background: var(--red); }
.msg.note { background: var(--orange-soft); max-width: 100%; }
.msg-text { flex: 1; min-width: 0; }
.speak-btn { background: none; border: 0; cursor: pointer; padding: 0; width: 28px; height: 24px; color: var(--text-3); display: grid; place-items: center; flex: none; }
.speak-btn .ic { width: 18px; height: 18px; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; width: 100%; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 0; background: var(--bg); color: var(--text); border-radius: 99px; padding: 8px 14px; font: 500 14px var(--font); cursor: pointer; min-height: 38px; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.chip .ic { width: 18px; height: 18px; color: var(--text-2); }
.typing { width: auto; }
.typing span { display: inline-block; width: 7px; height: 7px; margin: 5px 1px; border-radius: 50%; background: var(--text-3); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.chat-foot { display: flex; flex-direction: column; gap: 10px; padding-top: 8px; }
.chat-bar { display: flex; gap: 8px; align-items: flex-end; background: var(--fill); border-radius: 24px; padding: 4px 4px 4px 16px; }
.chat-input { resize: none; max-height: 120px; background: transparent; padding: 11px 0; min-height: 44px; border-radius: 0; }
.chat-bar .icon-btn { width: 40px; height: 40px; margin-bottom: 2px; }
.icon-btn.send { background: var(--blue); color: #fff; }
.icon-btn.send .ic { width: 20px; height: 20px; }
.icon-btn.on { background: var(--red-soft); color: var(--red); }

/* ---------- map ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 4px 0 14px; font-size: 13px; color: var(--text-2); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--orange); }
.legend-dot.camp { background: var(--green); } .legend-dot.unit { background: var(--blue); }
.map-wrap { position: relative; margin-bottom: 4px; }
.map { height: calc(var(--app-h) * .46); min-height: 280px; max-height: 460px; border-radius: var(--r-l); z-index: 1; background: var(--fill); overflow: hidden; }
.map-btn { position: absolute; right: 12px; bottom: 28px; z-index: 5; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--bg); color: var(--blue); display: grid; place-items: center; cursor: pointer; box-shadow: 0 2px 10px rgba(0, 0, 0, .2); }
.map-btn .ic { width: 22px; height: 22px; }
.list-row.as-btn { width: 100%; border: 0; background: transparent; font: inherit; letter-spacing: inherit; text-align: left; cursor: pointer; }
.leaflet-control-attribution { font-size: 10px; background: rgba(255, 255, 255, .8) !important; border-radius: 6px 0 0 0; }
.pin { background: #fff; border-radius: 50%; display: grid !important; place-items: center; box-shadow: 0 2px 8px rgba(0, 0, 0, .28); color: var(--orange); }
.pin .ic { width: 20px; height: 20px; vertical-align: 0; }
.pin.confirmed { background: var(--red); color: #fff; }
.pin.camp { color: var(--green); }
.pin.unit { background: var(--blue); color: #fff; }
.leaflet-container { font-family: var(--font); }
.leaflet-popup-content-wrapper { border-radius: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
.leaflet-popup-content { margin: 12px 14px; font-size: 14px; line-height: 1.4; color: var(--text); }
.leaflet-popup-content .ic { width: 16px; height: 16px; vertical-align: -.2em; }
.file-label { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-weight: 600; color: var(--blue); cursor: pointer; min-height: 44px; }
.file-label input { display: none; }
.photo-preview { display: none; max-width: 100%; max-height: 180px; border-radius: var(--r-m); margin-top: 8px; }

/* ---------- compass ---------- */
.compass-card { text-align: center; padding: 24px 20px; }
.compass-card h2 { font-size: 17px; font-weight: 600; }
.compass { position: relative; width: 200px; height: 200px; margin: 20px auto; }
.ring { position: absolute; inset: 0; border-radius: 50%; background: var(--fill); }
.ring .n { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); font-size: 13px; font-weight: 700; color: var(--red); }
.arrow { position: absolute; inset: 0; display: grid; place-items: center; color: var(--red); transition: transform .3s ease; }
.arrow .ic { width: 96px; height: 96px; }

/* ---------- weather, official alerts ---------- */
.weather { display: flex; align-items: center; gap: 14px; background: var(--blue-soft); border-radius: var(--r-l); padding: 14px 16px; margin-bottom: 16px; }
.weather.warn { background: var(--red-soft); }
.wx-ic { width: 44px; height: 44px; border-radius: 12px; background: var(--bg); color: var(--blue); display: grid; place-items: center; flex: none; }
.weather.warn .wx-ic { color: var(--red); }
.wx-ic .ic { width: 26px; height: 26px; }
.wx-top { display: flex; align-items: baseline; gap: 8px; font-size: 16px; font-weight: 500; }
.wx-temp { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.wx-sub { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.wx-warn { display: flex; gap: 6px; align-items: center; margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--red); }
.wx-warn .ic { width: 16px; height: 16px; }
.wx-when { font-size: 11px; color: var(--text-3); text-align: right; line-height: 1.3; }
.official { margin-top: 32px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-head h3 { margin: 0 0 8px; }
.section-head .small { font-size: 11px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 15px; line-height: 1.35; }
.source { display: flex; align-items: center; gap: 6px; margin-top: -12px; }
.source .ic { width: 16px; height: 16px; }

/* ---------- people nearby ---------- */
.tabs.seg { margin: 0 0 12px; }
.chat-wrap .chat { height: calc(var(--app-h) - var(--top-h) - var(--nav-h) - env(safe-area-inset-bottom) - 100px); }
.people-note { margin: 0 0 4px; line-height: 1.45; }
.people-note .ic { width: 14px; height: 14px; }
.people-note .mesh { color: var(--text-3); }
.people-empty { margin: auto 0; padding: 24px 12px; }
.pmsg { align-self: flex-start; max-width: 85%; background: var(--fill); border-radius: 18px; border-bottom-left-radius: 6px; padding: 8px 12px 10px; }
.pmsg.me { align-self: flex-end; background: var(--blue); color: #fff; border-radius: 18px; border-bottom-right-radius: 6px; }
.pmsg.kind-help:not(.me) { background: var(--red-soft); }
.pmsg.kind-safe:not(.me) { background: var(--green-soft); }
.pmeta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); margin-bottom: 2px; }
.pmsg.me .pmeta { color: rgba(255, 255, 255, .8); }
.pmeta .ic { width: 15px; height: 15px; }
.flag-btn { margin-left: auto; background: none; border: 0; padding: 2px; color: var(--text-3); cursor: pointer; display: grid; place-items: center; }
.quick-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.quick-row .chip { white-space: nowrap; background: var(--fill); box-shadow: none; }

/* ---------- feature tour ---------- */
.tour-card { background: var(--fill); border-radius: var(--r-l); padding: 18px; margin-bottom: 12px; }
.tour-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.tour-head h2 { font-size: 18px; margin: 0; }
.tour-card p { font-size: 15px; line-height: 1.45; color: var(--text-2); margin-bottom: 14px; }
.tour-card > .btn, .tour-card .stack > .btn { width: 100%; }
.tour-card .btn { background: var(--bg); }
.tour-card .btn.primary { background: var(--red); } .tour-card .btn.blue { background: var(--blue); }
.switch-row { display: flex; align-items: center; gap: 12px; background: var(--bg); border-radius: var(--r-m); padding: 12px 14px; font-size: 15px; }
.switch { width: 52px; height: 32px; border-radius: 99px; border: 0; background: var(--fill-2); position: relative; cursor: pointer; flex: none; transition: background .2s ease; }
.switch span { position: absolute; top: 2px; left: 2px; width: 28px; height: 28px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .2); transition: transform .2s ease; }
.switch.on { background: var(--orange); } .switch.on span { transform: translateX(20px); }
.lang-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tour-link { display: flex; align-items: center; gap: 12px; margin-top: 24px; padding: 14px 16px; border-radius: var(--r-l); background: var(--fill); text-decoration: none; color: var(--text); font-size: 15px; font-weight: 600; }
.tour-link .end { margin-left: auto; color: var(--text-3); }

#toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px); transform: translate(-50%, 20px); opacity: 0; z-index: 90;
  background: rgba(29, 29, 31, .94); color: #fff; padding: 12px 18px; border-radius: 14px; font-size: 15px; max-width: min(90vw, 500px); transition: .25s; pointer-events: none; text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Softer map colours so pins stand out */
.soft-tiles { filter: saturate(.3) brightness(1.05) contrast(.96); }

/* ---------- wide screens: phone frame ---------- */
/* On laptops and desktops the app is shown inside a phone-sized frame that always fits the window,
   and scrolls inside the frame like a real phone. Phones are not affected. */
@media (min-width: 820px) {
  html, body { height: 100%; overflow: hidden; }
  body {
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(1200px 600px at 50% -10%, #fdeceb 0%, rgba(253, 236, 235, 0) 60%), #f1f2f5;
  }
  #app {
    --app-h: min(860px, calc(100dvh - 48px));
    width: 400px; height: var(--app-h); min-height: 0; margin: 0;
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--bg); border-radius: 44px;
    box-shadow: 0 0 0 10px #1d1d1f, 0 0 0 11px #48484a, 0 40px 90px rgba(0, 0, 0, .25);
    /* Makes fixed-position parts (bottom bar, popups, SOS button, toasts) stay inside the frame */
    transform: translateZ(0);
  }
  #app > .topbar { position: relative; flex: none; padding-top: 6px; }
  #app > main { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  #app .bottomnav { padding-bottom: 8px; height: calc(var(--nav-h) + 8px); }
  .overlay { border-radius: 44px; }
  .overlay.sheet > .card { border-radius: var(--r-xl) var(--r-xl) 44px 44px; }
}
