body {
    font-family: 'Roboto', sans-serif !important;
    margin: 0;
    padding: 0;
    /* Reserve space for the fixed navbar (56px) so content isn't hidden under
       it; border-box keeps min-height:100vh from adding an extra 56px scroll. */
    padding-top: 56px;
    box-sizing: border-box;
    background-color: var(--bg-body);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-size: 16px;
}

/* Paragraph spacing */
p {
    margin-bottom: 20px;
    line-height: 1.6;
    font-size: 16px;
}

/* List and general text sizing */
li, ol, ul {
    font-size: 16px;
    line-height: 1.6;
}

/* Unified content lists (plain <ul>/<ol> in article bodies). Lists that carry
   a class — reference-list, the floating TOC, nav menus — keep their own
   styling and are intentionally excluded. The TOC's <ul> is class-less but
   lives inside .toc-float, so it is re-reset below. */
.site-content ul:not([class]),
.site-content ol:not([class]) {
    padding-left: 1.6em;
    margin: 0 0 16px;
}
.site-content ul:not([class]) { list-style: disc; }
.site-content ol:not([class]) { list-style: decimal; }
.site-content ul:not([class]) ul:not([class]) { list-style: circle; margin-bottom: 0; }
.site-content ul:not([class]) > li,
.site-content ol:not([class]) > li {
    margin-bottom: 6px;
    padding-left: 4px;
}
.site-content ul:not([class]) > li::marker,
.site-content ol:not([class]) > li::marker {
    color: var(--primary-color);
}
/* Leave the floating TOC untouched (its <ul> has no class). */
.toc-float ul:not([class]) {
    list-style: none;
    padding-left: 0;
    margin: 0;
}
.toc-float ul:not([class]) > li { margin-bottom: 0; padding-left: 0; }

/* Changelog list — opt-in via class="changelog" on a <ul>. */
ul.changelog {
    list-style: none;
    padding-left: 0;
    margin: 8px 0 16px;
}
ul.changelog > li {
    display: flex;
    gap: 12px;
    align-items: baseline;
    padding: 4px 0;
}
ul.changelog .changelog-date {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
    font-size: .82rem;
    font-weight: 600;
    color: var(--primary-color);
    background: var(--primary-light);
    padding: 2px 10px;
    border-radius: 999px;
    white-space: nowrap;
}
ul.changelog .changelog-text { color: var(--text-primary); }

div, span {
    font-size: inherit;
}

/* Ant Design Typography - Headings */
h1.ant-typography {
    color: var(--text-primary);
    margin-bottom: 24px;
    font-size: 36px;
    font-weight: 600;
    line-height: 1.35;
}

h2.ant-typography {
    color: var(--text-primary);
    margin-bottom: 20px;
    margin-top: 32px;
    font-size: 30px;
    font-weight: 600;
    line-height: 1.35;
}

h3.ant-typography {
    color: var(--text-primary);
    margin-bottom: 16px;
    margin-top: 24px;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.35;
}

h4.ant-typography {
    color: var(--text-primary);
    margin-bottom: 16px;
    margin-top: 20px;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.4;
}

h2, h3, h4, h5, h6 {
    margin-top: 32px;
    margin-bottom: 16px;
}

h1:first-child, h2:first-child, h3:first-child, h4:first-child {
    margin-top: 0;
}

/* Ant Design Navbar */
.ant-navbar {
    background-color: var(--bg-navbar);
    /* Translucent overlay for subtle depth (lighter top → darker bottom)
       without hardcoding greens, so --bg-navbar stays the single source. */
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(0, 0, 0, 0.10) 100%);
    padding: 0 50px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    min-height: 56px;
    height: 56px;
    flex-shrink: 0;
    /* Fixed (not sticky): inside the flex-column body, sticky sticks initially
       then scrolls away in some browsers. Fixed keeps it pinned everywhere;
       body padding-top below reserves the 56px it no longer occupies in flow. */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1100;
}

/* Progress bar pinned to the navbar's bottom edge (opt-in per page). */
.navbar-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.18);
    display: none;
}
.navbar-progress.active { display: block; }
.navbar-progress-bar {
    height: 100%;
    width: 100%;
    background: #fadb14;             /* amber = time remaining */
    transition: width 1s linear, background-color 0.4s ease;
}
.navbar-progress-bar.low { background: #ff4d4f; }   /* < 1 min left */

.navbar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
    height: 100%;
}

