/*
 * Wayback Machine Downloader - File editor refresh
 * SAFE SCOPE: All page rules below start with body.wmd-file-editor-modern.
 * Load this file ONLY on file_editor.php, after the existing shared stylesheet.
 * The shared style.css and existing JS class/ID hooks remain untouched.
 */

body.wmd-file-editor-modern {
    --wmd-ed-ink: #172d4e;
    --wmd-ed-muted: #687c96;
    --wmd-ed-line: #dce7f4;
    --wmd-ed-blue: #156cc9;
    --wmd-ed-blue-dark: #0751a4;
    --wmd-ed-surface: #ffffff;
    --wmd-ed-radius: 12px;
    background: #f3f7fc;
    color: var(--wmd-ed-ink);
}

body.wmd-file-editor-modern #feature {
    background: #f3f7fc;
    padding-bottom: 38px;
}

body.wmd-file-editor-modern #feature > .container {
    width: calc(100% - 40px);
    max-width: 1500px;
}

body.wmd-file-editor-modern .wmd-editor-shell {
    position: relative;
    font-family: inherit;
}
body.wmd-file-editor-modern .wmd-editor-shell::after {
    content: "";
    display: block;
    clear: both;
}

/* Left: request summary + file tree */
body.wmd-file-editor-modern #subleft {
    width: 320px;
    background: var(--wmd-ed-surface);
    border: 1px solid var(--wmd-ed-line);
    border-radius: var(--wmd-ed-radius);
    box-shadow: 0 5px 22px rgba(31, 65, 115, .09);
    overflow: hidden;
    float: left;
}
body.wmd-file-editor-modern #subleft .subleft_wrp {
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overflow-wrap: anywhere;
    scrollbar-color: #c1d3e7 transparent;
    scrollbar-width: thin;
}
body.wmd-file-editor-modern .wmd-editor-sidebar-heading {
    position: relative;
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 20px 17px;
    background: linear-gradient(125deg, #1878d6 0%, #0b4b9b 100%);
    color: #fff;
}
body.wmd-file-editor-modern .wmd-editor-heading-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    color: #fff;
    border-radius: 11px;
    font-size: 21px;
    background: rgba(255, 255, 255, .17);
}
body.wmd-file-editor-modern .wmd-editor-sidebar-heading-copy { min-width: 0; }
body.wmd-file-editor-modern .wmd-editor-sidebar-heading h1 {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -.3px;
    line-height: 1.25;
    margin: 0;
    color: #fff;
}
body.wmd-file-editor-modern .ed_total_page_done {
    position: static;
    display: inline-block;
    max-width: 100%;
    background: rgba(255,255,255,.15);
    color: #fff;
    border-radius: 14px;
    font-size: 11px;
    margin: 0 0 7px;
    padding: 2px 8px;
}
body.wmd-file-editor-modern .ed_total_page_done:empty { display: none; }
body.wmd-file-editor-modern .wayback_url_wrp {
    width: auto;
    float: none;
    border: 1px solid var(--wmd-ed-line);
    border-radius: 10px;
    background: #f9fbff;
    margin: 14px 14px 16px;
    padding: 0 12px 5px;
    font-weight: normal;
}
body.wmd-file-editor-modern .wmd-editor-details-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--wmd-ed-ink);
    padding: 12px 0 9px;
    border-bottom: 1px solid var(--wmd-ed-line);
    font-size: 12px;
    font-weight: 750;
}
body.wmd-file-editor-modern .wmd-editor-details-heading .glyphicon { color: #1973ca; }
body.wmd-file-editor-modern .wayback_url_wrp .fe_row {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 9px 0;
    margin: 0;
    border-bottom: 1px solid #e7eef8;
    font-size: 12px;
    line-height: 1.5;
}
body.wmd-file-editor-modern .wayback_url_wrp .fe_row:last-child { border-bottom: 0; }
body.wmd-file-editor-modern .wayback_url_wrp .fe_name {
    flex: 0 0 94px;
    float: none;
    color: var(--wmd-ed-muted);
    font-weight: 700;
}
body.wmd-file-editor-modern .wayback_url_wrp .wayback_url,
body.wmd-file-editor-modern .wayback_url_wrp .wayback_url.wayback_url_1 {
    display: block;
    min-width: 0;
    flex: 1 1 auto;
    margin-left: 0;
    overflow-wrap: anywhere;
    color: #243e61;
}
body.wmd-file-editor-modern .wayback_url_wrp a { color: #0f6fca; }
body.wmd-file-editor-modern .wmd-editor-tree-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 3px 15px 11px;
    font-size: 13px;
    font-weight: 750;
}
body.wmd-file-editor-modern .wmd-editor-tree-heading .glyphicon {
    color: #f6b42e;
    margin-right: 6px;
}
body.wmd-file-editor-modern .wmd-editor-count {
    flex: 0 0 auto;
    font-size: 11px;
    color: #155cac;
    background: #e8f2ff;
    border-radius: 15px;
    padding: 4px 9px;
    font-weight: 700;
}
body.wmd-file-editor-modern .editor_file_listing {
    display: block;
    float: none;
    width: 100%;
    padding: 0 10px 12px;
    font-size: 12px;
}
body.wmd-file-editor-modern .editor_file_listing .ygtvcontent {
    border-radius: 5px;
    padding-top: 2px;
    padding-bottom: 2px;
}
body.wmd-file-editor-modern .editor_file_listing .ygtvlabel {
    color: #28415f;
    font-size: 12px;
    text-decoration: none;
}
body.wmd-file-editor-modern .editor_file_listing .ygtvcontent:hover {
    background: #edf5ff;
}
body.wmd-file-editor-modern .editor_file_listing .selected .ygtvcontent,
body.wmd-file-editor-modern .editor_file_listing .ygtvtm_is_file.selected {
    color: #0756b4;
    background: #dcecff;
    border-radius: 5px;
}
body.wmd-file-editor-modern .editor_file_listing .selected .ygtvlabel {
    color: #0756b4;
    font-weight: 750;
}
body.wmd-file-editor-modern #subleft .editor_reset_wrp {
    float: none;
    display: block;
    width: 100%;
    padding: 12px 14px;
    background: #fff;
    border-top: 1px solid var(--wmd-ed-line);
}
body.wmd-file-editor-modern #subleft .editor_reset {
    display: block;
    width: 100%;
    margin: 0;
    color: #1456a7;
    background: #eaf3ff;
    border: 1px solid #d3e5fb;
    border-radius: 9px;
    padding: 10px 15px;
    font-size: 13px;
    font-weight: 700;
}
body.wmd-file-editor-modern #subleft .editor_reset:hover,
body.wmd-file-editor-modern #subleft .editor_reset:focus {
    background: #d9eaff;
    border-color: #b6d5f7;
}

