/*
 * GAPIT Voice — socle de la scène de dialogue professionnelle.
 *
 * Cette feuille est chargée après les feuilles historiques. Elle centralise
 * les dimensions sans renommer ni déplacer les organes fonctionnels actuels.
 * Les prochains sprints pourront modifier la composition en ne changeant que
 * ces variables et les règles de grille.
 */

:root {
    --voice-ui-scale: 1;
    --voice-character-scale: 1;
    --voice-professor-scale: 1;
    --voice-translator-scale: 1;
    --voice-transcript-scale: 1;
    --voice-translation-scale: 1;
    --voice-controls-scale: 1;
    --voice-visitor-scale: 1;

    --voice-stage-gap: clamp(8px, 1.2vw, 18px);
    --voice-stage-pad: clamp(8px, 1.4vw, 22px);
    --voice-control-size: clamp(36px, 3.2vw, 46px);
    --voice-visitor-size: clamp(72px, 8vw, 112px);
    --voice-translator-size: clamp(58px, 7vw, 96px);
    --voice-panel-radius: clamp(14px, 1.6vw, 22px);
    --voice-panel-border: 2px;
    --voice-panel-shadow: 0 14px 36px rgba(8, 20, 45, .18);
    --voice-panel-bg: rgba(255, 255, 255, .96);
    --voice-transcript-bg: #fffdf0;
    --voice-translation-bg: #effcf2;
    --voice-focus-ring: 0 0 0 3px rgba(53, 114, 239, .28);
}

body[data-voice-section="translate"],
body[data-voice-section="record"],
body[data-voice-section="pingpong"] {
    --voice-stage-width: min(1440px, 100vw);
    font-family: "Segoe UI", Arial, sans-serif;
}

/* Les dimensions existantes deviennent pilotables par les variables. */
body[data-voice-section] #nv-profile-bubble {
    width: calc(var(--voice-visitor-size) * var(--voice-ui-scale) * var(--voice-visitor-scale)) !important;
    height: calc(var(--voice-visitor-size) * var(--voice-ui-scale) * var(--voice-visitor-scale)) !important;
    border-radius: 50%;
    filter: drop-shadow(0 10px 18px rgba(5, 15, 35, .18));
}

body[data-voice-section] #nvListenFigurineMain {
    width: calc(var(--voice-translator-size) * var(--voice-ui-scale) * var(--voice-character-scale) * var(--voice-translator-scale)) !important;
    max-height: 132px;
    object-fit: contain;
}

body[data-voice-section] #nvTranstextePopup,
body[data-voice-section] #nvResultHeader {
    border: var(--voice-panel-border) solid rgba(24, 36, 58, .82) !important;
    border-radius: var(--voice-panel-radius) !important;
    box-shadow: var(--voice-panel-shadow) !important;
    backdrop-filter: blur(10px);
}

body[data-voice-section] #nvTranstextePopup {
    background: var(--voice-panel-bg) !important;
    transform-origin: center;
}

body[data-voice-section] #transcript {
    background: var(--voice-transcript-bg) !important;
    font-size: calc(clamp(14px, 1.25vw, 20px) * var(--voice-transcript-scale));
    border-width: 1px !important;
    border-color: rgba(47, 59, 80, .36) !important;
    border-radius: calc(var(--voice-panel-radius) - 5px) !important;
}

body[data-voice-section] #translation {
    background: var(--voice-translation-bg) !important;
    font-size: calc(clamp(14px, 1.25vw, 20px) * var(--voice-translation-scale));
    border-width: 1px !important;
    border-color: rgba(38, 98, 61, .34) !important;
    border-radius: calc(var(--voice-panel-radius) - 5px) !important;
}

body[data-voice-section] #transcript:focus,
body[data-voice-section] #translation:focus {
    outline: none;
    box-shadow: var(--voice-focus-ring);
}

body[data-voice-section] .nv-act-btn,
body[data-voice-section] #nvListenTranslationBtn,
body[data-voice-section] #copyTranslationIcon {
    width: calc(var(--voice-control-size) * var(--voice-ui-scale) * var(--voice-controls-scale)) !important;
    height: calc(var(--voice-control-size) * var(--voice-ui-scale) * var(--voice-controls-scale)) !important;
    min-width: calc(var(--voice-control-size) * var(--voice-ui-scale) * var(--voice-controls-scale)) !important;
    min-height: calc(var(--voice-control-size) * var(--voice-ui-scale) * var(--voice-controls-scale)) !important;
    max-width: none !important;
    flex: 0 0 auto !important;
    padding: 7px !important;
    border: 1px solid rgba(255, 255, 255, .24) !important;
    border-radius: 13px !important;
    color: #fff !important;
    background: linear-gradient(155deg, #315f9f, #1d3e70) !important;
    box-shadow: 0 6px 14px rgba(19, 45, 84, .24), inset 0 1px 0 rgba(255,255,255,.16) !important;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

body[data-voice-section] .nv-act-btn:hover,
body[data-voice-section] .nv-act-btn:focus-visible,
body[data-voice-section] #nvListenTranslationBtn:hover,
body[data-voice-section] #copyTranslationIcon:hover {
    transform: translateY(-2px) !important;
    background: linear-gradient(155deg, #3d73bb, #244f8b) !important;
    box-shadow: 0 10px 22px rgba(19, 45, 84, .3), inset 0 1px 0 rgba(255,255,255,.2) !important;
}

body[data-voice-section] .nv-act-btn img,
body[data-voice-section] #copyTranslationIcon img {
    width: 23px !important;
    height: 23px !important;
    filter: brightness(0) invert(1);
}

