:root {
    color-scheme: dark;
    --bg: #090a0d;
    --bg2: #0d0f13;
    --panel: rgba(17,19,24,.94);
    --panel2: rgba(22,24,30,.94);
    --panel3: #15171d;
    --line: rgba(255,255,255,.075);
    --line2: rgba(217,177,82,.24);
    --text: #f4f0e7;
    --muted: #9e9b96;
    --gold: #d9b152;
    --gold2: #a67528;
    --goldSoft: rgba(217,177,82,.12);
    --green: #65d39c;
    --red: #ef858e;
    --warn: #e7bb70;
    --shadow: 0 24px 80px rgba(0,0,0,.38);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { width:100%; height:100%; margin:0; background:var(--bg); color:var(--text); }
body { overflow:hidden; }
button,input,textarea,select { font:inherit; }
button { cursor:pointer; }
[hidden] { display:none !important; }
.page-glow { position:fixed; inset:0; pointer-events:none; background:radial-gradient(circle at 18% 4%, rgba(217,177,82,.10), transparent 24%), radial-gradient(circle at 88% 8%, rgba(77,88,132,.12), transparent 24%); }

/* Shared */
.muted { color:var(--muted); }
.small-text { font-size:12px; }
.full { width:100%; }
.eyebrow { color:var(--gold); text-transform:uppercase; letter-spacing:.18em; font-size:11px; font-weight:800; }
.badge,.model-chip,.model-pill,.service-pill { display:inline-flex; align-items:center; border-radius:999px; padding:4px 9px; border:1px solid var(--line); background:rgba(255,255,255,.035); color:#e9e5dc; font-size:11px; white-space:nowrap; }
.badge.gold,.model-chip { color:#f2d89e; background:var(--goldSoft); border-color:var(--line2); }
.primary,.ghost,.danger,.danger-ghost,.icon-btn,.send-btn { border-radius:12px; border:1px solid transparent; color:var(--text); transition:.16s ease; }
.primary { padding:10px 14px; background:linear-gradient(135deg,#f0d287,#b78331); color:#1d1406; font-weight:800; }
.primary:hover { filter:brightness(1.04); transform:translateY(-1px); }
.ghost,.icon-btn { padding:9px 12px; background:rgba(255,255,255,.025); border-color:var(--line); }
.ghost:hover,.icon-btn:hover { background:rgba(255,255,255,.055); }
.danger { padding:9px 12px; background:#e1757d; color:#260a0d; font-weight:800; }
.danger-ghost { padding:9px 12px; background:transparent; border-color:rgba(239,133,142,.24); color:#ffafb6; }
.danger-ghost:hover { background:rgba(239,133,142,.08); }
.compact-action { padding:8px 10px; font-size:13px; }
input,textarea,select { color:var(--text); background:#0d0f14; border:1px solid var(--line); outline:none; border-radius:12px; }
input:focus,textarea:focus,select:focus { border-color:rgba(217,177,82,.7); box-shadow:0 0 0 3px rgba(217,177,82,.11); }
label { display:grid; gap:7px; color:var(--muted); font-size:13px; }

/* Login */
.login-view { min-height:100vh; display:grid; place-items:center; padding:32px; position:relative; }
.login-shell { width:min(1080px,100%); display:grid; grid-template-columns:minmax(0,1.2fr) minmax(330px,390px); gap:24px; }
.login-copy,.login-card { background:linear-gradient(180deg,rgba(20,22,28,.94),rgba(14,16,21,.92)); border:1px solid var(--line); border-radius:26px; box-shadow:var(--shadow); backdrop-filter:blur(16px); }
.login-copy { padding:40px; }
.login-card { padding:32px; align-self:center; border-color:var(--line2); }
.brand-lockup,.brand-row { display:flex; align-items:center; gap:13px; }
.brand-mark { width:50px; height:50px; display:grid; place-items:center; border-radius:15px; background:linear-gradient(135deg,#f0d287,#a97527); color:#211706; font-weight:900; letter-spacing:-.04em; box-shadow:0 10px 26px rgba(217,177,82,.25); }
.brand-mark.alt { background:linear-gradient(135deg,#8264ff,#d8b35c); color:white; }
.brand-mark.small { width:34px; height:34px; border-radius:10px; font-size:12px; flex:0 0 auto; }
.brand-mark.large { width:58px; height:58px; border-radius:18px; margin:0 auto 10px; }
.login-copy h1 { margin:4px 0 0; font-size:clamp(2.2rem,5vw,4rem); line-height:1; }
.hero-copy { max-width:48ch; color:#d3cec5; line-height:1.7; font-size:1.05rem; margin:24px 0 0; }
.feature-grid { display:grid; gap:12px; margin-top:28px; }
.feature-grid.two { grid-template-columns:repeat(2,minmax(0,1fr)); }
.feature-card { padding:15px; border:1px solid var(--line); border-radius:16px; background:rgba(255,255,255,.025); }
.feature-card p { margin:10px 0 0; color:var(--muted); font-size:13px; line-height:1.5; }
.login-card h2 { margin:16px 0 5px; font-size:26px; }
.login-card form { display:grid; gap:15px; margin-top:22px; }
.login-card input { padding:11px 12px; }
.error-text { color:#ffadb5; font-size:13px; margin:12px 0 0; }

/* App shell */
.app { display:grid; grid-template-columns:268px minmax(0,1fr); height:100vh; min-height:0; position:relative; }
.sidebar { min-width:0; min-height:0; display:grid; grid-template-rows:auto minmax(0,1fr) auto; background:linear-gradient(180deg,rgba(13,15,19,.98),rgba(10,12,15,.96)); border-right:1px solid var(--line); z-index:20; }
.sidebar-head { padding:14px 12px 10px; border-bottom:1px solid var(--line); }
.brand-row { padding:2px 2px 12px; }
.brand-copy { min-width:0; flex:1; }
.brand-copy strong { display:block; font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.subbrand { display:block; color:var(--muted); font-size:11px; margin-top:1px; }
.status-dot { width:9px; height:9px; flex:0 0 auto; border-radius:50%; background:var(--warn); box-shadow:0 0 0 4px rgba(231,187,112,.08); }
.status-dot.ok { background:var(--green); box-shadow:0 0 0 4px rgba(101,211,156,.08); }
.new-chat-btn { width:100%; padding:9px 12px; display:flex; align-items:center; justify-content:center; gap:7px; font-size:13px; }
.chat-search-wrap { margin-top:9px; display:flex; align-items:center; gap:7px; padding:0 9px; border:1px solid var(--line); background:rgba(255,255,255,.025); border-radius:11px; }
.chat-search-wrap span { color:#777; }
.chat-search-wrap input { width:100%; border:0; background:transparent; padding:8px 0; box-shadow:none; font-size:12px; }
.chat-list { min-height:0; overflow-y:auto; overscroll-behavior:contain; padding:7px; display:flex; flex-direction:column; gap:3px; scrollbar-width:thin; scrollbar-color:#393a3f transparent; }
.chat-item { width:100%; min-width:0; text-align:left; display:grid; grid-template-columns:minmax(0,1fr) auto; grid-template-rows:auto auto; column-gap:8px; row-gap:2px; padding:8px 9px; border-radius:10px; border:1px solid transparent; background:transparent; color:var(--text); }
.chat-item:hover { background:rgba(255,255,255,.035); }
.chat-item.active { background:rgba(217,177,82,.075); border-color:rgba(217,177,82,.17); }
.chat-item-title { grid-column:1 / 3; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-size:12.5px; font-weight:600; line-height:1.3; }
.chat-item small { min-width:0; color:#807e79; font-size:10px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chat-item time { color:#686864; font-size:10px; text-align:right; }
.empty-sidebar { padding:14px 10px; font-size:12px; }
.sidebar-bottom { display:flex; align-items:center; justify-content:space-between; gap:9px; padding:10px 11px; border-top:1px solid var(--line); }
.account-box { min-width:0; display:flex; align-items:center; gap:8px; }
.account-box > div { min-width:0; display:grid; }
.account-box strong { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-size:12px; }
.account-avatar { color:var(--gold); font-size:10px; }
.icon-btn.compact { width:34px; height:34px; padding:0; display:grid; place-items:center; }

/* Main chat */
.main { min-width:0; min-height:0; display:grid; grid-template-rows:auto minmax(0,1fr) auto; padding:12px; gap:10px; }
.chat-header { min-width:0; display:flex; align-items:center; justify-content:space-between; gap:14px; padding:10px 12px; border:1px solid var(--line); border-radius:16px; background:rgba(18,20,25,.86); backdrop-filter:blur(14px); }
.header-left { min-width:0; display:flex; align-items:center; gap:9px; flex:1; }
.chat-heading { min-width:0; flex:1; }
.title-input { width:min(760px,100%); padding:0; border:0; background:transparent; box-shadow:none !important; font-size:15px; font-weight:720; }
.chat-subline { margin-top:4px; display:flex; align-items:center; gap:7px; min-width:0; }
.chat-subline .small-text { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.model-chip { padding:3px 7px; font-size:10px; }
.header-actions { display:flex; gap:6px; flex:0 0 auto; }
.messages { position:relative; min-height:0; overflow-y:auto; overscroll-behavior:contain; scroll-behavior:smooth; border:1px solid var(--line); border-radius:18px; background:rgba(11,13,17,.66); padding:18px max(18px,calc((100% - 930px)/2)); display:flex; flex-direction:column; gap:11px; scrollbar-width:thin; scrollbar-color:#3a3a3f transparent; }
.empty-state { margin:auto; width:min(560px,100%); text-align:center; display:grid; justify-items:center; gap:8px; padding:28px; }
.empty-state h2 { margin:0; font-size:24px; }
.empty-state p { color:var(--muted); line-height:1.55; margin:0 0 8px; }
.message { width:min(840px,100%); border-radius:16px; padding:13px 15px; border:1px solid var(--line); background:rgba(255,255,255,.027); box-shadow:0 7px 22px rgba(0,0,0,.14); }
.message.user { align-self:flex-end; max-width:min(720px,92%); background:linear-gradient(180deg,rgba(217,177,82,.10),rgba(217,177,82,.055)); border-color:rgba(217,177,82,.18); }
.message.assistant { align-self:flex-start; }
.message-head { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:7px; }
.message-meta { color:#88857f; font-size:10.5px; text-transform:uppercase; letter-spacing:.075em; }
.message-actions { display:flex; align-items:center; gap:4px; opacity:.55; transition:opacity .15s; }
.message:hover .message-actions { opacity:1; }
.message-action { width:28px; height:28px; display:grid; place-items:center; border-radius:8px; border:1px solid transparent; background:transparent; color:#aaa59d; padding:0; }
.message-action:hover { color:#f0d28a; background:rgba(217,177,82,.08); border-color:rgba(217,177,82,.14); }
.message-action.speaking { color:#f0d28a; animation:pulse 1s infinite alternate; }
@keyframes pulse { to { opacity:.45; } }
.message-content { color:#f0ece5; line-height:1.68; font-size:14px; overflow-wrap:anywhere; }
.message-content p { margin:0; }
.message-content p + p { margin-top:10px; }
.message-content h1,.message-content h2,.message-content h3 { margin:13px 0 8px; line-height:1.25; }
.message-content ul { margin:8px 0 8px 20px; padding:0; }
.message-content pre { margin:12px 0 0; border:1px solid rgba(255,255,255,.06); background:#090b0e; border-radius:12px; overflow:auto; }
.code-head { padding:8px 11px; font-size:10px; color:#a49f96; border-bottom:1px solid rgba(255,255,255,.055); background:rgba(255,255,255,.025); }
.message-content pre code { display:block; padding:12px; font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; font-size:12.5px; }
code.inline { padding:.13em .38em; border-radius:6px; background:rgba(255,255,255,.07); font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; }
.scroll-bottom-btn { position:sticky; z-index:7; bottom:9px; align-self:center; margin-top:auto; width:36px; height:36px; border-radius:50%; border:1px solid var(--line2); background:#171611; color:#f1d58f; box-shadow:0 9px 25px rgba(0,0,0,.35); }

/* Composer */
.composer-wrap { border:1px solid var(--line); border-radius:16px; background:rgba(18,20,25,.88); padding:9px; backdrop-filter:blur(14px); }
.queue-banner { margin-bottom:7px; padding:8px 10px; border-radius:10px; border:1px solid rgba(217,177,82,.22); background:rgba(217,177,82,.08); color:#eed69b; font-size:12px; }
.composer { display:grid; gap:7px; }
#promptInput { width:100%; min-height:48px; max-height:200px; padding:11px 12px; border-radius:13px; background:#0b0d11; line-height:1.45; }
.composer-bottom { display:flex; align-items:center; justify-content:space-between; gap:10px; min-height:34px; }
.composer-left,.composer-actions { display:flex; align-items:center; gap:8px; }
#reasoningSelect { min-width:145px; padding:7px 9px; font-size:11px; }
.send-btn { width:36px; height:36px; padding:0; display:grid; place-items:center; border-radius:11px; background:linear-gradient(135deg,#efd083,#b37f2d); color:#211706; font-size:19px; font-weight:900; }
.send-btn:hover { filter:brightness(1.05); transform:translateY(-1px); }
.stop-btn { height:34px; padding:0 12px; }

/* Dialogs */
dialog { border:0; padding:0; background:transparent; color:inherit; }
dialog::backdrop { background:rgba(0,0,0,.62); backdrop-filter:blur(6px); }
.dialog-card { width:min(760px,calc(100vw - 24px)); max-height:min(86vh,760px); overflow:auto; padding:21px; border-radius:20px; border:1px solid var(--line); background:linear-gradient(180deg,#15171d,#101217); box-shadow:var(--shadow); }
.model-dialog { width:min(880px,calc(100vw - 24px)); }
.dialog-head { margin-bottom:15px; }
.dialog-head h3 { margin:4px 0 6px; font-size:22px; }
.dialog-head p { margin:0; }
.dialog-card textarea { width:100%; padding:12px; }
.dialog-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:16px; }
.model-picker { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.model-card { text-align:left; padding:14px; border-radius:15px; border:1px solid var(--line); background:rgba(255,255,255,.025); color:var(--text); }
.model-card:hover { background:rgba(255,255,255,.05); }
.model-card.active { background:rgba(217,177,82,.075); border-color:rgba(217,177,82,.28); box-shadow:inset 0 0 0 1px rgba(217,177,82,.08); }
.model-card-top { display:flex; justify-content:space-between; gap:10px; }
.model-card-top strong { display:block; margin-bottom:5px; font-size:13px; }
.model-card-top p { margin:0; color:var(--muted); font-size:12px; line-height:1.45; }
.model-meta { margin-top:10px; display:flex; gap:6px; flex-wrap:wrap; }
.model-pill { padding:3px 7px; font-size:9.5px; }
.reasoning-wrap { margin-top:14px; }
.reasoning-wrap select,.speech-grid select { padding:9px 10px; }
.speech-dialog { width:min(700px,calc(100vw - 24px)); }
.speech-dialog-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; }
.service-pill { color:var(--warn); }
.service-pill.ok { color:var(--green); border-color:rgba(101,211,156,.24); background:rgba(101,211,156,.06); }
.service-pill.offline { color:#ffadb5; border-color:rgba(239,133,142,.24); }
.speech-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.toggle-row { margin-top:15px; display:flex; align-items:center; gap:9px; color:#d6d0c6; }
.toggle-row input { width:16px; height:16px; accent-color:var(--gold); }
.speech-tags { margin-top:16px; padding:13px; border:1px solid var(--line); border-radius:13px; background:rgba(255,255,255,.022); }
.speech-tags strong { font-size:12px; }
.tag-row { margin-top:9px; display:flex; gap:6px; flex-wrap:wrap; }
.tag-row code { padding:4px 7px; border-radius:7px; color:#eed69b; background:rgba(217,177,82,.08); border:1px solid rgba(217,177,82,.12); font-size:10px; }
.speech-tags p { margin:9px 0 0; }
.toast { position:fixed; z-index:100; top:15px; right:15px; min-width:260px; max-width:min(430px,92vw); padding:12px 14px; border-radius:13px; border:1px solid var(--line); background:rgba(16,18,23,.97); box-shadow:var(--shadow); opacity:0; transform:translateY(-7px); pointer-events:none; transition:.18s ease; font-size:13px; }
.toast.show { opacity:1; transform:translateY(0); }
.toast.success { border-color:rgba(101,211,156,.3); }
.toast.warn { border-color:rgba(231,187,112,.34); }
.toast.error { border-color:rgba(239,133,142,.34); }
.mobile-only { display:none; }

@media (max-width:1050px) {
    .login-shell { grid-template-columns:1fr; }
    .feature-grid.two { grid-template-columns:1fr 1fr; }
    .model-picker { grid-template-columns:1fr; }
}
@media (max-width:860px) {
    .app { grid-template-columns:1fr; }
    .sidebar { position:fixed; inset:0 auto 0 0; width:min(286px,88vw); transform:translateX(-103%); transition:transform .2s ease; box-shadow:var(--shadow); }
    body.sidebar-open .sidebar { transform:translateX(0); }
    .mobile-only { display:grid; }
    .main { padding:8px; }
    .chat-header { align-items:flex-start; }
    .chat-subline .small-text { display:none; }
    .header-actions { flex-wrap:wrap; justify-content:flex-end; }
    .messages { padding:14px; }
}
@media (max-width:620px) {
    .login-view { padding:14px; }
    .login-copy { display:none; }
    .login-card { padding:24px; }
    .chat-header { flex-direction:column; align-items:stretch; }
    .header-actions { justify-content:flex-start; }
    .speech-grid { grid-template-columns:1fr; }
    .message { max-width:100%; }
    .message.user { max-width:94%; }
}

/* v1.2.1 resilient-generation + compact workspace refinements */
.chat-list { gap:4px; padding:7px; }
.chat-item { padding:8px 10px; border-radius:11px; grid-template-columns:minmax(0,1fr) auto; column-gap:8px; row-gap:2px; }
.chat-item-title { font-size:12.5px; }
.chat-item small { grid-column:1; font-size:9.5px; }
.chat-item time { grid-column:2; grid-row:1 / span 2; align-self:center; }
.chat-item.active { box-shadow:inset 2px 0 0 var(--gold); }
.header-actions .compact-action { padding:7px 9px; font-size:11px; }
button:disabled, input:disabled, textarea:disabled { opacity:.52; cursor:not-allowed; }

.working-dots { display:inline-flex; gap:4px; align-items:center; margin-right:7px; }
.working-dots i { width:5px; height:5px; border-radius:50%; background:var(--gold); animation:working-dot 1.05s infinite ease-in-out; }
.working-dots i:nth-child(2) { animation-delay:.14s; }
.working-dots i:nth-child(3) { animation-delay:.28s; }
@keyframes working-dot { 0%,70%,100% { transform:translateY(0); opacity:.35; } 35% { transform:translateY(-4px); opacity:1; } }
.ai-working-inline { min-height:28px; display:flex; align-items:center; color:#bdb7ad; }
.queue-banner { display:flex; align-items:center; flex-wrap:wrap; gap:4px; }

.context-dialog { width:min(640px,calc(100vw - 24px)); }
.context-meter { height:9px; overflow:hidden; border-radius:999px; background:#0a0c10; border:1px solid var(--line); margin:6px 0 16px; }
.context-meter-fill { height:100%; width:0; border-radius:inherit; background:linear-gradient(90deg,#9d742e,#efd083); transition:width .28s ease; }
.context-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:9px; }
.context-grid > div { border:1px solid var(--line); border-radius:12px; background:rgba(255,255,255,.022); padding:11px; display:grid; gap:5px; }
.context-grid span { color:var(--muted); font-size:10px; text-transform:uppercase; letter-spacing:.06em; }
.context-grid strong { font-size:14px; }
.context-foot { margin:14px 0 0; line-height:1.5; }
.export-dialog { width:min(660px,calc(100vw - 24px)); }
.export-actions { display:grid; gap:8px; }
.export-card { text-align:left; display:grid; gap:4px; width:100%; padding:12px 13px; border-radius:12px; border:1px solid var(--line); color:var(--text); background:rgba(255,255,255,.024); }
.export-card:hover { border-color:var(--line2); background:var(--goldSoft); }
.export-card strong { font-size:12px; }
.export-card span { color:var(--muted); font-size:11px; }

@media (max-width:720px) {
    .context-grid { grid-template-columns:1fr 1fr; }
    .header-actions .compact-action { padding:7px 8px; }
}

/* v1.2.4 · dedicated TTS workspace */
.workspace-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    margin-top: 12px;
}
.workspace-nav-btn {
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(255,255,255,.018);
    color: var(--muted);
    padding: 9px 10px;
    font-size: 12px;
    font-weight: 650;
    text-align: center;
}
.workspace-nav-btn:hover { color: var(--text); background: rgba(255,255,255,.04); }
.workspace-nav-btn.active {
    color: #f3d99e;
    background: rgba(216,179,92,.1);
    border-color: rgba(216,179,92,.24);
}
#chatSidebarTools { display: grid; gap: 10px; margin-top: 10px; }

.tts-workspace {
    min-width: 0;
    overflow: auto;
    padding: 22px clamp(18px, 3vw, 38px) 34px;
    background: radial-gradient(circle at 70% 5%, rgba(216,179,92,.07), transparent 25%);
}
.tts-page-header {
    max-width: 1180px;
    margin: 0 auto 18px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}
.tts-page-header h1 { margin: 3px 0 5px; font-size: clamp(1.8rem, 3vw, 2.45rem); }
.tts-page-header p { margin: 0; }
.tts-studio-grid {
    max-width: 1180px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, .72fr);
    gap: 16px;
    align-items: start;
}
.tts-editor-card,
.tts-control-card {
    background: rgba(17,19,25,.82);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 16px 46px rgba(0,0,0,.18);
}
.tts-editor-card { padding: 16px; }
.tts-control-card { padding: 16px; display: grid; gap: 13px; position: sticky; top: 18px; }
.tts-card-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 12px;
}
.tts-card-head h2 { margin: 0 0 4px; font-size: 16px; }
.tts-card-head p { margin: 0; }
#ttsStudioText {
    width: 100%;
    min-height: 390px;
    resize: vertical;
    line-height: 1.62;
    border-radius: 14px;
    padding: 15px;
}
.tts-tag-toolbar {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    margin-top: 10px;
}
.tts-tag-toolbar button {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255,255,255,.025);
    color: var(--muted);
    padding: 6px 10px;
    font-size: 11px;
}
.tts-tag-toolbar button:hover { color: #f2d79a; border-color: rgba(216,179,92,.24); }
.tts-style-hint { min-height: 18px; margin-top: 9px; }
.tts-control-card select { width: 100%; padding: 10px 11px; }
.tts-progress {
    display: flex;
    gap: 11px;
    align-items: center;
    border: 1px solid rgba(216,179,92,.18);
    border-radius: 13px;
    padding: 11px;
    background: rgba(216,179,92,.055);
}
.tts-progress div { display: grid; gap: 2px; }
.tts-spinner {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    border-radius: 50%;
    border: 2px solid rgba(216,179,92,.2);
    border-top-color: var(--accent);
    animation: ttsSpin .85s linear infinite;
}
@keyframes ttsSpin { to { transform: rotate(360deg); } }
.tts-result {
    display: grid;
    gap: 10px;
    border-top: 1px solid var(--line);
    padding-top: 12px;
}
.tts-result audio { width: 100%; }
.tts-result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

@media (max-width: 950px) {
    .tts-studio-grid { grid-template-columns: 1fr; }
    .tts-control-card { position: static; }
    #ttsStudioText { min-height: 300px; }
}

/* v1.2.5 dual speech engine */
.speech-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .speech-grid { grid-template-columns: 1fr; } }

/* v1.3 Voice Studio */
.voice-studio-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(300px, .75fr);
    gap: 14px;
    align-items: start;
}
.voice-script-card { min-height: 430px; }
.voice-control-card { min-height: 430px; }
.voice-advanced-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.voice-advanced-grid label {
    padding: 11px 12px;
    background: rgba(255,255,255,.025);
    border: 1px solid var(--line);
    border-radius: 14px;
}
.voice-advanced-grid input[type="range"] { width: 100%; accent-color: var(--accent); }
.voice-library-card {
    margin-top: 14px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(15,17,23,.72);
}
.voice-clone-form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) 150px minmax(220px, 1fr) auto;
    gap: 10px;
    align-items: end;
    margin-top: 14px;
}
.voice-clone-form input,
.voice-clone-form select { width: 100%; }
.voice-file-label input[type="file"] {
    padding: 8px;
    min-height: 42px;
}
.voice-profile-list { display: grid; gap: 8px; margin-top: 16px; }
.voice-profile-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255,255,255,.02);
}
.voice-profile-main { display: flex; gap: 10px; align-items: center; min-width: 0; }
.voice-profile-main > div:last-child { min-width: 0; display: grid; gap: 2px; }
.voice-profile-main strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.voice-profile-main span { color: var(--muted); font-size: 12px; }
.voice-avatar {
    width: 34px; height: 34px; border-radius: 11px;
    display: grid; place-items: center;
    flex: 0 0 auto;
    background: var(--accent-soft);
    color: #f2d79a;
    border: 1px solid rgba(216,179,92,.22);
    font-weight: 800;
}
.voice-empty {
    padding: 15px;
    border: 1px dashed var(--line);
    border-radius: 14px;
    text-align: center;
}
#voiceProfileLanguageHint { min-height: 32px; line-height: 1.45; }

@media (max-width: 980px) {
    .voice-studio-layout { grid-template-columns: 1fr; }
    .voice-control-card { position: static; min-height: auto; }
    .voice-advanced-grid { grid-template-columns: 1fr; }
    .voice-clone-form { grid-template-columns: 1fr; }
}

/* Voice upload feedback 1.3.5 */
.voice-upload-summary {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 8px 12px; margin-top: 12px; min-width: 0;
}
#voiceSelectedFile { overflow-wrap: anywhere; flex: 1 1 240px; min-width: 0; }
#voiceUploadLimits { flex-basis: 100%; }
#voiceUploadStatus { flex-basis: 100%; margin: 0; line-height: 1.5; overflow-wrap: anywhere; }
#voiceUploadStatus:empty { display: none; }
