/* Fachleiter-Erweiterung für den offiziellen PDF.js-Viewer */

html,
body,
#outerContainer,
#mainContainer {
    height: 100%;
}

html,
body {
    overscroll-behavior: none;
}

.flpdf-app-loader,
.flpdf-app-loader * {
    box-sizing: border-box;
}

.flpdf-app-loader {
    position: fixed;
    z-index: 2000000;
    inset: 0;
    display: grid;
    place-items: center;
    padding:
        max(18px, env(safe-area-inset-top))
        max(18px, env(safe-area-inset-right))
        max(18px, env(safe-area-inset-bottom))
        max(18px, env(safe-area-inset-left));
    background:
        radial-gradient(
            circle at 50% 34%,
            #ffffff 0,
            #f3f5f8 46%,
            #e7ebf1 100%
        );
    color: #17243a;
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    opacity: 1;
    transition:
        opacity 180ms ease,
        visibility 180ms ease;
}

.flpdf-app-loader.is-hidden {
    visibility: hidden;
    pointer-events: none;
    opacity: 0;
}

.flpdf-app-loader-card {
    display: grid;
    justify-items: center;
    width: min(100%, 390px);
    padding: clamp(20px, 5vw, 34px);
    border: 1px solid rgba(23, 36, 58, 0.1);
    border-radius: clamp(18px, 4vw, 28px);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 22px 60px rgba(23, 36, 58, 0.16);
    text-align: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.flpdf-app-loader-logo {
    display: block;
    width: clamp(150px, 42vw, 230px);
    max-height: 34dvh;
    height: auto;
    margin-bottom: 8px;
    object-fit: contain;
    animation: flpdf-logo-breathe 1.8s ease-in-out infinite;
}

#flpdfAppLoaderPercent {
    color: #17243a;
    font-size: clamp(30px, 8vw, 44px);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

#flpdfAppLoaderMessage {
    min-height: 1.5em;
    margin-top: 7px;
    color: #596579;
    font-size: clamp(14px, 3.8vw, 17px);
    font-weight: 650;
    line-height: 1.45;
}

.flpdf-app-loader-track {
    width: 100%;
    height: 8px;
    margin-top: 18px;
    overflow: hidden;
    border-radius: 999px;
    background: #dce2ea;
}

#flpdfAppLoaderProgress {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #17243a, #e31d2b, #f4bf17);
    transition: width 180ms ease;
}

#flpdfAppLoaderRetry {
    min-width: 190px;
    min-height: 48px;
    margin-top: 18px;
    padding: 10px 20px;
    border: 0;
    border-radius: 12px;
    background: #17243a;
    color: #ffffff;
    font: 750 16px/1.2 system-ui, sans-serif;
    cursor: pointer;
    touch-action: manipulation;
}

#flpdfAppLoaderRetry[hidden] {
    display: none;
}

.flpdf-app-loader.is-error
    .flpdf-app-loader-logo {
    animation: none;
}

.flpdf-app-loader.is-error
    #flpdfAppLoaderPercent,
.flpdf-app-loader.is-error
    .flpdf-app-loader-track {
    display: none;
}

@keyframes flpdf-logo-breathe {
    0%,
    100% {
        transform: scale(0.98);
        opacity: 0.84;
    }

    50% {
        transform: scale(1.02);
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .flpdf-app-loader-logo {
        animation: none;
    }
}

@media (max-height: 520px) {
    .flpdf-app-loader-card {
        grid-template-columns: auto 1fr;
        column-gap: 18px;
        width: min(100%, 520px);
        padding: 14px 18px;
    }

    .flpdf-app-loader-logo {
        grid-row: 1 / span 4;
        width: min(30vw, 150px);
        max-height: 70dvh;
        margin: 0;
    }

    .flpdf-app-loader-track {
        margin-top: 10px;
    }

    #flpdfAppLoaderRetry {
        min-height: 42px;
        margin-top: 10px;
    }
}

#flpdfTranslatorPopup,
#flpdfTranslatorPopup * {
    box-sizing: border-box;
}

