
    :root { --bg:#f7fbff; --card:#ffffff; --card-soft:#fbfdff; --panel:#ffffff; --line:#dbe7f2; --line-strong:#c7d9ea; --text:#243447; --muted:#66788a; --primary:#86b3d9; --primary-strong:#4a6f87; --primary-soft:#e1f0ff; --primary-soft-2:#d3e4ff; --danger:#bf4637; --danger-soft:#ffe3de; --success:#2f6f4f; --success-soft:#dff3e5; --warning-soft:#fff2bf; --warning-strong:#b78200; }
    * { box-sizing: border-box; }
    html, body { margin:0; padding:0; background:var(--bg); color:var(--text); font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif; overflow-x:hidden; }
    body { padding-bottom: 86px; }
    body.global-audio-collapsed { padding-bottom: 52px; }
    body.global-audio-hidden-state { padding-bottom: 0; }
    .adaptive-lab-banner { width:min(1100px, 100%); margin:0 auto; padding:5px 12px; background:#7c2d12; color:#fff; text-align:center; font-size:11px; font-weight:800; letter-spacing:.08em; }
    .wrap { width: min(1100px, 100%); margin: 0 auto; padding: 12px; }
    body.focus-mode { padding-bottom:0; }
    body.focus-mode .wrap { width:100%; max-width:none; padding:6px; }
    @media (max-width: 700px) { body.focus-mode .wrap { padding-left:16px; padding-right:16px; } }
    .card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 12px; box-shadow: 0 6px 18px rgba(74,111,135,.06); }
    .row { display: flex; gap: 12px; align-items: flex-start; }
    .main { flex: 1; min-width: 0; }
    .side { width: 280px; }
    .btn, button { background: var(--primary-strong); color: white; border: 1px solid transparent; border-radius: 12px; padding: 11px 14px; cursor: pointer; text-decoration: none; display: inline-block; font-size: 15px; font-weight: 600; box-shadow: 0 1px 0 rgba(255,255,255,.15) inset; transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .05s ease; }
    .btn.secondary, button.secondary { background: #7f93a6; color: white; }
    .btn.light, button.light { background: var(--card-soft); color: var(--text); border: 1px solid var(--line-strong); box-shadow:none; }
    .btn.danger, button.danger { background: var(--danger); color: white; }
    .btn:hover, button:hover { background: #5f88a4; }
    .btn:active, button:active { transform: translateY(1px); }
    .btn.light:hover, button.light:hover { background: var(--primary-soft); border-color: var(--primary); }
    .btn.secondary:hover, button.secondary:hover { background: #6f879a; }
    .btn.danger:hover, button.danger:hover { background: #bb4f40; }
    .pane-card { background: var(--card-soft); border-color: var(--line-strong); }
    .pane-head h2 { color: var(--text); letter-spacing: -.01em; }
    .pane-title { color: var(--text); }
    .topbar-title { color: var(--primary-strong); font-weight: 700; }
    h1, h2, h3 { color: var(--text); }
    a { color: var(--primary-strong); }
    input[type=text], input[type=number], input[type=password], input[type=file], textarea, select { background: #fff; border-color: var(--line-strong); color: var(--text); }
    input[type=text]:focus, input[type=number]:focus, input[type=password]:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(134,179,217,.18); }
    .flash { background: #f3f8fc; border-color: var(--line-strong); color: var(--text); }
    .navlist a { border-bottom-color: #edf2f7; }
    .qchip.current { border-color: var(--primary-strong); box-shadow: inset 0 0 0 2px var(--primary-strong); }
    .qchip.correct, .option.correct-option { background: var(--success-soft); }
    .qchip.recovered { background: #ffefd0; }
    .qchip.incorrect, .option.incorrect-option { background: var(--danger-soft); }
    .muted { color: var(--muted); }
    .danger { color: var(--danger); }
    .good { color: var(--success); }
    .metric-good { color: var(--success); font-weight: 700; }
    .metric-progress { color: var(--text); font-weight: 700; }
    .option { border: 1px solid var(--line); border-radius: 14px; padding: 14px 12px; margin-bottom: 10px; background: #fff; box-shadow: 0 1px 0 rgba(74,111,135,.03); }
    .option label { display:block; line-height: 1.45; font-size: 18px; font-weight:400; }
    .option-text { display:inline; }
    .option-letter { font-weight:700; margin-right: 8px; }
    .option input[type=radio], .option input[type=checkbox] { transform: scale(1.2); margin-right: 10px; vertical-align: top; }
    button.answer-card { width:100%; display:block; text-align:left; color:var(--text); font:inherit; line-height:1.45; cursor:pointer; touch-action:pan-y; transition:background .12s ease,border-color .12s ease,box-shadow .12s ease; }
    button.answer-card:hover { background:var(--primary-soft); border-color:var(--primary); }
    button.answer-card:disabled { opacity:1; cursor:default; color:var(--text); }
    button.answer-card[aria-disabled="true"] { cursor:default; }
    button.answer-card[aria-disabled="true"].correct-option:hover { background:var(--success-soft); }
    button.answer-card[aria-disabled="true"].incorrect-option:hover { background:var(--danger-soft); border-color:#d98b80; }
    button.answer-card[aria-disabled="true"].resolved-unselected-correct:hover { background:#fff; border-color:#79b88e; }
    button.answer-card[aria-disabled="true"].resolved-unselected-wrong:hover { background:#fff; border-color:#d7e0e7; }
    button.answer-card.incorrect-option:hover { background:var(--danger-soft); border-color:#d98b80; }
    .answer-card-text { display:block; font-size:18px; font-weight:400; }
    .guided-choice-feedback { display:block; margin-top:10px; padding:9px 10px; border-radius:10px; background:rgba(255,255,255,.72); border:1px solid rgba(191,70,55,.18); font-size:14px; line-height:1.45; font-weight:400; }
    .guided-choice-feedback.guided-choice-correct { border-color:rgba(39,125,78,.22); background:rgba(244,252,247,.9); }
    .option.resolved-unselected-correct { background:#fff; border-color:#79b88e; box-shadow:inset 3px 0 0 #4f9b68; }
    .option.resolved-unselected-wrong { background:#fff; border-color:#d7e0e7; box-shadow:none; }
    .resolved-answer-state { display:block; margin-top:8px; font-size:12px; line-height:1.25; font-weight:800; letter-spacing:.01em; }
    .resolved-answer-state.correct { color:#287347; }
    .resolved-answer-state.wrong { color:#6b7780; }
    .resolved-answer-state.selected-wrong { color:#9b3d32; }
    .resolved-choice-feedback { display:block; margin-top:10px; padding:9px 10px; border-radius:10px; font-size:14px; line-height:1.45; font-weight:400; color:var(--text); }
    .resolved-answer-state.wrong + .resolved-choice-feedback,
    .resolved-answer-state.selected-wrong + .resolved-choice-feedback { background:rgba(255,255,255,.72); border:1px solid rgba(191,70,55,.18); }
    .resolved-answer-state.correct + .resolved-choice-feedback { border:1px solid rgba(39,125,78,.22); background:rgba(244,252,247,.9); }
    /* NQ_RESOLVED_STRATEGY_VISUALS_20260927_V1
       Strategy signals live inside the original resolved answer card. The top-left
       area keeps wording/heuristic cautions; the top-right keeps its existing
       explanatory labels while Compare badges identify relationships. Answer order
       is never changed. */
    .answer-choice-shell.choice-strategy-card, .option.choice-strategy-card { position:relative; }
    .answer-choice-shell.choice-strategy-card > button.answer-card { padding-top:38px; }
    .option.choice-strategy-card { padding-top:38px; }
    .choice-strategy-strip {
      position:absolute; top:7px; left:11px; right:11px; min-height:22px;
      display:flex; align-items:center; justify-content:space-between; gap:8px;
      pointer-events:none; z-index:8;
    }
    .choice-strategy-left, .choice-strategy-right { display:flex; align-items:center; gap:4px; min-width:0; }
    .choice-strategy-left { flex:0 1 auto; flex-wrap:nowrap; }
    .choice-strategy-right { flex:1 1 auto; margin-left:auto; justify-content:flex-end; flex-wrap:nowrap; overflow:hidden; }
    .choice-strategy-left-unit { display:inline-flex; align-items:center; gap:4px; min-width:0; max-width:320px; white-space:nowrap; }
    .choice-strategy-left-label { min-width:0; max-width:160px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:#748491; font-size:9.5px; line-height:1.15; font-weight:650; letter-spacing:0; }
    .choice-strategy-compare-unit { display:inline-flex; align-items:center; justify-content:flex-start; flex-wrap:nowrap; column-gap:4px; min-width:0; max-width:190px; white-space:nowrap; }
    .choice-strategy-compare-label { min-width:0; max-width:128px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; text-align:left; color:#748491; font-size:9.5px; line-height:1.15; font-weight:650; letter-spacing:0; }
    @media(max-width:700px){ .choice-strategy-left-unit{max-width:260px} .choice-strategy-left-label{max-width:120px;font-size:9px} .choice-strategy-compare-unit{max-width:150px} .choice-strategy-compare-label{max-width:105px;font-size:9px} }
    .choice-strategy-action-unit { display:inline-flex; align-items:center; gap:4px; min-width:0; max-width:240px; }
    .choice-strategy-action-label { min-width:0; max-width:135px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:#748491; font-size:9.5px; line-height:1.15; font-weight:650; letter-spacing:0; }
    .choice-fit-unit { display:inline-flex; align-items:center; gap:4px; min-width:0; max-width:245px; flex:0 1 auto; white-space:nowrap; }
    .choice-fit-button {
      pointer-events:auto; appearance:none; -webkit-appearance:none; border:0; background:transparent;
      padding:0; margin:0; display:inline-flex; align-items:center; gap:4px; min-width:0;
      color:#657684; font:inherit; cursor:pointer; white-space:nowrap;
    }
    .choice-fit-button:focus-visible { outline:2px solid var(--primary); outline-offset:2px; border-radius:5px; }
    .choice-fit-bar { width:44px; height:6px; border-radius:999px; background:#e3eaf0; overflow:hidden; flex:0 0 auto; }
    .choice-fit-fill { display:block; height:100%; border-radius:inherit; background:currentColor; opacity:.9; }
    .choice-fit-text { font-size:9.5px; line-height:1; font-weight:850; letter-spacing:.01em; white-space:nowrap; }
    .choice-fit-very-weak { color:#8f4e55; }
    .choice-fit-weak { color:#80602e; }
    .choice-fit-uncertain { color:#667582; }
    .choice-fit-strong { color:#3f7467; }
    .choice-fit-very-strong { color:#356f60; }
    @media(max-width:700px){
      .choice-strategy-action-unit{max-width:150px}
      .choice-strategy-action-label{max-width:78px;font-size:8.8px}
      .choice-fit-unit{max-width:176px;gap:3px}
      .choice-fit-bar{width:30px;height:5px}
      .choice-fit-text{font-size:8.8px}
    }
    .choice-strategy-badge {
      pointer-events:auto; appearance:none; -webkit-appearance:none; border:1px solid #c9d6df;
      border-radius:999px; background:rgba(255,255,255,.9); color:#526b7c;
      padding:2px 6px; margin:0; min-height:20px; font:inherit; font-size:10px;
      line-height:1.15; font-weight:850; letter-spacing:.035em; white-space:nowrap;
      cursor:pointer; box-shadow:none;
    }
    .choice-strategy-badge:hover { background:#fff; border-color:#9fb4c3; }
    .choice-strategy-badge:focus-visible { outline:2px solid var(--primary); outline-offset:2px; }
    .choice-strategy-compare {
      position:relative; isolation:isolate; z-index:0;
      border:0; border-radius:0; background:transparent;
      padding-left:10px; padding-right:10px;
      overflow:visible;
    }
    .choice-strategy-compare::before,
    .choice-strategy-compare::after {
      content:""; position:absolute; pointer-events:none;
      clip-path:polygon(7px 0,calc(100% - 7px) 0,100% 50%,calc(100% - 7px) 100%,7px 100%,0 50%);
    }
    .choice-strategy-compare::before {
      inset:0; background:currentColor; z-index:-2;
    }
    .choice-strategy-compare::after {
      inset:1px; background:#fff; z-index:-1;
    }
    .choice-strategy-compare:hover { background:transparent; border-color:transparent; }
    .choice-strategy-action-eliminate, .choice-strategy-action-opposite { color:#8f4e55; border-color:#dfc1c5; background:#fffafa; }
    .choice-strategy-action-keep { color:#356f60; border-color:#bfd8cf; background:#f8fcfa; }
    .choice-strategy-action-evidence, .choice-strategy-action-extreme, .choice-strategy-action-trap { color:#80602e; border-color:#dfd0ae; background:#fffdf7; }
    .choice-strategy-action-outlier { color:#655b78; border-color:#d2c8df; background:#fbf9fd; }
    .choice-strategy-middle { position:absolute; left:50%; top:0; transform:translateX(-50%); display:flex; align-items:center; justify-content:center; min-width:0; pointer-events:none; }
    .choice-strategy-middle .choice-strategy-badge { pointer-events:auto; }
    .choice-strategy-heuristic-caution { color:#80602e; border-color:#dfd0ae; background:#fffdf7; }
    .choice-strategy-heuristic-support { color:#356f60; border-color:#bfd8cf; background:#f8fcfa; }
    form[data-autosave="1"].choice-compare-active { position:relative; }
    form[data-autosave="1"].choice-compare-active .answer-choice-shell,
    form[data-autosave="1"].choice-compare-active > .option:not(.answer-card) {
      width:calc(100% - 14px); max-width:calc(100% - 14px); box-sizing:border-box;
      margin-left:14px;
    }
    .choice-compare-overlay {
      position:absolute; inset:0; width:100%; height:100%; overflow:visible;
      pointer-events:none; z-index:5;
    }
    .choice-strategy-popover {
      position:fixed; z-index:10060; display:none; width:min(340px,calc(100vw - 24px));
      padding:10px 12px; border:1px solid #cbd8e1; border-radius:10px; background:#fff;
      color:var(--text); box-shadow:0 10px 28px rgba(33,58,76,.16);
      font-size:13px; line-height:1.42;
    }
    .choice-strategy-popover.open { display:block; }
    .choice-strategy-popover-title { margin-bottom:3px; color:#38586f; font-size:12px; font-weight:850; letter-spacing:.025em; text-transform:uppercase; }
    @media(max-width:700px){
      .choice-strategy-strip{top:6px;left:9px;right:9px;gap:5px}
      .choice-strategy-badge{font-size:9.5px;padding:2px 5px;letter-spacing:.025em}
      .answer-choice-shell.choice-strategy-card > button.answer-card{padding-top:36px}
      .option.choice-strategy-card{padding-top:36px}
    }
    /* NQ_CHOICE_HEADER_LEFT_PILLS_20261025_V1
       Keep Compare first and all other top indicators left aligned; allow wrapping.
       The answer starts below the measured badge rows on narrow screens. */
    .choice-strategy-strip { justify-content:flex-start; align-items:flex-start; }
    .choice-strategy-left {
      flex:1 1 100%; width:100%; min-width:0; flex-wrap:wrap;
      align-content:flex-start; justify-content:flex-start; row-gap:4px; column-gap:6px;
    }
    .choice-strategy-right { display:none; }
    .choice-strategy-context-pill {
      display:block; max-width:225px; min-height:20px; box-sizing:border-box;
      color:#526b7c; background:#edf3f7; border-color:#c9d6df;
      font-weight:650; text-transform:none; letter-spacing:0;
      overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
      pointer-events:none; cursor:default;
    }
    .answer-choice-shell.choice-strategy-card > button.answer-card,
    .option.choice-strategy-card { padding-top:var(--nq-choice-header-pad,38px); }
    @media(max-width:700px){
      .answer-choice-shell.choice-strategy-card > button.answer-card,
      .option.choice-strategy-card { padding-top:var(--nq-choice-header-pad,36px); }
    }
    /* NQ_NEUTRAL_CHOICE_CUES_20261025_V1
       Neutral relational prompts are not answer recommendations. */
    .choice-strategy-heuristic-neutral {
      color:#526b7c; background:#edf3f7; border-color:#c9d6df;
    }
    /* NQ_COMPARE_VERIFIED_WORDING_TRAP_HIGHLIGHT_20261025_V1
       Only highlight an exact, supported phrase on a resolved answer.
       Amber indicates "inspect wording", NEVER answer correctness. */
    .option-text .nq-wording-trap-mark {
      color:inherit!important; font-weight:inherit; border-radius:2px;
      background:rgba(188,139,43,.15);
      text-decoration:underline solid #b98322 1.5px;
      text-underline-offset:3px;
      -webkit-box-decoration-break:clone; box-decoration-break:clone;
      pointer-events:none;
    }
    html[data-theme="dark"] .option-text .nq-wording-trap-mark {
      background:rgba(232,188,86,.19)!important;
      text-decoration-color:#edc774!important;
      color:inherit!important;
    }
    /* NQ_RETIRE_ANSWER_CHOICE_STRATEGY_BADGES_20261025_V1
       Defense in depth against UI fragments retained during soft nav. */
    .choice-strategy-strip,.choice-compare-overlay,#choice-strategy-popover {
      display:none!important;
    }
    .nq-wording-trap-mark {
      background:transparent!important; text-decoration:none!important;
      color:inherit!important; font-weight:inherit!important;
    }
    .answer-choice-shell.choice-strategy-card > button.answer-card,
    .option.choice-strategy-card {
      padding-top:14px!important;
    }
    /* NQ_CONTEXTUAL_AI_CONTAINMENT_20260911_V3 */
    /* Keep Ask AI physically inside the stem/answer boundary and align its field with explanation text. */
    .answer-choice-shell { width:100%; max-width:100%; min-width:0; }
    .answer-choice-shell.has-choice-ai {
      margin:0 0 10px; border:1px solid var(--line); border-radius:14px; overflow:hidden;
      background:#fff; box-shadow:0 1px 0 rgba(74,111,135,.03);
    }
    .answer-choice-shell.has-choice-ai > button.answer-card {
      margin:0; border:0!important; border-radius:0!important; box-shadow:none!important;
      background:transparent!important; max-width:100%; padding-bottom:0!important;
    }
    .answer-choice-shell.has-choice-ai:has(> button.answer-card.correct-option) { background:var(--success-soft); border-color:#79b88e; box-shadow:inset 4px 0 0 #4f9b68; }
    .answer-choice-shell.has-choice-ai:has(> button.answer-card.incorrect-option) { background:var(--danger-soft); border-color:#d98b80; box-shadow:inset 4px 0 0 #c85b4e; }
    .answer-choice-shell.has-choice-ai:has(> button.answer-card.resolved-unselected-correct) { background:#fff; border-color:#79b88e; box-shadow:inset 3px 0 0 #4f9b68; }
    .answer-choice-shell.has-choice-ai:has(> button.answer-card.resolved-unselected-wrong) { background:#fff; border-color:#d7e0e7; box-shadow:none; }
    /* NQ_GUIDED_FOCUS_OUTER_SHELL_20260911_V1
       The temporary current/final-answer accent must wrap the entire learning unit,
       including the inline Ask AI continuation, rather than ending at the button. */
    .answer-choice-shell.has-choice-ai > button.answer-card:focus,
    .answer-choice-shell.has-choice-ai > button.answer-card:focus-visible {
      outline:none!important;
    }
    .answer-choice-shell.has-choice-ai:has(> button.answer-card.guided-choice-focus) {
      outline:2px solid var(--primary-strong);
      outline-offset:0;
    }
    .answer-choice-shell.has-choice-ai:has(> button.answer-card.guided-choice-focus.correct-option) {
      outline-color:var(--success);
    }
    .answer-choice-shell.has-choice-ai:has(> button.answer-card.guided-choice-focus.incorrect-option) {
      outline-color:var(--danger);
    }
    button.answer-card:has(+ .choice-ai-box) .guided-choice-feedback,
    button.answer-card:has(+ .choice-ai-box) .resolved-choice-feedback { border-bottom-left-radius:0; border-bottom-right-radius:0; border-bottom-color:transparent; margin-bottom:0; }
    .choice-ai-box { max-width:calc(100% - 24px); min-width:0; margin:0 12px 10px; padding:0 10px 8px; border:1px solid rgba(90,110,125,.14); border-top:0; border-radius:0 0 10px 10px; background:rgba(255,255,255,.72); box-shadow:none; overflow:hidden; }
    /* The answer button used to leave its colored bottom padding between explanation and Ask AI. */
    .answer-choice-shell.has-choice-ai > button.answer-card.guided-choice-focus { padding-bottom:0!important; }
    button.answer-card.correct-option + .choice-ai-box { background:rgba(244,252,247,.9); border-color:rgba(39,125,78,.22); border-top:0; }
    button.answer-card.incorrect-option + .choice-ai-box { background:rgba(255,255,255,.72); border-color:rgba(191,70,55,.18); border-top:0; }
    button.answer-card.resolved-unselected-correct + .choice-ai-box { background:rgba(244,252,247,.9); border-color:rgba(39,125,78,.22); border-top:0; }
    button.answer-card.resolved-unselected-wrong + .choice-ai-box { background:rgba(255,255,255,.72); border-color:rgba(191,70,55,.18); border-top:0; }
    .choice-ai-latest { display:none; margin:0; padding:0; font-size:14px; line-height:1.45; color:var(--text); overflow-wrap:anywhere; }
    button.answer-card.guided-choice-focus + .choice-ai-box .choice-ai-latest { font-size:17px; line-height:1.58; }
    .choice-ai-latest .choice-ai-you { color:var(--muted); margin:0; font-size:.86em; }
    /* Ask AI is one quiet continuation line: label, field, history on the same row. */
    .choice-ai-row, .stem-ai-row { display:flex; align-items:baseline; gap:6px; width:100%; max-width:100%; min-width:0; margin:0; }
    .choice-ai-latest[style*="block"] + .choice-ai-row, .stem-ai-latest[style*="block"] + .stem-ai-row { margin-top:3px; }
    .choice-ai-label, .stem-ai-label { flex:0 0 auto; display:block; font-size:13px; font-weight:500; color:var(--muted); white-space:nowrap; }
    .choice-ai-input, .stem-ai-input {
      flex:1 1 auto; min-width:0; width:auto!important; max-width:none!important; height:auto!important; box-sizing:border-box;
      border:0!important; border-bottom:1px solid rgba(94,111,126,.22)!important; border-radius:0!important;
      background:transparent!important; padding:0 1px 1px!important; font:inherit; font-size:14px; line-height:1.2;
      outline:none!important; box-shadow:none!important;
    }
    .choice-ai-input:focus, .stem-ai-input:focus { border-bottom-color:rgba(63,85,104,.42)!important; box-shadow:none!important; }
    .choice-ai-send-btn, .stem-ai-send-btn { flex:0 0 auto; align-self:center; width:23px; height:23px; display:inline-flex; align-items:center; justify-content:center; border:1px solid rgba(94,111,126,.22); border-radius:50%; background:rgba(255,255,255,.72); padding:0; margin:0; color:#526b7c; font:inherit; font-size:15px; line-height:1; cursor:pointer; box-shadow:none; }
    .choice-ai-send-btn:hover, .stem-ai-send-btn:hover { border-color:rgba(63,85,104,.42); background:#fff; }
    .choice-ai-send-btn:disabled, .stem-ai-send-btn:disabled { opacity:.45; cursor:default; }
    .choice-ai-history-btn, .stem-ai-history-btn { display:none; flex:0 0 auto; align-self:center; border:0; background:transparent; padding:0 2px; margin:0; color:#687887; font-size:16px; line-height:1; cursor:pointer; box-shadow:none; }
    .choice-ai-history { display:none; max-height:220px; overflow:auto; margin:5px 0 0; padding:7px 8px; border:1px solid rgba(90,110,125,.12); border-radius:7px; background:rgba(255,255,255,.55); font-size:13px; line-height:1.45; overflow-wrap:anywhere; }
    .choice-ai-history-entry { margin:0 0 7px; }
    .choice-ai-history-entry:last-child { margin-bottom:0; }
    .choice-ai-history-entry strong { font-size:12px; }
    .choice-ai-latest [data-choice-ai-answer] > :first-child,
    .stem-ai-latest [data-stem-ai-answer] > :first-child,
    .nq-ai-history-body > :first-child { margin-top:0; }
    .choice-ai-latest [data-choice-ai-answer] > :last-child,
    .stem-ai-latest [data-stem-ai-answer] > :last-child,
    .nq-ai-history-body > :last-child { margin-bottom:0; }
    .choice-ai-latest [data-choice-ai-answer] p,
    .stem-ai-latest [data-stem-ai-answer] p,
    .nq-ai-history-body p { margin:.18em 0; }
    .choice-ai-latest [data-choice-ai-answer] ul,
    .choice-ai-latest [data-choice-ai-answer] ol,
    .stem-ai-latest [data-stem-ai-answer] ul,
    .stem-ai-latest [data-stem-ai-answer] ol,
    .nq-ai-history-body ul,
    .nq-ai-history-body ol { margin:.22em 0 .3em 1.35em; padding:0; }
    .nq-ai-history-body { display:inline-block; vertical-align:top; max-width:calc(100% - 38px); }
    .choice-ai-status { display:none; font-size:12px; color:var(--muted); margin-top:3px; overflow-wrap:anywhere; }
    /* NQ_SATA_MCQLIKE_EXPLANATION_20260911_V1 */
    .sata-explanation-shell {
      width:100%; max-width:100%; min-width:0; margin-top:10px; padding:9px 10px 8px;
      border:1px solid rgba(90,110,125,.14); border-radius:10px;
      background:rgba(255,255,255,.72); overflow:hidden;
    }
    .option.correct-option .sata-explanation-shell { background:rgba(244,252,247,.9); border-color:rgba(39,125,78,.22); }
    .option.incorrect-option .sata-explanation-shell { background:rgba(255,255,255,.72); border-color:rgba(191,70,55,.18); }
    .sata-explanation-shell > .resolved-choice-feedback {
      display:block; margin:0; padding:0; border:0!important; border-radius:0!important; background:transparent!important;
      font-size:14px; line-height:1.45; font-weight:400; color:var(--text);
    }
    .sata-explanation-shell > .resolved-choice-feedback:empty { display:none; }
    .option .sata-choice-ai-box {
      width:100%; max-width:100%; min-width:0; margin:0; padding:0; border:0; border-radius:0;
      background:transparent!important; box-shadow:none; overflow:hidden;
    }
    .sata-explanation-shell > .resolved-choice-feedback:not(:empty) + .sata-choice-ai-box { margin-top:3px; }
    /* Stem Ask AI remains inside the stem shell after resolution and cannot overflow it. */
    .stem-learning-shell { width:100%; max-width:100%; margin:8px 0 14px; padding:13px 14px 11px; border:1px solid var(--line); border-radius:14px; background:#fff; overflow:hidden; }
    .stem-learning-shell > .question-text { margin:0; }
    .stem-learning-shell #ai-stem-analysis, .stem-learning-shell #ai-test-tip { max-width:none!important; }
    .stem-ai-box { width:100%; max-width:100%; min-width:0; margin:0; padding:0; border:0; overflow:hidden; }
    .stem-ai-latest { display:none; margin:0; padding:0; font-size:14px; line-height:1.45; color:var(--text); overflow-wrap:anywhere; }
    .stem-ai-latest .stem-ai-you { color:var(--muted); margin:0; font-size:12px; }
    .stem-ai-history { display:none; max-height:220px; overflow:auto; margin:5px 0 0; padding:7px 8px; border:1px solid rgba(90,110,125,.12); border-radius:7px; background:rgba(255,255,255,.55); font-size:13px; line-height:1.45; overflow-wrap:anywhere; }
    .stem-ai-history-entry { margin:0 0 7px; }
    .stem-ai-history-entry:last-child { margin-bottom:0; }
    .stem-ai-history-entry strong { font-size:12px; }
    .stem-ai-status { display:none; font-size:12px; color:var(--muted); margin-top:3px; overflow-wrap:anywhere; }
    @media(max-width:700px){
      .choice-ai-label,.stem-ai-label{font-size:12px}.choice-ai-input,.stem-ai-input{font-size:13px;padding-top:0!important;padding-bottom:1px!important}.choice-ai-history,.stem-ai-history{max-height:180px}
      button.answer-card.guided-choice-focus + .choice-ai-box .choice-ai-latest { font-size:16px; line-height:1.55; }
      .stem-learning-shell{max-width:100%;padding:12px 11px 10px}.stem-ai-box{max-width:100%}
    }

    .flash { padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; background: #fff8db; border: 1px solid #f0d98c; }
    .login-head { display:flex; align-items:center; justify-content:space-between; gap:12px; }
    input[type=text], input[type=number], input[type=password], input[type=file] { width: 100%; max-width: 420px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; font-size: 16px; box-sizing: border-box; }
    .small { font-size: 13px; }
    .navlist a { display: block; padding: 10px 0; text-decoration: none; color: inherit; border-bottom: 1px solid #efefef; }
    pre { white-space: pre-wrap; line-height: 1.45; }
    .explanation-block { white-space: normal; line-height: 1.55; font-size: 15px; }
    .exp-heading { margin-top: 12px; }
    .exp-heading:first-child { margin-top: 0; }
    .exp-line { margin-top: 4px; }
    .exp-bullet { margin-top: 4px; padding-left: 14px; text-indent: -10px; }
    .exp-spacer { height: 8px; }
    .inline { display: inline-block; margin-right: 8px; margin-bottom: 8px; }
    .chapter-box { columns: 2 260px; }
    .preset-row, .mode-row, .action-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 16px; }
    .preset-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 62px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer; }
    .preset-chip input { margin-right: 8px; }
    .mobile-only { display: none; }
    .desktop-only { display: block; }
    .question-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 8px; }
    .qchip { display: block; text-align: center; padding: 10px 0; border: 1px solid #c7d6e4; border-radius: 10px; text-decoration: none; color: var(--text); background: #fff; font-weight:600; }
    .qchip.current { border-color: var(--primary-strong); box-shadow: inset 0 0 0 2px var(--primary-strong); font-weight: 800; background:#eef6ff; }
    .qchip.correct { background: #dff3e5; border-color: #79b88e; color:#1f5539; font-weight:700; }
    .qchip.recovered { background:#ffefd0; border-color:#d69a32; color:#704900; font-weight:700; }
    .qchip.incorrect { background: #ffe3de; border-color: #d98b80; color:#8f3025; font-weight:700; }
    .qchip.voided { background: #fff0b8; border-color: #b78200; color:#684c00; text-decoration: line-through; font-weight:700; }
    .option.correct-option { background: #dff3e5; border-color: #79b88e; box-shadow: inset 4px 0 0 #4f9b68; }
    .option.incorrect-option { background: #ffe3de; border-color: #d98b80; box-shadow: inset 4px 0 0 #c85b4e; }
    .sticky-actions { position: sticky; bottom: 0; background: rgba(247,251,255,0.98); padding-top: 10px; }
    .range-row { display:flex; align-items:flex-end; gap:10px; flex-wrap:nowrap; }
    .range-field { flex:1; }
    .range-field input { max-width:none; text-align:center; font-size:20px; font-weight:700; }
    .range-dash { font-size: 30px; font-weight: 700; padding-bottom: 8px; color:#666; }
    .topbar { position: sticky; top:0; z-index:20; display:flex; justify-content:space-between; gap:12px; align-items:center; margin: -12px -12px 12px; padding: 10px 12px; flex-wrap:wrap; background: rgba(255,255,255,.94); backdrop-filter: blur(6px); border-bottom:1px solid var(--line); max-width:100%; }
    .topbar-main { min-width:0; display:flex; align-items:center; gap:8px; flex-wrap:nowrap; }
    .topbar-title { min-width: 0; font-size:14px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
    .topbar-quiz-actions { display:flex; gap:6px; align-items:center; flex-shrink:0; }
    .topbar-quiz-controls { display:flex; align-items:center; gap:6px; flex:0 0 auto; flex-wrap:nowrap; min-width:0; }
    /* Keep the name NEXT TO the quiz icons, never above/below them on desktop.
       The buttons retain their 38px height; the title fills only the remaining
       space, wrapping to two lines WITHIN that same height. Reduce the font
       gradually on narrower laptop viewports rather than truncating the name. */
    .topbar.topbar-quiz { flex-wrap:nowrap; justify-content:flex-start; row-gap:0; }
    .topbar.topbar-quiz .topbar-main {
      display:flex; flex:1 1 auto; width:100%; min-width:0;
      align-items:center; flex-wrap:nowrap; gap:10px;
    }
    .topbar.topbar-quiz .account-menu { flex:0 0 auto; }
    .topbar.topbar-quiz .topbar-quiz-actions {
      display:flex; flex:1 1 0%; min-width:0;
      align-items:center; flex-wrap:nowrap; gap:12px;
    }
    .topbar.topbar-quiz .topbar-quiz-controls {
      flex:0 0 auto; width:auto; min-width:max-content; flex-wrap:nowrap;
    }
    .topbar-quiz-actions .quiz-icon-only { min-width:38px; width:38px; height:38px; padding:7px !important; display:inline-flex; align-items:center; justify-content:center; }
    .topbar-quiz-actions .quiz-icon-only .nq-line-icon { width:19px; height:19px; }
    .topbar.topbar-quiz .topbar-quiz-name {
      display:block; box-sizing:border-box; flex:1 1 0%; width:auto; max-width:none;
      min-width:0; max-height:38px; padding:0; margin:0;
      color:var(--muted); font-size:clamp(9px, calc(2vw - 9px), 13px);
      font-weight:700; line-height:1.23; white-space:normal;
      overflow:hidden; text-overflow:clip; overflow-wrap:anywhere; word-break:normal;
    }
    .topbar-report-voided { opacity:.5; cursor:default; }
    /* Below laptop width there isn't enough horizontal room for readable
       full-length chapter names. Preserve ALL title text on a separate row
       rather than rendering microscopic or clipped text beside the icons. */
    @media (max-width:850px) {
      .topbar.topbar-quiz .topbar-quiz-actions { flex-wrap:wrap; }
      .topbar.topbar-quiz .topbar-quiz-controls { min-width:0; }
      .topbar.topbar-quiz .topbar-quiz-name {
        flex:1 1 100%; width:100%; max-height:none;
        font-size:12px; margin-top:5px; overflow:visible;
      }
    }
    @media (max-width:700px) {
      .topbar.topbar-quiz { display:block; }
      .topbar.topbar-quiz .topbar-main { width:100%; flex:1 1 100%; }
      .topbar.topbar-quiz .account-menu { display:none; }
      .topbar.topbar-quiz .topbar-quiz-actions { width:100%; flex:1 1 auto; gap:5px; }
      .topbar.topbar-quiz .topbar-quiz-controls { width:auto; gap:5px; flex-wrap:nowrap; }
      .topbar.topbar-quiz .topbar-quiz-name { font-size:11px; }
      .topbar.topbar-quiz .quiz-icon-only { min-width:34px; width:34px; height:34px; padding:6px !important; }
      .topbar.topbar-quiz .topbar-qmap-toggle { min-height:34px; padding:6px 9px !important; }
    }
    @media (max-width:380px) {
      .topbar.topbar-quiz .topbar-quiz-controls { min-width:0; width:100%; max-width:100%; flex-wrap:wrap; }
    }
    .quiz-star-button.is-starred { background:#fff8d8 !important; border-color:#d9b84c !important; color:#8a6800 !important; }
    .qchip { position:relative; }
    .qchip .qchip-star { position:absolute; top:2px; right:4px; font-size:.72rem; line-height:1; color:#9b7500; text-shadow:0 1px 0 #fff; }
    .study-settings-dialog { width:min(620px,calc(100vw - 24px)); border:1px solid var(--line-strong); border-radius:14px; padding:0; box-shadow:0 18px 45px rgba(36,52,71,.25); }
    .study-settings-dialog::backdrop { background:rgba(36,52,71,.25); }
    /* NQ_FLAG_REPORT_DIALOG_V1: reuse existing theme-aware modal styling. */
    .nq-report-dialog { width:min(550px,calc(100vw - 24px)); max-height:min(88vh,720px); overflow:auto; color:var(--text);background:var(--card); }
    .nq-report-dialog .study-settings-body { gap:9px; }
    .nq-report-dialog label { display:block; font-weight:650; }
    .nq-report-dialog select, .nq-report-dialog textarea { width:100%; max-width:100%; box-sizing:border-box; background:var(--card); color:var(--text); border:1px solid var(--line); border-radius:9px; }
    .nq-report-dialog select { padding:9px 10px; }
    .nq-report-dialog textarea { min-height:80px; resize:vertical; padding:9px 10px; }
    .nq-report-actions { display:flex; justify-content:flex-end; gap:8px; flex-wrap:wrap; padding:12px 14px; border-top:1px solid var(--line); }
    .nq-report-void-option { border:1px solid var(--line); border-radius:10px; padding:10px 12px; background:var(--card-soft); }
    .nq-report-void-option label { display:flex; align-items:center; gap:9px; margin:0; font-size:.91rem; font-weight:600; cursor:pointer; }
    .nq-report-void-option input[type="checkbox"] { flex:none; width:16px; height:16px; margin:0; }
    .nq-report-void-option .small { margin:5px 0 0 25px; }
    .nq-report-status { min-height:1.1rem; font-size:.82rem; color:var(--muted); }
    .study-settings-head { display:flex; align-items:center; gap:8px; padding:12px 14px; border-bottom:1px solid var(--line); }
    .study-settings-body { padding:12px 14px 14px; display:grid; gap:10px; }
    .study-settings-row { display:flex; align-items:center; gap:8px; min-width:0; }
    .study-settings-row > .study-settings-label { flex:1 1 auto; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
    .study-settings-row > .study-settings-label.nq-med-label-setting { white-space:normal; overflow:visible; text-overflow:clip; overflow-wrap:anywhere; }
    .study-settings-row select { width:auto; max-width:225px; padding:5px 7px; font-size:.82rem; }
    .study-settings-impact { min-width:118px; text-align:right; white-space:nowrap; }
    .topbar-actions { display:flex; gap:6px; align-items:center; flex-shrink:0; }
    .topbar-actions .btn, .topbar-actions button,
    .topbar-quiz-actions .btn, .topbar-quiz-actions button { padding: 8px 10px; font-size: 13px; border-radius: 10px; }
    .compact-quiz-title { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
    .question-text { font-size: 23px; line-height:1.4; margin: 8px 0 12px; white-space: normal; overflow-wrap: anywhere; font-weight:400; }
     /* PB29_MED_LABELS_SITEWIDE_20261105: subtle links inside original question layout. */
     .study-drug-term.nq-med-drug-link { cursor:pointer; font-weight:inherit; text-decoration:underline dotted; text-decoration-thickness:1px; text-underline-offset:3px; color:var(--primary-strong); border-radius:2px; }
     .study-drug-term.nq-med-drug-link:hover, .study-drug-term.nq-med-drug-link:focus-visible { text-decoration-style:solid; color:var(--primary-strong); background:var(--primary-soft); outline-offset:2px; }
     .nq-med-counterpart { font-size:.93em; color:var(--muted); font-weight:400; text-decoration:none; }
     html[data-theme="dark"] .study-drug-term.nq-med-drug-link { color:var(--primary-strong); }
     html[data-theme="dark"] .nq-med-counterpart { color:var(--muted); }
     .study-setting-toggle:disabled { opacity:.6; cursor:wait; }

    .quiz-instruction { font-weight:700; }
    .progress-wrap { margin: 0 0 14px; }
    .progress-top { display:flex; justify-content:space-between; gap:10px; font-size:13px; color: var(--muted); margin-bottom:6px; }
    .progress-bar { height: 10px; border-radius:999px; background:#e8f0f7; overflow:hidden; }
    .progress-fill { height:100%; background: var(--primary); border-radius:999px; }
    .calc-toggle { min-width: 40px; min-height: 38px; padding: 7px 9px; font-size: 1rem; line-height: 1; display:inline-flex; align-items:center; justify-content:center; }
    .calc-toggle .nq-line-icon { width:19px; height:19px; }
    .calc-panel { position: static; width: min(360px, 100%); max-width: 100%; margin: 10px 0 16px; background: white; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 3px 10px rgba(74,111,135,.08); padding: 14px; display: none; }
    .calc-panel.open { display: block; }
    /* NQ_DESKTOP_CALCULATOR_ANSWER_COLUMN_20261005_V1 */
    @media (min-width: 821px) {
      .quiz-answer-workspace:has(> .calc-panel.open) { display:grid; grid-template-columns:minmax(0,1fr) minmax(300px,360px); column-gap:18px; align-items:start; }
      .quiz-answer-workspace:has(> .calc-panel.open) > .calc-panel { grid-column:2; grid-row:1 / span 100; width:100%; max-width:360px; margin:0 0 16px; justify-self:end; }
      .quiz-answer-workspace:has(> .calc-panel.open) > .answer-choice-shell,
      .quiz-answer-workspace:has(> .calc-panel.open) > .option,
      .quiz-answer-workspace:has(> .calc-panel.open) > .range-row,
      .quiz-answer-workspace:has(> .calc-panel.open) > p { grid-column:1; min-width:0; }
    }
    .calc-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; gap:10px; }
    .calc-display { width: 100%; max-width: none !important; font-size: 20px; text-align: right; margin-bottom: 10px; }
    .calc-grid { display:grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
    .calc-grid button { width: 100%; padding: 12px 10px; }
    .calc-grid .wide { grid-column: span 2; }
    .pdf-card { border:1px solid var(--line); border-radius:14px; padding:14px; background:#fff; margin-bottom:10px; box-shadow: 0 3px 10px rgba(74,111,135,.04); }
    .pdf-actions { display:grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
    .pdf-actions a { text-align:center; }
    .library-main-card { grid-column: 1 / -1; }
    .library-toolbar { display:flex; justify-content:space-between; gap:10px; align-items:center; flex-wrap:wrap; margin-bottom:10px; }
    .library-view-switch { display:inline-flex; gap:4px; padding:3px; border:1px solid var(--line); border-radius:10px; background:#f7fafc; }
    .library-view-switch button { padding:6px 9px; font-size:12px; border-radius:7px; background:transparent; color:var(--muted); border:0; box-shadow:none; }
    .library-view-switch button.active { background:#fff; color:var(--text); box-shadow:0 1px 4px rgba(74,111,135,.12); }
    .library-bookshelf { display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:16px; padding:4px 2px 8px; }
    .library-list-view { display:none; }
    .library-collection[data-view="list"] .library-bookshelf { display:none; }
    .library-collection[data-view="list"] .library-list-view { display:block; }
    .book-card { position:relative; display:flex; flex-direction:column; min-width:0; border:1px solid var(--line); border-radius:14px; background:#fff; padding:9px; box-shadow:0 4px 14px rgba(74,111,135,.07); transition:transform .12s ease, box-shadow .12s ease; }
    .book-card:hover { transform:translateY(-2px); box-shadow:0 8px 20px rgba(74,111,135,.12); }
    .book-select { position:absolute; top:14px; left:14px; z-index:3; transform:scale(1.15); }
    .book-cover-link { display:block; border-radius:10px; overflow:hidden; background:linear-gradient(145deg,#eef4f9,#dfe9f1); border:1px solid #d7e2ea; aspect-ratio:0.74; }
    .book-cover { width:100%; height:100%; display:block; object-fit:contain; background:#f3f6f8; }
    .book-info { display:flex; flex-direction:column; flex:1; padding:9px 3px 2px; min-width:0; }
    .book-title { color:var(--text); font-weight:750; line-height:1.28; text-decoration:none; display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; min-height:3.7em; }
    .book-meta { margin-top:5px; font-size:11px; line-height:1.25; color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
    .book-actions { display:grid; grid-template-columns:1fr 1fr; gap:5px; margin-top:auto; padding-top:8px; }
    .book-actions.admin-actions { grid-template-columns:1fr 1fr 1fr; }
    .book-actions .btn { padding:6px 5px; font-size:11px; text-align:center; border-radius:8px; }
    @media (max-width: 560px) {
      .library-bookshelf { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
      .book-card { padding:7px; }
      .book-title { font-size:13px; }
      .book-actions .btn { font-size:10px; padding:6px 3px; }
    }
    .upload-stack { display:grid; gap: 14px; }
    .upload-form { display:grid; gap: 12px; }
    .upload-form input[type=file] { max-width: none; }
    .upload-form button { width: fit-content; min-width: 180px; }
    .manage-grid { display:grid; gap:10px; }
    .manage-item { border:1px solid var(--line); border-radius:12px; padding:12px; background:#fff; }
    .manage-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; }
    .pane-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap:12px; }
    .pane-card { display:flex; flex-direction:column; }
    .pane-head { display:flex; align-items:center; gap:8px; margin-bottom:10px; flex-wrap:wrap; min-width:0; }
    .pane-icon { width:32px; height:32px; border-radius:10px; display:inline-flex; align-items:center; justify-content:center; font-size:18px; background: var(--primary-soft); border:1px solid var(--line); }
    .pane-head h2 { margin:0; font-size:20px; flex:1 1 140px; min-width:0; }
    .pane-tests-progress .pane-icon { background:#edf5ff; }
    .pane-tests-completed .pane-icon { background:#eef7ff; }
    .pane-tests-deleted .pane-icon { background:#f4f8fc; }
    .pane-banks-permanent .pane-icon { background:#edf4fb; }
    .pane-banks-custom .pane-icon { background:#eff5fd; }
    .pane-library .pane-icon { background:#edf4fb; }
    /* NQ_SITEWIDE_LINE_ICON_SYSTEM_20260911_V1 */
    .nq-line-icon { display:block; width:1.28em; height:1.28em; flex:0 0 auto; }
    .pane-icon .nq-line-icon, .explorer-icon .nq-line-icon { width:22px; height:22px; }
    .pane-icon { display:inline-flex; align-items:center; justify-content:center; }
    .explorer-icon { display:flex; align-items:center; justify-content:center; }
    .pane-share .pane-icon { background:#edf4fb; }
    .pane-form { display:flex; flex-direction:column; gap:10px; min-height:280px; }
    .pane-actions { display:flex; flex-wrap:nowrap; gap:6px; align-items:center; overflow-x:auto; padding-bottom:2px; }
    .pane-actions .btn, .pane-actions button, .pane-actions label { padding:7px 10px; font-size:12px; border-radius:9px; flex:0 0 auto; }
    .pane-actions .toggle-all { width:34px; min-width:34px; padding:7px 0; text-align:center; font-size:16px; }
    .pane-file { position:absolute; left:-9999px; width:1px; height:1px; opacity:0; }
    .file-pick { display:inline-flex; align-items:center; justify-content:center; min-width:34px; padding:7px 8px; }
    .rename-row { display:flex; gap:8px; flex-wrap:wrap; }
    .rename-row input { flex:1; min-width:180px; }
    .pane-list { border:1px solid var(--line); border-radius:12px; background: var(--panel); padding:8px; overflow:auto; max-height:calc(100vh - 360px); min-height:180px; }
    .pane-item { display:flex; gap:10px; align-items:flex-start; padding:10px; border-bottom:1px solid #edf2f7; border-radius: 12px; }
    .pane-item:last-child { border-bottom:0; }
    .pane-item.clickable { cursor:pointer; }
    .pane-item.clickable:hover { background: var(--primary-soft); }
    .pane-item input[type=checkbox] { margin-top:2px; transform:scale(1.15); position:relative; z-index:2; }
    .pane-main { flex:1; min-width:0; }
    .pane-title { font-weight:700; }
    .pane-row-actions { display:flex; gap:6px; flex-wrap:wrap; margin-top:8px; position:relative; z-index:2; }
    .pane-row-actions .btn, .pane-row-actions a, .pane-row-actions button { padding:5px 8px; font-size:11px; border-radius:8px; }
    .explorer-list { border:1px solid var(--line); border-radius:10px; background:#fff; overflow:auto; }
    .explorer-row { position:relative; display:grid; grid-template-columns:26px minmax(0,1fr) auto; gap:7px; align-items:center; min-height:38px; padding:5px 7px; border-bottom:1px solid #edf2f7; }
    .explorer-row:last-child { border-bottom:0; }
    .explorer-row:hover { background:var(--primary-soft); }
    .explorer-icon { font-size:18px; text-align:center; }
    .explorer-filetype { display:inline-flex; align-items:center; justify-content:center; min-width:26px; height:20px; padding:0 4px; border:1px solid var(--line-strong); border-radius:5px; background:#fff; color:var(--muted); font-size:8px; line-height:1; font-weight:850; letter-spacing:.02em; }
    .explorer-name {
      min-width:0; color:inherit; text-decoration:none; font-weight:650;
      white-space:normal; overflow:hidden; overflow-wrap:anywhere; line-height:1.22;
      display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2;
      line-clamp:2; max-height:2.44em;
    }
    .explorer-name:hover { text-decoration:underline; }
    .explorer-name-static:hover { text-decoration:none; }
    .explorer-name-tooltip {
      position:fixed; z-index:10050; display:none;
      max-width:min(560px,calc(100vw - 24px)); padding:6px 9px; border-radius:8px;
      background:#243447; color:#fff; font-size:12px; line-height:1.35;
      box-shadow:0 8px 22px rgba(36,52,71,.28); pointer-events:none; overflow-wrap:anywhere;
    }
    .inline-tree-row { border-bottom:0; min-height:34px; padding-top:4px; padding-bottom:4px; }
    .inline-tree-row:hover { background:#f7fbff; }
    .inline-tree-folder { font-weight:750; }
    .inline-tree-empty { color:var(--muted); font-size:10px; margin-left:5px; }
    .info-help { position:relative; display:inline-block; flex:0 0 auto; }
    .info-help > summary {
      list-style:none; width:22px; height:22px; display:flex; align-items:center;
      justify-content:center; padding:0; border:1px solid var(--line-strong);
      border-radius:999px; background:#fff; color:var(--primary-strong);
      font-size:12px; font-weight:800; cursor:pointer; user-select:none;
    }
    .info-help > summary::-webkit-details-marker { display:none; }
    .info-help[open] > summary { background:var(--primary-soft); border-color:var(--primary); }
    .info-help-pop {
      position:absolute; z-index:90; top:27px; left:0;
      width:min(330px,calc(100vw - 36px)); padding:9px 10px;
      border:1px solid var(--line-strong); border-radius:9px; background:#fff;
      color:var(--text); box-shadow:0 12px 28px rgba(36,52,71,.18);
      font-size:11.5px; line-height:1.4; font-weight:400;
    }
    .compact-record-form { margin:0; display:flex; align-items:center; flex:0 0 auto; }
    .compact-record-form button { padding:6px 9px; font-size:11px; border-radius:8px; white-space:nowrap; }
    .explorer-status { font-size:10.5px; color:var(--muted); white-space:nowrap; }
    .file-actions-menu { position:relative; z-index:6; }
    .file-actions-menu > summary { list-style:none; cursor:pointer; min-width:30px; min-height:28px; padding:3px 8px; border:1px solid var(--line-strong); border-radius:7px; background:#fff; font-weight:800; text-align:center; }
    .file-actions-menu > summary::-webkit-details-marker { display:none; }
    .file-menu-pop { position:absolute; z-index:5000; right:0; top:34px; min-width:205px; padding:6px; border:1px solid var(--line-strong); border-radius:10px; background:#fff; box-shadow:0 12px 28px rgba(36,52,71,.18); }
    .file-actions-menu.context-open .file-menu-pop { position:fixed; left:var(--ctx-x); top:var(--ctx-y); right:auto; }
    .file-menu-pop .btn, .file-menu-pop button { display:block; width:100%; padding:7px 8px; margin:0 0 4px; text-align:left; font-size:12px; border-radius:7px; }
    .file-menu-sep { height:1px; background:var(--line); margin:5px 2px; }
    .compact-upload-bar { display:flex; gap:6px; align-items:center; flex-wrap:wrap; margin-top:7px; }
    .compact-upload-bar input[type=file] { max-width:230px; padding:5px 7px; font-size:11px; }
    .compact-sort-form { margin-left:auto; display:flex; align-items:center; gap:5px; flex:0 0 auto; }
    .compact-sort-form select { max-width:120px; padding:4px 6px; font-size:11px; }
    .file-property-dialog { width:min(440px,calc(100vw - 28px)); border:1px solid var(--line-strong); border-radius:14px; padding:0; box-shadow:0 18px 45px rgba(36,52,71,.25); }
    .file-property-dialog::backdrop { background:rgba(36,52,71,.25); }
    .file-property-head { display:flex; align-items:center; gap:8px; padding:11px 13px; border-bottom:1px solid var(--line); }
    .file-property-head strong { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
    .file-property-body { padding:10px 13px 13px; }
    .file-property-row { display:grid; grid-template-columns:110px minmax(0,1fr); gap:9px; padding:5px 0; border-bottom:1px solid #edf2f7; font-size:12px; }
    .file-property-row:last-child { border-bottom:0; }
    @media(max-width:560px){.explorer-row{grid-template-columns:24px minmax(0,1fr) auto}.explorer-status{display:none}.file-property-row{grid-template-columns:90px minmax(0,1fr)}}
    .pane-item.bank-primary { background: #eef5fd; border: 1px solid #c9daeb; }
    .pane-item.bank-addition { background: #f3f8f4; border: 1px solid #cfe1d3; }
    .bank-tag-badge { display:inline-flex; align-items:center; margin-left:8px; padding:2px 8px; border-radius:999px; font-size:11px; font-weight:700; vertical-align:middle; }
    .bank-tag-badge.primary { background:#d9e9f7; color:#35536a; border:1px solid #bfd4e7; }
    .bank-tag-badge.addition { background:#e0efe3; color:#355d3d; border:1px solid #c7decf; }
    .bank-tag-badge.regular { background:#eef2f6; color:#64748b; border:1px solid #dbe3ea; }
    .pane-title-row { display:flex; align-items:flex-start; justify-content:space-between; gap:8px; }
    .pane-title-row .pane-title { flex:1; min-width:0; }
    .bank-format-chips { display:flex; flex-wrap:nowrap; gap:6px; justify-content:flex-end; margin-left:auto; flex-shrink:0; }
    .format-chip { display:inline-flex; align-items:center; gap:4px; padding:2px 8px; border-radius:999px; border:1px solid #dbe3ea; background:#f8fafc; color:#526173; font-size:11px; font-weight:700; white-space:nowrap; }
    .format-chip.compact { min-width:34px; justify-content:center; padding:2px 7px; }
    .format-chip.compact .format-label { display:none; }
    .format-chip.compact .format-icon { font-size:14px; line-height:1; }
    .format-chip.more { min-width:26px; justify-content:center; padding:2px 7px; }
    .format-legend { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
    .format-icon { line-height:1; }
    .bank-group-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap:12px; }
    .bank-group-card { border:1px solid var(--line); border-radius:12px; background:#fff; padding:10px; }
    .bank-group-head { display:flex; align-items:center; gap:8px; margin-bottom:8px; font-weight:700; }
    .bank-group-card .pane-list { max-height:320px; min-height:140px; }
    /* NQ_COMPLETED_ALIGNMENT_20260903_V1: child-bearing completed parents stay on the same top-level grid. */
    .attempt-group { border:1px solid var(--line); border-radius:12px; padding:0; background:#fff; margin-bottom:10px; }
    .attempt-select-spacer { width:13px; min-width:13px; flex:0 0 13px; height:1px; margin-top:2px; }
    .attempt-group-title { font-weight:700; margin-bottom:2px; }
    .attempt-child { margin-top:8px; margin-left:28px; padding:8px 10px; border:1px solid #e7eef5; border-left:4px solid #d6e3ef; border-radius:10px; background:#f8fbff; font-size:13px; }
    .attempt-child .pane-title { font-size:13px; font-weight:600; }
    .attempt-child .small { font-size:12px; }
    .attempt-child .pane-row-actions { margin-top:6px; }
    .attempt-child .pane-row-actions .btn, .attempt-child .pane-row-actions a, .attempt-child .pane-row-actions button { padding:4px 7px; font-size:10px; }
    /* NQ_COMBINED_SOURCE_POPOVER_20260903_V1 */
    .combined-source-popover { display:inline-block; }
    .combined-source-toggle { background:none !important; color:#2d6588 !important; border:0 !important; box-shadow:none !important; padding:0 !important; margin:0 !important; font:inherit !important; font-size:inherit !important; font-weight:400 !important; text-decoration:underline; cursor:pointer; }
    .combined-source-toggle:hover { background:none !important; color:#204d69 !important; }
    .combined-source-bubble { position:fixed; z-index:10040; width:min(430px,calc(100vw - 24px)); max-height:min(55vh,520px); overflow:auto; padding:10px 12px; border:1px solid var(--line-strong); border-radius:12px; background:#fff; box-shadow:0 14px 34px rgba(36,52,71,.22); text-align:left; }
    .combined-source-bubble[hidden] { display:none !important; }
    .combined-source-bubble-title { font-weight:800; margin-bottom:6px; }
    .combined-source-bubble-row { padding:7px 0; border-top:1px solid #edf2f7; }
    .combined-source-bubble-row:first-of-type { border-top:0; }
    .combined-source-bubble-name { font-weight:650; line-height:1.3; }
    /* NQ_EXHAUSTIVE_HELP_POPUP_V1: use established combined-source popup behavior.
       Only its own theme colors need adjustment for dark mode. */
    .combined-source-bubble.nq-exhaustive-help-bubble,
    .combined-source-bubble.nq-ai-results-help-bubble {
      color:var(--text); background:var(--card); line-height:1.5;
    }
    .combined-source-toggle.nq-exhaustive-help-toggle,
    .combined-source-toggle.nq-exhaustive-help-toggle:hover,
    .combined-source-toggle.nq-ai-results-help-toggle,
    .combined-source-toggle.nq-ai-results-help-toggle:hover {
      color:var(--primary-strong)!important;
    }
    .coverage-chip { display:inline-flex; align-items:center; gap:6px; padding:2px 8px; border-radius:999px; font-size:11px; font-weight:700; background:#f8fafc; border:1px solid #e2e8f0; }
    .syllabus-outline-row { padding:8px 0; border-top:1px solid var(--line); }
    .syllabus-outline-row:first-child { border-top:none; }

    .account-menu { position: relative; display:inline-block; }
    .account-menu summary { list-style:none; cursor:pointer; background:white; color:var(--text); border:1px solid var(--line); border-radius:10px; padding:8px 10px; font-size:13px; font-weight:600; box-shadow: 0 2px 8px rgba(74,111,135,.04); }
    .account-menu summary::-webkit-details-marker { display:none; }
    .account-menu[open] summary { border-bottom-left-radius:0; border-bottom-right-radius:0; }
    .account-dropdown { position:absolute; left:0; top:100%; min-width:140px; background:white; border:1px solid var(--line); border-top:0; border-bottom-left-radius:10px; border-bottom-right-radius:10px; box-shadow:0 10px 24px rgba(74,111,135,.12); padding:8px; z-index:30; }
    .account-dropdown form { margin:0; }
    .account-dropdown button { width:100%; text-align:left; background:white; color:var(--text); border:1px solid var(--line); }
    .topbar-nav { display:flex; gap:6px; align-items:center; justify-content:flex-end; flex:1 1 520px; min-width:0; flex-wrap:wrap; }
    .topbar-nav .btn, .topbar-nav button { padding:8px 10px; font-size:13px; border-radius:10px; margin-right:0 !important; margin-bottom:0 !important; white-space:nowrap; }
    
.audio-progress-wrap{height:10px; background:#eef2f7; border:1px solid #d8e0ea; border-radius:999px; overflow:hidden; margin:8px 0 4px; max-width:520px;}
.audio-progress-bar{height:100%; background:#3b82f6; border-radius:999px; min-width:0; transition:width .2s ease;}

.global-audio-player{position:fixed; left:0; right:0; bottom:0; z-index:1000; background:rgba(255,255,255,.97); border-top:1px solid var(--line-strong); box-shadow:0 -8px 28px rgba(74,111,135,.16); padding:8px 12px; backdrop-filter:blur(8px);}
.global-audio-inner{width:min(1180px, 100%); margin:0 auto; display:grid; grid-template-columns:minmax(180px, 1.1fr) minmax(300px, 1.6fr) auto; gap:10px; align-items:center;}
.global-audio-title{min-width:0; overflow:hidden;}
.global-audio-name{font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.global-audio-sub{font-size:12px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.global-audio-controls{display:grid; grid-template-columns:auto minmax(130px, 1fr) auto auto; align-items:center; gap:8px; min-width:0;}
.global-audio-controls button,.global-audio-actions .btn,.global-audio-actions button{padding:6px 9px; border-radius:9px; font-size:12px; box-shadow:none;}
.global-audio-seek{width:100%; min-width:0; accent-color:var(--primary-strong);}
.global-audio-time{font-size:12px; color:var(--muted); white-space:nowrap; min-width:86px; text-align:center;}
.global-audio-actions{display:flex; align-items:center; gap:6px; justify-content:flex-end; flex-wrap:wrap; min-width:0;}
.global-audio-actions select,.global-audio-actions input[type=range]{max-width:none; width:auto; padding:6px 8px; font-size:12px; border-radius:9px;}
.global-audio-volume{width:72px !important; accent-color:var(--primary-strong);}
.global-audio-collapse{min-width:34px; padding:6px 8px !important; font-weight:700; flex-shrink:0;}
.global-transcribe-toggle{
  min-width:32px; width:32px; height:30px; padding:5px !important;
  display:inline-flex; align-items:center; justify-content:center;
  color:#8f99a3 !important; background:#fbfcfd !important;
  border-color:#d7e0e8 !important; box-shadow:none !important;
}
.global-transcribe-toggle svg{width:16px;height:16px;display:block;fill:currentColor;}
.global-transcribe-toggle:hover{color:#727c86 !important;background:#f4f7f9 !important;border-color:#cbd5de !important;}
.global-transcribe-toggle.is-working{animation:nqMicWorking .8s ease-in-out infinite;}
.global-transcribe-toggle.is-recording{
  animation:nqMicRecording 1.45s ease-in-out infinite;
  background:#f7f9fa !important;
}
.global-transcribe-toggle.has-warning{box-shadow:0 0 0 2px rgba(143,153,163,.16) !important;}
.global-transcribe-lock{
  display:none; min-width:32px; width:32px; height:30px; padding:5px !important;
  align-items:center; justify-content:center; font-size:15px !important;
  color:#707b84 !important; background:#f7f9fa !important; border-color:#d5dee5 !important;
}
.global-transcribe-lock.is-available{display:inline-flex;}
.transcribe-touch-lock{
  position:fixed; inset:0; z-index:30000; display:none;
  background:#050505; color:#8f979d; touch-action:none; overscroll-behavior:none;
  user-select:none; -webkit-user-select:none;
}
.transcribe-touch-lock.open{display:flex; align-items:center; justify-content:center;}
.transcribe-touch-lock-inner{
  width:min(360px,calc(100% - 40px)); text-align:center; padding:22px;
}
.transcribe-touch-lock-status{font-size:13px; letter-spacing:.02em; color:#727b82; margin-bottom:24px;}
.transcribe-touch-lock-dot{
  display:inline-block; width:7px; height:7px; margin-right:7px; border-radius:50%;
  background:#9b5c5c; box-shadow:0 0 0 3px rgba(155,92,92,.10);
}
.transcribe-touch-unlock{
  position:relative; width:100%; min-height:54px; overflow:hidden;
  border:1px solid #262a2d !important; border-radius:12px !important;
  background:#0b0c0d !important; color:#8e969c !important; box-shadow:none !important;
  font-size:13px !important; font-weight:700 !important;
}
.transcribe-touch-unlock-progress{
  position:absolute; inset:0 auto 0 0; width:0; background:#171a1c; pointer-events:none;
}
.transcribe-touch-unlock.is-holding .transcribe-touch-unlock-progress{
  width:100%; transition:width 1.5s linear;
}
.transcribe-touch-unlock-label{position:relative; z-index:1;}
body.transcribe-touch-locked{overflow:hidden !important;}
@keyframes nqMicRecording{
  0%,100%{color:#69737d;opacity:.72;}
  50%{color:#a7adb3;opacity:1;}
}
@keyframes nqMicWorking{
  0%,100%{color:#87919a;opacity:.55;}
  50%{color:#b1b7bc;opacity:1;}
}
.global-audio-player.collapsed{padding:6px 10px;}
.global-audio-player.collapsed .global-audio-inner{grid-template-columns:minmax(0,1fr) auto; gap:8px;}
.global-audio-player.collapsed .global-audio-title{align-self:center;}
.global-audio-player.collapsed .global-audio-name{font-size:13px;}
.global-audio-player.collapsed .global-audio-sub{display:none;}
.global-audio-player.collapsed .global-audio-actions{display:none;}
.global-audio-player.collapsed .global-audio-controls{justify-content:flex-end; gap:6px; min-width:auto;}
.global-audio-player.collapsed .global-audio-seek{display:none;}
.global-audio-player.collapsed .global-audio-time{font-size:12px; min-width:70px;}
.global-audio-hidden{display:none;}
html.nq-soft-nav-loading .topbar { opacity:.72; }
@media (max-width: 1180px) {
      .global-audio-inner { grid-template-columns:1fr; gap:8px; }
      .global-audio-actions { justify-content:flex-start; }
}
@media (max-width: 820px) {
      .row { flex-direction: column; }
      .side { width: auto; }
      .desktop-only { display: none; }
      .mobile-only { display: block; }
      .chapter-box { columns: 1 260px; }
      .pane-list { max-height:240px; }
      .pane-actions { gap:5px; }
      .pane-actions .btn, .pane-actions button, .pane-actions label { padding:6px 8px; font-size:11px; }
      .pane-actions .toggle-all { width:32px; min-width:32px; font-size:15px; }
      .pane-title-row { align-items:flex-start; }
      .bank-format-chips { justify-content:flex-start; margin-left:0; }
      h1 { font-size: 22px; margin: 0 0 8px; }
      h2 { font-size: 20px; }
      .action-row > * { flex: 1 1 calc(50% - 10px); }
      .sticky-actions { display:grid; grid-template-columns: repeat(3, 1fr); gap:8px; }
      .sticky-actions > * { width:100%; margin:0 !important; padding: 12px 8px; font-size:13px; }
      .question-text { font-size: 21px; }
      .option label { font-size: 17px; }
      .global-audio-inner { grid-template-columns:1fr; gap:7px; }
      .global-audio-controls { grid-template-columns:auto 1fr auto auto; }
      .global-audio-actions { justify-content:flex-start; }
      .global-audio-player.collapsed .global-audio-inner { grid-template-columns:minmax(0,1fr) auto; }
      .global-audio-player.collapsed .global-audio-controls { flex-wrap:nowrap; }
    }
    @media (max-width: 560px) {
      body { padding-bottom: 178px; }
      body.global-audio-collapsed { padding-bottom: 58px; }
      body.global-audio-hidden-state { padding-bottom: 0; }
      .wrap { padding: 10px; }
      .card { padding: 14px; }
      .topbar { margin: -10px -10px 10px; padding: 8px 10px; align-items:flex-start; gap:8px; }
      .topbar-main { gap:6px; width:100%; flex-wrap:wrap; }
      .topbar-title { font-size: 13px; }
      .topbar-nav { width:100%; flex:1 1 100%; justify-content:flex-start; align-items:flex-start; gap:6px; flex-wrap:wrap; overflow:visible; }
      .topbar-nav .btn, .topbar-nav button { padding:7px 8px; font-size:12px; }
      .account-menu { max-width:100%; }
      .account-menu summary { max-width:calc(100vw - 32px); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
      .account-dropdown { left:0; right:auto; min-width:180px; max-width:calc(100vw - 32px); }
      .topbar-actions .btn, .topbar-actions button,
      .topbar-quiz-actions .btn, .topbar-quiz-actions button { padding: 7px 8px; font-size: 12px; }
      .question-text { font-size: 20px; }
      .range-row { gap:8px; }
      .range-dash { font-size: 28px; }
      .sticky-actions { grid-template-columns: repeat(3, 1fr); }
      .sticky-actions > * { min-width:0; }
    }

    /* NQ_SITE_WIDE_THEME_V1 - global contrast-aware theme */
    html[data-theme="dark"] {
      color-scheme:dark;
      --bg:#151b24; --card:#222b37; --card-soft:#1d2733; --panel:#222b37;
      --line:#394858; --line-strong:#53677c; --text:#edf2f7;
      --muted:#afc0d2; --primary:#759dbd; --primary-strong:#b6d8f3;
      --primary-soft:#2c4056; --primary-soft-2:#364d66;
      --danger:#ff978e; --danger-soft:#51302f; --success:#8bd9ac;
      --success-soft:#243d32; --warning-soft:#55472b; --warning-strong:#f6d78d;
    }
    html[data-theme="dark"],html[data-theme="dark"] body { background:var(--bg);color:var(--text); }
    html[data-theme="dark"] .topbar,
    html[data-theme="dark"] .card,
    html[data-theme="dark"] .pane-card,
    html[data-theme="dark"] .account-dropdown,
    html[data-theme="dark"] dialog,
    html[data-theme="dark"] .study-settings-dialog {background:var(--card)!important;color:var(--text);border-color:var(--line)!important;}
    html[data-theme="dark"] .topbar {background:rgba(28,37,49,.98)!important;}
    html[data-theme="dark"] .account-menu summary,
    html[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]),
    html[data-theme="dark"] select,html[data-theme="dark"] textarea,
    html[data-theme="dark"] .option,html[data-theme="dark"] .answer-card,
    html[data-theme="dark"] .flash {background:var(--card-soft)!important;color:var(--text)!important;border-color:var(--line)!important;}
    html[data-theme="dark"] .btn.light,
    html[data-theme="dark"] button.light {background:var(--card-soft)!important;color:var(--text)!important;border-color:var(--line)!important;}
    html[data-theme="dark"] .btn:not(.light):not(.danger),
    html[data-theme="dark"] button.btn:not(.light):not(.danger):not(.nq-theme-toggle) {color:#ffffff;background:#456780;}
    html[data-theme="dark"] a:not(.btn) {color:var(--primary-strong);}
    html[data-theme="dark"] .muted {color:var(--muted)!important;}
    html[data-theme="dark"] .option.correct-option,
    html[data-theme="dark"] .qchip.correct {background:var(--success-soft)!important;color:var(--text)!important;}
    html[data-theme="dark"] .option.incorrect-option,
    html[data-theme="dark"] .qchip.incorrect {background:var(--danger-soft)!important;color:var(--text)!important;}
    html[data-theme="dark"] .qchip.recovered {background:var(--warning-soft)!important;}
    html[data-theme="dark"] .study-settings-dialog::backdrop {background:rgba(0,0,0,.65);}

    /* PB29_THEME_TRANSITION_CONTRAST_V3
       A theme flip must be atomic for text contrast. Background transitions
       otherwise fool the contrast guardian into selecting a foreground for a
       temporary half-light/half-dark surface and leaving it behind. Other
       transitions (hover, navigation, animations) stay unchanged. */
    html.nq-theme-switching, html.nq-theme-switching *,
    html.nq-theme-switching *::before, html.nq-theme-switching *::after {
      transition: none !important;
    }

    /* PB29_CONTRAST_GUARD_THEME_SCOPE_V2
       Corrections live in a custom property and apply ONLY in the theme where
       they were calculated. If the observer lags or a soft navigation completes
       mid-frame, a stale dark contrast correction cannot fade day-mode text.
       Deliberately specific to supersede other semantic !important text colors
       only for elements the contrast audit proved unreadable. */
    html[data-theme="dark"] .nq-contrast-dark.nq-contrast-dark.nq-contrast-dark.nq-contrast-dark.nq-contrast-dark,
    html:not([data-theme="dark"]) .nq-contrast-light.nq-contrast-light.nq-contrast-light.nq-contrast-light.nq-contrast-light {
      color:var(--nq-contrast-foreground)!important;
    }

    /* PB29_THEME_TOKENS_V2: common semantic surfaces, never invert clinical imagery.
       A new component should use these variables instead of hardcoded white/gray. */
    :root {
      --nq-surface:var(--card);--nq-surface-raised:var(--card-soft);
      --nq-surface-inset:var(--panel);--nq-surface-tint:var(--primary-soft);
      --nq-foreground:var(--text);--nq-foreground-soft:var(--muted);
      --nq-border:var(--line);--nq-border-strong:var(--line-strong);
      --nq-link:var(--primary-strong);--nq-correct-bg:var(--success-soft);
      --nq-incorrect-bg:var(--danger-soft);--nq-warning-bg:var(--warning-soft);
    }
    html[data-theme="dark"] {color-scheme:dark;}
    html[data-theme="dark"] :is(
      .answer-choice-shell.has-choice-ai,.stem-learning-shell,.sata-explanation-shell,
      .choice-ai-box,.choice-ai-history,.stem-ai-history,.choice-strategy-popover,
      .quiz-learning-panel,.study-settings-dialog,.pdf-card,.manage-item,.bank-group-card,
      .attempt-group,.explorer-list,.file-menu-pop,.file-actions-menu>summary,
      .library-view-switch,.book-cover-link,.preset-chip,.qchip,.file-property-dialog,
      .account-dropdown,.popover,.modal,.dialog-content
    ) {
      background:var(--nq-surface)!important;
      color:var(--nq-foreground)!important;
      border-color:var(--nq-border)!important;
    }
    html[data-theme="dark"] :is(
      .choice-ai-box,.choice-ai-history,.stem-ai-history,.sata-explanation-shell,
      .attempt-child,.pane-item,.library-view-switch,.quiz-learning-panel-head,
      .choice-strategy-popover,.bank-group-card .pane-item,.pane-item.bank-primary,
      .pane-item.bank-addition,.coverage-chip,.format-chip
    ){
      background:var(--nq-surface-raised)!important;color:var(--nq-foreground)!important;
      border-color:var(--nq-border)!important;
    }
    html[data-theme="dark"] :is(
      .answer-choice-shell.has-choice-ai:has(>button.answer-card.resolved-unselected-correct),
      .answer-choice-shell.has-choice-ai:has(>button.answer-card.resolved-unselected-wrong),
      .option.resolved-unselected-correct,.option.resolved-unselected-wrong,
      button.answer-card[aria-disabled="true"].resolved-unselected-correct:hover,
      button.answer-card[aria-disabled="true"].resolved-unselected-wrong:hover
    ) {background:var(--nq-surface)!important;color:var(--nq-foreground)!important;}
    html[data-theme="dark"] :is(
      .answer-choice-shell.has-choice-ai:has(>button.answer-card.correct-option),
      .option.correct-option,.qchip.correct
    ){background:var(--nq-correct-bg)!important;color:var(--nq-foreground)!important;}
    html[data-theme="dark"] :is(
      .answer-choice-shell.has-choice-ai:has(>button.answer-card.incorrect-option),
      .option.incorrect-option,.qchip.incorrect
    ){background:var(--nq-incorrect-bg)!important;color:var(--nq-foreground)!important;}
    html[data-theme="dark"] :is(.qchip.recovered,.qchip.voided,.quiz-star-button.is-starred){
      background:var(--nq-warning-bg)!important;color:var(--nq-foreground)!important;
    }
    html[data-theme="dark"] .answer-choice-shell.has-choice-ai >button.answer-card {
      background:transparent!important;color:var(--nq-foreground)!important;
    }
    html[data-theme="dark"] .choice-ai-box :is(p,span,strong,div,li),
    html[data-theme="dark"] .sata-explanation-shell :is(p,span,strong,div,li),
    html[data-theme="dark"] .choice-strategy-popover :is(p,span,strong,div,li){
      color:var(--nq-foreground);
    }
    html[data-theme="dark"] :is(
      .choice-ai-label,.stem-ai-label,.choice-ai-status,.choice-ai-you,
      .choice-strategy-left-label,.choice-strategy-compare-label,
      .choice-strategy-action-label,.choice-fit-button
    ){color:var(--nq-foreground-soft)!important;}
    html[data-theme="dark"] :is(.choice-ai-send-btn,.stem-ai-send-btn){
      background:#35546d!important;color:#ffffff!important;border-color:var(--nq-border-strong)!important;
    }
    html[data-theme="dark"] :is(.choice-ai-input,.stem-ai-input){
      background:transparent!important;color:var(--nq-foreground)!important;
    }
    html[data-theme="dark"] :is(.choice-ai-input,.stem-ai-input)::placeholder{
      color:var(--nq-foreground-soft)!important;
    }
    html[data-theme="dark"] :is(
      .choice-strategy-popover-title,.question-analysis-subtoggle,
      .quiz-learning-panel-toggle
    ){color:var(--nq-foreground)!important;}
    html[data-theme="dark"] .choice-fit-bar{background:var(--nq-border)!important;}
    html[data-theme="dark"] :is(.choice-strategy-context-pill,.choice-strategy-heuristic-neutral){
      background:var(--nq-surface-tint)!important;
      color:var(--nq-foreground-soft)!important;
      border-color:var(--nq-border-strong)!important;
    }
    html[data-theme="dark"] .choice-strategy-badge:hover{background:var(--nq-surface-tint)!important;}
    html[data-theme="dark"] :is(.choice-strategy-action-eliminate,.choice-strategy-action-opposite){
      background:var(--nq-incorrect-bg)!important;color:#ffd4d0!important;
    }
    html[data-theme="dark"] :is(.choice-strategy-action-keep,.choice-strategy-heuristic-support){
      background:var(--nq-correct-bg)!important;color:#c4f6d6!important;
    }
    html[data-theme="dark"] :is(
      .choice-strategy-action-evidence,.choice-strategy-action-extreme,
      .choice-strategy-action-trap,.choice-strategy-heuristic-caution
    ){background:var(--nq-warning-bg)!important;color:#f6dfaa!important;}
    html[data-theme="dark"] :is(.choice-strategy-action-outlier,.choice-strategy-compare){
      background:var(--nq-surface-tint)!important;color:#c7e2fb!important;
    }
    html[data-theme="dark"] :is(
      .quiz-learning-panel .ai-markdown,.quiz-learning-panel .ai-markdown *,
      .quiz-learning-panel .resolved-choice-feedback,.quiz-learning-panel .resolved-choice-feedback *,
      .answer-choice-shell.has-choice-ai .guided-choice-feedback,
      .answer-choice-shell.has-choice-ai .resolved-choice-feedback
    ){color:var(--nq-foreground)!important;}
    html[data-theme="dark"] :is(
      .quiz-learning-panel-head,.file-menu-pop,.account-menu summary
    ){border-color:var(--nq-border)!important;}
    html[data-theme="dark"] :is(.pane-item,.explorer-row,.file-property-row,.navlist a){
      border-color:var(--nq-border)!important;
    }
    html[data-theme="dark"] :is(.pane-item:hover,.inline-tree-row:hover,.explorer-row:hover){
      background:var(--nq-surface-tint)!important;
    }
    html[data-theme="dark"] :is(
      .pane-tests-progress .pane-icon,.pane-tests-completed .pane-icon,.pane-tests-deleted .pane-icon,
      .pane-banks-permanent .pane-icon,.pane-banks-custom .pane-icon,.pane-library .pane-icon,
      .pane-share .pane-icon,.library-view-switch button.active,.progress-bar,.audio-progress-wrap
    ){background:var(--nq-surface-tint)!important;}
    html[data-theme="dark"] .flash{background:var(--nq-warning-bg)!important;}
    html[data-theme="dark"] .book-cover{background:transparent!important;}
    /* Preserve original pixels/color scales for externally-authored medical images, ECGs,
       figures, PDFs, charts, and textbook diagrams: no CSS invert/filter on content. */

    /* PB29_QUIZ_NAV_DARK_POLISH_V1: soften only quiz navigation buttons in dark mode. */
    html[data-theme="dark"] .pb29-quiz-nav-actions.sticky-actions {
      background:rgba(29,39,51,.97)!important;
      border:1px solid var(--nq-border)!important;
      border-radius:16px!important;
      box-shadow:0 8px 22px rgba(0,0,0,.18)!important;
      padding:10px!important;
      gap:9px!important;
      display:flex;
      align-items:stretch;
      flex-wrap:nowrap;
    }
    html[data-theme="dark"] .pb29-quiz-nav-actions > :is(a.btn,button) {
      display:flex!important;
      flex:1 1 0!important;
      min-width:0!important;
      width:auto!important;
      min-height:46px;
      justify-content:center;
      align-items:center;
      margin:0!important;
      padding:10px 9px!important;
      font-size:15px!important;
      font-weight:650!important;
      letter-spacing:.01em;
      border-radius:12px!important;
      color:#f2f7fc!important;
      background:#466d89!important;
      border:1px solid #6588a3!important;
      box-shadow:none!important;
      text-decoration:none!important;
      text-align:center;
    }
    html[data-theme="dark"] .pb29-quiz-nav-actions > :is(a.btn,button):hover {
      background:#547d99!important;
      border-color:#84a9c3!important;
    }
    html[data-theme="dark"] .pb29-quiz-nav-actions > :is(a.btn,button):focus-visible {
      outline:3px solid #b4dbf6!important;
      outline-offset:2px;
    }
    html[data-theme="dark"] .pb29-quiz-nav-actions > :is(a.btn,button):disabled {
      opacity:.5;
    }
    @media(max-width:700px){
      html[data-theme="dark"] .pb29-quiz-nav-actions.sticky-actions{gap:7px!important;padding:8px!important;}
      html[data-theme="dark"] .pb29-quiz-nav-actions > :is(a.btn,button){
        font-size:14px!important;min-height:44px;padding:9px 5px!important;
      }
    }
    .nq-theme-toggle{display:inline-flex;flex:0 0 36px;align-items:center;justify-content:center;width:36px;min-width:36px;height:36px;padding:5px!important;border:1px solid var(--line-strong)!important;border-radius:10px;background:var(--card-soft)!important;color:var(--text)!important;box-shadow:none!important;line-height:1;}
    /* PB29_THEME_ICON_ALIGNMENT_V1: same footprint and baseline as adjacent SVG icon buttons. */
    .topbar-quiz-actions .nq-theme-toggle {
      box-sizing:border-box;
      align-self:center;
      height:38px;
      min-height:38px;
      width:38px;
      min-width:38px;
      flex:0 0 38px;
      vertical-align:middle;
      padding:7px!important;
    }
    /* PB29_THEME_OUTLINE_ICONS_V1: theme artwork uses the SAME 1.8px
       outline SVG family as the calculator, flag and settings buttons. */
    .nq-theme-toggle .nq-theme-sun,.nq-theme-toggle .nq-theme-moon{
      display:inline-flex;
      width:20px;
      height:20px;
      align-items:center;
      justify-content:center;
      line-height:0;
    }
    .nq-theme-toggle :is(.nq-theme-sun,.nq-theme-moon) .nq-line-icon{
      display:block;
      width:20px;
      height:20px;
      flex:0 0 20px;
    }
    @media(max-width:700px){
      .topbar.topbar-quiz .nq-theme-toggle {
        height:35px!important;
        min-height:35px!important;
        width:35px!important;
        min-width:35px!important;
        flex:0 0 35px!important;
        padding:6px!important;
      }
    }
    .nq-theme-toggle .nq-theme-moon{display:none;}
    html[data-theme="dark"] .nq-theme-toggle .nq-theme-sun{display:none;}
    html[data-theme="dark"] .nq-theme-toggle .nq-theme-moon{display:inline-flex;}

    /* PB29_UNIFORM_QUIZ_TOOLBAR_V1: one sizing/alignment contract for the
       seven icon-only controls. Q-Map remains intentionally wider. */
    .topbar.topbar-quiz .topbar-quiz-controls {
      align-items:center;
    }
    .topbar.topbar-quiz .topbar-quiz-controls > form {
      display:flex;
      flex:0 0 auto;
      margin:0!important;
      padding:0;
      align-items:center;
      align-self:center;
    }
    .topbar.topbar-quiz .topbar-quiz-controls :is(.quiz-icon-only,.nq-theme-toggle) {
      box-sizing:border-box!important;
      display:inline-flex!important;
      align-items:center!important;
      justify-content:center!important;
      align-self:center!important;
      flex:0 0 38px!important;
      width:38px!important;
      min-width:38px!important;
      max-width:38px!important;
      height:38px!important;
      min-height:38px!important;
      max-height:38px!important;
      padding:7px!important;
      margin:0!important;
      border-radius:10px!important;
      line-height:1!important;
      vertical-align:middle;
    }
    .topbar.topbar-quiz .topbar-quiz-controls :is(.quiz-icon-only,.nq-theme-toggle) .nq-line-icon {
      display:block;
      flex:0 0 20px;
      width:20px!important;
      height:20px!important;
      margin:auto;
    }
    @media(max-width:700px){
      .topbar.topbar-quiz .topbar-quiz-controls :is(.quiz-icon-only,.nq-theme-toggle){
        flex:0 0 35px!important;
        width:35px!important;min-width:35px!important;max-width:35px!important;
        height:35px!important;min-height:35px!important;max-height:35px!important;
        padding:6px!important;
      }
      .topbar.topbar-quiz .topbar-quiz-controls :is(.quiz-icon-only,.nq-theme-toggle) .nq-line-icon{
        flex-basis:19px;width:19px!important;height:19px!important;
      }
    }

    /* PB29_QMAP_ALIGN_V1 */
    .topbar.topbar-quiz .topbar-quiz-controls .topbar-qmap-toggle {
      box-sizing:border-box!important;display:inline-flex!important;
      align-items:center!important;justify-content:center!important;
      align-self:center!important;flex:0 0 auto!important;
      height:38px!important;min-height:38px!important;max-height:38px!important;
      width:auto!important;margin:0!important;
      padding:7px 12px!important;line-height:1.15!important;
      vertical-align:middle;
    }
    @media(max-width:700px) {
      .topbar.topbar-quiz .topbar-quiz-controls .topbar-qmap-toggle {
        height:35px!important;min-height:35px!important;max-height:35px!important;
        padding:6px 10px!important;
      }
    }
    .nq-theme-toggle:focus-visible{outline:3px solid var(--primary-strong);outline-offset:2px;}
    @media(max-width:700px){
      .topbar.topbar-quiz .topbar-quiz-controls{gap:3px!important;}
      .topbar.topbar-quiz .nq-theme-toggle{width:35px;min-width:35px;flex-basis:35px;height:35px;padding:6px!important;}
      .topbar.topbar-quiz .topbar-quiz-controls .quiz-icon-only{width:35px;min-width:35px;}
    }

    /* PB29_INTERACTIVE_WINDOW_EDGE_V1
       A single visual convention for MAJOR interactive surfaces:
       standalone workspace cards, full-size module panes, dialogs and popup
       panels. Never decorate nested file rows, answer choices, buttons, chips,
       stat tiles, or the audio player nested within its parent window.
       The outer Exam Collections .exam-workspace-shell frame is EXCLUDED
       in both themes and on hover: it keeps its standard 1px border.
       Future top-level windows may opt in with .nq-interactive-window. */
    :root {
      --nq-window-edge:#a9becc;
      --nq-window-edge-active:#7399b1;
    }
    html[data-theme="dark"] {
      --nq-window-edge:#667f93;
      --nq-window-edge-active:#8cacbf;
    }
    .pane-tests-progress {
      --nq-window-edge:#b7a77b;
      --nq-window-edge-active:#b7a77b;
    }
    .pane-tests-completed {
      --nq-window-edge:#91a99a;
      --nq-window-edge-active:#91a99a;
    }
    html[data-theme="dark"] .pane-tests-progress {
      --nq-window-edge:#a08a58;
      --nq-window-edge-active:#a08a58;
    }
    html[data-theme="dark"] .pane-tests-completed {
      --nq-window-edge:#779c84;
      --nq-window-edge-active:#779c84;
    }
    :is(
      .nq-interactive-window,
      .card:not(.card .card),
      .pane-grid > .card,
      .card.pane-card,
      .card:has(> .pane-head),
      dialog,
      .file-menu-pop
    ):not(.exam-workspace-shell) {
      border-left:3px solid var(--nq-window-edge)!important;
      transition:border-left-color .15s ease;
    }
    :is(
      .nq-interactive-window,
      .card:not(.card .card),
      .pane-grid > .card,
      .card.pane-card,
      .card:has(> .pane-head),
      dialog,
      .file-menu-pop
    ):not(.exam-workspace-shell):not(.pane-tests-progress):not(.pane-tests-completed):is(:hover,:focus-within) {
      border-left-color:var(--nq-window-edge-active)!important;
    }
  