/* Right: source code + live preview */
body.wmd-file-editor-modern #subright {
    margin-left: 340px;
    margin-bottom: 0;
    padding: 0;
    background: transparent;
    font-size: 13px;
}
body.wmd-file-editor-modern #subright .quiz_alert {
    border-radius: 10px;
    border: 1px solid #bde4cb;
    margin: 0 0 10px !important;
    box-shadow: none;
}
body.wmd-file-editor-modern .wmd-editor-code-header,
body.wmd-file-editor-modern .wmd-editor-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 48px;
    padding: 10px 17px;
    background: #fff;
    border: 1px solid var(--wmd-ed-line);
    border-radius: var(--wmd-ed-radius) var(--wmd-ed-radius) 0 0;
    color: var(--wmd-ed-ink);
}
body.wmd-file-editor-modern .wmd-editor-code-heading,
body.wmd-file-editor-modern .wmd-editor-preview-heading {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    gap: 10px;
    color: #1b3559;
    font-weight: 750;
    font-size: 14px;
}
body.wmd-file-editor-modern .wmd-editor-code-heading .glyphicon,
body.wmd-file-editor-modern .wmd-editor-preview-heading .glyphicon {
    color: #1571d1;
    font-size: 15px;
}
body.wmd-file-editor-modern .wmd-editor-current-file {
    display: inline-block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
body.wmd-file-editor-modern .wmd-editor-code-type {
    font-size: 11px;
    color: #175aa5;
    font-weight: 750;
    text-transform: uppercase;
    background: #eaf3ff;
    padding: 5px 13px;
    border: 1px solid #d5e6fb;
    border-radius: 20px;
}
body.wmd-file-editor-modern #filesarea {
    background: #fff;
    border-left: 1px solid var(--wmd-ed-line);
    border-right: 1px solid var(--wmd-ed-line);
    overflow: hidden;
}
body.wmd-file-editor-modern #filesarea textarea.code_textarea {
    display: block;
    box-sizing: border-box;
    width: 100%;
    margin: 0;
    padding: 17px 20px;
    border: 0;
    border-radius: 0;
    box-shadow: inset 0 1px 2px rgba(14, 57, 105, .035);
    background: #fcfdff;
    color: #203752;
    font-family: Consolas, Monaco, 'Courier New', monospace;
    font-size: 12.5px;
    line-height: 1.65;
    resize: none;
    outline-offset: -3px;
    tab-size: 4;
}
body.wmd-file-editor-modern #filesarea textarea.code_textarea:focus {
    outline: 2px solid rgba(30, 119, 208, .38);
    box-shadow: inset 0 0 0 1px rgba(30, 119, 208, .18);
}
body.wmd-file-editor-modern .editor_save_preview_btn {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    min-height: 65px;
    margin: 0 0 14px;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid var(--wmd-ed-line);
    border-top: 0;
    border-radius: 0 0 var(--wmd-ed-radius) var(--wmd-ed-radius);
    box-shadow: 0 5px 16px rgba(31, 65, 115, .06);
}
body.wmd-file-editor-modern .editor_save_preview_btn .preview_wrp {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}
body.wmd-file-editor-modern .editor_save_preview_btn .file_editor_alert_wrp {
    flex: 1 1 220px;
}
body.wmd-file-editor-modern .editor_save_preview_btn .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 39px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 12px;
    padding: 9px 13px;
    margin: 0;
    text-decoration: none;
}
body.wmd-file-editor-modern .editor_save_preview_btn .btn-primary {
    color: white;
    border-color: #0955ae;
    background: linear-gradient(180deg, #2284e8, #0955b5);
}
body.wmd-file-editor-modern .editor_save_preview_btn .btn-default {
    color: #2d4c71;
    border-color: #cbdcf0;
    background: #fff;
}
body.wmd-file-editor-modern .wmd-editor-preview-header {
    min-height: 46px;
    padding-right: 13px;
    border-bottom: 0;
}
body.wmd-file-editor-modern .wmd-editor-preview-devices {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
body.wmd-file-editor-modern .wmd-editor-preview-mode {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 9px;
    border-radius: 7px;
    border: 1px solid transparent;
    background: transparent;
    color: #637b99;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}
body.wmd-file-editor-modern .wmd-editor-preview-mode.is-active {
    background: #e5f1ff;
    border-color: #c6ddfa;
    color: #1166bf;
}
body.wmd-file-editor-modern .wmd-editor-preview-mode:focus-visible {
    outline: 2px solid #0969c6;
    outline-offset: 2px;
}
body.wmd-file-editor-modern .iframe_wrp {
    box-sizing: border-box;
    width: 100%;
    min-height: 130px;
    overflow: auto;
    background: #edf1f7;
    padding: 0;
    border: 1px solid var(--wmd-ed-line);
    border-radius: 0 0 var(--wmd-ed-radius) var(--wmd-ed-radius);
    box-shadow: 0 5px 16px rgba(31, 65, 115, .06);
    text-align: center;
}
body.wmd-file-editor-modern .iframe_wrp iframe {
    display: block;
    border: 0;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    background: white;
}
body.wmd-file-editor-modern .iframe_wrp[data-preview-mode="mobile"] iframe {
    width: 390px;
    max-width: 100%;
    box-shadow: 0 0 0 1px rgba(26, 54, 92, .18), 0 8px 25px rgba(20, 45, 80, .12);
}

/* Bottom action strip: existing links and their click handlers are preserved. */
body.wmd-file-editor-modern #sub_buttom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin: 14px 0 0 340px;
    padding: 14px;
    background: #fff;
    border: 1px solid var(--wmd-ed-line);
    border-radius: var(--wmd-ed-radius);
    box-shadow: 0 5px 20px rgba(31, 65, 115, .07);
    text-align: center;
}
body.wmd-file-editor-modern #sub_buttom > .btn,
body.wmd-file-editor-modern #sub_buttom > ul > li > .btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    min-height: 43px;
    padding: 10px 18px;
    margin: 0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 750;
    text-decoration: none;
}
body.wmd-file-editor-modern #sub_buttom .btn-primary {
    background: linear-gradient(180deg, #2488ec, #0860c4);
    border: 1px solid #0f62bc;
    color: white;
}
body.wmd-file-editor-modern #sub_buttom .btn-success {
    background: linear-gradient(180deg, #65b847, #339f24);
    border: 1px solid #3c9a2c;
    color: white;
}
body.wmd-file-editor-modern #sub_buttom > ul {
    display: inline-block;
    padding: 0;
    margin: 0;
    position: relative;
    list-style: none;
}
body.wmd-file-editor-modern #sub_buttom > ul > li { list-style: none; }
body.wmd-file-editor-modern #sub_buttom .wmd-editor-install-group { position: relative; }
body.wmd-file-editor-modern #sub_buttom .wmd-editor-install-group > ul.dropdown_submenu {
    display: none;
    position: absolute;
    /* No gap: pointer can move straight from trigger to popup without losing hover. */
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    min-width: 230px;
    max-width: min(90vw, 350px);
    padding: 7px;
    margin: 0;
    border: 1px solid var(--wmd-ed-line);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 25px rgba(23, 55, 94, .18);
    z-index: 100;
}
body.wmd-file-editor-modern #sub_buttom .wmd-editor-install-group:hover > ul.dropdown_submenu,
body.wmd-file-editor-modern #sub_buttom .wmd-editor-install-group:focus-within > ul.dropdown_submenu,
body.wmd-file-editor-modern #sub_buttom .wmd-editor-install-group.is-open > ul.dropdown_submenu {
    display: block;
}
body.wmd-file-editor-modern #sub_buttom ul.dropdown_submenu li { display: block; }
body.wmd-file-editor-modern #sub_buttom ul.dropdown_submenu a.btn {
    display: block;
    width: 100%;
    padding: 11px;
    border: 0;
    border-radius: 7px;
    margin: 0;
    background: #fff;
    color: #174571;
    text-align: left;
    font-size: 12px;
}
body.wmd-file-editor-modern #sub_buttom ul.dropdown_submenu a.btn:hover,
body.wmd-file-editor-modern #sub_buttom ul.dropdown_submenu a.btn:focus {
    color: #0c62bd;
    background: #edf5ff;
}

/* Responsive adjustments apply only to this editor page. */
@media (max-width: 992px) {
    body.wmd-file-editor-modern #feature > .container {
        max-width: none;
        width: calc(100% - 22px);
    }
    body.wmd-file-editor-modern #subleft,
    body.wmd-file-editor-modern #subright,
    body.wmd-file-editor-modern #sub_buttom {
        float: none;
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
    body.wmd-file-editor-modern #subleft { margin-bottom: 15px; }
    body.wmd-file-editor-modern #subright { margin-bottom: 0; }
    body.wmd-file-editor-modern #sub_buttom { margin-top: 14px; }
}
@media (max-width: 600px) {
    body.wmd-file-editor-modern #feature > .container { width: 100%; }
    body.wmd-file-editor-modern .wmd-editor-sidebar-heading { padding: 16px; }
    body.wmd-file-editor-modern .wmd-editor-sidebar-heading h1 { font-size: 17px; }
    body.wmd-file-editor-modern .wmd-editor-code-header,
    body.wmd-file-editor-modern .wmd-editor-preview-header { padding: 10px 12px; }
    body.wmd-file-editor-modern .editor_save_preview_btn {
        justify-content: center;
        padding: 11px;
    }
    body.wmd-file-editor-modern .editor_save_preview_btn .preview_wrp,
    body.wmd-file-editor-modern .editor_save_preview_btn .preview_wrp .btn {
        width: 100%;
    }
    body.wmd-file-editor-modern .wmd-editor-device-label { display: none; }
    body.wmd-file-editor-modern #sub_buttom { padding: 12px; }
    body.wmd-file-editor-modern #sub_buttom > .btn,
    body.wmd-file-editor-modern #sub_buttom > ul,
    body.wmd-file-editor-modern #sub_buttom > ul > li > .btn { width: 100%; }
}

/* Desktop: keep the whole dashboard visible without document-level scrolling.
   Long source files, recovered file trees, and embedded sites may still scroll
   inside their own panes (their contents cannot all fit on one screen). */
@media (min-width: 993px) and (min-height: 650px) {
    body.wmd-file-editor-modern.wmd-editor-fitted {
        height: 100vh;
        overflow-y: hidden;
    }
    body.wmd-file-editor-modern.wmd-editor-fitted #feature {
        padding-bottom: 0;
    }
    body.wmd-file-editor-modern.wmd-editor-fitted #subleft,
    body.wmd-file-editor-modern.wmd-editor-fitted #subright {
        box-sizing: border-box;
    }
    body.wmd-file-editor-modern.wmd-editor-fitted #sub_buttom {
        position: relative;
        z-index: 30;
        overflow: visible;
    }
}
/* The iframe itself handles scrolling when the recovered website is long.
   Avoid an extra scrollbar on its wrapper. */
body.wmd-file-editor-modern .iframe_wrp {
    overflow: hidden;
}