.navbar-brand {
    display: flex;
    align-items: center;
    height: 100%;
}

.navbar-right {
    display: flex;
    align-items: center;
}

/* Ant Design Menu Customization */
.ant-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    background-color: transparent;
    border: none;
    height: 100%;
    font-weight: normal;
    align-items: center;
}

.ant-menu-item,
.ant-menu-submenu {
    position: relative;
    display: flex;
    align-items: center;
    padding: 0 4px;
    color: white;
    cursor: pointer;
    height: 100%;
}

.ant-menu-item a,
.ant-menu-submenu-title {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

/* Direct child (`.ant-menu >`) so this white wash only tints the TOP-LEVEL
   navbar items sitting on the green bar. Without the `>` it also hit every
   dropdown/flyout popup <a>, layering a grey-white veil over their green
   --dropdown-hover and making all menu highlights look grey in dark mode. */
.ant-menu > .ant-menu-item:hover > a,
.ant-menu-submenu:hover .ant-menu-submenu-title {
    background-color: rgba(255, 255, 255, 0.14);
}

.ant-menu > .ant-menu-item-selected > a,
.ant-menu-submenu-selected .ant-menu-submenu-title {
    background-color: rgba(255, 255, 255, 0.18);
    font-weight: 500;
}

/* Dropdown Menu */
.ant-menu-submenu-popup {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--dropdown-bg);
    min-width: 190px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    padding: 6px;
    list-style: none;
    margin: 0;
    z-index: 1000;
    margin-top: 6px;
    border: 1px solid var(--border-light);

    /* Animation properties */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

/* Invisible bridge across the gap so the dropdown stays open while the
   cursor travels from the title to the popup. */
.ant-menu-submenu-popup::before {
    content: "";
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
}

.ant-menu-submenu:hover .ant-menu-submenu-popup {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.ant-menu-submenu-popup .ant-menu-item {
    line-height: 1.5;
    padding: 0;
    border-bottom: none !important;
    border-radius: 6px;
    overflow: hidden;
    display: block;
    transition: background-color 0.2s ease, padding-left 0.2s ease;
}

.ant-menu-submenu-popup .ant-menu-item a {
    color: var(--text-primary);
    text-decoration: none;
    display: block;
    white-space: nowrap;
    transition: color 0.2s ease, padding-left 0.2s ease;
    padding: 8px 16px;
    width: 100%;
}

/* :not(.py-subnav) so the "Tutorial For Python" parent row does NOT stay
   highlighted as a heavy block while the cursor is inside its flyout — the
   parent header gets its own direct-hover rule below instead. */
.ant-menu-submenu-popup .ant-menu-item:hover:not(.py-subnav) {
    background-color: var(--dropdown-hover);
    border-bottom: none !important;
}

.ant-menu-submenu-popup .ant-menu-item:hover a {
    padding-left: 20px;
}

/* Third-level flyout: "Tutorial For Python" nested inside the HU-Only
   dropdown. Decoupled from .ant-menu-submenu (own classes) so the mobile
   accordion JS leaves it alone; on mobile it flattens inline (see media query
   at the end of this file). */
/* Two-class selector so it beats `.ant-menu-submenu-popup .ant-menu-item
   { overflow:hidden }` (equal specificity, defined later) — otherwise the
   flyout positioned at left:100% gets clipped and never appears. */
.ant-menu-submenu-popup .py-subnav {
    position: relative;
    padding: 0;
    overflow: visible;
}
.py-subnav-title {
    position: relative;
    display: block;
    /* Parent label is a non-clickable header; only the Lecture items navigate.
       Hovering it still reveals the flyout (handled on .py-subnav:hover). */
    cursor: default;
    padding: 8px 16px;
    color: var(--text-primary);
    border-radius: 6px;
    transition: background-color 0.2s ease;
}
/* Highlight the header only on direct hover, so it clears once the cursor
   moves right into the flyout (flyout visibility is driven by .py-subnav:hover,
   which is unaffected). */
.py-subnav-title:hover {
    background-color: var(--dropdown-hover);
}
.py-subnav-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: var(--text-secondary);
    pointer-events: none;
}
.py-subnav:hover .py-subnav-arrow {
    color: var(--link-color);
}
.py-subnav-popup {
    position: absolute;
    top: -7px;
    left: 100%;
    margin-left: 6px;
    min-width: 230px;
    background-color: var(--dropdown-bg);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    border: 1px solid var(--border-light);
    padding: 6px;
    margin-top: 0;
    list-style: none;
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}
/* Bridge across the horizontal gap so the flyout stays open while the cursor
   travels from the title to the popup. */
.py-subnav-popup::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -12px;
    width: 14px;
}
.py-subnav:hover .py-subnav-popup {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}
.py-subnav-popup .ant-menu-item {
    border-radius: 6px;
    overflow: hidden;
}
.py-subnav-popup .ant-menu-item a {
    display: block;
    padding: 8px 16px;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.2s ease, padding-left 0.2s ease;
}
.py-subnav-popup .ant-menu-item:hover {
    background-color: var(--dropdown-hover);
}
.py-subnav-popup .ant-menu-item:hover a {
    padding-left: 20px;
}