#flpdfTranslatorPopup {
    position: fixed;
    z-index: 1000000;
    top: 50%;
    right: auto;
    bottom: auto;
    left: 50%;
    display: none;
    transform: translate(-50%, -50%);
    width: min(560px, calc(100vw - 24px));
    max-height: min(720px, calc(100dvh - 24px));
    overflow-y: auto;
    padding: 18px;
    border: 1px solid #d7dee8;
    border-radius: 15px;
    background: #ffffff;
    color: #1f2937;
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    box-shadow:
        0 18px 55px rgba(15, 23, 42, 0.25);
}

#flpdfTranslatorPopup.is-visible {
    display: block;
}

.flpdf-popup-close {
    position: absolute;
    top: 7px;
    right: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #475467;
    font-size: 26px;
    cursor: pointer;
}

.flpdf-popup-section + .flpdf-popup-section {
    margin-top: 15px;
}

.flpdf-popup-section[hidden] {
    display: none !important;
}

.flpdf-popup-label {
    margin-bottom: 5px;
    padding-right: 38px;
    color: #667085;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.flpdf-popup-content {
    font-size: 16px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

#flpdfOriginal {
    font-weight: 650;
}

.flpdf-grammar-row {
    display: grid;
    grid-template-columns: 105px 1fr;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid #eef1f5;
    font-size: 14px;
}

.flpdf-grammar-row span {
    color: #667085;
}

#flpdfSpeak {
    width: 100%;
    min-height: 45px;
    margin-top: 16px;
    padding: 9px 14px;
    border: 0;
    border-radius: 9px;
    background: #17243a;
    color: #ffffff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

#flpdfSpeak:disabled {
    cursor: wait;
    opacity: 0.7;
}

#flpdfPopupStatus {
    min-height: 18px;
    margin-top: 8px;
    color: #a52222;
    font-size: 13px;
}

.flpdf-ai-note {
    margin-top: 5px;
    color: #7b8492;
    font-size: 11px;
    text-align: center;
}

.flpdf-clickable-annotation {
    cursor: pointer !important;
    touch-action: pan-x pan-y pinch-zoom;
    -webkit-touch-callout: none;
}

.flpdf-clickable-annotation:hover {
    outline: 2px solid rgba(37, 99, 235, 0.65);
    outline-offset: 2px;
}

/*
 * Die eingebauten PDF.js-Kommentarfenster werden durch das besser lesbare
 * Fachleiter-Pop-up ersetzt. So erscheinen Kommentare nicht unter der Seite.
 */
.annotationLayer .popupAnnotation,
.annotationLayer .annotationCommentButton {
    display: none !important;
}

/*
 * Responsiver E-Book-Lesemodus. Der PDF-Text liegt hier als echtes HTML vor
 * und fließt abhängig von Fensterbreite und Schriftgröße neu um.
 */
#flpdfEbookReader {
    position: absolute;
    z-index: 1;
    inset: var(--toolbar-height) 0 0;
    display: none;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-x: none;
    overscroll-behavior-y: contain;
    background: #eeeae2;
    color: #1f2937;
    font-family:
        Georgia,
        "Times New Roman",
        serif;
    -webkit-overflow-scrolling: touch;
}

html.flpdf-ebook-mode #viewerContainer {
    display: none !important;
}

html.flpdf-ebook-mode #flpdfEbookReader {
    display: block;
}

html.flpdf-ebook-mode #scaleSelectContainer {
    display: none !important;
}

html.flpdf-ebook-mode #viewsManagerToggleButton,
html.flpdf-ebook-mode #viewFindButton,
html.flpdf-ebook-mode #editorModeButtons {
    display: none !important;
}

.flpdf-view-mode-controls {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-inline-end: 5px;
}

.flpdf-mode-button {
    height: 28px;
    padding: 0 10px;
    border: 2px solid transparent;
    border-radius: 6px;
    color: #ffffff;
    font: 750 12px/1 system-ui, sans-serif;
    cursor: pointer;
    opacity: 0.72;
}

