/* voice Air — v4 design system (2026-10-24)
   Direction: a portrait and a voice. Air (양지원) is a quiet, precise secretary in navy with a silver water-drop hairpin.
   The page is a night-navy (day: cool paper) room with one framed portrait, editorial captions under it, and a single
   solid primary control. No glows, no gloss, almost no outlines: hierarchy comes from type, space and one accent.
   One moving signature: a silver "water line" at the foot of the portrait that follows the voice level (--lvl).

   Tokens
   colour  bg · surface · line · ink · ink-2 · muted · primary (silver by night, navy by day) · accent (listening blue)
           states: work (amber), ok, err — used only for their meaning
   type    Pretendard (self-hosted KS X 1001 subset) · scale ×1.2 from 17: 12 · 14 · 17 · 20 · 24 · 29
   space   4 · 8 · 12 · 16 · 24 · 32 · 48
   radius  --r1 12 (controls, rows, bubbles) · --r2 24 (portrait, panels, sheet)
   depth   --e1 resting surfaces · --e2 floating (menu, sheet, toast)
   Aliases --panel/--line/--fg/--muted/--face-shadow are kept for older inline styles. */
@font-face { font-family: "Pretendard Air"; src: url("/static/fonts/pretendard-sub.woff2") format("woff2-variations"), url("/static/fonts/pretendard-sub.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
:root {
  --bg: #0c1426; --bg-2: #08101f; --surface: #141e35; --surface-2: #1b2742; --line: #26324e; --line-soft: #1d2843;
  --fg: #e9edf5; --fg-2: #c3cbdc; --muted: #8f9ab4;
  --primary: #d3dae8; --on-primary: #0d1834; --accent: #8db2f8; --on-accent: #0b1430;
  --work: #e0b25c; --ok: #7accb3; --err: #f0897f;
  --me: #1a2644;
  --vignette: #050a18;
  --e1: 0 1px 2px #00000040; --e2: 0 24px 56px -16px #000000b3, 0 0 0 1px #ffffff0f;
  --panel: var(--surface); --raise: var(--surface-2); --face-shadow: var(--e2);
  --r1: 12px; --r2: 24px;
  --t1: 12px; --t2: 14px; --t3: 17px; --t4: 20px; --t5: 24px; --t6: 29px;
  --font: "Pretendard Air", "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Noto Sans CJK KR", "Malgun Gothic", system-ui, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1); --ease-soft: cubic-bezier(.45, 0, .55, 1); --t-fast: .15s; --t: .22s; --t-slow: .45s;
  --breath: 7.2s; --word-gap: 45ms; --gaze: .45%;
  --lvl: 0;
  --toph: 56px; --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3f5f9; --bg-2: #eaeef5; --surface: #ffffff; --surface-2: #e9edf5; --line: #d6dce7; --line-soft: #e4e8f0;
    --fg: #111a2e; --fg-2: #34405a; --muted: #5a6580;
    --primary: #1c2b57; --on-primary: #ffffff; --accent: #2a55be; --on-accent: #ffffff;
    --work: #8a5800; --ok: #0e7461; --err: #b63a36;
    --me: #e4eaf7;
    --vignette: #0b1430;
    --e1: 0 1px 2px #1a254d14; --e2: 0 24px 56px -18px #1a254d47, 0 0 0 1px #0f1a3a12;
    color-scheme: light;
  }
}

/* ---- base */
* { box-sizing: border-box; }
html { background: var(--bg-2); overflow-x: clip; }
html, body { margin: 0; height: 100%; color: var(--fg); font: var(--t3)/1.5 var(--font); font-feature-settings: "ss06"; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
body { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; position: relative; padding: var(--sat) var(--sar) 0 var(--sal);
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg) 40%, var(--bg-2) 100%) fixed; background-color: var(--bg);
  /* stacked (phone / Fold cover) geometry: portrait width/height from what is left after header, text and dock */
  --cw: calc(100vw - var(--sal) - var(--sar)); --avail: max(150px, calc(100dvh - var(--sat) - var(--sab) - var(--toph) - 392px));
  --pw: min(calc(var(--cw) - 32px), 480px, calc(var(--avail) / .72)); --ph: min(calc(var(--pw) * 1.25), var(--avail)); }
.muted { color: var(--muted); }
button { font: inherit; color: inherit; touch-action: manipulation; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
.ico { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
button, a, select, .say input { transition: background-color var(--t) var(--ease), color var(--t) var(--ease), box-shadow var(--t) var(--ease), opacity var(--t) var(--ease), transform var(--t-fast) var(--ease); }
button:active { transform: scale(.97); transition-duration: .08s; }
:is(button, a, select, input):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { cursor: default; opacity: .5; }

/* ---- header */
.top { grid-area: top; flex: none; height: var(--toph); display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 8px 0 20px; position: relative; z-index: 11; }
.who { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.who b { font-size: var(--t3); font-weight: 650; letter-spacing: -.01em; }
.who .sub { font-size: var(--t2); font-weight: 500; color: var(--muted); }
/* connection: invisible-quiet when fine, a clear red mark when the line is down */
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--err); align-self: center; flex: none; transition: background-color var(--t) var(--ease); }
.dot.on { background: var(--ok); }
.top-r { display: flex; align-items: center; gap: 4px; }
.tbtn { height: 44px; min-width: 44px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: var(--r1); background: transparent; color: var(--fg-2); font-size: var(--t2); font-weight: 600; cursor: pointer; }
.tbtn.sq { padding: 0; width: 44px; }
.tbtn .ico { width: 22px; height: 22px; }
.tbtn[aria-expanded=true] { background: var(--surface); color: var(--fg); }
@media (hover: hover) { .tbtn:hover, .ctl:hover, .act-x:hover, .row:is(button, a):hover { background-color: var(--surface-2); color: var(--fg); } }

/* ---- settings panel: grouped list rows (label left, value/switch right) */
.menu { position: absolute; z-index: 12; top: calc(var(--sat) + var(--toph) - 4px); left: calc(8px + var(--sal)); right: calc(8px + var(--sar)); max-height: calc(100dvh - var(--sat) - var(--toph) - 16px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border-radius: var(--r2); box-shadow: var(--e2); padding: 4px 16px 12px; animation: pop var(--t) var(--ease); transform-origin: top right; scrollbar-width: thin; }
.menu[hidden], .row[hidden] { display: none; }
.menu form { margin: 0; }
.grp { padding: 12px 0 4px; }
.grp + .grp { border-top: 1px solid var(--line-soft); }
.grp h3 { margin: 4px 0 4px; font-size: var(--t2); font-weight: 600; color: var(--muted); letter-spacing: 0; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; min-height: 52px; padding: 0 8px; margin: 0 -8px; width: calc(100% + 16px); border: 0; border-radius: var(--r1); background: transparent; color: var(--fg); font-size: var(--t3); font-weight: 500; text-align: left; text-decoration: none; cursor: pointer; }
.row .k { min-width: 0; }
.row.act { justify-content: flex-start; }
.row.quiet { color: var(--muted); }
.row select { flex: 1; min-width: 0; max-width: 62%; height: 44px; -webkit-appearance: none; appearance: none; border: 0; border-radius: var(--r1); background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.75 6 6.25l4.5-4.5' fill='none' stroke='%238f9ab4' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 4px center;
  padding: 0 24px 0 8px; color: var(--fg-2); font: inherit; font-size: var(--t3); font-weight: 500; text-align: right; text-align-last: right; cursor: pointer; text-overflow: ellipsis; }
.row select option { background: var(--surface); color: var(--fg); }
/* switch: the row is the button (aria-pressed); the track is decoration */
.sw { flex: none; width: 40px; height: 24px; border-radius: 12px; background: color-mix(in srgb, var(--muted) 62%, var(--surface)); position: relative; transition: background-color var(--t) var(--ease); }
.sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--e1); transition: transform var(--t) var(--ease); }
.tog[aria-pressed=true] .sw { background: var(--accent); }
.tog[aria-pressed=true] .sw::after { transform: translateX(16px); }
.tog:disabled { opacity: 1; cursor: default; } .tog:disabled .k { color: var(--muted); } .tog:disabled .sw { opacity: .5; }
.note { font-size: var(--t2); line-height: 1.5; color: var(--muted); display: flex; flex-direction: column; gap: 8px; padding: 0 0 12px; }
.note:empty, #wakeNote:empty { display: none !important; }
.nl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.mini { min-height: 36px; padding: 0 12px; border: 0; border-radius: var(--r1); background: var(--surface-2); color: var(--fg); font-size: var(--t2); font-weight: 600; cursor: pointer; }

/* ---- stage: the portrait + the words */
.stage { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; padding: 4px 16px 0; gap: 16px; overflow: hidden; }
.face { grid-area: face; position: relative; flex: none; width: var(--pw); height: var(--ph); border: 0; padding: 0; border-radius: var(--r2); overflow: hidden; background: var(--surface); cursor: pointer; box-shadow: var(--e1);
  transition: opacity var(--t-slow) var(--ease), transform var(--t-fast) var(--ease); }
