/* Independent display preferences never change exam state. */
.exam-display{position:relative;z-index:35;font-size:14px;color:var(--text)}
.exam-display>summary{list-style:none;display:flex;align-items:center;gap:8px;padding:9px 13px;border:1px solid var(--line);border-radius:9px;background:var(--surface);cursor:pointer;white-space:nowrap;font-weight:600}
.exam-display>summary::-webkit-details-marker{display:none}
.exam-display>summary b{font-size:18px}
.exam-display :is(summary,button,select,input):focus-visible{outline:3px solid var(--accent);outline-offset:3px}
.reader-popover{position:absolute;right:0;top:calc(100% + 10px);width:340px;max-width:calc(100vw - 24px);padding:22px;border:1px solid var(--line);border-radius:16px;background:var(--surface);box-shadow:0 16px 50px #0004;white-space:normal;max-height:calc(100dvh - 160px);overflow:auto}
.reader-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:17px}
.reader-heading button{width:32px;height:32px;border:1px solid var(--line);border-radius:50%;color:var(--text);background:var(--surface-raised);font-size:22px;cursor:pointer}
.reader-popover p{font-size:13px;line-height:1.6;margin:8px 0 20px;color:var(--secondary)}
.reader-size-label{display:flex;justify-content:space-between;align-items:center;gap:12px}
.reader-size-label output{font-variant-numeric:tabular-nums;font-size:13px;padding:3px 8px;border-radius:5px;background:var(--surface-raised)}
.reader-popover input[type=range]{display:block;width:100%;min-height:32px;margin:8px 0 16px;padding:0;accent-color:var(--accent)}
.reader-fields{display:grid;grid-template-columns:90px minmax(0,1fr);gap:12px;align-items:center}
.reader-fields select{width:100%;min-height:40px;padding:7px 8px;font:inherit;font-size:13px;color:var(--text);background:var(--surface);border:1px solid var(--line);border-radius:7px}
.reader-popover small{display:block;font-size:12px;line-height:1.7;color:var(--secondary);margin:18px 0 12px}
.reader-reset{width:100%;padding:10px;border:1px solid var(--line);border-radius:8px;background:var(--surface-raised);color:var(--text);font:inherit;cursor:pointer}
.reader-enabled{--reader-bg:#fff;--reader-fg:#202520;--reader-blue:#17467d;--reader-green:#205234;--reader-amber:#704315;--reader-line:#b7bdb7;--reader-selected:#e8eee8;--reader-family:Arial,'Noto Sans',sans-serif;--reader-ink:var(--reader-fg)}
html[data-theme=dark] .reader-enabled{--reader-bg:#000;--reader-fg:#f5f5f5;--reader-blue:#b5d5ff;--reader-green:#b6e7be;--reader-amber:#f5d49b;--reader-line:#666;--reader-selected:#242424}
html .reader-enabled[data-reader-background=black]{--reader-bg:#000;--reader-fg:#f5f5f5;--reader-blue:#b5d5ff;--reader-green:#b6e7be;--reader-amber:#f5d49b;--reader-line:#666;--reader-selected:#242424}
html .reader-enabled:is([data-reader-background=white],[data-reader-background=cream]){--reader-bg:#fff;--reader-fg:#202520;--reader-blue:#17467d;--reader-green:#205234;--reader-amber:#704315;--reader-line:#b7bdb7;--reader-selected:#e8eee8}
html .reader-enabled[data-reader-background=cream]{--reader-bg:#f7efdC;--reader-selected:#e8dec5}
.reader-enabled[data-reader-ink=blue]{--reader-ink:var(--reader-blue)}
.reader-enabled[data-reader-ink=green]{--reader-ink:var(--reader-green)}
.reader-enabled[data-reader-ink=amber]{--reader-ink:var(--reader-amber)}
.reader-enabled[data-reader-font=serif]{--reader-family:Georgia,'Times New Roman',serif}
html .reader-enabled :is(.exam-panels,.subjective-layout){--text:var(--reader-ink);--secondary:var(--reader-ink);--surface:var(--reader-bg);--surface-raised:var(--reader-selected);--page:var(--reader-bg);--line:var(--reader-line);min-width:0;background:var(--reader-bg)!important;color:var(--reader-ink)!important}
html .reader-enabled :is(.passage-panel,.question-panel,.task-prompt,.response-panel,.answer-option,.answer-input,#essay-answer,.task-table table){background:var(--reader-bg)!important;color:var(--reader-ink)!important;border-color:var(--reader-line)}
html .reader-enabled :is(.passage-paragraph,.task-instructions,.question-panel legend,.answer-option,.answer-input,#essay-answer,.task-table table,.knowledge-panel>p,.listening-panel>p,.response-panel>p,.transcript){font-family:var(--reader-family);font-size:var(--reader-size)!important;line-height:1.85;color:var(--reader-ink)!important;overflow-wrap:anywhere}
html .reader-enabled :is(.question-instruction,.passage-instruction,.tfng-help,.practice-guidance,.gap-label){font-size:max(14px,calc(var(--reader-size) - 3px));line-height:1.7;color:var(--reader-ink)!important}
html .reader-enabled :is(.passage-panel h1,.task-prompt h1,.response-panel>h2){color:var(--reader-ink)!important;font-family:var(--reader-family);font-size:calc(var(--reader-size) + 10px);overflow-wrap:anywhere}
html .reader-enabled .answer-option:is(.chosen,:hover){background:var(--reader-selected)!important}
html .reader-enabled :is(.tfng-help,.task-table thead){background:var(--reader-selected)!important;color:var(--reader-ink)!important}
html .reader-enabled .tfng-help b{color:inherit}
html .reader-enabled .answer-option.chosen{border:2px solid var(--reader-ink)}
html .reader-enabled :is(.answer-input,#essay-answer)::placeholder{color:var(--reader-ink);opacity:.7}
.reader-enabled .exam-panels>*,.reader-enabled .subjective-layout>*{min-width:0}
.reader-enabled[data-reader-layout=wide] :is(.exam-panels,.subjective-layout){grid-template-columns:minmax(0,3fr) minmax(0,2fr)}
.reader-enabled[data-reader-layout=stacked] .exam-panels{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) minmax(0,1fr)}
.reader-enabled[data-reader-layout=stacked] .exam-panels>.passage-panel{border-right:0;border-bottom:2px solid var(--reader-line)}
.reader-enabled[data-reader-layout=stacked] .subjective-layout{grid-template-columns:minmax(0,1fr);width:100%}
.reader-enabled[data-reader-layout=stacked] .task-prompt{border-right:0;border-bottom:1px solid var(--reader-line)}
@media(max-width:760px){
  .reader-enabled .exam-subbar{flex-wrap:wrap;gap:8px;padding:10px 14px}
  .reader-enabled .exam-subbar>span{max-width:100%;flex:1 1 180px}
  .reader-enabled .exam-subbar>div{margin-left:auto;align-items:center}
  .reader-popover{position:fixed;top:110px;right:12px;max-height:calc(100dvh - 140px)}
  .reader-enabled :is(.exam-panels,.subjective-layout){display:block!important}
  .reader-enabled .exam-panels>.passage-panel{height:38dvh;min-height:230px;overflow:auto;border-right:0;border-bottom:2px solid var(--reader-line)}
  .reader-enabled .question-panel{overflow:visible}
  .reader-enabled{height:auto;min-height:100dvh}
}

/* Keep the exam utility bar compact and tied to the site theme. */
html .reader-enabled .exam-subbar{min-height:44px;flex-shrink:0;flex-wrap:nowrap;padding:6px 20px;gap:12px;background:var(--surface);color:var(--text);border-bottom:1px solid var(--line);font-size:14px;line-height:1.4}
html .reader-enabled .exam-subbar>span{display:block;flex:1 1 0;min-width:0;max-width:none;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color:var(--secondary);line-height:1.4}
html .reader-enabled .exam-subbar>span>.icon{margin-right:6px}
html .reader-enabled .exam-subbar>div{display:flex;flex:0 0 auto;align-items:center;gap:8px;margin-left:auto}
html .reader-enabled .exam-display>summary,html .reader-enabled .exam-subbar [data-action=exit]{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:32px;padding:4px 10px;border:1px solid var(--line);border-radius:6px;background:var(--surface);color:var(--text);font-size:14px;font-weight:600;line-height:22px;white-space:nowrap}
html .reader-enabled .exam-display>summary b{font-size:16px;line-height:22px}
html .reader-enabled .exam-display>summary:hover,html .reader-enabled .exam-subbar [data-action=exit]:hover{background:var(--surface-raised);color:var(--text)}
html .reader-enabled .exam-display>summary:focus-visible,html .reader-enabled .exam-subbar [data-action=exit]:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
html .reader-enabled .exam-subbar [data-action=exit]:disabled{opacity:1;color:var(--secondary)}
@media(max-width:760px){
 html .reader-enabled .exam-subbar{padding:6px 12px;gap:8px}
 html .reader-enabled .exam-display>summary,html .reader-enabled .exam-subbar [data-action=exit]{padding:4px 8px}
}
