/* Редактор ролика по сценарию (studio_video.php). Общие классы (st-btn, st-input, st-tab, st-group) - из studio.css. */

.vd-app { display: flex; flex-direction: column; gap: 12px; }
.vd-app [hidden] { display: none !important; }

.vd-notice { padding: 8px 12px; border-radius: 7px; background: #eff6ff; color: #1e3a8a; border: 1px solid #bfdbfe; }
.vd-notice.is-error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }

.vd-list-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.vd-list-head h2 { margin: 0; font-size: 1.3rem; }
.vd-list-import { margin-left: auto; }
.vd-group { border: 1px solid #dde3ea; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; background: #fff; }
.vd-group-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.vd-group-head h3 { margin: 0; font-size: 1.05rem; }
.vd-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid #eef1f4; }
.vd-row-title { flex: 1 1 auto; color: #1d4ed8; text-decoration: none; }
.vd-row-title:hover { text-decoration: underline; }

.vd-top { display: flex; align-items: center; gap: 8px; }
.vd-title { flex: 1 1 auto; max-width: 520px; font-weight: 600; }
.vd-save { font-size: 0.82rem; color: #64748b; min-width: 110px; }
.vd-save.is-pending, .vd-save.is-saving { color: #b45309; }
.vd-save.is-failed, .vd-save.is-conflict { color: #b91c1c; }
.vd-conflict { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: #b91c1c; }
.vd-warn { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 7px; background: #fffbeb; border: 1px solid #fde68a; color: #92400e; font-size: 0.88rem; }
.vd-queue { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 7px; background: #f0fdfa; border: 1px solid #99f6e4; color: #115e59; font-size: 0.88rem; }

.vd-main { display: grid; grid-template-columns: minmax(0, 1fr) 460px; gap: 16px; align-items: start; }
.vd-preview { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.vd-wrap { max-height: 60vh; }
.vd-fit { max-height: 60vh; }
.vd-transport { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vd-play.is-playing { background: #b45309; border-color: #b45309; }
.vd-sound { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; }
.vd-clock { margin-left: auto; font-variant-numeric: tabular-nums; color: #64748b; font-size: 0.85rem; }

.vd-side { display: flex; flex-direction: column; gap: 8px; min-width: 0; max-height: 72vh; overflow: auto; }
/* Вкладки и разделы не сжимаются в колонке, а вкладки не уезжают при прокрутке длинной вкладки (например «Языки») */
.vd-side > * { flex-shrink: 0; }
/* Звуки ходов: вид, выбор звука, прослушивание, свой файл */
.vd-sound-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.vd-sound-name { min-width: 84px; font-size: 0.9rem; }
.vd-sound-row select { flex: 1 1 130px; min-width: 0; }
.vd-sound-file { font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.vd-side .vd-tabs { position: sticky; top: 0; z-index: 4; background: #fff; }
.vd-app .vd-hint { color: #64748b; font-size: 0.82rem; line-height: 1.35; margin: 4px 0; }
.vd-app .vd-hint.is-warn { color: #b45309; }
.vd-side .st-group { margin-bottom: 14px; }
.vd-app p { margin: 0; }

/* Свойства шага */
.vd-step-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.vd-kind { font-size: 0.72rem; padding: 2px 7px; border-radius: 999px; background: #e2e8f0; color: #334155; }
.vd-kind.is-enter, .vd-kind.is-up { background: #fef3c7; color: #92400e; }
.vd-kind.is-hold { background: #ede9fe; color: #5b21b6; }
.vd-kind.is-frame { background: #dcfce7; color: #166534; }

.vd-phrases { display: flex; flex-direction: column; gap: 8px; }
.vd-phrase { border: 1px solid #dde3ea; border-radius: 8px; padding: 8px; background: #f8fafc; display: flex; flex-direction: column; gap: 6px; }
/* Язык фразы: плашка (всегда видна) и тело с полями (прячется). На плашке - пиктограммы того, что внутри */
.vd-phrase-lang { display: flex; flex-direction: column; gap: 4px; }
.vd-lang-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 4px 8px; border: 1px solid #dde3ea; border-radius: 6px; background: #fff; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.vd-lang-head:hover { background: #f1f5f9; }
.vd-lang-arrow { width: 1em; color: #64748b; }
.vd-lang-arrow::before { content: '▸'; }
.vd-phrase-lang.is-open .vd-lang-arrow::before { content: '▾'; }
.vd-lang-icons { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; }
.vd-ico { font-size: 0.95rem; line-height: 1; }
.vd-ico.is-off { opacity: 0.28; filter: grayscale(1); }
.vd-phrase-body { display: flex; flex-direction: column; gap: 4px; padding: 2px 0 6px 14px; }
.vd-phrase-body[hidden] { display: none; }
.vd-phrase-code { font-size: 0.75rem; font-weight: 700; color: #475569; min-width: 2.2em; }
.vd-phrase-fields { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.vd-phrase-bar { grid-column: 2; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.vd-text { width: 100%; resize: vertical; font: inherit; font-size: 0.88rem; }
.vd-speak { font-size: 0.8rem; color: #475569; }
.vd-badge { font-size: 0.72rem; padding: 1px 7px; border-radius: 999px; background: #e2e8f0; color: #334155; }
.vd-badge.is-ok { background: #dcfce7; color: #166534; }
.vd-badge.is-missing { background: #fee2e2; color: #991b1b; }
.vd-badge.is-error { background: #fee2e2; color: #991b1b; }
.vd-badge.is-outdated, .vd-badge.is-otherVoice, .vd-badge.is-balance { background: #fef3c7; color: #92400e; }
.vd-badge.is-queued, .vd-badge.is-running { background: #dbeafe; color: #1e40af; }

.vd-lang { border: 1px solid #dde3ea; border-radius: 8px; padding: 8px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 6px; background: #fff; }
.vd-flags { display: inline-flex; gap: 10px; margin-left: auto; font-size: 0.8rem; }

/* Текст на кадре: сам текст, затем подписанные поля шрифта и положения, тень, подложка */
.vd-text-card { border: 1px solid #dde3ea; border-radius: 8px; padding: 8px; margin-bottom: 8px; background: #f8fafc; display: flex; flex-direction: column; gap: 6px; }
.vd-text-head { display: flex; align-items: flex-start; gap: 4px; }
.vd-text-head .vd-text { flex: 1 1 auto; min-width: 0; }
/* align-items: end - подпись может занять две строки, поля при этом остаются на одной линии */
.vd-text-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; align-items: end; }
.vd-text-sub { padding-left: 4px; border-left: 3px solid #cbd5e1; }
.vd-field { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vd-field-label { font-size: 0.72rem; color: #64748b; line-height: 1.15; }
.vd-field .st-input { width: 100%; }
.vd-text-toggle { font-size: 0.85rem; }
.vd-color { width: 32px; height: 28px; padding: 0; border: 1px solid #cbd5e1; border-radius: 5px; background: #fff; }
.vd-field .vd-color { width: 100%; }
.vd-block-name { flex: 1 1 120px; font-size: 0.85rem; }

/* Таблица «Тексты» */
.vd-texts { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-top: 8px; }
.vd-texts th, .vd-texts td { border: 1px solid #e2e8f0; padding: 3px; vertical-align: top; position: relative; }
.vd-texts th { background: #f1f5f9; font-weight: 600; }
.vd-texts-name { white-space: nowrap; }
.vd-texts td.is-empty { background: #fef2f2; }
.vd-texts td.is-outdated { background: #fffbeb; }
.vd-link { border: 0; background: none; color: #1d4ed8; cursor: pointer; font: inherit; padding: 2px; }
.vd-dot { position: absolute; right: 4px; bottom: 4px; width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.vd-dot.is-ok { background: #16a34a; }
.vd-dot.is-missing, .vd-dot.is-error { background: #dc2626; }
.vd-dot.is-outdated, .vd-dot.is-otherVoice, .vd-dot.is-balance { background: #d97706; }
.vd-dot.is-queued, .vd-dot.is-running { background: #2563eb; }

/* Компоновки ролика и формат просмотра */
.vd-format { align-self: center; }
.vd-format .st-seg-btn { padding: 4px 10px; }
.vd-layout-row { display: flex; align-items: center; gap: 6px; padding: 3px 4px; border-radius: 6px; }
.vd-layout-row.is-current { background: #eff6ff; }
.vd-layout-name { flex: 1 1 auto; min-width: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vd-layout-row.is-current .vd-layout-name { font-weight: 600; }
.vd-layout-add { flex-wrap: wrap; margin-top: 6px; }
.vd-layout-title { flex: 1 1 auto; min-width: 0; font-weight: 600; }

/* Шкала времени */
.vd-timeline { border: 1px solid #dde3ea; border-radius: 8px; background: #fff; padding: 8px; }
.vd-tl-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; font-size: 0.85rem; }
.vd-tl-summary { margin-left: auto; color: #64748b; }
.vd-tl-frame { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 0; }
.vd-tl-labels { display: flex; flex-direction: column; font-size: 0.75rem; color: #475569; }
.vd-lane-labels { display: flex; flex-direction: column; }
.vd-lane-label { height: 30px; display: flex; align-items: center; padding-right: 6px; border-bottom: 1px solid #f1f5f9; font-weight: 600; }
.vd-lane-label-steps { height: 38px; }
.vd-tl-scroll { overflow-x: auto; overflow-y: hidden; position: relative; }
.vd-tl-content { position: relative; min-width: 100%; }
.vd-lane { position: relative; height: 30px; border-bottom: 1px solid #f1f5f9; }
.vd-lane-steps { height: 38px; }
.vd-lane-music { height: 40px; }
.vd-lanes { display: flex; flex-direction: column; }
.vd-step { position: absolute; top: 3px; height: 32px; padding: 0 4px; border: 1px solid #94a3b8; border-radius: 5px; background: #e2e8f0; color: #1e293b; font-size: 0.75rem; overflow: hidden; white-space: nowrap; cursor: pointer; text-align: left; }
.vd-step.is-start { background: #f1f5f9; }
.vd-step.is-frame { background: #dcfce7; border-color: #86efac; }
.vd-step.is-enter, .vd-step.is-up { background: #fef3c7; border-color: #fcd34d; }
.vd-step.is-hold { background: #ede9fe; border-color: #c4b5fd; }
.vd-step.is-position { background: #dbeafe; border-color: #93c5fd; }
.vd-step.is-branch { border-style: dashed; }
.vd-step.is-orphan { outline: 2px solid #dc2626; }
.vd-step.is-stretched { box-shadow: inset -4px 0 0 #f59e0b; }
.vd-step.is-selected { outline: 2px solid #2563eb; z-index: 2; }
.vd-step-mark { margin-left: 3px; color: #2563eb; }
.vd-bar { position: absolute; top: 4px; height: 22px; border-radius: 4px; background: #93c5fd; color: #1e3a8a; font-size: 0.7rem; padding: 0 3px; overflow: hidden; white-space: nowrap; cursor: pointer; line-height: 22px; }
.vd-bar.is-missing { background: #fecaca; color: #991b1b; border: 1px dashed #dc2626; text-align: center; }
.vd-music-canvas { display: block; height: 40px; }
.vd-playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: #dc2626; pointer-events: none; z-index: 5; }

@media (max-width: 1100px) {
    .vd-main { grid-template-columns: minmax(0, 1fr); }
    .vd-side { max-height: none; }
}

/* ══ Редактор на всё окно: страницы (Tasks/WBChess_TZ_studio_redesign.md, §10) ══════════════════════════════════
   Каркас - css/studio-shell.css (верхняя полоса, полоса этапов, .ss-work). Здесь - сетка по data-page и содержимое страниц. */

#videoApp { height: 100%; display: block; min-height: 0; }
#vdList, #vdLogin { height: 100vh; height: 100dvh; overflow: auto; padding: 16px 24px; box-sizing: border-box; }
#vdNotice { position: fixed; top: 8px; left: 50%; transform: translateX(-50%); z-index: 2000; max-width: 80vw; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2); }
#vdEditor.ss-app { height: 100%; }
.vd-title { flex: 0 1 380px; min-width: 120px; font-weight: 600; }
.ss-top .vd-sound { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; }
.ss-top .vd-sound .st-input { padding: 4px 6px; }

.vd-work {
    grid-template-columns: minmax(0, 1fr) 480px;
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas:
        "script stage"
        "script transport"
        "script .";
    align-content: start;
}

.vd-cell { min-width: 0; min-height: 0; }
.vd-cell[hidden] { display: none !important; }
.vd-cell-script { grid-area: script; overflow-y: auto; padding: 0 6px 24px 0; }
.vd-cell-stage { grid-area: stage; position: relative; aspect-ratio: 16 / 9; width: 100%; align-self: start; }
.vd-cell-transport { grid-area: transport; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; align-self: start; }
.vd-cell-page, .vd-cell-cards, .vd-cell-bar, .vd-cell-ribbon { overflow: auto; }

.vd-cell-stage .st-wrap { position: absolute; inset: 0; max-height: none; background: transparent; box-shadow: none; border-radius: 0; }
.vd-cell-stage .st-wrap-fit { position: absolute; inset: 0; width: auto; aspect-ratio: auto; max-height: none; }
.vd-cell-stage .studio-stage { border-radius: 12px; box-shadow: 0 2px 14px rgba(0, 0, 0, 0.35); }

/* Страницы без сцены: сцена остаётся в документе с прежним размером (visibility, а не display: none) */
.ss-app[data-page="voice"] .vd-cell-stage,
.ss-app[data-page="sound"] .vd-cell-stage,
.ss-app[data-page="record"] .vd-cell-stage {
    position: absolute; left: 0; top: 0; width: 960px; height: 540px; visibility: hidden; pointer-events: none;
}

.ss-app[data-page="voice"] .vd-work,
.ss-app[data-page="sound"] .vd-work,
.ss-app[data-page="record"] .vd-work {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    grid-template-areas: "page";
}
.vd-cell-voice, .vd-cell-sound, .vd-cell-record { grid-area: page; }
.vd-cell-page { background: var(--c-surface, #fff); border: 1px solid var(--c-border, #dfe4ef); border-radius: 12px; padding: 12px 14px; }

/* «Оформление»: слева сцены, над сценой инструменты, под ней лента шагов */
.ss-app[data-page="design"] .vd-work {
    grid-template-columns: 250px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas:
        "cards bar"
        "cards stage"
        "cards ribbon";
}
.ss-app[data-page="design"] .vd-cell-stage { aspect-ratio: auto; height: 100%; align-self: stretch; }
.vd-cell-cards { grid-area: cards; padding-right: 4px; }
.vd-cell-bar { grid-area: bar; }
.vd-cell-ribbon { grid-area: ribbon; max-height: 118px; }
.vd-bar-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 2px 0 6px; }
.vd-bar-row .vd-layout-title { flex: 0 1 240px; }
.vd-cards-add { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.vd-menu-wrap { position: relative; }
.vd-menu-wrap .st-btn { width: 100%; }
.vd-menu { position: absolute; z-index: 30; left: 0; right: 0; bottom: 100%; margin-bottom: 4px; display: flex; flex-direction: column; background: var(--c-surface, #fff); border: 1px solid var(--c-border, #dfe4ef); border-radius: 10px; box-shadow: var(--c-shadow, 0 6px 20px rgba(0, 0, 0, 0.18)); padding: 4px; }
.vd-menu[hidden] { display: none; }
.vd-menu-item { text-align: left; border: 0; background: transparent; padding: 7px 10px; border-radius: 6px; font: inherit; color: inherit; cursor: pointer; }
.vd-menu-item:hover { background: var(--c-accent-soft, #eceffd); }
.vd-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin: 8px 0; }
.vd-picker-item { display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid var(--c-border, #dfe4ef); border-radius: 10px; cursor: pointer; }
.vd-picker-item:has(input:checked) { border-color: var(--c-accent, #5568e0); background: var(--c-accent-soft, #eceffd); }

.vd-ribbon-step {
    --stripe: #2563eb;
    flex: 0 0 auto; display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px;
    min-width: 74px; max-width: 150px; padding: 5px 8px 4px; margin: 0 4px 4px 0;
    border: 1px solid var(--c-border, #dfe4ef); border-bottom: 4px solid var(--stripe); border-radius: 8px;
    background: var(--c-surface, #fff); color: inherit; font: inherit; font-size: 0.78rem; cursor: pointer; text-align: left;
}
#vdRibbon { display: flex; flex-wrap: wrap; }
.vd-ribbon-step.is-selected { outline: 2px solid var(--c-accent, #5568e0); }
.vd-ribbon-num { font-size: 0.7rem; color: var(--c-muted, #5b6784); }
.vd-ribbon-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* Всплывающая панель редактора */
.vd-pop { right: 24px; bottom: 24px; width: 420px; max-height: calc(100vh - 150px); }
.vd-pop.is-wide { width: 560px; }
.vd-pop-body { display: flex; flex-direction: column; gap: 8px; }

/* Просмотр на всё окно: сцена растянута, Esc закрывает */
.ss-app.is-full .vd-cell-stage {
    position: fixed; inset: 0; width: auto; height: auto; aspect-ratio: auto; z-index: 1500; background: #000;
    visibility: visible; pointer-events: auto;
    /* align-self: start у обычного места сцены сжало бы закреплённый блок по высоте содержимого */
    align-self: stretch; justify-self: stretch;
}
.ss-app.is-full .vd-cell-stage .studio-stage { border-radius: 0; box-shadow: none; }
.vd-fullbar { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 5; display: flex; gap: 8px; opacity: 0.85; }
.vd-fullbar[hidden] { display: none; }

/* «Сценарий»: список шагов как текст */
.vs-tools { display: flex; align-items: center; gap: 8px; padding: 2px 0 8px; position: sticky; top: 0; z-index: 3; background: var(--c-bg, #f5f7fb); }
.vs-total { margin-left: auto; font-size: 0.82rem; color: var(--c-muted, #5b6784); }
.vs-list { display: flex; flex-direction: column; }
.vs-item { position: relative; }
.vs-row {
    --depth: 0;
    display: grid; grid-template-columns: 34px minmax(110px, 200px) minmax(0, 1fr) auto; gap: 6px 8px; align-items: start;
    padding: 5px 8px 5px calc(8px + var(--depth) * 16px);
    border: 1px solid transparent; border-radius: 10px; background: var(--c-surface, #fff);
}
.vs-row:hover { border-color: var(--c-border, #dfe4ef); }
.vs-row.is-selected { border-color: var(--c-accent, #5568e0); box-shadow: inset 0 0 0 1px var(--c-accent, #5568e0); }
.vs-row.is-branch { border-left: 3px solid #d97706; }
.vs-row.is-orphan { outline: 1px solid #dc2626; }
.vs-num { border: 0; background: var(--c-surface-2, #eef1f8); border-radius: 50%; width: 28px; height: 28px; font: inherit; font-size: 0.78rem; color: var(--c-muted, #5b6784); cursor: pointer; }
.vs-label { border: 0; background: transparent; padding: 4px 0; font: inherit; font-weight: 600; text-align: left; color: inherit; cursor: pointer; overflow-wrap: anywhere; }
.vs-row.is-enter .vs-label, .vs-row.is-up .vs-label { color: #b45309; }
.vs-row.is-hold .vs-label { color: #7c3aed; }
.vs-row.is-frame .vs-label { color: #15803d; font-weight: 500; }
.vs-fields { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.vs-field { display: flex; align-items: flex-start; gap: 4px; }
.vs-text, textarea.st-input.vs-text { flex: 1 1 auto; min-width: 0; min-height: 32px; resize: none; overflow: hidden; font: inherit; font-size: 0.92rem; line-height: 1.35; padding: 4px 8px; }
.vs-field-side { display: flex; gap: 2px; }
.vs-field-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.vs-add { opacity: 0.75; }
.vs-icons { display: flex; align-items: center; gap: 2px; }
.vs-ico { min-width: 30px; height: 28px; padding: 0 6px; border: 1px solid transparent; border-radius: 7px; background: transparent; font: inherit; font-size: 0.8rem; color: var(--c-muted, #5b6784); opacity: 0.55; cursor: pointer; font-variant-numeric: tabular-nums; }
.vs-ico:hover, .vs-ico.is-open { opacity: 1; border-color: var(--c-border, #dfe4ef); }
.vs-ico.is-set { color: var(--c-accent-text, #4455c8); background: var(--c-accent-soft, #eceffd); opacity: 1; }
.vs-panel { margin: 2px 0 6px 42px; padding: 8px 12px; border: 1px solid var(--c-border, #dfe4ef); border-radius: 10px; background: var(--c-surface, #fff); }
.vs-panel[hidden] { display: none; }
.vs-gap { height: 6px; position: relative; }
.vs-gap-btn { position: absolute; left: 50%; top: -9px; transform: translateX(-50%); z-index: 2; padding: 1px 10px; border: 1px dashed var(--c-border, #dfe4ef); border-radius: 999px; background: var(--c-surface, #fff); font: inherit; font-size: 0.72rem; color: var(--c-muted, #5b6784); cursor: pointer; opacity: 0; }
.vs-gap:hover .vs-gap-btn, .vs-gap-btn:focus { opacity: 1; }
.vs-lost, .vs-hidden { margin: 6px 0; padding: 8px 12px; border: 1px solid #fde68a; border-radius: 10px; background: #fffbeb; color: #92400e; }
.vd-caption { flex: 1 1 100%; padding: 6px 2px; }
.vd-caption-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vd-caption-text { margin-top: 4px; font-size: 0.95rem; line-height: 1.4; }

/* «Озвучка» */
.vv-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-bottom: 10px; }
.vv-lang { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: 1px solid var(--c-border, #dfe4ef); border-radius: 999px; background: var(--c-surface, #fff); font: inherit; font-size: 0.85rem; color: inherit; cursor: pointer; }
.vv-lang:hover { border-color: var(--c-accent, #5568e0); }
.vv-lang-name { color: var(--c-muted, #5b6784); }
.vv-lang-count { font-variant-numeric: tabular-nums; font-size: 0.78rem; padding: 0 6px; border-radius: 999px; background: var(--c-surface-2, #eef1f8); }
.vv-lang-count.is-done { background: #dcfce7; color: #166534; }
.vv-lang-flag { color: #d97706; }
.vv-lang-add { border-style: dashed; }
.vv-spacer { flex: 1 1 auto; }
/* Прокручивается только таблица: страница «Озвучка» занимает ячейку целиком, полоса прокрутки таблицы - у её нижнего края */
.vd-cell-voice:not([hidden]) { display: flex; flex-direction: column; }
#vdVoiceBody { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.vv-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; }
/* Столбец языка не уже 320px: при многих языках таблица шире окна и листается вбок, первый столбец остаётся на месте */
.vv-table { table-layout: fixed; min-width: calc(190px + var(--vv-langs, 1) * 320px); }
.vv-table th:first-child, .vv-table td:first-child { width: 190px; }
.vv-table th:first-child, .vv-table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--c-surface, #fff); }
.vv-table thead th { position: sticky; top: 0; z-index: 2; }
.vv-table thead th:first-child { z-index: 3; background: #f1f5f9; }
.vv-first { vertical-align: top; }
.vv-code { display: block; font-size: 0.72rem; color: var(--c-muted, #5b6784); }
.vv-row-actions { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; align-items: flex-start; }
.vv-cell .vd-phrase-bar { margin-top: 4px; }
/* Полоса ячейки в одну строку: слева состояние, длительность и значки, справа кнопки-значки */
.vv-cell .vv-bar { flex-wrap: nowrap; justify-content: space-between; gap: 6px; }
.vv-bar-info { display: inline-flex; align-items: center; gap: 4px; min-width: 0; overflow: hidden; }
.vv-bar-tools { display: inline-flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.vv-ico { min-width: 22px; height: 22px; padding: 0 3px; font-size: 0.82rem; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.vv-cell .vd-badge { padding: 1px 5px; white-space: nowrap; }
.vv-chip { cursor: help; }
.vv-speak-toggle { opacity: 0.55; }
.vv-speak-toggle.is-on { opacity: 1; border-color: var(--c-accent, #5568e0); }
.vv-dur { font-size: 0.72rem; color: var(--c-muted, #5b6784); white-space: nowrap; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
/* Заметная разница длины языков в шаге: жёлтая - догоняется скоростью озвучки, красная - нужен перевод короче.
   Полоса слева, а не фон: фон ячейки уже говорит о пустом тексте и устаревшем переводе */
.vd-texts td.is-fit-rate { box-shadow: inset 4px 0 0 #d97706; }
.vd-texts td.is-fit-translate { box-shadow: inset 4px 0 0 #dc2626; }
.vd-badge.is-fit-rate { background: #fde68a; color: #78350f; }
.vd-badge.is-fit-translate { background: #fecaca; color: #7f1d1d; }
.vv-fit-btn.is-fit-rate { border-color: #d97706; }
.vv-fit-btn.is-fit-translate { border-color: #dc2626; }
.vd-bar.is-fit-rate { background: #fcd34d; color: #78350f; }
.vd-bar.is-fit-translate { background: #fca5a5; color: #7f1d1d; }

/* «Звук» */
.vd-cell-sound { overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.vd-cell-sound .vd-timeline { margin-top: 6px; }

/* «Запись» */
.vr-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; max-width: 1100px; }
.vr-col { display: flex; flex-direction: column; gap: 12px; }
.vr-ready-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.vr-ready-row.is-done .vr-ready-text { color: #15803d; }
.vr-rec-row { display: flex; flex-direction: column; padding: 4px 0; border-top: 1px solid var(--c-border, #dfe4ef); }
.vr-gap { margin-top: 8px; }
.vr-go { align-self: flex-start; text-decoration: none; padding: 10px 18px; }

/* Наборы звуков ходов: выбор набора и окно правки */
.vd-sset { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.vd-sset .st-row { flex-wrap: wrap; gap: 6px; }
.vd-sset-dialog { width: min(980px, 96vw); max-height: 92vh; overflow: auto; }
.vd-sset-bind { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.vd-sset-tabs { align-self: flex-start; margin: 10px 0; }
.vd-sset-grid {
    display: grid;
    grid-template-columns: 150px repeat(4, minmax(0, 1fr));
    gap: 6px 8px;
    align-items: center;
}
.vd-sset-head { font-size: 0.8rem; text-align: center; }
.vd-sset-label { display: flex; flex-direction: column; gap: 2px; font-size: 0.85rem; }
.vd-sset-bymove { font-size: 0.75rem; font-weight: 400; }
.vd-sset-row { display: contents; }
.vd-sset-row[hidden] { display: contents; visibility: hidden; }
.vd-sset-cell { display: flex; gap: 4px; align-items: center; min-width: 0; }
.vd-sset-cell .st-input { min-width: 0; flex: 1 1 auto; padding: 4px 6px; }
.vd-sset-results { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 10px; margin-top: 12px; }
.vd-sset-results > b { grid-column: 1 / -1; }

@media (max-width: 1200px) {
    .vd-work { grid-template-columns: minmax(0, 1fr) 400px; }
    .ss-app[data-page="design"] .vd-work { grid-template-columns: 210px minmax(0, 1fr); }
}
