/* Still Here — public app. Built on the Apple HIG web tokens in css/apple/ (efey1ldirim/apple-skill, MIT).
   Rules (DESIGN.md): binary canvas · groups not cards · status is a dot and a word · one filled button per screen ·
   no uppercase eyebrows · Lucide icons · glass only on the functional layer · one column. */
:root {
  --canvas: #F5F5F7; --group: #FFFFFF; --elev: #FFFFFF; --label: #1D1D1F; --label2: #6E6E73; --label3: rgb(60 60 67 / .42);
  --hair: rgb(0 0 0 / .08); --fill: rgb(120 120 128 / .12); --fill2: rgb(120 120 128 / .2); --thumb: #FFFFFF;
  --accent: var(--apple-blue); --red: var(--apple-red); --orange: var(--apple-orange); --green: var(--apple-green); --gray: var(--apple-gray);
  --group-shadow: 0 1px 2px rgb(0 0 0 / .05);
  --q0: #EEF8F1; --q1: #BFE6CB; --q2: #8ED2A4; --q3: #55B77B; --q4: #2C9757; --q5: #15703C; --nodata: #D8D8DC; --nodata-line: #C2C2C8; --flow: #0088FF; --st-reached: var(--apple-green); --st-going: var(--apple-orange); --st-nobody: var(--apple-red); --group-solid: #FFFFFF;
  --land: #E5E5EA; --edge: rgb(0 0 0 / .2); --outline: #8E8E93; --sel: #1D1D1F; --bg-map: #FFFFFF;
  --wa-bg: #efeae2; --wa-in: #ffffff; --wa-out: #d9fdd3; --wa-sys: #fff3c4; --wa-ink: #111b21; --wa-ink2: #667781; --wa-sys-ink: #54410b; --mesh-bg: #0c1220; --mesh-in: #16213a; --mesh-out: #1f3b2d;
  --btn-prominent-bg: #1D1D1F; --btn-prominent-fg: #FFFFFF; --ease: cubic-bezier(.32, .72, 0, 1);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --canvas: #08080A; --group: rgb(255 255 255 / .055); --elev: #1C1C1E; --label: #F5F5F7; --label2: rgb(235 235 245 / .62); --label3: rgb(235 235 245 / .36);
  --hair: rgb(255 255 255 / .08); --fill: rgb(120 120 128 / .24); --fill2: rgb(120 120 128 / .36); --thumb: #48484A; --group-shadow: none;
  --q0: #1C2B21; --q1: #1D4830; --q2: #236C44; --q3: #2E9459; --q4: #4BBA72; --q5: #89DEA3; --nodata: #3A3A3E; --nodata-line: #4A4A50; --flow: #0091FF; --group-solid: #1C1C1E; --land: #2c2c30; --edge: rgb(0 0 0 / .55); --outline: #636366; --sel: #F5F5F7; --bg-map: #141416;
  --wa-bg: #0b141a; --wa-in: #202c33; --wa-out: #005c4b; --wa-sys: #182229; --wa-ink: #e9edef; --wa-ink2: #8696a0; --wa-sys-ink: #ffd279; --btn-prominent-bg: #F5F5F7; --btn-prominent-fg: #1D1D1F;
} }
:root[data-theme="dark"] {
  --canvas: #08080A; --group: rgb(255 255 255 / .055); --elev: #1C1C1E; --label: #F5F5F7; --label2: rgb(235 235 245 / .62); --label3: rgb(235 235 245 / .36);
  --hair: rgb(255 255 255 / .08); --fill: rgb(120 120 128 / .24); --fill2: rgb(120 120 128 / .36); --thumb: #48484A; --group-shadow: none;
  --q0: #1C2B21; --q1: #1D4830; --q2: #236C44; --q3: #2E9459; --q4: #4BBA72; --q5: #89DEA3; --nodata: #3A3A3E; --nodata-line: #4A4A50; --flow: #0091FF; --group-solid: #1C1C1E; --land: #2c2c30; --edge: rgb(0 0 0 / .55); --outline: #636366; --sel: #F5F5F7; --bg-map: #141416;
  --wa-bg: #0b141a; --wa-in: #202c33; --wa-out: #005c4b; --wa-sys: #182229; --wa-ink: #e9edef; --wa-ink2: #8696a0; --wa-sys-ink: #ffd279; --btn-prominent-bg: #F5F5F7; --btn-prominent-fg: #1D1D1F;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--canvas); color: var(--label); font: 15px/1.47 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; letter-spacing: -.01em; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
p { margin: 0 0 8px; }
h1, h2, h3 { margin: 0; }
.ic { flex: none; display: inline-block; vertical-align: middle; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* type */
.title { font-size: 34px; font-weight: 600; letter-spacing: -.022em; line-height: 1.1; }
.lede { font-size: 17px; color: var(--label2); margin: 6px 0 0; max-width: 34em; }
.h2 { font-size: 22px; font-weight: 600; letter-spacing: -.021em; line-height: 1.2; }
.h3 { font-size: 17px; font-weight: 600; letter-spacing: -.015em; }
.sub { font-size: 15px; color: var(--label2); }
.fn { font-size: 13px; color: var(--label2); line-height: 1.4; }
.mono { font-variant-numeric: tabular-nums; }
.secthead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 34px 0 10px; padding: 0 4px; }
.secthead .h2 { font-size: 20px; }
.secthead a, .secthead button.link { font-size: 15px; }
.foot { font-size: 13px; color: var(--label2); padding: 8px 16px 0; line-height: 1.45; }

/* shell */
.shell { display: grid; grid-template-columns: 244px minmax(0, 1fr) 360px; grid-template-rows: minmax(0, 1fr); height: 100vh; }
.sidebar { height: 100vh; min-height: 0; overflow-y: auto; padding: 18px 12px; display: flex; flex-direction: column; background: var(--glass-bg); -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter); border-right: 1px solid var(--hair); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; }
.brand .mark { width: 30px; height: 30px; border-radius: 8px; background: #1D1D1F; display: grid; place-items: center; }
.brand .mark i { width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px var(--apple-green); }
.brand b { display: block; font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.brand span { display: block; font-size: 12.5px; color: var(--label2); }
.nav a { display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 6px 10px; margin: 1px 0; border-radius: 8px; color: var(--label); font-size: 14px; font-weight: 500; }
.nav a .ic { color: var(--accent); }
.nav a:hover { background: var(--fill); }
.nav a.on { background: var(--fill2); }
.nav .sec { font-size: 12px; font-weight: 600; color: var(--label2); padding: 16px 10px 4px; }
.sidebar .aside-foot { margin-top: auto; padding: 12px 10px 4px; font-size: 12.5px; color: var(--label2); line-height: 1.45; }
.main { height: 100vh; min-height: 0; overflow-y: auto; position: relative; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 8px 24px; background: var(--glass-bg); -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter); border-bottom: 1px solid var(--hair); }
.topbar .status { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500; min-width: 0; }
.topbar .status .ic { color: var(--green); }
.topbar .status .short { display: none; }
.topbar .tools { display: flex; align-items: center; gap: 8px; flex: none; }
.content { max-width: 46rem; margin: 0 auto; padding: 30px 24px 80px; container-type: inline-size; }
.content.wide { max-width: 62rem; }
.inspector { height: 100vh; min-height: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--elev); border-left: 1px solid var(--hair); }
.inspector .tabs { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--hair); }
.inspector .pane { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; }
.inspector .closer { display: none; }

