/* Optional voice companion. Opening this UI never starts media or billing. */
#voice-root{position:absolute;inset:0;z-index:45;pointer-events:none;min-width:0;min-height:0}
.voice-companion{position:absolute;right:24px;bottom:calc(var(--voice-composer-height,0px) + 12px);width:min(390px,calc(100% - 48px));max-width:100%;color:var(--ink);font-size:14px;pointer-events:auto}
.app-shell.voice-visible .thread{padding-bottom:172px}
.app-shell.voice-visible:not(.voice-layout)>#new-answer{bottom:calc(var(--voice-composer-height,0px) + var(--voice-companion-height,110px) + 24px)}
.voice-capsule{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:0 4px;padding:6px 8px 8px;border:1px solid var(--line-strong);border-radius:22px;background:linear-gradient(125deg,var(--surface),var(--panel));box-shadow:0 8px 32px var(--shadow-soft)}
.voice-launcher{display:flex;align-items:center;gap:8px;min-width:0;min-height:52px;padding:0;background:transparent;color:var(--ink);text-align:left;border-radius:16px}
.voice-launcher-name{display:flex;flex:1;flex-direction:column;gap:4px;min-width:0}
.voice-launcher-name>span{font:400 15px/1.2 Georgia,serif;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.voice-launcher-name small{font-size:11px;line-height:1.3;color:var(--muted);white-space:nowrap}
.voice-launcher>.voice-icon{width:16px;flex:none;color:var(--muted)}
.voice-icon{display:inline-flex;align-items:center;justify-content:center;flex:none}
.voice-icon svg{display:block;width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.voice-launcher>.voice-icon svg{width:16px;height:16px}
.voice-icon-button{display:inline-flex;align-items:center;justify-content:center;flex:none;width:44px;height:44px;min-width:44px;min-height:44px;padding:0;border:1px solid var(--line);border-radius:50%;background:var(--wash);color:var(--ink)}
.voice-icon-button:hover:not(:disabled),.voice-button:hover:not(:disabled),.voice-mode:hover:not(:disabled){background:var(--wash-hover);border-color:var(--line-strong)}
.voice-icon-button:disabled,.voice-button:disabled,.voice-mode:disabled{opacity:.45}
.voice-companion button:focus-visible{outline-offset:2px}
.voice-quick-controls{display:flex;align-items:center;gap:2px}
.voice-quick-end,.voice-end{color:var(--danger)}
.voice-caption-peek{grid-column:1/-1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin:3px 4px 0;font-size:11px;line-height:1.5;color:var(--soft-ink)}
.voice-compact-error{grid-column:1/-1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin:3px 4px 0;color:var(--danger);font-size:11px;line-height:1.5}
.voice-compact-billing{grid-column:1/-1;display:flex;flex-wrap:wrap;align-items:baseline;gap:2px 9px;margin:5px 4px 0;color:var(--muted);font-size:10.5px;line-height:1.45;font-variant-numeric:tabular-nums}
.voice-compact-billing span{overflow-wrap:anywhere}
.voice-compact-tariff{color:var(--gold)}
.voice-panel{width:100%;max-height:calc(var(--vh) - var(--voice-composer-height,0px) - var(--voice-header-height,92px) - 24px);overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;padding:16px 18px 20px;background:linear-gradient(150deg,var(--surface),var(--panel));border:1px solid var(--line-strong);border-radius:24px;box-shadow:0 18px 54px var(--shadow-soft)}
.voice-heading{display:flex;align-items:center;gap:8px}
.voice-heading h2{font:400 23px/1.2 Georgia,serif;margin:0;flex:1}
.voice-collapse{color:var(--muted);background:transparent;border-color:transparent}
.voice-collapse .voice-icon{transform:rotate(180deg)}
.voice-hero{display:flex;align-items:center;justify-content:center;margin:4px auto 2px;min-height:160px}
.voice-hero .voice-sphere{--voice-sphere-size:160px}
.voice-intro{font-size:13px;line-height:1.6;color:var(--soft-ink);margin:12px 0}
.voice-tariff{color:var(--gold);font-size:12px;line-height:1.6;margin:12px 0 6px}
.voice-note{font-size:12px;line-height:1.55;color:var(--muted);margin:6px 0 14px}
.voice-modes{display:grid;gap:9px;margin:16px 0}
.voice-mode{padding:13px 15px;text-align:left;min-height:60px;border:1px solid var(--line-strong);border-radius:12px;background:var(--wash);color:var(--ink);font-size:14px}
.voice-mode small{display:block;margin-top:5px;font-size:11px;line-height:1.4;color:var(--muted)}
.voice-status{font-size:12px;line-height:1.6;margin:2px 0 12px;text-align:center;color:var(--soft-ink);overflow-wrap:anywhere}
.voice-spending{font-size:12px;line-height:1.6;color:var(--muted);font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.voice-controls{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:14px}
.voice-button{border:1px solid var(--line);border-radius:12px;padding:10px;min-height:44px;min-width:0;background:var(--wash);color:var(--ink);font-size:12px;line-height:1.4;overflow-wrap:anywhere}
.voice-end{display:flex;align-items:center;justify-content:center;gap:8px;grid-column:1/-1;color:var(--danger)}
.voice-motion,.voice-history{display:block;min-height:44px;padding:9px 4px;background:transparent;color:var(--muted);font-size:12px;line-height:1.5;text-align:left}
.voice-motion[aria-pressed=true]{color:var(--gold)}
.voice-history{color:var(--gold);margin-top:4px}
.voice-error{color:var(--danger);font-size:13px;line-height:1.6;overflow-wrap:anywhere}
.voice-companion .voice-warning{color:var(--gold)}
.voice-captions{max-height:180px;overflow:auto;overscroll-behavior:contain;margin-top:12px;border-top:1px solid var(--line);padding-top:12px;font-size:13px;line-height:1.6;overflow-wrap:anywhere}
.voice-caption+.voice-caption{margin-top:10px}
.voice-caption strong{font-size:11px;color:var(--gold);font-weight:500}
.voice-caption p{margin:3px 0 0;white-space:pre-wrap}
.voice-draft{margin-top:14px;padding:12px;border:1px solid var(--line);border-radius:12px;overflow-wrap:anywhere}
.voice-draft small{color:var(--muted);font-size:11px}
.voice-draft p{font-size:13px;line-height:1.6;white-space:pre-wrap}
.voice-draft .voice-button{width:100%}
.voice-history-dialog{width:min(680px,calc(100vw - 32px));max-height:82dvh;overflow:auto;background:var(--surface);color:var(--ink);border:1px solid var(--line-strong);border-radius:20px;padding:24px}
.voice-transcript-history{font-size:15px;line-height:1.6;overflow-wrap:anywhere;margin:20px 0}
.voice-transcript-history .voice-caption{padding:12px 0;border-bottom:1px solid var(--line)}

/* Both renderers occupy the same measured area; [hidden] remains authoritative. */
.voice-compact-sphere{display:flex;flex:none;width:48px;height:48px;align-items:center;justify-content:center}
.voice-sphere{position:relative;display:inline-block;flex:none;width:var(--voice-sphere-size,48px);height:var(--voice-sphere-size,48px);isolation:isolate}
.voice-sphere-canvas,.voice-sphere-fallback{position:absolute;inset:0;display:block;width:100%;height:100%;pointer-events:none}
.voice-sphere-fallback{border-radius:50%;border:1px solid rgba(246,228,205,.55);background:radial-gradient(ellipse at 28% 23%,rgba(255,247,236,.86),transparent 31%),radial-gradient(ellipse at 74% 72%,rgba(236,193,131,.72),transparent 43%),radial-gradient(ellipse at 36% 68%,rgba(181,155,229,.87),transparent 47%),radial-gradient(ellipse at 68% 28%,#bba5d7,transparent 62%),#655274;box-shadow:inset -6px -8px 14px rgba(57,35,76,.45),inset 4px 4px 13px rgba(255,243,230,.34),0 0 18px var(--glow-plum)}
.voice-sphere-fallback:before{content:"";position:absolute;inset:10% 14%;border-radius:46% 54% 58% 42%;border-top:1px solid rgba(255,238,212,.65);border-bottom:1px solid rgba(232,217,254,.4);transform:rotate(-29deg);box-shadow:0 -2px 5px rgba(255,231,189,.22)}
.voice-sphere[data-state=off],.voice-sphere[data-state=ended]{opacity:.72}
.voice-sphere[data-state=error]{filter:saturate(.55)}
.voice-companion[data-listening=true] .voice-capsule{border-color:var(--gold)}

@media(min-width:1101px){
 .app-shell.voice-layout{grid-template-columns:minmax(0,1fr) 300px}
 .app-shell.voice-layout>.topbar{grid-column:1/-1;grid-row:1}
 .app-shell.voice-layout>.conversation{grid-column:1;grid-row:2;min-width:0}
 .app-shell.voice-layout>.composer-area{grid-column:1;grid-row:3;min-width:0}
 .app-shell.voice-layout>.new-answer{left:calc((100% - 300px)/2)}
 .app-shell.voice-layout>#voice-root{position:relative;inset:auto;grid-column:2;grid-row:2/4;border-left:1px solid var(--line)}
 .app-shell.voice-layout .voice-companion{position:static;width:100%;height:100%;max-width:none}
 .app-shell.voice-layout .voice-panel{height:100%;max-height:none;border:0;border-radius:0;box-shadow:none;padding:18px}
 .app-shell.voice-layout .thread{padding-bottom:36px}
}
@media(max-width:1100px){
 .voice-companion{right:12px;width:min(440px,calc(100% - 24px))}
 .voice-panel{max-height:calc(var(--vh) - var(--voice-composer-height,0px) - var(--voice-header-height,56px) - 24px)}
}

/* Mobile density only. Text remains in the DOM as the action's accessible name. */
@media(max-width:700px){
 .app-shell .topbar{grid-template-columns:minmax(0,1fr) auto auto;gap:4px;min-height:56px;padding:6px 8px;padding-top:max(6px,env(safe-area-inset-top))}
 .app-shell .topbar .brand{grid-column:1;grid-row:1;gap:6px;min-width:0;min-height:44px;width:fit-content}
 .app-shell .topbar .brand-star{display:block;flex:none;font-size:30px}
 .app-shell .topbar .brand strong{font-size:18px;white-space:nowrap}
 .app-shell .topbar .brand-note{display:none}
 .app-shell .topbar .header-actions{grid-column:2;grid-row:1;gap:0;min-width:0;flex-wrap:nowrap}
 .app-shell .topbar .header-actions .text-button,.app-shell .topbar #history-button,.app-shell .topbar #sound{display:inline-flex;align-items:center;justify-content:center;flex:none;width:44px;height:44px;min-width:44px;min-height:44px;margin:0;padding:0;border:0;border-radius:12px;font-size:0;line-height:1;background:transparent}
 .app-shell .topbar .header-actions #account-entry:after{content:none}
 .app-shell .topbar #account-entry:before,.app-shell .topbar #history-button:before,.app-shell .topbar #catalog-link:before{content:"";display:block;width:21px;height:21px;background:currentColor;-webkit-mask:var(--header-action-icon) center/contain no-repeat;mask:var(--header-action-icon) center/contain no-repeat}
 .app-shell .topbar #account-entry{--header-action-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='12' cy='8' r='3.5'/%3E%3Cpath d='M5 20v-2a7 7 0 0 1 14 0v2'/%3E%3C/svg%3E")}
 .app-shell .topbar #history-button{--header-action-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 4h16v13H9l-5 4V4Zm4 5h8m-8 4h6'/%3E%3C/svg%3E")}
 .app-shell .topbar #catalog-link{--header-action-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='7' y='3' width='12' height='17' rx='2'/%3E%3Cpath d='m4 6-2 1 4 15 10-2M13 7l1.2 3.3 2.8 1.2-2.8 1.2L13 16l-1.2-3.3L9 11.5l2.8-1.2Z'/%3E%3C/svg%3E")}
 .app-shell .topbar #sound-label{display:none}
 .app-shell .topbar .sound-button>span:first-child{display:block;font-size:23px}
 .app-shell .topbar>.theme-toggle{grid-column:3;grid-row:1;justify-content:center;gap:0;width:44px;height:44px;min-width:44px;min-height:44px;padding:10px}
 .app-shell .topbar>.theme-toggle:before{transform:none}
 .app-shell .topbar .theme-toggle .theme-sun{display:none}
 .app-shell .topbar .theme-toggle .theme-moon{display:block}
 [data-theme=light] .app-shell .topbar .theme-toggle .theme-sun{display:block}
 [data-theme=light] .app-shell .topbar .theme-toggle .theme-moon{display:none}
 .app-shell .composer-area{padding:6px 12px calc(8px + env(safe-area-inset-bottom))}
 .app-shell #composer{gap:8px;padding:1px 1px 1px 12px;border-radius:15px}
 .app-shell #composer textarea{min-width:0;min-height:40px;padding:7px 0;line-height:22px;font-size:16px}
 .app-shell #composer .send-button{min-width:40px;min-height:40px;height:40px;padding:0 8px;border-radius:12px}
 .app-shell .composer-note{gap:8px;flex-wrap:nowrap;margin:4px 2px 0;font-size:11px;line-height:1.35}
 .app-shell .composer-note #about{min-width:24px;min-height:24px;padding:0;font-size:19px;text-align:center}
 .app-shell .composer-note #remaining{min-width:0;text-align:right;overflow-wrap:anywhere}
 .app-shell #status{margin:0 2px 6px}
 .app-shell #status:empty{display:none}
 .voice-panel{padding:12px 16px 18px}
}
@media(max-width:360px){
 .app-shell .topbar .brand{min-width:44px;justify-content:center}
 .app-shell .topbar .brand>span:last-child{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
 .voice-launcher-name>span{font-size:13px}
 .voice-launcher-name small{font-size:10px}
 .voice-launcher{gap:6px}
 .voice-launcher>.voice-icon{width:12px}
 .voice-launcher>.voice-icon svg{width:12px;height:12px}
}
@media(prefers-reduced-motion:reduce){.voice-companion *{animation:none!important;transition:none!important}}
