/* === Explanation navigation (Quiet Instrument Minimalism) === */
.wpProQuiz_content .wpProQuiz_listItem,
.wpProQuiz_content .wpProQuiz_header {
    scroll-margin-top: 96px;
}

.iplr-exp-nav {
    /* Light tokens */
    --exp-bg: #f7f9fc;
    --exp-surface: #ffffff;
    --exp-text: #0f172a;
    --exp-muted: #64748b;
    --exp-line: #e7ecf2;
    --exp-accent: #2f6fed;
    --exp-accent-fill: #2f6fed;
    --exp-on-accent: #ffffff;
    --exp-on-fill: #ffffff;
    --exp-success: #17a673;
    --exp-error: #e15b64;
    --exp-shadow: 0 10px 30px rgba(15, 23, 42, 0.1);
    pointer-events: none;
}

.iplr-exp-nav__status {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.iplr-exp-nav[hidden] {
    display: none !important;
}

.iplr-exp-nav__rail,
.iplr-exp-nav__dock,
.iplr-exp-nav__panel,
.iplr-exp-nav__backdrop {
    pointer-events: auto;
}

/* Theme-proof control reset (BuddyBoss/LearnDash style buttons are aggressive) */
body .iplr-exp-nav button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
    width: auto;
    min-width: 0;
    box-shadow: none;
    text-shadow: none;
    text-transform: none;
    letter-spacing: normal;
    font-family: inherit;
    line-height: 1.2;
    cursor: pointer;
}

body .iplr-exp-nav button:disabled {
    opacity: 0.35;
    cursor: default;
}

/* No border-radius here: the outline must follow each control's own shape,
   otherwise it squares off the circular dock buttons. */
.iplr-exp-nav :focus-visible {
    outline: 2px solid var(--exp-accent);
    outline-offset: 2px;
}

.iplr-exp-nav__icon {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

/* ---------- Desktop rail ---------- */
.iplr-exp-nav__rail {
    display: none;
    position: fixed;
    top: 96px;
    right: 16px;
    z-index: 40;
    box-sizing: border-box;
    width: 136px;
    padding: 10px;
    border: 1px solid var(--exp-line);
    border-radius: 14px;
    background: var(--exp-surface);
    box-shadow: var(--exp-shadow);
    color: var(--exp-text);
}

.iplr-exp-nav__rail-head {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--exp-line);
}

.iplr-exp-nav__rail-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--exp-accent);
    white-space: nowrap;
}

.iplr-exp-nav__rail-progress {
    flex: 1;
    font-size: 11px;
    font-weight: 600;
    color: var(--exp-muted);
    font-variant-numeric: tabular-nums;
    text-align: center;
    white-space: nowrap;
}

.iplr-exp-nav__iconbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--exp-muted);
}

.iplr-exp-nav__iconbtn:hover {
    background: var(--exp-bg);
    color: var(--exp-text);
}

.iplr-exp-nav__rail-body[hidden] {
    display: none !important;
}

.iplr-exp-nav__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2px;
    max-height: min(46vh, 340px);
    overflow: auto;
    margin-bottom: 10px;
    overscroll-behavior: contain;
}

/* ---------- Question chips (neutral = bare number) ---------- */
.iplr-exp-nav__num {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 30px;
    padding: 2px 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--exp-text);
    font-size: 12px;
    font-weight: 600;
}

.iplr-exp-nav__num:hover {
    background: var(--exp-bg);
}

.iplr-exp-nav__num-text {
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

/* Shape carries the state as well as colour: circle = correct, diamond = wrong */
.iplr-exp-nav__dot {
    display: block;
    width: 4px;
    height: 4px;
}

.iplr-exp-nav__dot--correct {
    border-radius: 50%;
    background: var(--exp-success);
}

.iplr-exp-nav__dot--incorrect {
    border-radius: 1px;
    transform: rotate(45deg);
    background: var(--exp-error);
}

.iplr-exp-nav__num.is-current {
    background: var(--exp-accent);
    color: var(--exp-on-accent);
    font-weight: 700;
}

.iplr-exp-nav__num.is-current .iplr-exp-nav__dot {
    background: var(--exp-on-accent);
}

.iplr-exp-nav__num.is-bookmarked::after {
    content: "";
    position: absolute;
    top: 4px;
    right: 5px;
    width: 3px;
    height: 5px;
    border-radius: 0 0 1px 1px;
    background: var(--exp-accent);
    opacity: 0.55;
}

.iplr-exp-nav__num.is-current.is-bookmarked::after {
    background: var(--exp-on-accent);
    opacity: 0.75;
}

/* ---------- Primary / quiet actions ---------- */
.iplr-exp-nav__primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    min-height: 36px;
    padding: 0 10px;
    border: 0;
    border-radius: 9px;
    background: var(--exp-accent-fill);
    color: var(--exp-on-fill);
    font-size: 13px;
    font-weight: 700;
}

