:root {
  color-scheme: light;
  --cp-bg: #f4f4f4;
  --cp-bg-elevated: #ffffff;
  --cp-surface: #ffffff;
  --cp-surface-soft: #f4f4f4;
  --cp-border: #b6b6b6;
  --cp-border-strong: #999999;
  --cp-text: #161616;
  --cp-text-muted: #353535;
  --cp-text-soft: #999999;
  --cp-accent: #6bbc15;
  --cp-accent-hover: #6bbc15;
  --cp-accent-soft: rgba(107, 188, 21, 0.12);
  --cp-accent-fg: #161616;
  --cp-voice-heading: #007f86;
  --cp-success: #6bbc15;
  --cp-danger: #0658fc;
  --cp-warning: #00eefc;
  --cp-link: #0658fc;
  --cp-shadow: 0 12px 30px rgba(22, 22, 22, 0.1);
  --cp-overlay: rgba(255, 255, 255, 0.8);
  --cp-panel: rgba(255, 255, 255, 0.94);
  --cp-panel-strong: rgba(255, 255, 255, 0.98);
  --cp-sheen: rgba(255, 255, 255, 0.55);
  --cp-highlight: rgba(6, 88, 252, 0.18);
}
html[data-theme="dark"] {
  color-scheme: dark;
  --cp-bg: #161616;
  --cp-bg-elevated: #232323;
  --cp-surface: #232323;
  --cp-surface-soft: #353535;
  --cp-border: #353535;
  --cp-border-strong: #999999;
  --cp-text: #f4f4f4;
  --cp-text-muted: #b6b6b6;
  --cp-text-soft: #999999;
  --cp-accent: #b7ff00;
  --cp-accent-hover: #b7ff00;
  --cp-accent-soft: rgba(183, 255, 0, 0.14);
  --cp-accent-fg: #161616;
  --cp-voice-heading: #00eefc;
  --cp-success: #b7ff00;
  --cp-danger: #00eefc;
  --cp-warning: #08f3a9;
  --cp-link: #00eefc;
  --cp-shadow: 0 12px 30px rgba(0, 0, 0, 0.32);
  --cp-overlay: rgba(22, 22, 22, 0.88);
  --cp-panel: rgba(35, 35, 35, 0.94);
  --cp-panel-strong: rgba(35, 35, 35, 0.98);
  --cp-sheen: rgba(255, 255, 255, 0.04);
  --cp-highlight: rgba(0, 238, 252, 0.2);
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--cp-bg);
  color: var(--cp-text);
  font-family: Arial, Helvetica, sans-serif;
}
button, select, textarea, input { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, select:focus-visible, textarea:focus-visible, input:focus-visible, a:focus-visible {
  outline: 3px solid var(--cp-highlight);
  outline-offset: 3px;
}
.app-shell {
  min-height: 100vh;
  background: var(--cp-bg);
}
body.auth-locked { overflow: hidden; }
body.auth-locked .skip-link,
body.auth-locked .topbar,
body.auth-locked .footer,
body.auth-locked main > :not(#auth-gate) { display: none !important; }
body.auth-locked main {
  display: grid;
  min-height: 100vh;
  width: min(100% - 48px, 720px);
  padding: 0;
  align-items: center;
}
body.auth-locked #auth-gate { display: block; width: 100%; margin: 0; box-sizing: border-box; }
.topbar, main, .footer { width: min(1180px, calc(100% - 48px)); margin: 0 auto; }
.topbar {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--cp-border);
  box-shadow: inset 0 3px 0 var(--cp-accent);
}
.brand { display: inline-flex; align-items: center; gap: 13px; color: var(--cp-text); text-decoration: none; }
.brand-name { color: var(--cp-accent); font-size: 18px; font-weight: 700; letter-spacing: 0.01em; }
.brand-divider { width: 1px; height: 28px; background: var(--cp-border-strong); }
.brand-product strong, .brand-product small { display: block; }
.brand-product strong { font-size: 15px; letter-spacing: 0.01em; }
.brand-product small { margin-top: 2px; color: var(--cp-text-soft); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.account-controls { display: flex; align-items: center; gap: 8px; }
.auth-user { max-width: 180px; overflow: hidden; color: var(--cp-text-muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.account-menu { position: relative; }
.account-menu-toggle { display: flex; align-items: center; gap: 8px; min-width: 190px; padding: 5px 8px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--cp-text); text-align: left; }
.account-menu-toggle:hover, .account-menu-toggle[aria-expanded="true"] { border-color: var(--cp-border); background: var(--cp-surface); }
.account-menu-label { display: grid; min-width: 0; gap: 1px; flex: 1; }
.account-menu-label .auth-user, .account-username { display: block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-username { color: var(--cp-text-soft); font-size: 10px; }
.account-chevron { color: var(--cp-text-soft); font-size: 14px; }
.account-icon { position: relative; display: inline-block; width: 18px; height: 18px; flex: 0 0 18px; border: 1.5px solid currentColor; border-radius: 50%; color: var(--cp-accent); }
.account-icon::before { position: absolute; top: 3px; left: 5px; width: 5px; height: 5px; border: 1px solid currentColor; border-radius: 50%; content: ""; }
.account-icon::after { position: absolute; bottom: 3px; left: 3px; width: 9px; height: 5px; border: 1px solid currentColor; border-radius: 7px 7px 4px 4px; content: ""; }
.account-menu-panel { position: absolute; z-index: 20; top: calc(100% + 5px); right: 0; display: none; min-width: 190px; padding: 5px; border: 1px solid var(--cp-border); border-radius: 7px; background: var(--cp-panel-strong); box-shadow: var(--cp-shadow); }
.account-menu:hover .account-menu-panel, .account-menu:focus-within .account-menu-panel, .account-menu-toggle[aria-expanded="true"] + .account-menu-panel { display: grid; }
.account-menu-panel button { display: flex; align-items: center; gap: 8px; padding: 8px 9px; border: 0; background: transparent; color: var(--cp-text); font-size: 12px; text-align: left; }
.account-menu-panel button:hover, .account-menu-panel button:focus-visible { background: var(--cp-accent-soft); color: var(--cp-accent); }
.theme-toggle { display: inline-grid; width: 34px; height: 34px; padding: 0; place-items: center; border: 1px solid var(--cp-border); border-radius: 7px; background: var(--cp-surface); color: var(--cp-text); font-size: 17px; }
.theme-toggle:hover { border-color: var(--cp-accent); color: var(--cp-accent); }
.icon-button, .text-button { border: 0; background: transparent; color: var(--cp-text-muted); }
.icon-button { padding: 7px 10px; border: 1px solid var(--cp-border); border-radius: 10px; font-size: 12px; }
.icon-button:hover, .text-button:hover { color: var(--cp-accent); }
main { padding: 10px 0 4px; }
.auth-gate { max-width: 620px; margin: 42px auto; padding: 32px; text-align: center; }
.auth-gate h1 { margin: 0 auto 12px; font-size: 42px; }
.auth-gate .intro-copy { margin: 0 auto 22px; }
.auth-message { min-height: 18px; margin: 14px 0 0; color: var(--cp-danger); font-size: 12px; }
.intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 8px; }
.intro.is-hidden { display: none; }
.intro > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 0 18px; width: 100%; }
.intro > div .eyebrow { grid-column: 1; margin: 0; }
.intro > div h1 { grid-column: 2; justify-self: end; margin: 0; text-align: right; }
.intro > div .intro-copy { grid-column: 1 / -1; }
.eyebrow, .section-kicker, .format-label { margin: 0 0 6px; color: var(--cp-accent); font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { max-width: 700px; margin-bottom: 5px; font-size: 34px; line-height: 0.98; letter-spacing: -0.04em; font-weight: 700; }
h2 { margin-bottom: 0; font-size: 19px; line-height: 1.15; letter-spacing: -0.02em; }
.intro-copy { max-width: 580px; margin-bottom: 0; color: var(--cp-text-muted); font-size: 13px; line-height: 1.35; }
.format-note { min-width: 220px; padding: 0 0 4px 20px; border-left: 2px solid var(--cp-accent); color: var(--cp-text-muted); font-size: 12px; line-height: 1.5; }
.format-note strong, .format-note span { display: block; }
.format-note strong { margin-bottom: 3px; color: var(--cp-text); font-size: 14px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(330px, 0.75fr); gap: 14px; }
.workspace .script-panel { grid-column: 1 / -1; }
.workspace .settings-panel { grid-column: 1; grid-row: 2; }
.workspace .preview-bar { display: grid; grid-column: 2; grid-row: 2; align-self: stretch; height: 100%; box-sizing: border-box; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; }
.panel { background: var(--cp-panel); border: 1px solid var(--cp-border); border-radius: 8px; box-shadow: var(--cp-shadow); }
.script-panel, .settings-panel { min-height: 0; padding: 13px 14px; }
.panel-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: baseline; gap: 0 10px; margin-bottom: 8px; }
.panel-heading .section-kicker { margin: 0; }
.panel-heading h2 { justify-self: end; margin: 0; text-align: right; }
.section-kicker { margin-bottom: 8px; color: var(--cp-text-soft); }
.character-count { color: var(--cp-text-soft); font-family: Consolas, "Courier New", Courier, monospace; font-size: 12px; white-space: nowrap; }
textarea {
  display: block; width: 100%; min-height: 170px; resize: vertical; padding: 12px;
  border: 1px solid var(--cp-border); border-radius: 6px; background: var(--cp-surface); color: var(--cp-text);
  font-size: 15px; line-height: 1.4;
}
textarea::placeholder { color: var(--cp-text-soft); }
textarea:hover, select:hover { border-color: var(--cp-border-strong); }
input[type="text"], input[type="url"] {
  width: 100%; min-height: 38px; padding: 0 12px; border: 1px solid var(--cp-border); border-radius: 6px;
  background: var(--cp-surface); color: var(--cp-text); font-size: 13px;
}
input[type="text"]:hover, input[type="url"]:hover { border-color: var(--cp-border-strong); }
.script-editor-layout { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 14px; align-items: stretch; }
.script-input-column { display: flex; min-width: 0; flex-direction: column; }
.script-text-workbench { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 10px; align-items: stretch; }
.script-text-entry { display: flex; min-width: 0; flex-direction: column; }
.prompt-editor-toolbar { display: flex; align-items: center; justify-content: flex-start; flex-wrap: wrap; gap: 4px; min-height: 26px; }
.text-control-icon { display: inline-grid; width: 28px; height: 24px; place-items: center; padding: 0; border: 1px solid var(--cp-border); border-radius: 5px; background: var(--cp-surface-soft); color: var(--cp-text-muted); font-size: 11px; font-weight: 800; }
.text-control-icon:hover, .text-control-icon:focus-visible { border-color: var(--cp-accent); color: var(--cp-accent); }
.text-control-icon[data-control-type="phoneme"], .text-control-icon[data-control-type="language"] { font-size: 9px; }
.script-textarea-shell { position: relative; display: flex; flex: 1 1 auto; min-height: 170px; }
.script-input-column textarea { position: relative; z-index: 1; flex: 1 1 auto; background: transparent; }
.script-text-highlight-layer { position: absolute; z-index: 2; inset: 0; overflow: hidden; padding: 12px; border: 1px solid transparent; border-radius: 6px; color: transparent; font-size: 15px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; pointer-events: none; }
.script-text-highlight-layer mark { color: transparent; background: var(--cp-accent-soft); border-bottom: 2px solid var(--cp-accent); pointer-events: auto; cursor: help; }
.script-processing-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 9px; border: 1px solid var(--cp-accent); border-radius: 6px; background: color-mix(in srgb, var(--cp-surface) 88%, transparent); color: var(--cp-accent); font-size: 12px; font-weight: 750; }
.script-processing-overlay[hidden] { display: none; }
.processing-spinner { width: 15px; height: 15px; border: 2px solid var(--cp-border-strong); border-top-color: var(--cp-accent); border-radius: 50%; animation: script-processing-spin 0.8s linear infinite; }
@keyframes script-processing-spin { to { transform: rotate(360deg); } }
.script-footer { display: flex; align-items: flex-start; gap: 14px; padding: 9px; border: 1px solid var(--cp-border); border-radius: 6px; background: var(--cp-surface-soft); }
.script-file-actions { display: flex; flex: 0 0 auto; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 6px; padding-top: 0; }
.prompt-editor-toolbar .script-file-actions { flex-direction: row; align-items: center; gap: 4px; margin-right: 6px; }
.script-file-actions .button { min-height: 30px; padding: 0 10px; font-size: 11px; }
.prompt-editor-toolbar .script-file-actions .button { min-height: 24px; padding: 0 8px; font-size: 10px; }
.prompt-input-meta { display: flex; justify-content: flex-end; min-height: 16px; padding-top: 4px; }
.text-controls { align-self: stretch; display: flex; min-width: 0; min-height: 0; box-sizing: border-box; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--cp-border-strong); border-radius: 8px; background: var(--cp-surface-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cp-surface) 45%, transparent); }
.text-controls-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding-bottom: 9px; border-bottom: 1px solid var(--cp-border); }
.text-controls-heading strong { color: var(--cp-text); font-size: 11px; }
.text-controls-heading span { color: var(--cp-text-soft); font-size: 10px; }
.text-controls-row { display: flex; align-items: center; gap: 6px; }
.text-controls-row select { flex: 1 1 180px; width: auto; min-width: 0; min-height: 30px; font-size: 11px; }
.text-controls-row input { flex: 1 1 180px; min-width: 0; min-height: 30px; padding: 0 8px; border: 1px solid var(--cp-border); border-radius: 6px; background: var(--cp-surface); color: var(--cp-text); font-size: 11px; }
.text-control-phoneme-row { display: flex; align-items: center; gap: 6px; }
.text-control-phoneme-row[hidden] { display: none; }
.text-control-phoneme-row input { flex: 1 1 auto; min-width: 0; min-height: 30px; padding: 0 8px; border: 1px solid var(--cp-border); border-radius: 6px; background: var(--cp-surface); color: var(--cp-text); font-size: 11px; }
.text-control-phoneme-row .button { flex: 0 0 auto; min-height: 30px; padding: 0 9px; font-size: 11px; }
.text-control-phoneme-hint { min-height: 30px; padding: 0 8px; border: 1px solid var(--cp-border); border-radius: 6px; background: var(--cp-surface); color: var(--cp-text); font-size: 11px; }
.text-control-apply { flex: 0 0 auto; }
.text-annotation-list { display: flex; flex: 1 1 auto; flex-wrap: wrap; align-content: flex-start; gap: 7px; min-height: 24px; padding-top: 1px; }
.text-annotation { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 3px 5px 3px 7px; border: 1px solid var(--cp-border); background: var(--cp-surface); color: var(--cp-text-muted); font-size: 10px; }
.text-annotation span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-annotation button { width: 16px; height: 16px; padding: 0; border: 0; background: transparent; color: var(--cp-text-soft); font-size: 14px; line-height: 1; }
.text-annotation button:hover { color: var(--cp-danger); }
.text-context-menu { position: fixed; z-index: 30; display: flex; width: min(260px, calc(100vw - 20px)); flex-direction: column; gap: 7px; padding: 10px; border: 1px solid var(--cp-border-strong); border-radius: 6px; background: var(--cp-panel); box-shadow: var(--cp-shadow); }
.text-context-menu[hidden] { display: none; }
.text-context-menu > strong { color: var(--cp-text); font-size: 11px; }
.text-context-selection { overflow: hidden; color: var(--cp-text-soft); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.text-context-menu select { min-height: 30px; font-size: 11px; }
.text-context-menu input { min-height: 30px; padding: 0 8px; font-size: 11px; }
.text-context-menu .button { min-height: 30px; font-size: 11px; }
.sample-prompts { display: flex; min-width: 0; flex: 1 1 auto; flex-wrap: wrap; gap: 8px 12px; }
.script-actions { display: flex; align-items: stretch; gap: 12px; flex: 0 0 auto; }
.script-actions .button { min-height: 34px; padding: 0 12px; font-size: 12px; }
.translation-widget { display: flex; width: 100%; height: 100%; box-sizing: border-box; flex-direction: column; align-items: stretch; gap: 8px; padding: 8px; border: 1px solid var(--cp-border); border-radius: 6px; background: var(--cp-surface-soft); }
.tool-group { display: flex; flex-direction: column; gap: 6px; }
.tool-group + .tool-group { padding-top: 8px; border-top: 1px solid var(--cp-border); }
.tool-group-heading { display: flex; align-items: center; gap: 6px; }
.tool-group-heading h3 { margin: 0; color: var(--cp-text); font-size: 11px; font-weight: 800; letter-spacing: 0.04em; }
.tool-icon { display: inline-grid; width: 18px; height: 18px; place-items: center; border-radius: 4px; background: var(--cp-accent-soft); color: var(--cp-accent); font-size: 13px; font-weight: 800; line-height: 1; }
.enhancement-instructions-toggle { display: inline-grid; width: 24px; height: 24px; margin-left: auto; padding: 0; place-items: center; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--cp-text-muted); }
.enhancement-instructions-toggle:hover, .enhancement-instructions-toggle[aria-expanded="true"] { border-color: var(--cp-border-strong); background: var(--cp-surface); color: var(--cp-accent); }
.enhancement-instructions-toggle.has-custom-instructions { border-color: var(--cp-accent); background: var(--cp-accent); color: var(--cp-accent-fg); }
.voice-bubble-icon { position: relative; display: block; width: 13px; height: 10px; border: 1.5px solid currentColor; border-radius: 3px; }
.enhancement-instructions-toggle.has-custom-instructions .voice-bubble-icon { background: currentColor; }
.voice-bubble-icon::after { position: absolute; right: 1px; bottom: -4px; width: 4px; height: 4px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; background: var(--cp-surface-soft); content: ""; transform: skewY(28deg); }
.enhancement-instructions-toggle.has-custom-instructions .voice-bubble-icon::after { background: currentColor; }
.translation-widget select { width: 100%; min-width: 0; min-height: 30px; padding: 0 8px; font-size: 12px; }
.translation-widget select:disabled { cursor: not-allowed; opacity: 0.62; }
.translation-widget-actions { display: flex; flex-direction: column; gap: 4px; padding-top: 4px; border-top: 1px solid var(--cp-border); }
.translation-widget-actions .button { width: 100%; min-height: 30px; padding: 0 10px; font-size: 12px; }
.translation-widget-links { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 10px; min-height: 18px; }
.translation-widget-links .text-button { font-size: 11px; }
.translation-widget-future { padding-bottom: 4px; border-bottom: 1px dashed var(--cp-border-strong); }
.ai-options-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; }
.ai-length-control { display: grid; gap: 3px; }
.ai-length-control label { color: var(--cp-text-muted); font-size: 10px; font-weight: 700; }
.ai-length-control select { min-height: 28px; padding: 0 8px; font-size: 11px; }
.enhancement-instructions-dialog { width: min(440px, calc(100% - 32px)); max-height: calc(100% - 32px); padding: 0; border: 1px solid var(--cp-border-strong); border-radius: 8px; background: var(--cp-panel); color: var(--cp-text); box-shadow: var(--cp-shadow); }
.enhancement-instructions-dialog::backdrop { background: rgb(16 25 35 / 58%); }
.enhancement-instructions-card { padding: 20px; }
.enhancement-instructions-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.enhancement-instructions-heading .section-kicker { margin-bottom: 5px; }
.enhancement-instructions-heading h2 { margin: 0; font-size: 18px; }
.enhancement-instructions-card > label { display: block; margin-bottom: 6px; color: var(--cp-text); font-size: 12px; font-weight: 700; }
.enhancement-instructions-card > label span { color: var(--cp-text-soft); font-weight: 400; }
.enhancement-instructions-card textarea { min-height: 88px; resize: vertical; padding: 10px; font-size: 13px; line-height: 1.4; }
.canned-instructions { display: grid; gap: 6px; margin-top: 10px; }
.canned-instructions-label { color: var(--cp-text-muted); font-size: 10px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.canned-instruction-list { display: flex; flex-wrap: wrap; gap: 6px; }
.canned-instruction { padding: 5px 8px; border: 1px solid var(--cp-border); border-radius: 5px; background: var(--cp-surface-soft); color: var(--cp-text-muted); font-size: 11px; font-weight: 700; }
.canned-instruction:hover, .canned-instruction:focus-visible { border-color: var(--cp-accent); color: var(--cp-accent); }
.enhancement-instructions-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.voice-settings-toggle { display: flex; align-items: center; gap: 5px; margin: 0 0 2px; color: var(--cp-text-muted); font-size: 10px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.voice-settings-toggle input { width: 14px; height: 14px; margin: 0; accent-color: var(--cp-accent); }
.tool-action-button { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 30px; padding: 0 10px; font-size: 11px; }
.button-icon { font-size: 14px; line-height: 1; }
.text-button-icon { display: inline-block; margin-right: 3px; font-size: 14px; line-height: 0; vertical-align: -1px; }
.text-button { padding: 2px 0; font-size: 12px; font-weight: 700; }
.field-group { margin-bottom: 9px; }
.field-group > label, .range-label label { display: block; margin-bottom: 4px; color: var(--cp-text); font-size: 12px; font-weight: 700; }
.inline-field-label { white-space: nowrap; }
.inline-field-hint { color: var(--cp-text-soft); font-size: 10px; font-weight: 400; }
select {
  width: 100%; min-height: 34px; padding: 0 10px; border: 1px solid var(--cp-border); border-radius: 6px;
  background: var(--cp-surface); color: var(--cp-text); font-size: 13px;
}
.field-hint { display: block; min-height: 17px; margin-top: 5px; color: var(--cp-text-soft); font-size: 10px; }
.control-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.extended-control-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.extended-control-grid .field-group { min-width: 0; }
.silence-control-group { grid-column: auto; }
.silence-control-heading { display: block; margin-bottom: 4px; color: var(--cp-voice-heading); font-size: 12px; font-weight: 700; }
.silence-control-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.silence-control-pair > div { min-width: 0; }
.silence-control-pair label { display: block; margin-bottom: 4px; color: var(--cp-text); font-size: 12px; font-weight: 700; }
.style-intensity-control { min-width: 0; margin-bottom: 0; }
.delivery-control-group { grid-column: 1; grid-row: 1; }
.pitch-control-group { grid-column: 1; grid-row: 2; }
.right-control-stack { grid-column: 2; grid-row: 1 / span 3; min-width: 0; }
.pause-control-group { grid-column: auto; grid-row: auto; }
.pause-control-heading { display: block; margin-bottom: 4px; color: var(--cp-voice-heading); font-size: 12px; font-weight: 700; }
.pause-control-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pause-control-pair > div { min-width: 0; }
.pause-control-pair label { display: block; margin-bottom: 4px; color: var(--cp-text); font-size: 12px; font-weight: 700; }
.silence-control-group { grid-column: auto; grid-row: auto; }
.advanced-delivery-group { grid-column: auto; grid-row: auto; }
.advanced-delivery-heading { display: flex; align-items: center; gap: 5px; margin-bottom: 4px; color: var(--cp-voice-heading); font-size: 12px; font-weight: 700; cursor: pointer; list-style: none; }
.advanced-delivery-heading::-webkit-details-marker { display: none; }
.advanced-delivery-heading::before { content: "+"; display: inline-block; width: 12px; color: var(--cp-voice-heading); font-size: 15px; line-height: 1; }
.advanced-delivery-group[open] .advanced-delivery-heading::before { content: "−"; }
.style-intensity-smoothing-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; margin-bottom: 8px; }
.pitch-control-group .style-intensity-smoothing-row { margin-top: 8px; }
.advanced-delivery-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.advanced-delivery-controls > div { min-width: 0; }
.advanced-delivery-controls label { display: block; margin-bottom: 4px; color: var(--cp-text); font-size: 12px; font-weight: 700; }
.advanced-delivery-group .smoothing-toggle { margin: 0 0 5px; }
.right-control-stack > .reset-delivery-button { display: block; margin: auto 0 0 auto; }
.settings-panel .advanced-delivery-group .field-hint { display: block; min-height: 0; margin-top: 3px; font-size: 9px; }
.settings-panel .extended-control-grid .field-hint { display: block; min-height: 0; margin-top: 3px; font-size: 9px; }
.range-group { margin-bottom: 9px; }
.range-label { display: flex; justify-content: space-between; gap: 12px; }
.range-label output { color: var(--cp-accent); font-family: Consolas, "Courier New", Courier, monospace; font-size: 12px; font-weight: 700; }
input[type="range"] { width: 100%; accent-color: var(--cp-accent); }
.range-scale { display: flex; justify-content: space-between; color: var(--cp-text-soft); font-size: 9px; }
.voice-card { position: relative; margin-top: 6px; padding: 6px 34px 6px 10px; border-left: 3px solid var(--cp-accent); background: var(--cp-accent-soft); }
.voice-card-header { margin-bottom: 4px; }
.voice-card-label { display: block; color: var(--cp-text-soft); font-size: 10px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.voice-card > strong { display: block; margin-bottom: 2px; font-size: 13px; }
.voice-card > span { display: block; color: var(--cp-text-muted); font-size: 12px; }
.voice-card-settings { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; }
.voice-card-settings div { display: flex; align-items: baseline; gap: 3px; min-width: 0; }
.voice-card-settings span { color: var(--cp-text-soft); font-size: 10px; }
.voice-card-settings strong { color: var(--cp-accent); font-family: Consolas, "Courier New", Courier, monospace; font-size: 11px; }
.voice-card-settings strong { overflow-wrap: anywhere; }
.favorite-heart-button { position: absolute; top: 5px; right: 7px; width: 28px; height: 28px; padding: 0; border: 0; background: transparent; color: var(--cp-text-soft); font-size: 25px; line-height: 1; }
.favorite-heart-button:hover, .favorite-heart-button.is-saved { color: var(--cp-accent); }
.settings-panel .panel-heading { margin-bottom: 6px; }
.settings-panel .field-group { margin-bottom: 3px; }
.settings-panel .field-hint { display: none; min-height: 0; margin-top: 2px; }
.settings-panel .range-group { margin-bottom: 3px; }
.settings-panel select { min-height: 30px; padding: 0 8px; font-size: 12px; }
.settings-panel .favorite-config-top { margin-bottom: 7px; }
.settings-panel .favorite-config-heading { margin-bottom: 4px; }
.settings-panel .favorite-icon-button { width: 32px; height: 32px; flex-basis: 32px; }
.settings-panel .voice-card { margin-top: 8px; }
.settings-panel .voice-choice-grid,
.settings-panel .voice-filter-grid { gap: 6px; }
.settings-panel .extended-control-grid { column-gap: 7px; row-gap: 5px; }
.settings-panel .slider-control-pair,
.settings-panel .pause-control-pair,
.settings-panel .silence-control-pair,
.settings-panel .advanced-delivery-controls { gap: 6px; }
.settings-panel .right-control-stack { display: flex; flex-direction: column; gap: 3px; align-items: stretch; }
.settings-panel .right-control-stack > * { grid-column: auto; grid-row: auto; min-width: 0; }
.settings-panel .field-hint { font-size: 9px; line-height: 1.2; }
.preview-bar .voice-card { grid-column: 1 / -1; margin: 0; }
.preview-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 8px; padding: 10px 14px; }
.workspace .preview-bar { margin-top: 0; }
.workspace .preview-bar { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; gap: 8px; }
.preview-copy { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 0 10px; }
.preview-copy .section-kicker { margin: 0; }
.preview-copy h2 { justify-self: end; margin: 0; text-align: right; }
.preview-copy .status-message { grid-column: 1 / -1; }
.status-message { min-height: 14px; margin-bottom: 0; color: var(--cp-text-muted); font-size: 11px; }
.status-message[data-state="error"] { color: var(--cp-danger); }
.status-message[data-state="working"] { color: var(--cp-accent); }
.preview-actions { display: grid; grid-template-columns: 1fr; align-items: end; gap: 8px; width: 100%; min-width: 0; }
.preview-format-group { width: 100%; margin: 0; }
.preview-format-group label { display: block; margin-bottom: 5px; color: var(--cp-text); font-size: 11px; font-weight: 700; }
.preview-format-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.preview-format-heading > label { margin-bottom: 0; }
.preview-format-heading .voice-settings-toggle { margin-bottom: 0; }
.preview-format-group .voice-settings-toggle { display: flex; margin-top: 7px; margin-bottom: 0; }
.preview-button-stack { display: flex; align-items: center; justify-content: flex-start; gap: 8px; flex-wrap: wrap; }
.preview-normalization-option { display: flex; align-items: center; gap: 6px; }
.preview-normalization-option[hidden] { display: none; }
.preview-normalization-option .voice-settings-toggle { margin: 0; }
.button { min-height: 36px; padding: 0 12px; border: 1px solid transparent; border-radius: 6px; font-size: 12px; font-weight: 750; }
.button-primary { background: var(--cp-accent); color: var(--cp-accent-fg); }
.button-primary:hover:not(:disabled) { background: var(--cp-accent-hover); }
.button-secondary { border-color: var(--cp-border-strong); background: var(--cp-surface); color: var(--cp-text); }
.button-secondary:hover:not(:disabled) { border-color: var(--cp-accent); color: var(--cp-accent); }
.button:disabled { cursor: not-allowed; opacity: 0.45; }
.audio-panel { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 8px; padding: 8px 14px; }
.account-preferences { margin-top: 16px; padding: 16px; }
.account-preferences-copy { margin: 0 0 12px; color: var(--cp-text-muted); font-size: 12px; }
.language-exclusions { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.language-exclusion-option { display: inline-flex; align-items: center; gap: 6px; color: var(--cp-text); font-size: 12px; font-weight: 700; cursor: pointer; }
.language-exclusion-option input { width: 14px; height: 14px; margin: 0; accent-color: var(--cp-accent); }
.account-preferences-status { min-height: 16px; margin: 10px 0 0; color: var(--cp-text-muted); font-size: 11px; }
.audio-heading { display: flex; align-items: center; gap: 13px; }
.audio-heading strong, .audio-heading span:last-child { display: block; }
.audio-heading strong { margin-bottom: 3px; font-size: 13px; }
.audio-heading span:last-child { color: var(--cp-text-muted); font-size: 11px; }
.audio-signal { display: flex; align-items: center; gap: 2px; width: 28px; height: 24px; }
.audio-signal i { display: block; width: 3px; border-radius: 2px; background: var(--cp-accent); }
.audio-signal i:nth-child(1), .audio-signal i:nth-child(5) { height: 8px; }
.audio-signal i:nth-child(2), .audio-signal i:nth-child(4) { height: 15px; }
.audio-signal i:nth-child(3) { height: 23px; }
audio { width: min(430px, 100%); height: 32px; }
.favorite-config-group { margin-top: 10px; }
.favorite-config-top { margin-top: 0; margin-bottom: 10px; }
.favorite-config-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.favorite-config-heading label { color: var(--cp-text); font-size: 12px; font-weight: 700; }
.favorite-config-heading span { color: var(--cp-text-soft); font-family: Consolas, "Courier New", Courier, monospace; font-size: 11px; }
.voice-choice-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 8px; }
.voice-choice-grid .field-group { min-width: 0; }
.voice-label-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.voice-label-row > label:first-child { margin-bottom: 0; }
.hd-voice-toggle { display: inline-flex; align-items: center; gap: 5px; color: var(--cp-text-muted); font-size: 11px; font-weight: 700; white-space: nowrap; }
.hd-voice-toggle input { width: 14px; height: 14px; margin: 0; accent-color: var(--cp-accent); }
.voice-filter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.voice-filter-grid.role-hidden { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.voice-filter-grid .field-group { min-width: 0; }
.voice-capability-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.voice-capability-grid .field-group { min-width: 0; }
.slider-control-group { min-width: 0; }
.advanced-delivery-group { grid-column: 2; grid-row: 3; }
.advanced-delivery-heading { display: flex; align-items: center; gap: 5px; margin-bottom: 4px; color: var(--cp-voice-heading); font-size: 12px; font-weight: 700; cursor: pointer; list-style: none; }
.style-intensity-smoothing-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; margin-bottom: 8px; }
.advanced-delivery-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.advanced-delivery-controls > div { min-width: 0; }
.advanced-delivery-controls label { display: block; margin-bottom: 4px; color: var(--cp-text); font-size: 12px; font-weight: 700; }
.advanced-delivery-group .smoothing-toggle { margin: 0 0 5px; }
.slider-control-heading { display: block; margin-bottom: 4px; color: var(--cp-voice-heading); font-size: 12px; font-weight: 700; }
.slider-control-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.slider-control-pair > .range-group { min-width: 0; margin-bottom: 0; }
.favorite-select-row { display: flex; align-items: center; gap: 8px; }
.favorite-select-row select { flex: 1; min-width: 0; }
.favorite-icon-button { display: inline-grid; flex: 0 0 38px; width: 38px; height: 38px; padding: 0; place-items: center; border: 1px solid var(--cp-border); border-radius: 6px; background: var(--cp-surface); color: var(--cp-text-muted); font-size: 19px; line-height: 1; }
.favorite-icon-button:hover { border-color: var(--cp-accent); color: var(--cp-accent); }
.favorite-icon-button:disabled { cursor: not-allowed; opacity: 0.45; }
.field-optional { color: var(--cp-text-soft); font-size: 10px; font-weight: 400; }
.favorite-notes { min-height: 38px; height: 38px; padding: 9px 12px; font-size: 13px; }
.favorites-status { min-height: 17px; margin: 10px 0 0; color: var(--cp-text-muted); font-size: 12px; }
.favorites-status[data-state="error"] { color: var(--cp-danger); }
.favorite-delete { color: var(--cp-danger); }
.favorite-dialog { width: min(500px, calc(100% - 32px)); max-height: calc(100% - 32px); padding: 0; border: 1px solid var(--cp-border-strong); border-radius: 8px; background: var(--cp-panel); color: var(--cp-text); box-shadow: var(--cp-shadow); }
.favorite-dialog::backdrop { background: rgb(16 25 35 / 58%); }
.favorite-dialog-card { padding: 22px; }
.favorite-dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.favorite-dialog-heading h2 { max-width: 320px; }
.dialog-close { width: 32px; height: 32px; padding: 0; border: 1px solid var(--cp-border); border-radius: 6px; background: transparent; color: var(--cp-text-muted); font-size: 22px; line-height: 1; }
.dialog-close:hover { border-color: var(--cp-accent); color: var(--cp-accent); }
.favorite-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.favorites-editor-list { display: grid; gap: 10px; max-height: 430px; overflow-y: auto; }
.favorite-empty { margin: 0; color: var(--cp-text-soft); font-size: 12px; }
.favorites-editor-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.favorites-editor-table th { padding: 0 8px 8px; color: var(--cp-text-soft); font-size: 10px; font-weight: 800; letter-spacing: 0.1em; text-align: left; text-transform: uppercase; }
.favorites-editor-table td { padding: 9px 8px; border-top: 1px solid var(--cp-border); vertical-align: middle; }
.favorites-editor-table th:first-child, .favorites-editor-table td:first-child { padding-left: 0; }
.favorites-editor-table th:last-child, .favorites-editor-table td:last-child { padding-right: 0; text-align: right; }
.favorites-editor-table input { width: 100%; min-width: 130px; box-sizing: border-box; min-height: 34px; padding: 8px 10px; border: 1px solid var(--cp-border); border-radius: 6px; background: var(--cp-surface); color: var(--cp-text); font: inherit; }
.favorite-settings-cell { color: var(--cp-text-muted); font-size: 11px; white-space: nowrap; }
.favorite-actions-cell { width: 38px; }
.favorite-trash-button { width: 30px; height: 30px; padding: 0; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--cp-danger); font-size: 17px; line-height: 1; }
.favorite-trash-button:hover { border-color: var(--cp-danger); background: var(--cp-surface); }
.footer { display: flex; justify-content: space-between; gap: 20px; padding: 10px 0 12px; color: var(--cp-text-soft); font-size: 11px; }
.account-page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 16px; }
.account-page-heading h1 { margin-bottom: 5px; }
.account-summary { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.account-summary-icon { width: 42px; height: 42px; flex-basis: 42px; }
.account-summary-icon::before { top: 8px; left: 12px; width: 11px; height: 11px; }
.account-summary-icon::after { bottom: 7px; left: 8px; width: 23px; height: 12px; }
.account-summary h2 { margin-bottom: 2px; }
.account-email { margin: 0; color: var(--cp-text-muted); font-size: 12px; }
.account-summary .button { margin-left: auto; }
.account-favorites-section { margin-top: 18px; }
.account-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.account-section-heading .section-kicker { margin-bottom: 5px; }
.account-favorites-count { color: var(--cp-text-soft); font-family: Consolas, "Courier New", Courier, monospace; font-size: 11px; }
.account-favorites-table-wrap { overflow-x: auto; border: 1px solid var(--cp-border); border-radius: 7px; background: var(--cp-panel); }
.account-favorites-table { width: 100%; min-width: 1050px; border-collapse: collapse; font-size: 12px; }
.account-favorites-table th { padding: 9px 10px; background: var(--cp-surface-soft); color: var(--cp-text-soft); font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.account-favorites-table td { padding: 9px 10px; border-top: 1px solid var(--cp-border); color: var(--cp-text-muted); vertical-align: middle; }
.account-favorites-table td:first-child { width: 170px; }
.account-favorites-table input { width: 100%; min-height: 30px; padding: 6px 8px; border: 1px solid var(--cp-border); border-radius: 5px; background: var(--cp-surface); color: var(--cp-text); font: inherit; }
.account-favorites-table input:focus { border-color: var(--cp-accent); }
.account-favorites-table td:nth-child(7) { min-width: 270px; font-family: Consolas, "Courier New", Courier, monospace; font-size: 10px; white-space: nowrap; }
.account-favorites-table td:nth-child(8) { min-width: 180px; }
.account-prompts-table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 12px; }
.account-prompts-table th { padding: 9px 10px; background: var(--cp-surface-soft); color: var(--cp-text-soft); font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.account-prompts-table td, .account-prompts-table tbody th { padding: 9px 10px; border-top: 1px solid var(--cp-border); color: var(--cp-text-muted); font-size: 12px; font-weight: 400; text-align: left; vertical-align: middle; }
.account-prompts-table tbody th { color: var(--cp-text); font-weight: 700; }
.account-prompt-preview { max-width: 390px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-prompt-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -50px; padding: 10px; background: var(--cp-accent); color: var(--cp-accent-fg); }
.skip-link:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 480px) {
  .topbar { flex-wrap: wrap; padding: 10px 0 0; }
  .topbar, main, .footer { width: min(100% - 30px, 620px); }
  main { padding-top: 42px; }
  .intro { display: block; margin-bottom: 28px; }
  .intro > div { display: block; }
  .intro > div h1 { text-align: left; }
  h1 { font-size: 48px; }
  .format-note { margin-top: 24px; padding-left: 14px; }
  .workspace { grid-template-columns: 1fr; }
  .workspace .script-panel, .workspace .settings-panel, .workspace .preview-bar { grid-column: 1; grid-row: auto; }
  .script-panel { min-height: auto; padding: 23px; }
  .settings-panel { min-height: auto; padding: 16px; }
  textarea { min-height: 260px; }
  .voice-choice-grid { grid-template-columns: 1fr; gap: 0; }
  .voice-filter-grid, .voice-filter-grid.role-hidden { grid-template-columns: 1fr; gap: 0; }
  .voice-capability-grid { grid-template-columns: 1fr; gap: 0; }
  .script-editor-layout { grid-template-columns: 1fr; }
  .script-text-workbench { grid-template-columns: 1fr; }
  .preview-bar, .audio-panel { align-items: flex-start; flex-direction: column; padding: 22px 23px; }
  .workspace .preview-bar { display: flex; }
  .preview-actions { display: flex; flex-wrap: wrap; width: 100%; justify-content: flex-start; }
  .preview-format-group { width: 100%; }
  .script-actions { flex-wrap: wrap; }
  .script-footer { flex-direction: column; }
  .translation-widget { max-width: none; }
  audio { width: 100%; }
  .favorite-dialog-actions { flex-direction: column-reverse; }
  .favorite-dialog-actions .button { width: 100%; }
  .favorites-editor-table { min-width: 430px; }
  .favorites-editor-list { overflow-x: auto; }
}
@media (max-width: 480px) {
  .topbar { min-height: 70px; }
  .service-pill { display: none; }
  .auth-user { max-width: 110px; }
  .account-menu-toggle { min-width: 0; }
  .account-username { display: none; }
  .account-page-heading { display: block; }
  .account-page-heading .button { margin-top: 14px; }
  .account-summary { align-items: flex-start; flex-wrap: wrap; }
  .account-summary .button { margin-left: 0; }
  h1 { font-size: 40px; }
  .control-grid { grid-template-columns: 1fr; gap: 0; }
  .extended-control-grid { grid-template-columns: 1fr; gap: 0; }
  .style-intensity-smoothing-row { grid-template-columns: 1fr; }
  .extended-control-grid .delivery-control-group,
  .extended-control-grid .pitch-control-group,
  .extended-control-grid .right-control-stack { grid-column: auto; grid-row: auto; }
  .footer { display: block; line-height: 1.8; }
  .footer span { display: block; }
}
