/* Quiet Chinese companion system. Layout transitions never recreate media. */
:root{--paper:#faf8f5;--surface:#fffefa;--ink:#292827;--muted:#77716c;--accent:#805966;--tint:#eee5e6;--line:#e6e0da;--danger:#ad3e47;--radius:18px;color-scheme:light}
body.companion-theme{background:var(--paper);color:var(--ink);font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",system-ui,sans-serif;font-size:16px}
.companion-theme *, .companion-theme *::before,.companion-theme *::after{box-sizing:border-box}
.companion-theme button{background:var(--accent);color:white;border-radius:14px;min-height:44px;transition:background-color .14s,transform .12s,box-shadow .14s}
.companion-theme button:not(:disabled):active{transform:scale(.97);filter:brightness(.94)}
.companion-theme button.secondary,.companion-theme .secondary{background:#f0ebe7;color:var(--ink)}
.companion-theme button:focus-visible,.companion-theme a:focus-visible,.companion-theme summary:focus-visible{outline:3px solid var(--accent);outline-offset:3px}
.companion-theme input,.companion-theme textarea,.companion-theme select{border:1px solid var(--line);background:var(--surface);color:var(--ink);border-radius:12px;font-size:16px}
.companion-theme input:focus,.companion-theme textarea:focus,.companion-theme select:focus{outline:2px solid #80596680;outline-offset:1px}
.companion-theme a,.companion-theme #sharing a{color:var(--accent)}
.companion-theme .hint,.companion-theme small,.companion-theme .eyebrow{color:var(--muted)}
.companion-theme>header{background:var(--paper);border-bottom:1px solid var(--line)}
.companion-theme .modern{max-width:1300px}
.companion-theme .modern .chat-panel,.companion-theme .modern .chat-heading,.companion-theme .modern .chat-composer{background:var(--paper)}
.companion-theme .modern .chat-heading{gap:8px;padding:10px 0 18px;border-bottom:1px solid var(--line)}
.companion-theme .modern .chat-heading h2{text-align:left;font-size:20px;line-height:1.35;letter-spacing:.2px}
.companion-theme .modern .chat-heading h2 small{display:block;font-size:12px;font-weight:400;margin-top:3px}
.companion-theme .modern .chat-heading button{font-size:13px;min-width:44px;padding:8px 11px;background:transparent;color:var(--ink)}
.companion-theme .modern .chat-heading button:hover{background:#f0ebe7}
.companion-theme .modern .messages{height:calc(100dvh - 260px);padding-top:20px;scroll-behavior:smooth}
.companion-theme .modern .message{background:#f0ede9;border:0;box-shadow:none;border-radius:19px;line-height:1.85;font-size:17px;max-width:86%;padding:14px 17px;margin:14px 0}
.companion-theme .modern .message.user{background:var(--tint);margin-left:auto}
.companion-theme .modern .message.assistant{margin-right:auto}
.companion-theme .modern .message button{background:#e9e0df;color:#684753;min-height:40px;font-size:13px}
.companion-theme .modern .message small{font-size:12px;margin-bottom:6px}
.companion-theme .modern .chat-composer{padding:12px 0 max(12px,env(safe-area-inset-bottom));border-color:var(--line);align-items:end}
.companion-theme .modern .chat-composer textarea{background:var(--surface);border-color:var(--line);border-radius:20px}
.companion-theme .modern .composer-mic,.companion-theme .modern .composer-plus{background:transparent;color:var(--accent)}
.companion-theme .modern .chat-composer .send-message{background:var(--accent);border-radius:16px}
.companion-theme .modern .extras-panel{background:#f0ebe7;border-radius:20px;padding:16px;gap:12px}
.companion-theme .extras-panel button{background:var(--surface);color:var(--accent);min-height:84px;border-radius:16px}
.companion-theme .modern .chat-composer>.hold-to-talk{border-color:var(--line);background:var(--surface);color:var(--ink)}
.companion-theme .persona-home h1{font-size:30px;font-weight:600;letter-spacing:0}
.companion-theme .persona-grid{gap:20px;margin-top:30px}
.companion-theme .persona-card{background:var(--surface);border:1px solid var(--line);box-shadow:none;border-radius:20px;color:var(--ink);padding:24px;min-height:220px}
.companion-theme .persona-card:hover{border-color:#c3abae;box-shadow:0 8px 25px #51443708}
.companion-theme .persona-card>span:last-child{color:var(--accent)}
.companion-theme .avatar{background:#e9e2dc;color:#6c5856;box-shadow:none;border-radius:50%}
.companion-theme .modern[data-screen=chat]>.desktop-personas{background:transparent;border-right:1px solid var(--line);border-radius:0;padding-right:18px}
.companion-theme .desktop-personas button{color:var(--ink);background:transparent}
.companion-theme .desktop-personas button.selected{background:var(--tint);color:#684753}
.companion-theme .modern .settings-drawer{background:var(--surface);box-shadow:-12px 0 65px #29282725;padding:20px;max-width:100vw}
.companion-theme .drawer-title{background:var(--surface);top:-20px;padding:10px 0}
.companion-theme .drawer-title h2{font-size:22px}
.companion-settings-nav{display:flex;gap:5px;position:sticky;top:57px;background:var(--surface);z-index:3;padding:10px 0 16px;border-bottom:1px solid var(--line);margin-bottom:14px;overflow-x:auto}
.companion-settings-nav button{flex:1;padding:7px 9px;min-height:44px;background:transparent!important;color:var(--muted)!important}
.companion-settings-nav button[aria-pressed=true]{color:var(--accent)!important;background:var(--tint)!important;font-weight:600}
.companion-theme .settings-drawer section{border:0;box-shadow:none;padding:12px 0;background:transparent;border-radius:0}
.companion-theme .settings-drawer .workspace-tools-body{padding:0}
.companion-theme .settings-drawer .workspace-tools{border:0;background:transparent}
.companion-theme .settings-drawer .voice-recorder,.companion-theme .settings-drawer .voice-reading,.companion-theme .notice{background:#f3eeea;border-color:var(--line);color:var(--ink)}
.companion-theme .settings-drawer .memory-entry>button{background:#f0ebe7;color:var(--ink)}
.companion-theme .settings-drawer .interview-entry{padding:12px 0}
.companion-settings-footer{display:flex;gap:12px;flex-wrap:wrap;border-top:1px solid var(--line);padding:20px 0;margin-top:14px}
.companion-settings-footer button:last-child,.companion-person-wrap>button{color:var(--danger)!important}
.companion-person-wrap{display:flex;flex-direction:column;gap:8px;min-width:0}
.companion-person-wrap>.persona-card{width:100%;flex:1}
#companion-dialog{width:min(540px,calc(100vw - 24px));max-height:85dvh;overflow:auto;border:1px solid var(--line);border-radius:24px;background:var(--surface);color:var(--ink);padding:24px;font:16px/1.75 -apple-system,BlinkMacSystemFont,"Microsoft YaHei",sans-serif;box-shadow:0 20px 80px #29282720}
#companion-dialog::backdrop{background:#29282765;backdrop-filter:blur(3px)}
.companion-dialog-head{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:18px}
.companion-dialog-head h2{margin:0;font-size:23px}
.companion-history-row{display:flex;align-items:center;justify-content:space-between;gap:12px;border-bottom:1px solid var(--line);padding:14px 0}
.companion-history-row>button:first-child{flex:1;white-space:normal;text-align:left;background:transparent}
.companion-history-row small{display:block;font-size:12px}
.companion-history-row>button:last-child{flex-shrink:0;background:transparent;color:var(--danger)}
.companion-theme button.danger{background:var(--danger);color:white}
.companion-theme .call-screen,.companion-theme .speech-sheet{background:var(--paper)!important;color:var(--ink);box-shadow:0 15px 80px #29282720}
.companion-theme .call-person p{color:var(--muted)}
#companion-wave{display:block;width:min(320px,100%);height:52px;flex:none;margin:15px auto}
.companion-theme .call-controls button,.companion-theme .call-inline-actions button{background:#eee7e2;color:var(--ink)}
.companion-theme .call-controls .hangup,.companion-theme .call-inline-actions .hangup{background:#f6e4e3;color:var(--danger)}
.companion-theme .call-mini{background:var(--surface);border-color:var(--line)}
.companion-theme .speech-feedback{background:#f0ebe7;color:var(--ink);border-color:var(--line)}
.companion-theme #memory-page,.companion-theme .memory-page-heading,.companion-theme .memory-filters{background:var(--paper);color:var(--ink)}
.companion-theme .memory-list-row,.companion-theme .memory-category{border-color:var(--line);background:var(--surface);color:var(--ink)}
/* The video stage retains its original identity and sizing/state machine. */
body.video-conversation.companion-theme{background:var(--paper)}
.companion-theme.video-conversation header{background:var(--paper);border-color:var(--line)}
.companion-theme.video-conversation #layout-toggle,.companion-theme.video-conversation #history-toggle,.companion-theme.video-conversation #keyboard-toggle,.companion-theme.video-conversation #transcript-toggle{background:#eee7e2;color:var(--ink)}
.companion-theme.video-conversation #status{color:var(--muted)}
.companion-theme.video-conversation .stage #status{background:#242020b8;color:white}
.companion-theme.video-conversation #transcript p{background:var(--surface);color:var(--ink);border:0;font-size:17px;line-height:1.8}
.companion-theme.video-conversation .controls{border-color:var(--line);background:var(--paper)}
.companion-theme.video-conversation #mic{background:var(--accent);color:white}
.companion-theme.video-conversation #interrupt{background:#eee7e2;color:var(--ink)}
.companion-theme.video-conversation #hangup{background:var(--danger);color:white}
.companion-theme.video-conversation #text-form,.companion-theme.video-conversation #video-history-panel{background:var(--paper);border-color:var(--line)}
.companion-theme #video-progress-bar{background:var(--accent)}
@keyframes companion-enter{from{opacity:0;transform:translateY(7px)}to{opacity:1;transform:translateY(0)}}
.companion-theme .persona-home,.companion-theme .settings-drawer:not([hidden]),#companion-dialog[open],.companion-theme .extras-panel:not([hidden]){animation:companion-enter .26s ease-out both}
@media(max-width:760px){
 .companion-theme .modern{padding:8px 14px 0}.companion-theme>header{padding:10px 16px}
 .companion-theme .modern .chat-panel{padding:0}.companion-theme .modern .chat-heading{gap:3px}
 .companion-theme .modern .chat-heading h2{font-size:18px}.companion-theme .modern .chat-heading button{padding:8px;min-width:40px;font-size:13px}
 .companion-theme .modern .messages{height:calc(100dvh - 250px);min-height:150px}
 .companion-theme .modern .message{font-size:17px;padding:12px 15px;max-width:91%;line-height:1.8}
 .companion-theme .persona-grid{gap:12px}.companion-theme .persona-card{padding:18px;min-height:195px}
 .companion-theme .persona-home>.row{flex-wrap:wrap;gap:8px}.companion-theme .persona-home>.row>div{flex:1;min-width:150px}
 .companion-theme .modern .settings-drawer{width:100vw;padding:18px}.companion-theme .drawer-title{top:-18px}
 .companion-theme .voice-call-inline .modern .messages{height:calc(100dvh - 250px)}
 .companion-theme .companion-voice-surface.call-inline{position:fixed;inset:0;z-index:42;display:flex;flex-direction:column;align-items:center;gap:18px;background:var(--paper);padding:24px max(24px,env(safe-area-inset-left)) max(28px,env(safe-area-inset-bottom));margin:0;border-radius:0}
 .companion-voice-surface.call-inline>.secondary{align-self:flex-end}
 .companion-voice-surface.call-inline>.avatar{width:94px;height:94px;font-size:38px;margin-top:7dvh;flex-shrink:0}
 .companion-voice-surface.call-inline .call-inline-person{width:100%;text-align:center;flex:1;padding-top:12px}
 .companion-voice-surface.call-inline .call-inline-person strong{font-size:27px}.companion-voice-surface.call-inline .call-inline-person p{font-size:19px;margin:24px 0}
 .companion-voice-surface.call-inline #call-transcript{max-height:20dvh;min-height:44px;font-size:17px;line-height:1.8}
 .companion-voice-surface.call-inline .call-inline-actions{width:100%;display:flex;justify-content:space-around;gap:12px}
 .companion-voice-surface.call-inline .call-inline-actions button{min-height:58px;border-radius:28px;padding:12px 16px;font-size:15px}
 .companion-theme.video-conversation header{padding:10px 14px}.companion-theme.video-conversation #call-person-name{font-size:18px}
 .companion-theme.video-conversation #transcript{padding:8px 14px}
}
@media(prefers-reduced-motion:reduce){.companion-theme *,.companion-theme *::before,.companion-theme *::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}

.companion-settings-block{border-bottom:1px solid var(--line);padding:4px 0}.companion-settings-block>summary{padding:15px 0;min-height:48px;font-size:16px;font-weight:600;cursor:pointer}.companion-settings-block>section>h2{display:none}

@media(max-width:760px){
 .companion-theme .modern[data-screen=chat]{height:calc(100dvh - 65px);padding-top:0;display:flex;flex-direction:column}
 .companion-theme .modern[data-screen=chat]>.layout{flex:1;min-height:0;margin:0;display:flex;flex-direction:column}
 .companion-theme .modern[data-screen=chat] .chat-panel{height:100%;display:flex;flex-direction:column;min-height:0;margin:0;flex:1}
 .companion-theme .modern[data-screen=chat] .messages{height:auto!important;min-height:0;flex:1}
 .companion-theme .modern[data-screen=chat] .chat-composer,.companion-theme .modern[data-screen=chat] .chat-heading{flex-shrink:0}
 .companion-theme .modern[data-screen=chat] .persona-purpose-caption{font-size:11px;line-height:1.5;margin:8px 0 0;color:var(--muted)}
}

.companion-theme .modern .chat-heading .companion-heading-avatar{width:42px;height:42px;min-width:42px;font-size:19px;flex:none}
.companion-theme .modern .composer-mic{font-size:13px!important;color:var(--accent)}
@media(max-width:760px){
 .companion-theme.companion-chat>header{display:none}
 .companion-theme .modern[data-screen=chat]{height:100dvh}
 .companion-theme .modern .chat-heading h2{font-size:17px}
 .companion-theme .modern .chat-heading button{padding:6px;min-width:44px}
 .companion-theme .modern .chat-heading .companion-heading-avatar{width:36px;height:36px;min-width:36px;font-size:17px}
}

/* Experience audit fixes: compact call, bounded drafts and consistent accessible states. */
.companion-theme .modern .chat-composer textarea{min-width:0;min-height:44px!important;max-height:120px;height:44px;line-height:24px;padding:9px 12px;resize:none;overflow-y:auto;align-self:end}
.companion-theme .modern .chat-composer{grid-template-rows:auto auto}
.companion-theme .modern .chat-composer textarea[hidden]{display:none}
.companion-theme .call-mini{z-index:43;max-width:calc(100vw - 24px);display:flex;align-items:center;gap:8px;padding:8px;border:1px solid var(--line);border-radius:18px;box-shadow:0 6px 24px #29282720}
.companion-theme .call-mini button{min-height:44px;white-space:normal}
.companion-theme .call-mini button:first-child{background:var(--tint);color:var(--ink);overflow-wrap:anywhere}
.companion-theme .login-help{margin-top:22px;border-top:1px solid var(--line);padding-top:14px;font-size:14px;line-height:1.8;color:var(--muted)}
.companion-theme .login-help summary{min-height:44px;cursor:pointer;color:var(--accent);padding:10px 0}
.companion-theme #welcome-guide .guide-choices button{background:var(--surface);color:var(--ink);border-color:var(--line)}
.companion-theme #welcome-guide .guide-choices button.chosen{background:var(--accent);border-color:var(--accent);color:white}
.companion-theme #welcome-guide .guide-choices button.chosen small{color:white}
.companion-theme #welcome-guide .guide-choices button:not(.chosen) small{color:#615b56}
.companion-theme #welcome-guide .guide-progress .active{background:var(--accent)}
.companion-theme #welcome-guide .guide-progress span{background:var(--tint)}
.companion-theme #welcome-guide .guide-eyebrow{color:var(--accent)}
.companion-theme .modern .emoji-picker{background:#f1ebe6;border-color:var(--line)}
.companion-theme .modern .emoji-tabs button{color:#615b56;min-height:44px}
.companion-theme .modern .emoji-tabs button[aria-pressed=true]{background:var(--surface);color:var(--accent)}
.companion-theme .modern .chat-heading button{min-height:44px}
.companion-theme .modern .chat-heading .companion-heading-avatar{pointer-events:none}
@media(max-width:360px){.companion-theme .modern .chat-heading{gap:0}.companion-theme .modern .chat-heading .companion-heading-avatar{display:none}}

.companion-theme .modern .chat-composer>button.send-message{align-self:end}
@media(max-width:600px){
 .companion-theme .modern .call-mini{position:static;inset:auto;transform:none;width:100%;max-width:100%;flex-shrink:0;margin:8px 0;padding:7px;gap:7px;box-shadow:none}
 .companion-theme .modern .call-mini button:first-child{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:8px;font-size:13px}
 .companion-theme .modern .call-mini button:last-child{flex:none;padding:8px 12px;font-size:13px}
}

/* Call actions remain reachable beside the composer, distinct from voice messages. */
.companion-call-entry{display:flex;gap:10px;flex-shrink:0;padding:8px 0;border-top:1px solid var(--line);background:var(--paper)}
.companion-theme .companion-call-entry button{flex:1;min-height:48px;padding:10px 16px;border:1px solid var(--line);background:var(--surface);color:var(--accent);font-size:16px;font-weight:600}
.companion-theme .modern .composer-mic{font-size:12px!important}
@media(min-width:761px){
 .companion-theme .modern[data-screen=chat] .chat-panel{height:calc(100dvh - 140px);display:flex;flex-direction:column;min-height:0}
 .companion-theme .modern[data-screen=chat] .messages{height:auto!important;min-height:0;flex:1}
 .companion-theme .modern[data-screen=chat] .chat-heading,.companion-theme .modern[data-screen=chat] .chat-composer{flex-shrink:0}
}

.site-registration{padding:24px 0 12px;margin-top:24px;text-align:center;font-size:12px;line-height:1.8;color:var(--muted)}
.companion-theme .site-registration a{color:var(--muted);text-decoration:none}.site-registration a:hover{text-decoration:underline}