/* ===== v4: viewport-contained editor, safe to load ONLY on file_editor.php ===== */
@media (min-width: 993px) and (min-height: 620px) {
    html.wmd-editor-document-fitted {
        height: 100%;
        overflow: hidden;
    }
    body.wmd-file-editor-modern.wmd-editor-fitted {
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
    }
    body.wmd-file-editor-modern.wmd-editor-fitted #feature {
        margin-top: 0;
        padding-top: 12px;
        padding-bottom: 0;
    }
    body.wmd-file-editor-modern.wmd-editor-fitted .wmd-editor-shell {
        display: grid;
        grid-template-columns: 320px minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr) auto;
        column-gap: 20px;
        row-gap: 10px;
        min-width: 0;
        min-height: 0;
        overflow: visible;
    }
    /* The old clearfix pseudo-element otherwise becomes an extra grid row. */
    body.wmd-file-editor-modern.wmd-editor-fitted .wmd-editor-shell::after {
        content: none;
        display: none;
    }
    body.wmd-file-editor-modern.wmd-editor-fitted #subleft {
        grid-column: 1;
        grid-row: 1 / 3;
        display: flex;
        flex-direction: column;
        float: none;
        width: 100%;
        height: 100% !important;
        min-width: 0;
        min-height: 0;
        margin: 0;
        overflow: hidden;
    }
    body.wmd-file-editor-modern.wmd-editor-fitted #subleft .subleft_wrp {
        flex: 1 1 auto;
        height: auto !important;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
    }
    body.wmd-file-editor-modern.wmd-editor-fitted #subleft .editor_reset_wrp {
        flex: 0 0 auto;
        position: relative;
        z-index: 3;
        margin: 0;
        padding: 8px 12px;
        background: #fff;
    }
    body.wmd-file-editor-modern.wmd-editor-fitted #subleft .editor_reset {
        padding: 8px 12px;
        min-height: 38px;
    }

    body.wmd-file-editor-modern.wmd-editor-fitted #subright {
        grid-column: 2;
        grid-row: 1;
        display: flex;
        flex-direction: column;
        float: none;
        width: auto;
        height: 100% !important;
        min-width: 0;
        min-height: 0;
        margin: 0;
        padding: 0;
    }
    body.wmd-file-editor-modern.wmd-editor-fitted #subright .quiz_alert,
    body.wmd-file-editor-modern.wmd-editor-fitted .wmd-editor-code-header,
    body.wmd-file-editor-modern.wmd-editor-fitted .wmd-editor-preview-header,
    body.wmd-file-editor-modern.wmd-editor-fitted .editor_save_preview_btn {
        flex: 0 0 auto;
    }
    body.wmd-file-editor-modern.wmd-editor-fitted .wmd-editor-code-header,
    body.wmd-file-editor-modern.wmd-editor-fitted .wmd-editor-preview-header {
        min-height: 42px;
        padding: 7px 12px;
    }
    body.wmd-file-editor-modern.wmd-editor-fitted #filesarea {
        flex: 1 1 0;
        min-height: 65px;
        height: auto;
        overflow: hidden;
    }
    body.wmd-file-editor-modern.wmd-editor-fitted #filesarea textarea.code_textarea {
        width: 100%;
        height: 100% !important;
        min-height: 0;
        padding: 10px 14px;
        overflow: auto;
    }
    body.wmd-file-editor-modern.wmd-editor-fitted .editor_save_preview_btn {
        min-height: 50px;
        margin: 0 0 8px;
        padding: 6px 10px;
    }
    body.wmd-file-editor-modern.wmd-editor-fitted .editor_save_preview_btn .btn {
        min-height: 36px;
        padding: 7px 10px;
    }
    body.wmd-file-editor-modern.wmd-editor-fitted .iframe_wrp {
        flex: 1 1 0;
        height: auto !important;
        min-height: 65px;
        overflow: hidden;
        margin: 0;
    }
    body.wmd-file-editor-modern.wmd-editor-fitted .iframe_wrp iframe {
        display: block;
        height: 100% !important;
        border: 0;
    }
    body.wmd-file-editor-modern.wmd-editor-fitted #sub_buttom {
        grid-column: 2;
        grid-row: 2;
        float: none;
        width: 100%;
        min-height: 58px;
        min-width: 0;
        margin: 0;
        padding: 7px 10px;
        overflow: visible;
        position: relative;
        z-index: 30;
    }
    body.wmd-file-editor-modern.wmd-editor-fitted #sub_buttom > .btn,
    body.wmd-file-editor-modern.wmd-editor-fitted #sub_buttom > ul > li > .btn {
        min-height: 40px;
        padding: 8px 14px;
    }
}

/* Menu is lifted into <body> on initialization so no iframe or ancestor
   clipping can block clicks on its three real links. */
body.wmd-file-editor-modern > ul.wmd-editor-install-popup {
    display: none;
    position: fixed;
    z-index: 2147483000;
    box-sizing: border-box;
    list-style: none;
    width: 280px;
    max-width: calc(100vw - 16px);
    padding: 7px;
    margin: 0;
    border: 1px solid #d4e2f4;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 15px 35px rgba(20, 44, 82, .22);
    pointer-events: auto;
}
body.wmd-file-editor-modern > ul.wmd-editor-install-popup.is-visible { display: block; }
body.wmd-file-editor-modern > ul.wmd-editor-install-popup li { list-style: none; }
body.wmd-file-editor-modern > ul.wmd-editor-install-popup a.btn {
    display: block;
    width: 100%;
    min-height: 37px;
    margin: 0;
    padding: 9px 11px;
    border: 0;
    border-radius: 6px;
    background: #fff;
    box-shadow: none;
    color: #174571;
    font-size: 12px;
    text-align: left;
    white-space: normal;
    text-decoration: none;
}
body.wmd-file-editor-modern > ul.wmd-editor-install-popup a.btn:hover,
body.wmd-file-editor-modern > ul.wmd-editor-install-popup a.btn:focus-visible {
    background: #edf5ff;
    color: #0c62bd;
}

/* ===== v5: sidebar info, progress placement, preview devices and actions ===== */

/* Honor the legacy double-click hotspots without blocking the footer buttons. */
body.wmd-file-editor-modern #hidden_buttons_top,
body.wmd-file-editor-modern #hidden_buttons_btm,
body.wmd-file-editor-modern.wmd-editor-fitted #hidden_buttons_top,
body.wmd-file-editor-modern.wmd-editor-fitted #hidden_buttons_btm {
    z-index: 99;
}

/* Progress is a small badge in the TOP RIGHT, not part of the title flow. */
body.wmd-file-editor-modern .wmd-editor-sidebar-heading {
    padding: 38px 17px 16px;
}
body.wmd-file-editor-modern .ed_total_page_done {
    position: absolute;
    top: 10px;
    right: 13px;
    left: auto;
    z-index: 2;
    max-width: calc(100% - 26px);
    padding: 3px 9px;
    margin: 0;
    text-align: right;
    white-space: nowrap;
    line-height: 1.4;
}

/* Action and Current URL are separate two-column rows. */
body.wmd-file-editor-modern .wayback_url_wrp .wmd-editor-action-row,
body.wmd-file-editor-modern .wayback_url_wrp .wmd-editor-current-url-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
body.wmd-file-editor-modern .wayback_url_wrp .wmd-editor-action-row .fe_name,
body.wmd-file-editor-modern .wayback_url_wrp .wmd-editor-current-url-row .fe_name {
    flex: 0 0 94px;
}
body.wmd-file-editor-modern .wayback_url_wrp .wmd-editor-current-url-row .wayback_url {
    min-width: 0;
    overflow: hidden;
}
body.wmd-file-editor-modern .wmd-editor-current-url-row .wayback_url a {
    display: block;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-decoration: none;
}
body.wmd-file-editor-modern .wmd-editor-current-url-row .wayback_url a:hover,
body.wmd-file-editor-modern .wmd-editor-current-url-row .wayback_url a:focus {
    text-decoration: underline;
}
body.wmd-file-editor-modern .wmd-editor-url-comment {
    display: block;
    margin-top: 3px;
    color: var(--wmd-ed-muted);
    white-space: normal;
    overflow-wrap: anywhere;
}

/* Crisp vector icons, same proportions for desktop and mobile. */
body.wmd-file-editor-modern .wmd-editor-preview-mode {
    gap: 6px;
}
body.wmd-file-editor-modern .wmd-editor-preview-mode .wmd-editor-device-icon {
    display: block;
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    vertical-align: middle;
}

/* Reset and Add robots.txt: identical height and centered content, side by side. */
body.wmd-file-editor-modern #subleft .editor_reset_wrp,
body.wmd-file-editor-modern.wmd-editor-fitted #subleft .editor_reset_wrp {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0;
    padding: 9px 12px 19px;
}
body.wmd-file-editor-modern #subleft .editor_reset_wrp .editor_reset,
body.wmd-file-editor-modern #subleft .editor_reset_wrp .editor_add_robots,
body.wmd-file-editor-modern.wmd-editor-fitted #subleft .editor_reset_wrp .editor_reset,
body.wmd-file-editor-modern.wmd-editor-fitted #subleft .editor_reset_wrp .editor_add_robots {
    box-sizing: border-box;
    display: inline-flex;
    flex: 1 1 120px;
    width: auto;
    min-width: 0;
    min-height: 40px;
    height: auto;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0;
    padding: 8px 10px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 12px;
    line-height: 1.35;
    font-weight: 700;
    text-decoration: none;
    text-align: center;
    white-space: normal;
}
body.wmd-file-editor-modern #subleft .editor_reset_wrp .editor_add_robots {
    background: #eefaf4;
    border: 1px solid #bfe4d2;
    color: #187249;
}
body.wmd-file-editor-modern #subleft .editor_reset_wrp .editor_add_robots:hover,
body.wmd-file-editor-modern #subleft .editor_reset_wrp .editor_add_robots:focus-visible {
    background: #dff5e9;
    border-color: #83c9a5;
    color: #115b3a;
}
body.wmd-file-editor-modern #subleft .editor_reset_wrp .btn .glyphicon {
    flex: 0 0 auto;
    font-size: 13px;
    line-height: 1;
}
/* Footer leaves a narrow 10px bottom strip for the legacy double-click hotspot. */
body.wmd-file-editor-modern #subleft .editor_reset_wrp .btn:focus-visible {
    outline: 2px solid #2678d1;
    outline-offset: 2px;
}