.flpdf-mode-responsive {
    background: #15803d;
}

.flpdf-mode-flashcards {
    background: #7c3aed;
}

.flpdf-mode-pdf {
    background: #1d4ed8;
}

.flpdf-mode-button.is-active {
    border-color: #ffffff;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.5);
    opacity: 1;
}

.flpdf-mode-button:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.flpdf-heft-language-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    margin-inline-start: 5px;
    color: #ffffff;
    font: 750 11px/1 system-ui, sans-serif;
    white-space: nowrap;
}

#flpdfHeftLanguage {
    width: auto;
    max-width: 170px;
    height: 28px;
    padding: 0 25px 0 7px;
    border: 1px solid rgba(255, 255, 255, 0.58);
    border-radius: 6px;
    background-color: #ffffff;
    color: #17243a;
    font: 700 12px/1 system-ui, sans-serif;
    cursor: pointer;
}

#flpdfHeftLanguage:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

#flpdfEbookPages {
    --flpdf-ebook-font-size: clamp(17px, calc(14px + 0.55vw), 22px);
    width: min(100%, 820px);
    margin: 0 auto;
    padding: clamp(14px, 3.5vw, 42px);
    font-size: var(--flpdf-ebook-font-size);
    line-height: 1.68;
}

.flpdf-responsive-toc {
    width: min(100%, 820px);
    margin: 0 auto;
    padding: clamp(14px, 3.5vw, 42px)
        clamp(14px, 3.5vw, 42px) 0;
}

.flpdf-responsive-toc[hidden] {
    display: none !important;
}

.flpdf-toc-block {
    padding: clamp(18px, 4vw, 34px);
    border: 1px solid #ded8cd;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(38, 30, 20, 0.08);
    font-family: system-ui, sans-serif;
}

.flpdf-toc-heading {
    margin: 0 0 0.7em;
    color: #164e63;
    font-size: 1.35em;
    line-height: 1.25;
}

.flpdf-toc-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.flpdf-toc-item {
    margin: 0;
    padding-inline-start:
        calc(var(--flpdf-toc-level, 0) * 16px);
    border-top: 1px solid #e7e1d8;
}