body[data-voice-section] .nv-act-btn span,
body[data-voice-section] #nvListenTranslationBtn span {
    color: #fff !important;
    font-size: 20px !important;
}

body[data-voice-section] #afflngvisit {
    width: auto !important;
    min-width: 68px !important;
    height: calc(var(--voice-control-size) * var(--voice-ui-scale) * var(--voice-controls-scale)) !important;
    padding: 5px 10px !important;
    border: 1px solid rgba(255,255,255,.28) !important;
    border-radius: 13px !important;
    color: #fff !important;
    background: linear-gradient(155deg, #243f68, #132943) !important;
    box-shadow: 0 6px 14px rgba(19,45,84,.2) !important;
}

body[data-voice-section] #afflngvisit-code { color: #fff !important; }

/* Couleurs fonctionnelles : contenu, sauvegarde, suppression, informations. */
body[data-voice-section] #phrasesIconBtn {
    background: linear-gradient(155deg, #7655bd, #4f328f) !important;
}
body[data-voice-section] #nvSaveToNoteBtn {
    background: linear-gradient(155deg, #188c76, #0b6655) !important;
}
body[data-voice-section] #nvClearTranscriptBtn {
    background: linear-gradient(155deg, #c6535d, #91333c) !important;
}
body[data-voice-section] #nvInfoBtn {
    background: linear-gradient(155deg, #4f75b7, #2e4f88) !important;
}
body[data-voice-section] #nvSettingsCtrlBtn {
    background: linear-gradient(155deg, #667085, #3e4758) !important;
}

/* Pavé traduction : composition réelle, sans table historique. */
body[data-voice-section] #nvResultHeader {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    padding: 10px !important;
    background: var(--voice-panel-bg) !important;
}
body[data-voice-section] .nv-translation-toolbar {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) auto auto;
    align-items: center;
    gap: 9px;
    min-height: 58px;
    padding: 6px 8px;
    border: 1px solid rgba(38,98,61,.14);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(245,253,248,.98), rgba(226,242,232,.96));
}
body[data-voice-section] .nv-translator-identity {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
body[data-voice-section] .nv-translator-identity #nvListenFigurineMain {
    width: calc(var(--voice-translator-size) * .72 * var(--voice-ui-scale) * var(--voice-character-scale)) !important;
    max-height: 62px !important;
    margin: 0 !important;
}
body[data-voice-section] .nv-translator-identity #nvResultLangMeta {
    align-items: flex-start !important;
    text-align: left !important;
}
body[data-voice-section] .nv-translator-identity #nvSpokenLangLabel {
    color: #244d37 !important;
    font-size: 13px !important;
}
body[data-voice-section] #nvResultPhoneticInline {
    flex-direction: row !important;
    min-width: auto !important;
    padding: 6px 8px !important;
}
body[data-voice-section] .nv-translation-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
body[data-voice-section] .nv-translation-actions #copyTranslationIcon,
body[data-voice-section] .nv-translation-actions #nvListenTranslationBtn {
    width: calc(var(--voice-control-size) * var(--voice-ui-scale) * var(--voice-controls-scale)) !important;
    height: calc(var(--voice-control-size) * var(--voice-ui-scale) * var(--voice-controls-scale)) !important;
    margin: 0 !important;
}
body[data-voice-section] #nvResultHeader .nv-header-translation-wrap {
    width: 100% !important;
    flex: 1 1 auto !important;
}
body[data-voice-section] #nvResultHeader #translation {
    width: 100% !important;
    min-height: 84px !important;
    box-sizing: border-box !important;
}

@media (max-width: 620px) {
    body[data-voice-section] .nv-translation-toolbar {
        grid-template-columns: minmax(100px, 1fr) auto;
    }
    body[data-voice-section] .nv-translation-toolbar #nvResultPhoneticInline {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-self: stretch;
        justify-content: center;
    }
    body[data-voice-section] .nv-translation-actions { justify-self: end; }
}

body[data-voice-section] #nvResultPhoneticInline {
    min-width: 58px;
    border: 1px solid rgba(38,98,61,.18) !important;
    background: rgba(255,255,255,.72) !important;
}

