/*
 * Elda's screen on the family's TV. Elda's look (apps/mobile/components/elda/theme.ts): cream page,
 * white cards with a warm hairline, espresso ink, rust actions, apricot for Elda herself. Drawn at
 * 1920x1080 (a 4K TV at 200%) and scaled to fit any window by app.js. Type is sized for a 43-inch TV
 * across a room: nothing that must be read is under 20px.
 */
:root {
  --page: #FBF6EF; --card: #FFFFFF; --border: #EADFD2; --hairline: #F2EAE0;
  --espresso: #33261B; --text: #1F1A16; --secondary: #5C5047; --muted: #7A6E62; --taupe: #A69A8C;
  --apricot: #F28A3D; --rust: #B5532A; --rust-dark: #9C4523; --tint: #FCE6D4; --sand: #F4ECE2;
  --alert: #C2410C; --alert-bg: #FDECE4; --success: #2F7D4F; --success-bg: #E5F1E9;
  --board: #FFFAF4; --board-edge: #F3C9A6;
  color-scheme: light;
  --display: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
  --body: 'Atkinson Hyperlegible', ui-sans-serif, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--page); color: var(--text); font-family: var(--body); }
body { overflow: hidden; -webkit-font-smoothing: antialiased; }
button { font: inherit; }
svg { display: block; }
.noscript { padding: 40px; font-size: 24px; }

/* ------------------------------------------------------------ stage */
#viewport { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--page); }
.stage { position: relative; width: 1920px; height: 1080px; flex: none; padding: 40px 56px 44px; display: flex; flex-direction: column; gap: 32px; overflow: hidden; transform-origin: center center; background: var(--page); }
.stage.night::after { content: ''; position: absolute; inset: 0; background: rgba(31, 26, 22, .5); pointer-events: none; transition: opacity 2s; z-index: 40; }

