/* MuseGuard design system. Light and dark themes via html[data-theme]. */
:root, :root[data-theme="light"] {
  --bg: #F6F7FB; --surface: #FFFFFF; --surface-2: #EEF1F8; --ink: #0F172A; --body: #334155; --muted: #475569; --line: #E6E9F2;
  --brand: #3157D5; --brand-strong: #3157D5; --brand-hover: #2443AE; --brand-soft: #EAF0FF; --brand-ink: #1E3A8A;
  --mint: #047857; --mint-soft: #E3F6EE; --peach: #9A3F0F; --peach-soft: #FFEBDD; --amber: #92400E; --amber-soft: #FEF3C7;
  --danger: #DC2626; --danger-ink: #B91C1C; --danger-soft: #FDECEA;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px rgba(15,23,42,.06);
  --inverse: #0F172A; --inverse-ink: #FFFFFF; --feed: #141A24; --input: #F6F7FB; --scrim: rgba(15,23,42,.45);
  --ease: cubic-bezier(.2,.7,.2,1);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0B1020; --surface: #141B2E; --surface-2: #1B2338; --ink: #E7ECF5; --body: #C7CFDD; --muted: #9AA6BC; --line: #263049;
  --brand: #8EA6FF; --brand-strong: #4A6BE0; --brand-hover: #5B7AEA; --brand-soft: #1D2850; --brand-ink: #CBD6FF;
  --mint: #6EE7B7; --mint-soft: rgba(16,185,129,.14); --peach: #FDBA8C; --peach-soft: rgba(251,146,60,.14); --amber: #FCD34D; --amber-soft: rgba(245,158,11,.16);
  --danger: #DC2626; --danger-ink: #FCA5A5; --danger-soft: rgba(220,38,38,.18);
  --shadow: none; --inverse: #E7ECF5; --inverse-ink: #0B1020; --feed: #070B14; --input: #0F1526; --scrim: rgba(0,0,0,.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink); font: 400 15px/1.5 'Nunito Sans', system-ui, -apple-system, 'PingFang TC', 'Noto Sans TC', sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3, b, strong { font-family: Nunito, 'Nunito Sans', system-ui, 'PingFang TC', sans-serif; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; font-weight: 900; line-height: 1.15; letter-spacing: -.01em; }
h2 { font-size: 18px; font-weight: 800; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Text ---------- */
.lede { font-size: 16px; color: var(--body); line-height: 1.55; }
.label { font-size: 13px; font-weight: 700; color: var(--muted); }
.kicker { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.kicker.blue { color: var(--brand); text-transform: none; letter-spacing: 0; font-size: 13px; }
.fine { font-size: 12px; line-height: 1.5; color: var(--muted); text-align: center; }
.fine.left { text-align: left; display: flex; gap: 8px; align-items: flex-start; }
.fine .i { width: 16px; height: 16px; margin-top: 1px; }
.fine a { font-weight: 700; }
.muted { color: var(--muted); font-weight: 600; }
.mono, code { font-family: 'JetBrains Mono', ui-monospace, monospace; }
.small { font-size: 12px; }
.center { text-align: center; }
.h-big { font-size: 30px; }
.h-greet { font-size: 24px; font-weight: 900; }
.h-sec { font-size: 17px; font-weight: 800; }

/* ---------- Layout helpers ---------- */
.row { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.stack-xs { display: flex; flex-direction: column; gap: 3px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.center-self { align-self: center; }
@media (max-width: 899px) { .dsk { display: none !important; } }

.screen { width: 100%; max-width: 480px; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 18px 28px; display: flex; flex-direction: column; gap: 18px; }
.has-tabs .screen { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: Nunito, sans-serif; font-size: 20px; font-weight: 900; color: var(--ink); }
.brand:hover { color: var(--ink); }
.ollie { display: block; flex: none; }

/* Ollie (ollie.js): a layered plush puppet. Cream in light mode, Blue in dark mode; layer positions and pivots
   are in /ollie-rig.css (generated). Held poses are transitions so an interrupted pose eases back; loops animate
   only transform and opacity. */
.o3d { display: inline-block; position: relative; flex: none; line-height: 0; container-type: size; }
/* The 768x896 rig canvas, sized so Ollie fills the box like the flat image did, feet on the same line. */
.o3d-fig { position: absolute; --cw: calc(min(100cqw, 78.82cqh) * 1.2); width: var(--cw); height: calc(var(--cw) * 1.16667);
  left: calc(50% - var(--cw) / 2); top: calc(50% - var(--cw) * .58333); transform-origin: 49.87% 95.31%;
  transition: opacity .4s ease, filter .4s ease; }
.o3d-rig, .o3d-up, .o3d-head, .o3d-head2, .o3d-eyes { position: absolute; inset: 0; }
.o3d-rig i { position: absolute; display: block; background: no-repeat 0 0 / 100% 100%; }
.o3d .rig-blue { display: none; }
html[data-theme="dark"] .o3d .rig-cream, .o-night .o3d .rig-cream, .tut-art.night .o3d .rig-cream { display: none; }
html[data-theme="dark"] .o3d .rig-blue, .o-night .o3d .rig-blue, .tut-art.night .o3d .rig-blue { display: block; }
/* Breathing lifts the body from the foot line; the feet stay planted. */
.o3d-up { transform-origin: 49.87% 95.31%; animation: o-breathe 4.8s ease-in-out infinite; }
.o3d-head, .o3d-head2 { transform-origin: 49.87% 42.63%; }
.o3d-head { z-index: 2; transition: transform .55s cubic-bezier(.3, .7, .3, 1); }
/* When a looping look-around ends, the head eases back from wherever the loop left it. */
.o3d-head2 { transition: transform .55s cubic-bezier(.3, .7, .3, 1); }
.o3d-eyes { transition: transform .4s ease; }
.o3d-rig .p-wing-L, .o3d-rig .p-wing-R { z-index: 1; transition: transform .5s cubic-bezier(.3, .7, .3, 1), z-index 0s .5s; }
/* Blink: the eyes swap for the closed lids (the white mask stays), at an uneven rhythm with an occasional double. */
.o3d-eyes { animation: o-eyes 11s step-end infinite var(--blink-at, 0s); }
.o3d-rig .p-lid-L, .o3d-rig .p-lid-R { opacity: 0; animation: o-lids 11s step-end infinite var(--blink-at, 0s); }
.o3d-rig .p-beak-open { opacity: 0; }
/* The flat SVG Ollies in illustrations.js: cream in light, blue in dark. */
g.o3d .o3d-dark { display: none; }
html[data-theme="dark"] g.o3d .o3d-light { display: none; }
html[data-theme="dark"] g.o3d .o3d-dark { display: inline; }
.fx-ring { position: absolute; inset: 0; margin: auto; width: min(92cqw, 74cqh); height: min(92cqw, 74cqh); border-radius: 50%; border: max(2px, 1.6cqw) solid var(--danger); opacity: 0; }

/* watching (an active guardian, all clear): attentive, a slow look across the room */
.o3d[data-state="watching"] .o3d-head2 { animation: o-attend 9s ease-in-out infinite; }
/* thinking: a small upward glance with the head tipped */
.o3d[data-state="thinking"] .o3d-head { transform: rotate(-4deg); }
.o3d[data-state="thinking"] .o3d-eyes { transform: translateY(-.7%); }
/* listening: head tilted, one wing raised to the cheek (in front of the head while it's up) */
.o3d[data-state="listening"] .o3d-head { transform: rotate(-5deg); }
.o3d[data-state="listening"] .o3d-rig .p-wing-R { z-index: 3; transform: rotate(150deg) scaleY(.6); transition: transform .5s cubic-bezier(.3, .7, .3, 1), z-index 0s; }
/* talking: the beak opens and closes in short, uneven beats */
.o3d[data-state="talking"] .p-beak-open { animation: o-beak 1.3s step-end infinite; }
.o3d[data-state="talking"] .p-beak-closed { animation: o-beak-shut 1.3s step-end infinite; }
/* happy / celebrate: a hop (ollie.js) on a positive moment, then wings a little open */
.o3d[data-state="happy"] .o3d-head { transform: rotate(3deg); }
.o3d[data-state="happy"] .p-wing-L { transform: rotate(14deg); }
.o3d[data-state="happy"] .p-wing-R { transform: rotate(-14deg); }
.o3d[data-state="celebrate"] .p-wing-L { transform: rotate(38deg); }
.o3d[data-state="celebrate"] .p-wing-R { transform: rotate(-38deg); }
/* alert: eyes open and still, one quick start, a slow red pulse ring (under once a second, never a flash) */
.o3d[data-state="alert"] .o3d-eyes, .o3d[data-state="alert"] .p-lid-L, .o3d[data-state="alert"] .p-lid-R { animation: none; }
.o3d[data-state="alert"] .o3d-fig { animation: o-startle .6s ease-in-out 1; }
.o3d[data-state="alert"] .fx-ring { opacity: .55; animation: o-ring 1.6s ease-out infinite; }
/* night (quiet nighttime monitoring): still watching, with slow blinks and a gentle tilt now and then */
.o3d[data-state="night"] .o3d-up { animation-duration: 6.5s; }
.o3d[data-state="night"] .o3d-eyes { animation: o-eyes-slow 9s step-end infinite var(--blink-at, 0s); }
.o3d[data-state="night"] .p-lid-L, .o3d[data-state="night"] .p-lid-R { animation: o-lids-slow 9s step-end infinite var(--blink-at, 0s); }
.o3d[data-state="night"] .o3d-head2 { animation: o-nod 14s ease-in-out infinite; }
/* connecting: looking around, a little muted; offline: eyes closed, head lowered, muted */
.o3d[data-state="connecting"] .o3d-fig { opacity: .85; }
.o3d[data-state="connecting"] .o3d-head2 { animation: o-look 4.4s ease-in-out infinite; }
.o3d[data-state="offline"] .o3d-fig { opacity: .6; filter: saturate(.35); }
.o3d[data-state="offline"] .o3d-head { transform: rotate(-4deg); }
.o3d[data-state="offline"] .o3d-eyes { animation: none; opacity: 0; }
.o3d[data-state="offline"] .p-lid-L, .o3d[data-state="offline"] .p-lid-R { animation: none; opacity: 1; }
/* waving (greetOnce): one wing lifts, holds, and lowers when the greeting ends */
.o3d[data-state="waving"] .p-wing-L { transform: rotate(125deg); transition-duration: .45s; }

@keyframes o-breathe { 0%,100% { transform: scale(1); } 45% { transform: scale(1.006, 1.012); } }
@keyframes o-eyes { 0% { opacity: 1; } 30% { opacity: 0; } 31.3% { opacity: 1; } 72% { opacity: 0; } 73.3% { opacity: 1; } 75.5% { opacity: 0; } 76.8% { opacity: 1; } }
@keyframes o-lids { 0% { opacity: 0; } 30% { opacity: 1; } 31.3% { opacity: 0; } 72% { opacity: 1; } 73.3% { opacity: 0; } 75.5% { opacity: 1; } 76.8% { opacity: 0; } }
@keyframes o-eyes-slow { 0% { opacity: 1; } 44% { opacity: 0; } 50% { opacity: 1; } }
@keyframes o-lids-slow { 0% { opacity: 0; } 44% { opacity: 1; } 50% { opacity: 0; } }
@keyframes o-beak { 0% { opacity: 1; } 11% { opacity: 0; } 26% { opacity: 1; } 33% { opacity: 0; } 52% { opacity: 1; } 68% { opacity: 0; } }
@keyframes o-beak-shut { 0% { opacity: 0; } 11% { opacity: 1; } 26% { opacity: 0; } 33% { opacity: 1; } 52% { opacity: 0; } 68% { opacity: 1; } }
@keyframes o-attend { 0%,100% { transform: rotate(0); } 22%,36% { transform: rotate(-2.5deg); } 62%,76% { transform: rotate(2deg); } }
@keyframes o-nod { 0%,55%,100% { transform: rotate(0); } 65%,82% { transform: rotate(3.5deg); } }
@keyframes o-look { 0%,100% { transform: rotate(0); } 30% { transform: rotate(-5deg); } 70% { transform: rotate(5deg); } }
@keyframes o-startle { 0%,100% { transform: none; } 20% { transform: translateY(-1.5%) scale(1.02); } 45% { transform: rotate(-2deg); } 70% { transform: rotate(1.5deg); } }
@keyframes o-ring { 0% { opacity: .6; transform: scale(.8); } 100% { opacity: 0; transform: scale(1.12); } }
/* Hidden page: stop everything. Reduced motion: no loops, no easing, a clear still pose per state. */
html.o-paused .o3d *, html.o-paused .o3d { animation-play-state: paused !important; }
@media (prefers-reduced-motion: reduce) {
  .o3d, .o3d * { animation: none !important; transition: none !important; }
  .o3d[data-state="talking"] .p-beak-open { opacity: 1; }
  .o3d[data-state="talking"] .p-beak-closed { opacity: 0; }
  .o3d[data-state="night"] .o3d-head2 { transform: rotate(3deg); }
  .o3d[data-state="watching"] .o3d-head2 { transform: rotate(-2deg); }
  .o3d[data-state="alert"] .fx-ring { opacity: .5; }
}
.o-face { width: 40px; height: 40px; }
.o-xs { width: 48px; height: 56px; }
.o-sm { width: 84px; height: 100px; }
.o-home { width: 108px; height: 130px; }
.o-tut { width: 150px; height: 180px; }
.o-about { width: 140px; height: 170px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 14px; border: 1px solid transparent; font-weight: 800; font-family: Nunito, sans-serif; font-size: 15px; text-align: center; transition: background-color .15s var(--ease), border-color .15s var(--ease), transform .1s var(--ease); white-space: nowrap; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn-sm { min-height: 34px; padding: 0 12px; border-radius: 10px; font-size: 13px; }
.btn-sm .i { width: 16px; height: 16px; }
.btn-lg { min-height: 52px; border-radius: 16px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand-strong); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); color: #fff; }
.btn-primary:disabled { background: var(--surface-2); color: var(--muted); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); color: var(--ink); }
.btn-ghost:disabled { color: var(--muted); }
.btn-soft { background: var(--brand-soft); color: var(--brand); }
.btn-soft:hover { color: var(--brand); filter: brightness(.97); }
.btn-dark { background: var(--inverse); color: var(--inverse-ink); }
.btn-dark:hover { color: var(--inverse-ink); opacity: .92; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--danger-ink); border-color: var(--line); }
.btn-logout { background: var(--surface); color: var(--danger-ink); border-color: var(--line); }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); flex: none; }
.icon-btn:hover { color: var(--ink); }
.pill-btn { min-height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 800; }
.link-btn { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 4px 0; color: var(--brand); font-weight: 800; font-size: 14px; }
.link-btn .i { width: 16px; height: 16px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border-radius: 22px; padding: 18px; box-shadow: var(--shadow); border: 1px solid transparent; }
html[data-theme="dark"] .card { border-color: var(--line); }
.card.flat { box-shadow: none; }
.card.list { padding: 6px 16px; }
.note { display: flex; gap: 10px; align-items: flex-start; border-radius: 16px; padding: 12px 14px; font-size: 13px; line-height: 1.5; }
.note .i { width: 18px; height: 18px; margin-top: 1px; }
.note.amber { background: var(--amber-soft); color: var(--amber); }
.note.info { background: var(--brand-soft); color: var(--brand-ink); }
.note.danger { background: var(--danger-soft); color: var(--danger-ink); font-weight: 700; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: var(--muted); font-weight: 600; padding: 24px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 700; }
input, select { width: 100%; min-height: 48px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--input); color: var(--ink); font: inherit; font-size: 16px; }
input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.hint { font-size: 12px; color: var(--muted); font-weight: 600; }
.hint.bad { color: var(--danger-ink); }
.hint.ok { color: var(--mint); }
.input-row { display: flex; gap: 8px; }
.code-input { font-family: 'JetBrains Mono', monospace; letter-spacing: .06em; text-transform: uppercase; }
.code-box { display: block; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 15px; letter-spacing: .06em; text-align: center; user-select: all; }