/* Bibliothèque linguistique : fenêtre commune Phrases / Mots. */
body[data-voice-section] #phrasesTypesMenu.phrases-types-menu {
    top: 14px !important;
    left: 50% !important;
    width: min(760px, calc(100vw - 28px)) !important;
    padding: 0 14px 14px !important;
    overflow: auto !important;
    color: #17243a;
    border: 1px solid rgba(31, 55, 91, .28) !important;
    border-radius: 20px !important;
    background: linear-gradient(180deg, rgba(252,253,255,.99), rgba(238,243,251,.99)) !important;
    box-shadow: 0 24px 65px rgba(15, 31, 55, .34), 0 2px 0 rgba(255,255,255,.9) inset !important;
    transform: translateX(-50%);
}
body[data-voice-section] #phrasesMenuGrip {
    margin: 0 -14px 0 !important;
    padding: 5px 0 !important;
    color: #8b99ac !important;
    border: 0 !important;
    background: rgba(220,228,240,.64);
}
body[data-voice-section] #phrasesExpandBtn,
body[data-voice-section] .voice-legacy-words-btn { display: none !important; }
body[data-voice-section] .phrases-close-btn {
    position: absolute;
    top: 8px;
    right: 9px;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 31px;
    height: 31px;
    padding: 0;
    color: #fff;
    border: 1px solid rgba(255,255,255,.28);
    border-radius: 50%;
    background: linear-gradient(155deg, #c6535d, #91333c);
    box-shadow: 0 5px 12px rgba(145,51,60,.24);
    font-size: 15px;
    font-weight: 900;
    cursor: pointer;
}
body[data-voice-section] .voice-library-tabs {
    display: flex;
    gap: 5px;
    padding: 4px;
    border-radius: 12px;
    background: #dfe7f3;
}
body[data-voice-section] .voice-library-tab {
    min-height: 34px;
    padding: 6px 11px;
    color: #43536c;
    border: 0;
    border-radius: 9px;
    background: transparent;
    font: 700 12px 'Segoe UI', Arial, sans-serif;
    cursor: pointer;
}
body[data-voice-section] .voice-library-tab.active {
    color: #fff;
    background: linear-gradient(155deg, #355d94, #203d66);
    box-shadow: 0 4px 10px rgba(27,55,91,.25);
}
body[data-voice-section] #phrasesTypesMenu .phrase-page.active {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}
body[data-voice-section] #phrasesTypesMenu .phrase-item {
    min-height: 44px;
    margin: 0 !important;
    padding: 7px 8px !important;
    overflow: visible;
    border: 1px solid rgba(42,65,98,.14) !important;
    border-radius: 12px !important;
    background: rgba(255,255,255,.9) !important;
    box-shadow: 0 2px 6px rgba(27,44,69,.05);
}
body[data-voice-section] #phrasesTypesMenu .phrase-item:hover,
body[data-voice-section] #phrasesTypesMenu .phrase-item:focus-within {
    border-color: rgba(53,93,148,.42) !important;
    background: #f4f8ff !important;
    box-shadow: 0 5px 14px rgba(32,61,102,.12);
}
body[data-voice-section] #phrasesTypesMenu .phrase-main { overflow: visible !important; }
body[data-voice-section] #phrasesTypesMenu .phrase-text {
    overflow: hidden;
    white-space: normal !important;
    line-height: 1.25;
}
body[data-voice-section] #phrasesTypesMenu .phrase-listen-link {
    color: #284d7d;
    border-color: rgba(40,77,125,.22) !important;
    background: #edf4ff !important;
}
body[data-voice-section] #phrasesTypesMenu .phrase-pagination,
body[data-voice-section] #phrasesTypesMenu .images-grid-pagination {
    position: sticky;
    bottom: 0;
    padding: 9px;
    border-radius: 13px;
    background: rgba(236,242,250,.96);
    backdrop-filter: blur(8px);
}
body[data-voice-section] #phrasesTypesMenu .phrase-pagination {
    flex-wrap: wrap;
}
body[data-voice-section] #phrasesTypesMenu .phrase-pagination .voice-library-tabs {
    flex: 1 0 100%;
    justify-content: center;
    margin-bottom: 2px;
}
body[data-voice-section] #phrasesTypesMenu .phrase-nav-btn {
    border: 1px solid rgba(255,255,255,.2) !important;
    background: linear-gradient(155deg, #355d94, #203d66) !important;
    box-shadow: 0 4px 10px rgba(27,55,91,.2);
}
body[data-voice-section] #phrasesTypesMenu #motsBtn {
    background: linear-gradient(155deg, #7655bd, #4f328f) !important;
}
body[data-voice-section] #phrasesTypesMenu .images-grid-header {
    justify-content: space-between !important;
    margin: 0 0 8px !important;
}
body[data-voice-section] .voice-word-search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 7px 10px;
    border: 1px solid rgba(42,65,98,.16);
    border-radius: 12px;
    background: rgba(255,255,255,.88);
}
body[data-voice-section] .voice-word-search input {
    flex: 1;
    min-width: 0;
    padding: 3px 0;
    color: #1e2c42;
    border: 0;
    outline: 0;
    background: transparent;
    font: 600 13px 'Segoe UI', Arial, sans-serif;
}
body[data-voice-section] .voice-word-count {
    color: #718096;
    font-size: 10px;
    white-space: nowrap;
}
body[data-voice-section] #imagesGridContainer.images-grid-container {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 9px !important;
}
body[data-voice-section] #imagesGridContainer .voice-word-card {
    position: relative;
    min-width: 0;
    padding: 8px 5px 6px !important;
    cursor: default !important;
    border-color: rgba(42,65,98,.14) !important;
    background: rgba(255,255,255,.94) !important;
}
body[data-voice-section] #imagesGridContainer .voice-word-image {
    width: 72px !important;
    height: 62px !important;
    cursor: pointer;
    pointer-events: auto !important;
}
body[data-voice-section] #imagesGridContainer .voice-word-label {
    max-width: 100% !important;
    color: #253653 !important;
    font-size: 11px !important;
}
body[data-voice-section] .voice-word-card-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    padding-top: 4px;
    border-top: 1px solid rgba(42,65,98,.08);
}
body[data-voice-section] .voice-word-card-actions button {
    min-width: 32px;
    min-height: 26px;
    color: #315683;
    border: 1px solid rgba(49,86,131,.2);
    border-radius: 7px;
    background: #edf4ff;
    font-weight: 800;
    cursor: pointer;
}
body[data-voice-section] .voice-word-card-actions button:hover { background: #dceaff; }
body[data-voice-section] .voice-word-empty {
    display: flex !important;
    align-items: center;
    justify-content: center;
    min-height: 150px;
    color: #64748b;
    font-weight: 700;
}

@media (max-width: 620px) {
    body[data-voice-section] .voice-library-header { align-items: stretch; flex-direction: column; }
    body[data-voice-section] .voice-library-tabs { align-self: stretch; }
    body[data-voice-section] .voice-library-tab { flex: 1; }
    body[data-voice-section] #phrasesTypesMenu .phrase-page.active { grid-template-columns: 1fr; }
    body[data-voice-section] #imagesGridContainer.images-grid-container { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}

@media (max-width: 390px) {
    body[data-voice-section] #imagesGridContainer.images-grid-container { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

body[data-voice-section] #micIcon {
    width: 44px !important;
    height: 44px !important;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(155deg, #e2545e, #a52d38);
    box-shadow: 0 7px 16px rgba(125, 30, 40, .28), inset 0 1px 0 rgba(255,255,255,.2);
    font-size: 25px !important;
}

body[data-voice-section] #micIcon.listening {
    background: linear-gradient(155deg, #25aa75, #107453);
    box-shadow: 0 0 0 5px rgba(37,170,117,.18), 0 7px 16px rgba(16,116,83,.28);
}

/* Portrait : on privilégie le texte et les cibles tactiles. */
@media (max-width: 700px) and (orientation: portrait) {
    :root {
        --voice-ui-scale: .94;
        --voice-character-scale: .88;
        --voice-controls-scale: 1;
        --voice-visitor-size: clamp(68px, 22vw, 92px);
        --voice-translator-size: clamp(52px, 17vw, 74px);
        --voice-stage-pad: 8px;
    }

    body[data-voice-section] #transcript,
    body[data-voice-section] #translation {
        line-height: 1.45;
    }

}

/* ================================================================
   Pavé Transcription professionnel — priorité finale
   ================================================================ */
body[data-voice-section] #nvTranstextePopup {
    overflow: visible !important;
    padding: 0 12px 12px !important;
    border: 1px solid rgba(26,48,78,.3) !important;
    border-radius: 20px !important;
    background: linear-gradient(180deg, #f7faff 0, #eef3fa 100%) !important;
    box-shadow: 0 22px 55px rgba(12,30,57,.25) !important;
}
body[data-voice-section] .voice-transcription-heading {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    min-height: 58px;
    margin: 0 -12px 10px !important;
    padding: 8px 14px !important;
    color: #fff !important;
    border-radius: 19px 19px 0 0;
    background: linear-gradient(135deg, #183458, #2f6097) !important;
    box-shadow: inset 0 -1px 0 rgba(255,255,255,.12);
}
body[data-voice-section] .voice-heading-identity {
    display: flex;
    align-items: center;
    gap: 9px;
}
body[data-voice-section] .voice-heading-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    color: #a8d5ff;
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 50%;
    background: rgba(255,255,255,.1);
    box-shadow: 0 0 0 4px rgba(255,255,255,.05);
}
body[data-voice-section] .voice-heading-identity > span:last-child {
    display: flex;
    flex-direction: column;
}
body[data-voice-section] .voice-heading-identity small {
    color: #bcd4ef;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}
body[data-voice-section] .voice-heading-identity strong {
    color: #fff;
    font-size: 17px;
    line-height: 1.1;
}
body[data-voice-section] .voice-heading-hint {
    color: #d8e7f7;
    font-size: 10px;
    font-weight: 600;
}
body[data-voice-section] .voice-transcription-layout {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
}
body[data-voice-section] .voice-transcription-toolbar {
    order: 1;
    display: grid !important;
    grid-template-columns: minmax(350px, 1.25fr) minmax(280px, .9fr) !important;
    align-items: stretch;
    gap: 10px !important;
    width: 100%;
}
body[data-voice-section] .voice-transcription-toolbar #nv-actions-row,
body[data-voice-section] .voice-transcription-toolbar .transcript-right-col {
    position: relative;
    display: grid !important;
    align-items: center !important;
    gap: 5px !important;
    min-height: 74px !important;
    margin: 0 !important;
    padding: 23px 6px 6px !important;
    overflow: visible !important;
    border: 1px solid rgba(39,68,106,.14) !important;
    border-radius: 14px !important;
    background: rgba(255,255,255,.82) !important;
    box-shadow: 0 5px 15px rgba(21,45,75,.07), inset 0 1px 0 #fff;
}
body[data-voice-section] .voice-transcription-toolbar #nv-actions-row {
    grid-template-columns: repeat(5, minmax(62px, 1fr));
}
body[data-voice-section] .voice-transcription-toolbar .transcript-right-col {
    grid-template-columns: repeat(4, minmax(62px, 1fr));
}
body[data-voice-section] .voice-transcription-toolbar #nv-actions-row::before,
body[data-voice-section] .voice-transcription-toolbar .transcript-right-col::before {
    content: attr(data-group-title);
    position: absolute;
    top: 7px;
    left: 10px;
    color: #607087;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}
body[data-voice-section] .voice-transcription-toolbar .nv-act-btn,
body[data-voice-section] .voice-transcription-toolbar #afflngvisit {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    width: 100% !important;
    min-width: 58px !important;
    height: 46px !important;
    min-height: 46px !important;
    padding: 5px 4px !important;
    border: 1px solid rgba(255,255,255,.25) !important;
    border-radius: 10px !important;
    box-shadow: 0 5px 11px rgba(25,53,88,.18), inset 0 1px 0 rgba(255,255,255,.16) !important;
}
body[data-voice-section] .voice-transcription-toolbar .nv-act-btn::after,
body[data-voice-section] .voice-transcription-toolbar #afflngvisit::after {
    content: attr(data-label);
    display: block;
    color: rgba(255,255,255,.96);
    font: 800 8px/1 'Segoe UI', Arial, sans-serif;
    letter-spacing: .01em;
    white-space: nowrap;
}
body[data-voice-section] .voice-transcription-toolbar .nv-act-btn img {
    width: 19px !important;
    height: 19px !important;
}
body[data-voice-section] .voice-transcription-toolbar .nv-act-btn span {
    font-size: 17px !important;
}
body[data-voice-section] .voice-transcription-toolbar #afflngvisit {
    background: linear-gradient(155deg, #315f9f, #1d3e70) !important;
}
body[data-voice-section] .voice-transcription-content {
    order: 2;
    display: block !important;
    width: 100% !important;
}
body[data-voice-section] .voice-transcription-content #transcript {
    display: block !important;
    width: 100% !important;
    min-height: 120px !important;
    margin-top: 2px !important;
    padding: 14px 16px !important;
    color: #1c2b40 !important;
    border: 1px solid rgba(42,65,98,.2) !important;
    border-radius: 14px !important;
    background: #fff !important;
    box-shadow: inset 0 2px 7px rgba(20,43,73,.06), 0 5px 16px rgba(20,43,73,.06) !important;
}
body[data-voice-section] .voice-transcription-content #transcript::placeholder { color: #8a97a8; }