/* ===== v6: full-screen preview and consistent vector action icons ===== */
body.wmd-file-editor-modern .wmd-editor-preview-stage {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 180px;
    height: 340px;
}
body.wmd-file-editor-modern .wmd-editor-preview-stage .wmd-editor-preview-header {
    flex: 0 0 auto;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}
body.wmd-file-editor-modern .wmd-editor-preview-stage .iframe_wrp {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
}
body.wmd-file-editor-modern .wmd-editor-preview-stage .iframe_wrp iframe {
    height: 100%;
}
body.wmd-file-editor-modern .wmd-editor-fullscreen-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 30px;
    padding: 5px;
    margin-left: 4px;
    color: #225b99;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    cursor: pointer;
}
body.wmd-file-editor-modern .wmd-editor-fullscreen-toggle:hover,
body.wmd-file-editor-modern .wmd-editor-fullscreen-toggle:focus-visible {
    color: #0b5cae;
    background: #e5f1ff;
    border-color: #c6ddfa;
}
body.wmd-file-editor-modern .wmd-editor-fullscreen-toggle:focus-visible {
    outline: 2px solid #0969c6;
    outline-offset: 2px;
}
body.wmd-file-editor-modern .wmd-editor-fullscreen-toggle .wmd-editor-icon-collapse { display: none; }
body.wmd-file-editor-modern .wmd-editor-fullscreen-toggle.is-expanded .wmd-editor-icon-expand { display: none; }
body.wmd-file-editor-modern .wmd-editor-fullscreen-toggle.is-expanded .wmd-editor-icon-collapse { display: block; }
body.wmd-file-editor-modern #subleft .editor_reset_wrp .wmd-editor-action-icon {
    display: block;
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}
@media (min-width: 993px) and (min-height: 620px) {
    body.wmd-file-editor-modern.wmd-editor-fitted #subright .wmd-editor-preview-stage {
        flex: 1 1 0;
        min-height: 75px;
        height: auto;
    }
    body.wmd-file-editor-modern.wmd-editor-fitted .wmd-editor-preview-stage .iframe_wrp {
        min-height: 0;
        height: auto !important;
    }
}
/* Native browser fullscreen (Escape automatically exits). */
body.wmd-file-editor-modern #wmd-editor-preview-stage:fullscreen,
body.wmd-file-editor-modern #wmd-editor-preview-stage.wmd-editor-preview-overlay {
    box-sizing: border-box;
    display: flex !important;
    flex-direction: column;
    width: 100vw !important;
    height: 100vh !important;
    min-height: 0;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: #edf2f9;
    z-index: 2147483600;
}
body.wmd-file-editor-modern #wmd-editor-preview-stage.wmd-editor-preview-overlay {
    position: fixed;
    inset: 0;
}
body.wmd-file-editor-modern.wmd-editor-preview-overlay-open { overflow: hidden !important; }
body.wmd-file-editor-modern #wmd-editor-preview-stage:fullscreen .wmd-editor-preview-header,
body.wmd-file-editor-modern #wmd-editor-preview-stage.wmd-editor-preview-overlay .wmd-editor-preview-header {
    flex: 0 0 52px;
    min-height: 52px;
    border-radius: 0;
    padding: 8px 16px;
}
body.wmd-file-editor-modern #wmd-editor-preview-stage:fullscreen .iframe_wrp,
body.wmd-file-editor-modern #wmd-editor-preview-stage.wmd-editor-preview-overlay .iframe_wrp,
body.wmd-file-editor-modern.wmd-editor-fitted #wmd-editor-preview-stage:fullscreen .iframe_wrp,
body.wmd-file-editor-modern.wmd-editor-fitted #wmd-editor-preview-stage.wmd-editor-preview-overlay .iframe_wrp {
    box-sizing: border-box;
    flex: 1 1 0;
    min-height: 0;
    width: 100%;
    height: auto !important;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}
body.wmd-file-editor-modern #wmd-editor-preview-stage:fullscreen .iframe_wrp iframe,
body.wmd-file-editor-modern #wmd-editor-preview-stage.wmd-editor-preview-overlay .iframe_wrp iframe {
    display: block;
    height: 100% !important;
    border: 0;
}


/* ===== v7: rich request details, safe formatted action, fully visible URLs =====
   Scope is deliberately limited to this editor; shared style.css is unchanged. */
body.wmd-file-editor-modern .wayback_url_wrp {
    padding: 0 10px 3px;
    background: #fff;
    border-color: #dce7f4;
}
body.wmd-file-editor-modern .wayback_url_wrp .wmd-editor-details-heading {
    font-size: 12px;
    padding: 12px 2px 10px;
}
body.wmd-file-editor-modern .wayback_url_wrp .fe_row.wmd-editor-detail-row,
body.wmd-file-editor-modern .wayback_url_wrp .fe_row.wmd-editor-detail-row.wmd-editor-action-row,
body.wmd-file-editor-modern .wayback_url_wrp .fe_row.wmd-editor-detail-row.wmd-editor-current-url-row {
    display: grid;
    grid-template-columns: 22px 82px minmax(0, 1fr);
    column-gap: 7px;
    align-items: start;
    border-bottom: 1px solid #e7eef8;
    padding: 10px 0;
    margin: 0;
    font-size: 11.7px;
    line-height: 1.55;
}
body.wmd-file-editor-modern .wayback_url_wrp .fe_row.wmd-editor-detail-row:last-child {
    border-bottom: 0;
}
body.wmd-file-editor-modern .wayback_url_wrp .fe_row.wmd-editor-detail-row .wmd-editor-detail-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 21px;
    height: 21px;
    border-radius: 7px;
    background: #eaf3ff;
    color: #1871ca;
    margin-top: 0;
}
body.wmd-file-editor-modern .wayback_url_wrp .fe_row.wmd-editor-detail-row .wmd-editor-detail-icon svg {
    display: block;
    width: 14px;
    height: 14px;
}
body.wmd-file-editor-modern .wayback_url_wrp .fe_row.wmd-editor-status-row .wmd-editor-detail-icon--check {
    background: #e2f7e8;
    color: #219345;
}
body.wmd-file-editor-modern .wayback_url_wrp .fe_row.wmd-editor-detail-row > .fe_name {
    display: block;
    float: none;
    min-width: 0;
    width: auto;
    flex: none;
    margin: 1px 0 0;
    color: #526881;
    font-size: 11.5px;
    font-weight: 750;
}
body.wmd-file-editor-modern .wayback_url_wrp .fe_row.wmd-editor-detail-row > .wayback_url {
    display: block;
    float: none;
    min-width: 0;
    max-width: 100%;
    margin-left: 0;
    overflow: visible;
    overflow-wrap: anywhere;
    word-break: normal;
    white-space: normal;
    text-overflow: clip;
    color: #243e61;
}
body.wmd-file-editor-modern .wayback_url_wrp .fe_row.wmd-editor-detail-row .wayback_url a,
body.wmd-file-editor-modern .wayback_url_wrp .fe_row.wmd-editor-detail-row.wmd-editor-current-url-row .wayback_url a {
    display: inline;
    width: auto;
    min-width: 0;
    max-width: 100%;
    overflow: visible;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
    text-overflow: clip;
    line-height: inherit;
    text-decoration: none;
}
body.wmd-file-editor-modern .wayback_url_wrp .fe_row.wmd-editor-detail-row .wayback_url a:hover,
body.wmd-file-editor-modern .wayback_url_wrp .fe_row.wmd-editor-detail-row .wayback_url a:focus-visible {
    text-decoration: underline;
}
body.wmd-file-editor-modern .wmd-editor-external-icon {
    display: inline-block;
    width: 13px;
    height: 13px;
    margin-left: 5px;
    vertical-align: -2px;
    color: #1772ce;
}
body.wmd-file-editor-modern .wmd-editor-pages-count {
    font-weight: 700;
}
body.wmd-file-editor-modern .wmd-editor-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 20px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 750;
    line-height: 1.45;
}
body.wmd-file-editor-modern .wmd-editor-status-badge.is-complete {
    background: #d7f4de;
    color: #1b7437;
}
body.wmd-file-editor-modern .wmd-editor-status-badge.is-progress {
    background: #fff3da;
    color: #8b5c0b;
}
body.wmd-file-editor-modern .wmd-editor-action-row .wayback_url strong,
body.wmd-file-editor-modern .wmd-editor-action-row .wayback_url em {
    color: #16385f;
}
body.wmd-file-editor-modern .wayback_url_wrp .wmd-editor-url-comment {
    display: block;
    margin-top: 5px;
    font-size: 11px;
    color: #667b95;
    overflow-wrap: anywhere;
    white-space: normal;
}
@media (max-width: 375px) {
    body.wmd-file-editor-modern .wayback_url_wrp .fe_row.wmd-editor-detail-row {
        grid-template-columns: 21px 75px minmax(0, 1fr);
        column-gap: 5px;
    }
}