.seg { display: inline-flex; background: var(--surface-2); padding: 3px; border-radius: 12px; gap: 2px; }
.seg button { border: 0; background: transparent; min-height: 34px; padding: 0 12px; border-radius: 9px; font-size: 13px; font-weight: 800; color: var(--muted); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--inverse); color: var(--inverse-ink); }
.seg-sm button { min-height: 28px; padding: 0 9px; font-size: 12px; }
.seg-wide { display: flex; }
.seg-wide button { flex: 1; min-height: 40px; }
.seg-wide button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.switch { position: relative; width: 50px; height: 30px; border-radius: 999px; border: 0; background: color-mix(in srgb, var(--muted) 35%, var(--surface-2)); flex: none; transition: background-color .2s var(--ease); }
.switch span { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s var(--ease); }
.switch[aria-checked="true"] { background: var(--brand-strong); }
.switch[aria-checked="true"] span { transform: translateX(20px); }
.switch:disabled { opacity: .55; }

/* ---------- Small pieces ---------- */
.avatar { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; font-family: Nunito, sans-serif; font-weight: 900; font-size: 15px; flex: none; background: var(--brand-soft); color: var(--brand); }
.avatar.lg { width: 44px; height: 44px; font-size: 17px; }
.avatar.peach { background: var(--peach-soft); color: var(--peach); }
.avatar.mint { background: var(--mint-soft); color: var(--mint); }
.avatar.gray { background: var(--surface-2); color: var(--muted); }
a.avatar:hover { color: var(--peach); }
.tile-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--surface-2); color: var(--ink); flex: none; }
.tile-icon.brand { background: var(--brand-soft); color: var(--brand); }
.tile-icon.peach { background: var(--peach-soft); color: var(--peach); }
.tile-icon.mint { background: var(--mint-soft); color: var(--mint); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill .i { width: 16px; height: 16px; }
.pill.ok, .pill.mint { background: var(--mint-soft); color: var(--mint); }
.pill.warn { background: var(--amber-soft); color: var(--amber); }
.pill.bad { background: var(--danger-soft); color: var(--danger-ink); }
.pill.off { background: var(--surface-2); color: var(--muted); }
.chip { white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 700; border: 1px solid var(--line); }
.chip .i { width: 14px; height: 14px; }
.chip-btn { cursor: pointer; padding: 6px 8px; }
.chip-btn .i { width: 18px; height: 18px; }

.tag { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 6px; font-size: 11px; font-weight: 800; letter-spacing: .02em; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.tag.high { background: var(--danger); color: #fff; }
.tag.unverified { background: var(--amber-soft); color: var(--amber); }
.tag.clear { background: var(--mint-soft); color: var(--mint); }
.tag.test { background: var(--brand-soft); color: var(--brand); }
.tag.on-it { background: var(--brand-soft); color: var(--brand); }
.tag.false-alarm { background: var(--surface-2); color: var(--muted); }
.tag.soft { background: var(--brand-soft); color: var(--brand); font-weight: 700; letter-spacing: 0; }
.mint-tag { background: var(--mint-soft); color: var(--mint); align-self: flex-start; }

.dots { display: flex; gap: 6px; align-items: center; justify-content: center; }
.dots span { width: 8px; height: 8px; border-radius: 99px; background: var(--line); transition: width .2s var(--ease); }
.dots span.on { width: 24px; background: var(--brand-strong); }

.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 90; max-width: min(92vw, 420px); padding: 12px 16px; border-radius: 14px; background: var(--inverse); color: var(--inverse-ink); font-weight: 700; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25); text-align: center; }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid color-mix(in srgb, var(--brand) 25%, transparent); border-top-color: var(--brand); animation: spin .9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Sign in ---------- */
.signin { gap: 16px; }
.duo { position: relative; height: 230px; border-radius: 28px; background: linear-gradient(180deg, var(--brand-soft), color-mix(in srgb, var(--brand-soft) 40%, var(--bg))); overflow: hidden; }
.duo-glow { position: absolute; left: 50%; bottom: -60px; width: 300px; height: 140px; transform: translateX(-50%); border-radius: 50%; background: color-mix(in srgb, var(--brand) 16%, transparent); filter: blur(10px); }
.duo-l, .duo-r { position: absolute; bottom: -18px; height: 200px; width: auto; }
.duo-l { right: 50%; margin-right: -14px; transform-origin: 65% 100%; animation: mg-lean 3.2s ease-in-out infinite; }
.duo-r { left: 50%; margin-left: -14px; transform-origin: 35% 100%; animation: mg-wave 3.2s ease-in-out infinite; }
.duo-b1, .duo-b2 { position: absolute; top: 18px; z-index: 2; padding: 6px 12px; border-radius: 14px; background: var(--surface); color: var(--ink); font-family: Nunito, sans-serif; font-weight: 900; font-size: 14px; box-shadow: var(--shadow); }
.duo-b1 { left: 22px; animation: mg-pop 3.2s ease-in-out infinite; animation-delay: -1.6s; }
.duo-b2 { right: 22px; animation: mg-pop 3.2s ease-in-out infinite; }
.duo-heart { position: absolute; left: 50%; top: 70px; z-index: 2; animation: mg-heart 3.2s ease-out infinite; }
@keyframes mg-lean { 0%,100% { transform: rotate(0) translateY(0); } 50% { transform: rotate(4deg) translateY(-4px); } }
@keyframes mg-wave { 0%,38%,100% { transform: rotate(0); } 46% { transform: rotate(-8deg); } 54% { transform: rotate(6deg); } 62% { transform: rotate(-8deg); } 70% { transform: rotate(5deg); } 78% { transform: rotate(0); } }
@keyframes mg-pop { 0%,36% { opacity: 0; transform: translateY(8px) scale(.8); } 44%,82% { opacity: 1; transform: translateY(0) scale(1); } 90%,100% { opacity: 0; transform: translateY(-4px) scale(1); } }
@keyframes mg-heart { 0% { opacity: 0; transform: translate(-50%, 0) scale(.6); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -70px) scale(1.15); } }
@media (prefers-reduced-motion: reduce) {
  .duo-l, .duo-r, .duo-b1, .duo-b2, .duo-heart { animation: none; }
  .duo-b1, .duo-heart { opacity: 0; }
}
.signin-copy { text-align: center; display: flex; flex-direction: column; gap: 8px; }
.signin-copy h1 { font-size: 30px; }
.signin-copy .lede { font-size: 15px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; font-weight: 700; }
.or span { flex: 1; height: 1px; background: var(--line); }
.guardian-link { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 16px; border: 1px dashed color-mix(in srgb, var(--brand) 45%, var(--line)); color: var(--body); font-size: 14px; }
.guardian-link span { flex: 1; }
.guardian-link b { color: var(--brand); }

