[data-voice-studio] {
  --voice-bg: #f4f4f5;
  --voice-surface: #fff;
  --voice-text: #18181b;
  --voice-muted: #71717a;
  --voice-border: rgba(0, 0, 0, 0.1);
  color: var(--voice-text);
}
[data-voice-studio],
[data-voice-studio] * { box-sizing: border-box; }
[data-voice-studio] .icon { display: block; width: 20px; height: 20px; opacity: .78; }
.voice-editor-region,
.voice-library-region { min-height: 0; height: 100%; }
[data-voice-studio] .toolbox-queue-region h2,
[data-voice-studio] .toolbox-queue-region h3 { white-space: nowrap; }
.editor-panel,
.library-panel { display: flex; flex-direction: column; }
.voice-editor-body { overflow: hidden; }
.lines-wrap { position: relative; flex: 1; min-height: 0; overflow-y: scroll; padding: 4px 0 14px; scrollbar-width: none; }
.lines { display: grid; gap: 9px; }
.line { overflow: visible; }
.line-head { display: flex; height: 36px; align-items: center; gap: 4px; padding: 0 4px 0 2px; }
.line-toggle { display: flex; min-width: 0; height: 100%; flex: 1; align-items: center; gap: 10px; text-align: left; }
.line-title { min-width: 0; flex: 1; }
.line-title strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-title strong { font-size: 13px; }
.line-summary { max-width: 42%; overflow: hidden; color: #858690; font-size: 11px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.line-chevron { width: 14px; height: 14px; flex: none; color: #6b7280; transition: transform .2s ease; }
.line[data-expanded=true] .line-chevron { transform: rotate(180deg); }
.remove { display: grid; width: 30px; height: 30px; border-radius: 8px; place-items: center; }
.remove:hover { background: #e8e8ed; }
.remove .icon { width: 16px; height: 16px; }
.line-body { padding: 10px; border: 1px solid var(--voice-border); border-radius: 13px; background: #f4f4f5; }
.selected-voice-card { margin-bottom: 8px; padding: 8px; border: 1px solid var(--voice-border); border-radius: 12px; background: #fafafa; }
.selected-voice-main { display: grid; min-height: 36px; width: 100%; grid-template-columns: 36px minmax(0,1fr) auto; align-items: center; gap: 9px; padding: 0; text-align: left; }
.selected-voice-avatar { width: 36px; height: 36px; border: 1px solid #e0e0e5; border-radius: 10px; object-fit: cover; background: #f1f1f4; }
.private-voice-avatar { display: block; overflow: hidden; }
.private-voice-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; transform: scale(2); }
.selected-voice-main > span { min-width: 0; }
.selected-voice-main strong,
.selected-voice-main em { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected-voice-main strong { font-size: 14px; }
.selected-voice-main em { margin-top: 5px; color: #8b8c96; font-size: 10px; font-style: normal; }
.selected-sample-label { display: flex; justify-content: space-between; margin: 4px 0 1px; color: #888a94; font-size: 9px; }
.selected-player-slot { min-height: 28px; }
.selected-voice-player,
.collapsed-voice-player { display: block; width: 100%; height: 28px; color-scheme: light; }
.selected-voice-player::-webkit-media-controls-panel,
.collapsed-voice-player::-webkit-media-controls-panel { background: #f4f4f5; }
[data-voice-studio] > .selected-voice-player { display: none; }
.line-collapsed-preview { padding: 8px; border: 1px solid var(--voice-border); border-radius: 13px; background: #fafafa; cursor: pointer; }
.line-collapsed-preview:focus-visible { outline: 1px solid var(--control-focus, #5f697b); outline-offset: -1px; }
.line-collapsed-preview .selected-voice-main { margin-bottom: 4px; }
.collapsed-voice-main { grid-template-columns: 36px minmax(0,1fr) auto; }
.collapsed-voice-name { display: flex; align-items: center; align-self: stretch; }
.selected-voice-main .collapsed-voice-meta { max-width: 100%; margin: 0; color: #8b8c96; font-size: 10px; font-style: normal; text-align: right; }
.collapsed-player-shell.is-disabled { opacity: .48; filter: grayscale(1); pointer-events: none; }
.script-field,
.library-tools label { display: grid; gap: 6px; color: #5f616b; font-size: 11px; }
.script-input-shell { position: relative; display: block; }
.script-field textarea,
.library-tools input,
.library-tools select {
  width: 100%;
  border: 1px solid var(--voice-border);
  border-radius: 9px;
  color: var(--voice-text);
  background: #fff;
}
.script-field textarea { min-height: 72px; padding: 10px 14px; resize: vertical; border-color: #dfe3e8; border-radius: 10px; background: #f5f5f6; box-shadow: inset 0 2px 6px rgba(15,23,42,.055),0 1px 2px rgba(15,23,42,.02); font-size: 13px; line-height: 1.6; }
.script-field textarea::placeholder { color: #657186; opacity: 1; }
.voice-setting-cards { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-top: 4px; }
.setting-card .icon { width: 16px; height: 16px; }
.setting-card b { display: block; overflow: hidden; margin-top: 1px; font-size: 10px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.setting-card[data-open=true] .setting-chevron { transform: rotate(180deg); }
.editor-footer { flex: 0 0 auto; padding: 0 2px 2px; }
.voice-generation-card { margin: 0 0 8px; padding: 9px 10px; border: 1px solid #dedee4; border-radius: 10px; background: #fafafa; }
.voice-generation-card[hidden] { display: none; }
.voice-generation-copy { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #303038; font-size: 11px; }
.voice-generation-copy span { color: #71717a; font-variant-numeric: tabular-nums; }
.voice-generation-track { height: 5px; margin-top: 7px; overflow: hidden; border-radius: 999px; background: #e4e4e7; }
.voice-generation-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: #252529; transition: width .25s ease; }
.voice-generation-card[data-status=succeeded] .voice-generation-track span { background: #16803c; }
.voice-generation-card[data-status=failed] .voice-generation-track span,
.voice-generation-card[data-status=reconciling] .voice-generation-track span { background: #b45309; }
.voice-generation-card audio { display: block; width: 100%; height: 30px; margin-top: 7px; color-scheme: light; }
.voice-generation-card audio[hidden] { display: none; }
.editor-notice-row { display: flex; min-height: 18px; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px 2px; color: #858690; font-size: 10px; }
.editor-notice-row p { overflow: hidden; margin: 0; text-overflow: ellipsis; white-space: nowrap; }
.editor-notice-row button { flex: none; color: #303038; font-weight: 650; }
.line-add { min-height: 38px; margin-top: 7px; border: 1px dashed #d4d4dc; border-radius: 10px; background: rgba(255,255,255,.58); }
.line-add:hover { border-color: #aaaab5; background: #fff; }
.voice-tabs button { white-space: nowrap; }
.voice-tabs #mine-count { font-size: 9px; line-height: 1; }
.library-panel .toolbox-preview-panel-header { justify-content: space-between; }
.library-tools { display: grid; flex: 0 0 auto; grid-template-columns: minmax(0,1fr) 104px 104px; gap: 8px; padding: 12px 0; }
.library-tools .search-wrap,
.library-tools .filter-wrap { min-width: 0; align-self: end; }
.search-wrap { position: relative; }
.search-wrap .icon { position: absolute; top: 50%; left: 10px; width: 17px; height: 17px; transform: translateY(-50%); }
.library-tools input,
.library-tools select { height: 38px; padding: 0 10px; }
.library-tools .search-wrap input { padding-left: 34px; }
.custom-voice { grid-column: 1/-1; display: flex; min-height: 42px; align-items: center; justify-content: space-between; padding: 0 12px; border: 1px dashed #d4d4dc !important; border-radius: 10px; color: #686973; background: #fafafa !important; font-size: 11px; font-weight: 400; line-height: 1.25; text-align: left; }
.custom-voice:hover,
.custom-voice[aria-expanded=true] { border-color: #aaaab5 !important; background: #f7f7fa !important; }
.custom-voice span { color: #a0a1aa; font-size: 10px; }
.custom-voice-form { grid-column: 1/-1; display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; padding: 10px; border: 1px solid var(--voice-border); border-radius: 10px; background: #fafafa; }
.custom-voice-form[hidden] { display: none; }
.custom-voice-form label { min-width: 0; }
.custom-voice-form input { height: 36px; padding: 0 9px; }
.custom-voice-form input[type=file] { padding: 4px 9px; line-height: 26px; }
.custom-voice-form input[type=file]::file-selector-button { height: 26px; margin: 0 8px 0 0; padding: 0 10px; border: 1px solid #dce0e9; border-radius: 6px; color: #343947; background: #f7f8fb; font: inherit; line-height: 24px; vertical-align: top; cursor: pointer; }
.custom-voice-form p { grid-column: 1/-1; margin: 0; color: #8d8e98; font-size: 10px; }
.custom-voice-form button { align-self: end; height: 36px; padding: 0 12px; border-radius: 8px; color: #fff; background: #242429; white-space: nowrap; }
.voice-list { min-height: 0; flex: 1; margin-right: -16px; overflow-y: scroll; padding-right: 16px; scrollbar-width: none; }
.voice-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-content: start; gap: 10px; padding-bottom: 12px; }
.voice-list::-webkit-scrollbar { width: 0; height: 0; }
.voice-scrollbar,
.lines-scrollbar { position: absolute; z-index: 3; right: -1px; width: 8px; border: 0; background: none !important; box-shadow: none; cursor: pointer; }
.voice-scrollbar span,
.lines-scrollbar span { position: absolute; top: 0; right: 1px; width: 6px; min-height: 30px; border-radius: 999px; background: #c9cad1; cursor: grab; }
.voice-scrollbar span:active,
.lines-scrollbar span:active { cursor: grabbing; }
.lines-wrap::-webkit-scrollbar { width: 0; height: 0; }
.voice-card { position: relative; display: flex; min-height: 86px; flex: none; align-items: center; gap: 12px; padding: 13px; border: 1px solid #e0e0e5; border-radius: 15px; background: linear-gradient(130deg,#f3f3f5,#f8f8f9); box-shadow: inset 0 1px 1px #ffffffe6,0 1px 2px #00000002; cursor: pointer; transition: background .15s ease,border-color .15s ease,box-shadow .15s ease; }
.voice-card:hover:not(.selected) { border-color: #ededf0; background: #fff; box-shadow: 0 4px 14px #25273308; }
.voice-card.selected { border: 1px solid #1b1b1e; background: #fff; box-shadow: 0 2px 3px #00000008; }
.voice-card:focus-visible { outline: 1px solid var(--control-focus, #5f697b); outline-offset: -1px; }
.voice-card .avatar { display: grid; width: 42px; height: 42px; flex-shrink: 0; overflow: hidden; border: 1px solid #e0e0e5; border-radius: 11px; color: #656772; object-fit: cover; background: #eee; font-size: 11px; font-weight: 650; place-items: center; }
.voice-copy { min-width: 0; flex: 1; }
.voice-copy b,
.voice-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-copy b { color: #29292f; font-size: 13px; font-weight: 650; letter-spacing: .1px; }
.voice-copy small { margin-top: 7px; color: #90909b; font-size: 10px; line-height: 1.4; }
.voice-card-actions { position: relative; display: grid; gap: 7px; align-items: center; margin: 0; }
.audition-button { display: grid; width: 27px; min-width: 27px; height: 27px; margin-top: 8px; padding: 2px; border: 0; border-radius: 50%; color: #90929e; background: transparent; place-items: center; }
.audition-button:hover:not(:disabled),
.favorite-button:hover { color: #353843; background: #e1e2e8; }
.audition-button:disabled { opacity: .35; }
.audition-button svg { display: block; width: 23px; height: 23px; }
.favorite-button { padding: 1px 6px; border: 0; color: #92939f; background: none; font-size: 16px; line-height: 1; }
.favorite-button[aria-pressed=true] { color: #29292f; }
.voice-card-management { display: flex; justify-content: flex-end; }
.voice-card-management button { display: grid; width: 27px; height: 18px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #92939f; place-items: center; }
.voice-card-management svg, .voice-card-management img { width: 18px; height: 18px; }
.voice-card-management button:hover:not(:disabled) { background: #e1e2e8; color: #353843; }
.voice-card-management button:disabled { opacity: .35; }
.voice-card-actions > .audition-button { justify-self: end; }
.voice-card .checked { position: absolute; top: 7px; right: 8px; display: grid; width: 17px; height: 17px; border-radius: 50%; color: #fff; background: #1c1c1f; font-size: 9px; pointer-events: none; place-items: center; }
.voice-card.selected .voice-card-actions { margin: 0; }
.empty { padding: 30px; color: var(--voice-muted); text-align: center; }
.library-foot { display: flex; min-height: 42px; flex: 0 0 42px; align-items: center; gap: 4px; padding: 0 14px; border-top: 1px solid rgba(0,0,0,.06); color: #9697a1; font-size: 10px; white-space: nowrap; }
.voice-confirm { width: min(360px,calc(100% - 32px)); padding: 0; border: 1px solid #dedee4; border-radius: 14px; color: #27272d; background: #fff; box-shadow: 0 18px 56px rgba(15,23,42,.18); }
.voice-confirm::backdrop { background: rgba(24,24,27,.24); backdrop-filter: blur(2px); }
.voice-confirm form { padding: 18px; }
.voice-confirm h3 { margin: 0; font-size: 14px; font-weight: 700; }
.voice-confirm p { margin: 8px 0 16px; color: #71717a; font-size: 12px; line-height: 1.55; }
.voice-confirm form > div { display: flex; justify-content: flex-end; gap: 8px; }
.voice-confirm button { min-width: 72px; height: 34px; border: 1px solid #dedee4; border-radius: 9px; background: #f7f7f8; font-size: 12px; font-weight: 650; }
.voice-confirm .confirm-primary { border-color: #242429; color: #fff; background: #242429; }
@media (max-width: 1120px) {
  .library-tools { grid-template-columns: minmax(0,1fr) 92px 92px; }
  .voice-grid { grid-template-columns: 1fr; }
  .library-foot { white-space: normal; }
}
@media (max-width: 900px) {
  [data-voice-studio] { overflow: visible !important; }
  .voice-editor-region { height: 720px; }
  .voice-library-region { height: 620px; }
}
@media (max-width: 540px) {
  .voice-setting-cards,
  .tuning { grid-template-columns: 1fr; }
  .library-tools { grid-template-columns: 1fr 1fr; }
  .library-tools .search-wrap,
  .custom-voice,
  .custom-voice-form { grid-column: 1/-1; }
  .custom-voice-form { grid-template-columns: 1fr; }
  .custom-voice-form p { grid-column: auto; }
}
@media (max-width: 639px) {
  .voice-list { margin-right: -12px; padding-right: 12px; }
}

.voice-dialogue-section { margin-top: 18px; }
.voice-dialogue-section h3 { margin-bottom: 10px; }
.voice-dialogue-card { min-width: 0; }
.voice-dialogue-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.voice-dialogue-head > strong { flex: none; }
.voice-dialogue-character { min-width: 0; flex: 1; }
.voice-dialogue-character select { width: 100%; min-height: 30px; border: 1px solid var(--voice-border); border-radius: 8px; background: #fff; }
.dialogue-result-player { display: block; width: 100%; height: 28px; margin-top: 8px; }
.selected-voice-main:focus-visible { outline: 1px solid var(--control-focus, #5f697b); outline-offset: -1px; }

[data-voice-studio] [data-voice-queue-host] > :not(.voice-owned-queue) { display: none !important; }
.voice-owned-queue { display: flex; min-height: 0; flex: 1; flex-direction: column; }
.voice-job-list { display: grid; gap: 8px; margin-top: 8px; padding: 0 4px; list-style: none; }
.voice-job-card { position: relative; display: flex; width: 100%; height: 74px; min-width: 0; align-items: center; gap: 8px; overflow: hidden; padding: 10px; border: 1px solid var(--voice-border); border-radius: 12px; background: #f6f6f8; text-align: left; transition: border-color .15s, transform .2s; }
.voice-job-card.is-selected { border-color: rgba(88,104,124,.42); background: #fff; }
@media (prefers-reduced-motion: no-preference) { .voice-job-card:hover { transform: translateY(-1px); } }
.voice-job-icon { display: grid; width: 52px; height: 52px; flex: none; overflow: hidden; padding: 0; border: 0; border-radius: 8px; background: #e8e8e8; cursor: pointer; place-items: center; }
.voice-job-icon img { width: 52px; height: 52px; object-fit: contain; }
.voice-job-copy { display: flex; min-width: 0; height: 52px; flex: 1; flex-direction: column; justify-content: center; gap: 4px; padding: 0; border: 0; color: #858690; background: transparent; text-align: left; font-size: 10px; line-height: 1.25; cursor: pointer; }
.voice-job-copy:disabled { cursor: default; opacity: .6; }
.voice-job-copy strong { overflow: hidden; color: var(--voice-text); font-size: 10px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.voice-job-actions { position: absolute; inset: auto 0 0; z-index: 2; display: flex; height: 28px; align-items: flex-end; justify-content: space-between; padding: 4px 4px 2px; border-radius: 0 0 12px 12px; background: linear-gradient(to top,rgba(0,0,0,.75),rgba(0,0,0,.4),transparent); opacity: 0; pointer-events: none; transform: translateY(100%); transition: transform .2s, opacity .2s; }
.voice-job-card:hover .voice-job-actions, .voice-job-card:focus-within .voice-job-actions { opacity: 1; pointer-events: auto; transform: translateY(0); }
.voice-job-actions button { display: grid; width: 24px; height: 24px; flex: none; padding: 0; border: 0; border-radius: 6px; color: rgba(255,255,255,.95); background: transparent; cursor: pointer; place-items: center; }
.voice-job-actions button:hover { background: rgba(126,98,255,.4); }
.voice-job-actions button:disabled { cursor: wait; opacity: .5; }
.voice-job-actions svg { width: 14px; height: 14px; }
.voice-queue-message, .voice-queue-load { margin: 8px 0; padding: 8px 4px; color: var(--voice-muted); text-align: center; font-size: 11px; }
.voice-queue-load:hover { background: #00000008; border-radius: 8px; }
.voice-job-list.is-compact { padding: 0; }
.is-compact .voice-job-card { height: 38px; justify-content: center; padding: 4px; }
.is-compact .voice-job-copy { display: none; }
.is-compact .voice-job-icon, .is-compact .voice-job-icon img { width: 28px; height: 28px; }
.voice-job-details { width: min(660px,calc(100% - 32px)); max-height: min(84dvh,760px); overflow: hidden; padding: 0; border: 1px solid var(--voice-border); border-radius: 16px; color: var(--voice-text); background: #fff; box-shadow: 0 18px 56px rgba(15,23,42,.18); }
.voice-job-details::backdrop { background: rgba(24,24,27,.24); backdrop-filter: blur(2px); }
.voice-job-details > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--voice-border); }
.voice-job-details h3 { margin: 0; font-size: 14px; font-weight: 650; }
.voice-job-details button { padding: 6px 12px; border: 1px solid var(--voice-border); border-radius: 8px; color: var(--voice-text); background: #f7f7f8; font-size: 12px; cursor: pointer; }
.voice-job-details-body { max-height: calc(min(84dvh,760px) - 68px); overflow-y: auto; padding: 16px 20px 20px; }
.voice-job-details h4 { margin: 0 0 10px; font-size: 12px; font-weight: 650; }
.voice-detail-result audio { display: block; width: 100%; height: 32px; margin-bottom: 16px; }
.voice-detail-meta { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px 18px; margin: 0; font-size: 11px; line-height: 1.5; }
.voice-detail-meta dt { color: var(--voice-muted); }
.voice-detail-meta dd { margin: 3px 0 0; overflow-wrap: anywhere; }
.voice-detail-segments { margin-top: 18px; }
.voice-detail-segments article { margin-top: 10px; padding: 12px; border: 1px solid var(--voice-border); border-radius: 10px; background: #f8f8fa; }
.voice-detail-segments h5 { margin: 0; font-size: 12px; font-weight: 650; }
.voice-detail-script { margin: 8px 0 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.6; }
.voice-detail-error { margin: 12px 0; color: #a04420; font-size: 11px; overflow-wrap: anywhere; }

.voice-result-player { display: flex; min-width: 0; align-items: center; gap: 4px; }
.voice-result-player[hidden] { display: none; }
.voice-result-player > audio { min-width: 0; flex: 1; }
.voice-result-player > .voice-audio-download { flex: none; width: 30px; height: 28px; padding: 0; border: 0; border-radius: 6px; color: var(--voice-text); background: transparent; font-size: 10px; cursor: pointer; }
.voice-result-player > .voice-audio-download:hover { background: #e8e8ed; }
.voice-result-player > .voice-audio-download:disabled { opacity: .5; cursor: wait; }
/* Keep the original final audio margin outside the details section after adding the flex row. */
.voice-detail-result > .voice-result-player { margin-bottom: 16px; }
.voice-detail-result > .voice-result-player > audio { margin-bottom: 0; }
