/* The WKWebView extends behind iOS system bars (viewport-fit=cover). */
:root{--spn-safe-top:env(safe-area-inset-top,0px);--spn-safe-bottom:env(safe-area-inset-bottom,0px);--spn-safe-left:env(safe-area-inset-left,0px);--spn-safe-right:env(safe-area-inset-right,0px)}
.layout{padding-top:var(--spn-safe-top)}
.workspace{padding-left:var(--spn-safe-left);padding-right:var(--spn-safe-right)}
.account-page{padding-top:calc(24px + var(--spn-safe-top));padding-bottom:calc(24px + var(--spn-safe-bottom));padding-left:max(16px,var(--spn-safe-left));padding-right:max(16px,var(--spn-safe-right))}
.skip:focus{top:calc(10px + var(--spn-safe-top))}
.plan-demo-entry{display:flex;justify-content:flex-end;gap:8px;flex-wrap:wrap}
@media(min-width:681px){
 .sidebar{padding-top:calc(32px + var(--spn-safe-top))}
 /* Tablet app chrome uses viewport space too; keep exam actions above it. */
 .test-runner{height:calc(100dvh - 118px - var(--spn-safe-top) - var(--spn-safe-bottom))}
}
@media(max-width:900px){
 dialog{max-height:calc(100dvh - var(--spn-safe-top) - var(--spn-safe-bottom) - 24px);margin-top:calc(var(--spn-safe-top) + 12px);margin-bottom:calc(var(--spn-safe-bottom) + 12px)}
 .topbar{flex-wrap:nowrap}.topbar .breadcrumb{min-width:0}.topbar .compact-logout{flex-shrink:0;min-height:44px}
}
@media(max-width:680px){
 .sidebar{height:calc(70px + var(--spn-safe-bottom));padding-bottom:calc(10px + var(--spn-safe-bottom));padding-left:max(12px,var(--spn-safe-left));padding-right:max(12px,var(--spn-safe-right))}
 .main{padding-bottom:calc(104px + var(--spn-safe-bottom))}
 .main:has(.test-runner){padding-bottom:calc(82px + var(--spn-safe-bottom))}
 .test-runner{height:calc(100dvh - 155px - var(--spn-safe-top) - var(--spn-safe-bottom))}
 #toast{bottom:calc(83px + var(--spn-safe-bottom))}
}