.ant-menu-submenu-title {
    cursor: pointer;
}

/* Hide back button on desktop */
.ant-menu-item.submenu-back {
    display: none;
}

/* Menu Divider */
.ant-menu-divider {
    height: 1px;
    margin: 8px 0;
    background-color: var(--border-color, #d0d7de);
    list-style: none;
}

[data-theme="dark"] .ant-menu-divider {
    background-color: var(--border-color, #30363d);
}

/* Content Container */
.site-content {
    max-width: 1000px;
    margin: 30px auto;
    padding: 0 20px;
    flex: 1;
    width: 100%;
}
.toc-figure {
    text-align: center;
}
.toc-figure img {
    max-height: 400px;
    max-width: 100%;
}

/* Figures and captions (site-wide). A per-image max-width may still be set
   inline to cap the display size; everything else lives here. */
figure {
    margin: 24px 0;
}
figure img {
    max-width: 100%;
    height: auto;
}
figcaption {
    margin-top: 8px;
    line-height: 1.35;
    font-size: 14px;
    color: var(--text-tertiary);
}

/* Back to Top button styling */
.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-color);
    /* Button is always dark-green in both themes, so the arrow is always white.
       (var(--text-inverse) flips to black in dark mode → black-on-green.) */
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: all 0.3s;
    z-index: 1000;
    font-size: 16px;
}