.flpdf-toc-link {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: baseline;
    width: 100%;
    min-height: 44px;
    padding: 10px 2px;
    border: 0;
    background: transparent;
    color: #1f2937;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.flpdf-toc-link:hover,
.flpdf-toc-link:focus-visible {
    color: #1d4ed8;
    outline: none;
}

.flpdf-toc-title {
    min-width: 0;
    overflow-wrap: anywhere;
}

.flpdf-toc-page {
    color: #475467;
    font-variant-numeric: tabular-nums;
    font-weight: 750;
}

.flpdf-ebook-loading {
    position: sticky;
    z-index: 3;
    top: 0;
    padding: 13px 18px;
    background: #17243a;
    color: #ffffff;
    font: 700 15px/1.4 system-ui, sans-serif;
    text-align: center;
}

.flpdf-ebook-page {
    margin: 0 0 clamp(16px, 3vw, 28px);
    padding: clamp(20px, 5vw, 52px);
    border: 1px solid #ded8cd;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(38, 30, 20, 0.08);
}

.flpdf-ebook-page-label {
    margin: 0 0 1.6em;
    padding-bottom: 0.55em;
    border-bottom: 1px solid #e7e1d8;
    color: #746b60;
    font: 700 0.67em/1.4 system-ui, sans-serif;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.flpdf-ebook-paragraph {
    margin: 0 0 1em;
}

.flpdf-ebook-heading {
    margin: 1.35em 0 0.55em;
    color: #164e63;
    font-family: system-ui, sans-serif;
    font-size: 1.32em;
    line-height: 1.25;
}

.flpdf-ebook-page-content
    > .flpdf-ebook-heading:first-child {
    margin-top: 0;
}

.flpdf-brief-line {
    min-height: 1.45em;
    margin: 0;
}

.flpdf-brief-line.is-spaced,
.flpdf-brief-line.is-field-heading {
    margin-top: 0.85em;
}

.flpdf-brief-line.is-field-heading:first-child {
    margin-top: 0;
}

.flpdf-brief-field-label {
    font-weight: 800;
}

.flpdf-ebook-empty {
    color: #667085;
    font-family: system-ui, sans-serif;
    font-style: italic;
}

.flpdf-ebook-comment {
    border-radius: 3px;
    background: #fff0a8;
    color: inherit;
    cursor: pointer;
    text-decoration: underline dotted #9a6c00;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    touch-action: pan-y pinch-zoom;
}

.flpdf-ebook-comment:hover,
.flpdf-ebook-comment:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
    background: #ffe56b;
}

.flpdf-ebook-page-comments {
    display: grid;
    gap: 9px;
    margin-top: 1.3em;
    padding-top: 1em;
    border-top: 1px solid #e7e1d8;
}

.flpdf-ebook-comment-note {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #d9b43b;
    background: #fff6ca;
    font: 650 0.78em/1.4 system-ui, sans-serif;
    text-align: left;
}

.flpdf-ebook-table-wrap {
    margin: 1.25em 0;
    font-family: system-ui, sans-serif;
}

.flpdf-ebook-table-record {
    padding: 0.95em 0;
    border-top: 2px solid #9ca3af;
}

.flpdf-ebook-table-record:last-child {
    border-bottom: 2px solid #9ca3af;
}

.flpdf-ebook-table-title {
    margin: 0 0 0.45em;
    color: #111827;
    font-size: 1.05em;
    line-height: 1.35;
}

.flpdf-ebook-table-field {
    margin: 0.24em 0;
    color: #111827;
    font-size: 0.9em;
    line-height: 1.5;
}

.flpdf-ebook-table-label {
    color: #344054;
}

.flpdf-ebook-page-image {
    display: block;
    width: 100%;
    height: auto;
}

.flpdf-ebook-images {
    display: grid;
    gap: 16px;
    margin: 1.4em 0 0;
}

/*
 * Interaktive Flashcard-Ansicht. Jede gespeicherte Kartenfläche wird aus der
 * PDF-Vorlage ausgeschnitten und auf Desktop wie Mobil vollständig eingepasst.
 */
#flpdfFlashcardReader {
    position: absolute;
    z-index: 2;
    inset: var(--toolbar-height) 0 0;
    display: none;
    box-sizing: border-box;
    overflow: hidden;
    overscroll-behavior: none;
    padding: clamp(6px, 1.5vw, 14px);
    background:
        radial-gradient(
            circle at top,
            #f3efff 0,
            #e9e5f3 42%,
            #ded9e8 100%
        );
    color: #1f2937;
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    -webkit-overflow-scrolling: touch;
}

html.flpdf-flashcard-mode #viewerContainer {
    display: none !important;
}

html.flpdf-flashcard-mode
    #flpdfFlashcardReader {
    display: block;
}

html.flpdf-flashcard-mode
    #scaleSelectContainer,
html.flpdf-flashcard-mode
    #zoomOutButton,
html.flpdf-flashcard-mode
    #zoomInButton,
html.flpdf-flashcard-mode
    #viewsManagerToggleButton,
html.flpdf-flashcard-mode
    #viewFindButton,
html.flpdf-flashcard-mode
    #editorModeButtons {
    display: none !important;
}

html.flpdf-flashcard-mode
    #toolbarViewerLeft,
html.flpdf-flashcard-mode
    #toolbarViewerRight {
    display: none !important;
}

html.flpdf-flashcard-mode
    #toolbarViewerMiddle {
    flex: 1 1 auto;
    justify-content: center;
}

.flpdf-flashcard-shell {
    box-sizing: border-box;
    display: grid;
    grid-template-rows:
        auto
        auto
        minmax(0, 1fr)
        auto
        auto
        auto;
    gap: clamp(6px, 1.2vh, 11px);
    width: min(100%, 820px);
    height: 100%;
    margin: 0 auto;
    padding: clamp(8px, 1.5vw, 16px);
    overflow: hidden;
    border: 1px solid #d8d1e4;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow:
        0 18px 48px rgba(46, 35, 68, 0.15);
}