.face:active { transform: scale(.99); }
.face .pane { position: absolute; inset: 0; transform: translate3d(var(--gx, 0), var(--gy, 0), 0); transition: transform 1.8s var(--ease-soft); }
/* breathing: ~0.6% swell from the chest; base 1.012 keeps the gaze shift covered */
.face img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 32%; transform-origin: 50% 78%; transform: scale(1.012);
  animation: breath var(--breath) var(--ease-soft) infinite; transition: opacity .45s ease, filter var(--t-slow) var(--ease); }
.face img.hide { opacity: 0; }
.face .sheen { display: none; }
body.calm .face img { animation-play-state: paused; }
/* frame: hairline edge + soft vignette (corners and foot) so the water line has a calm ground */
.face .ring { --rc: transparent; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 30%, transparent 58%, color-mix(in srgb, var(--vignette) 34%, transparent) 100%), linear-gradient(180deg, transparent 70%, color-mix(in srgb, var(--vignette) 46%, transparent) 100%);
  box-shadow: inset 0 0 0 1px #ffffff10, inset 0 0 0 1.5px color-mix(in srgb, var(--rc) 38%, transparent); transition: box-shadow var(--t-slow) var(--ease); }
/* the water line: a short silver/blue stroke at the portrait's foot; its length follows the voice level */
.face .ring::before { content: ''; position: absolute; left: 30%; right: 30%; bottom: 16px; height: 3px; border-radius: 2px; background: var(--rc);
  transform: scaleX(calc(.05 + var(--lvl) * .95)); opacity: 0; transition: opacity var(--t-slow) var(--ease); will-change: transform; }