/* phone mode */
/* The top bar stays in phone mode so Desktop is always one click away; the frame is scaled to fit the window (fitDevice in app.js) */
body.phone .main { display: flex; flex-direction: column; align-items: center; padding: 0 0 20px; }
body.phone .topbar { align-self: stretch; }
body.phone .content-desktop { display: none; }
body.phone .device { margin-top: 18px; transform-origin: top center; }
.device { display: none; }
body.phone .device { display: block; width: 393px; height: 852px; flex: none; background: #0b0b0f; border-radius: 54px; padding: 12px; box-shadow: 0 30px 60px -30px rgb(0 0 0 / .45), inset 0 0 0 2px #2a2a30; position: relative; }
.device .island { position: absolute; top: 24px; left: 50%; transform: translateX(-50%); width: 120px; height: 34px; background: #0b0b0f; border-radius: 20px; z-index: 4; }
.device .screen { background: var(--canvas); border-radius: 44px; height: 100%; overflow: hidden; display: flex; flex-direction: column; }
.device .sbar { height: 54px; display: flex; align-items: flex-end; justify-content: space-between; padding: 0 30px 8px; font-size: 14px; font-weight: 600; }
.device .pcontent { flex: 1; overflow-y: auto; padding: 6px 16px 100px; container-type: inline-size; }
.device .pcontent::-webkit-scrollbar { width: 0; }
.device .tabbar { position: absolute; left: 22px; right: 22px; bottom: 26px; display: flex; padding: 6px; border-radius: 30px; z-index: 3; }
.device .tabbar a { flex: 1; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10px; font-weight: 600; color: var(--label2); border-radius: 24px; }
.device .tabbar a.on { color: var(--accent); background: var(--fill); }
body.phone .device .title { font-size: 30px; }
body.phone .device .stats { grid-template-columns: 1fr 1fr; }
body.phone .device .btn { min-height: 44px; }
body:not(.phone) .device { display: none; }

/* groups and rows */
.group { background: var(--group); border-radius: 18px; box-shadow: var(--group-shadow); overflow: hidden; }
.group + .group, .group + .foot + .group { margin-top: 14px; }
.r { position: relative; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 16px; color: var(--label); width: 100%; text-align: left; background: transparent; border: 0; font: inherit; }
.r + .r::before, .r + details > .r::before, details + .r::before, details + details > .r::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--hair); }
.r.t + .r::before, .group.tiles .r + .r::before, .group.tiles details + .r::before, .group.tiles .r + details > .r::before, .group.tiles details + details > .r::before { left: 56px; }
a.r:hover, button.r:hover, summary.r:hover { background: rgb(120 120 128 / .07); }
.r .tt { flex: 1; min-width: 0; }
.r .tt b { display: block; font-size: 16px; font-weight: 500; letter-spacing: -.01em; line-height: 1.3; }
.r .tt span { display: block; font-size: 13px; color: var(--label2); line-height: 1.4; margin-top: 1px; }
.r .val { font-size: 15px; color: var(--label2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.r .chev { color: var(--label3); }
.tile { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex: none; }
.tile.lg { width: 44px; height: 44px; border-radius: 11px; }
.tile.red { background: var(--apple-red); } .tile.orange { background: var(--apple-orange); } .tile.green { background: var(--apple-green); } .tile.blue { background: var(--apple-blue); }
.tile.indigo { background: var(--apple-indigo); } .tile.teal { background: var(--apple-teal); } .tile.gray { background: var(--apple-gray); } .tile.purple { background: var(--apple-purple); } .tile.ink { background: var(--btn-prominent-bg); color: var(--btn-prominent-fg); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--fill); color: var(--label2); display: grid; place-items: center; font-size: 14px; font-weight: 600; flex: none; }
.r.t .avatar + .tt { }
.pad { padding: 14px 16px; }
.pad + .pad { border-top: 1px solid var(--hair); }

/* status: dot + word */
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--label2); white-space: nowrap; }
.st::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--gray); flex: none; }
.st.red::before { background: var(--apple-red); } .st.orange::before { background: var(--apple-orange); } .st.green::before { background: var(--apple-green); } .st.blue::before { background: var(--apple-blue); }
.okline { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; }
.okline .ic { color: var(--green); margin-top: 1px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stats.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { background: var(--group); border-radius: 18px; box-shadow: var(--group-shadow); padding: 14px 16px; position: relative; }
.stat .l { font-size: 13px; color: var(--label2); padding-right: 18px; line-height: 1.3; }
.stat .v { font-size: 28px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; margin-top: 4px; }
.stat .v small { font-size: 15px; font-weight: 500; color: var(--label2); letter-spacing: -.01em; }
.stat .d { font-size: 13px; color: var(--label2); margin-top: 3px; }
.info { position: absolute; top: 12px; right: 12px; color: var(--label3); }
.info.inl { position: static; margin-left: 4px; vertical-align: -2px; }
[data-help] { cursor: help; }

/* buttons: apple-buttons.css + local sizing */
.btn { font-size: 15px; letter-spacing: -.01em; cursor: pointer; }
.btn-compact { font-size: 14px; padding-inline: 14px; }
.btn-row { margin-top: 14px; }
.link { border: 0; background: transparent; color: var(--accent); font: inherit; cursor: pointer; padding: 0; }

/* segmented control: grey rail, white thumb */
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--fill); gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: var(--label2); font: inherit; font-size: 13.5px; font-weight: 500; min-height: 30px; padding: 0 13px; border-radius: 999px; cursor: pointer; transition: background .2s var(--ease), color .2s; }
.seg button.on { background: var(--thumb); color: var(--label); box-shadow: 0 1px 3px rgb(0 0 0 / .12); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 18px 0 14px; }
.proj { font-size: 13px; color: var(--label2); display: inline-flex; align-items: center; gap: 6px; }
.proj::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--apple-orange); }
.proj.now::before { background: var(--apple-green); }