.flpdf-flashcard-header {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin: 0;
    color: #5b5269;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

.flpdf-flashcard-number {
    color: #2d2140;
    font-size: clamp(22px, 4vw, 32px);
    line-height: 1;
}

.flpdf-flashcard-side-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    width: min(100%, 430px);
    margin: 0 auto;
    padding: 4px;
    border-radius: 10px;
    background: #ebe7f0;
}

.flpdf-flashcard-side-switch button,
.flpdf-flashcard-navigation button,
.flpdf-flashcard-index button {
    min-height: 38px;
    border: 1px solid transparent;
    border-radius: 8px;
    font: 750 14px/1.2 system-ui, sans-serif;
    cursor: pointer;
}

.flpdf-flashcard-side-switch button {
    background: transparent;
    color: #514760;
}

.flpdf-flashcard-side-switch button.is-active {
    border-color: #d6cbe7;
    background: #ffffff;
    color: #6d28d9;
    box-shadow: 0 2px 8px rgba(66, 45, 94, 0.12);
}

.flpdf-flashcard-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid #9ea4ad;
    border-radius: 12px;
    background: #ffffff;
    box-shadow:
        0 10px 28px rgba(15, 23, 42, 0.12);
    cursor: pointer;
}

.flpdf-flashcard-stage:focus-visible {
    outline: 3px solid #7c3aed;
    outline-offset: 3px;
}

.flpdf-flashcard-canvas {
    display: block;
    min-width: 0;
    min-height: 0;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    background: #ffffff;
}

.flpdf-flashcard-side-switch button,
.flpdf-flashcard-navigation button,
.flpdf-flashcard-index button,
.flpdf-flashcard-stage {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.flpdf-flashcard-loading {
    max-width: 520px;
    padding: 30px;
    color: #655c70;
    font-size: 16px;
    line-height: 1.5;
    text-align: center;
}

.flpdf-flashcard-navigation {
    display: grid;
    grid-template-columns: 1fr 1.25fr 1fr;
    gap: 8px;
    margin: 0;
}

.flpdf-flashcard-navigation button {
    padding: 9px 12px;
    border-color: #d4cddd;
    background: #ffffff;
    color: #332a40;
}

#flpdfFlashcardFlip {
    border-color: #6d28d9;
    background: #7c3aed;
    color: #ffffff;
}

.flpdf-flashcard-navigation button:disabled,
.flpdf-flashcard-side-switch button:disabled {
    cursor: not-allowed;
    opacity: 0.42;
}

.flpdf-flashcard-progress {
    height: 8px;
    margin: 0;
    overflow: hidden;
    border-radius: 999px;
    background: #ddd6e8;
}

#flpdfFlashcardProgress {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(
        90deg,
        #7c3aed,
        #2563eb
    );
    transition: width 180ms ease;
}

.flpdf-flashcard-index {
    display: flex;
    gap: 7px;
    min-height: 46px;
    padding: 2px 1px 4px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.flpdf-flashcard-index button {
    flex: 0 0 auto;
    min-width: 48px;
    padding: 7px 10px;
    border-color: #d3ccdc;
    background: #f7f5fa;
    color: #4b4257;
    font-variant-numeric: tabular-nums;
}

.flpdf-flashcard-index button.is-active {
    border-color: #6d28d9;
    background: #ede9fe;
    color: #5b21b6;
}

.flpdf-ebook-embedded-image {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    border: 1px solid #d7dce2;
    border-radius: 6px;
    background: #ffffff;
    box-shadow: 0 5px 16px rgba(15, 23, 42, 0.1);
}

#flpdfTranslatorPopup[data-mode="comment"] {
    top: 50% !important;
    right: auto !important;
    bottom: auto !important;
    left: 50% !important;
    width: min(410px, calc(100vw - 24px)) !important;
    max-height: min(70dvh, 620px) !important;
    transform: translate(-50%, -50%);
}