body[data-state=listening] .face .ring { --rc: var(--accent); }
body[data-state=speaking] .face .ring { --rc: #e6ebf4; }
body[data-state=thinking] .face .ring { --rc: #c3cbdc; }
body:is([data-state=listening], [data-state=speaking]) .face .ring::before { opacity: 1; }
body[data-state=thinking] .face .ring::before { opacity: 1; animation: tide 2.4s var(--ease-soft) infinite; }
body.no-vu[data-state=speaking] .face .ring::before { animation: tide 1.6s var(--ease-soft) infinite; }
body[data-state=off] .face img { filter: saturate(.82); }
body[data-state=connecting] .face { opacity: .6; }
body[data-state=connecting] .face img { filter: saturate(.6); animation-duration: calc(var(--breath) * 1.6); }
body:is([data-state=listening], [data-state=speaking]) .face { --gy: calc(var(--gaze) * .7); }

.status { grid-area: status; container-type: size; width: var(--pw); max-width: 100%; flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: stretch; text-align: left; gap: 8px; overflow: hidden; }
/* state: the water-drop mark (Air's hairpin) + one word */
.state { --c: var(--muted); display: flex; align-items: center; gap: 12px; min-height: 26px; font-size: var(--t3); font-weight: 600; letter-spacing: -.005em; color: var(--c); transition: color var(--t) var(--ease); }
.state::before { content: ''; width: 8px; height: 8px; flex: none; margin: 0 1px; border-radius: 0 50% 50% 50%; transform: rotate(45deg) scale(calc(1 + var(--lvl) * .35)); background: var(--c); transition: background-color var(--t) var(--ease); }
body[data-state=connecting] .state::before { animation: blink 1.2s ease-in-out infinite; }
body[data-state=listening] .state { --c: var(--accent); }
body[data-state=thinking] .state { --c: var(--fg-2); }
body[data-state=thinking] .state::before { animation: blink 2.4s var(--ease-soft) infinite; }
body[data-state=speaking] .state { --c: var(--fg); }
.state.swap { animation: soft-in .3s var(--ease); }
/* what he said (small, quiet, named) */
.heard { font-size: var(--t3); line-height: 1.55; color: var(--muted); overflow-wrap: anywhere; word-break: keep-all; text-wrap: pretty; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; transition: color var(--t) var(--ease); }
.heard:not(:empty)::before { content: '대표님'; display: inline-block; margin-right: 8px; font-size: var(--t2); font-weight: 600; color: var(--fg-2); }
.heard.live { color: var(--fg-2); }
.heard.live::before { color: var(--accent); }
/* what Air is saying: the hero text */
.caption { font-size: var(--t5); line-height: 1.5; font-weight: 500; letter-spacing: -.018em; color: var(--fg); overflow-wrap: anywhere; word-break: keep-all; text-wrap: pretty; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; transition: color .4s var(--ease); }
.caption.past { color: var(--fg-2); font-size: var(--t4); font-weight: 400; letter-spacing: -.012em; }
.caption .w { display: inline-block; animation: word .5s var(--ease) both; animation-delay: calc(var(--i) * var(--word-gap)); }
.caption.enter, .heard.enter { animation: soft-in .36s var(--ease); }

/* ---- dock: activity, controls, text input */
.dock { grid-area: dock; flex: none; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 12px 16px calc(8px + var(--sab)); }
.dock > * { width: min(100%, var(--pw)); }
.activity { display: flex; align-items: center; gap: 4px; min-height: 48px; padding: 0 4px 0 16px; background: var(--surface); border-radius: var(--r1); animation: pop var(--t) var(--ease); }
.activity[hidden] { display: none; }
.act-main { flex: 1; min-width: 0; min-height: 44px; display: flex; align-items: center; gap: 12px; border: 0; padding: 0; background: none; cursor: pointer; text-align: left; font-size: var(--t2); font-weight: 500; color: var(--fg); }
.act-main:active { transform: none; }
#actText { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-main .tm { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.spin { width: 14px; height: 14px; flex: none; border-radius: 50%; border: 1.5px solid var(--work); border-right-color: transparent; animation: spin 1.1s linear infinite; }
.act-x { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border: 0; border-radius: var(--r1); background: transparent; color: var(--muted); cursor: pointer; }
.act-x .ico { width: 20px; height: 20px; }
.controls { display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; align-items: center; gap: 12px; }
.ctl { height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 0; border-radius: var(--r1); background: transparent; color: var(--fg-2); cursor: pointer; }
.ctl .lb { font-size: var(--t1); font-weight: 600; color: var(--muted); line-height: 1; }
.ctl.on { background: var(--surface); color: var(--accent); }
.ctl.on .lb { color: var(--accent); }
/* the voice button: the one solid object on screen */
.mic { position: relative; height: 56px; display: flex; align-items: center; justify-content: center; gap: 12px; border: 0; border-radius: var(--r2); background: var(--primary); color: var(--on-primary); font-size: var(--t3); font-weight: 650; letter-spacing: -.01em; cursor: pointer; box-shadow: var(--e1); }
.mic::after { content: ''; position: absolute; inset: -5px; border-radius: 29px; pointer-events: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); opacity: 0; will-change: opacity; }
.mic.on { background: var(--surface); color: var(--fg); box-shadow: inset 0 0 0 1.5px var(--accent); }
.mic.on .ico { color: var(--accent); }
.mic.on::after { opacity: var(--lvl); }
@media (hover: hover) { .mic:not(.on):hover { background: color-mix(in srgb, var(--primary) 90%, var(--fg)); } }
.say { display: flex; gap: 8px; animation: pop var(--t) var(--ease); }
.say[hidden] { display: none; }
.say input { flex: 1; min-width: 0; height: 52px; padding: 0 16px; border: 1px solid var(--line); border-radius: var(--r1); background: var(--surface); color: var(--fg); font: inherit; font-size: var(--t3); }
.say input::placeholder { color: var(--muted); }
.say input:focus { border-color: var(--accent); }
.say .send { width: 52px; height: 52px; flex: none; display: grid; place-items: center; border: 0; border-radius: var(--r1); background: var(--primary); color: var(--on-primary); cursor: pointer; }
.metric { min-height: 18px; font-size: var(--t1); line-height: 1.5; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.metric:empty { min-height: 0; margin-top: -12px; }

/* ---- conversation log (bottom sheet on phones, docked column when wide) — a transcript, not a chat app */
.scrim { position: fixed; inset: 0; z-index: 8; background: color-mix(in srgb, var(--bg-2) 66%, transparent); animation: fade var(--t) var(--ease); }
.scrim[hidden] { display: none; }
.sheet { grid-area: sheet; position: fixed; left: 0; right: 0; bottom: 0; z-index: 9; height: min(80dvh, 760px); display: flex; flex-direction: column; padding-bottom: var(--sab);
  background: var(--surface); border-radius: var(--r2) var(--r2) 0 0; box-shadow: var(--e2); animation: rise .32s var(--ease); }
.sheet[hidden] { display: none; }
.sheet-head { flex: none; position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 60px; padding: 8px 8px 0 20px; }
.sheet-head b { font-size: var(--t3); font-weight: 650; letter-spacing: -.01em; }
.sheet-head .grab { position: absolute; top: 8px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--line); }
.log { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px 20px 24px; display: flex; flex-direction: column; gap: 16px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.log::before { content: ''; flex: 1; }
.line { max-width: 88%; font-size: var(--t3); line-height: 1.6; overflow-wrap: anywhere; word-break: keep-all; }
.line .meta { display: block; margin-bottom: 4px; font-size: var(--t1); font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.line .txt { white-space: pre-wrap; }
.line.air { align-self: flex-start; }
.line.user { align-self: flex-end; padding: 12px 16px; background: var(--me); border-radius: var(--r1); color: var(--fg); }
.line.user .meta { text-align: right; }
.line.air.cut .txt::after { content: ' …'; color: var(--muted); }
.line.system { align-self: center; max-width: 92%; font-size: var(--t2); line-height: 1.5; color: var(--muted); text-align: center; }
.log > .in { animation: line-in .36s var(--ease) both; }
.newmsg { position: absolute; left: 50%; bottom: calc(16px + var(--sab)); transform: translateX(-50%); z-index: 2; min-height: 44px; display: inline-flex; align-items: center; gap: 4px; padding: 0 12px 0 16px; border: 0; border-radius: var(--r2); background: var(--primary); color: var(--on-primary); font-size: var(--t2); font-weight: 600; box-shadow: var(--e2); animation: pop var(--t) var(--ease); cursor: pointer; }
.newmsg .ico { width: 20px; height: 20px; }
.newmsg:active { transform: translateX(-50%) scale(.97); }
.newmsg[hidden] { display: none; }
/* task row: one line, expands in place */
.task { align-self: stretch; max-width: 100%; background: var(--bg); border-radius: var(--r1); font-size: var(--t2); }
.task > .head { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 8px 16px; border: 0; border-radius: inherit; background: none; text-align: left; cursor: pointer; }
.task > .head:active { transform: none; }
.task .ttl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; color: var(--fg); }
.task .tm { flex: none; color: var(--muted); font-size: var(--t1); font-variant-numeric: tabular-nums; }
.task .ic { width: 16px; height: 16px; flex: none; display: grid; place-items: center; border-radius: 50%; font-size: 10px; font-weight: 700; line-height: 1; }
.task.running .ic, .task.queued .ic { border: 1.5px solid var(--work); border-right-color: transparent; animation: spin 1.1s linear infinite; }
.task.queued .ic { border-color: var(--muted); border-right-color: transparent; animation-duration: 2.4s; }
.task.done .ic { background: var(--ok); color: var(--bg); }
.task.failed .ic { background: var(--err); color: var(--bg); }
.task.cancelled .ic { background: var(--line); color: var(--muted); }
.task .body { display: none; padding: 0 16px 12px 44px; color: var(--muted); white-space: pre-wrap; max-height: 50vh; overflow-y: auto; line-height: 1.6; }
.task.open .body { display: block; }
.task .body ol { margin: 0 0 8px; padding-left: 18px; }
.task .body .res { color: var(--fg-2); }

/* ---- toast (new version, etc.) */
.toast { position: fixed; left: 50%; bottom: calc(148px + var(--sab)); transform: translateX(-50%); z-index: 30; max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: var(--r1); background: var(--surface-2); color: var(--fg); font-size: var(--t2); font-weight: 600; box-shadow: var(--e2); animation: pop var(--t) var(--ease); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breath { 0%, 100% { transform: scale(1.012); } 45% { transform: scale(1.018) translate3d(0, -.3%, 0); } }
@keyframes tide { 0%, 100% { transform: scaleX(.08); opacity: .55; } 50% { transform: scaleX(.42); opacity: 1; } }
@keyframes blink { 50% { opacity: .35; } }
@keyframes word { from { opacity: 0; transform: translate3d(0, .3em, 0); } }
@keyframes soft-in { from { opacity: 0; transform: translate3d(0, 6px, 0); } }
@keyframes line-in { from { opacity: 0; transform: translate3d(0, 8px, 0); } }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } }
@keyframes slide { from { opacity: 0; transform: translateX(24px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }

/* short screens: fewer caption lines, never half a line */
@media (max-height: 560px) { .caption { -webkit-line-clamp: 2; } .heard { -webkit-line-clamp: 1; } }
@media (min-width: 720px) { .menu { left: auto; width: 400px; } .sheet { left: 50%; right: auto; width: 680px; margin-left: -340px; } }

/* ---- wide / short screens (Fold8 inner ~880x800 either way, landscape phones, desktop):
   a centred composition — portrait on the left, words top-aligned to its top edge and controls to its foot. */
@media (min-width: 680px) and (min-aspect-ratio: 4/5) {
  body { --A: calc(100dvh - var(--sat) - var(--sab) - var(--toph));
    --fw: max(160px, min(calc(100vw - var(--sal) - var(--sar) - 460px), calc((var(--A) - 32px) * .8), 560px)); --fh: calc(var(--fw) * 1.25);
    --pad: max(16px, calc((var(--A) - var(--fh)) / 2)); --gap: clamp(32px, 4vw, 56px);
    display: grid; padding-bottom: var(--sab);
    grid-template-columns: minmax(16px, 1fr) var(--fw) var(--gap) minmax(0, 560px) minmax(24px, 1fr);
    grid-template-rows: var(--toph) var(--pad) minmax(0, 1fr) auto var(--pad);
    grid-template-areas: "top top top top top" ". . . . ." ". face . status ." ". face . dock ." ". . . . ."; }
  .stage { display: contents; }
  .face { width: var(--fw); height: min(var(--fh), calc(var(--A) - 32px)); align-self: center; grid-row: 3 / 5; }
  body:is([data-state=listening], [data-state=speaking], [data-state=thinking]):not(.log-open) .face { --gx: var(--gaze); --gy: 0; }
  .status { width: auto; padding-top: 4px; gap: 12px; }
  .state { min-height: 28px; }
  .caption { font-size: var(--t6); line-height: 1.45; -webkit-line-clamp: 4; }
  .caption.past { font-size: var(--t5); }
  @container (min-height: 400px) { .caption { -webkit-line-clamp: 6; } }
  .dock { padding: 12px 0 0; align-items: stretch; }
  .dock > * { width: auto; }
  .metric { text-align: left; }
  .controls { grid-template-columns: minmax(0, 320px) 64px 64px; justify-content: start; }
  .controls .mic { grid-column: 1; grid-row: 1; }
  .menu { left: auto; width: min(400px, calc(100vw - 16px)); }
  .scrim { display: none !important; }
  .sheet { left: auto; right: 0; top: 0; bottom: 0; width: clamp(340px, 42vw, 520px); height: auto; margin: 0; border-radius: 0; box-shadow: -1px 0 0 var(--line-soft); padding-top: var(--sat); animation-name: slide; }
  .sheet-head { min-height: var(--toph); padding-top: 0; }
  .sheet-head .grab { display: none; }

  /* log open: [voice column (stacked, like the phone) | transcript column] */
  body.log-open { --lw: clamp(340px, 42vw, 520px); --cw: calc(100vw - var(--sal) - var(--sar) - var(--lw)); --avail: max(120px, calc(var(--A) - 380px));
    --pw: min(calc(var(--cw) - 48px), 480px, calc(var(--avail) / .72)); --ph: min(calc(var(--pw) * 1.25), var(--avail));
    grid-template-columns: minmax(0, 1fr) var(--lw); grid-template-rows: var(--toph) auto minmax(0, 1fr) auto;
    grid-template-areas: "top sheet" "face sheet" "status sheet" "dock sheet"; }
  body.log-open .face { grid-row: auto; width: var(--pw); height: var(--ph); justify-self: center; align-self: start; margin-top: 4px; }
  body.log-open .status { width: var(--pw); justify-self: center; padding-top: 16px; }
  body.log-open .caption { font-size: var(--t5); }
  body.log-open .caption.past { font-size: var(--t4); }
  body.log-open .dock { width: var(--pw); justify-self: center; padding-bottom: 12px; }
  body.log-open .sheet { position: relative; inset: auto; width: auto; min-height: 0; margin-top: calc(0px - var(--sat)); margin-bottom: calc(0px - var(--sab)); margin-right: calc(0px - var(--sar)); padding-right: var(--sar); padding-bottom: var(--sab); animation-name: fade; }
  body.log-open .top-r #logBtn { display: none; }
}
/* very short + log open (landscape phone): the portrait makes way for words and controls */
@media (min-width: 680px) and (min-aspect-ratio: 4/5) and (max-height: 520px) { body.log-open .face { display: none; } body.log-open .status { padding-top: 0; } }
/* foldable spanning the hinge: split on the fold */
@media (horizontal-viewport-segments: 2) {
  body:not(.log-open) { --fw: min(calc(env(viewport-segment-width 0 0, 50vw) - 48px), calc((var(--A) - 32px) * .8)); grid-template-columns: 0 env(viewport-segment-width 0 0, 50vw) calc(env(viewport-segment-left 1 0, 50vw) - env(viewport-segment-right 0 0, 50vw) + 32px) minmax(0, 1fr) 24px; }
  body:not(.log-open) .face { justify-self: center; }
}
/* status area too short for all lines: drop lines instead of clipping one in half (after the layout blocks so it wins) */
@container (max-height: 190px) { .caption { -webkit-line-clamp: 2; } .heard { -webkit-line-clamp: 1; } }
@container (max-height: 160px) { .caption, .caption.past { font-size: var(--t4); } }
@container (max-height: 120px) { .heard { display: none; } }
/* app in background / screen off: freeze every loop */
body.bg *, body.bg *::before, body.bg *::after { animation-play-state: paused !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .face img { transform: none; } .face { --gx: 0 !important; --gy: 0 !important; }
  .face .ring::before { transform: scaleX(.3) !important; } .mic::after { opacity: 0 !important; } .state::before { transform: rotate(45deg) !important; }
  button:active, .face:active { transform: none; }
  .newmsg:active { transform: translateX(-50%); }
}
@media (prefers-contrast: more) { :root { --line: var(--muted); --line-soft: var(--muted); --muted: var(--fg-2); } }

/* ---- login / message pages (lib/auth.mjs) */
body.plain { align-items: center; justify-content: center; padding: 16px; }
.card { width: 100%; max-width: 360px; padding: 32px 24px; text-align: center; background: var(--surface); border-radius: var(--r2); box-shadow: var(--e2); }
.brand { margin: 0 0 8px; font-size: var(--t5); font-weight: 650; letter-spacing: -.01em; }
.card h2 { font-size: var(--t3); margin: 12px 0; }
.btn { display: block; margin-top: 24px; padding: 12px; border-radius: var(--r1); background: var(--surface-2); color: var(--fg); text-decoration: none; font-weight: 600; }
.btn.primary { background: var(--primary); color: var(--on-primary); }
.err { color: var(--err); font-size: var(--t2); }

/* video avatar (prototype 2026-10-24): loops sit over the stills; same framing as .face img so the crossfade is seamless.
   While a loop is visible the CSS breathing is switched off (the loop breathes itself). */
.face video.vid { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 32%; transform-origin: 50% 78%; transform: scale(1.012);
  opacity: 0; transition: opacity .45s ease, filter var(--t-slow) var(--ease); pointer-events: none; background: transparent; }
.face video.vid.on { opacity: 1; }
body.vid-on .face img { animation: none; }
body[data-state=off] .face video.vid { filter: saturate(.82); }
@media (prefers-reduced-motion: reduce) { .face video.vid { display: none; } }

/* ---- hologram room (2026-10-24): app.js draws a faint teal/violet/pink light into a tiny canvas behind everything
   (see the hologram block there; it also lifts the light out from under the words, following the layout).
   body isolates so the layer sits above body's own navy/paper gradient and below every element. */
body { isolation: isolate; }
.holo { position: fixed; inset: 0; z-index: -1; pointer-events: none; contain: strict; }
.holo canvas { display: block; width: 100%; height: 100%; }
@media (forced-colors: active) { .holo { display: none; } }

/* ---- [interp 20261024] interpretation mode (public/interp.js). Scoped: .ip-* / body.interp-on / #interpBtn only.
   Hanzi: the Pretendard subset has no ideographs -> "Air Hanzi" = the phone's own CJK SC font when present (local()),
   else a self-hosted Noto Sans SC subset (GB2312 level 1, 3.8k chars, ~1 MB, fetched only when a Hanzi is drawn). */
@font-face { font-family: "Air Hanzi"; font-weight: 100 549; font-display: swap; unicode-range: U+3000-303F, U+3400-4DBF, U+4E00-9FFF, U+F900-FAFF, U+FF00-FFEF;
  src: local("Noto Sans CJK SC Regular"), local("NotoSansCJKsc-Regular"), local("Noto Sans SC Regular"), local("NotoSansSC-Regular"), local("Source Han Sans SC Regular"), local("SourceHanSansSC-Regular"), local("PingFangSC-Regular"), local("Microsoft YaHei"), url("/static/fonts/hanzi-sub.woff2") format("woff2"); }
@font-face { font-family: "Air Hanzi"; font-weight: 550 900; font-display: swap; unicode-range: U+3000-303F, U+3400-4DBF, U+4E00-9FFF, U+F900-FAFF, U+FF00-FFEF;
  src: local("Noto Sans CJK SC Bold"), local("NotoSansCJKsc-Bold"), local("Noto Sans SC Bold"), local("NotoSansSC-Bold"), local("Source Han Sans SC Bold"), local("SourceHanSansSC-Bold"), local("PingFangSC-Semibold"), local("Microsoft YaHei Bold"), url("/static/fonts/hanzi-sub.woff2") format("woff2"); }
:root { --font-zh: "Air Hanzi", "Noto Sans CJK SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", var(--font); --ip-mic: #f0897f; }
@media (prefers-color-scheme: light) { :root { --ip-mic: #c23b35; } }
:lang(zh) { font-family: var(--font-zh); word-break: normal; line-break: strict; overflow-wrap: anywhere; }
#caption:lang(zh) { letter-spacing: .02em; }
.ip { position: fixed; z-index: 7; top: calc(var(--sat) + var(--toph)); bottom: 0; left: 0; right: 0; display: flex; flex-direction: column; gap: 8px;
  padding: 0 calc(16px + var(--sar)) calc(12px + var(--sab)) calc(16px + var(--sal)); background: var(--bg); animation: fade var(--t) var(--ease); }
.ip[hidden] { display: none; }
.ip > * { width: 100%; max-width: 760px; margin-inline: auto; }
body.interp-on .stage, body.interp-on .dock { visibility: hidden; }
/* banner: who is listening is never ambiguous (participants can see it) */
.ip-banner { flex: none; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 14px; border-radius: var(--r1);
  background: color-mix(in srgb, var(--ip-mic) 16%, var(--surface)); color: var(--fg); font-size: var(--t3); font-weight: 650; }
.ip-banner.off { background: var(--surface); color: var(--fg-2); }
.ip-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ip-mic); flex: none; animation: ip-rec 1.6s var(--ease-soft) infinite; }
.ip-banner.off .ip-dot { background: var(--muted); animation: none; }
@keyframes ip-rec { 50% { opacity: .35; } }
.ip-btext { flex: 1; min-width: 0; }
.ip-pair { flex: none; display: inline-flex; gap: 6px; align-items: baseline; font-size: var(--t2); font-weight: 600; color: var(--fg-2); }
/* cards */
.ip-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 12px; padding: 4px 0 8px; scrollbar-width: thin; }
.ip-empty { margin: auto 0; display: flex; flex-direction: column; gap: 8px; padding: 24px 8px; color: var(--fg-2); font-size: var(--t3); line-height: 1.55; word-break: keep-all; }
.ip-empty b { color: var(--fg); font-size: var(--t4); font-weight: 650; }
.ip-empty .ip-hint { margin-top: 8px; font-size: var(--t2); color: var(--muted); }
.ip-card { flex: none; display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: var(--r2); background: var(--surface); box-shadow: var(--e1); }
.ip-card.ip-out { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.ip-card.is-pending { box-shadow: inset 0 0 0 2px var(--work), var(--e1); }
.ip-card.is-cancelled { opacity: .55; }
.ip-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: var(--t1); font-weight: 600; color: var(--muted); }
.ip-who { color: var(--fg-2); }
.ip-st { padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--fg-2); }
.is-pending .ip-st { background: color-mix(in srgb, var(--work) 22%, var(--surface)); color: var(--fg); }
.is-error .ip-st { color: var(--err); }
.ip-warn, .ip-chip { padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--work) 18%, transparent); color: var(--work); }
.ip-chip { background: var(--surface-2); color: var(--fg-2); }
/* one labelled line per language: [中文 원문] 汉字 / [병음] pīnyīn / [한국어 번역] 한글 */
.ip-line { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 2px 10px; align-items: baseline; }
.ip-tag { display: flex; flex-direction: column; gap: 0; line-height: 1.25; padding-top: 2px; }
.ip-tag b { font-size: var(--t1); font-weight: 700; color: var(--fg-2); letter-spacing: .02em; }
.ip-tag i { font-style: normal; font-size: 11px; font-weight: 600; color: var(--muted); }
.ip-t { min-width: 0; color: var(--fg); overflow-wrap: anywhere; }
.ip-zh .ip-t { font-size: var(--t5); line-height: 1.5; font-weight: 500; }
.ip-zh .ip-tag b { color: var(--accent); }
.ip-ko .ip-t { font-size: var(--t4); line-height: 1.5; word-break: keep-all; }
.ip-py .ip-t { font-size: var(--t2); line-height: 1.5; color: var(--fg-2); letter-spacing: .01em; }
.ip-small .ip-t { font-size: var(--t2); color: var(--fg-2); }
.ip-back .ip-t { font-size: var(--t2); color: var(--muted); }
.ip-wait .ip-t { color: var(--muted); }
.ip-sens { padding: 8px 12px; border-radius: var(--r1); background: color-mix(in srgb, var(--err) 14%, transparent); color: var(--fg); font-size: var(--t2); font-weight: 600; word-break: keep-all; }
.ip-ask { font-size: var(--t2); font-weight: 600; color: var(--fg); word-break: keep-all; }
.ip-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.ip-act { min-height: 44px; padding: 0 16px; border: 0; border-radius: var(--r1); background: var(--surface-2); color: var(--fg); font-size: var(--t2); font-weight: 650; cursor: pointer; }
.ip-act.pri { background: var(--primary); color: var(--on-primary); min-width: 96px; }
.ip-edit { width: 100%; min-height: 88px; padding: 12px; border: 1px solid var(--accent); border-radius: var(--r1); background: var(--bg); color: var(--fg); font: inherit; font-size: var(--t4); line-height: 1.5; resize: vertical; }
.ip-edit:lang(zh) { font-family: var(--font-zh); }
/* bottom: tools + the big stop */
.ip-prefs { flex: none; padding: 4px 16px 8px; border-radius: var(--r2); background: var(--surface); box-shadow: var(--e1); }
.ip-prefs[hidden] { display: none; }
.ip-note { margin: 8px 0 4px; font-size: var(--t2); line-height: 1.5; color: var(--muted); word-break: keep-all; }
.ip-say { flex: none; display: flex; gap: 8px; }
.ip-say input { flex: 1; min-width: 0; height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r1); background: var(--surface); color: var(--fg); font: inherit; font-size: var(--t2); }
.ip-say input:focus { border-color: var(--accent); outline: none; }
.ip-say .send { width: 48px; height: 48px; flex: none; display: grid; place-items: center; border: 0; border-radius: var(--r1); background: var(--surface-2); color: var(--fg); cursor: pointer; }
.ip-bar { flex: none; display: flex; align-items: stretch; gap: 8px; }
.ip-tools { display: flex; gap: 4px; flex: none; }
.ip-tool { width: 60px; min-height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 0; border-radius: var(--r1); background: transparent; color: var(--fg-2); font-size: 11px; font-weight: 600; cursor: pointer; }
.ip-tool .lb { white-space: nowrap; }
.ip-tool.on, .ip-tool[aria-pressed=true], .ip-tool[aria-expanded=true] { background: var(--surface); color: var(--fg); }
.ip-tool.on .ico { color: var(--ip-mic); }
.ip-pyg { height: 24px; display: grid; place-items: center; font-size: var(--t2); font-weight: 700; font-style: italic; }
.ip-stop { flex: 1; min-height: 60px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; border: 0; border-radius: var(--r1); background: #b3261e; color: #fff; font-size: var(--t4); font-weight: 750; cursor: pointer; }
@media (prefers-color-scheme: light) { .ip-stop { color: #fff; } }
.ip-toast { position: fixed; z-index: 30; left: 50%; top: calc(var(--sat) + var(--toph) + 8px); transform: translateX(-50%); max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: var(--r1); background: var(--surface); box-shadow: var(--e2); color: var(--fg); font-size: var(--t2); font-weight: 600; word-break: keep-all; }
.ip-toast[hidden] { display: none; }
/* header entry */
#interpBtn { gap: 6px; }
#interpBtn .ip-eg { display: inline-flex; font-size: 13px; font-weight: 700; line-height: 1; }
#interpBtn .ip-eg span { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; background: var(--surface-2); }
#interpBtn .ip-eg span + span { margin-left: -4px; background: var(--surface); box-shadow: 0 0 0 1.5px var(--bg); }
#interpBtn.on { color: var(--fg); background: color-mix(in srgb, var(--ip-mic) 16%, transparent); }
@media (max-width: 380px) { #interpBtn > span:last-child { display: none; } }
.line.interp .txt { white-space: pre-line; color: var(--fg-2); }
/* wide (Fold inner / landscape): roomier type; the card column stays readable (<= 760px) */
@media (min-width: 680px) and (min-aspect-ratio: 4/5) {
  .ip { padding-top: 4px; }
  .ip-zh .ip-t { font-size: var(--t6); }
  .ip-ko .ip-t { font-size: var(--t5); }
  .ip-line { grid-template-columns: 64px minmax(0, 1fr); }
  .ip-tool { width: 68px; }
}
@media (max-height: 520px) { .ip-say { display: none; } .ip-empty { padding: 8px; } .ip-tool, .ip-stop { min-height: 52px; } .ip-banner { min-height: 40px; padding: 6px 12px; } }
@media (prefers-reduced-motion: reduce) { .ip-dot { animation: none; } }
/* [interp] banner lines, language columns (wide), language pick dialog (605d439a) */
.ip-btext { display: flex; flex-direction: column; gap: 0; line-height: 1.3; }
.ip-bsub { font-size: var(--t1); font-weight: 600; color: var(--fg-2); }
.ip-cols { display: none; }
.ip-body { display: flex; flex-direction: column; gap: 10px; }
.ip-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ip-col:empty { display: none; }
.ip-colko { padding-top: 10px; border-top: 1px solid var(--line-soft); }
@media (min-width: 680px) and (min-aspect-ratio: 4/5) {
  .ip > * { max-width: 1040px; }
  .ip-cols { flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 24px; padding: 0 16px; font-size: var(--t2); font-weight: 700; color: var(--fg-2); }
  .ip-cols i { font-style: normal; font-weight: 600; color: var(--muted); margin-left: 4px; }
  .ip-body { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
  .ip-col:empty { display: flex; }
  .ip-colko { padding-top: 0; border-top: 0; padding-left: 24px; margin-left: -12px; border-left: 1px solid var(--line-soft); }
  .ip-line { grid-template-columns: 1fr; gap: 2px; }
  .ip-tag { flex-direction: row; gap: 6px; padding-top: 0; }
  .ip-zh .ip-t { font-size: var(--t5); } .ip-ko .ip-t { font-size: var(--t4); }
}
@media (min-width: 680px) and (min-aspect-ratio: 4/5) and (max-height: 520px) { .ip-cols { display: none; } .ip-zh .ip-t { font-size: var(--t4); } .ip-ko .ip-t { font-size: var(--t3); } }
.ip-scrim { position: fixed; inset: 0; z-index: 30; background: color-mix(in srgb, var(--bg-2) 70%, transparent); animation: fade var(--t) var(--ease); }
.ip-scrim[hidden], .ip-pick[hidden] { display: none; }
.ip-pick { position: fixed; z-index: 31; left: calc(8px + var(--sal)); right: calc(8px + var(--sar)); bottom: calc(8px + var(--sab)); max-width: 440px; margin-inline: auto; padding: 20px 20px 16px;
  background: var(--surface); border-radius: var(--r2); box-shadow: var(--e2); display: flex; flex-direction: column; gap: 12px; animation: rise var(--t) var(--ease); }
.ip-pick h2 { margin: 0; font-size: var(--t4); font-weight: 700; }
.ip-langs { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 6px; }
.ip-langs legend { padding: 0 0 6px; font-size: var(--t2); font-weight: 600; color: var(--muted); }
.ip-lang { display: grid; grid-template-columns: 24px 72px 1fr; align-items: center; gap: 10px; min-height: 52px; padding: 0 12px; border-radius: var(--r1); background: var(--surface-2); cursor: pointer; }
.ip-lang:has(input:checked) { box-shadow: inset 0 0 0 2px var(--accent); }
.ip-lang.dis { cursor: default; opacity: .55; }
.ip-lang input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.ip-ln { font-size: var(--t4); font-weight: 700; }
.ip-ld { font-size: var(--t2); color: var(--fg-2); }
.ip-auto { margin: 0; width: 100%; padding: 0 4px; }
.ip-auto small { display: block; font-size: var(--t1); color: var(--muted); font-weight: 500; }
.ip-auto input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.ip-pick .ip-acts .ip-act { flex: 1; min-height: 52px; font-size: var(--t3); }
@media (min-width: 680px) and (min-aspect-ratio: 4/5) { .ip-pick { top: 50%; bottom: auto; transform: translateY(-50%); animation-name: fade; } }
.ip-banner:focus { outline: none; }
.ip-banner:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.ip-banner.busy .ip-bsub { color: var(--fg); }
@media (max-height: 520px) { .ip-bsub { display: none; } }

/* ---- [calm 20261024] CEO: the reactive face and the hologram felt eerie and too much. Quieter overrides:
   - breathing moves the whole pane (so the blink overlay rides with it): ~0.4% swell, 7.2 s, no gaze shift
   - expression change: the new face fades in over 0.5 s on top; the old one stays opaque until it is covered (no ghost)
   - blink overlay (.lid): only the eye band, opacity driven by app.js (calm blink block)
   - the water line follows the voice smoothly (no jitter) and a little dimmer; thinking tide slowed */
:root { --gaze: 0; }
.face .pane { transform: none; transform-origin: 50% 78%; transition: none; animation: breath-calm var(--breath) var(--ease-soft) infinite; }
.face img { animation: none; transform: scale(1.006); transition: opacity .5s var(--ease-soft), filter var(--t-slow) var(--ease); }
.face img.hide { opacity: 0; transition: opacity 0s .55s, filter var(--t-slow) var(--ease); }
.face img.lid { z-index: 3; opacity: 0; transition: filter var(--t-slow) var(--ease); pointer-events: none; }
body.calm .face .pane, body[data-state=connecting] .face .pane { animation-play-state: paused; }
.face .ring::before { transition: opacity var(--t-slow) var(--ease), transform .18s linear; }
body:is([data-state=listening], [data-state=speaking]) .face .ring::before { opacity: .75; }
body[data-state=thinking] .face .ring::before { animation-duration: 4s; opacity: .6; }
body.no-vu[data-state=speaking] .face .ring::before { animation-duration: 3.2s; }
.state::before { transition: background-color var(--t) var(--ease), transform .18s linear; }
@keyframes breath-calm { 0%, 100% { transform: scale(1); } 45% { transform: scale(1.004) translate3d(0, -.15%, 0); } }
@media (prefers-reduced-motion: reduce) { .face .pane { animation: none !important; transform: none !important; } .face img.lid { display: none; } }

/* ---- [mood 20261024] mood clips: one slow, tiny camera move per expression still, picked by app.js (data-mood on the
   <img>) from the sentence's emotion tag or the state. No lip-sync, no face video. Each move starts from the resting
   framing (scale 1.006) and stays within ~0.6%, so a 0.5 s crossfade between two stills never shows a double image. */
.face img[data-mood=warm] { animation: mood-in 9s var(--ease-soft) both; }
.face img[data-mood=bright] { animation: mood-in-short 6s var(--ease-soft) both; }
.face img[data-mood=laugh] { animation: mood-lift 3.2s var(--ease-soft) both; }
.face img[data-mood=concern] { animation: mood-settle 10s var(--ease-soft) both; }
.face img[data-mood=think] { animation: mood-drift 12s var(--ease-soft) infinite alternate both; }
.face img.lid { animation: none !important; }
body.calm .face img, body.lowpow .face img { animation-play-state: paused; }
body.lowpow .face .pane { animation: none; }
@keyframes mood-in { from { transform: scale(1.006); } to { transform: scale(1.012) translate3d(0, -.2%, 0); } }
@keyframes mood-in-short { from { transform: scale(1.006); } to { transform: scale(1.01) translate3d(0, -.1%, 0); } }
@keyframes mood-lift { 0%, 100% { transform: scale(1.006); } 30% { transform: scale(1.01) translate3d(0, -.3%, 0); } }
@keyframes mood-settle { from { transform: scale(1.006); } to { transform: scale(1.01) translate3d(0, .15%, 0); } }
@keyframes mood-drift { from { transform: scale(1.006); } to { transform: scale(1.009) translate3d(-.3%, 0, 0); } }

/* ---- [lava 20261024] background: metaball canvas (app.js lava block) over a very dim ambient mood clip while Air
   speaks/thinks (Seedance text-to-video, no person; dark theme only). The clip only tints the room: low opacity, desaturated. */
.holo .amb { position: absolute; inset: 0; overflow: hidden; }
.holo .amb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; filter: saturate(.7) brightness(.9); transition: opacity .6s var(--ease-soft); }
.holo .amb video.on { opacity: .3; }
.holo canvas { position: absolute; inset: 0; }
@media (prefers-reduced-motion: reduce) { .holo .amb { display: none; } }

/* ---- [l2d 20261025] Live2D mode (/?mode=live2d): the model replaces the portrait; status floats over it */
body.l2d .face { display: none; }
body.l2d .stage { position: relative; padding: 0; }
.l2d-stage { position: absolute; inset: 0; z-index: 0; opacity: 0; transition: opacity .6s var(--ease-soft); }
body.l2d-ready .l2d-stage { opacity: 1; }
.l2d-stage canvas { display: block; width: 100%; height: 100%; touch-action: none; }
body.l2d-shadow .l2d-stage canvas { filter: drop-shadow(0 10px 14px rgb(0 0 0 / .42)) drop-shadow(0 2px 3px rgb(0 0 0 / .3)); } /* pinch/drag are ours, not page zoom/scroll */
/* speech bubble: placed beside the head by live2d.js (--bx/--by), hidden when there is nothing to say */
body.l2d .status { position: absolute; left: 0; top: 0; transform: translate(var(--bx, 16px), var(--by, 8px)); z-index: 2; flex: none; height: auto; width: max-content; max-width: var(--bw, 280px); max-height: 40%;
  margin: 0; padding: 8px 12px; gap: 4px; container-type: normal; border-radius: 16px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); box-shadow: var(--e1);
  transition: opacity .3s var(--ease), transform .25s var(--ease-soft); }
body.l2d .status .state { display: none; }
body.l2d .status .caption { font-size: var(--t3); -webkit-line-clamp: 5; }
body.l2d .status .heard { font-size: 12px; }
body.l2d .status[data-side=r] { border-top-left-radius: 4px; }
body.l2d .status[data-side=l] { border-top-right-radius: 4px; }
body.l2d.l2d-quiet .status { opacity: 0; pointer-events: none; }
/* the character mode keeps the single-column layout at any width (the wide grid splits face/status) */
@media (min-width: 680px) and (min-aspect-ratio: 4/5) {
  body.l2d { display: flex; flex-direction: column; }
  body.l2d .stage { display: flex; }
  body.l2d .dock { padding: 12px 16px calc(8px + var(--sab)); align-items: center; }
}
/* character mode chrome: header + bottom controls give way to a glass icon bar and name tag beside the head (live2d.js);
   the page background is fully transparent on the desktop app and the glass shows only on hover */
html:has(body.l2d-desk:not(.l2d-solid)), body.l2d-desk:not(.l2d-solid) { background: transparent !important; }
body.l2d { --glass: rgb(255 255 255 / .12); --glass-hi: rgb(255 255 255 / .35); --glass-line: rgb(255 255 255 / .22); --glass-fg: rgb(255 255 255 / .95);
  --glass-shadow: 0 8px 24px rgb(0 0 0 / .18); --glass-blur: blur(18px) saturate(140%); }
@media (prefers-color-scheme: light) { body.l2d { --glass: rgb(16 28 64 / .18); --glass-hi: rgb(255 255 255 / .5); --glass-line: rgb(255 255 255 / .35); } }
body.l2d .top { display: none; }
body.l2d .dock { position: absolute; left: 0; right: 0; bottom: 0; z-index: 11; background: transparent; border: 0; box-shadow: none; padding: 0 16px calc(12px + var(--sab)); pointer-events: none; }
body.l2d .dock > * { pointer-events: auto; width: min(100%, 420px); }
/* text input floats over the stage as glass (the character keeps the full height) */
body.l2d .say { padding: 5px; border-radius: 18px; }
body.l2d .say input { height: 42px; border: 0; border-radius: 14px; background: rgb(255 255 255 / .1); color: var(--glass-fg); text-shadow: 0 1px 2px rgb(0 0 0 / .35); }
body.l2d .say input::placeholder { color: rgb(255 255 255 / .7); }
body.l2d .say input:focus { outline: 1px solid rgb(255 255 255 / .45); }
body.l2d .say .send { width: 42px; height: 42px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 60%, transparent); }
/* chat bubbles beside the face (live2d.js .l2d-chat): bottom-anchored column, new lines push older ones up */
body.l2d .status { display: none; }
.l2d-chat { position: fixed; left: 0; top: 0; z-index: 10; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; overflow-x: hidden; pointer-events: auto;
  overscroll-behavior: contain; touch-action: pan-y; scrollbar-width: none; padding-top: 24px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 28px); mask-image: linear-gradient(to bottom, transparent 0, #000 28px); transition: opacity .4s var(--ease); --cb-fs: 14px; }
body:not(.l2d-ready) .l2d-chat, body.l2d-quiet .l2d-chat { opacity: 0; }
.l2d-chat::-webkit-scrollbar { display: none; }
.l2d-chat::before { content: ''; flex: 1 1 auto; } /* bottom-anchored while it fits, scrollable when it does not */
.l2d-chat:hover .cb.old, .l2d-chat:focus-within .cb.old { opacity: .6; }
body.l2d-quiet .l2d-chat { pointer-events: none; }
.l2d-chat .cb { flex: none; max-width: 92%; padding: 7px 11px; border-radius: 14px; font-size: var(--cb-fs); line-height: 1.45; word-break: keep-all; overflow-wrap: anywhere;
  transition: opacity .8s var(--ease); animation: cb-in .25s var(--ease) both; }
.l2d-chat .cb[hidden] { display: none; }
.l2d-chat .cb.old { opacity: 0; }
.l2d-chat .cb.user { background: color-mix(in srgb, var(--accent) 38%, transparent); }
.l2d-chat .cb.user.live { opacity: .8; }
.l2d-chat[data-side=r] .cb.air { align-self: flex-start; border-top-left-radius: 4px; }
.l2d-chat[data-side=r] .cb.user { align-self: flex-end; border-top-right-radius: 4px; }
.l2d-chat[data-side=l] .cb.air { align-self: flex-end; border-top-right-radius: 4px; }
.l2d-chat[data-side=l] .cb.user { align-self: flex-start; border-top-left-radius: 4px; }
@keyframes cb-in { from { opacity: 0; transform: translateY(8px); } }
body.l2d[data-bubble=s] .l2d-chat { --cb-fs: 12.5px; }
body.l2d[data-bubble=l] .l2d-chat { --cb-fs: 17px; }
body.l2d .dock .controls, body.l2d .metric { display: none; }
.l2d-glass { background: var(--glass); border: 1px solid var(--glass-line); border-top-color: var(--glass-hi); box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); color: var(--glass-fg); text-shadow: 0 1px 2px rgb(0 0 0 / .35); }
body.l2d .status, body.l2d .say, body.l2d .activity, body.l2d .menu, body.l2d .sheet { background: var(--glass); border: 1px solid var(--glass-line); border-top-color: var(--glass-hi);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
body.l2d .status .caption { color: var(--glass-fg); text-shadow: 0 1px 2px rgb(0 0 0 / .35); }
body.l2d .status .heard { color: rgb(255 255 255 / .75); }
.l2d-bar, .l2d-name, .l2d-more { display: none; }
body.l2d-ready .l2d-bar, body.l2d-ready .l2d-name { display: flex; position: fixed; left: 0; top: 0; z-index: 12; opacity: 0; pointer-events: none; transition: opacity .35s var(--ease); }
body.l2d-ready.l2d-hover .l2d-bar, body.l2d-ready.l2d-hover .l2d-name { opacity: 1; pointer-events: auto; transition-duration: .15s; }
body.l2d-edit .l2d-bar, body.l2d-edit .l2d-name, body.l2d-edit .l2d-more { opacity: 0 !important; pointer-events: none !important; }
.l2d-bar { flex-direction: column; gap: 6px; padding: 5px; border-radius: 24px; }
.l2d-bar.row { flex-direction: row; }
.l2d-bar button { width: 36px; height: 36px; border: 0; border-radius: 50%; display: grid; place-items: center; background: transparent; color: inherit; cursor: pointer; position: relative; }
.l2d-bar button .ico { width: 20px; height: 20px; filter: drop-shadow(0 1px 1px rgb(0 0 0 / .35)); }
@media (hover: hover) { .l2d-bar button:hover { background: rgb(255 255 255 / .16); } }
.l2d-bar button[data-a=mic].on { background: color-mix(in srgb, var(--accent) 55%, transparent); }
.l2d-bar button[data-a=voice].off { opacity: .6; }
.l2d-bar button[data-a=mic]::after { content: ''; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid transparent; pointer-events: none; }
body[data-state=listening] .l2d-bar button[data-a=mic].on::after { border-color: color-mix(in srgb, var(--accent) 70%, transparent); animation: l2d-pulse 1.8s ease-in-out infinite; }
body[data-state=thinking] .l2d-bar button[data-a=mic]::after { border-color: rgb(255 255 255 / .6) transparent transparent transparent; animation: l2d-spin 1s linear infinite; }
@keyframes l2d-pulse { 50% { transform: scale(1.12); opacity: .4; } }
@keyframes l2d-spin { to { transform: rotate(1turn); } }
.l2d-name { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; }
body.l2d-desk .l2d-name { -webkit-app-region: drag; cursor: move; } /* desktop: drag the window by the name tag */
.l2d-more:not([hidden]) { display: flex; flex-direction: column; position: fixed; left: 0; top: 0; z-index: 13; padding: 4px; border-radius: 14px; min-width: 132px; }
.l2d-more button { border: 0; background: transparent; color: inherit; text-align: left; padding: 8px 12px; border-radius: 10px; font-size: 13px; cursor: pointer; }
@media (hover: hover) { .l2d-more button:hover { background: rgb(255 255 255 / .16); } }
/* stage edit (desktop): dashed frame; the border band drags the window, the corner grip resizes it */
.l2d-frame { display: none; }
body.l2d-edit .l2d-frame { display: block; position: fixed; inset: 0; z-index: 30; pointer-events: none; border: 2px dashed color-mix(in srgb, var(--accent) 80%, transparent); border-radius: 10px; }
.l2d-band { position: absolute; inset: 0; border: 14px solid color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 8px; pointer-events: auto; -webkit-app-region: drag; cursor: move;
  -webkit-mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); }
.l2d-hint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center; width: max-content; max-width: calc(100% - 44px);
  padding: 6px 8px 6px 12px; border-radius: var(--r1); background: color-mix(in srgb, var(--bg) 88%, transparent); font-size: 12px; color: var(--muted); pointer-events: auto; -webkit-app-region: no-drag; }
.l2d-hint button { border: 0; border-radius: 8px; padding: 4px 10px; background: var(--surface-2); color: var(--fg); cursor: pointer; font-size: 12px; }
.l2d-hint button[data-a=done] { background: var(--accent); color: var(--on-accent); }
.l2d-grip { position: absolute; right: 2px; bottom: 2px; width: 22px; height: 22px; pointer-events: auto; -webkit-app-region: no-drag; cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 50%, var(--accent) 50% 60%, transparent 60% 72%, var(--accent) 72% 82%, transparent 82%); }
body.l2d-edit .l2d-stage { outline: none; }
/* desktop app, transparent window: backdrop-filter cannot blur the desktop behind the window, so glass is tinted dark
   enough to read on any wallpaper, and text panels (settings, log, tasks) are solid */