/* Focused study navigation: secondary controls appear on demand. */
.test-tabs{gap:2px;margin-bottom:18px}.test-tabs button{padding:10px 12px}
.main:has(#custom-test-form){padding-bottom:180px}.test-config .test-quantity{gap:8px;margin-top:16px}.compact-custom{width:auto;justify-content:flex-start}.compact-custom .button{min-height:44px}.compact-custom input{font-size:16px}
.test-config .test-step+.test-step{margin-top:18px;padding-top:18px}.test-topics-heading{margin-bottom:12px}
.test-launch{position:fixed;left:234px;right:0;bottom:0;z-index:6;padding:12px max(24px,env(safe-area-inset-right));background:#fff;border-top:1px solid var(--border);box-shadow:0 -4px 18px #1734510a}
.test-launch-row{display:flex;align-items:flex-end;justify-content:space-between;gap:12px;max-width:900px;margin:auto}.test-launch .form-error{max-width:900px;margin:0 auto 8px}.test-quota{display:block;max-width:900px;margin:5px auto 0;color:var(--muted);font-size:11px}
.test-time-settings summary{cursor:pointer;min-height:44px;display:flex;align-items:center;gap:6px;font-size:14px}.test-time-settings .test-time-row{flex-wrap:wrap;margin:0;padding:8px 0 0;border:0}.test-time-settings .test-time-row>label{display:none}.test-time-settings{max-width:60%}.test-time-settings[open]{padding-bottom:6px}.test-time-settings .custom-time{margin:0}.test-launch-row>button{flex-shrink:0;min-height:46px}.test-history{margin-top:0}.test-history-row>span{min-width:0;overflow-wrap:anywhere}
.library-settings{margin-top:16px}.settings-actions{display:grid;gap:12px}.card-options{position:relative}.card-options summary{cursor:pointer;min-height:44px;display:flex;align-items:center;font-size:12px;color:var(--blue);padding:8px}.card-options[open]>.button{position:absolute;right:0;top:100%;white-space:nowrap;background:#fff;border:1px solid var(--border);z-index:3;box-shadow:0 5px 15px #17345115}.study-source{display:block;font-size:12px;color:var(--muted)}.study-source[hidden]{display:none}.study-source summary{cursor:pointer;padding:12px 0;min-height:44px}.study-source>span{display:block}.study-source a{display:inline-block;padding:8px 0}
.module-card{min-height:190px}.module-symbol{margin-bottom:18px}
@media(min-width:901px) and (max-width:1150px){.test-launch{left:204px}}
@media(min-width:681px) and (max-width:900px){.test-launch{left:82px}}
@media(max-width:680px){.test-launch{left:0;bottom:calc(70px + var(--spn-safe-bottom));padding:10px max(16px,var(--spn-safe-right))}.main:has(#custom-test-form){padding-bottom:calc(230px + var(--spn-safe-bottom))}.test-launch-row{gap:8px}.test-launch-row>button{font-size:14px;padding-inline:14px}.test-time-settings{max-width:48%}.test-time-settings .test-time-row select{width:100%;font-size:16px}.test-tabs button{flex:1;padding:10px 6px;font-size:14px;white-space:nowrap}.test-config .quantity-presets{gap:6px}.test-config.panel{padding:18px 14px}.module-card{min-height:96px;padding:18px;gap:16px}.module-symbol{margin:0}.module-copy strong{font-size:20px}.campus-welcome{margin:8px 0 18px}.test-history-row{flex-wrap:wrap}.library-settings .button{min-height:44px}}
@media(max-width:680px){.test-config .quantity-presets{flex:0 0 100%}.compact-custom{margin-left:auto}.test-launch .form-error{max-height:70px;overflow-y:auto}}

.main:has(#library-results) .toolbar{gap:12px}.main:has(#library-results) .search-wrap{flex:1;min-width:180px}.top-meta>[data-action="account-tools"]{min-height:44px}.main:has(#library-results) .page-heading{margin-bottom:18px}
/* Compact authoring and test review map */
.editor-settings{margin:0 0 16px;color:#53677e;font-size:14px}.editor-settings>summary{cursor:pointer;min-height:36px;display:flex;align-items:center}.editor-settings[open]>summary{margin-bottom:8px}.editor-settings>label{display:flex;align-items:center;gap:8px;padding:7px 0}.editor-settings input{width:18px;height:18px}.editor-row [hidden]{display:none!important}
.test-answer-foot{display:flex;align-items:center;justify-content:space-between;gap:12px}.risk-toggle.active{background:#fff1b3;color:#684a00;border:1px solid #ddbe49}.review-map{margin:16px 0 24px;grid-template-columns:repeat(auto-fill,minmax(44px,1fr));gap:8px}.review-map button{min-height:44px;border:1px solid #ced8e5;border-radius:10px;color:#19344f;font-weight:700;background:#f6f8fb}.review-map .map-correct{background:#dcf4e6;border-color:#7abd97}.review-map .map-wrong{background:#fbe1e3;border-color:#d18a92}.review-map .map-answered{background:#dfeafa;border-color:#91b1de}.review-map .map-risk{background:#ffedaa;border-color:#c7a735}.review-map .map-risk.map-correct{background:linear-gradient(135deg,#ffedaa 50%,#dcf4e6 50%)}.review-map .map-risk.map-wrong{background:linear-gradient(135deg,#ffedaa 50%,#fbe1e3 50%)}.review-map .map-risk.map-blank{background:linear-gradient(135deg,#ffedaa 50%,#f6f8fb 50%)}.review-map .current{outline:2px solid #214f85;outline-offset:2px}.review-map button:focus-visible{outline:3px solid #214f85;outline-offset:2px}.test-correction{scroll-margin-top:24px}.test-review .section-heading{flex-wrap:wrap;gap:10px}.test-review .section-heading select{min-height:44px;max-width:100%;font-size:16px}
@media(max-width:600px){.test-answer-foot{font-size:12px}.test-answer-foot .risk-toggle{min-height:44px}.review-map{gap:7px}.editor-settings{font-size:14px}}

.review-toolbar{position:sticky;top:0;z-index:4;background:#f5f7fb;padding:12px 0}.review-toolbar h2{flex:1 0 100%;margin:0}.test-correction{scroll-margin-top:126px}
.test-review .review-toolbar{display:grid;grid-template-columns:auto 1fr;gap:8px;align-items:center}.review-toolbar h2{grid-column:1/-1}.review-toolbar select{justify-self:end;width:auto}.review-toolbar>.button{justify-self:start}

/* Protect the correction toolbar from the iOS status bar. */
.review-toolbar{top:var(--spn-safe-top)}.review-toolbar::before{content:"";position:absolute;left:0;right:0;bottom:100%;height:var(--spn-safe-top);background:#f5f7fb;pointer-events:none}.test-correction{scroll-margin-top:calc(126px + var(--spn-safe-top))}
.question-quick-actions{display:flex;gap:8px;flex-shrink:0}.question-quick-actions .question-favorite{width:44px;height:44px;padding:10px;justify-content:center}.question-quick-actions .question-favorite span{display:none}.question-risk.selected{background:#fff1b3;border-color:#ddbe49;color:#684a00}.question-risk.selected .icon{fill:#ffdf77}.test-runner .question-panel h2{font-weight:650}.test-correction .question-stem{font-weight:600}
.discard-editor-dialog{max-width:400px}.discard-editor-dialog .dialog-footer{flex-wrap:wrap}.discard-editor-dialog::backdrop{background:#17345155}
/* Safe-area padding participates in layout: never paint over result buttons. */
.review-toolbar{top:0;padding-top:calc(12px + var(--spn-safe-top))}.review-toolbar::before{display:none}
.question-quick-actions .question-risk{width:auto;gap:6px;padding-inline:10px}.question-quick-actions .question-risk span{display:inline;font-size:12px}.question-risk.selected .icon{fill:none}
.test-result{background:#fff;border:1px solid #dce5ef;border-radius:20px;padding:24px;max-width:650px;margin:12px auto 28px}.test-result h1{font-size:24px;margin:4px 0 22px}.result-highlights{display:flex;justify-content:center;align-items:stretch;gap:22px}.result-highlights>div{flex:1;min-width:0}.result-label{display:block;font-size:12px;color:#596e85}.test-result .test-score{font-size:56px;line-height:1.15;letter-spacing:-1.5px;margin:6px 0 0}.test-result .test-score span{font-size:18px;margin-left:5px}.result-percentile{border-left:1px solid #dce5ef;padding-left:22px}.result-percentile>strong{display:block;font-size:40px;line-height:1.4;color:#214f85}.result-percentile>small{display:block;font-size:11px;color:#596e85;line-height:1.5}.test-result .result-numbers{margin:22px 0;padding:15px 0;border-width:1px 0;border-radius:0}.test-result .result-numbers strong{font-size:24px}.test-result .result-actions{display:grid;grid-template-columns:1fr 1fr;gap:10px;position:relative}.result-actions .button{min-width:0;min-height:48px;line-height:1.4;white-space:normal;overflow:visible}
@media(max-width:400px){.test-result{padding:22px 16px}.result-highlights{gap:12px}.result-percentile{padding-left:12px}.test-result .test-score{font-size:44px}.test-result .test-score span{font-size:15px}.result-percentile>strong{font-size:34px}.result-actions .button{padding-inline:8px;font-size:13px}.question-topline{gap:8px}.question-quick-actions{gap:5px}}
.test-heading-actions{display:flex;align-items:center;gap:8px}.test-heading-actions>.button{flex-shrink:0}.test-focus-button{width:44px;height:44px;padding:10px}.test-footer-tools .button.secondary{padding:8px 12px;min-height:42px}
.layout:has(.test-runner.focus-mode)>.sidebar,.workspace:has(.test-runner.focus-mode)>.topbar,.main:has(.test-runner.focus-mode)>.plan-demo-bar{display:none}.layout:has(.test-runner.focus-mode)>.workspace{margin-left:0}.main:has(.test-runner.focus-mode){padding:12px max(12px,var(--spn-safe-right)) 12px max(12px,var(--spn-safe-left));max-width:none}.test-runner.focus-mode{height:calc(100dvh - var(--spn-safe-top) - var(--spn-safe-bottom) - 24px);max-width:1000px;min-height:260px}.focus-mode .test-run-heading .eyebrow{display:none}.focus-mode .test-run-heading h1{font-size:19px}.focus-mode .test-run-heading h1 span{font-size:16px}.focus-mode .question-panel{margin-top:10px}.focus-mode .test-run-meta{margin-bottom:6px}
@media(max-width:680px){.test-heading-actions{gap:6px}.test-heading-actions>.button:not(.test-focus-button){font-size:11px;padding:9px;min-height:44px}.test-run-heading{gap:8px}.test-run-heading h1{font-size:22px}}

/* Keep navigation visible inside the question, outside its scrolling content. */
.question-toolbar{display:flex;align-items:center;justify-content:flex-end;gap:12px;flex-shrink:0;padding-bottom:10px}.question-navigation{display:flex;justify-content:space-between;gap:8px;flex-shrink:0;padding-top:10px}.question-navigation .question-arrow{width:44px;height:44px;min-height:44px;padding:10px;justify-content:center}.question-arrow:disabled{opacity:.35;cursor:default}.question-topic{margin:0;font-size:10px;line-height:1.6}.test-runner .test-footer-tools{border-top:1px solid var(--border);padding-top:10px;margin-top:8px}
@media(max-width:360px){.question-toolbar{gap:6px}.question-navigation{gap:5px}.question-quick-actions .question-risk{padding-inline:8px}}

/* Avoid accidental double-tap zoom while keeping scrolling and pinch zoom. */
html,body,body *{touch-action:manipulation}

/* Generous targets for pointer and touch navigation. */
.question-navigation .question-arrow{width:96px;height:56px;min-height:56px;border-radius:12px}.question-arrow .icon{width:24px;height:24px}
@media(max-width:680px){.question-navigation .question-arrow{width:84px;height:52px;min-height:52px}}

/* Phones in landscape are wide but very short. Give the active test the full
   viewport so the fixed controls cannot squeeze the question out of view. */
@media(orientation:landscape) and (max-height:500px) and (max-width:1000px){
 .layout:has(.test-runner)>.sidebar,.workspace:has(.test-runner)>.topbar{display:none}
 .layout:has(.test-runner)>.workspace{margin-left:0}
 .main:has(.test-runner){max-width:none;padding:8px max(12px,var(--spn-safe-right)) 8px max(12px,var(--spn-safe-left))}
 .test-runner,.test-runner.focus-mode{height:calc(100dvh - var(--spn-safe-top) - var(--spn-safe-bottom) - 16px);min-height:0;max-width:1000px}
 .test-runner .test-run-heading{margin-bottom:3px}
 .test-runner .test-run-heading .eyebrow{display:none}
 .test-runner .test-run-heading h1,.focus-mode .test-run-heading h1{font-size:18px;margin:0}
 .test-runner .test-run-heading h1 span,.focus-mode .test-run-heading h1 span{font-size:14px}
 .test-runner .test-run-meta{margin-bottom:3px}
 .test-runner .question-panel,.focus-mode .question-panel{margin-top:5px;padding:7px 10px 5px;border-radius:14px}
 .question-toolbar{padding-bottom:4px}
 .test-runner .question-panel h2{margin:6px 0 10px;font-size:17px;line-height:1.35}
 .test-runner .test-options{gap:7px}
 .test-runner .test-option{padding:8px 10px;font-size:14px;line-height:1.35}
 .question-navigation{padding-top:4px}
 .question-navigation .question-arrow{height:44px;min-height:44px}
 .test-runner .test-footer-tools{margin-top:3px;padding-top:3px}
 .test-footer-tools .button.secondary{min-height:40px;padding-block:6px}
}