@media (max-width: 760px) {
    #downloadButton,
    #printButton {
        display: none !important;
    }

    .flpdf-view-mode-controls {
        gap: 2px;
        margin-inline-end: 2px;
    }

    .flpdf-mode-button {
        height: 27px;
        padding: 0 6px;
        font-size: 9px;
    }

    .flpdf-heft-language-control {
        gap: 3px;
        margin-inline-start: 2px;
        font-size: 0;
    }

    .flpdf-heft-language-control > span::before {
        content: "🌐";
        font-size: 15px;
    }

    #flpdfHeftLanguage {
        max-width: 110px;
        height: 27px;
        padding-inline: 5px 20px;
        font-size: 10px;
    }

    #flpdfEbookReader {
        inset-block-start: var(--toolbar-height);
    }

    #flpdfEbookPages {
        --flpdf-ebook-font-size: clamp(18px, calc(16px + 0.8vw), 21px);
        padding: 10px;
        line-height: 1.62;
    }

    #flpdfFlashcardReader {
        padding: 4px;
    }

    .flpdf-flashcard-shell {
        gap: 5px;
        padding: 7px;
        border-radius: 8px;
    }

    .flpdf-flashcard-stage {
        border-radius: 7px;
    }

    .flpdf-flashcard-navigation button {
        min-height: 36px;
        padding: 6px 4px;
        font-size: 11px;
    }

    .flpdf-flashcard-side-switch button {
        min-height: 34px;
        font-size: 12px;
    }

    .flpdf-flashcard-header {
        font-size: 12px;
    }

    .flpdf-flashcard-number {
        font-size: 20px;
    }

    .flpdf-flashcard-index {
        min-height: 40px;
    }

    .flpdf-flashcard-index button {
        min-width: 42px;
        min-height: 36px;
        padding: 5px 8px;
        font-size: 12px;
    }

    .flpdf-ebook-page {
        margin-bottom: 12px;
        padding: 20px 17px 28px;
        border-radius: 4px;
    }

    #viewerContainer .pdfViewer {
        padding-right: 0;
        padding-left: 0;
    }

    #viewerContainer .pdfViewer .page {
        margin-right: auto;
        margin-left: auto;
    }

    #flpdfTranslatorPopup {
        top: 50% !important;
        right: auto !important;
        bottom: auto !important;
        left: 50% !important;
        width: min(560px, calc(100vw - 24px));
        max-height: min(72dvh, 720px);
        transform: translate(-50%, -50%);
        -webkit-overflow-scrolling: touch;
    }

    #flpdfTranslatorPopup[data-mode="comment"] {
        max-height: 50dvh;
    }
}

/* Fachleiter Auswahl-Aktionsleiste: vor der eigentlichen Übersetzung. */
#flpdfSelectionActions,
#flpdfSelectionActions * {
    box-sizing: border-box;
}

#flpdfSelectionActions {
    position: fixed;
    z-index: 1000001;
    display: none;
    align-items: center;
    gap: 6px;
    padding: 6px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 12px 34px rgba(15, 23, 42, 0.24);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

#flpdfSelectionActions.is-visible {
    display: flex;
}

#flpdfSelectionActions button {
    min-height: 40px;
    padding: 8px 14px;
    border: 0;
    border-radius: 8px;
    background: #17243a;
    color: #ffffff;
    font: inherit;
    font-size: 14px;
    font-weight: 750;
    line-height: 1;
    cursor: pointer;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

#flpdfSelectionActions button:last-child {
    background: #eef2f6;
    color: #17243a;
}

#flpdfSelectionActions button:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

@media (pointer: coarse), (max-width: 900px) {
    #flpdfSelectionActions {
        max-width: calc(100vw - 24px);
        padding: 7px;
        border-radius: 14px;
    }

    #flpdfSelectionActions button {
        min-height: 44px;
        padding-right: 16px;
        padding-left: 16px;
        font-size: 15px;
    }
}