body.l2d-desk:not(.l2d-solid) { --glass: rgb(14 20 38 / .74); --glass-hi: rgb(255 255 255 / .22); --glass-line: rgb(255 255 255 / .14); }
body.l2d-desk:not(.l2d-solid) :is(.menu, .sheet, .activity) { background: color-mix(in srgb, var(--surface) 96%, transparent); color: var(--fg); text-shadow: none; }
body.l2d-desk:not(.l2d-solid) .l2d-chat .cb.user { background: color-mix(in srgb, var(--accent) 70%, rgb(14 20 38)); }
/* Live2D loading card */
.l2d-loading { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); z-index: 5; display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center;
  width: min(260px, calc(100% - 48px)); padding: 14px 16px; border-radius: 18px; font-size: 13px; transition: opacity .5s var(--ease); background: rgb(12 20 38 / .72); }
.l2d-loading b { grid-column: 1 / -1; font-size: 15px; letter-spacing: .04em; }
.l2d-loading .bar { grid-column: 1; height: 4px; border-radius: 2px; background: rgb(255 255 255 / .18); overflow: hidden; }
.l2d-loading .bar i { display: block; height: 100%; width: 30%; border-radius: inherit; background: var(--accent); transition: width .2s linear; }
.l2d-loading .bar i:not([style*=width]), .l2d-loading .bar i[style=""] { animation: l2d-indet 1.2s ease-in-out infinite; }
.l2d-loading .p { grid-column: 2; font-variant-numeric: tabular-nums; opacity: .8; }
.l2d-loading .t { grid-column: 1 / -1; opacity: .85; }
.l2d-loading.err .bar { display: none; }
.l2d-loading.out { opacity: 0; }
@keyframes l2d-indet { from { transform: translateX(-110%); } to { transform: translateX(340%); } }
/* character screen: drags and pinches belong to the stage (no page scroll / overscroll refresh / browser zoom);
   panels keep normal scrolling */