/* ------------------------------------------------------------ top bar */
.top { height: 72px; flex: none; display: flex; align-items: center; gap: 28px; }
.wordmark { font-family: var(--display); font-weight: 700; font-size: 50px; line-height: 1; letter-spacing: -.02em; color: var(--text); }
.wordmark span { color: var(--apricot); }
.sep { width: 2px; height: 44px; background: var(--border); }
.status { display: flex; align-items: center; gap: 16px; font-size: 26px; font-weight: 700; color: var(--espresso); }
.status-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 6px var(--success-bg); }
.status[data-tone="elda"] .status-dot { background: var(--apricot); box-shadow: 0 0 0 6px var(--tint); }
.status[data-tone="web"] .status-dot { background: var(--alert); box-shadow: 0 0 0 6px var(--alert-bg); }
.status[data-tone="off"] .status-dot { background: var(--taupe); box-shadow: 0 0 0 6px var(--sand); }
.grow { flex: 1; }
.chip { display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 24px 0 18px; border-radius: 999px; background: var(--card); border: 1.5px solid var(--border); font-size: 22px; font-weight: 700; color: var(--espresso); white-space: nowrap; }
.chip svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.chip .state { display: flex; align-items: center; gap: 8px; color: var(--success); }
.chip .state::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.chip .state.off { color: var(--muted); }
.chip .soft { font-weight: 400; color: var(--secondary); }
.chip.hearing { background: var(--success-bg); border-color: #BFDCC9; color: #1F5A37; }
.chip.hearing .state { color: #1F5A37; }
.clock { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; margin-left: 12px; }
.clock-time { font-family: var(--display); font-weight: 700; font-size: 42px; line-height: 1; font-variant-numeric: tabular-nums; }
.clock-time span { font-size: 24px; color: var(--muted); }
.clock-date { font-size: 21px; color: var(--secondary); }
.stage[data-view="resting"] .top .clock { display: none; }

/* ------------------------------------------------------------ body + shared parts */
.body { flex: 1; min-height: 0; position: relative; }
.view { position: absolute; inset: 0; display: none; }
.stage[data-view="resting"] .view-resting, .stage[data-view="live"] .view-live, .stage[data-view="health"] .view-health, .stage[data-view="history"] .view-history { display: grid; animation: fade .5s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.label { display: flex; align-items: center; gap: 14px; font-size: 22px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--rust); }
.label .dot, .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--apricot); flex: none; }
.card { background: var(--card); border: 1.5px solid var(--border); border-radius: 28px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 14px; border-radius: 999px; font-size: 20px; font-weight: 700; white-space: nowrap; }
.pill.done { background: var(--success-bg); color: var(--success); }
.pill.next, .pill.info, .pill.pending { background: var(--tint); color: var(--rust-dark); }
.pill.alert, .pill.missed, .pill.failed { background: var(--alert-bg); color: var(--alert); }
.icon-chip { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none; }
.icon-chip svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic-heart { background: #FDE8E8; color: #DC2626; } .ic-drop { background: #E6EFFE; color: #2563EB; }
.ic-steps { background: var(--success-bg); color: var(--success); } .ic-moon { background: #EEEAFB; color: #6A55C2; }
.ic-warm { background: var(--sand); color: var(--rust); }
.num { font-family: var(--display); font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1; }
.unit { font-size: 22px; color: var(--secondary); font-family: var(--body); font-weight: 400; }
.empty { color: var(--muted); font-size: 24px; }

/* The board: Elda's whiteboard, as on the phone's voice screen (EldaVoiceScreen.tsx) */
.board { position: relative; background: var(--board); border: 2px solid var(--board-edge); border-radius: 40px; box-shadow: 0 18px 60px rgba(242, 138, 61, .22), 0 2px 6px rgba(181, 83, 42, .06); padding: 30px 40px 34px; display: flex; flex-direction: column; gap: 18px; min-height: 0; }
.board-top { display: flex; align-items: center; gap: 14px; }
.board-top .label { flex: 1; }
.board-count { font-size: 22px; color: var(--muted); font-variant-numeric: tabular-nums; }
.board-heading { margin: 0; font-family: var(--display); font-weight: 700; font-size: 44px; line-height: 52px; color: var(--muted); text-transform: lowercase; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pointer { position: absolute; width: 28px; height: 28px; background: var(--board); border-color: var(--board-edge); border-style: solid; border-width: 0; transform: rotate(45deg); }
.pointer.left { left: -16px; border-left-width: 2px; border-bottom-width: 2px; border-bottom-left-radius: 6px; }
.pointer.right { right: -16px; border-top-width: 2px; border-right-width: 2px; border-top-right-radius: 6px; }
.pointer.down { bottom: -16px; left: 50%; margin-left: -14px; border-right-width: 2px; border-bottom-width: 2px; border-bottom-right-radius: 6px; }

/* Elda herself: one element that moves to where each view wants her */
#elda { position: absolute; z-index: 5; pointer-events: none; transition: left .8s cubic-bezier(.2, .8, .2, 1), top .8s cubic-bezier(.2, .8, .2, 1), width .8s, height .8s, opacity .5s; }
#elda .glow { position: absolute; left: 50%; top: 54%; width: 150%; height: 150%; transform: translate(-50%, -50%) scale(var(--glow-scale, 1)); border-radius: 50%; background: radial-gradient(circle, rgba(242, 138, 61, var(--glow-a, .42)) 0%, rgba(246, 168, 100, calc(var(--glow-a, .42) * .66)) 38%, rgba(251, 217, 188, calc(var(--glow-a, .42) * .38)) 60%, rgba(251, 246, 239, 0) 72%); transition: transform .15s linear, opacity .4s; }
#elda iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; opacity: 0; transition: opacity .4s; }
#elda.ready iframe { opacity: 1; }
#elda .still { position: absolute; left: 12%; top: 6%; width: 76%; height: 88%; object-fit: contain; transition: opacity .4s; }
#elda.ready .still { opacity: 0; }
#elda.bob .still { animation: bob 3.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px); } }
.stage[data-view="resting"] #elda { left: 1354px; top: var(--rest-top, 640px); width: 300px; height: 300px; }
.stage[data-view="live"] #elda { left: 56px; top: 460px; width: 380px; height: 380px; }
.stage[data-view="health"] #elda, .stage[data-view="history"] #elda { opacity: 0; left: 76px; top: 560px; width: 300px; height: 300px; }

/* ------------------------------------------------------------ resting */
.view-resting { grid-template-columns: minmax(0, 1fr) 720px; column-gap: 80px; }
.rest-left { display: flex; flex-direction: column; min-height: 0; padding-top: 8px; }
.greeting { font-family: var(--display); font-weight: 700; font-size: 64px; line-height: 72px; color: var(--espresso); }
.big-clock { display: flex; align-items: baseline; gap: 20px; margin-top: 4px; }
.big-clock .num { font-size: 260px; line-height: 232px; letter-spacing: -.045em; }
.big-clock .ampm { font-family: var(--display); font-weight: 700; font-size: 72px; color: var(--muted); }
.big-date { font-size: 48px; line-height: 58px; color: var(--secondary); margin-top: 12px; }
.done-row { display: flex; align-items: center; gap: 14px; margin-top: 30px; flex-wrap: wrap; }
.done-row:empty { display: none; }
.done-row .lead { font-size: 24px; font-weight: 700; color: var(--secondary); margin-right: 6px; }
.done-chip { display: flex; align-items: center; gap: 8px; height: 50px; padding: 0 22px 0 16px; border-radius: 999px; background: var(--success-bg); font-size: 24px; font-weight: 700; color: var(--success); max-width: 420px; }
.done-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.done-chip svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.last-talk { margin-bottom: 28px; padding: 22px 30px; border-radius: 28px; background: var(--board); border: 2px solid var(--board-edge); display: flex; flex-direction: column; gap: 6px; max-width: 920px; }
.last-talk[hidden] { display: none; }
.last-talk .when { font-size: 20px; color: var(--muted); font-variant-numeric: tabular-nums; }
.last-talk .q { font-family: var(--display); font-weight: 700; font-size: 34px; line-height: 42px; color: var(--espresso); }
.last-talk .a { font-size: 26px; line-height: 34px; color: var(--secondary); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.last-talk .a b { font-family: var(--display); color: var(--rust); margin-right: 12px; }
.ring-card { padding: 26px 36px 30px; display: flex; flex-direction: column; gap: 20px; border-radius: 32px; }
.ring-head { display: flex; align-items: center; gap: 12px; font-size: 24px; font-weight: 700; color: var(--espresso); }
.ring-head .ago { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 22px; font-weight: 400; color: var(--secondary); }
.ring-head .ago::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--success); }
.ring-head .ago.stale::before { background: var(--taupe); }
.ring-head svg, .card-head svg { width: 28px; height: 28px; fill: none; stroke: var(--rust); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ring-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.metric { display: flex; flex-direction: column; gap: 10px; }
.metric-name { display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 700; color: var(--secondary); }
.metric .num { font-size: 60px; }
.metric .num small { font-size: 26px; margin: 0 8px 0 2px; font-family: var(--display); }
.rest-right { display: flex; flex-direction: column; align-items: center; min-height: 0; }
.rest-right .board { align-self: stretch; padding: 30px 36px 34px; }
.rest-hint { position: absolute; left: 1088px; width: 720px; bottom: 34px; display: flex; align-items: center; justify-content: center; gap: 14px; font-size: 30px; font-weight: 700; color: var(--rust); }
.rest-hint svg { width: 42px; height: 42px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* timeline (a plan, Elda's timeline card) */
.timeline { display: flex; flex-direction: column; }
.tl-row { display: flex; gap: 20px; }
.tl-rail { width: 28px; flex: none; display: flex; flex-direction: column; align-items: center; }
.tl-rail .up { width: 3px; height: 8px; background: var(--border); }
.tl-row:first-child .tl-rail .up { background: transparent; }
.tl-rail .down { width: 3px; flex: 1; background: var(--border); }
.tl-row:last-child .tl-rail .down { background: transparent; }
.tl-dot { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--rust); background: var(--card); flex: none; }
.tl-dot.done { background: var(--rust); }
.tl-dot.next { border: 4px solid var(--apricot); box-shadow: 0 0 0 6px var(--tint); }
.tl-dot.missed, .tl-dot.alert { border-color: var(--alert); background: var(--alert); }
.tl-body { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 16px; padding-bottom: 18px; }
.tl-text { flex: 1; min-width: 0; }
.tl-title { font-size: 32px; line-height: 38px; font-weight: 700; color: var(--espresso); }
.tl-sub { font-size: 24px; line-height: 30px; color: var(--secondary); }
.tl-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.tl-time { font-size: 28px; line-height: 38px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl-time.strong { color: var(--espresso); font-weight: 700; }

/* ------------------------------------------------------------ live */
.view-live { grid-template-columns: 380px minmax(0, 1fr) 440px; grid-template-rows: minmax(0, 1fr) auto; column-gap: 40px; row-gap: 24px; }
.live-elda { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; padding-bottom: 6px; }
.elda-pill { display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 26px 0 20px; border-radius: 999px; background: var(--card); border: 1.5px solid var(--border); box-shadow: 0 4px 16px rgba(51, 38, 27, .06); font-size: 24px; font-weight: 700; color: var(--rust); white-space: nowrap; max-width: 380px; overflow: hidden; z-index: 6; }
.elda-pill .bars { display: flex; align-items: center; gap: 4px; height: 28px; }
.elda-pill .bars i { width: 5px; border-radius: 3px; background: var(--apricot); height: 8px; animation: bar 1s ease-in-out infinite; }
.elda-pill .bars i:nth-child(2) { animation-delay: .15s; } .elda-pill .bars i:nth-child(3) { animation-delay: .3s; } .elda-pill .bars i:nth-child(4) { animation-delay: .45s; }
.elda-pill .bars.still i { animation: none; height: 8px; opacity: .5; }
@keyframes bar { 50% { height: 26px; } }
.live-center { grid-column: 2; grid-row: 1; min-height: 0; display: flex; flex-direction: column; gap: 24px; }
.live-center .board { flex: 1; }
.live-center[data-mode="listening"] .board, .live-center[data-mode="words"] .board { display: none; }
.live-center:not([data-mode="listening"]):not([data-mode="words"]) .hearing { display: none; }
.hearing { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 36px; padding: 0 24px 60px 32px; }
.hearing .who { display: flex; align-items: center; gap: 14px; font-size: 24px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--rust); }
.hearing .who svg { width: 40px; height: 40px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.said { margin: 0; font-family: var(--display); font-weight: 700; font-size: 96px; line-height: 106px; letter-spacing: -.02em; color: var(--text); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; }
.said.long { font-size: 72px; line-height: 82px; }
.said .caret { display: inline-block; width: 8px; height: .85em; margin-left: 10px; border-radius: 4px; background: var(--apricot); vertical-align: -6px; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.said.elda { color: var(--espresso); }
.levels { display: flex; align-items: center; gap: 7px; height: 72px; }
.levels i { width: 8px; height: 8px; border-radius: 4px; background: var(--apricot); transition: height .12s linear; }
.hearing .hint { font-size: 30px; line-height: 40px; color: var(--secondary); }
.words { grid-column: 1 / span 2; grid-row: 2; padding: 0 12px; min-height: 52px; }
.words p { margin: 0; font-size: 40px; line-height: 52px; color: var(--text); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.words b { font-family: var(--display); color: var(--rust); margin-right: 16px; }
.live-center:not([data-mode="board"]):not([data-mode="browser"]):not([data-mode="seeing"]) ~ .words p { visibility: hidden; }
.rail { grid-column: 3; grid-row: 1 / span 2; min-height: 0; display: flex; flex-direction: column; gap: 24px; }
.rail .ring-card { padding: 24px 26px 26px; border-radius: 28px; gap: 18px; }
.rail .ring-head .ago { font-size: 20px; }
.rail .ring-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.rail .metric { background: var(--page); border-radius: 20px; padding: 16px 18px; gap: 6px; }
.rail .metric-name { font-size: 20px; gap: 10px; }
.rail .metric-name .icon-chip { width: 34px; height: 34px; }
.rail .metric-name .icon-chip svg { width: 20px; height: 20px; }
.rail .metric .num { font-size: 50px; }
.rail .metric .num small { font-size: 22px; }
.rail .metric .extra { height: 34px; display: flex; flex-direction: column; justify-content: center; gap: 4px; font-size: 19px; line-height: 20px; color: var(--secondary); }
.feed { flex: 1; min-height: 0; padding: 24px 26px 8px; display: flex; flex-direction: column; gap: 6px; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 12px; font-size: 24px; font-weight: 700; color: var(--espresso); padding-bottom: 6px; }
.card-head .soft { margin-left: auto; font-size: 20px; font-weight: 400; color: var(--secondary); }
.feed-row { padding: 12px 0; border-top: 1.5px solid var(--hairline); }
.feed-row .when { font-size: 19px; line-height: 24px; color: var(--muted); font-variant-numeric: tabular-nums; }
.feed-row .what { font-size: 24px; line-height: 30px; font-weight: 700; color: var(--espresso); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-row .then { font-size: 21px; line-height: 27px; color: var(--secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Elda's cards on the board (lib/elda/cards.ts types) */
.elda-card { flex: 1; min-height: 0; background: var(--card); border: 1.5px solid var(--border); border-radius: 28px; padding: 26px 36px 18px; display: flex; flex-direction: column; gap: 14px; overflow: hidden; }
.elda-card.alert { background: var(--alert-bg); border-color: #F6CDB9; }
.elda-card .card-head { padding: 0; color: var(--secondary); }
.hero { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.hero .num { font-size: 120px; }
.hero .hero-unit { font-family: var(--display); font-weight: 700; font-size: 44px; color: var(--secondary); }
.hero-text { display: flex; flex-direction: column; gap: 2px; margin-left: 12px; }
.hero-label { font-size: 28px; font-weight: 700; color: var(--espresso); }
.hero-sub { font-size: 24px; color: var(--secondary); }
.items { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 20px; padding: 16px 0; border-top: 1.5px solid var(--hairline); }
.item:first-child { border-top: 0; }
.item-text { flex: 1; min-width: 0; }
.item-title { font-size: 32px; line-height: 38px; font-weight: 700; color: var(--espresso); }
.item-sub { font-size: 24px; line-height: 30px; color: var(--secondary); }
.item-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.item-time { font-size: 26px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.card-note { font-size: 24px; line-height: 32px; color: var(--secondary); }
.card-say { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; font-size: 22px; color: var(--secondary); }
.card-say .pill { background: var(--sand); color: var(--espresso); font-size: 22px; padding: 6px 18px; }
.card-photo { width: 100%; max-height: 520px; object-fit: contain; border-radius: 18px; background: var(--sand); }

/* browser and camera on the board */
.frame { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--card); border: 1.5px solid #E3D7C9; border-radius: 24px; overflow: hidden; }
.frame-bar { height: 60px; flex: none; display: flex; align-items: center; gap: 14px; padding: 0 20px; background: #F6F1EA; border-bottom: 1.5px solid var(--border); }
.frame-url { flex: 1; height: 42px; display: flex; align-items: center; gap: 10px; padding: 0 18px; border-radius: 999px; background: var(--card); border: 1px solid var(--border); font-size: 22px; color: var(--espresso); overflow: hidden; white-space: nowrap; }
.frame-url svg { width: 20px; height: 20px; fill: none; stroke: var(--success); stroke-width: 2; flex: none; }
.driving { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px; border-radius: 999px; background: var(--tint); font-size: 20px; font-weight: 700; color: var(--rust-dark); white-space: nowrap; }
.frame-view { flex: 1; min-height: 0; position: relative; background: #F6F1EA; display: flex; align-items: center; justify-content: center; }
.frame-view img, .frame-view video { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.frame-view .waiting { font-size: 28px; color: var(--muted); }
/* ------------------------------------------------------------ a family call */
.label svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.call-timer { font-size: 30px; font-weight: 700; color: var(--rust); font-variant-numeric: tabular-nums; }
.call-heading { margin: 0; font-family: var(--display); font-weight: 700; font-size: 56px; line-height: 64px; letter-spacing: -.01em; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.call-tiles { flex: 1; min-height: 0; display: grid; gap: 20px; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); }
.call-tiles.n1 { grid-template-columns: minmax(0, 1fr); }
.call-tile { position: relative; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; border-radius: 28px; overflow: hidden; background: var(--sand); border: 3px solid transparent; transition: border-color .2s, box-shadow .2s; }
.call-tile.speaking { border-color: var(--apricot); box-shadow: 0 0 0 6px var(--tint); }
.call-tile.ghost { background: transparent; border: 3px dashed var(--board-edge); }
.call-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.call-face { width: 168px; height: 168px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--tint); color: var(--rust); font-family: var(--display); font-weight: 700; font-size: 76px; }
.call-face svg { width: 76px; height: 76px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.call-face.ringing { animation: calling 1.6s ease-in-out infinite; }
@keyframes calling { 50% { box-shadow: 0 0 0 24px rgba(242, 138, 61, .16); } }
.call-name { position: absolute; left: 20px; bottom: 18px; max-width: calc(100% - 40px); display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 22px 0 18px; border-radius: 999px; background: rgba(255, 255, 255, .94); font-size: 26px; font-weight: 700; color: var(--espresso); }
.call-name svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.call-name span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.call-tile.ghost .call-name { position: static; background: none; padding: 0; color: var(--secondary); }
.call-tile.ghost { flex-direction: column; gap: 22px; }
.call-caption { margin: 0; min-height: 50px; font-size: 38px; line-height: 50px; color: var(--text); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.call-caption b { font-family: var(--display); color: var(--rust); margin-right: 14px; }

.live-pill { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 999px; background: var(--alert-bg); font-size: 20px; font-weight: 700; letter-spacing: .08em; color: var(--alert); }
.live-pill::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--alert); box-shadow: 0 0 0 4px #F6CDB9; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(246, 205, 185, .4); } }
.steps { display: flex; flex-direction: column; gap: 10px; max-height: 260px; overflow: hidden; }
.step { display: flex; align-items: center; gap: 14px; font-size: 24px; color: var(--espresso); }
.step::before { content: ''; width: 14px; height: 14px; border-radius: 50%; background: var(--success); flex: none; }
.step:last-child::before { background: var(--card); border: 3px solid var(--apricot); box-shadow: 0 0 0 5px var(--tint); }
.steps.finished .step:last-child::before { background: var(--success); border: 0; box-shadow: none; }
/* Elda's browser is a phone-sized page (browser-service: 390x780), shown whole beside what she is doing */
.browser-row { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 36px; flex: 1; min-height: 0; align-items: start; }
.frame.phone { flex: none; border-radius: 28px; }
.frame.phone .frame-bar { height: 52px; padding: 0 12px; }
.frame.phone .frame-url { height: 36px; padding: 0 12px; font-size: 18px; }
.frame.phone .frame-view { flex: none; height: 600px; }
.frame.phone .frame-view img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.frame.phone .frame-view .waiting { padding: 24px; text-align: center; font-size: 24px; line-height: 32px; }
.browser-side { display: flex; flex-direction: column; gap: 18px; min-height: 0; }
.browser-side .goal { font-family: var(--display); font-weight: 700; font-size: 34px; line-height: 42px; color: var(--espresso); }
.browser-side .result { font-size: 26px; line-height: 34px; color: var(--secondary); }

/* ------------------------------------------------------------ health: a calm dashboard
 * After the reference the owner chose (17 Oct 2026): a near-white page, the person's portrait fading
 * into it with today's readings glowing beside them, and soft pastel cards. */
.stage[data-view="health"] { background: #F7F5F1; transition: background .6s; }
.view-health { grid-template-columns: 600px minmax(0, 1fr); column-gap: 36px; }
.side { display: flex; flex-direction: column; min-height: 0; }
.right { display: flex; flex-direction: column; gap: 20px; min-height: 0; }
.hello { padding: 0 0 0 4px; position: relative; z-index: 2; }
.hello-hi { font-family: var(--display); font-weight: 400; font-size: 44px; line-height: 48px; color: var(--secondary); }
.hello-name { margin: 0; font-family: var(--display); font-weight: 700; font-size: 92px; line-height: 96px; letter-spacing: -.03em; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hello-sub { margin: 6px 0 0; font-size: 28px; color: var(--muted); }

.person { flex: 1; position: relative; min-height: 0; }
.portrait { position: absolute; left: 50px; right: -40px; top: -40px; bottom: 96px; display: flex; justify-content: center; }
.portrait::before { content: ''; position: absolute; inset: 8% 4% 18%; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .95) 0%, rgba(255, 255, 255, 0) 70%); }
.portrait img { position: relative; height: 100%; width: auto; max-width: 100%; object-fit: contain; object-position: center top;
  filter: saturate(.9) brightness(1.02);
  -webkit-mask-image: radial-gradient(ellipse 58% 62% at 50% 38%, #000 58%, transparent 100%);
  mask-image: radial-gradient(ellipse 58% 62% at 50% 38%, #000 58%, transparent 100%); }
.person-foot { position: absolute; left: 4px; right: 0; bottom: 0; display: flex; flex-direction: column; gap: 8px; }
.elda-line { margin: 0; font-size: 26px; line-height: 34px; color: var(--espresso); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.elda-line b { font-family: var(--display); color: var(--rust); margin-right: 12px; }
.synced { display: flex; align-items: center; gap: 10px; font-size: 20px; color: var(--muted); }
.synced::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--success); }
.synced.stale::before { background: var(--taupe); }

/* the glowing points on the portrait */
.marker { position: absolute; display: flex; align-items: center; z-index: 2; }
.marker-text { width: 190px; flex: none; display: flex; flex-direction: column; gap: 2px; }
.m-oxygen .marker-text { width: 170px; }
.marker-name { font-size: 22px; font-weight: 700; color: var(--espresso); }
.marker-value { font-size: 24px; color: var(--secondary); white-space: nowrap; }
.marker-value .num { font-size: 48px; font-weight: 600; }
.marker-note { font-size: 20px; color: var(--muted); }
.marker-line { width: 86px; height: 2px; margin: 0 6px 0 18px; background: linear-gradient(90deg, rgba(166, 154, 140, .25), rgba(166, 154, 140, .7)); }
.marker-dot { position: relative; width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, .55); border: 2px solid rgba(255, 255, 255, .95); box-shadow: 0 0 0 10px rgba(255, 255, 255, .28), 0 6px 18px rgba(51, 38, 27, .12); backdrop-filter: blur(6px); flex: none; }
.marker-dot::after { content: ''; position: absolute; inset: 11px; border-radius: 50%; background: #F6D58A; box-shadow: 0 0 14px 4px rgba(246, 205, 120, .9); animation: glow 2.6s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 22px 8px rgba(246, 205, 120, .55); } }
.m-heart { left: 0; top: 300px; }
.m-temp { left: 0; top: 480px; }
.m-temp .marker-line { width: 150px; }
.m-oxygen { right: -36px; top: 215px; flex-direction: row-reverse; }
.m-oxygen .marker-line { width: 40px; margin: 0 18px 0 6px; background: linear-gradient(270deg, rgba(166, 154, 140, .25), rgba(166, 154, 140, .7)); }

/* six soft cards */
.vitals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: 268px 268px; gap: 20px; }
.vital { position: relative; border-radius: 30px; padding: 22px 28px 20px; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; border: 1.5px solid rgba(255, 255, 255, .9); box-shadow: 0 10px 30px rgba(51, 38, 27, .05); background: #FFFFFF; }
.vital.mint { background: linear-gradient(150deg, #E3F4E6 0%, #F4FAF3 60%, #FFFFFF 100%); }
.vital.peach { background: linear-gradient(150deg, #FDE2D3 0%, #FCEFD9 55%, #FFF8EE 100%); }
.vital.sky { background: linear-gradient(150deg, #E4EEFB 0%, #F3F7FD 60%, #FFFFFF 100%); }
.vital.lilac { background: linear-gradient(150deg, #ECE7FA 0%, #F6F3FD 60%, #FFFFFF 100%); }
.vital.rose { background: linear-gradient(150deg, #FBE3E6 0%, #FDF1F1 60%, #FFFFFF 100%); }
.vital.stone { background: linear-gradient(150deg, #EFEDE9 0%, #F8F7F4 60%, #FFFFFF 100%); }
.vital-name { font-size: 24px; font-weight: 700; color: var(--espresso); }
.vital-value { display: flex; align-items: baseline; gap: 10px; margin-top: 4px; }
.vital-value .num { font-size: 76px; font-weight: 600; letter-spacing: -.02em; }
.vital-unit { font-size: 24px; color: var(--secondary); }
.vital-body { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: flex-end; }
.vital-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; font-size: 20px; color: var(--secondary); white-space: nowrap; }
.vital-foot .tag { padding: 4px 14px; border-radius: 999px; background: rgba(255, 255, 255, .8); font-weight: 700; color: var(--espresso); }
.vital-foot .tag:empty { display: none; }
.vital-empty { font-size: 20px; line-height: 26px; color: var(--muted); }
.oxy svg { width: 100%; height: 80px; }
.oxy path, .pulse path { fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.oxy .w1 { stroke: rgba(242, 138, 61, .55); } .oxy .w2 { stroke: rgba(255, 255, 255, .95); }
.pulse { width: 100%; height: 90px; }
.pulse path { stroke: #7FA4DA; stroke-width: 3; }
.sleep-line { width: 100%; height: 90px; overflow: visible; }
.sleep-line .line { fill: none; stroke: #8E7BD6; stroke-width: 4; stroke-linecap: round; }
.sleep-line .end { fill: #FFFFFF; stroke: #8E7BD6; stroke-width: 4; }
.gauge { width: 200px; height: 110px; align-self: center; overflow: visible; }
.gauge .track { fill: none; stroke: rgba(222, 120, 135, .28); stroke-width: 14; stroke-linecap: round; }
.gauge .knob { fill: #FFFFFF; stroke: #D9667A; stroke-width: 6; }
.hour-bars { flex: 1; max-height: 100px; display: flex; align-items: flex-end; gap: 6px; }
.hour-bars i { flex: 1; border-radius: 4px; background: #D9D5CE; }
.hour-bars i.now { background: #6F665D; }
.score-bars { flex: 1; max-height: 100px; display: flex; align-items: flex-end; gap: 10px; }
.score-bars i { flex: 1; border-radius: 6px; background: rgba(47, 125, 79, .22); }
.score-bars i.now { background: var(--success); }
.goal { flex: 1; height: 12px; border-radius: 6px; background: rgba(51, 38, 27, .08); overflow: hidden; }
.goal i { display: block; height: 100%; border-radius: 6px; background: var(--success); }

/* the day and Elda's notes */
.today { flex: 1; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; min-height: 0; }
.soft-card { background: rgba(255, 255, 255, .92); border: 1.5px solid #EEE9E2; border-radius: 30px; padding: 22px 30px; display: flex; flex-direction: column; gap: 14px; min-height: 0; overflow: hidden; box-shadow: 0 10px 30px rgba(51, 38, 27, .04); }
.soft-head { font-size: 24px; font-weight: 700; color: var(--espresso); }
.dayline { padding-top: 34px; }
.dayline-track { position: relative; height: 18px; border-radius: 9px; background: #EFECE7; }
.dayline-past { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 9px; background: #E2DED7; }
.dayline-dot { position: absolute; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; border: 3px solid #FFFFFF; background: #C9B9F0; }
.dayline-dot.done { background: #7FC08F; } .dayline-dot.next { background: #F2B25C; } .dayline-dot.missed { background: #E8846F; }
.dayline-now { position: absolute; top: -34px; bottom: -8px; width: 2px; margin-left: -1px; background: var(--espresso); }
.dayline-now span { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); padding: 2px 12px; border-radius: 999px; background: var(--espresso); color: #FFFFFF; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dayline-ticks { position: relative; height: 26px; margin-top: 10px; font-size: 20px; color: var(--muted); }
.dayline-ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.dayline-ticks span:first-child { transform: none; }
.plan-list { display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow: hidden; }
.plan-row { display: flex; align-items: center; gap: 16px; }
.plan-dot { width: 16px; height: 16px; border-radius: 50%; background: #C9B9F0; flex: none; }
.plan-row.done .plan-dot { background: #7FC08F; } .plan-row.next .plan-dot { background: #F2B25C; } .plan-row.missed .plan-dot { background: #E8846F; }
.plan-text { flex: 1; min-width: 0; }
.plan-title { font-size: 26px; line-height: 30px; font-weight: 700; color: var(--espresso); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-sub { font-size: 20px; line-height: 26px; color: var(--muted); }
.plan-state { font-size: 21px; color: var(--muted); white-space: nowrap; }
.plan-row.next .plan-state { color: #B7791F; font-weight: 700; } .plan-row.done .plan-state { color: var(--success); } .plan-row.missed .plan-state { color: var(--alert); }
.insight { display: flex; align-items: center; gap: 16px; min-width: 0; }
.insight-icon { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none; background: #EEEAFB; color: #6A55C2; }
.insight-icon.good { background: var(--success-bg); color: var(--success); }
.insight-icon.watch { background: #FDF0DC; color: #B7791F; }
.insight-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.insight-text { min-width: 0; }
.insight-title { font-size: 23px; line-height: 28px; font-weight: 700; color: var(--espresso); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.insight-when { font-size: 20px; line-height: 26px; color: var(--muted); }

/* ------------------------------------------------------------ history */
.view-history { grid-template-rows: auto auto minmax(0, 1fr); grid-template-columns: minmax(0, 1fr) 600px; column-gap: 40px; row-gap: 24px; }
.hist-title { grid-column: 1 / span 2; display: flex; align-items: flex-end; gap: 40px; }
.hist-title h1 { margin: 6px 0 0; font-family: var(--display); font-weight: 700; font-size: 64px; line-height: 72px; letter-spacing: -.01em; }
.counts { margin-left: auto; display: flex; background: var(--card); border: 1.5px solid var(--border); border-radius: 24px; padding: 14px 8px; }
.counts div { display: flex; flex-direction: column; gap: 2px; padding: 0 28px; border-left: 1.5px solid var(--border); }
.counts div:first-child { border-left: 0; }
.counts .num { font-size: 48px; line-height: 52px; }
.counts span { font-size: 21px; color: var(--secondary); }
.hist-hint { grid-column: 1 / span 2; display: flex; align-items: center; gap: 12px; font-size: 22px; color: var(--secondary); }
.hist-hint svg, .elda-pill svg, .card-say svg { width: 26px; height: 26px; flex: none; }
.elda-pill svg { color: var(--rust); }
.hist-list { min-height: 0; padding: 8px 28px; overflow: hidden; display: flex; flex-direction: column; }
.moment { display: grid; grid-template-columns: 92px 52px minmax(0, 1fr) auto; column-gap: 20px; align-items: center; padding: 12px 0; border-top: 1.5px solid var(--hairline); }
.moment:first-child { border-top: 0; }
.moment.picked { padding: 10px 14px; margin: 2px -16px; background: #FFF4EA; border: 2px solid var(--board-edge); border-radius: 20px; }
.moment.picked + .moment { border-top: 0; }
.moment .t { font-family: var(--display); font-weight: 700; font-size: 30px; color: var(--espresso); font-variant-numeric: tabular-nums; }
.moment .src { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--tint); color: var(--rust); }
.moment .src.quiet { background: var(--sand); color: var(--secondary); }
.moment .src svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.moment .what { font-size: 26px; line-height: 32px; font-weight: 700; color: var(--espresso); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.moment .then { font-size: 21px; line-height: 28px; color: var(--secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail { min-height: 0; padding: 26px 32px 28px; gap: 14px; overflow: hidden; }
.detail h2 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 40px; line-height: 46px; color: var(--text); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.detail-head { display: flex; align-items: flex-end; gap: 16px; }
.detail-head h2 { flex: 1; }
.detail-head img { width: 104px; height: 123px; object-fit: contain; flex: none; }
.turns { display: flex; flex-direction: column; background: var(--card); border: 1.5px solid var(--border); border-radius: 22px; padding: 6px 20px; overflow: hidden; min-height: 0; }
.turn { display: flex; gap: 16px; padding: 8px 0; font-size: 21px; line-height: 28px; border-top: 1.5px solid var(--hairline); }
.turn:first-child { border-top: 0; }
.turn .who { width: 64px; flex: none; color: var(--muted); font-weight: 700; }
.turn.elda .who { color: var(--rust); }
.turn .txt { color: var(--espresso); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.used { display: flex; flex-wrap: wrap; gap: 10px; }
.used .pill { background: var(--sand); color: var(--espresso); }

/* ------------------------------------------------------------ toasts and hints */
.hint-corner { position: absolute; right: 56px; bottom: 16px; font-size: 18px; color: var(--muted); opacity: 0; transition: opacity 1s; z-index: 30; }
.hint-corner.show { opacity: 1; }
.offline { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); padding: 10px 24px; border-radius: 999px; background: var(--alert-bg); color: var(--alert); font-size: 22px; font-weight: 700; z-index: 50; display: none; }
.offline.show { display: block; }

/* ------------------------------------------------------------ lock page */
.lock { min-height: 100vh; display: flex; flex-direction: column; padding: 40px 56px; }
.lock-top { display: flex; align-items: center; justify-content: space-between; }
.lock-clock { font-family: var(--display); font-weight: 700; font-size: 36px; color: var(--text); font-variant-numeric: tabular-nums; }
.lock-body { flex: 1; display: flex; align-items: center; justify-content: center; gap: 120px; padding: 40px 0; flex-wrap: wrap; }
.lock-elda { position: relative; width: 380px; height: 460px; display: flex; align-items: center; justify-content: center; }
.lock-elda .glow { position: absolute; inset: -60px; border-radius: 50%; background: radial-gradient(circle, rgba(242, 138, 61, .40) 0%, rgba(246, 168, 100, .26) 38%, rgba(251, 217, 188, .14) 60%, rgba(251, 246, 239, 0) 72%); }
.lock-elda img { position: relative; width: 300px; height: 352px; object-fit: contain; animation: bob 3.4s ease-in-out infinite; }
.lock-card { width: min(760px, 100%); background: var(--card); border: 1.5px solid var(--border); border-radius: 40px; padding: 56px 64px 52px; box-shadow: 0 18px 60px rgba(51, 38, 27, .08); display: flex; flex-direction: column; gap: 22px; }
.lock-card h1 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 56px; line-height: 62px; letter-spacing: -.01em; }
.lock-card p { margin: 0; font-size: 26px; line-height: 36px; color: var(--secondary); }
.lock-card > label { font-size: 24px; font-weight: 700; color: var(--espresso); margin-top: 8px; }
.field { position: relative; }
.field input { width: 100%; height: 88px; padding: 0 96px 0 28px; border-radius: 24px; border: 2.5px solid var(--border); background: var(--page); font: inherit; font-size: 32px; color: var(--text); outline: none; }
.field input:focus { border-color: var(--rust); box-shadow: 0 0 0 6px var(--tint); }
.field input.bad { border-color: var(--alert); box-shadow: 0 0 0 6px var(--alert-bg); }
.eye { position: absolute; right: 14px; top: 14px; width: 60px; height: 60px; border-radius: 18px; border: 0; background: var(--sand); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.eye svg { width: 30px; height: 30px; fill: none; stroke: var(--secondary); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.error { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-radius: 18px; background: var(--alert-bg); font-size: 24px; font-weight: 700; color: var(--alert); }
.error[hidden] { display: none; }
.check { display: flex; align-items: center; gap: 16px; font-size: 26px; color: var(--espresso); cursor: pointer; }
.check input { width: 32px; height: 32px; margin: 0; accent-color: var(--rust); }
.primary { height: 88px; border-radius: 999px; border: 0; background: var(--rust); color: #FFFFFF; font-size: 30px; font-weight: 700; cursor: pointer; }
.primary:hover { background: var(--rust-dark); }
.primary:disabled { opacity: .6; cursor: default; }
.primary:focus-visible, .eye:focus-visible, .check input:focus-visible { outline: 4px solid var(--apricot); outline-offset: 3px; }
.private { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 22px !important; }
.private svg { width: 22px; height: 22px; fill: none; stroke: var(--secondary); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 900px) {
  .lock { padding: 24px 16px; }
  .lock-elda { width: 240px; height: 260px; }
  .lock-elda img { width: 180px; height: 210px; }
  .lock-card { padding: 32px 24px; border-radius: 28px; }
  .lock-card h1 { font-size: 34px; line-height: 40px; }
  .lock-body { gap: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