.iplr-exp-nav__primary .iplr-exp-nav__icon {
    width: 16px;
    height: 16px;
}

.iplr-exp-nav__quiet {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 6px;
}

.iplr-exp-nav__quietbtn {
    min-height: 30px;
    padding: 0 4px;
    border: 0;
    background: transparent;
    color: var(--exp-muted);
    font-size: 12px;
    font-weight: 600;
}

.iplr-exp-nav__quietbtn:hover {
    color: var(--exp-text);
}

.iplr-exp-nav__quiet-sep {
    color: var(--exp-muted);
    font-size: 12px;
    opacity: 0.65;
}

/* ---------- Overflow menu ---------- */
.iplr-exp-nav__menu {
    position: absolute;
    top: 40px;
    right: 8px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    min-width: 104px;
    padding: 4px;
    border: 1px solid var(--exp-line);
    border-radius: 10px;
    background: var(--exp-surface);
    box-shadow: var(--exp-shadow);
}

.iplr-exp-nav__menu[hidden] {
    display: none !important;
}

.iplr-exp-nav__menuitem {
    min-height: 32px;
    padding: 0 8px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--exp-text);
    font-size: 12px;
    font-weight: 600;
    text-align: left;
}

.iplr-exp-nav__menuitem:hover {
    background: var(--exp-bg);
}

/* ---------- Collapsed rail ---------- */
.iplr-exp-nav.is-collapsed .iplr-exp-nav__rail {
    width: 46px;
    padding: 8px;
}

.iplr-exp-nav.is-collapsed .iplr-exp-nav__rail-head {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: 0;
}

.iplr-exp-nav.is-collapsed .iplr-exp-nav__rail-title,
.iplr-exp-nav.is-collapsed .iplr-exp-nav__rail-progress,
.iplr-exp-nav.is-collapsed [data-iplr-nav="menu"] {
    display: none;
}

.iplr-exp-nav.is-collapsed .iplr-exp-nav__collapse {
    width: 30px;
    height: 30px;
}

.iplr-exp-nav.is-collapsed .iplr-exp-nav__collapse .iplr-exp-nav__icon {
    transform: rotate(180deg);
}

/* ---------- Mobile dock ---------- */
.iplr-exp-nav__dock {
    display: flex;
    align-items: center;
    gap: 8px;
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    /* Above the backdrop (48) but below the drawer (50), so the dock's
       previous/next stay tappable while the drawer is open. */
    z-index: 49;
    box-sizing: border-box;
    height: 56px;
    padding: 0 6px;
    border: 1px solid var(--exp-line);
    border-radius: 28px;
    background: var(--exp-surface);
    box-shadow: var(--exp-shadow);
    color: var(--exp-text);
}

.iplr-exp-nav__dockbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--exp-text);
}

.iplr-exp-nav__dockbtn .iplr-exp-nav__icon {
    width: 20px;
    height: 20px;
}

.iplr-exp-nav__dockbtn--next {
    background: var(--exp-accent-fill);
    color: var(--exp-on-fill);
}

.iplr-exp-nav__dockcenter {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    min-height: 44px;
    padding: 0 6px;
    border: 0;
    border-radius: 22px;
    background: transparent;
    color: var(--exp-text);
}