/* v8: when no progress message exists, use the compact sidebar heading.
   Keep the extra top room only when the top-right progress badge is visible. */
body.wmd-file-editor-modern .wmd-editor-sidebar-heading:not(:has(.ed_total_page_done)) {
    padding-top: 17px;
}


/* ===== v9: Ace highlighting, line counts, full-screen source editor =====
   Entirely scoped to the editor page; shared style.css is never changed. */
body.wmd-file-editor-modern #wmd-editor-code-stage {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 260px;
    width: 100%;
}
body.wmd-file-editor-modern #wmd-editor-code-stage .wmd-editor-code-header {
    flex: 0 0 auto;
}
body.wmd-file-editor-modern #wmd-editor-code-stage #filesarea {
    position: relative;
    box-sizing: border-box;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 130px;
    height: 300px;
    overflow: hidden;
}
body.wmd-file-editor-modern #wmd-editor-code-stage .editor_save_preview_btn {
    flex: 0 0 auto;
}
body.wmd-file-editor-modern #wmd-editor-code-stage #wmd-editor-ace {
    box-sizing: border-box;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    font-size: 13px;
    text-align: left;
    background: #fcfdff;
}
body.wmd-file-editor-modern #wmd-editor-code-stage .wmd-editor-code-tools {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    flex: 0 0 auto;
}
body.wmd-file-editor-modern #wmd-editor-code-stage .wmd-editor-code-fullscreen-toggle {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 30px;
    border: 1px solid transparent;
    border-radius: 7px;
    padding: 5px;
    color: #225b99;
    background: transparent;
    cursor: pointer;
}
body.wmd-file-editor-modern #wmd-editor-code-stage .wmd-editor-code-fullscreen-toggle:hover,
body.wmd-file-editor-modern #wmd-editor-code-stage .wmd-editor-code-fullscreen-toggle:focus-visible {
    background: #e5f1ff;
    border-color: #c6ddfa;
    color: #0b5cae;
}
body.wmd-file-editor-modern #wmd-editor-code-stage .wmd-editor-code-fullscreen-toggle:focus-visible {
    outline: 2px solid #0969c6;
    outline-offset: 2px;
}
body.wmd-file-editor-modern #wmd-editor-code-stage .wmd-editor-code-collapse { display: none; }
body.wmd-file-editor-modern #wmd-editor-code-stage .wmd-editor-code-fullscreen-toggle.is-expanded .wmd-editor-code-expand { display: none; }
body.wmd-file-editor-modern #wmd-editor-code-stage .wmd-editor-code-fullscreen-toggle.is-expanded .wmd-editor-code-collapse { display: block; }
body.wmd-file-editor-modern #wmd-editor-code-stage .wmd-editor-code-status {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex: 0 0 24px;
    min-height: 24px;
    padding: 3px 13px;
    color: #5e7490;
    background: #f6f9fe;
    border: 1px solid #dce7f4;
    border-top: 0;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}
body.wmd-file-editor-modern #wmd-editor-code-stage .ace_editor,
body.wmd-file-editor-modern #wmd-editor-code-stage .ace_gutter {
    font-family: Consolas, Monaco, 'Courier New', monospace;
}
body.wmd-file-editor-modern #wmd-editor-code-stage .ace_gutter {
    background: #f2f6fb;
    color: #8093aa;
}
body.wmd-file-editor-modern #wmd-editor-code-stage .ace_gutter-active-line {
    background: #dfedff;
}
body.wmd-file-editor-modern #wmd-editor-code-stage .ace_active-line {
    background: #ecf5ff;
}
/* The stage owns its content height; keep a 50/50 split with the live preview. */
@media (min-width: 993px) and (min-height: 620px) {
    body.wmd-file-editor-modern.wmd-editor-fitted #subright #wmd-editor-code-stage {
        flex: 1 1 0;
        min-height: 85px;
        height: auto;
    }
    body.wmd-file-editor-modern.wmd-editor-fitted #wmd-editor-code-stage #filesarea {
        flex: 1 1 0;
        min-height: 45px;
        height: auto;
    }
    body.wmd-file-editor-modern.wmd-editor-fitted #wmd-editor-code-stage .editor_save_preview_btn {
        margin-bottom: 8px;
    }
}
/* Source editor full-screen mode, independent of the existing preview full screen. */
body.wmd-file-editor-modern #wmd-editor-code-stage:fullscreen,
body.wmd-file-editor-modern #wmd-editor-code-stage.wmd-editor-code-overlay,
body.wmd-file-editor-modern.wmd-editor-fitted #wmd-editor-code-stage:fullscreen,
body.wmd-file-editor-modern.wmd-editor-fitted #wmd-editor-code-stage.wmd-editor-code-overlay {
    box-sizing: border-box;
    display: flex !important;
    flex-direction: column;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    min-width: 0;
    min-height: 0;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: #f6f9fe;
    z-index: 2147483600;
}
body.wmd-file-editor-modern #wmd-editor-code-stage.wmd-editor-code-overlay {
    position: fixed;
    inset: 0;
}
body.wmd-file-editor-modern.wmd-editor-code-overlay-open {
    overflow: hidden !important;
}
body.wmd-file-editor-modern #wmd-editor-code-stage:fullscreen .wmd-editor-code-header,
body.wmd-file-editor-modern #wmd-editor-code-stage.wmd-editor-code-overlay .wmd-editor-code-header {
    flex: 0 0 54px;
    min-height: 54px;
    border-radius: 0;
    padding: 8px 16px;
}
body.wmd-file-editor-modern #wmd-editor-code-stage:fullscreen #filesarea,
body.wmd-file-editor-modern #wmd-editor-code-stage.wmd-editor-code-overlay #filesarea,
body.wmd-file-editor-modern.wmd-editor-fitted #wmd-editor-code-stage:fullscreen #filesarea,
body.wmd-file-editor-modern.wmd-editor-fitted #wmd-editor-code-stage.wmd-editor-code-overlay #filesarea {
    flex: 1 1 0;
    min-height: 0;
    height: auto;
}
body.wmd-file-editor-modern #wmd-editor-code-stage:fullscreen .editor_save_preview_btn,
body.wmd-file-editor-modern #wmd-editor-code-stage.wmd-editor-code-overlay .editor_save_preview_btn {
    flex: 0 0 auto;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
}
body.wmd-file-editor-modern #wmd-editor-code-stage:fullscreen .wmd-editor-code-status,
body.wmd-file-editor-modern #wmd-editor-code-stage.wmd-editor-code-overlay .wmd-editor-code-status {
    flex: 0 0 28px;
    min-height: 28px;
}


/* ===== v10: compact original-style preview icons; code file actions ===== */
body.wmd-file-editor-modern .wmd-editor-preview-devices {
    gap: 6px;
}
body.wmd-file-editor-modern .wmd-editor-preview-mode {
    flex: 0 0 37px;
    width: 37px;
    height: 33px;
    padding: 7px;
    margin: 0;
    justify-content: center;
    border-radius: 6px;
    color: #284a73;
}
body.wmd-file-editor-modern .wmd-editor-preview-mode .wmd-editor-device-icon {
    flex: 0 0 19px;
    width: 19px;
    height: 19px;
}
body.wmd-file-editor-modern .wmd-editor-preview-mode.is-active {
    background: #c3e1ff;
    color: #086ac5;
    border-color: #b7d6f5;
}
body.wmd-file-editor-modern .wmd-editor-preview-mode:hover:not(.is-active),
body.wmd-file-editor-modern .wmd-editor-fullscreen-toggle:hover {
    background: #edf5ff;
    color: #0b62b6;
}
body.wmd-file-editor-modern .wmd-editor-preview-divider,
body.wmd-file-editor-modern .wmd-editor-code-toolbar-divider {
    display: inline-block;
    flex: 0 0 1px;
    height: 22px;
    width: 1px;
    margin: 0 4px;
    background: #d9e4f2;
}
body.wmd-file-editor-modern .wmd-editor-fullscreen-toggle {
    margin-left: 0;
    width: 34px;
    height: 33px;
}
body.wmd-file-editor-modern .iframe_wrp[data-preview-mode="tablet"] iframe {
    width: 768px;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 0 0 1px rgba(26, 54, 92, .15), 0 7px 20px rgba(20, 45, 80, .09);
}
body.wmd-file-editor-modern #wmd-editor-code-stage .wmd-editor-code-tools {
    gap: 5px;
}
body.wmd-file-editor-modern #wmd-editor-code-stage .wmd-editor-code-icon-actions {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}
body.wmd-file-editor-modern #wmd-editor-code-stage .wmd-editor-code-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 31px;
    width: 31px;
    height: 31px;
    padding: 5px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #225b99;
    cursor: pointer;
}
body.wmd-file-editor-modern #wmd-editor-code-stage .wmd-editor-code-icon-btn:hover,
body.wmd-file-editor-modern #wmd-editor-code-stage .wmd-editor-code-icon-btn:focus-visible {
    border-color: #c6ddfa;
    background: #e5f1ff;
    color: #0b5cae;
}
body.wmd-file-editor-modern #wmd-editor-code-stage .wmd-editor-code-icon-btn:focus-visible {
    outline: 2px solid #0969c6;
    outline-offset: 2px;
}
body.wmd-file-editor-modern #wmd-editor-code-stage .wmd-editor-code-header {
    position: relative;
}
body.wmd-file-editor-modern #wmd-editor-code-stage .wmd-editor-code-toast {
    position: absolute;
    right: 10px;
    top: 100%;
    z-index: 35;
    font-size: 11px;
    font-weight: 700;
    pointer-events: none;
    border-radius: 0 0 6px 6px;
    padding: 0;
    color: #177344;
    background: #e9f8ef;
}
body.wmd-file-editor-modern #wmd-editor-code-stage .wmd-editor-code-toast:not(:empty) {
    padding: 5px 9px;
    border: 1px solid #bde2c9;
}
body.wmd-file-editor-modern #wmd-editor-code-stage .wmd-editor-code-toast.is-error {
    color: #9b2929;
    background: #fff1ef;
    border-color: #f0c4c0;
}
@media (max-width: 600px) {
    body.wmd-file-editor-modern #wmd-editor-code-stage .wmd-editor-code-type { display: none; }
    body.wmd-file-editor-modern #wmd-editor-code-stage .wmd-editor-code-tools { gap: 2px; }
    body.wmd-file-editor-modern #wmd-editor-code-stage .wmd-editor-code-icon-btn { width: 29px; flex-basis: 29px; }
    body.wmd-file-editor-modern .wmd-editor-preview-devices { gap: 3px; }
}