/* ---------- Household ---------- */
.person { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.person + .person { border-top: 1px solid var(--line); }
.person b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person small { color: var(--muted); font-size: 12px; font-weight: 600; }

/* ---------- Main shell ---------- */
.sidebar { display: none; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(4, 1fr); padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0; font-size: 12px; font-weight: 800; color: var(--muted); }
.tab-ic { position: relative; display: grid; place-items: center; width: 52px; height: 30px; border-radius: 999px; }
.tabbar a[aria-current="page"] { color: var(--brand); }
.tabbar a[aria-current="page"] .tab-ic { background: var(--brand-soft); }
.tab-ic .dot { position: absolute; top: 2px; right: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); }

/* ---------- Home ---------- */
.ollie-card { display: flex; align-items: center; gap: 12px; padding: 14px 16px 0 6px; border-radius: 26px; background: var(--brand-soft); min-height: 132px; overflow: hidden; }
.ollie-card .o3d { align-self: flex-end; }
.ollie-card .stack-sm { padding-bottom: 14px; align-items: flex-start; }
.ollie-card .say { font-family: Nunito, sans-serif; font-weight: 800; font-size: 16px; line-height: 1.35; color: var(--brand-ink); }
.ollie-card.bad { background: var(--danger-soft); }
.ollie-card.bad .say { color: var(--danger-ink); }
.ollie-card.warn { background: var(--amber-soft); }
.ollie-card.warn .say { color: var(--amber); }
.ollie-card.off { background: var(--surface-2); }
.ollie-card.off .say { color: var(--body); }
.ollie-card.soft { padding: 12px 14px; min-height: 0; align-items: flex-start; }
.ollie-card.soft .o3d { align-self: flex-start; }
.ollie-card.soft p { color: var(--brand-ink); font-size: 14px; line-height: 1.5; }
.ollie-card.soft .kicker { color: var(--brand); text-transform: none; letter-spacing: 0; }