.iplr-exp-nav__dock-progress {
    font-size: 15px;
    font-weight: 700;
    color: var(--exp-text);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.iplr-exp-nav__dock-track {
    display: block;
    flex: 1;
    min-width: 24px;
    height: 3px;
    border-radius: 999px;
    background: var(--exp-line);
    overflow: hidden;
}

.iplr-exp-nav__dock-fill {
    display: block;
    width: 0;
    height: 100%;
    border-radius: 999px;
    background: var(--exp-accent);
    transition: width 0.2s ease;
}

.iplr-exp-nav__dockcenter .iplr-exp-nav__icon {
    width: 20px;
    height: 20px;
    color: var(--exp-muted);
}

/* ---------- Shared list dialog ---------- */
.iplr-exp-nav__backdrop {
    position: fixed;
    inset: 0;
    z-index: 48;
    background: rgba(15, 23, 42, 0.36);
    opacity: 1;
    transition: opacity 200ms ease-out, visibility 200ms ease-out;
}

.iplr-exp-nav__backdrop[hidden] {
    display: none !important;
}

.iplr-exp-nav__panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 6px;
    /* Content-sized drawer: no vh floor, so it only takes the room it needs
       and stays capped for very long quizzes. */
    min-height: 0;
    max-height: 38vh;
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
    border-radius: 18px 18px 0 0;
    background: var(--exp-surface);
    box-shadow: 0 -12px 32px rgba(15, 23, 42, 0.2);
    color: var(--exp-text);
}

.iplr-exp-nav__panel[hidden] {
    display: none !important;
}

.iplr-exp-nav__panel-head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.iplr-exp-nav__panel-title {
    margin: 0;
    flex: 1;
    font-size: 16px;
    font-weight: 700;
    color: var(--exp-text);
}

.iplr-exp-nav__panel-progress {
    font-size: 13px;
    font-weight: 700;
    color: var(--exp-muted);
    font-variant-numeric: tabular-nums;
}

.iplr-exp-nav__panel .iplr-exp-nav__iconbtn {
    width: 44px;
    height: 44px;
}

.iplr-exp-nav__filters {
    display: flex;
    gap: 6px;
    border-bottom: 1px solid var(--exp-line);
}

.iplr-exp-nav__filter {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 44px;
    padding: 0 10px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--exp-muted);
    font-size: 13px;
    font-weight: 600;
}

.iplr-exp-nav__filter.is-active {
    color: var(--exp-accent);
    border-bottom-color: var(--exp-accent);
}

/* Inherits the button colour at full strength so the count keeps 4.5:1. */
.iplr-exp-nav__filter-count {
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.iplr-exp-nav__filter[hidden] {
    display: none !important;
}

/* 7 columns fits 21 questions in 3 rows instead of 5. At 375px the inner width
   is 351px, so 7x44px cells plus 6x4px gaps (332px) still clear the touch target.
   `flex: 1 1 auto` + `min-height: 0` keeps the grid content-sized normally but
   lets it shrink and scroll when a quiz has unusually many questions. */
.iplr-exp-nav__panel-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
}

.iplr-exp-nav__panel-grid .iplr-exp-nav__num {
    min-height: 44px;
    font-size: 14px;
}

.iplr-exp-nav__panel-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.iplr-exp-nav__panel-foot .iplr-exp-nav__quietbtn {
    min-height: 44px;
    padding: 0 12px;
}

.iplr-exp-nav__panel-foot .iplr-exp-nav__primary {
    width: auto;
    min-width: 132px;
    min-height: 44px;
    font-size: 14px;
}

/* Keep the fixed dock from covering the tail of the explanation */
body.iplr-exp-nav-ready {
    padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
}

/* ---------- Mobile ---------- */
@media (max-width: 1279px) {
    /* Only the bottom sheet is modal, so only it locks the page. `overflow`
       (not `position: fixed`) keeps the current scroll offset intact. */
    body.iplr-exp-nav-panel-open {
        overflow: hidden;
    }

    /* The persistent mobile UI is the dock alone; the question list is a
       temporary drawer that slides up out of it and collapses after use.
       It rests exactly on the dock (14px offset + 56px tall) and stays
       edge-to-edge, which is what keeps 7 x 44px cells fitting at 375px. */
    .iplr-exp-nav__panel {
        transition: transform 200ms ease-out, visibility 200ms ease-out;
        transform: translateY(0);
        bottom: calc(70px + env(safe-area-inset-bottom, 0px));
        padding-bottom: 12px;
    }

    /* `visibility` rather than `display: none` so closing animates too. */
    .iplr-exp-nav__panel[hidden] {
        display: flex !important;
        visibility: hidden;
        transform: translateY(100%);
        pointer-events: none;
    }

    .iplr-exp-nav__backdrop[hidden] {
        display: block !important;
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
    }

    .iplr-exp-nav__dockcenter .iplr-exp-nav__icon {
        transition: transform 200ms ease-out;
    }

    .iplr-exp-nav__dockcenter[aria-expanded="true"] .iplr-exp-nav__icon {
        transform: rotate(180deg);
    }
}