@media (max-width: 900px) {
    body[data-voice-section] .voice-transcription-toolbar {
        grid-template-columns: 1fr !important;
    }
}
@media (max-width: 700px) and (orientation: portrait) {
    body[data-voice-section] #nvTranstextePopup { padding: 0 8px 8px !important; }
    body[data-voice-section] .voice-transcription-heading {
        margin: 0 -8px 7px !important;
        min-height: 50px;
        padding: 6px 10px !important;
    }
    body[data-voice-section] .voice-heading-hint { display: none; }
    body[data-voice-section] .voice-transcription-toolbar { gap: 6px !important; }
    body[data-voice-section] .voice-transcription-toolbar #nv-actions-row,
    body[data-voice-section] .voice-transcription-toolbar .transcript-right-col {
        min-height: 72px !important;
        padding: 22px 4px 4px !important;
    }
    body[data-voice-section] .voice-transcription-toolbar #nv-actions-row {
        grid-template-columns: repeat(5, minmax(48px, 1fr));
    }
    body[data-voice-section] .voice-transcription-toolbar .transcript-right-col {
        grid-template-columns: repeat(4, minmax(48px, 1fr));
    }
    body[data-voice-section] .voice-transcription-toolbar .nv-act-btn,
    body[data-voice-section] .voice-transcription-toolbar #afflngvisit {
        min-width: 0 !important;
        height: 48px !important;
        min-height: 48px !important;
        padding: 4px 2px !important;
    }
    body[data-voice-section] .voice-transcription-toolbar .nv-act-btn::after,
    body[data-voice-section] .voice-transcription-toolbar #afflngvisit::after {
        font-size: 7px;
    }
    body[data-voice-section] .voice-transcription-content #transcript {
        min-height: 96px !important;
        padding: 11px 12px !important;
    }
}