/* v1.13.0 – cross-browser mobile selection + responsive translator */
.textLayer,
.textLayer :is(span, br),
#flpdfEbookReader,
#flpdfEbookReader * {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    user-select: text !important;
}

@media (pointer: coarse), (max-width: 900px) {
    #flpdfSelectionActions {
        max-width: calc(100vw - 16px);
        gap: 6px;
        padding: 6px;
    }
    #flpdfSelectionActions button {
        min-height: 42px;
        padding: 8px 13px;
        font-size: 15px;
    }
}

@media (max-width: 680px) {
    #flpdfTranslatorPopup {
        width: calc(100vw - 16px);
        max-width: none;
        max-height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        padding: 14px;
        border-radius: 12px;
    }
}

@media (max-height: 560px) {
    #flpdfTranslatorPopup {
        width: min(680px, calc(100vw - 16px));
        max-height: calc(100dvh - 12px);
        padding: 12px;
    }
}


/* v1.13.0 – Firefox Android / iOS Safari / Chromium compatibility.
 * Native long-press is allowed long enough to create the Range; JavaScript
 * clears it only after the stable selection is captured. */
.textLayer,
.textLayer span,
.textLayer br,
#flpdfEbookReader,
#flpdfEbookReader * {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    user-select: text !important;
    -webkit-touch-callout: default !important;
}
@media (pointer: coarse), (max-width: 900px) {
    .textLayer, #flpdfEbookReader {
        touch-action: pan-x pan-y pinch-zoom !important;
    }
    #flpdfSelectionActions {
        max-width: calc(100vw - 16px - env(safe-area-inset-left) - env(safe-area-inset-right));
    }
}

/* v1.13.1 – persistent visual highlight for the selected PDF text.
   The native browser selection can be cleared to remove Copy/Search menus,
   while the learner can still see exactly which text remains active. */
#flpdfSelectionHighlightLayer{
    position:fixed;
    inset:0;
    z-index:999997;
    pointer-events:none;
}
.flpdf-selection-highlight{
    position:fixed;
    background:rgba(67,126,255,.28);
    border-radius:2px;
    pointer-events:none;
    box-shadow:inset 0 0 0 1px rgba(67,126,255,.12);
}

/* Übersetzungs-Delay: für Lernende frei einstellbar, Standard 1,6 s. */
    display: inline-flex;
    align-items: center;
    gap: 3px;
    height: 28px;
    margin-inline-start: 4px;
    padding: 0 6px;
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 6px;
    color: #fff;
    background: rgba(15,23,42,.72);
    font: 700 11px/1 system-ui,sans-serif;
    white-space: nowrap;
}
#flpdfSelectionDelay {
    box-sizing: border-box;
    width: 46px;
    height: 22px;
    padding: 0 4px;
    border: 1px solid rgba(255,255,255,.35);
    border-radius: 4px;
    background: #fff;
    color: #111827;
    font: 700 11px/1 system-ui,sans-serif;
    text-align: center;
}
@media (max-width: 760px) {
        gap: 2px;
        height: 27px;
        margin-inline-start: 2px;
        padding: 0 4px;
        font-size: 9px;
    }
    #flpdfSelectionDelay {
        width: 40px;
        height: 21px;
        font-size: 10px;
    }
}


/* v1.13.4 – mobile PDF selection: hide native blue selection paint while
   preserving the browser Range/handles. Fachleiter draws its own highlight. */
@media (pointer: coarse), (max-width: 900px) {
    html.flpdf-mobile-selecting .textLayer ::selection,
    html.flpdf-mobile-selecting #flpdfEbookReader ::selection {
        background: transparent !important;
        color: inherit !important;
        text-shadow: none !important;
    }
    html.flpdf-mobile-selecting .textLayer ::-moz-selection,
    html.flpdf-mobile-selecting #flpdfEbookReader ::-moz-selection {
        background: transparent !important;
        color: inherit !important;
        text-shadow: none !important;
    }
}