/* disclosure */
details.disc { margin: 10px 4px 0; }
details.disc summary { list-style: none; cursor: pointer; font-size: 14px; color: var(--accent); display: inline-flex; align-items: center; gap: 6px; }
details.disc summary::-webkit-details-marker { display: none; }
details.disc .body { font-size: 14px; color: var(--label2); margin-top: 6px; line-height: 1.5; max-width: 40em; }
details.row > summary { list-style: none; cursor: pointer; }
details.row > summary::-webkit-details-marker { display: none; }
details.row[open] > summary .chev { transform: rotate(90deg); }
details.row .more { padding: 0 16px 14px 56px; font-size: 14px; color: var(--label); }
details.row .more dt { font-size: 13px; color: var(--label2); margin-top: 8px; }
details.row .more dd { margin: 2px 0 0; line-height: 1.45; }

/* log */
.log { list-style: none; margin: 0; padding: 0; }
.log li { display: flex; gap: 12px; padding: 10px 16px; font-size: 14px; position: relative; }
.log li + li::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--hair); }
.log time { color: var(--label2); font-variant-numeric: tabular-nums; flex: none; width: 42px; }

/* maps and charts */
.mapgroup { background: var(--bg-map); border-radius: 18px; box-shadow: var(--group-shadow); padding: 10px; }
.mapbox { height: 60vh; min-height: 360px; position: relative; }
body.phone .device .mapbox { height: 380px; min-height: 0; }
.mapbox svg { width: 100%; height: 100%; display: block; }
.shape { cursor: pointer; } .shape:hover { opacity: .82; }
.mlabel { fill: var(--label); font-weight: 600; paint-order: stroke; stroke: var(--bg-map); stroke-linejoin: round; pointer-events: none; }
.mlabel.strong { font-weight: 700; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--label2); padding: 8px 6px 2px; align-items: center; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .info { position: static; }
.crumbs { font-size: 14px; color: var(--label2); margin: 0 0 10px; display: flex; align-items: center; gap: 6px; }
.stack { display: flex; height: 8px; border-radius: 4px; overflow: hidden; gap: 2px; margin-top: 12px; }
.stack i { display: block; height: 100%; }
.stack-l { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--label2); margin-top: 8px; }
.stack-l i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.grid { stroke: var(--hair); stroke-width: 1; }
.axis { font-size: 11px; fill: var(--label2); } .axis.strong { font-weight: 600; fill: var(--label); }
.marker { stroke: var(--label3); stroke-dasharray: 3 3; } .xhair { stroke: var(--label2); stroke-width: 1; }
.spark { color: var(--green); }