html:has(body.l2d), body.l2d { overscroll-behavior: none; }
body.l2d .stage, body.l2d .l2d-bar, body.l2d .l2d-name, body.l2d .l2d-loading { touch-action: none; }
/* [files 20261025] drag & drop a file onto the page -> the work session (public/drop.js) */
.drop-hint { position: fixed; left: 50%; bottom: calc(24px + var(--sab)); transform: translateX(-50%); z-index: 40; display: grid; gap: 2px; justify-items: center;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 16px; background: color-mix(in srgb, var(--surface) 96%, transparent); color: var(--fg);
  border: 1px dashed color-mix(in srgb, var(--accent) 70%, transparent); box-shadow: 0 8px 24px rgb(0 0 0 / .25); pointer-events: none; text-align: center; }
.drop-hint[hidden] { display: none; }
.drop-hint b { font-size: 15px; }
.drop-hint span { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.drop-hint.sending { border-style: solid; }
/* [comp 20261026] companion (public/companion.js): chips beside EPOCH (work / focus / result balloon), "zz" while she
   dozes, settings rows (함께), memory panel. Chips are glass in character mode (live2d.js places them beside her) and
   solid under the header on the portrait page; text panels are opaque everywhere (readable on any wallpaper). */
.comp-chips { position: fixed; left: 0; top: 0; z-index: 8; display: none; flex-direction: column; align-items: flex-start; gap: 6px; max-width: min(280px, calc(100vw - 24px)); pointer-events: none; }
body.comp-chips-on .comp-chips { display: flex; }
body.l2d:not(.l2d-ready) .comp-chips { display: none; }
.comp-chips > * { pointer-events: auto; max-width: 100%; }
.comp-chips[data-side=l] { align-items: flex-end; }
.comp-chip { display: flex; align-items: center; gap: 2px; min-height: 30px; padding: 0 4px 0 10px; border-radius: 999px; font-size: 12.5px; line-height: 1.2; white-space: nowrap;
  background: var(--surface); color: var(--fg); border: 1px solid var(--line-soft); box-shadow: var(--e1); animation: cb-in .25s var(--ease) both; }
.comp-chip[hidden], .comp-res[hidden] { display: none; }
.comp-chip button { border: 0; background: transparent; color: inherit; cursor: pointer; font: inherit; }
.comp-chip .m { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 6px 2px 6px 0; }
.comp-chip .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.comp-chip .x { flex: none; width: 24px; height: 24px; border-radius: 50%; font-size: 15px; line-height: 1; opacity: .7; }
@media (hover: hover) { .comp-chip .x:hover { opacity: 1; background: rgb(127 127 127 / .2); } }
.comp-chip.focus { gap: 6px; }
.comp-chip.focus .t::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--ok); vertical-align: 1px; }
.comp-chip.focus .tm { font-variant-numeric: tabular-nums; font-weight: 650; }
.comp-res { display: grid; gap: 3px; width: max-content; max-width: 100%; padding: 8px 12px; border-radius: 14px; text-align: left; cursor: pointer; font: inherit; font-size: 13px; line-height: 1.4;
  background: var(--surface); color: var(--fg); border: 1px solid var(--line-soft); box-shadow: var(--e2); animation: cb-in .25s var(--ease) both; }