/* Paysage court / mini-projecteur : personnages compacts, texte prioritaire. */
@media (orientation: landscape) and (max-height: 560px) {
    :root {
        --voice-ui-scale: .88;
        --voice-character-scale: .76;
        --voice-controls-scale: .9;
        --voice-visitor-size: clamp(62px, 12vh, 82px);
        --voice-translator-size: clamp(48px, 12vh, 70px);
        --voice-panel-radius: 14px;
        --voice-stage-gap: 6px;
        --voice-stage-pad: 6px;
    }
}

/* Accessibilité / projecteur : classe ajoutable sans changer la disposition. */
body.voice-zoom-all {
    --voice-ui-scale: 1.18;
    --voice-character-scale: 1.1;
    --voice-transcript-scale: 1.12;
    --voice-translation-scale: 1.12;
}
body.voice-zoom-text {
    --voice-transcript-scale: 1.2;
    --voice-translation-scale: 1.2;
}
body.voice-zoom-characters { --voice-character-scale: 1.22; }

.voice-display-settings {
    margin: 8px 0 12px;
    padding: 10px;
    border: 1px solid rgba(42,65,98,.16);
    border-radius: 12px;
    background: linear-gradient(180deg, #f7faff, #edf3fb);
}
.voice-display-settings-title {
    margin-bottom: 7px;
    color: #2b3e5d;
    font-size: 12px;
    font-weight: 800;
}
.voice-display-modes {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
}
.voice-display-modes button {
    min-height: 32px;
    padding: 5px 4px;
    color: #40536f;
    border: 1px solid rgba(48,80,122,.2);
    border-radius: 8px;
    background: #fff;
    font: 700 10px 'Segoe UI', Arial, sans-serif;
    cursor: pointer;
}
.voice-display-modes button[aria-pressed="true"] {
    color: #fff;
    border-color: #274c7b;
    background: linear-gradient(155deg, #355d94, #203d66);
    box-shadow: 0 3px 9px rgba(32,61,102,.25);
}
.voice-display-settings small {
    display: block;
    margin-top: 6px;
    color: #6b778b;
    font-size: 9px;
    line-height: 1.25;
}

/* Panneau de réglages : même langage visuel que la scène Voice. */
body[data-voice-section] #voiceSettingsMenu.voice-settings-menu {
    width: min(390px, calc(100vw - 12px)) !important;
    padding: 15px !important;
    color: #263852 !important;
    border: 1px solid rgba(37,61,95,.24) !important;
    border-right: 0 !important;
    border-radius: 20px 0 0 20px !important;
    background: linear-gradient(180deg, rgba(252,253,255,.99), rgba(235,241,249,.99)) !important;
    box-shadow: -18px 20px 55px rgba(15,31,55,.28) !important;
    scrollbar-width: thin;
}
body[data-voice-section] #voiceSettingsMenu .settings-title {
    color: #1f3554 !important;
    font-size: 18px !important;
    letter-spacing: -.2px;
}
body[data-voice-section] #nvVsmReset {
    min-height: 30px;
    padding: 5px 10px !important;
    color: #40536f !important;
    border: 1px solid rgba(48,80,122,.22) !important;
    border-radius: 9px !important;
    background: #f7f9fc !important;
    box-shadow: none !important;
}
body[data-voice-section] #nvVsmClose {
    width: 30px !important;
    height: 30px !important;
    color: #fff !important;
    background: linear-gradient(155deg, #c6535d, #91333c) !important;
    box-shadow: 0 5px 12px rgba(145,51,60,.24) !important;
}
body[data-voice-section] .voice-settings-section-label {
    margin: 12px 0 6px;
    padding: 5px 1px;
    color: #31547f;
    border-bottom: 1px solid rgba(49,84,127,.14);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .35px;
    text-transform: uppercase;
}
body[data-voice-section] #voiceSettingsMenu .voice-selector,
body[data-voice-section] #voiceSettingsMenu .voice-controls,
body[data-voice-section] #voiceSettingsMenu .font-settings-group {
    margin: 0 0 7px !important;
    padding: 9px !important;
    border: 1px solid rgba(42,65,98,.12) !important;
    border-radius: 12px !important;
    background: rgba(255,255,255,.76) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
}
body[data-voice-section] #voiceSettingsMenu .voice-options {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px !important;
}
body[data-voice-section] #voiceSettingsMenu .voice-option {
    min-width: 0;
    margin: 0 !important;
}
body[data-voice-section] #voiceSettingsMenu .voice-label {
    display: flex !important;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 5px 3px !important;
    overflow: hidden;
    border: 1px solid rgba(48,80,122,.18) !important;
    border-radius: 9px !important;
    background: #f7f9fc !important;
    font-size: 10px !important;
    text-overflow: ellipsis;
}
body[data-voice-section] #voiceSettingsMenu .voice-option input:checked + .voice-label {
    color: #fff !important;
    border-color: #274c7b !important;
    background: linear-gradient(155deg, #355d94, #203d66) !important;
}
body[data-voice-section] #voiceSettingsMenu input[type="range"] {
    width: 100% !important;
    accent-color: #315f9f;
}
body[data-voice-section] #voiceSettingsMenu .font-setting-item { width: 100%; }
body[data-voice-section] #voiceSettingsMenu #transcriptFontToggle,
body[data-voice-section] #voiceSettingsMenu #translationFontToggle {
    min-height: 32px;
    color: #314966;
    border: 1px solid rgba(48,80,122,.24) !important;
    border-radius: 9px !important;
    background: #fff !important;
}
body[data-voice-section] #voiceSettingsMenu .font-list {
    max-height: 170px;
    overflow-y: auto;
    margin-top: 5px;
    padding: 5px;
    border: 1px solid rgba(42,65,98,.16);
    border-radius: 10px;
    background: #fff;
}
body[data-voice-section] #voiceSettingsMenu .font-item {
    padding: 6px 8px !important;
    border-radius: 7px;
    cursor: pointer;
}
body[data-voice-section] #voiceSettingsMenu .font-item:hover,
body[data-voice-section] #voiceSettingsMenu .font-item.selected { background: #e8f0fc !important; }

