/* AVROK Gift PWA — warm, calm, rounded. Light/dark via prefers-color-scheme. */

:root {
  --bg: #fbf3ec;
  --bg-2: #f6e8dd;
  --surface: #fffaf6;
  --surface-2: #f3e4d8;
  --line: #ead7c8;
  --text: #34232b;
  --muted: #76616a;
  --accent: #b6543d;        /* buttons, links (white text passes AA) */
  --accent-ink: #8f3f2c;
  --accent-soft: #f6d9cc;
  --love: #c9446e;
  --love-soft: #f9dbe4;
  --ok: #3d7d58;
  --ok-soft: #dcefe3;
  --warn: #9a5b0c;
  --warn-soft: #fbe8c8;
  --danger: #b3261e;
  --oled: #0b0d12;
  --oled-on: #d6f0ff;
  --me-bubble: #b6543d;
  --me-text: #fffaf6;
  --agent-bubble: #f3e4d8;
  --shadow: 0 1px 2px rgba(80, 40, 30, .06), 0 6px 20px rgba(80, 40, 30, .07);
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --tab-h: 68px;
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Young Serif', Georgia, 'Times New Roman', serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1d1619;
    --bg-2: #241b1f;
    --surface: #2a2024;
    --surface-2: #36292e;
    --line: #45353b;
    --text: #f6ebe4;
    --muted: #bba8a7;
    --accent: #f0987d;
    --accent-ink: #f6b29d;
    --accent-soft: #4a2e28;
    --love: #f286a8;
    --love-soft: #4b2433;
    --ok: #86c9a0;
    --ok-soft: #233a2c;
    --warn: #f0c070;
    --warn-soft: #43341b;
    --danger: #ff8a80;
    --me-bubble: #f0987d;
    --me-text: #2a1714;
    --agent-bubble: #36292e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  background-image: radial-gradient(1200px 500px at 50% -200px, var(--bg-2), transparent 70%);
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.5 var(--font);
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent-ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 10px; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 14px; border-radius: 10px; z-index: 50; }
.skip:focus { left: 12px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hint { color: var(--muted); font-size: .875rem; }
.center { text-align: center; }
.error { color: var(--danger); font-weight: 600; font-size: .95rem; }
.icon { display: inline-flex; width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.25em; }
.icon svg { width: 100%; height: 100%; }
.icon.big { width: 2.2rem; height: 2.2rem; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.brand { font-family: var(--display); font-size: 1.15rem; letter-spacing: .06em; color: var(--text); }
.status { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700;
  background: var(--surface-2); color: var(--muted);
}
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.demo { background: var(--love-soft); color: var(--love); }
.pill.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
.banner {
  margin: 0 16px 8px; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--warn-soft); color: var(--text); display: flex; gap: 12px; align-items: center; justify-content: space-between;
  max-width: 560px;
}
@media (min-width: 600px) { .banner { margin-inline: auto; } }

/* ---------- eyes (the puck's face) ---------- */
.eyes {
  --ew: 11px; --eh: 15px; --eg: 6px;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--eg);
  min-width: 48px; min-height: 40px; padding: 0 6px;
  border: 0; background: var(--text); border-radius: 14px; cursor: pointer;
  color: var(--bg);
}
.eyes .eye {
  width: var(--ew); height: var(--eh); border-radius: 999px; background: currentColor;
  transform-origin: 50% 60%;
  animation: blink 5.5s infinite;
  transition: transform .35s cubic-bezier(.22, 1, .36, 1), height .3s, border-radius .3s, background .3s;
}
.eyes .eye:nth-child(2) { animation-delay: .04s; }
@keyframes blink { 0%, 93%, 100% { scale: 1 1; } 96% { scale: 1 .08; } }
.eyes[data-mood="think"] .eye { transform: translate(3px, -3px); height: calc(var(--eh) * .8); }
.eyes[data-mood="happy"] .eye { height: calc(var(--eh) * .55); border-radius: 999px 999px 3px 3px; animation: none; }
.eyes[data-mood="love"] .eye { background: var(--love); animation: heartbeat 1s ease-in-out infinite; }
.eyes[data-mood="confused"] .eye:nth-child(2) { height: calc(var(--eh) * .45); }
.eyes[data-mood="sleepy"] .eye { height: calc(var(--eh) * .22); animation: none; }
@keyframes heartbeat { 0%, 100% { transform: scale(1); } 30% { transform: scale(1.25); } 50% { transform: scale(.95); } }
.eyes-hero {
  --ew: 34px; --eh: 48px; --eg: 22px;
  width: 168px; height: 108px; border-radius: 36px; margin: 8px auto 4px; cursor: default;
  box-shadow: var(--shadow);
}
button.eyes-hero, .welcome .eyes-hero { cursor: pointer; }
.mini-eyes {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  width: 46px; height: 32px; border-radius: 11px; background: var(--oled); flex: none;
}
.mini-eyes i { width: 8px; height: 12px; border-radius: 99px; background: var(--oled-on); animation: blink 4.8s infinite; box-shadow: 0 0 6px rgba(150, 220, 255, .6); }
.mini-eyes.off i { height: 2px; box-shadow: none; opacity: .5; animation: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- layout ---------- */
main { display: block; padding: 4px 16px calc(var(--tab-h) + env(safe-area-inset-bottom) + 24px); max-width: 600px; margin: 0 auto; outline: none; }
body.first-run main { padding-bottom: 40px; }
.view { display: flex; flex-direction: column; gap: 14px; animation: rise .35s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.view-head { padding: 8px 2px 2px; }
.view-head h1, .greet h1 { font-family: var(--display); font-weight: 400; font-size: 1.9rem; letter-spacing: -.01em; outline: none; }
.view-head p { margin-top: 4px; }
.greet { padding: 10px 2px 4px; }
.greet .name { color: var(--accent-ink); }
.card {
  background: var(--surface); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow);
  border: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.card.tight { padding: 6px 16px; }
.card-title { display: flex; align-items: center; gap: 8px; font-size: 1.02rem; font-weight: 800; margin-bottom: 10px; }
.card-title .icon { color: var(--accent); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack.tight { gap: 4px; }
.row { display: flex; gap: 10px; align-items: flex-end; }
.row.end { justify-content: flex-end; align-items: center; }
.row.wrap { flex-wrap: wrap; align-items: center; }
.grow { flex: 1; min-width: 0; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 999px; border: 0;
  font-weight: 800; cursor: pointer; text-decoration: none; background: var(--surface-2); color: var(--text);
  transition: transform .12s, background .2s, filter .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); color: var(--surface); }
:root .btn.primary { color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #2a1714; } }
.btn.soft { background: var(--accent-soft); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger-text { color: var(--danger); }
.btn.small { min-height: 40px; padding: 0 14px; font-size: .9rem; }
.btn.block { width: 100%; }
.link { background: none; border: 0; color: var(--accent-ink); font-weight: 700; padding: 10px 4px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; min-height: 44px; }
.link.back { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; align-self: flex-start; }
.icon-btn {
  display: inline-grid; place-items: center; width: 48px; height: 48px; flex: none;
  border-radius: 999px; border: 0; background: var(--surface-2); color: var(--text); cursor: pointer;
}
.icon-btn.primary { background: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .icon-btn.primary { color: #2a1714; } }
.icon-btn.recording { background: var(--danger); color: #fff; animation: pulse 1.2s infinite; }
.input {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: var(--r-sm);
  border: 1.5px solid var(--line); background: var(--bg); color: var(--text);
}
textarea.input { resize: vertical; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
.label { font-weight: 700; font-size: .95rem; }
select.input { appearance: auto; }
.search-wrap { position: relative; }
.search-wrap > .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-wrap .input { padding-left: 44px; border-radius: 999px; background: var(--surface); }
.chips, .quick { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar, .quick::-webkit-scrollbar { display: none; }
.chip-btn {
  flex: none; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--surface); font-weight: 700; cursor: pointer; color: var(--text);
}
.chip-btn.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.quick-btn { background: var(--love-soft); border-color: transparent; color: var(--text); }

/* switch */
.switch-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; cursor: pointer; position: relative; }
.switch-row + .switch-row { border-top: 1px solid var(--line); }
.switch-text { flex: 1; display: flex; flex-direction: column; }
.switch-label { font-weight: 700; }
.switch-input { position: absolute; opacity: 0; width: 52px; height: 32px; right: 0; margin: 0; cursor: pointer; }
.switch { width: 52px; height: 32px; border-radius: 99px; background: var(--line); position: relative; flex: none; transition: background .2s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .25s cubic-bezier(.22, 1, .36, 1); }
.switch-input:checked + .switch { background: var(--accent); }
.switch-input:checked + .switch::after { transform: translateX(20px); }
.switch-input:focus-visible + .switch { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: space-around;
  padding: 6px 6px calc(env(safe-area-inset-bottom) + 6px);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tabbar[hidden] { display: none; }
.tab {
  flex: 1; max-width: 120px; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: .74rem; font-weight: 700; border-radius: 16px;
}
.tab-ico { position: relative; display: grid; place-items: center; width: 52px; height: 30px; border-radius: 99px; transition: background .2s; }
.tab-ico .icon { width: 22px; height: 22px; }
.tab.active { color: var(--text); }
.tab.active .tab-ico { background: var(--accent-soft); color: var(--accent-ink); }
.tab-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  position: absolute; top: -2px; right: 6px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 99px; background: var(--love); color: #fff; font-size: .7rem; font-weight: 800; display: grid; place-items: center;
  animation: pop .3s cubic-bezier(.22, 1, .36, 1);
}
@keyframes pop { from { transform: scale(0); } }

/* ---------- toasts & sheets ---------- */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 14px); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 60; pointer-events: none; padding: 0 16px; }
.toast {
  max-width: 520px; padding: 12px 18px; border-radius: 16px; background: var(--text); color: var(--bg);
  font-weight: 700; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); transition: opacity .25s, transform .25s;
}
.toast.in { opacity: 1; transform: none; }
.toast.ok { background: var(--ok); color: #fff; }
.toast.warn { background: var(--warn-soft); color: var(--text); }
dialog.sheet {
  width: min(560px, 100vw); max-width: 100vw; max-height: 92dvh; margin: auto auto 0; padding: 18px 16px calc(env(safe-area-inset-bottom) + 18px);
  border: 0; border-radius: 26px 26px 0 0; background: var(--surface); color: var(--text); box-shadow: 0 -10px 40px rgba(0,0,0,.25);
  animation: sheet-up .3s cubic-bezier(.2,.9,.3,1);
}
@media (min-width: 600px) { dialog.sheet { margin: auto; border-radius: 26px; } }
dialog.sheet::backdrop { background: rgba(30, 15, 20, .45); backdrop-filter: blur(2px); }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.sheet-head h2 { font-family: var(--display); font-weight: 400; font-size: 1.35rem; }

/* ---------- home ---------- */
.summary-card { background: linear-gradient(160deg, var(--surface), color-mix(in srgb, var(--accent-soft) 55%, var(--surface))); }
.summary-text { font-size: 1.08rem; line-height: 1.6; margin-bottom: 6px; }
.skeleton { display: inline-block; width: 80%; height: 1em; border-radius: 8px; background: var(--surface-2); animation: pulse 1.2s infinite; }
.skeleton-card { height: 120px; animation: pulse 1.2s infinite; }
.puck-head { display: flex; align-items: center; gap: 14px; }
.puck-head .card-title { margin-bottom: 2px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); margin-right: 6px; vertical-align: 1px; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.stats { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.stat { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; background: var(--surface-2); font-size: .88rem; font-weight: 700; }
.stat.low { background: var(--warn-soft); color: var(--warn); }

.chat-log, .thread { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 52dvh; overflow-y: auto; overscroll-behavior: contain; }
.thread { max-height: none; min-height: 30dvh; }
.bubble-row { display: flex; }
.bubble-row.mine { justify-content: flex-end; }
.bubble { max-width: 84%; padding: 10px 14px 6px; border-radius: 20px; position: relative; overflow-wrap: anywhere; }
.bubble p { white-space: pre-wrap; }
.bubble.me { background: var(--me-bubble); color: var(--me-text); border-bottom-right-radius: 6px; }
.bubble.agent, .bubble.them { background: var(--agent-bubble); border-bottom-left-radius: 6px; }
.bubble.them { background: var(--love-soft); }
.bubble.failed { outline: 2px dashed var(--danger); }
.bubble .meta { display: block; font-size: .72rem; opacity: .75; text-align: right; margin-top: 2px; }
.bubble .via { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 700; opacity: .85; margin-bottom: 2px; margin-right: 8px; }
.bubble .via .icon { width: 1em; height: 1em; }
.bubble .via.print.done { color: inherit; }
.badges { display: flex; flex-wrap: wrap; }
.mem-used { margin-top: 8px; padding-top: 8px; border-top: 1px dashed color-mix(in srgb, var(--muted) 40%, transparent); }
.mem-used-label { display: flex; align-items: center; gap: 4px; font-size: .75rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.mem-used-label .icon { color: var(--love); width: 1em; height: 1em; }
.mem-used ul { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; padding: 4px 10px; border-radius: 99px; background: var(--surface); color: var(--text); font-size: .82rem; font-weight: 600; text-decoration: none; border: 1px solid var(--line); }
.empty-chat { padding: 14px 4px; text-align: center; }
.typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: typing 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { transform: none; opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }
.composer { display: flex; gap: 8px; align-items: center; }
.composer .input { border-radius: 999px; background: var(--bg); }

/* ---------- recordings ---------- */
.timeline { display: flex; flex-direction: column; gap: 18px; }
.day { display: flex; flex-direction: column; gap: 10px; }
.day-label { font-size: .82rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding-left: 4px; }
.rec { display: flex; flex-direction: column; gap: 8px; }
.rec.processing { border-style: dashed; }
.rec-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rec-time { font-weight: 800; }
.rec-dur { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: .88rem; }
.rec-dur .icon { width: 1em; height: 1em; }
.rec-head .audio-pill { margin-left: auto; }
.rec-title { font-size: 1.05rem; font-weight: 800; }
.transcript { font-size: 1rem; line-height: 1.55; }
.transcript.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
mark { background: var(--warn-soft); color: inherit; border-radius: 4px; padding: 0 2px; }
.actions { list-style: none; margin: 2px 0 0; padding: 10px 0 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.act { display: flex; align-items: center; gap: 8px; font-size: .93rem; }
.act > .icon { color: var(--accent); }
.act.sent_to_sai > .icon, .act.reply .mini-eyes { color: var(--love); }
.act.reply .mini-eyes { width: 30px; height: 20px; border-radius: 7px; gap: 3px; }
.act.reply .mini-eyes i { width: 5px; height: 8px; }
.audio-pill {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px 0 6px;
  border-radius: 999px; border: 0; background: var(--accent-soft); color: var(--accent-ink); cursor: pointer; font-weight: 700;
}
.audio-ico { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .audio-ico { color: #2a1714; } }
.audio-ico .icon { width: 16px; height: 16px; }
.audio-bar { width: 64px; height: 4px; border-radius: 4px; background: color-mix(in srgb, var(--accent) 25%, transparent); overflow: hidden; }
.audio-fill { display: block; width: 0; height: 100%; background: var(--accent); }
.audio-time { font-size: .82rem; font-variant-numeric: tabular-nums; }
.audio-pill.loading { opacity: .6; }
.bubble.me .audio-pill { background: rgba(255,255,255,.2); color: inherit; }
.empty { text-align: center; padding: 36px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty .icon.big { color: var(--accent); opacity: .7; margin-bottom: 4px; }

/* ---------- memory ---------- */
.privacy-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); background: var(--ok-soft); font-size: .93rem; }
.privacy-note .icon { color: var(--ok); margin-top: 2px; }
.seg { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 999px; overflow-x: auto; scrollbar-width: none; }
.seg button {
  flex: 1; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 999px; background: transparent; font-weight: 800; font-size: .88rem; cursor: pointer; color: var(--muted); padding: 0 10px; white-space: nowrap;
}
.seg button .icon { width: 1.1em; height: 1.1em; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg .count { font-size: .72rem; background: var(--surface-2); border-radius: 99px; padding: 0 6px; }
.seg button.on .count { background: var(--accent-soft); color: var(--accent-ink); }
@media (max-width: 380px) { .seg .seg-label { display: none; } }
.seg.small button { min-height: 40px; flex: none; width: 48px; }
.add-card { background: var(--surface); }
.mem-list { display: flex; flex-direction: column; gap: 10px; }
.mem { display: flex; flex-direction: column; gap: 6px; }
.fact-key { font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.fact-val { font-family: var(--display); font-size: 1.35rem; line-height: 1.3; }
.fact-sentence { font-size: .93rem; }
.fact-meta { display: flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--muted); }
.fact-meta .icon { width: 1em; height: 1em; }
.fact-change { display: flex; align-items: center; gap: 6px; font-size: .88rem; font-weight: 700; color: var(--warn); background: var(--warn-soft); padding: 6px 10px; border-radius: 10px; align-self: flex-start; }
.history summary { cursor: pointer; font-weight: 700; color: var(--accent-ink); min-height: 36px; display: flex; align-items: center; }
.hist-list { margin: 6px 0 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); list-style: none; display: flex; flex-direction: column; gap: 8px; }
.hist-list li { position: relative; font-size: .93rem; }
.hist-list li::before { content: ''; position: absolute; left: -24px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.hist-list li.now::before { background: var(--accent); }
.mem-actions { margin-top: 2px; gap: 4px; }
.person-head { display: flex; align-items: center; gap: 12px; }
.person-head h3 { font-size: 1.1rem; }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--love-soft); color: var(--love); font-weight: 800; font-size: 1.2rem; flex: none; }
.avatar.place { background: var(--accent-soft); color: var(--accent-ink); }
.notes { font-size: .97rem; }
.rem-row { display: flex; gap: 12px; align-items: flex-start; }
.check { width: 26px; height: 26px; margin: 2px 0 0; accent-color: var(--accent); flex: none; cursor: pointer; }
.rem-text { display: flex; flex-direction: column; font-weight: 700; cursor: pointer; flex: 1; }
.rem-due { font-weight: 600; font-size: .86rem; color: var(--muted); }
.rem-due.overdue { color: var(--danger); }
.reminder.done .rem-text { text-decoration: line-through; color: var(--muted); }

/* ---------- thread ---------- */
.thread-card { display: flex; flex-direction: column; gap: 10px; }
.day-sep { text-align: center; margin: 6px 0; }
.day-sep span { font-size: .74rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); padding: 3px 10px; border-radius: 99px; }
.doodle-wrap { display: flex; flex-direction: column; gap: 6px; padding-top: 4px; }
canvas.oled { width: 100%; max-width: 256px; aspect-ratio: 2 / 1; image-rendering: pixelated; border-radius: 10px; background: var(--oled); box-shadow: inset 0 0 0 3px #22262e; display: block; }
.pad-frame { padding: 10px; border-radius: 20px; background: #1a1d24; box-shadow: inset 0 2px 8px rgba(0,0,0,.6); }
canvas.pad-canvas { max-width: none; touch-action: none; cursor: crosshair; box-shadow: none; }
.brush { display: inline-block; border-radius: 50%; background: currentColor; }
.brush.b1 { width: 4px; height: 4px; } .brush.b2 { width: 8px; height: 8px; } .brush.b3 { width: 13px; height: 13px; }
.rec-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 99px; background: var(--love-soft); font-weight: 700; }
.rec-bar[hidden] { display: none; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulse 1s infinite; }
.rec-timer { font-variant-numeric: tabular-nums; }
.rec-bar .link { margin-left: auto; min-height: 32px; padding: 0 4px; }

/* ---------- welcome ---------- */
.welcome { display: flex; flex-direction: column; gap: 16px; padding: 12px 2px 24px; animation: rise .4s ease-out; }
.welcome h1 { font-family: var(--display); font-weight: 400; font-size: 2rem; text-align: center; outline: none; }
.welcome .lead { text-align: center; color: var(--muted); font-size: 1.05rem; max-width: 30em; margin: 0 auto; }
.demo-note { text-align: center; background: var(--love-soft); color: var(--text); padding: 8px 12px; border-radius: 12px; font-weight: 700; }
.choice-grid { display: grid; gap: 12px; margin-top: 6px; }
.choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  padding: 18px; border-radius: var(--r-lg); border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; box-shadow: var(--shadow);
  transition: transform .15s, border-color .2s;
}
.choice:hover { border-color: var(--accent); }
.choice:active { transform: scale(.98); }
.choice strong { font-size: 1.15rem; }
.choice .icon.big { color: var(--accent); margin-bottom: 4px; }
.code-input { font-family: ui-monospace, 'Cascadia Mono', Menlo, monospace; font-size: .95rem; word-break: break-all; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); padding: 14px; border-radius: var(--r-md); border: 1px solid var(--line); }
.steps p { margin-top: 2px; font-size: .95rem; }
.step-n { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-weight: 800; flex: none; }
.qr-frame { position: relative; border-radius: 20px; overflow: hidden; background: #000; aspect-ratio: 1; }
.qr-video { width: 100%; height: 100%; object-fit: cover; }
.qr-reticle { position: absolute; inset: 18%; border: 3px solid rgba(255,255,255,.85); border-radius: 22px; box-shadow: 0 0 0 999px rgba(0,0,0,.35); }
.splash { display: grid; place-items: center; min-height: 60dvh; }

/* ---------- settings ---------- */
.settings .card .puck-card { box-shadow: none; padding: 0 0 12px; border: 0; }
.code-reveal { position: relative; width: 100%; min-height: 64px; padding: 14px; margin: 10px 0; border-radius: var(--r-sm); border: 1.5px dashed var(--line); background: var(--bg); cursor: pointer; text-align: left; }
.code-blur { font-family: ui-monospace, 'Cascadia Mono', Menlo, monospace; font-size: .9rem; word-break: break-all; filter: blur(7px); user-select: none; transition: filter .25s; }
.code-cover { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 800; color: var(--accent-ink); }
.code-reveal.shown .code-blur { filter: none; user-select: all; }
.code-reveal.shown .code-cover { display: none; }
.setup summary { cursor: pointer; font-weight: 800; min-height: 44px; display: flex; align-items: center; color: var(--accent-ink); }
.setup .steps { margin-top: 8px; }
.setup .steps li { background: var(--bg); }
.about { padding: 8px 0 4px; }

/* ---------- diagnostics ---------- */
.big-result { font-size: 1.3rem; font-weight: 800; padding: 10px 14px; border-radius: 12px; }
.big-result.pass { background: var(--ok-soft); color: var(--ok); }
.big-result.fail { background: #fde2e0; color: var(--danger); }
.table-wrap { overflow-x: auto; }
.diag-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.diag-table caption { text-align: left; font-weight: 800; padding-bottom: 6px; }
.diag-table th, .diag-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.diag-table code { word-break: break-all; font-size: .82rem; }
.diag-table .pass { color: var(--ok); font-weight: 800; }
.diag-table .fail { color: var(--danger); font-weight: 800; }
.diag-info { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; font-size: .85rem; margin: 0; }
.diag-info dt { font-weight: 800; color: var(--muted); }
.diag-info dd { margin: 0; word-break: break-word; }