.comp-res .hd { display: flex; align-items: center; gap: 6px; min-width: 0; }
.comp-res .hd b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.comp-res .ic { flex: none; width: 16px; height: 16px; display: grid; place-items: center; border-radius: 50%; font-size: 10px; font-weight: 800; background: var(--ok); color: var(--bg); }
.comp-res.fail .ic { background: var(--err); }
.comp-res .st { flex: none; font-size: 11.5px; color: var(--muted); }
.comp-res .sm { color: var(--fg-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.comp-res::after { content: '눌러서 자세히'; font-size: 11px; color: var(--muted); }
/* character mode: glass like the bubbles (the PC app's transparent window tints it dark, see --glass there) */
body.l2d .comp-chip, body.l2d .comp-res { background: var(--glass); color: var(--glass-fg); border-color: var(--glass-line); border-top-color: var(--glass-hi); box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); text-shadow: 0 1px 2px rgb(0 0 0 / .35); }
body.l2d .comp-res .sm, body.l2d .comp-res .st, body.l2d .comp-res::after { color: rgb(255 255 255 / .78); }
body.l2d.comp-busy .activity { display: none; } /* the 작업 중 chip beside her replaces the bottom bar (same click / cancel) */
/* portrait page: chips centred under the header; the existing activity bar already shows the work */
body:not(.l2d) .comp-chips { left: 50%; top: calc(var(--sat) + var(--toph) + 4px); transform: translateX(-50%); align-items: center; }
body:not(.l2d) .comp-chip.busy { display: none; }
/* doze: a small "z z" near her head (live2d.js places it), floating slowly */
.comp-zz { position: fixed; left: 0; top: 0; z-index: 11; pointer-events: none; opacity: 0; transition: opacity 1.2s var(--ease); font: italic 700 15px/1 var(--font); letter-spacing: .2em; color: #fff;
  text-shadow: 0 1px 3px rgb(0 0 0 / .55), 0 0 10px color-mix(in srgb, var(--accent) 60%, transparent); }
body.l2d-ready.comp-doze .comp-zz { opacity: .9; }
@media (prefers-reduced-motion: no-preference) { body.comp-doze .comp-zz { animation: comp-zz 3.2s ease-in-out infinite; } }
@keyframes comp-zz { 0%, 100% { translate: 0 0; opacity: .5; } 50% { translate: 4px -8px; opacity: 1; } }
/* settings rows (함께) */
.row .k small { font-size: var(--t1); color: var(--muted); font-weight: 500; }
.row.seg { cursor: default; }
.row.seg .segs { display: flex; flex: none; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-2); }
.row.seg .segs button { min-width: 48px; height: 34px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--fg-2); font: inherit; font-size: var(--t2); font-weight: 600; cursor: pointer; }
.row.seg .segs button[aria-pressed=true] { background: var(--surface); color: var(--fg); box-shadow: var(--e1); }
body.l2d .row.seg .segs { background: rgb(127 127 127 / .2); }
/* memory panel: an opaque sheet (bottom sheet on phones, centred card on wide screens) */
.comp-scrim { position: fixed; inset: 0; z-index: 19; background: rgb(4 8 20 / .45); }
.comp-scrim[hidden], .comp-mem[hidden] { display: none; }
.comp-mem { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; flex-direction: column; max-height: min(86dvh, 760px); padding: 0 16px calc(12px + var(--sab));
  background: var(--surface); color: var(--fg); text-shadow: none; border-radius: var(--r2) var(--r2) 0 0; box-shadow: var(--e2); animation: pop var(--t) var(--ease); font-size: var(--t2); }