@media (max-width: 540px) {
    body[data-voice-section] #voiceSettingsMenu.voice-settings-menu {
        top: 46px !important;
        right: 4px !important;
        left: 4px !important;
        width: auto !important;
        max-height: calc(100vh - 52px) !important;
        border-right: 1px solid rgba(37,61,95,.24) !important;
        border-radius: 16px !important;
    }
}

/* ================================================================
   Composition réelle de la scène — version 20260812c
   ================================================================ */
body[data-voice-section="translate"],
body[data-voice-section="record"],
body[data-voice-section="pingpong"] { overflow-x: hidden; }

body[data-voice-section] #_nvLsTable { display: none !important; }

body[data-voice-section] .content {
    width: 100%;
    max-width: none;
    padding: 0;
}

body[data-voice-section] .main-row {
    position: fixed !important;
    left: var(--voice-stage-pad);
    right: var(--voice-stage-pad);
    bottom: clamp(68px, 9vh, 108px);
    z-index: 120;
    width: auto !important;
    max-width: var(--voice-stage-width);
    margin: 0 auto;
    display: flex !important;
    flex-direction: row-reverse !important;
    align-items: flex-start !important;
    justify-content: center !important;
    gap: var(--voice-stage-gap) !important;
    pointer-events: none;
}
body[data-voice-section] .main-row > * { pointer-events: auto; }