/* ===== v12: mobile/tablet flow, editor-only overrides =====
   The shared style.css assigns #subleft a 376px height and .subleft_wrp
   a 250px height. These are useful for the original desktop UI but produce
   blank space below Reset All on phones. Leave the fitted desktop grid alone.
*/
@media (max-width: 992px) {
    /* Override the old 165px mobile top padding without affecting the navbar. */
    body.wmd-file-editor-modern #feature { padding-top: 80px !important; }
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) {
        height: auto !important;
        min-height: 100%;
        overflow-x: hidden;
        overflow-y: auto !important;
    }
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) .wmd-editor-shell {
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        gap: 12px;
        width: 100%;
        height: auto !important;
        min-height: 0 !important;
        overflow: visible;
    }
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) .wmd-editor-shell::after {
        display: none;
        content: none;
    }
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) #subleft,
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) #subright,
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) #sub_buttom {
        box-sizing: border-box;
        position: relative;
        float: none;
        flex: 0 0 auto;
        width: 100%;
        height: auto !important;
        min-width: 0;
        min-height: 0 !important;
        margin: 0 !important;
    }
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) #subleft {
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) #subleft .subleft_wrp {
        box-sizing: border-box;
        display: block;
        flex: 0 0 auto;
        width: 100%;
        height: auto !important;
        min-height: 0 !important;
        max-height: none;
        overflow: visible;
    }
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) #subleft .editor_file_listing {
        box-sizing: border-box;
        float: none;
        width: 100%;
        max-height: 260px;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) #subleft .editor_reset_wrp {
        box-sizing: border-box;
        float: none;
        flex: 0 0 auto;
        clear: both;
        width: 100%;
        height: auto !important;
        margin: 0 !important;
        padding: 9px 12px 12px !important;
        border-top: 1px solid var(--wmd-ed-line);
    }
    /* The two hidden double-click areas remain usable without forcing height. */
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) #hidden_buttons_top,
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) #hidden_buttons_btm {
        z-index: 99;
    }
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) #subright {
        display: flex;
        flex-direction: column;
        gap: 0;
    }
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) #wmd-editor-code-stage,
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) #wmd-editor-preview-stage {
        box-sizing: border-box;
        display: flex;
        flex: 0 0 auto;
        flex-direction: column;
        height: auto !important;
        min-height: 0;
        width: 100%;
    }
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) #wmd-editor-code-stage #filesarea {
        flex: 0 0 auto;
        box-sizing: border-box;
        width: 100%;
        height: min(45vh, 400px) !important;
        min-height: 240px;
        max-height: 400px;
        overflow: hidden;
    }
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) #wmd-editor-code-stage #wmd-editor-ace {
        height: 100% !important;
        width: 100%;
    }
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) #wmd-editor-code-stage .editor_save_preview_btn {
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        flex: 0 0 auto;
        align-items: stretch;
        justify-content: flex-start;
        gap: 8px;
        width: 100%;
        min-height: 0;
        margin-bottom: 12px;
        padding: 10px 12px;
    }
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) .editor_save_preview_btn .file_editor_alert_wrp,
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) .editor_save_preview_btn .preview_wrp {
        box-sizing: border-box;
        flex: 0 0 auto;
        width: 100%;
        min-width: 0;
    }
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) .editor_save_preview_btn .preview_wrp {
        display: flex;
        justify-content: stretch;
        gap: 8px;
    }
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) .editor_save_preview_btn .preview_wrp .btn {
        flex: 1 1 170px;
        white-space: normal;
        text-align: center;
    }
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) .wmd-editor-preview-stage .iframe_wrp {
        box-sizing: border-box;
        display: block;
        flex: 0 0 auto;
        width: 100%;
        height: min(55vh, 450px) !important;
        min-height: 260px;
        max-height: 450px;
        overflow: hidden;
    }
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) .wmd-editor-preview-stage .iframe_wrp iframe {
        height: 100% !important;
        max-width: 100%;
    }
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) #sub_buttom {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: stretch;
        gap: 8px;
        padding: 12px;
        z-index: 30;
    }
    /* Preserve fullscreen modes on mobile: their own overlay rules win. */
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) #wmd-editor-code-stage:fullscreen,
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) #wmd-editor-code-stage.wmd-editor-code-overlay,
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) #wmd-editor-preview-stage:fullscreen,
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) #wmd-editor-preview-stage.wmd-editor-preview-overlay {
        position: fixed;
        height: 100dvh !important;
        min-height: 0;
        max-height: none;
    }
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) #wmd-editor-code-stage:fullscreen #filesarea,
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) #wmd-editor-code-stage.wmd-editor-code-overlay #filesarea {
        flex: 1 1 auto;
        height: auto !important;
        min-height: 0;
        max-height: none;
    }
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) #wmd-editor-preview-stage:fullscreen .iframe_wrp,
    body.wmd-file-editor-modern:not(.wmd-editor-fitted) #wmd-editor-preview-stage.wmd-editor-preview-overlay .iframe_wrp {
        flex: 1 1 auto;
        height: auto !important;
        max-height: none;
        min-height: 0;
    }
}
@media (max-width: 600px) {
    body.wmd-file-editor-modern #feature > .container {
        box-sizing: border-box;
        width: 100%;
        max-width: 100%;
        padding-left: 10px;
        padding-right: 10px;
    }
    /* Bootstrap row gutters must match the editor container on narrow screens. */
    body.wmd-file-editor-modern #feature > .container > .row {
        margin-left: -10px;
        margin-right: -10px;
    }
    body.wmd-file-editor-modern .wmd-editor-preview-header {
        gap: 6px;
        padding: 8px 10px;
    }
    body.wmd-file-editor-modern .wmd-editor-preview-devices {
        gap: 0;
    }
    body.wmd-file-editor-modern .wmd-editor-preview-mode {
        flex-basis: 33px;
        width: 33px;
        padding: 5px;
    }
    body.wmd-file-editor-modern #sub_buttom > .btn,
    body.wmd-file-editor-modern #sub_buttom > ul,
    body.wmd-file-editor-modern #sub_buttom > ul > li > .btn {
        box-sizing: border-box;
        flex: 1 1 100%;
        width: 100%;
        margin: 0;
    }
    body.wmd-file-editor-modern .editor_save_preview_btn .preview_wrp .btn {
        flex: 1 1 100%;
        width: 100%;
    }
    body.wmd-file-editor-modern .wayback_url_wrp {
        margin: 10px 10px 12px;
    }
}