/* ---------- Desktop ---------- */
@media (min-width: 1280px) {
    .iplr-exp-nav__rail {
        display: block;
    }

    .iplr-exp-nav__dock {
        display: none;
    }

    body.iplr-exp-nav-ready {
        padding-bottom: 0;
    }

    /* The popover is not modal: a full-viewport backdrop would swallow clicks
       aimed at the rail sitting underneath it. Outside clicks close it in JS. */
    .iplr-exp-nav__backdrop {
        display: none !important;
    }

    /* The popover has room to breathe, so it keeps the original 5-column
       grid and roomier spacing that the mobile sheet had to give up. */
    .iplr-exp-nav__panel {
        left: auto;
        right: 16px;
        top: 96px;
        bottom: auto;
        width: 320px;
        gap: 12px;
        min-height: 0;
        max-height: calc(100vh - 128px);
        padding: 16px;
        border: 1px solid var(--exp-line);
        border-radius: 14px;
        box-shadow: var(--exp-shadow);
    }

    .iplr-exp-nav__panel-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

/* ---------- Dark theme ---------- */
html:not([data-airmen-theme="light"]) body.bb-dark-theme .iplr-exp-nav,
html:not([data-airmen-theme="light"]) body.dark-theme .iplr-exp-nav,
html:not([data-airmen-theme="light"]) body.dark-mode .iplr-exp-nav,
html[data-airmen-theme="dark"] .iplr-exp-nav,
html.airmen-theme-dark-boot:not([data-airmen-theme="light"]) .iplr-exp-nav {
    --exp-bg: #090e16;
    --exp-surface: #131b27;
    --exp-text: #f5f7fa;
    --exp-muted: #8b9aaf;
    --exp-line: #253142;
    --exp-accent: #72a7ff;
    --exp-accent-fill: #2f6fed;
    --exp-on-accent: #071022;
    --exp-on-fill: #ffffff;
    --exp-success: #50c896;
    --exp-error: #ff7a82;
    --exp-shadow: 0 12px 34px rgba(2, 6, 14, 0.6);
}

html:not([data-airmen-theme="light"]) body.bb-dark-theme .iplr-exp-nav__backdrop,
html:not([data-airmen-theme="light"]) body.dark-theme .iplr-exp-nav__backdrop,
html:not([data-airmen-theme="light"]) body.dark-mode .iplr-exp-nav__backdrop,
html[data-airmen-theme="dark"] .iplr-exp-nav__backdrop,
html.airmen-theme-dark-boot:not([data-airmen-theme="light"]) .iplr-exp-nav__backdrop {
    background: rgba(2, 6, 14, 0.62);
}

html:not([data-airmen-theme="light"]) body.bb-dark-theme .iplr-exp-nav__panel,
html:not([data-airmen-theme="light"]) body.dark-theme .iplr-exp-nav__panel,
html:not([data-airmen-theme="light"]) body.dark-mode .iplr-exp-nav__panel,
html[data-airmen-theme="dark"] .iplr-exp-nav__panel,
html.airmen-theme-dark-boot:not([data-airmen-theme="light"]) .iplr-exp-nav__panel {
    box-shadow: 0 -12px 32px rgba(2, 6, 14, 0.66);
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .iplr-exp-nav,
    .iplr-exp-nav * {
        transition: none !important;
        animation: none !important;
        scroll-behavior: auto !important;
    }
}


@media(min-width:1280px){html[data-airmen-theme] body.single-sfwd-quiz.iplr-exp-nav-ready #learndash-page-content{padding-right:176px!important;box-sizing:border-box;}}
body.iplr-exp-nav-ready #ipqd-dock{display:none!important;}
html[data-airmen-theme] body.single-sfwd-quiz.iplr-exp-nav-ready .wpProQuiz_reviewDiv{display:none!important;}
.iplr-exp-nav__filters{flex-wrap:wrap;}