.g-card { display: block; background: var(--surface); border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); color: var(--ink); border: 1px solid transparent; }
html[data-theme="dark"] .g-card { border-color: var(--line); }
.g-card:hover { color: var(--ink); }
.g-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; }
.g-meta b { display: block; font-size: 16px; }
.g-meta small, .g-row small, .add-card small { color: var(--muted); font-size: 12px; font-weight: 600; }
.g-row, .add-card { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 12px 14px; color: var(--ink); }
.g-row b, .add-card b { display: block; }
.add-card { border-style: dashed; border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.add-card > .i:first-child { color: var(--brand); }
.add-card span { flex: 1; }
.ask-bar { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-weight: 600; font-size: 14px; }
.ask-bar span:first-child { flex: 1; }
.ask-bar:hover { color: var(--muted); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.mic { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--brand-strong); color: #fff; border: 0; flex: none; }
.stat-tile { background: var(--surface); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line); }
.stat-tile b { font-size: 20px; font-weight: 900; }
.stat-tile span { font-size: 12px; color: var(--muted); font-weight: 700; }
.push-banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.push-banner b { display: block; font-size: 14px; }
.push-banner small { font-size: 12px; color: var(--muted); }

/* ---------- Live feed ---------- */
.feed { position: relative; background: var(--feed); border-radius: 22px; overflow: hidden; aspect-ratio: 4 / 3; isolation: isolate; }
.feed video, .feed canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* Parents see the whole frame (letterboxed): cropping could hide the very edge where a cord or blanket is. */
.js-feed video { object-fit: contain; background: #000; }
.js-feed.mirror video { transform: scaleX(-1); }
.feed canvas { pointer-events: none; }
.feed video { opacity: 0; transition: opacity .3s; }
.feed.has-video video { opacity: 1; }
.feed-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; color: #9AA6BC; font-size: 13px; font-weight: 700; background: radial-gradient(circle at 50% 40%, #222B3D, #141A24 70%); }
.feed.has-video .feed-empty { display: none; }
.feed.alerting { outline: 3px solid var(--danger); outline-offset: -3px; }
.live-chip { position: absolute; left: 10px; top: 10px; z-index: 2; display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 999px; background: rgba(11,16,32,.8); color: #fff; font-size: 11px; font-weight: 900; letter-spacing: .04em; }
.live-chip i { width: 7px; height: 7px; border-radius: 50%; background: #F87171; }
.feed:not(.has-video) .live-chip { display: none; }
.chip-glass { position: absolute; left: 66px; top: 10px; z-index: 2; padding: 4px 9px; border-radius: 999px; background: rgba(11,16,32,.6); color: #E7ECF5; font-size: 11px; font-weight: 700; }
.feed:not(.has-video) .chip-glass { display: none; }
.fs-btn { position: absolute; right: 10px; top: 10px; z-index: 2; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; border: 0; background: rgba(11,16,32,.65); color: #fff; }
.fs-btn .i { width: 18px; height: 18px; }
.state-chip { position: absolute; left: 10px; bottom: 10px; z-index: 2; display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: 12px; background: rgba(11,16,32,.84); color: #6EE7B7; font-family: Nunito, sans-serif; font-weight: 800; font-size: 14px; max-width: calc(100% - 20px); }
.state-chip .i { width: 16px; height: 16px; }
.state-chip.hide { display: none; }
.handover-chip { position: absolute; left: 10px; right: 10px; top: 40px; z-index: 2; width: fit-content; max-width: calc(100% - 20px); padding: 6px 10px; border-radius: 10px; background: rgba(11,16,32,.84); color: #FCD34D; font-size: 12px; font-weight: 800; }
.handover-chip.hide, .feed:not(.has-video) .handover-chip { display: none; }
.mini-feed .handover-chip { display: none; }
.state-chip.warn, .state-chip.idle { color: #FCD34D; }
.state-chip.review { color: #CBD6FF; }
.state-chip.bad { background: var(--danger); color: #fff; }
.thumb-feed { aspect-ratio: 16 / 9; border-radius: 0; }
.thumb-feed .state-chip { font-size: 12px; padding: 5px 9px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { display: flex; flex-direction: column; gap: 1px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 9px 11px; }
.stat span { font-size: 12px; font-weight: 700; color: var(--muted); }
.stat b { font-size: 15px; }
.stat.ok { background: var(--mint-soft); border-color: transparent; }
.stat.ok span, .stat.ok b { color: var(--mint); }
.stat.warn { background: var(--amber-soft); border-color: transparent; }
.stat.warn span, .stat.warn b { color: var(--amber); }
.stat.bad { background: var(--danger-soft); border-color: transparent; }
.stat.bad span, .stat.bad b { color: var(--danger-ink); }

.live .page-head h1 { font-size: 22px; }
.presence { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.presence i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.presence.ok { color: var(--mint); }
.presence.bad { color: var(--danger-ink); }
.presence.warn { color: var(--amber); }
.actions .action { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 76px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-weight: 800; font-size: 13px; }
.actions .action.primary { background: var(--brand-strong); color: #fff; border-color: transparent; }

.alert-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.alert-row:hover { color: var(--ink); border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.alert-row .thumb { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; flex: none; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.alert-row b { display: block; font-size: 15px; margin-top: 2px; }
.alert-row small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert-row time { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--muted); }
.alert-row > .i { color: var(--muted); }
.group-title { font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 6px 4px 0; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: center; gap: 12px; }
.page-head h1 { font-size: 24px; }
.page-head .kicker { text-transform: none; letter-spacing: 0; }

/* ---------- Ollie chat ---------- */
.chat-screen { min-height: 100dvh; }
.has-tabs .chat-screen { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.chat-head h1 { font-size: 20px; }
.o-avatar { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--brand-soft); overflow: hidden; flex: none; }
.o-avatar .o3d { width: 40px; height: 46px; margin-top: 8px; }
.mini-live { display: block; width: 96px; flex: none; }
.mini-feed { aspect-ratio: 4 / 3; border-radius: 14px; }
.mini-feed .state-chip, .mini-feed .feed-empty span { display: none; }
.mini-feed .live-chip { left: 6px; top: 6px; font-size: 9px; padding: 2px 6px; }
.chat-full { flex: 1; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.chat-log { flex: 1; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 200px; padding: 2px; }
.msg { max-width: 86%; padding: 11px 14px; border-radius: 18px; font-size: 15px; line-height: 1.45; display: flex; flex-direction: column; gap: 8px; }
.msg.me { align-self: flex-end; background: var(--brand-strong); color: #fff; border-bottom-right-radius: 6px; }
.msg.ollie { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg-tags { flex-wrap: wrap; gap: 6px; }
.opts .opt { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; font-size: 14px; text-align: left; }
.opts .opt[aria-pressed="true"] { border: 2px solid var(--brand-strong); color: var(--brand); }
.chat-bottom { display: flex; flex-direction: column; gap: 10px; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 700; }
.chat-input { display: flex; gap: 8px; align-items: center; padding: 5px 5px 5px 4px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.chat-input input { border: 0; background: transparent; min-height: 40px; }
.chat-input input:focus { box-shadow: none; }

/* ---------- Activity ---------- */
.timeline { position: relative; height: 34px; }
.tl-bar { position: absolute; left: 0; right: 0; top: 13px; height: 8px; border-radius: 99px; background: var(--brand-soft); }
.tl-mark { position: absolute; top: 6px; width: 10px; height: 22px; margin-left: -5px; border-radius: 4px; border: 2px solid var(--surface); }
.tl-mark.alert { background: var(--danger); }
.tl-mark.clear { background: var(--mint); }
.tl-mark.test { background: var(--brand); }
.tl-axis { font-size: 11px; font-weight: 600; }
.legend { gap: 14px; font-size: 12px; font-weight: 700; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.lg-alert { background: var(--danger); }
.lg-clear { background: var(--mint); }
.lg-test { background: var(--brand); }
.filters { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.filters button { flex: none; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 800; color: var(--body); }
.filters button[aria-pressed="true"] { background: var(--inverse); color: var(--inverse-ink); border-color: var(--inverse); }

/* ---------- Alert detail ---------- */
.alert-page { gap: 14px; padding-top: 0; }
.alert-head { margin: 0 -18px; padding: max(18px, env(safe-area-inset-top)) 18px 20px; display: flex; flex-direction: column; gap: 14px; background: var(--danger); color: #fff; }
.alert-head .icon-btn { background: rgba(255,255,255,.18); border-color: transparent; color: #fff; }
.alert-head .kicker { color: rgba(255,255,255,.88); }
.alert-head h1 { font-size: 22px; color: #fff; }
.alert-head .glyph { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: #fff; color: var(--danger); flex: none; }
.alert-head.unverified { background: var(--amber-soft); color: var(--amber); }
.alert-head.unverified h1, .alert-head.unverified .kicker { color: var(--amber); }
.alert-head.unverified .glyph { color: var(--amber); }
.alert-head.unverified .icon-btn { background: rgba(0,0,0,.06); color: var(--amber); }
.alert-head.clear { background: var(--mint-soft); color: var(--mint); }
.alert-head.clear h1, .alert-head.clear .kicker { color: var(--mint); }
.alert-head.clear .glyph { color: var(--mint); }
.alert-head.clear .icon-btn { background: rgba(0,0,0,.06); color: var(--mint); }
.alert-head.test { background: var(--brand-soft); color: var(--brand-ink); }
.alert-head.test h1, .alert-head.test .kicker { color: var(--brand-ink); }
.alert-head.test .glyph { color: var(--brand); }
.alert-head.test .icon-btn { background: rgba(0,0,0,.06); color: var(--brand-ink); }
.alert-body { display: flex; flex-direction: column; gap: 14px; }
.snap { position: relative; border-radius: 20px; overflow: hidden; background: var(--feed); }
.snap img { display: block; width: 100%; }
.snap .box { position: absolute; border: 2px dashed #FACC15; border-radius: 6px; }
.snap .box.face { border: 2px solid #F87171; }
.snap .box span { position: absolute; left: -2px; top: -20px; background: #FACC15; color: #1F1300; font: 600 10px 'JetBrains Mono', monospace; padding: 2px 5px; border-radius: 4px; white-space: nowrap; }
.snap .box.face span { background: #F87171; color: #fff; }
.snap .caption { position: absolute; right: 8px; bottom: 8px; background: rgba(11,16,32,.8); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 8px; }
.why p { font-size: 15px; color: var(--ink); line-height: 1.5; }
.steps-card { padding: 4px 16px; }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; font-size: 14px; }
.steps li + li { border-top: 1px solid var(--line); }
.steps small { display: block; color: var(--muted); font-size: 12px; }
.steps .n { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); font-size: 12px; font-weight: 800; flex: none; }
.steps .n.hot { background: var(--danger); color: #fff; }
.steps .n.ok { background: var(--mint-soft); color: var(--mint); }
.alert-actions { margin-top: auto; }
.resp-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.resp-state { display: flex; align-items: center; gap: 10px; padding: 12px 14px; font-weight: 700; font-size: 14px; }
.resp-state.on-it { background: var(--brand-soft); color: var(--brand-ink); }
.resp-state.false-alarm { background: var(--surface-2); color: var(--body); }
.resp-notes { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 4px; font-size: 14px; color: var(--body); }
.resp-state + .resp-notes { margin-top: 10px; }
.resp-btns + .note { margin-top: 10px; }

.alert-modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; background: var(--scrim); animation: fade .2s var(--ease); }
.modal-card { position: relative; width: min(640px, 100%); max-height: calc(100dvh - 48px); overflow-y: auto; background: var(--surface); border-radius: 26px; padding: 0 20px 18px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.modal-card .alert-head { margin: 0 -20px; padding-top: 20px; border-radius: 26px 26px 0 0; }
.modal-x { position: absolute; right: 14px; top: 14px; z-index: 2; width: 36px; height: 36px; background: rgba(255,255,255,.7); border-color: transparent; color: #0F172A; }
.modal-card .alert-head .mono { margin-right: 44px; }
@keyframes fade { from { opacity: 0; } }

/* ---------- Account ---------- */
.acc-grid { display: flex; flex-direction: column; gap: 14px; }
.me-card { display: flex; align-items: center; gap: 12px; }
.me-card b { display: block; font-size: 17px; }
.me-card small { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.theme-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px; border-radius: 14px; border: 2px solid var(--line); background: transparent; font-size: 13px; font-weight: 800; }
.theme-card[aria-pressed="true"] { border-color: var(--brand-strong); }
.theme-card .sw { width: 100%; height: 36px; border-radius: 10px; display: block; }
.sw-light { background: #F6F7FB; border: 1px solid #CBD2DE; }
.sw-dark { background: #0B1020; border: 1px solid #263049; }
.sw-auto { background: linear-gradient(90deg, #F6F7FB 50%, #0B1020 50%); border: 1px solid #CBD2DE; }
.set-row, .set-link { display: flex; align-items: center; gap: 12px; padding: 10px 0; color: var(--ink); width: 100%; background: none; border: 0; text-align: left; }
.set-row + .set-row, .set-row + .set-link, .set-link + .set-link, .set-link + .set-row { border-top: 1px solid var(--line); }
.set-row b, .set-link b { display: block; font-size: 15px; font-weight: 700; }
.set-row small, .set-link small { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.set-link:hover { color: var(--ink); }
.set-link > .i:first-child { color: var(--brand); }
.set-link > .i:last-child { color: var(--muted); }
.licenses { display: block; }
.licenses summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; }
.licenses summary::-webkit-details-marker { display: none; }
.licenses ul { list-style: none; margin: 8px 0 0; padding: 0; font-size: 13px; }
.licenses li { display: flex; justify-content: space-between; padding: 5px 0; color: var(--body); }

/* ---------- About + legal ---------- */
.page { gap: 16px; }
.about, .legal, .members { display: flex; flex-direction: column; gap: 14px; }
.about-hero { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px 0 14px; border-radius: 26px; background: var(--brand-soft); }
.about-hero b { font-size: 22px; font-weight: 900; }
.num-list { margin: 0; padding: 0; list-style: none; counter-reset: n; display: flex; flex-direction: column; gap: 12px; }
.num-list li { counter-increment: n; display: flex; gap: 12px; font-size: 14px; line-height: 1.5; color: var(--body); }
.num-list li::before { content: counter(n); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 900; font-size: 13px; flex: none; }
.num-list b { color: var(--ink); }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 4px 0; }
.kv span { color: var(--muted); text-align: right; }
.legal section { display: flex; flex-direction: column; gap: 8px; }
.legal h2 { font-size: 17px; }
.legal p { color: var(--body); font-size: 14px; line-height: 1.65; }

/* ---------- Add-a-guardian flow ---------- */
.flow { min-height: 100dvh; display: flex; flex-direction: column; }
.flow-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: max(16px, env(safe-area-inset-top)) 18px 0; max-width: 480px; width: 100%; margin: 0 auto; }
.flow-label { font-size: 13px; font-weight: 800; color: var(--muted); }
.flow-body { flex: 1; }
.flow-body .screen { padding-top: 14px; }
.choice-card { display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.choice-card:hover { color: var(--ink); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.choice-card.primary { border: 2px solid var(--brand-strong); }
.choice-card > .row b { font-size: 17px; line-height: 1.25; }
.choice-card p { font-size: 14px; color: var(--body); line-height: 1.5; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.list-row + .list-row { border-top: 1px solid var(--line); }
.list-row b { display: block; font-size: 14px; }
.list-row small { color: var(--muted); font-size: 12px; }

.qr-card { display: flex; flex-direction: column; align-items: stretch; gap: 14px; }
.qr { position: relative; display: grid; place-items: center; align-self: center; width: min(240px, 70vw); aspect-ratio: 1; padding: 14px; border-radius: 20px; background: #fff; border: 1px solid #E6E9F2; }
.qr img { width: 100%; height: 100%; }
.qr .label { color: #475569; text-align: center; }
.qr-logo { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: #fff; }
.qr.expired img { opacity: .15; }
.qr-meta { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.qr-meta .i { width: 16px; height: 16px; }
.qr-meta .link-btn { margin-left: 6px; font-size: 13px; }
.waiting { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 16px; background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; font-size: 14px; }
.waiting.ok { background: var(--mint-soft); color: var(--mint); }

.ollie-say { display: flex; align-items: flex-end; gap: 10px; }
.bubble { position: relative; padding: 12px 14px; border-radius: 18px 18px 18px 6px; background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--line); font-family: Nunito, sans-serif; font-weight: 800; font-size: 15px; line-height: 1.35; }
.ollie-say .bubble { margin-bottom: 24px; }

.tut { gap: 16px; }
.tut-art { position: relative; height: 260px; border-radius: 28px; background: var(--brand-soft); overflow: hidden; display: flex; align-items: flex-end; justify-content: center; }
.tut-art .o3d { margin-bottom: -20px; }
.tut-art.night { background: #0B1020; }
.tut-phone { position: absolute; left: 22px; top: 22px; display: grid; place-items: center; width: 44px; height: 60px; border-radius: 10px; background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.tut-crib { position: absolute; left: 0; bottom: 30px; width: 36%; height: 90px; border: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); border-left: 0; border-radius: 0 14px 14px 0; }
.tut-dist { position: absolute; left: 76px; top: 56px; padding: 3px 8px; border-radius: 8px; background: var(--surface); font-size: 12px; font-weight: 800; color: var(--brand); }
.tut-cord { position: absolute; right: 26px; top: 30px; width: 60px; height: 160px; border-right: 4px solid #B45309; border-radius: 0 50% 50% 0; }
.tut-keep { position: absolute; left: 22px; top: 22px; padding: 3px 8px; border-radius: 8px; background: var(--danger-soft); color: var(--danger-ink); font-size: 12px; font-weight: 800; }
.tut-dim { position: absolute; left: 50%; top: 22px; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.08); color: #CBD6FF; font-size: 12px; font-weight: 800; white-space: nowrap; }
.tut-notif { position: absolute; left: 16px; right: 16px; top: 16px; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); font-size: 13px; }
.tut-notif small { color: var(--muted); }
.tut-nav { gap: 10px; }
.tut-nav .btn { min-width: 96px; }
.tut .lede { min-height: 96px; }

.place-feed { aspect-ratio: 4 / 3; }
.check-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.check-row + .check-row { border-top: 1px solid var(--line); }
.check-row b { display: block; font-size: 14px; font-weight: 700; }
.check-row small { display: block; color: var(--muted); font-size: 12px; }
.check-ic { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; flex: none; }
.check-ic .i { width: 15px; height: 15px; stroke-width: 2.6; }
.check-row.ok .check-ic { background: var(--mint-soft); color: var(--mint); }
.check-row.todo .check-ic { background: var(--amber-soft); color: var(--amber); }

/* ---------- Dialog sheet ---------- */
.sheet { width: min(440px, calc(100% - 24px)); border: 0; border-radius: 24px; padding: 20px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.sheet::backdrop { background: var(--scrim); }

/* ---------- Guardian device ---------- */
.guardian-mode { background: var(--bg); }
.gd { min-height: 100dvh; display: flex; flex-direction: column; gap: 12px; padding: max(14px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; }
.gd-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.gd-top .pill .i { width: 18px; height: 14px; stroke-width: 2.6; }
.gd-chips { gap: 6px; }
.gd-alert-kicker { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 12px; font-weight: 900; letter-spacing: .03em; }
.gd-alert-kicker .i { width: 16px; height: 16px; }
.gd-paused { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 14px; background: var(--amber-soft); color: var(--amber); font-size: 13px; font-weight: 700; }
.gd-paused .i { width: 18px; height: 18px; }
.gd-ollie { position: relative; flex: 1; min-height: 300px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; border-radius: 30px; background: var(--brand-soft); overflow: hidden; }
.gd-ollie .bubble { position: absolute; left: 14px; right: 14px; top: 14px; z-index: 2; font-size: 18px; border: 0; } /* Ollie's head never hides what Ollie says */
.o-guard { height: min(46vh, 330px); aspect-ratio: 480 / 600; margin-bottom: -40px; }
.talk { position: absolute; bottom: 14px; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 0; background: var(--surface); box-shadow: var(--shadow); font-size: 13px; font-weight: 800; }
.talk .i { width: 18px; height: 18px; }
.gd-feed { display: flex; flex-direction: column; gap: 8px; }
.gd-feed .feed { aspect-ratio: 16 / 9; }
.gd-feed .feed video { opacity: 1; object-fit: contain; background: #000; }
/* A camera facing the user shows a mirror image, like a selfie preview; parents get the true image. */
.gd-feed .feed.mirror video { transform: scaleX(-1); }
.gd-feed .live-chip { display: inline-flex; }
.gd-foot { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); }
.gd.alerting .gd-ollie { background: var(--danger-soft); }
.gd.alerting .gd-ollie .bubble { color: var(--danger-ink); }
.gd.alerting .feed { outline: 3px solid var(--danger); outline-offset: -3px; }
.gd.reviewing .gd-ollie { background: color-mix(in srgb, var(--brand-soft) 70%, var(--amber-soft)); }
.gd .stats .stat b { font-size: 13px; }
.code-box + .label { margin-top: 4px; }

/* Landscape: Ollie on the left, feed on the right */
@media (orientation: landscape) and (max-height: 700px) {
  .gd { display: grid; grid-template-columns: minmax(240px, 38%) 1fr; grid-template-rows: auto auto 1fr auto; max-width: none; column-gap: 14px; row-gap: 10px; min-height: 100dvh; padding: 12px 18px; }
  .gd-top { grid-column: 2; grid-row: 1; }
  .gd-paused { grid-column: 2; grid-row: 2; }
  .gd-ollie { grid-column: 1; grid-row: 1 / 5; min-height: 0; position: sticky; top: 12px; height: calc(100dvh - 24px); }
  .gd-ollie .bubble { font-size: 16px; }
  .o-guard { height: min(62vh, 260px); margin-bottom: -34px; }
  .gd-feed { grid-column: 2; grid-row: 3; min-height: 0; }
  .gd-foot { grid-column: 2; grid-row: 4; }
}

/* Guardian: scan screen */
.scan { min-height: 100dvh; }
.scanner { position: relative; aspect-ratio: 3 / 4; max-height: 52vh; border-radius: 26px; overflow: hidden; background: #0B1020; }
.scanner video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; inset: 18%; }
.scan-frame span { position: absolute; width: 34px; height: 34px; border: 4px solid #6EE7B7; }
.scan-frame span:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; border-radius: 10px 0 0 0; }
.scan-frame span:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; border-radius: 0 10px 0 0; }
.scan-frame span:nth-child(3) { left: 0; bottom: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 10px; }
.scan-frame span:nth-child(4) { right: 0; bottom: 0; border-left: 0; border-top: 0; border-radius: 0 0 10px 0; }
.scan-msg { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 14px; background: rgba(11,16,32,.85); color: #6EE7B7; font-weight: 800; font-size: 14px; }
.scan-msg.warn { color: #FCD34D; font-weight: 700; font-size: 13px; }

/* ---------- Detection Lab (test.html) ---------- */
.lab { max-width: 1200px; margin: 0 auto; padding: 32px 24px 56px; display: flex; flex-direction: column; gap: 28px; }
.lab-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.lab-header .inner { max-width: 1200px; margin: 0 auto; padding: 14px 24px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.lab h1 { font-size: clamp(28px, 4vw, 36px); font-weight: 900; }
.lab-top { display: flex; flex-wrap: wrap; gap: 20px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.badge.mint { background: var(--mint-soft); color: var(--mint); }
.drop { flex: 2 1 420px; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 180px; background: var(--surface); border: 2px dashed var(--line); border-radius: 22px; padding: 24px; text-align: center; cursor: pointer; position: relative; }
.drop.over, .drop:focus-within { border-color: var(--brand); background: var(--brand-soft); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.rules { flex: 1 1 280px; min-width: 0; }
.rules .r { display: flex; justify-content: space-between; font-size: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rules .r:last-of-type { border-bottom: 0; }
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.result { background: var(--surface); border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.result canvas { display: block; width: 100%; height: auto; background: var(--feed); }
.result .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.result .metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.result .metrics span { display: block; font-size: 11px; color: var(--muted); }
.result .metrics b { font-size: 14px; }
.verdict { font-size: 11px; font-weight: 800; border-radius: 6px; padding: 3px 7px; }
.verdict.no { background: var(--mint-soft); color: var(--mint); }
.verdict.yes { background: var(--danger-soft); color: var(--danger-ink); }

/* ---------- Desktop (≥ 900px) ---------- */
@media (min-width: 900px) {
  .mob, .mob-only { display: none !important; }
  .tabbar { display: none; }
  .has-tabs .screen { padding-bottom: 40px; }
  .toast { bottom: 28px; }

  .layout { display: grid; grid-template-columns: 248px 1fr; min-height: 100dvh; }
  .sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; gap: 18px; padding: 22px 16px; background: var(--surface); border-right: 1px solid var(--line); }
  .sidebar .brand { padding: 0 6px; }
  .hh-switch { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; border: 1px solid var(--line); color: var(--ink); }
  .hh-switch b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hh-switch small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hh-switch .grow { min-width: 0; }
  .hh-switch > .i { color: var(--muted); }
  .side-nav { display: flex; flex-direction: column; gap: 4px; }
  .side-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; color: var(--body); font-weight: 700; }
  .side-nav a:hover { background: var(--surface-2); color: var(--ink); }
  .side-nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
  .side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
  .side-foot .seg { display: flex; }
  .side-foot .seg button { flex: 1; }
  .me { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; font-size: 14px; padding: 0 4px; }
  .main { min-width: 0; }
  .main .screen, .main .page { max-width: 880px; padding: 34px 36px 48px; }
  .page { margin: 0 auto; display: flex; flex-direction: column; }
  .main .page.alert-page { max-width: 820px; padding-top: 28px; }
  .alert-page .alert-head { margin: 0; border-radius: 24px; padding-top: 18px; }
  .alert-page .alert-body, .modal-card .alert-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .alert-page .alert-actions { flex-direction: row; }
  .alert-page .alert-actions > * { flex: 1; }

  /* Home */
  .desk-home { max-width: 1180px; margin: 0 auto; padding: 28px 32px 40px; display: flex; flex-direction: column; gap: 20px; }
  .desk-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
  .desk-head h1 { font-size: 28px; }
  .desk-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, 1fr); gap: 18px; }
  .desk-grid.lower { grid-template-columns: minmax(0, 1.45fr) minmax(320px, 1fr); }
  .live-card { display: flex; flex-direction: column; gap: 12px; }
  .desk-feed { aspect-ratio: 16 / 10; }
  .chat-card { display: flex; flex-direction: column; gap: 12px; padding: 0; overflow: hidden; height: 100%; max-height: 640px; }
  .chat-top { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .chat-top b { display: block; }
  .chat-top .tag { margin-left: auto; }
  .chat-card .chat-log { padding: 4px 16px; min-height: 260px; }
  .chat-card .chat-bottom { padding: 0 16px 16px; }
  .desk-empty { display: flex; align-items: center; gap: 20px; padding: 24px 28px 0; background: var(--brand-soft); border: 0; }
  .desk-empty .stack-sm { padding-bottom: 24px; align-items: flex-start; }
  .desk-empty .say { font-family: Nunito, sans-serif; font-weight: 800; font-size: 18px; color: var(--brand-ink); max-width: 520px; }

  /* Chat screen */
  .chat-screen { min-height: 100dvh; max-width: 820px !important; }
  .chat-full { max-height: calc(100dvh - 150px); }

  /* Account → Settings */
  .acc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .acc-grid .me-card { grid-column: 1 / -1; }
  .account .btn-logout { max-width: 320px; align-self: flex-start; }
  .account .fine { text-align: left; }

  /* Flow */
  .flow-head { max-width: none; padding: 14px 28px; background: var(--surface); border-bottom: 1px solid var(--line); }
  .flow-head .brand { font-size: 18px; }
  .stepper { display: flex !important; gap: 8px; list-style: none; margin: 0; padding: 0; }
  .stepper li { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 800; }
  .stepper li.done { background: var(--mint-soft); color: var(--mint); }
  .stepper li.now { background: var(--brand-strong); color: #fff; }
  .stepper .i { width: 14px; height: 14px; }
  .flow-body .screen.narrow { max-width: 600px; padding-top: 32px; }
  .pair { display: grid; grid-template-columns: minmax(320px, 400px) minmax(0, 480px); justify-content: center; gap: 40px; padding: 36px 32px; }
  .pair .screen { padding: 0; max-width: none; }
  .pair-side { display: flex !important; flex-direction: column; gap: 16px; padding-top: 6px; }
  .pair-side h1 { font-size: 28px; }

  .narrow { max-width: 600px; }
}
@media (min-width: 1280px) {
  .chat-card { max-height: 680px; }
}

/* ---------- Guardian options (⋯) ---------- */
.more-btn { width: 36px; height: 36px; border-radius: 12px; }
.more-btn .i { width: 20px; height: 20px; }
.g-card-link { display: block; }
.g-meta a.grow { color: var(--ink); }
.g-meta a.grow:hover { color: var(--ink); }
.g-row { padding: 6px 8px 6px 4px; gap: 6px; }
.g-row-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; padding: 6px 4px 6px 10px; border: 0; background: none; text-align: left; color: var(--ink); }
.g-row-main b { display: block; }
.g-row-main small { color: var(--muted); font-size: 12px; font-weight: 600; }
.sheet h2 { font-size: 18px; }
.code-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.code-row code { font-size: 13px; letter-spacing: .04em; }
.unpair-box { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 16px; background: var(--danger-soft); }
.unpair-box b { color: var(--danger-ink); }
.unpair-box small { color: var(--body); font-size: 13px; line-height: 1.45; margin-bottom: 6px; }

/* ---------- Tutorial scenes (SVG) ---------- */
.tut-art.scene { align-items: center; padding: 6px 4px 0; }
.tut-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.tut-svg .ink-fill { fill: var(--ink); }
.tut-svg .ink-line { stroke: var(--ink); }
.tut-svg .bg-fill { fill: var(--brand-soft); }
.tut-svg .floor { stroke: color-mix(in srgb, var(--ink) 18%, transparent); stroke-width: 2; stroke-linecap: round; }
.tut-svg .wall { stroke: color-mix(in srgb, var(--ink) 10%, transparent); stroke-width: 2; }
.tut-svg .wood rect { fill: #E7CBA9; }
.tut-svg .wood-detail rect { fill: #F3DFC6; stroke: #C79A6B; stroke-width: 1.5; }
.tut-svg .wood-detail circle { fill: #9A6A3A; }
html[data-theme="dark"] .tut-svg .wood rect { fill: #6B5236; }
html[data-theme="dark"] .tut-svg .wood-detail rect { fill: #7E6243; stroke: #A9835A; }
html[data-theme="dark"] .tut-svg .wood-detail circle { fill: #E7CBA9; }
.tut-svg .ph-screen { fill: var(--brand-strong); }
.tut-svg .ph-dot { fill: #fff; opacity: .9; }
.tut-svg .view-cone { fill: var(--brand); fill-opacity: .13; }
.tut-svg .dim-guide { stroke: var(--brand); stroke-width: 1.5; stroke-dasharray: 3 4; opacity: .7; }
.tut-svg .view-edge { stroke: var(--brand); stroke-width: 1.6; stroke-dasharray: 4 5; fill: none; opacity: .6; }
.tut-svg .dim { stroke: var(--brand); stroke-width: 2; stroke-dasharray: 6 5; }
.tut-svg .dim-tick { stroke: var(--brand); stroke-width: 2.5; stroke-linecap: round; }
.tut-svg .dim.danger, .tut-svg .dim-tick.danger { stroke: var(--danger-ink); }
.tut-svg .pill-brand rect { fill: var(--surface); stroke: color-mix(in srgb, var(--brand) 35%, transparent); }
.tut-svg .pill-brand text { fill: var(--brand); }
.tut-svg .pill-danger rect { fill: var(--surface); stroke: color-mix(in srgb, var(--danger) 35%, transparent); }
.tut-svg .pill-danger text { fill: var(--danger-ink); }
.tut-svg text { font: 800 13px Nunito, 'PingFang TC', sans-serif; }
.tut-svg .zone { fill: var(--danger); fill-opacity: .06; stroke: var(--danger-ink); stroke-width: 1.8; stroke-dasharray: 7 6; }
.tut-svg .cord { fill: none; stroke-width: 3.5; stroke-linecap: round; }
.tut-svg .cord.bad { stroke: #B45309; }
.tut-svg .cord.ok { stroke: color-mix(in srgb, var(--ink) 55%, transparent); }
.tut-svg .cord-plug.bad { fill: #B45309; }
.tut-svg .cord-plug.ok { fill: color-mix(in srgb, var(--ink) 55%, transparent); }
.tut-svg .outlet { fill: var(--surface); stroke: color-mix(in srgb, var(--ink) 25%, transparent); stroke-width: 1.5; }
.tut-svg .outlet-hole { fill: color-mix(in srgb, var(--ink) 50%, transparent); }
.tut-svg .mk-badge circle { stroke: var(--surface); stroke-width: 3; }
.tut-svg .mk-badge path { fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.tut-svg .mk-badge.bad circle { fill: var(--danger); }
.tut-svg .mk-badge.ok circle { fill: #059669; }

/* ---------- User menu ---------- */
.avatar-btn { border: 0; cursor: pointer; padding: 0; }
.avatar-btn[aria-expanded="true"] { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 35%, transparent); }
.me { width: 100%; border: 0; background: none; text-align: left; border-radius: 12px; padding: 6px 8px 6px 4px; cursor: pointer; }
.me:hover, .me[aria-expanded="true"] { background: var(--surface-2); }
.me > .i { color: var(--muted); width: 18px; height: 18px; }
.user-menu { position: fixed; z-index: 85; width: 272px; padding: 8px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 18px 50px rgba(15,23,42,.18), 0 2px 6px rgba(15,23,42,.06); animation: um-in .14s var(--ease); }
html[data-theme="dark"] .user-menu { box-shadow: 0 18px 50px rgba(0,0,0,.5); }
.user-menu.from-bottom { transform-origin: bottom left; }
.user-menu.from-top { transform-origin: top right; }
@keyframes um-in { from { opacity: 0; transform: scale(.96); } }
.um-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 10px; }
.um-head b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.um-head small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.um-sep { height: 1px; background: var(--line); margin: 4px 6px; }
.um-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 42px; padding: 0 10px; border: 0; border-radius: 10px; background: none; color: var(--ink); font-size: 15px; font-weight: 600; text-align: left; }
.um-item:hover, .um-item:focus-visible { background: var(--surface-2); color: var(--ink); outline: none; }
.um-item > .i:first-child { color: var(--body); }
.um-chev { width: 16px; height: 16px; color: var(--muted); transition: transform .15s var(--ease); }
.um-item[aria-expanded="true"] .um-chev { transform: rotate(90deg); }
.um-help { margin: 2px 6px 6px; padding: 12px; border-radius: 12px; background: var(--brand-soft); display: flex; flex-direction: column; gap: 6px; }
.um-help b { font-size: 14px; color: var(--brand-ink); }
.um-help p { font-size: 13px; line-height: 1.45; color: var(--body); }
.um-mail { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; }
.um-mail .i { width: 18px; height: 18px; }
.js-um-logout, .js-um-logout > .i:first-child { color: var(--danger-ink) !important; }

/* Guardian: front/back camera switch, top right of the preview */
.flip-btn { position: absolute; right: 10px; top: 10px; z-index: 2; width: 44px; height: 44px; background: rgba(11,16,32,.8); color: #fff; border: 0; }
.flip-btn:disabled { opacity: .5; }

/* Member role menu on the household page */
.role-select { width: auto; min-height: 36px; padding: 0 10px; border-radius: 10px; font-size: 14px; font-weight: 700; }

/* Account: danger zone under Log out */
.danger-zone { border: 1px solid var(--danger-soft); }
.danger-zone .kicker { color: var(--danger-ink); }
.danger-link { color: var(--danger-ink); align-self: center; }

/* Invites: a count on the Activity button (side menu and tab bar) and cards at the top of Activity */
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 12px; font-weight: 900; display: inline-grid; place-items: center; }
.tab-ic .nav-badge { position: absolute; top: -6px; right: -12px; margin: 0; }
.tab-ic:has(.nav-badge) .js-tabdot { display: none; }
.invite-card { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.invite-card .grow { display: flex; flex-direction: column; gap: 2px; flex: 1 1 220px; min-width: 0; }
.invite-card .grow small { color: var(--muted); }
.empty-home { align-items: center; text-align: center; max-width: 520px; }
.hh-picker { gap: 12px; align-items: center; }
.hh-picker select { margin-top: 4px; }

/* First sign-in: agree to the terms */
.agree-check { display: flex; gap: 12px; align-items: flex-start; font-weight: 700; cursor: pointer; }
.agree-check input { width: 22px; min-height: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--brand); }
.agree-docs { max-height: min(48vh, 460px); overflow-y: auto; overscroll-behavior: contain; }
.agree-docs .doc-title { margin-top: 8px; }
.agree-check:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.hint .down { transform: rotate(90deg); }

/* ---------- Care modes: Baby, Pet, Older adult ---------- */
.tile-icon.mode-baby { background: var(--brand-soft); color: var(--brand); }
.tile-icon.mode-pet { background: var(--peach-soft); color: var(--peach); }
.tile-icon.mode-elder { background: var(--mint-soft); color: var(--mint); }
.pill.gray { background: var(--surface-2); color: var(--body); }
.pill.warn-strong { background: var(--amber-soft); color: var(--amber); outline: 1.5px solid color-mix(in srgb, var(--amber) 45%, transparent); }
.g-row-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; min-height: 52px; background: none; border: 0; padding: 0; text-align: left; color: inherit; }
.g-chev { color: var(--muted); width: 18px; height: 18px; }
.stat.warm { background: var(--amber-soft); border-color: transparent; }
.stat.warm span, .stat.warm b { color: var(--amber); }
.tag.checked { background: var(--mint-soft); color: var(--mint); }
.tag.activity { background: var(--peach-soft); color: var(--peach); }
.status-bar { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 16px; font-family: Nunito, sans-serif; font-weight: 800; font-size: 16px; background: var(--surface-2); color: var(--body); }
.status-bar .i { width: 22px; height: 22px; }
.status-bar.ok { background: var(--mint-soft); color: var(--mint); }
.status-bar.warn { background: var(--amber-soft); color: var(--amber); }
.status-bar.gray, .status-bar.off { background: var(--surface-2); color: var(--muted); }
.status-bar.soft { background: var(--brand-soft); color: var(--brand-ink); }
.check-banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--amber-soft); color: var(--amber); margin: 0 0 12px; min-height: 52px; }
.check-banner b { display: block; color: var(--amber); }
.check-banner small { color: var(--amber); font-weight: 600; }
.check-banner:hover { color: var(--amber); }
.main > .check-banner { margin: 16px 18px 0; }
.choice-card.disabled { opacity: .6; }
.resp-btns.three { grid-template-columns: 1fr 1fr; }
.resp-btns.three > :first-child { grid-column: 1 / -1; }
.resp-state.checked { background: var(--mint-soft); color: var(--mint); }
.review-card .tile-icon { width: 40px; height: 40px; }
.review-card b { font-size: 16px; }
.review-card small { color: var(--muted); font-weight: 600; }
.review-card.done .tile-icon { background: var(--brand-soft); color: var(--brand); }
.responders ul { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.responders li { display: flex; gap: 8px; align-items: center; font-weight: 700; font-size: 14px; }
.responders .i { width: 18px; height: 18px; color: var(--mint); }
.alert-head .sub { font-size: 16px; font-weight: 700; opacity: .9; }
.plain-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; color: var(--body); }
.consent .agree-check { font-weight: 700; }
.feed .zone-overlay { pointer-events: none; z-index: 1; }
.live-feed video, .zone-feed video, .desk-feed video { object-fit: contain; background: #000; }
.feed.mirror .zone-overlay { transform: none; }
.feed.paused .feed-empty { background: var(--surface-2); color: var(--muted); }
/* --ar is the guardian video's width / height, set by the editor. Tall video stays within the screen height. */
.zone-feed { --ar: 1.7778; aspect-ratio: var(--ar); width: min(100%, calc(var(--ar) * 62vh)); width: min(100%, calc(var(--ar) * 62svh)); margin-inline: auto; touch-action: none; }
.zone-feed .zone-edit { pointer-events: auto; z-index: 2; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.zone-feed.mirror video { transform: scaleX(-1); }
.zone-sheet { max-height: calc(100vh - 24px); max-height: calc(100svh - 24px); overflow-y: auto; }
.zone-sheet .zone-feed { width: min(100%, calc(var(--ar) * 52vh)); width: min(100%, calc(var(--ar) * 52svh)); }
.ex-row input { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--input); color: var(--ink); min-height: 40px; }
.demo-chip { left: auto; right: 54px; background: rgba(146,64,14,.85); color: #FEF3C7; }

/* Guardian phone: the room and its care mode on top, capture state and viewers kept apart. */
.gd-title { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.gd-title b { font-size: 24px; font-weight: 900; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gd-title small { font-size: 14px; font-weight: 700; color: var(--muted); }
.gd-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.gd .chip-btn { min-height: 34px; min-width: 40px; justify-content: center; }
.camera-off { aspect-ratio: 16 / 9; border-radius: 22px; background: var(--surface-2); display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--body); }
.camera-off .i { width: 56px; height: 56px; stroke-width: 1.6; }
.camera-off b { font-size: 22px; }
.gd-off .gd-ollie { background: color-mix(in srgb, var(--surface-2) 60%, var(--brand-soft)); }
.gd .js-pause, .gd .js-resume { min-height: 56px; font-size: 18px; }
@media (orientation: landscape) and (max-height: 700px) {
  .gd { grid-template-rows: auto auto auto 1fr auto; }
  .gd-top { grid-column: 2; grid-row: 1; }
  .gd-chips { grid-column: 2; grid-row: 2; }
  .gd-paused { grid-column: 2; grid-row: 3; }
  .gd-ollie { grid-row: 1 / 6; }
  .gd-feed { grid-column: 2; grid-row: 4; }
  .gd-foot { grid-column: 2; grid-row: 5; }
  .camera-off { aspect-ratio: auto; min-height: 160px; }
}
.tut-art.mode-art { position: relative; display: grid; place-items: center; }
.tut-badge { position: absolute; right: 18%; bottom: 14%; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; background: var(--surface); color: var(--brand); box-shadow: var(--shadow); border: 1px solid var(--line); }
.tut-badge .i { width: 32px; height: 32px; }
.setup-banner { background: var(--brand-soft); color: var(--brand-ink); margin: 0; }
.setup-banner b, .setup-banner small, .setup-banner:hover { color: var(--brand-ink); }