/* ===== v13: PURE CSS VIEWPORT LAYOUT (no resize_screen() JavaScript) =====
   Desktop uses normal-flow navbar + a viewport-height flex shell. The browser
   itself allocates the remaining height; hidden overflow only affects the page,
   not the independent file tree, source editor, or embedded website scrollbars.
   These selectors apply ONLY to the file editor, not to shared style.css.
*/
@media (min-width: 993px) {
    html:has(body.wmd-file-editor-modern .wmd-editor-shell) {
        height: 100%;
        overflow: hidden;
    }
    body.wmd-file-editor-modern:has(.wmd-editor-shell) {
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        overflow: hidden;
    }
    /* The site header must take up its true height instead of overlapping
       the first row of the editor (it can stay sticky on other pages). */
    body.wmd-file-editor-modern:has(.wmd-editor-shell) #wmd_header {
        box-sizing: border-box;
        position: relative !important;
        inset: auto !important;
        transform: none !important;
        flex: 0 0 auto;
        width: 100%;
        margin: 0;
    }
    body.wmd-file-editor-modern:has(.wmd-editor-shell) #gen_loading {
        position: fixed;
    }
    /* Footer content is not part of the single-screen editing workspace. */
    body.wmd-file-editor-modern:has(.wmd-editor-shell) > footer,
    body.wmd-file-editor-modern:has(.wmd-editor-shell) > #footer {
        display: none;
    }
    body.wmd-file-editor-modern:has(.wmd-editor-shell) #feature {
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        flex: 1 1 0;
        height: auto !important;
        min-height: 0;
        padding: 8px 0 6px !important;
        margin: 0 !important;
        overflow: hidden;
    }
    body.wmd-file-editor-modern #feature > .container,
    body.wmd-file-editor-modern #feature > .container > .row,
    body.wmd-file-editor-modern #feature > .container > .row > .col-md-12 {
        box-sizing: border-box;
        height: 100%;
        min-height: 0;
    }
    body.wmd-file-editor-modern #feature > .container {
        flex: 1 1 0;
        min-width: 0;
    }
    body.wmd-file-editor-modern .wmd-editor-shell {
        box-sizing: border-box;
        display: grid;
        grid-template-columns: 320px minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr) auto;
        column-gap: 18px;
        row-gap: 8px;
        height: 100%;
        min-height: 0;
        min-width: 0;
        overflow: visible;
    }
    body.wmd-file-editor-modern .wmd-editor-shell::after {
        display: none;
        content: none;
    }
    body.wmd-file-editor-modern #subleft {
        box-sizing: border-box;
        grid-column: 1;
        grid-row: 1 / 3;
        display: flex;
        flex-direction: column;
        float: none;
        width: 100%;
        height: auto !important;
        min-height: 0;
        min-width: 0;
        margin: 0;
        overflow: hidden;
    }
    body.wmd-file-editor-modern #subleft .subleft_wrp {
        box-sizing: border-box;
        flex: 1 1 0;
        height: auto !important;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
    }
    body.wmd-file-editor-modern #subleft .editor_reset_wrp {
        flex: 0 0 auto;
        position: relative;
        padding: 8px 12px 12px;
        margin: 0;
    }
    body.wmd-file-editor-modern #subright {
        box-sizing: border-box;
        grid-column: 2;
        grid-row: 1;
        display: flex;
        flex-direction: column;
        float: none;
        width: 100%;
        height: auto !important;
        min-width: 0;
        min-height: 0;
        margin: 0;
        overflow: hidden;
    }
    body.wmd-file-editor-modern #subright .quiz_alert {
        flex: 0 0 auto;
    }
    body.wmd-file-editor-modern #subright #wmd-editor-code-stage,
    body.wmd-file-editor-modern #subright #wmd-editor-preview-stage {
        box-sizing: border-box;
        display: flex;
        flex: 1 1 0;
        flex-direction: column;
        width: 100%;
        height: auto !important;
        min-width: 0;
        min-height: 0 !important;
        overflow: hidden;
    }
    body.wmd-file-editor-modern #wmd-editor-code-stage .wmd-editor-code-header,
    body.wmd-file-editor-modern #wmd-editor-preview-stage .wmd-editor-preview-header,
    body.wmd-file-editor-modern #wmd-editor-code-stage .wmd-editor-code-status,
    body.wmd-file-editor-modern #wmd-editor-code-stage .editor_save_preview_btn {
        flex: 0 0 auto;
    }
    body.wmd-file-editor-modern #wmd-editor-code-stage #filesarea,
    body.wmd-file-editor-modern #wmd-editor-preview-stage .iframe_wrp {
        box-sizing: border-box;
        flex: 1 1 0;
        width: 100%;
        height: auto !important;
        min-height: 0;
        max-height: none;
        overflow: hidden;
    }
    body.wmd-file-editor-modern #filesarea .wmd-editor-ace,
    body.wmd-file-editor-modern #filesarea textarea.code_textarea,
    body.wmd-file-editor-modern #wmd-editor-preview-stage .iframe_wrp iframe {
        box-sizing: border-box;
        width: 100%;
        height: 100% !important;
        min-height: 0;
    }
    body.wmd-file-editor-modern #wmd-editor-code-stage .editor_save_preview_btn {
        min-height: 0;
        margin: 0 0 7px;
        padding: 6px 10px;
    }
    body.wmd-file-editor-modern #sub_buttom {
        box-sizing: border-box;
        grid-column: 2;
        grid-row: 2;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
        float: none;
        width: 100%;
        min-width: 0;
        min-height: 50px;
        height: auto;
        margin: 0;
        padding: 6px 10px;
        position: relative;
        z-index: 30;
        overflow: visible;
    }
    /* Keep the hidden double-click hotspots available. */
    body.wmd-file-editor-modern #hidden_buttons_top,
    body.wmd-file-editor-modern #hidden_buttons_btm {
        z-index: 99;
    }
    /* Fullscreen states win over the normal flex layout. */
    body.wmd-file-editor-modern #wmd-editor-code-stage:is(:fullscreen, .wmd-editor-code-overlay),
    body.wmd-file-editor-modern #wmd-editor-preview-stage:is(:fullscreen, .wmd-editor-preview-overlay) {
        position: fixed;
        inset: 0;
        flex: 0 0 auto;
        height: 100dvh !important;
        min-height: 0 !important;
        overflow: hidden;
    }
    body.wmd-file-editor-modern #wmd-editor-code-stage:is(:fullscreen, .wmd-editor-code-overlay) #filesarea,
    body.wmd-file-editor-modern #wmd-editor-preview-stage:is(:fullscreen, .wmd-editor-preview-overlay) .iframe_wrp {
        flex: 1 1 0;
        height: auto !important;
        min-height: 0;
    }
}

/* Short desktop windows stay in the same CSS grid, but give space back to
   the code/preview panels instead of pushing them below the viewport. */
@media (min-width: 993px) and (max-height: 700px) {
    body.wmd-file-editor-modern:has(.wmd-editor-shell) #feature {
        padding: 5px 0 4px !important;
    }
    body.wmd-file-editor-modern .wmd-editor-shell {
        row-gap: 5px;
    }
    body.wmd-file-editor-modern .wmd-editor-code-header,
    body.wmd-file-editor-modern .wmd-editor-preview-header {
        min-height: 35px;
        padding: 5px 10px;
    }
    body.wmd-file-editor-modern #wmd-editor-code-stage .editor_save_preview_btn {
        padding: 4px 8px;
        margin-bottom: 5px;
    }
    body.wmd-file-editor-modern #sub_buttom {
        min-height: 44px;
        padding: 4px 7px;
    }
    body.wmd-file-editor-modern #sub_buttom > .btn,
    body.wmd-file-editor-modern #sub_buttom > ul > li > .btn {
        min-height: 34px;
        padding: 6px 11px;
    }
    body.wmd-file-editor-modern #subleft .editor_reset_wrp {
        padding: 6px 10px 12px;
    }
}

/* Narrow screens continue as a regular vertical document; the file-tree and
   Ace editor are scrollable within their own panels. This rule is a CSS
   breakpoint, not a JS class toggle. */
@media (max-width: 992px) {
    html:has(body.wmd-file-editor-modern .wmd-editor-shell),
    body.wmd-file-editor-modern:has(.wmd-editor-shell) {
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
    }
}


/* ===== v14: preview device modes =====
   The CSS-only layout below sets iframe width to 100% using a selector
   containing #wmd-editor-preview-stage. These rules must have equal-or-higher
   specificity so Desktop/Tablet/Mobile buttons can change the viewport size.
   This applies only to the file-editor page; shared style.css is untouched. */
body.wmd-file-editor-modern #wmd-editor-preview-stage .iframe_wrp[data-preview-mode="desktop"] iframe {
    width: 100%;
    max-width: 100%;
    margin-inline: auto;
}
body.wmd-file-editor-modern #wmd-editor-preview-stage .iframe_wrp[data-preview-mode="tablet"] iframe {
    width: 768px;
    max-width: 100%;
    margin-inline: auto;
}
body.wmd-file-editor-modern #wmd-editor-preview-stage .iframe_wrp[data-preview-mode="mobile"] iframe {
    width: 390px;
    max-width: 100%;
    margin-inline: auto;
}