.back-to-top:hover {
    background-color: #52c41a;
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* Old heading styles - removed to use Ant Design format
h3, h4, h5, h6 {
    border-bottom: solid 5px var(--primary-color);
    padding-bottom: 10px;
    display: inline-block;
    line-height: 1.1;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    vertical-align: middle;
    color: var(--text-primary);
}
*/

textarea{
    width: 100%;
    height: 200px;
    font-family: "Roboto Mono", monospace !important;
    font-size: 16px!important;
    border-radius: 8px;
    padding: 12px;
    border: 1px solid var(--input-border);
    background-color: var(--input-bg);
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    margin-bottom: 16px;
}

textarea:focus {
    outline: none;
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px var(--primary-light), 0 2px 8px rgba(0, 0, 0, 0.1);
}

textarea:hover:not(:focus) {
    border-color: var(--input-hover);
}

/* Ant Design Button Customization */
.ant-btn-primary {
    background-color: darkgreen !important;
    border-color: darkgreen !important;
}

.ant-btn-primary:hover {
    background-color: #004d00 !important;
    border-color: #004d00 !important;
}

/* Footer */
.ant-layout-footer {
    background-color: var(--footer-bg);
    border-top: 1px solid var(--border-color);
    padding: 8px 24px;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    align-items: center;
}

.footer-link {
    color: var(--text-secondary);
    font-size: 12px;
    /* Pad the tap target to >=24px tall (Lighthouse "target-size"). */
    padding: 6px 2px;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: var(--link-hover);
    text-decoration: none;
}

.footer-separator {
    color: var(--text-tertiary);
    font-size: 12px;
    user-select: none;
}

.footer-copyright {
    /* secondary (0.65), not tertiary (0.45), to clear the 4.5:1 contrast bar. */
    color: var(--text-secondary);
    font-size: 12px;
}

.footer-copyright .footer-link {
    color: var(--text-secondary);
}

/* Floating "share this page" button + fallback menu (see share.js).
   Sits in the FAB stack: back-to-top (24px), share (72px), report (120px). */
.share-fab-wrap {
    position: fixed;
    bottom: 72px;
    right: 24px;
    z-index: 1000;
}

.share-fab {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    /* Match .back-to-top / .report-fab exactly so the FABs read as one set. */
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: all 0.3s;
    font-size: 16px;
}

.share-fab:hover {
    background-color: #52c41a;
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* Fallback menu opens to the LEFT of the button (empty space; avoids covering
   the other FABs stacked above). */
.share-fab-menu {
    position: absolute;
    bottom: 0;
    right: calc(100% + 12px);
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 168px;
    padding: 6px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
    z-index: 1500;
}

.share-fab-menu[hidden] {
    display: none;
}

.share-opt {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    text-align: left;
    color: var(--text-secondary);
    text-decoration: none;
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.share-opt:hover {
    background: rgba(127, 127, 127, 0.12);
    color: var(--link-hover);
    text-decoration: none;
}

.share-opt i {
    width: 16px;
    text-align: center;
}

.share-opt.copied {
    color: #52c41a;
}

/* ── Global feedback button ──────────────────────────────────────────────
   Floating button rendered site-wide from base.html on content pages (gated
   by `show_feedback`); the modal styles live further down. Matches
   .back-to-top / .share-fab exactly so the stacked FABs look like one set;
   only the vertical position differs. Stack (bottom-up): back-to-top 24px,
   share 72px, report 120px. Defined here (before the mobile media query) so
   the @media overrides win by source order. */
.report-fab {
    position: fixed; bottom: 120px; right: 24px; width: 40px; height: 40px; border-radius: 50%;
    background-color: var(--primary-color); color: #fff; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-md); transition: all 0.3s; z-index: 1000; font-size: 16px;
}
.report-fab:hover { background-color: #52c41a; box-shadow: var(--shadow-lg); }

/* Mobile Hamburger Menu */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    margin: 0;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
}

/* Mobile Navigation Styles */
@media (max-width: 768px) {
    /* Prevent horizontal scrolling */
    html, body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100%;
    }

    body {
        font-size: 14px;
    }

    /* Navbar adjustments — it inherits position:fixed from the base rule, so it
       (and its progress bar / the slide-in menu anchored at top:56px) stay put
       while the page scrolls. */
    .ant-navbar {
        padding: 0 16px;
        min-height: 56px;
    }

    .navbar-content {
        padding: 0;
        justify-content: space-between;
    }

    .navbar-left {
        gap: 12px;
    }

    .navbar-brand img {
        height: 20px !important;
        margin-right: 6px !important;
    }

    .navbar-brand img:first-child {
        height: 22px !important;
        margin-right: 6px !important;
    }

    /* Show mobile menu toggle */
    .mobile-menu-toggle {
        display: flex;
    }

    /* Slide-in drawer: an Ant Design-style light surface panel (white / dark
       grey in dark mode), NOT the green navbar colour — so it reuses the
       dropdown's dark-text + grey-hover + green-accent system and stays
       readable. */
    .ant-menu {
        position: fixed;
        top: 56px;
        left: -100%;
        width: 280px;
        height: calc(100vh - 56px);
        background-color: var(--dropdown-bg);
        flex-direction: column;
        align-items: flex-start;
        padding: 8px 0;
        box-shadow: var(--shadow-lg);
        transition: left 0.3s ease;
        z-index: 999;
        overflow-y: auto;
    }

    .ant-menu.mobile-menu-open {
        left: 0;
    }

    /* Mobile menu items */
    .ant-menu-item,
    .ant-menu-submenu {
        width: 100%;
        border-bottom: none !important;
        display: block;
        transition: opacity 0.3s ease, transform 0.3s ease;
    }

    .ant-menu-item {
        padding: 0;
        height: auto;
        border-left: 3px solid transparent;
    }

    .ant-menu-submenu {
        padding: 0;
        height: auto;
        border-left: none;
    }

    .ant-menu-item a {
        padding: 12px 20px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
        background: transparent;   /* kill the navbar's translucent-white pill */
    }
    /* Balance the leading icon with an equal-width trailing spacer so the label
       centers, matching the submenu titles (icon | label | chevron). */
    .ant-menu-item a::after {
        content: "";
        flex: 0 0 14px;
    }

    .ant-menu-item-selected,
    .ant-menu-submenu-selected {
        border-bottom: none !important;
    }

    .ant-menu-item-selected {
        border-left-color: var(--primary-color);
        background-color: var(--primary-light);
    }
    /* Tint lives on the row only; the <a> stays transparent (no white pill). */
    .ant-menu-item-selected a {
        color: var(--primary-color);
        font-weight: 600;
        background: transparent;
    }
    .ant-menu-item-selected:hover a { background: transparent; }

    .ant-menu-submenu-selected .ant-menu-submenu-title {
        background-color: var(--primary-light);
        border-left: 3px solid var(--primary-color);
        color: var(--primary-color);
        font-weight: 600;
    }

    /* Android-style submenu navigation */
    .ant-menu.submenu-active > .ant-menu-item:not(.submenu-back),
    .ant-menu.submenu-active > .ant-menu-submenu:not(.mobile-submenu-open) {
        display: none;
    }

    /* Mobile dropdown menu */
    .ant-menu-submenu-title {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        padding: 12px 20px;
        cursor: pointer;
        text-align: left;
        border-left: 3px solid transparent;
        min-height: 44px;
        box-sizing: border-box;
    }

    .ant-menu-submenu-title i {
        transition: transform 0.3s ease;
        flex-shrink: 0;
    }

    /* Hide submenu title when submenu is open in mobile */
    .ant-menu-submenu.mobile-submenu-open > .ant-menu-submenu-title {
        display: none;
    }

    .ant-menu-submenu-popup {
        position: static !important;
        display: block;
        width: 100%;
        overflow: hidden;
        max-height: 0;
        transition: max-height 0.3s ease;
        list-style: none;
        padding: 0;
        margin: 0;
        background-color: transparent;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        box-shadow: none !important;
        border: none !important;
        border-radius: 0 !important;
    }

    .ant-menu-submenu.mobile-submenu-open .ant-menu-submenu-popup {
        max-height: 100vh;
    }

    .ant-menu-submenu-popup .ant-menu-item {
        padding: 0;
        border-left: none !important;
        width: 100%;
        height: auto;
        background-color: transparent;
    }

    .ant-menu-submenu-popup .ant-menu-item a {
        padding: 12px 20px;
        width: 100%;
        display: block;
        text-align: left;
    }

    /* Back button styling */
    .ant-menu-item.submenu-back {
        display: block !important;
        border-bottom: 1px solid var(--border-light) !important;
        margin-bottom: 4px;
    }

    .ant-menu-item.submenu-back a {
        font-weight: 600;
    }

    /* Theme toggle adjustments */
    .theme-toggle {
        margin-right: 12px !important;
    }

    /* User avatar adjustments */
    .navbar-right img.rounded-circle {
        height: 28px !important;
    }

    /* Mobile overlay */
    .mobile-menu-overlay {
        display: none;
        position: fixed;
        top: 56px;
        left: 0;
        width: 100%;
        height: calc(100vh - 56px);
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 998;
    }

    .mobile-menu-overlay.active {
        display: block;
    }

    /* Content adjustments */
    .site-content {
        padding: 0 16px;
        margin: 20px auto;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Typography adjustments */
    h1.ant-typography {
        font-size: 28px;
    }

    h2.ant-typography {
        font-size: 24px;
        margin-top: 24px;
    }

    h3.ant-typography {
        font-size: 20px;
        margin-top: 20px;
    }

    h4.ant-typography {
        font-size: 18px;
    }

    p, li, ol, ul {
        font-size: 14px;
    }

    /* FAB stack on mobile: smaller (36px) and right:16px, stacked with an 8px
       gap so back-to-top / share / report stay aligned as one column. */
    .back-to-top {
        bottom: 16px;
        right: 16px;
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .share-fab-wrap {
        bottom: 60px;
        right: 16px;
    }

    .share-fab {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .report-fab {
        bottom: 104px;
        right: 16px;
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    /* Footer adjustments: keep it a compact wrapping row (not a tall 3-row
       column) — the separators stay so it reads as one line that wraps. */
    .ant-layout-footer {
        padding: 10px 16px;
    }

    .footer-links {
        gap: 4px 8px;
    }

    .footer-link,
    .footer-separator,
    .footer-copyright {
        font-size: 11px;
    }

    .footer-link {
        padding: 4px 2px;
    }

    /* Textarea adjustments */
    textarea {
        font-size: 14px !important;
        padding: 10px;
    }

    /* Image responsiveness */
    img {
        max-width: 100%;
        height: auto;
    }

    .toc-figure img {
        max-height: 250px;
    }

    /* ---- Mobile slide-in menu: Ant Design light-surface polish --------- */
    .ant-menu {
        width: min(82vw, 300px);
        border-right: 1px solid var(--border-light);
    }

    /* Comfortable touch rows. Dark text on the light surface (the base nav
       rule colours these white for the green navbar — override here). Full-width
       rows, no rounded hover pill. */
    .ant-menu-item a,
    .ant-menu-submenu-title,
    .ant-menu-submenu-popup .ant-menu-item a {
        padding: 13px 20px;
        font-size: 15px;
        border-radius: 0;
        min-height: 48px;
        box-sizing: border-box;
        color: var(--text-primary);
    }

    /* Hover / pressed: the dropdown's subtle grey, keeping dark text. */
    .ant-menu-item:hover a,
    .ant-menu-submenu:hover .ant-menu-submenu-title,
    .ant-menu-submenu-popup .ant-menu-item:hover a,
    .ant-menu-item a:active,
    .ant-menu-submenu-title:active {
        background-color: var(--dropdown-hover);
        color: var(--text-primary);
    }

    /* Drill-in affordance: point the submenu chevron to the right. */
    .ant-menu-submenu-title .fa-chevron-down {
        transform: rotate(-90deg);
        font-size: 12px;
        opacity: 0.55;
    }

    /* Divider: a light hairline on the surface, tight margins. */
    .ant-menu-divider {
        margin: 6px 16px;
        background-color: var(--border-light);
    }

    /* Back button: subtle header row at the top of a submenu. */
    .ant-menu-item.submenu-back {
        border-bottom: 1px solid var(--border-light) !important;
        margin-bottom: 6px;
        background-color: var(--dropdown-hover);
    }
    .ant-menu-item.submenu-back a {
        font-weight: 600;
        font-size: 14px;
        color: var(--text-primary);
    }
}

/* Reference / citation lists: plain list, one size smaller than body text.
   Each entry is auto-numbered [1], [2], … (matching the in-text citation
   markers) and prefixed with a "^" back-link to where it is cited. */
.reference-list {
    list-style: none;
    margin: 12px 0;
    padding-left: 0;
    font-size: 0.72em;
    counter-reset: ref;
}
.reference-list li {
    counter-increment: ref;
    margin-bottom: 8px;
    line-height: 1.6;
    color: var(--text-secondary);
}
.reference-list .cite-back {
    font-weight: 700;
    color: var(--link-color);
    text-decoration: none;
}
/* The "[N]" number follows the ^ back-link (so the order is "^ [1] text"). */
.reference-list .cite-back::after {
    content: "[" counter(ref) "]";
    margin: 0 6px 0 3px;
    font-weight: 600;
    color: var(--text-primary);
}
.reference-list .cite-back:hover {
    text-decoration: underline;
}
.reference-list li a {
    color: var(--link-color);
    word-break: break-word;
}
.reference-list li a:hover {
    text-decoration: underline;
}

/* Inline footnote citation markers in body text, e.g. Method[1]. */
sup.cite-ref {
    font-size: 0.7em;
    line-height: 0;
    margin-left: 1px;
    white-space: nowrap;
}
sup.cite-ref a {
    color: var(--link-color);
    text-decoration: none;
    font-weight: 600;
}
sup.cite-ref a:hover {
    text-decoration: underline;
}

/* Offset every in-page anchor jump (footnotes, back-links, TOC) so the
   target clears the sticky navbar. Set on the scroll container so it
   applies regardless of which element carries the id. */
html {
    scroll-padding-top: 72px;
    scroll-behavior: smooth;
}

/* ---- Site-wide custom <select> (see static/javascript/ui-select.js) -------
   Native <select> popups can't style the option-highlight width; this renders
   a full-width, theme-matched menu over a hidden <select>. */
.ui-select-dd { position: relative; width: 100%; }
.ui-select-dd > select.ui-select { display: none; }
.ui-select-trigger {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; height: 40px; padding: 4px 11px; font-size: 14px;
    line-height: 1.5715; color: var(--text-primary);
    background-color: var(--input-bg); border: 1px solid var(--input-border);
    border-radius: 6px; cursor: pointer; transition: all .2s ease; outline: none;
}
.ui-select-trigger:hover { border-color: var(--input-hover); }
.ui-select-dd.open .ui-select-trigger {
    border-color: var(--input-focus); box-shadow: 0 0 0 2px var(--primary-light);
}
.ui-select-dd.disabled .ui-select-trigger {
    opacity: .6; cursor: not-allowed; background-color: var(--bg-elevated);
}
.ui-select-caret {
    color: var(--text-secondary, rgba(0,0,0,.45)); font-size: 12px;
    transition: transform .2s ease; margin-left: 8px;
}
.ui-select-dd.open .ui-select-caret { transform: rotate(180deg); }
.ui-select-menu {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 50;
    max-height: 280px; overflow-y: auto; padding: 4px;
    background: var(--input-bg, #fff); border: 1px solid var(--border-color, #d9d9d9);
    border-radius: 6px; box-shadow: 0 6px 16px rgba(0,0,0,.12); display: none;
}
.ui-select-dd.open .ui-select-menu { display: block; }
.ui-select-option {
    display: block; width: 100%; padding: 7px 11px; font-size: 14px;
    color: var(--text-primary); border-radius: 4px; cursor: pointer;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* hover and selected deliberately share one highlight colour */
.ui-select-option:hover,
.ui-select-option.selected { background: var(--primary-light); }
.ui-select-option.selected { font-weight: 600; }


/* Mobile: flatten the "Tutorial For Python" third-level flyout into an inline
   indented list under its title (no JS accordion for this level). */
@media (max-width: 768px) {
    .py-subnav-arrow { display: none; }
    .py-subnav-popup {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        background: transparent;
        margin: 0;
        padding: 0 0 0 14px;
        min-width: 0;
        z-index: auto;
    }
    .py-subnav-popup::before { display: none; }
}

/* ── Global feedback button modal ────────────────────────────────────────
   The floating .report-fab button itself is styled up near the other FABs
   (before the mobile media query); these are its modal/overlay styles.
   Public submissions POST to the rate-limited /feedback endpoint with
   context = the current page path. */
.report-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 2000; display: flex; align-items: center; justify-content: center; }
.report-modal-box { background: var(--bg-container); border-radius: 10px; padding: 24px; width: min(92vw, 480px); box-shadow: var(--shadow-lg); }
.report-modal-box h4 { margin: 0 0 4px; }
.report-modal-sub { color: var(--text-secondary); font-size: .9rem; margin-bottom: 16px; }
.report-modal-box .form-label { font-size: .85rem; margin-bottom: 4px; }
.report-modal-box .mb-r { margin-bottom: 12px; }
.report-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
/* Honeypot: kept far off-screen; real users never see or fill it, bots do. */
.report-hp { position: absolute !important; left: -9999px; top: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ── Recent predictions card (AI tool landing pages) ─────────────────────
   Populated client-side from localStorage by recent-jobs.js; hidden until
   there is at least one saved result link. */
.recent-jobs-card {
    margin: 20px 0 8px; padding: 16px 18px;
    background: var(--bg-elevated); border: 1px solid var(--border-light);
    border-radius: 10px;
}
.recent-jobs-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.recent-jobs-head h4 { margin: 0; font-size: 1rem; color: var(--text-primary); }
.recent-jobs-head h4 i { color: var(--primary-color); margin-right: 8px; }
.recent-jobs-clear {
    background: none; border: none; cursor: pointer; padding: 2px 6px;
    font-size: .82rem; color: var(--text-tertiary); border-radius: 6px;
    transition: color .2s ease, background-color .2s ease;
}
.recent-jobs-clear:hover { color: var(--text-primary); background: var(--dropdown-hover); }
.recent-jobs-list { list-style: none; margin: 12px 0 0; padding: 0; }
.recent-job + .recent-job { border-top: 1px solid var(--border-light); }
.recent-job a {
    display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
    padding: 8px 8px; border-radius: 6px; text-decoration: none;
    color: var(--link-color); transition: background-color .2s ease, padding-left .2s ease;
}
.recent-job a:hover { background: var(--dropdown-hover); padding-left: 12px; }
.recent-job-label { font-family: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9rem; font-weight: 500; color: var(--primary-color); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Brand dark-green on light; the dark card needs the brighter green to stay
   legible (data-theme is always set pre-paint by the head script, and this
   JS-driven card never renders with scripting off). */
[data-theme="dark"] .recent-job-label { color: var(--link-color); }
.recent-job-time { flex: 0 0 auto; font-size: .8rem; color: var(--text-tertiary); }
.recent-jobs-note { margin: 10px 0 0; font-size: .78rem; color: var(--text-tertiary); }