@media (min-width: 640px) { .comp-mem { left: 50%; right: auto; bottom: auto; top: 50%; width: min(560px, calc(100vw - 32px)); max-height: min(80dvh, 720px); transform: translate(-50%, -50%); border-radius: var(--r2); padding-bottom: 16px; animation-name: fade; } }
.comp-mem .mem-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 56px; }
.comp-mem .mem-head b { font-size: var(--t3); font-weight: 650; }
.comp-mem .mem-note { flex: none; margin: 0 0 8px; color: var(--muted); font-size: var(--t1); line-height: 1.5; }
.comp-mem .mem-msg:empty { display: none; }
.comp-mem .mem-msg { flex: none; margin: 0 0 8px; padding: 8px 12px; border-radius: var(--r1); background: var(--surface-2); color: var(--fg-2); font-size: var(--t1); }
.comp-mem .mem-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -4px; padding: 0 4px 4px; }
.comp-mem h3 { display: flex; align-items: center; gap: 6px; margin: 14px 0 6px; font-size: var(--t2); font-weight: 650; color: var(--fg-2); }
.comp-mem h3 .n, .comp-mem summary { font-size: var(--t1); color: var(--muted); font-weight: 600; }
.comp-mem summary { margin: 14px 0 6px; cursor: pointer; }
.comp-mem ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.comp-mem li { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 10px; padding: 10px 12px; border-radius: var(--r1); background: var(--bg); }
.comp-mem li .t { grid-column: 1; margin: 0; line-height: 1.5; overflow-wrap: anywhere; word-break: keep-all; }
.comp-mem li .src { grid-column: 1; grid-row: 2; font-size: 11px; color: var(--muted); }
.comp-mem li .ops { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 4px; }
.comp-mem li.editing { grid-template-columns: 1fr; }
.comp-mem li.editing .ops { grid-column: 1; grid-row: auto; justify-content: flex-end; }
.comp-mem textarea { width: 100%; box-sizing: border-box; resize: vertical; min-height: 64px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--fg); font: inherit; line-height: 1.5; }
.comp-mem .ops button { height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: var(--surface-2); color: var(--fg); font: inherit; font-size: var(--t1); font-weight: 600; cursor: pointer; white-space: nowrap; }
.comp-mem .ops button.pri { background: var(--accent); color: var(--on-accent); }
.comp-mem .ops button.warn { color: var(--err); }
.comp-mem .props li { background: color-mix(in srgb, var(--accent) 10%, var(--bg)); }
.comp-mem .gone li .t { color: var(--muted); }
.comp-mem .mem-empty { margin: 0; padding: 8px 2px; color: var(--muted); font-size: var(--t1); }
@media (max-width: 380px) { .comp-mem li { grid-template-columns: 1fr; } .comp-mem li .ops { grid-column: 1; grid-row: auto; justify-content: flex-end; } }