body[data-voice-section] .main-row > div:first-child {
    flex: 0 0 auto;
    align-self: center !important;
    padding: 10px;
    border-radius: 999px;
    background: rgba(235, 242, 254, .72);
    box-shadow: 0 12px 30px rgba(13,31,61,.14);
    backdrop-filter: blur(10px);
}

body[data-voice-section] #nvTranstextePopup {
    flex: 1 1 760px !important;
    width: auto !important;
    max-width: 920px;
    min-width: 0;
}

body[data-voice-section] #nvTranstextePopup::before {
    left: auto !important;
    right: -22px !important;
    border-right: 0 !important;
    border-left: 22px solid rgba(24,36,58,.82) !important;
}
body[data-voice-section] #nvTranstextePopup::after {
    left: auto !important;
    right: -18px !important;
    border-right: 0 !important;
    border-left: 20px solid var(--voice-panel-bg) !important;
}

body[data-voice-section] .voice-panel-heading {
    width: 100%;
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 0 0 8px;
    color: #172943;
    font-size: clamp(14px, 1.2vw, 18px);
}
body[data-voice-section] .voice-panel-kicker {
    padding: 3px 8px;
    border-radius: 999px;
    color: #315f9f;
    background: #e7effb;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

body[data-voice-section] #nvResultPopup {
    position: fixed !important;
    top: clamp(62px, 8vh, 92px) !important;
    bottom: auto !important;
    left: clamp(150px, 16vw, 250px) !important;
    right: var(--voice-stage-pad) !important;
    z-index: 110 !important;
    width: auto !important;
    max-width: 1120px;
    margin: 0 auto !important;
    padding: 0 !important;
    transform: none !important;
}