/* ===== v15: progress clarity, loaded-file search, refresh and edit safety ===== */
body.wmd-file-editor-modern .wmd-editor-progress-summary {
    margin: 10px 14px 0;
    padding: 10px 12px;
    border: 1px solid #deebfa;
    border-radius: 10px;
    background: #f9fbff;
    font-size: 11.5px;
    color: #49637d;
}
body.wmd-file-editor-modern .wmd-editor-progress-summary[hidden] { display: none !important; }
body.wmd-file-editor-modern .wmd-editor-progress-heading,
body.wmd-file-editor-modern .wmd-editor-progress-files {
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
body.wmd-file-editor-modern .wmd-editor-progress-heading strong,
body.wmd-file-editor-modern .wmd-editor-progress-files strong { color: #174c8d; font-variant-numeric: tabular-nums; }
body.wmd-file-editor-modern .wmd-editor-progress-track {
    width: 100%; height: 7px; margin: 8px 0; overflow: hidden;
    border-radius: 20px; background: #e1edfb;
}
body.wmd-file-editor-modern .wmd-editor-progress-fill {
    display: block; height: 100%; border-radius: inherit; background: #237bd3;
    transition: width .25s ease;
}
body.wmd-file-editor-modern .wmd-editor-live-banner {
    min-height: 36px; margin-bottom: 8px !important; padding: 8px 34px 8px 13px;
    display: flex; align-items: center; gap: 9px;
    font-size: 12px; font-weight: 600; line-height: 1.3; text-align: left;
}
body.wmd-file-editor-modern .wmd-editor-live-banner .close {
    position: absolute; top: 5px; right: 10px; line-height: 24px;
}
body.wmd-file-editor-modern .wmd-editor-live-dot {
    display: inline-block; flex: 0 0 8px; width: 8px; height: 8px;
    border-radius: 50%; background: #37a960;
    box-shadow: 0 0 0 3px rgba(55,169,96,.12);
}
body.wmd-file-editor-modern .wmd-editor-live-banner .editor_quiz_alert_content {
    flex: 1 1 auto; min-width: 0; text-align: left;
}
body.wmd-file-editor-modern .wmd-editor-live-updated { flex: 0 0 auto; font-size: 11px; opacity: .7; }
body.wmd-file-editor-modern .wmd-editor-live-banner.is-complete .wmd-editor-live-dot { background: #2365a3; }
body.wmd-file-editor-modern .wmd-editor-tree-tools { display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; }
body.wmd-file-editor-modern .wmd-editor-tree-refresh {
    display: inline-flex; justify-content: center; align-items: center;
    width: 27px; height: 27px; padding: 4px;
    color: #2262a8; background: #eaf3ff; border: 1px solid #d5e6f9;
    border-radius: 7px; cursor: pointer;
}
body.wmd-file-editor-modern .wmd-editor-tree-refresh:hover,
body.wmd-file-editor-modern .wmd-editor-tree-refresh:focus-visible { background: #d9eaff; outline-color: #237bd3; }
body.wmd-file-editor-modern .wmd-editor-tree-refresh.has-new-files { color: #fff; background: #2678cf; border-color: #2678cf; }
body.wmd-file-editor-modern .wmd-editor-tree-refresh.is-loading svg { animation: wmd-file-refresh-spin 1s linear infinite; }
@keyframes wmd-file-refresh-spin { to { transform: rotate(360deg); } }
body.wmd-file-editor-modern .wmd-editor-search-wrap {
    display: flex; align-items: center; gap: 6px;
    margin: 0 14px 10px; padding: 7px 10px;
    min-height: 35px; border-radius: 8px; border: 1px solid #d6e5f6;
    background: #fff; color: #55789f;
}
body.wmd-file-editor-modern .wmd-editor-search-wrap:focus-within { border-color: #2879d3; box-shadow: 0 0 0 2px rgba(40,121,211,.1); }
body.wmd-file-editor-modern #wmd-file-search {
    width: 100%; min-width: 0; flex: 1; border: 0; outline: 0;
    background: transparent; color: #254665; font-size: 12px; font-weight: 400;
}
body.wmd-file-editor-modern .wmd-editor-search-clear {
    border: 0; background: transparent; font-size: 20px; color: #667c93;
    padding: 0 2px; cursor: pointer; line-height: 1;
}
body.wmd-file-editor-modern .wmd-editor-search-clear[hidden],
body.wmd-file-editor-modern .wmd-editor-search-results[hidden] { display: none !important; }
body.wmd-file-editor-modern .wmd-editor-search-results { padding: 0 12px 10px; }
body.wmd-file-editor-modern .wmd-editor-file-result {
    display: flex; gap: 9px; align-items: center;
    background: #fff; width: 100%; padding: 8px 9px;
    border: none; border-radius: 6px; color: #245487;
    cursor: pointer; text-align: left; font-weight: 500; font-size: 12px;
}
body.wmd-file-editor-modern .wmd-editor-file-result:hover,
body.wmd-file-editor-modern .wmd-editor-file-result:focus-visible { background: #eaf3ff; }
body.wmd-file-editor-modern .wmd-editor-file-result-name { min-width: 0; overflow-wrap: anywhere; }
body.wmd-file-editor-modern .wmd-editor-search-hint,
body.wmd-file-editor-modern .wmd-editor-search-empty { font-size: 11px; margin: 7px 4px; color: #6b829c; line-height: 1.45; }
body.wmd-file-editor-modern .wmd-editor-dirty-indicator {
    flex: 0 0 auto; padding: 3px 7px;
    background: #fff2db; color: #835100; border: 1px solid #f0d8ad;
    border-radius: 12px; font-size: 10px; font-weight: 700;
}
body.wmd-file-editor-modern .wmd-editor-dirty-indicator[hidden] { display: none !important; }
@media (max-width: 600px) {
    body.wmd-file-editor-modern .wmd-editor-progress-summary { margin: 8px 12px; }
    body.wmd-file-editor-modern .wmd-editor-live-updated { display: none; }
    body.wmd-file-editor-modern .wmd-editor-dirty-indicator { font-size: 9px; padding: 2px 5px; }
}


/* ===== v16: one progress location, compact heading, and edge-aligned recovery banner ===== */
/* Desktop/mobile use the same compact heading whenever there is no exceptional notice. */
body.wmd-file-editor-modern .wmd-editor-sidebar-heading {
    padding: 16px 17px;
}
body.wmd-file-editor-modern .wmd-editor-sidebar-heading:has(.ed_total_page_done) {
    padding-top: 38px;
}

/* A legible percentage inside the progress bar; the numeric page count stays above it. */
body.wmd-file-editor-modern .wmd-editor-progress-summary {
    padding: 9px 11px;
}
body.wmd-file-editor-modern .wmd-editor-progress-track {
    position: relative;
    height: 19px;
    margin: 7px 0;
    border-radius: 9px;
}
body.wmd-file-editor-modern .wmd-editor-progress-percent {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 1px 6px;
    border-radius: 5px;
    background: rgba(255, 255, 255, .93);
    color: #125296;
    font-size: 10px;
    line-height: 14px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    pointer-events: none;
}

/* Shared style.css defines .quiz_alert { padding: 0 80px !important; height: 50px; }.
   Override those values only for this editor's live status banner. */
body.wmd-file-editor-modern #subright .quiz_alert.wmd-editor-live-banner {
    display: flex !important;
    align-items: center;
    min-height: 32px;
    height: auto !important;
    padding: 6px 27px 6px 9px !important;
    gap: 8px;
    margin: 0 0 8px !important;
    text-align: left;
}
body.wmd-file-editor-modern .wmd-editor-live-banner .editor_quiz_alert_content {
    display: block;
    width: auto;
    min-width: 0;
    flex: 1 1 auto;
    text-align: left;
}
body.wmd-file-editor-modern .wmd-editor-live-banner .wmd-editor-live-updated {
    text-align: right;
}
body.wmd-file-editor-modern .wmd-editor-live-banner .close {
    top: 4px;
    right: 6px;
}
@media (max-width: 600px) {
    body.wmd-file-editor-modern .wmd-editor-sidebar-heading {
        padding: 14px 16px;
    }
    body.wmd-file-editor-modern .wmd-editor-sidebar-heading:has(.ed_total_page_done) {
        padding-top: 38px;
    }
}
@media (prefers-reduced-motion: reduce) {
    body.wmd-file-editor-modern .wmd-editor-progress-fill { transition: none; }
}

/* ===== v21: mobile navbar clearance and status display ===== */
@media (max-width: 992px) {
    /* The legacy editor has a negative #feature margin and fixed-position menu.
       Put the navbar back into normal flow on this page only. */
    body.wmd-file-editor-modern #wmd_header {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        transform: none !important;
        width: 100%;
        height: auto;
        z-index: 100;
    }
    body.wmd-file-editor-modern #feature {
        margin-top: 0 !important;
        padding-top: 12px !important;
    }
}
body.wmd-file-editor-modern .wmd-editor-demo-limit[hidden] {
    display: none !important;
}

/* v22 - Keep the recovery banner close control vertically centered on mobile.
   Override the legacy .quiz_alert .close absolute-position rule only here. */
body.wmd-file-editor-modern #subright .quiz_alert.wmd-editor-live-banner {
    padding: 6px 9px !important;
}
body.wmd-file-editor-modern #subright .quiz_alert.wmd-editor-live-banner > .close {
    position: static !important;
    inset: auto !important;
    top: auto !important;
    right: auto !important;
    float: none !important;
    transform: none !important;
    flex: 0 0 24px;
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin: 0 0 0 3px;
    padding: 0;
    line-height: 1;
    opacity: .65;
}
body.wmd-file-editor-modern #subright .quiz_alert.wmd-editor-live-banner > .close:hover,
body.wmd-file-editor-modern #subright .quiz_alert.wmd-editor-live-banner > .close:focus {
    opacity: 1;
}
@media (max-width: 600px) {
    body.wmd-file-editor-modern #subright .quiz_alert.wmd-editor-live-banner {
        gap: 6px;
        min-height: 36px;
    }
    body.wmd-file-editor-modern .wmd-editor-live-banner .wmd-editor-live-updated {
        font-size: 10px;
    }
}

/* v25: compact countdown inside the existing recovery banner. */
body.wmd-file-editor-modern .wmd-editor-live-banner .wmd-editor-next-check {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    opacity: .85;
}
body.wmd-file-editor-modern .wmd-editor-live-banner .wmd-editor-next-check-seconds {
    font-weight: 800;
}
body.wmd-file-editor-modern .wmd-editor-live-banner .wmd-editor-next-check[hidden] {
    display: none !important;
}
@media (max-width: 600px) {
    body.wmd-file-editor-modern .wmd-editor-live-banner .wmd-editor-next-check {
        font-size: 10px;
    }
}
