.exam-portrait{padding-bottom:calc(72px + env(safe-area-inset-bottom))}
.exam-portrait .exam-header{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr);gap:6px;padding:14px 10px}
.exam-portrait .exam-header>button{justify-self:start}
.exam-portrait .exam-header>strong{text-align:center;white-space:nowrap;font-size:clamp(16px,4.5vw,20px)}
.exam-portrait .exam-header-actions{justify-self:end;gap:6px;white-space:nowrap}
.exam-portrait .exam-header-actions>button{font-size:14px;padding:6px 7px}
.exam-portrait .exam-header-actions>span{font-size:16px}
.exam-page .exam-question h1{margin-top:0}
.exam-question-type{display:inline-block;vertical-align:3px;margin-right:8px;padding:4px 8px;border-radius:6px;background:#21c767;color:#fff;font-size:15px;font-weight:500;line-height:1.5}
.exam-portrait .exam-bottom{bottom:0;padding:8px 12px calc(8px + env(safe-area-inset-bottom));gap:6px}
.exam-portrait .exam-bottom>button{min-height:44px;padding:7px 4px;border-radius:12px;font-size:17px}
.exam-portrait .exam-bottom>.exam-card-button{flex:0 0 auto;font-size:15px;padding:7px 2px}
.exam-answer-count{flex-shrink:0}
.mock-review-page .question-heading,.local-study-page .question-heading{display:block;margin-bottom:20px;font-size:calc(var(--exam-font,22px) + 2px);line-height:1.5}
.mock-review-page .question-heading h1,.local-study-page .question-heading h1{display:inline;margin:0}
.mock-review-page .question-kind,.local-study-page .question-kind{display:inline-block;margin:0 8px 0 0;vertical-align:3px}
.exam-question .question-picture{margin:12px 0;cursor:zoom-in;text-align:center}
.exam-question .question-picture img{display:block;width:auto;max-width:100%;max-height:260px;object-fit:contain;margin:auto;border-radius:8px}
.exam-save-status{margin:4px 12px 80px;padding:10px;background:#fff0e7;color:#a84629;font-size:13px;line-height:1.5}
.exam-save-status[hidden]{display:none}
.exam-save-status button{margin-left:8px;padding:4px 8px;border-radius:6px;background:#fff;color:#a84629}
.exam-landscape .exam-question .question-picture img{max-height:220px}
.exam-mode-sheet{position:relative}
.exam-mode-sheet>h2{display:flex;align-items:center;justify-content:center;min-height:44px;margin:0 0 22px;padding:0 60px;text-align:center;white-space:nowrap}
.exam-mode-sheet>#close{position:absolute;right:18px;top:24px;float:none;padding:10px 12px;font-size:16px}
@media(max-width:350px){.exam-mode-sheet>h2{padding:0 52px;font-size:20px}.exam-mode-sheet>#close{font-size:14px;padding:10px}}
#modal #landscape-exam:disabled,#modal #portrait-exam:disabled{opacity:.5;cursor:default}
.exam-page .exam-options>button.answer-right{background:#e9f9ef;border-color:#42bd79;color:#18774a}
.exam-page .exam-options>button.answer-right>span:first-child{background:#21b868;border-color:#21b868;color:#fff}
.exam-page .exam-options>button.answer-wrong{background:#fff0ee;border-color:#ed9185;color:#b54534}
.exam-page .exam-options>button.answer-wrong>span:first-child{background:#e57060;border-color:#e57060;color:#fff}
.exam-answer-result{margin:14px 0;font-size:16px;font-weight:600}
.exam-answer-result.is-correct{color:#1d9c5b}.exam-answer-result.is-wrong{color:#c45b43}
.exam-inline-explanation{margin:16px 0 12px;padding:18px 16px;border:1px solid #dcecf4;border-radius:16px;background:#f4faff;line-height:1.7;scroll-margin-bottom:80px}
.exam-inline-explanation>strong{display:block;font-size:16px;color:#237d55}
.exam-inline-explanation h2{margin:14px 0 8px;font-size:18px;color:#254a61}
.exam-inline-explanation p{margin:0;font-size:var(--exam-font,22px);white-space:pre-wrap;overflow-wrap:anywhere}
.exam-explanation-toggle{margin-top:14px;padding:8px 12px;border-radius:9px;background:#e2f1fc;color:#2a7fb4;font-size:15px}
.exam-tip-dialog{box-sizing:border-box;width:min(380px,calc(100% - 32px));max-height:75dvh;overflow:auto;margin:auto;padding:22px;border:1px solid #ffffffd9;border-radius:24px;background:rgba(255,255,255,.94);color:#233d4b;box-shadow:0 18px 70px #1d435d30}
.exam-tip-dialog::backdrop{background:rgba(30,56,73,.08)}
.exam-tip-top{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:10px;color:#637e8e;font-size:14px}
.exam-tip-answer{padding-top:4px;color:#237d55;font-size:16px;line-height:1.5;overflow-wrap:anywhere}
.exam-tip-controls{display:flex;align-items:center;gap:6px;white-space:nowrap}
.exam-tip-countdown b{color:#2a7fb4;font-variant-numeric:tabular-nums;font-size:17px}
.exam-tip-top button{display:grid;place-items:center;flex-shrink:0;width:32px;height:32px;padding:0;border-radius:50%;background:#ffffff75;color:#567583;font-size:25px;line-height:1}
.exam-tip-dialog h2{margin:12px 0;font-size:26px;font-weight:700;color:#245477}
/* One typography rule for the same technique in manual, automatic and inline views. */
.study-tip-content,.exam-tip-text,.local-course-content .local-tip,.exam-inline-tip{font-family:inherit;font-size:var(--exam-font,22px);font-weight:700;color:#1d3027;line-height:1.7;white-space:pre-wrap;overflow-wrap:anywhere}
.exam-tip-text{margin:0 0 22px}
.exam-tip-continue{width:100%;min-height:46px;padding:12px;border-radius:13px;background:#279bf0e8;color:#fff;font-size:17px}
@media(prefers-reduced-motion:reduce){.exam-inline-explanation{scroll-behavior:auto}}

/* Landscape exam: a fixed information column, question area and 10 × 10 card. */
body.landscape-exam:has(.exam-reference){overflow:hidden;background:#fff}
body.landscape-exam .shell:has(.exam-reference){width:100vw;max-width:none;min-height:0;height:100dvh;margin:0;padding:0;border-radius:0;box-shadow:none}
body.landscape-exam .shell:has(.exam-reference)>#app{height:100%}
.exam-reference.exam-landscape{display:grid;grid-template-rows:minmax(0,1fr) auto;width:100%;height:100%;min-height:0;padding:0;background:#fff;color:#151515;--reference-blue:#1715cf;--reference-title:clamp(18px,2.2vmax,30px)}
.exam-reference.exam-landscape .exam-workspace{display:grid;grid-template-columns:minmax(105px,15fr) minmax(0,56fr) minmax(185px,29fr);gap:14px;height:100%;min-height:0;padding:12px 14px 10px;align-items:start}
.exam-reference fieldset{min-width:0;margin:0;border:1.5px solid #656565;padding:10px 12px 12px}
.exam-reference legend{padding:0 4px;margin:auto;color:var(--reference-blue);font-size:var(--reference-title);line-height:1.25;font-weight:700;text-align:center}
.exam-reference.exam-landscape .exam-information{display:flex;flex-direction:column;gap:10px;overflow:auto;max-height:100%;min-height:0}
.exam-reference .exam-information fieldset{width:100%;flex-shrink:0;padding:10px 8px}
.exam-reference .exam-information p{font-size:clamp(14px,1.7vmax,22px);line-height:1.6;margin:0;color:#151515;overflow-wrap:anywhere}
.exam-reference .exam-station p{text-align:center;font-size:clamp(18px,2vmax,26px);padding:3px 0}
.exam-reference .exam-clock{display:block;text-align:center;font-size:clamp(23px,2.4vmax,32px);font-weight:400;line-height:1.4;color:#333;font-variant-numeric:tabular-nums}
.exam-reference.exam-landscape .exam-question{height:100%;max-height:100%;min-height:0;overflow:auto;scrollbar-width:thin;padding:0 2px 12px;scrollbar-gutter:stable}
.exam-reference .exam-stem-panel{padding:9px 12px 12px}
.exam-reference.exam-landscape .exam-question h1{font-size:calc(var(--exam-font,22px) + 2px);font-weight:400;line-height:1.5;margin:0;overflow-wrap:anywhere}
.exam-reference.exam-landscape.reading-bold .exam-question h1{font-weight:700}
.exam-reference .exam-question-type{display:none}
.exam-reference .exam-choice-bar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:15px 0 10px;color:var(--reference-blue);font-size:clamp(16px,1.8vmax,23px)}
.exam-reference .exam-quick-options{display:flex;align-items:center;gap:8px;margin-left:auto;color:#151515}
.exam-reference .exam-quick-options button{display:grid;place-items:center;width:34px;height:34px;padding:0;border:1px solid #ccc;border-radius:5px;background:#f8f8f8;font-size:25px;line-height:1;color:#333}
.exam-reference .exam-quick-options button.selected{background:#e3efff;border-color:#2289d3}
.exam-reference .exam-quick-options button.answer-right{background:#e9f9ef;border-color:#42bd79;color:#18774a}
.exam-reference .exam-quick-options button.answer-wrong{background:#fff0ee;border-color:#ed9185;color:#b54534}
.exam-reference #exam-font-settings{display:block;width:100%;min-height:32px;margin-top:8px;padding:5px 7px;background:#f6f6f6;border:1px solid #ddd;border-radius:4px;font-size:15px;color:#555}
.exam-reference.exam-landscape .exam-options{gap:3px}
.exam-reference.exam-landscape .exam-options>button{min-height:36px;padding:5px 0;gap:5px;font-size:var(--exam-font,22px);line-height:1.4;border-radius:4px;color:#151515}
.exam-reference.exam-landscape .exam-options>button>span:first-child{display:block;flex-shrink:0;width:auto;height:auto;min-width:22px;margin:0;border:0;border-radius:0;font-size:inherit;line-height:inherit;color:inherit;background:none}
.exam-reference .exam-options>button>span:first-child::after{content:':' }
.exam-reference .exam-question .question-picture{margin:10px auto 0}
.exam-reference .exam-question .question-picture img{max-height:clamp(100px,14vmax,260px)}
.exam-reference.exam-landscape .exam-card-panel{display:block;align-self:start;min-height:0;max-height:100%;margin:0;padding:0;overflow:auto;border:0;border-radius:0;background:#fff}
.exam-reference .exam-card-panel legend{width:100%;padding:0 0 8px}
.exam-reference #exam-card{padding:0 0 0 5px;background:none;color:#666;font-size:12px;vertical-align:middle;font-weight:400}
.exam-reference .exam-numbers{display:grid;grid-template-columns:repeat(10,minmax(0,1fr));grid-template-rows:repeat(10,minmax(0,1fr));gap:0;aspect-ratio:9/10;width:100%;border:1.5px solid #555}
.exam-reference .exam-numbers button{display:grid;place-items:center;min-width:0;min-height:0;padding:0;background:#fff;color:#151515;border:1px solid #666;border-radius:0;font-size:clamp(12px,1.6vmax,22px);line-height:1}
.exam-reference .exam-numbers button.answered{background:#e5f1ff;color:#245d91}
.exam-reference .exam-numbers button.graded-right{background:#d8f1dd;color:#1b6a2f}
.exam-reference .exam-numbers button.graded-wrong{background:#ffe0d9;color:#a53d28}
.exam-reference .exam-numbers button.current{background:#ccc;color:#111;box-shadow:inset 0 0 0 2px #555}
.exam-reference .exam-legend{display:none}
.exam-reference.exam-landscape .exam-bottom{position:static;left:auto;bottom:auto;transform:none;width:100%;max-width:none;display:flex;align-items:center;justify-content:flex-start;gap:12px;padding:7px 16px;border-top:1px solid var(--reference-blue);background:#fafafa;z-index:10}
.exam-reference .exam-answer-count{font-size:13px;line-height:1.1;min-width:27px;gap:3px}
.exam-reference .exam-current-type{margin-right:auto;color:#e62b17;font-size:clamp(15px,1.8vmax,22px);white-space:nowrap}
.exam-reference .exam-footer-actions{display:flex;gap:10px;flex-shrink:0}
.exam-reference .exam-footer-actions button{min-height:35px;padding:5px 13px;border:1px solid #ccc;border-radius:4px;background:#fafafa;color:#151515;font-size:clamp(16px,1.8vmax,22px);white-space:nowrap}
.exam-reference .exam-footer-actions button:disabled{color:#aaa;cursor:default}
.exam-reference .exam-save-status{position:absolute;bottom:55px;left:16%;right:30%;z-index:15;margin:0;padding:6px 10px}
.exam-reference .exam-answer-result{margin:8px 0;font-size:15px}
.exam-reference .exam-inline-explanation{padding:12px;margin:10px 0}
.exam-reference .exam-inline-explanation p{font-size:var(--exam-font,22px)}
@media(orientation:portrait){
 body.landscape-exam .shell:has(.exam-reference){position:fixed;left:0;top:0;width:100dvh;height:100vw;transform:rotate(90deg) translateY(-100%);transform-origin:top left}
 body.landscape-exam:has(.exam-reference) #modal{position:fixed;left:0;top:0;width:100dvh;height:100vw;transform:rotate(90deg) translateY(-100%);transform-origin:top left;z-index:30}
 body.landscape-exam:has(.exam-reference) #modal:empty{pointer-events:none}
 body.landscape-exam:has(.exam-reference) #modal .shade{position:absolute}
 body.landscape-exam:has(.exam-reference) .exam-tip-dialog,body.landscape-exam:has(.exam-reference) .local-image-dialog{max-width:none;width:min(480px,calc(100dvh - 40px));max-height:calc(100vw - 24px);transform:rotate(90deg)}
}
@media(max-height:430px),(orientation:portrait) and (max-width:430px){
 .exam-reference.exam-landscape .exam-workspace{gap:10px;padding:8px 10px}
 .exam-reference .exam-information fieldset{padding:6px 7px}
 .exam-reference.exam-landscape .exam-information{gap:6px}
 .exam-reference .exam-choice-bar{margin:10px 0 6px;gap:6px}
 .exam-reference .exam-stem-panel{padding:6px 10px 8px}
 .exam-reference .exam-question .question-picture{margin-top:6px;padding:0;background:none}
 .exam-reference .exam-question .question-picture img{max-height:100px}
 .exam-reference .exam-quick-options{gap:5px}
 .exam-reference .exam-footer-actions{gap:8px}
 .exam-reference.exam-landscape .exam-bottom{padding:5px 12px}
 .exam-reference .exam-inline-explanation{padding:9px}
}