/* emergency alert */
.alert-row { display: flex; gap: 14px; align-items: flex-start; padding: 16px; }
.alert-row .tt { flex: 1; min-width: 0; }
.alert-row .tt b { display: block; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.alert-row .tt span { display: block; color: var(--label2); font-size: 13px; }
.alert-row + .r::before { content: ""; position: absolute; top: 0; left: 70px; right: 0; height: 1px; background: var(--hair); }

/* messages (WhatsApp depiction) */
.thread { background: var(--wa-bg); border-radius: 14px; padding: 10px; min-height: 340px; max-height: calc(100vh - 260px); overflow-y: auto; }
.thread.mesh { background: var(--mesh-bg); }
.msg { max-width: 90%; background: var(--wa-in); border-radius: 10px; padding: 7px 10px; margin: 6px 0; font-size: 13px; box-shadow: 0 1px 0 rgb(0 0 0 / .06); color: var(--wa-ink); }
.thread.mesh .msg { background: var(--mesh-in); color: #e8ecf5; }
.msg.out { background: var(--wa-out); margin-left: auto; }
.thread.mesh .msg.out { background: var(--mesh-out); }
.msg .from { display: block; font-size: 11px; color: var(--wa-ink2); font-weight: 600; }
.thread.mesh .msg .from { color: #8fb3ff; }
.msg .time { display: block; text-align: right; font-size: 10.5px; color: var(--wa-ink2); margin-top: 2px; }
.thread.mesh .msg .time { color: #7f8aa3; }
.msg.sys { background: var(--wa-sys); color: var(--wa-sys-ink); font-size: 12px; text-align: center; max-width: 100%; }
.thread.mesh .msg.sys { background: #1a2a44; color: #cfe0ff; }
.empty-thread { color: var(--wa-ink2); font-size: 13.5px; text-align: center; padding: 34px 16px; line-height: 1.5; }
.reply-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--label2); cursor: pointer; border: 0; background: transparent; font-family: inherit; }
.switch i { width: 38px; height: 23px; border-radius: 12px; background: var(--fill2); position: relative; transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgb(0 0 0 / .2); transition: left .2s var(--ease); }
.switch.on i { background: var(--apple-green); } .switch.on i::after { left: 17px; }
.steps { font-size: 13.5px; }
.step { display: flex; gap: 10px; padding: 7px 0; color: var(--label2); }
.step .n { width: 22px; height: 22px; border-radius: 50%; background: var(--fill); font-size: 11px; font-weight: 700; display: grid; place-items: center; flex: none; }
.step.now { color: var(--label); font-weight: 600; } .step.now .n { background: var(--label); color: var(--canvas); }
.step.done { opacity: .5; text-decoration: line-through; }
.badge { background: var(--apple-red); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 600; padding: 0 6px; margin-left: 6px; line-height: 18px; }

/* hover card on glass */
.tip { position: fixed; z-index: 1000; max-width: 300px; padding: 10px 12px; border-radius: 12px; font-size: 13px; line-height: 1.45; pointer-events: none; display: none; background: var(--glass-bg); -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter); box-shadow: var(--glass-edge), var(--glass-shadow); color: var(--label); }
.tip b { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 3px; } .tip b.inl { display: inline; }
.tip .src { color: var(--label2); font-size: 12px; margin-top: 6px; }
.tip .row { display: flex; justify-content: space-between; gap: 14px; } .tip .row span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; }
.tip .hintl { color: var(--accent); margin-top: 5px; font-size: 12px; }
.tip .sw { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }

/* toast */
.fb-toast { z-index: 40; }

/* layout breakpoints (decided by available width, never device) */
.msgbtn, .only-narrow { display: none !important; }
@container (max-width: 560px) {
  .stats, .stats.four { grid-template-columns: 1fr 1fr; } .stats > .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .spark { display: none; } .stat .v { font-size: 24px; }
}
@media (max-width: 1279px) {
  .shell { grid-template-columns: 228px minmax(0, 1fr); }
  .inspector { position: fixed; top: 0; right: 0; bottom: 0; width: 380px; max-width: 100%; z-index: 30; display: none; box-shadow: -20px 0 40px rgb(0 0 0 / .18); }
  body.msgs .inspector { display: flex; }
  .inspector .closer { display: inline-flex; }
  .msgbtn { display: inline-flex !important; } .btn-row.only-narrow { display: block !important; }
  .topbar .status .long { display: none; }
  .topbar .status span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
}
@media (max-width: 959px) { .topbar .status .full { display: none; } .topbar .status .short { display: inline; } }
@media (max-width: 759px), (pointer: coarse) and (max-height: 500px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar { padding: 8px 14px; } .content { padding: 20px 16px 96px; }
  #modeseg { display: none; }
  .topbar .status .full { display: none; } .topbar .status .short { display: inline; }
  .topbar .status span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .mobilenav { display: flex; }
  .title { font-size: 30px; }
  .mapbox { height: 52vh; min-height: 300px; max-height: 440px; }
}
@media (min-width: 760px) and (pointer: fine), (min-width: 760px) and (min-height: 501px) { .mobilenav { display: none !important; } }
body.pre .mobilenav, body.pre .tabbar { display: none !important; }
.mobilenav { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 20; padding: 6px; border-radius: 28px; }
.mobilenav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; font-weight: 600; color: var(--label2); padding: 6px 2px; border-radius: 20px; min-height: 46px; justify-content: center; }
.mobilenav a.on { color: var(--accent); background: var(--fill); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* map controls and scale (map redesign, 24 Oct) */
.mapbox { position: relative; touch-action: pan-y; }
.mapbox.zoomed { cursor: grab; touch-action: none; }
.mapbox.zoomed:active { cursor: grabbing; }
.mapzoom { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; border-radius: 12px; overflow: hidden; background: var(--glass-bg); -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter); box-shadow: var(--glass-edge), var(--glass-shadow); z-index: 2; }
.mapzoom button { width: 36px; height: 36px; border: 0; background: transparent; color: var(--label); display: grid; place-items: center; cursor: pointer; position: relative; }
.mapzoom button + button::before { content: ""; position: absolute; top: 0; left: 8px; right: 8px; height: 1px; background: var(--hair); }
.mapzoom button:hover { background: var(--fill); }
.mapzoom button:disabled { color: var(--label3); cursor: default; background: transparent; }
.legend .lt { color: var(--label); font-weight: 500; }
.legend .ramp { display: inline-flex; border-radius: 4px; overflow: hidden; height: 10px; }
.legend .ramp i { width: 28px; height: 10px; margin: 0; border-radius: 0; }
.legend .ends { display: inline-flex; gap: 6px; font-variant-numeric: tabular-nums; }
.legend .ends span:first-child::after { content: "to"; margin-left: 6px; color: var(--label3); }
.legend .nd i { background: repeating-linear-gradient(45deg, var(--nodata) 0 3px, var(--nodata-line) 3px 5px); }
.projband { fill: var(--fill); opacity: .35; }
.trendline { font-size: 15px; color: var(--label); margin: 0 0 10px; line-height: 1.45; }
.trendline b { font-weight: 600; }
.mapsearch { position: relative; margin: 0 0 12px; }
.mapsearch .field { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 12px; background: var(--fill); color: var(--label2); }
.mapsearch input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 16px; color: var(--label); outline: none; }
.mapsearch input::placeholder { color: var(--label3); }
.mapsearch input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.mapsearch .clear[hidden] { display: none; }
.mapsearch .clear { border: 0; background: transparent; color: var(--label3); padding: 0; display: grid; place-items: center; cursor: pointer; }
.mapsearch .results { position: absolute; left: 0; right: 0; top: 46px; z-index: 12; background: var(--elev); border-radius: 14px; box-shadow: 0 0 0 1px var(--hair), 0 18px 40px rgb(0 0 0 / .18); max-height: 360px; overflow-y: auto; display: none; }
.mapsearch.open .results { display: block; }
.mapsearch .results .r { cursor: pointer; min-height: 48px; }
.mapsearch .results .r.on, .mapsearch .results .r:hover { background: var(--fill); }
.mapsearch .results .hd { padding: 10px 16px 4px; font-size: 13px; color: var(--label2); }
.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; color: var(--label2); margin: 0 0 10px; }
.crumbs button { border: 0; background: transparent; color: var(--accent); font: inherit; font-size: 14px; padding: 0; cursor: pointer; }
.crumbs b { color: var(--label); font-weight: 600; }
.flowlist .n { width: 22px; height: 22px; border-radius: 50%; background: var(--flow); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; flex: none; }
.btn-pair { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-pair .btn { flex: 1 1 220px; }
.msg .gloss { display: block; font-size: 11.5px; color: var(--wa-ink2); font-style: italic; margin-top: 4px; line-height: 1.35; }
@container (max-width: 560px) { .r .st { white-space: normal; max-width: 38%; text-align: right; line-height: 1.25; } .r .tt b { overflow-wrap: anywhere; } }
/* Narrow screens: a row's status and button move under its text, so the text keeps the width (24 Oct, phone audit) */
@container (max-width: 560px) {
  .r:has(> .st) { flex-wrap: wrap; row-gap: 6px; }
  .r:has(> .st) > .tt { flex: 1 1 calc(100% - 100px); }
  .r:has(> .st) > .chev { order: 5; }
  .r:has(> .st) > .st { order: 10; max-width: none; text-align: left; white-space: normal; }
  .r:has(> .avatar) > .st { margin-left: 48px; }
  .r:has(> .tile) > .st { margin-left: 40px; }
  .r:has(> .st) > .btn { order: 11; margin-left: auto; }
  .r:has(> .st) > .val { order: 6; }
}
@container (max-width: 560px) {
  .r:has(> .val.sz) { flex-wrap: wrap; row-gap: 2px; }
  .r:has(> .val.sz) > .tt { flex: 1 1 calc(100% - 80px); }
  .r:has(> .val.sz) > .chev { order: 5; }
  .r > .val.sz { order: 10; margin-left: 40px; font-size: 13px; }
}
.secthead .fn { white-space: nowrap; }
/* 24 Oct night: Is this true?, the WhatsApp bot, the child alert */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.botthread { min-height: 0; max-height: none; }
.botline { white-space: pre-line; display: block; }
.kidalert { margin-top: 20px; border-radius: 28px; padding: 22px 20px 20px; background: linear-gradient(180deg, #2B2F3A, #15171C); color: #fff; text-align: center; box-shadow: 0 20px 40px -20px rgb(0 0 0 / .5); }
.ka-top { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; font-weight: 600; color: #FF6B6B; }
.ka-q { font-size: 30px; font-weight: 700; line-height: 1.2; margin: 18px 0 6px; letter-spacing: -.02em; }
.ka-hi { font-size: 18px; opacity: .85; margin: 0 0 18px; }
.ka-s { font-size: 17px; opacity: .9; margin: 8px 0; }
.ka-code { font-size: 40px; font-weight: 800; letter-spacing: .06em; margin: 10px 0; }
.ka-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 8px 0 16px; }
.ka-b { border: 0; border-radius: 22px; padding: 18px 10px; font: 600 16px/1.3 inherit; color: #fff; cursor: pointer; }
.ka-b span { display: block; font-size: 54px; line-height: 1.1; margin-bottom: 6px; }
.ka-b.ok { background: #1E8E3E; } .ka-b.no { background: #D93025; }
.kidalert .btn { background: rgb(255 255 255 / .14); color: #fff; }
.ka-open { display: flex; align-items: center; gap: 14px; max-width: 440px; margin: 16px auto 12px; padding: 14px 16px; border-radius: 20px; background: #fff; color: #111; text-decoration: none; text-align: left; box-shadow: 0 12px 26px -14px rgb(0 0 0 / .7); }
.ka-open img { width: 56px; height: 56px; border-radius: 14px; flex: none; }
.ka-open span { flex: 1; } .ka-open b { display: block; font-size: 19px; letter-spacing: -.01em; } .ka-open small { display: block; font-size: 14px; color: #555; margin-top: 2px; }
.ka-open svg { color: #999; flex: none; }
.ka-small { font-size: 15px; opacity: .75; }
/* Safari stability (24 Oct, Rahul's crash): no live blur on anything that sits over or follows across a map.
   Re-blurring hundreds of map shapes on every mouse move can crash a Safari tab; solid surfaces look the same. */
.tip, .overlay, .mapzoom { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; background: var(--elev) !important; box-shadow: 0 6px 24px rgb(0 0 0 / .18), 0 0 0 1px var(--hair, rgb(0 0 0 / .08)); }
[data-map] { contain: content; }
/* Rahul's review, 24 Oct night */
.persona { display: flex; gap: 12px; align-items: flex-start; margin-top: 22px; padding: 14px 16px; border-radius: 16px; background: color-mix(in srgb, var(--apple-blue) 10%, var(--group)); }
.persona .avatar { flex: none; } .persona b { display: block; font-size: 16px; } .persona span:not(.avatar) { display: block; color: var(--label2); font-size: 14.5px; line-height: 1.45; margin-top: 2px; }
.askby { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; flex-wrap: wrap; }
.ka-b.kid { background: color-mix(in srgb, var(--apple-orange) 18%, var(--group)); }
/* Toasts at the top, where they're seen */
.fb-toast { inset-block-end: auto !important; inset-block-start: 1rem !important; z-index: 60 !important; }
/* Map colours follow the situation: few children safe reads red, most safe reads green */
:root { --q0: #D93B30; --q1: #EE6A3E; --q2: #F59E42; --q3: #F2C94C; --q4: #8CCB7E; --q5: #2E9E5B; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --q0: #B83229; --q1: #CF5A33; --q2: #D98A3A; --q3: #CFAE45; --q4: #6FAE66; --q5: #36A862; } }
:root[data-theme="dark"] { --q0: #B83229; --q1: #CF5A33; --q2: #D98A3A; --q3: #CFAE45; --q4: #6FAE66; --q5: #36A862; }
.stamp { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--label2); margin: 8px 2px 0; }
.fb-toast { background: var(--elev) !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; box-shadow: 0 8px 28px rgb(0 0 0 / .28), 0 0 0 1px var(--hair) !important; }

/* No live blur (Safari crash, 24–25 Oct): glass surfaces become solid */
*, *::before, *::after { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
:root { --glass-bg: #FAFAFC !important; --glass-clear-bg: #FAFAFC !important; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --glass-bg: #161617 !important; --glass-clear-bg: #161617 !important; } }
:root[data-theme="dark"] { --glass-bg: #161617 !important; --glass-clear-bg: #161617 !important; }

/* Phone mode, 25 Oct: the tab bar is docked to the bottom of the screen like iOS, always shown, and nothing scrolls below it */
.device .screen { position: relative; }
.device .pcontent { padding-bottom: 20px; }
.device .tabbar { position: static; flex: none; left: auto; right: auto; bottom: auto; border-radius: 0; padding: 6px 10px 22px; background: var(--group-solid, #fff) !important; border-top: 1px solid var(--hair); }
.device .tabbar a { border-radius: 14px; }

.demo-strip { display: flex; gap: 8px; align-items: flex-start; margin: 2px 0 14px; padding: 9px 12px; border-radius: 12px; background: color-mix(in srgb, var(--apple-blue) 10%, var(--group)); color: var(--label2); font-size: 13.5px; line-height: 1.4; }
.demo-strip .ic { color: var(--apple-blue); margin-top: 2px; } .demo-strip b { color: var(--label); }

/* The child alert as a government emergency alert (25 Oct): no emojis, a read-aloud button on every step */
.galert { margin-top: 20px; border-radius: 22px; padding: 18px 18px 20px; background: var(--group); box-shadow: 0 1px 2px rgb(0 0 0 / .06), 0 8px 28px rgb(0 0 0 / .08); border: 1px solid var(--hair); text-align: center; }
.ga-head { display: flex; align-items: center; gap: 10px; text-align: left; padding-bottom: 12px; border-bottom: 1px solid var(--hair); }
.ga-head > .ic { color: #D93025; flex: none; } .ga-head > div { flex: 1; min-width: 0; }
.ga-head b { display: block; font-size: 16px; letter-spacing: -.01em; } .ga-head span { display: block; font-size: 13px; color: var(--label2); }
.ga-say { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 999px; padding: 7px 12px; font-family: inherit; font-weight: 600; font-size: 13px; line-height: 1; background: color-mix(in srgb, var(--apple-blue) 14%, transparent); color: var(--apple-blue); cursor: pointer; }
.ga-q { font-size: 26px; font-weight: 700; line-height: 1.2; margin: 18px 0 4px; letter-spacing: -.02em; }
.ga-hi { font-size: 17px; color: var(--label2); margin: 0 0 16px; }
.ga-s { font-size: 16px; color: var(--label); margin: 8px auto; max-width: 30em; } .ga-small { font-size: 14px; color: var(--label2); }
.ga-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 8px 0 4px; }
.ga-b { display: flex; flex-direction: column; align-items: center; gap: 8px; border: 0; border-radius: 16px; padding: 18px 10px; font-family: inherit; font-weight: 600; font-size: 17px; line-height: 1.25; cursor: pointer; }
.ga-b.adult { background: #0B2E6B; color: #fff; } .ga-b.child { background: #FFE11B; color: #0B2E6B; }
.ga-b.ok { background: #1E8E3E; color: #fff; } .ga-b.no { background: #D93025; color: #fff; }
.ga-code { display: inline-block; font-size: 34px; font-weight: 800; letter-spacing: .12em; margin: 10px 0; padding: 8px 22px; border-radius: 12px; background: #FFE11B; color: #0B2E6B; }
.galert .btn { margin-top: 6px; }

/* Real phones, 25 Oct evening: the page itself scrolls (not an inner box), so Safari's address bar shrinks as on any site,
   and nothing hides under the top bar, the tab bar or the home indicator. Reset is an icon here. */
.resetbtn .rs-ic { display: none; }
.shell, .sidebar, .main, .inspector { height: 100vh; height: 100dvh; }
@media (max-width: 759px), (pointer: coarse) and (max-height: 500px) {
  html, body { height: auto; }
  body { min-height: 100svh; }
  html { scroll-padding-top: 64px; scroll-padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .shell { display: block; height: auto; min-height: 100vh; }
  .main { height: auto; min-height: 100vh; min-height: 100dvh; overflow: visible; }
  .topbar { position: sticky; top: 0; z-index: 15; background: var(--canvas); padding-top: calc(8px + env(safe-area-inset-top)); padding-left: calc(14px + env(safe-area-inset-left)); padding-right: calc(14px + env(safe-area-inset-right)); }
  .topbar .tools { gap: 4px; }
  .content { padding-bottom: calc(112px + env(safe-area-inset-bottom)); }
  .mobilenav { bottom: calc(10px + env(safe-area-inset-bottom)); left: calc(12px + env(safe-area-inset-left)); right: calc(12px + env(safe-area-inset-right)); }
  .inspector { height: auto; top: 0; bottom: 0; padding-bottom: env(safe-area-inset-bottom); }
  .mapbox { height: 52vh; height: 52svh; }
  .inspector .pane, .thread, .mapsearch .results { overscroll-behavior: contain; }
  body.kb-open .mobilenav { display: none; }
  .resetbtn { min-width: 34px; padding: 0 8px; } .resetbtn .rs-ic { display: block; } .resetbtn .rs-t { display: none; }
}
body.phone .topbar { min-height: 61px; }
@media (max-width: 400px) { .topbar .tools [data-action="share"] { display: none; } }