body[data-voice-section] #nvLngRow {
    margin: 0 0 8px !important;
    padding: 5px 8px;
    border-radius: 14px;
    background: rgba(238,244,252,.92);
    box-shadow: 0 5px 18px rgba(13,31,61,.09);
}

/* Raccord esthétique du composant professeur existant quand University le
   fournit dans le même document. Aucun composant de remplacement n'est créé. */
body[data-voice-section] #gapitProfessorAnswer {
    position: fixed !important;
    display: block;
    left: var(--voice-stage-pad) !important;
    top: clamp(100px, 17vh, 180px) !important;
    right: auto !important;
    bottom: auto !important;
    width: clamp(190px, 20vw, 310px) !important;
    max-height: min(48vh, 420px);
    overflow: auto;
    border: 1px solid rgba(126,86,0,.65) !important;
    border-radius: var(--voice-panel-radius) !important;
    box-shadow: var(--voice-panel-shadow) !important;
}

body[data-voice-section] .corner-teacher,
body[data-voice-section] #gapitFloatingTeacher {
    left: var(--voice-stage-pad) !important;
    right: auto !important;
    bottom: clamp(74px, 10vh, 116px) !important;
    transform: scale(var(--voice-character-scale)) !important;
    transform-origin: left bottom !important;
}

@media (max-width: 700px) and (orientation: portrait) {
    body[data-voice-section] #nvResultPopup {
        top: 54px !important;
        left: 6px !important;
        right: 6px !important;
        max-width: none;
    }
    body[data-voice-section] .main-row {
        left: 6px;
        right: 6px;
        bottom: 58px;
        align-items: flex-end !important;
        gap: 6px !important;
    }
    body[data-voice-section] .main-row > div:first-child {
        padding: 4px;
        background: transparent;
        box-shadow: none;
    }
    body[data-voice-section] .voice-panel-heading { margin-bottom: 5px; }
}

@media (orientation: landscape) and (max-height: 560px) {
    body[data-voice-section] #nvResultPopup {
        top: 8px !important;
        left: 122px !important;
        right: 6px !important;
        max-width: none;
    }
    body[data-voice-section] .main-row {
        left: 6px;
        right: 6px;
        bottom: 6px;
    }
    body[data-voice-section] .voice-panel-heading { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    body[data-voice-section] *,
    body[data-voice-section] *::before,
    body[data-voice-section] *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* Priorités finales d'orientation : placées après les règles historiques. */
@media (orientation: landscape) and (min-width: 701px) {
    body[data-voice-section] .main-row {
        left: clamp(250px, 27vw, 390px) !important;
        right: var(--voice-stage-pad) !important;
    }
    body[data-voice-section] #nvResultPopup {
        left: clamp(250px, 27vw, 390px) !important;
        right: var(--voice-stage-pad) !important;
        width: auto !important;
        margin: 0 !important;
    }
    body[data-voice-section] #nvTranstextePopup {
        width: 100% !important;
        margin: 0 !important;
    }
    body[data-voice-section] #gapitProfessorAnswer {
        left: clamp(10px, 2vw, 28px) !important;
        top: 50% !important;
        bottom: auto !important;
        width: clamp(220px, 24vw, 350px) !important;
        max-height: min(56vh, 450px) !important;
        transform: translateY(-42%) !important;
    }
}

@media (orientation: landscape) and (max-height: 560px) {
    body[data-voice-section] .main-row {
        left: clamp(128px, 21vw, 250px) !important;
        right: 6px !important;
    }
    body[data-voice-section] #nvResultPopup {
        left: clamp(128px, 21vw, 250px) !important;
        right: 6px !important;
    }
    body[data-voice-section] #gapitProfessorAnswer {
        left: 6px !important;
        top: 50% !important;
        width: clamp(112px, 19vw, 225px) !important;
        max-height: calc(100vh - 18px) !important;
        transform: translateY(-50%) !important;
        font-size: 11px !important;
    }
}

@media (max-width: 700px) and (orientation: portrait) {
    body[data-voice-section] #nvResultPopup {
        top: 50px !important;
        left: 6px !important;
        right: 6px !important;
        width: auto !important;
    }
    body[data-voice-section] .main-row {
        left: 6px !important;
        right: 6px !important;
        bottom: 8px !important;
        max-height: 48vh;
        overflow-y: auto;
    }
    body[data-voice-section] #gapitProfessorAnswer {
        position: relative !important;
        left: auto !important;
        right: auto !important;
        top: auto !important;
        bottom: auto !important;
        width: calc(100% - 12px) !important;
        max-height: 30vh !important;
        margin: 8px auto !important;
        transform: none !important;
    }
}
