/* Shared interaction tokens and role-specific layouts. Teacher desktop density is retained. */
:root{--action-bg:#24766b;--action-text:#fff;--touch-nav-height:4.5rem;--focus-color:#087f81}
:root[data-theme="dark"]{--action-bg:#83caba;--action-text:#112522;--focus-color:#b9efda}
html .btn.teal,html .portal-home .portal-action,:root[data-theme="dark"] .portal-home .portal-action{background:var(--action-bg);color:var(--action-text)}
:where(a,button,select,input,textarea,summary):focus-visible{outline:3px solid var(--focus-color);outline-offset:3px}
h1[tabindex="-1"]:focus{outline:none}
html{scroll-padding-bottom:calc(var(--touch-nav-height) + 24px)}
.student-shell :is(a,button,input,select,textarea,summary){scroll-margin-block:90px}
.student-touch-nav,.submission-dock{display:none}
.student-shell,.student-home{overflow-wrap:anywhere}
.student-home .portal-grid>*,.student-home .portal-notice>span:not(.portal-number),.student-shell .page-heading>*,.student-shell .result-top>*,.student-shell .submission-exam>*{min-width:0}
.student-shell .exam-row .badge{white-space:normal;max-width:100%}
.student-shell .result-summary{flex-wrap:wrap}
.student-shell .theme-picker select,.student-home .theme-picker select{min-height:44px}
.student-more-links{display:grid;gap:16px}.student-more-links>a{display:flex;align-items:center;gap:18px;color:var(--ink)}.student-more-links span{flex:1}.student-more-links strong,.student-more-links small{display:block}.student-more-links small{font-size:.875rem;color:var(--muted);margin-top:5px}
/* A compact filter keeps the same controls available without a large decorative header. */
.student-filter-card{padding:14px 16px;margin-bottom:18px}
.student-filter-fields{grid-template-columns:minmax(0,1.5fr) minmax(0,1fr);gap:12px}
.student-filter-fields .type-field{grid-column:auto}
.student-filter-field{gap:4px}.student-filter-field>span{font-size:.8125rem}
.student-filter-field select{font-size:.875rem}
.student-filter-tools{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin-top:8px;min-width:0}
.student-filter-tools>.student-filter-field{display:flex;align-items:center;gap:8px;flex:1 1 10rem;min-width:0}
.student-filter-tools>.student-filter-field>span{flex-shrink:0}.student-filter-tools select{max-width:210px;min-width:5em}
.student-filter-count{white-space:nowrap;color:var(--muted);font-size:.8125rem}
.student-filter-tools .btn{flex-shrink:0;padding-inline:8px;min-height:44px}
.student-filter-note{font-size:.75rem;line-height:1.5;color:var(--muted);margin:7px 0 0}
/* Numbers remain legible; column count changes instead of shrinking type. */
.student-shell .question-grid{grid-template-columns:repeat(auto-fill,minmax(max(2.75rem,calc((100% - 72px)/10)),1fr));gap:8px}
.student-shell .question-grid .qbtn{min-height:64px;min-width:0;padding:6px 0;font-size:1rem;line-height:1.25}
.student-shell .qbtn:focus-visible{outline:3px solid var(--focus-color);outline-offset:4px}
.student-shell .qbtn .status-symbol{font-size:.875rem;line-height:1.2;margin-top:2px}
.student-shell .qbtn .question-rate{font-size:.75rem;font-weight:500;line-height:1.25;white-space:nowrap;margin-top:3px;font-variant-numeric:tabular-nums;letter-spacing:0}
.student-shell .exam-score-summary,.student-home .exam-score-summary,.student-home .portal-result-state{font-size:.75rem}
.student-shell .exam-score-summary.detailed{display:flex;flex-wrap:wrap;gap:10px 24px;font-size:.9375rem}
.exam-score-summary.detailed .exam-score-metric{display:grid;flex:1 1 7rem;gap:3px;min-width:0}
.exam-score-summary.detailed .exam-score-metric+.exam-score-metric{border-left:1px solid var(--line);padding-left:24px}
.exam-score-summary.detailed .exam-score-label{font-size:.875rem;line-height:1.5}
.exam-score-summary.detailed .exam-score-value{font-size:.875rem;line-height:1.25;white-space:nowrap}
.exam-score-summary.detailed .exam-score-value strong{font-size:1.75rem;font-weight:750;font-variant-numeric:tabular-nums;margin-right:3px}
.exam-score-summary.detailed small{flex-basis:100%;line-height:1.5}
.student-home .portal-table td:last-child{white-space:nowrap;min-width:50px}.student-home .portal-table td:last-child a{min-height:44px;min-width:44px;justify-content:flex-end}
.student-home .portal-status{order:0}.student-home .portal-grid>section{order:0}
.student-home .portal-grid{grid-template-columns:minmax(300px,1fr) minmax(0,1.6fr)}
.student-home .portal-stats{padding:12px 0}.student-home .portal-notice{padding:13px 0}
.student-home .portal-tile{min-height:134px;padding:18px}.student-home .portal-tile-icon{margin-bottom:10px}
.student-home .portal-menu summary,.student-home .portal-all{min-height:44px;display:inline-flex;align-items:center}
@media(min-width:1440px) and (pointer:fine){.student-shell .question-grid{grid-template-columns:repeat(auto-fill,minmax(max(2.75rem,calc((100% - 152px)/20)),1fr))}}
/* Touch layouts cover portrait and landscape tablets as well as phones. */
@media(max-width:1199px),(pointer:coarse){
 .student-shell{display:block}.student-shell>.sidebar{display:none}
 .student-shell .topbar{flex-wrap:wrap;height:auto;min-height:66px;padding:12px 22px;border-bottom:1px solid var(--line);background:var(--paper);gap:12px}
 .student-shell .topbar>.brand{display:flex;color:var(--ink)}
 .student-shell .page-location .breadcrumb{display:none}.student-shell .page-location{margin-right:auto}
 .student-shell .topbar .nav-back span{display:none}.student-shell .topbar .nav-back{padding:8px;min-width:44px;min-height:44px}
 .student-shell .content{max-width:1200px;margin:auto;padding:26px 24px calc(var(--touch-nav-height) + env(safe-area-inset-bottom) + 32px)}
 .student-home .portal-header{flex-wrap:wrap}.student-home .portal-content{padding-bottom:calc(var(--touch-nav-height) + env(safe-area-inset-bottom) + 32px)}
 .student-touch-nav{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));position:fixed;bottom:0;left:0;right:0;z-index:40;min-height:var(--touch-nav-height);background:var(--paper);border-top:1px solid var(--line);padding:6px max(4px,calc((100vw - 700px)/2)) calc(6px + env(safe-area-inset-bottom))}
 .student-touch-nav a{min-width:0;min-height:56px;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:4px;padding:6px 2px;border-radius:8px;color:var(--muted);font-size:.75rem;line-height:1.3;white-space:normal;overflow-wrap:anywhere;text-align:center}
 .student-touch-nav a[aria-current="page"]{background:var(--surface-selected,#e7f2ed);color:var(--teal);font-weight:700}.student-touch-nav .icon{width:22px;height:22px}
 .submission-dock{display:flex;position:fixed;bottom:0;left:0;right:0;z-index:45;align-items:center;justify-content:center;gap:14px;padding:12px 22px calc(12px + env(safe-area-inset-bottom));background:var(--paper);border-top:1px solid var(--line);min-height:80px}
 .submission-dock .dock-back{min-height:44px;min-width:44px;display:flex;align-items:center;gap:4px;color:var(--muted);font-size:.875rem}
 .dock-progress{min-width:90px}.dock-progress strong,.dock-progress small{display:block}.dock-progress strong{font-size:1rem}.dock-progress small{font-size:.75rem;color:var(--muted)}
 .submission-dock .btn{min-height:48px}.answer-entry .content{padding-bottom:calc(110px + env(safe-area-inset-bottom))}
 .answer-entry .submission-summary{position:static}.answer-entry .submission-summary>[data-action="submit-review"]{display:none}
 .student-shell .answer-option span{min-height:48px}.student-shell .clear-answer{min-height:44px;min-width:44px}
 .student-shell .submission-layout{grid-template-columns:minmax(0,1fr)}
 .student-shell .detail-grid{grid-template-columns:1fr}.student-shell .summary-count{display:block}
 .student-home .portal-grid{grid-template-columns:1fr}.student-home .portal-status{padding:20px}
 .student-home .portal-status .portal-empty{padding:10px 0}.student-home .portal-heading{margin-bottom:18px}
 .student-home .portal-tiles{grid-template-columns:repeat(3,minmax(0,1fr))}.student-home .portal-tile{min-height:120px}
 .student-preview-banner{position:static}.student-preview-banner small{font-size:.8125rem}
}
@media(min-width:1000px){.student-shell .detail-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:700px){
 .student-shell .result-top{grid-template-columns:minmax(0,1fr);padding:16px;gap:10px;margin-bottom:14px}
 .student-shell .result-top h1{font-size:1.25rem;line-height:1.35;margin:4px 0 6px}
 .student-shell .result-top .eyebrow{font-size:.75rem;line-height:1.5}
 .student-shell .result-top p{font-size:.8125rem;line-height:1.5}
 .student-shell .result-summary{padding-top:8px;gap:12px}
 .student-shell .big-score{font-size:2.25rem;line-height:1.2}
 .student-shell .big-score small{font-size:.875rem}
 .student-shell .summary-count label{font-size:.75rem;line-height:1.5}
 .student-shell .summary-count strong{font-size:1.125rem;line-height:1.4}
 .student-shell .exam-score-summary.detailed{padding:14px 16px;gap:8px 16px;margin-bottom:18px}
 .exam-score-summary.detailed .exam-score-metric+.exam-score-metric{padding-left:16px}
 .exam-score-summary.detailed .exam-score-label{font-size:.8125rem}
 .exam-score-summary.detailed .exam-score-value strong{font-size:1.625rem}
}
@media(max-width:599px){
 .student-shell .topbar{padding:10px 14px;gap:6px}.student-shell .topbar .brand{font-size:1.25rem;gap:6px}.student-shell .topbar .mark{width:30px;height:30px}
 .student-shell .content{padding:20px 18px calc(var(--touch-nav-height) + env(safe-area-inset-bottom) + 28px)}
 .student-shell .page-heading{margin-bottom:16px}.student-shell .page-heading p{font-size:.875rem}
 .student-filter-card{padding:12px;margin-bottom:16px}.student-filter-fields{gap:10px}.student-filter-field>span{font-size:.75rem}
 .student-filter-field select{padding-left:9px;font-size:.8125rem;min-height:44px}
 .student-filter-tools{gap:6px;margin-top:7px}.student-filter-tools>.student-filter-field{gap:6px}.student-filter-tools>.student-filter-field>span{font-size:.75rem}.student-filter-count{font-size:.75rem}.student-filter-tools .btn{font-size:.75rem;padding-inline:4px}
 .student-shell .welcome-grid{gap:10px;margin-bottom:20px}.student-shell .metric{padding:16px}.student-shell .metric label,.student-shell .metric p{font-size:.8125rem}.student-shell .metric strong{font-size:1.8rem}
 .student-shell .question-board{padding:16px}.student-shell .question-grid{grid-template-columns:repeat(auto-fill,minmax(max(2.75rem,calc((100% - 24px)/5)),1fr));gap:6px}
 .student-shell .answer-sheet{padding:14px}.student-shell .answer-input-row{padding:44px 0 12px}.student-shell .answer-input-row legend{top:0;transform:none;line-height:44px;font-size:.9375rem;width:auto}
 .student-shell .answer-options{grid-template-columns:repeat(5,minmax(0,1fr));gap:6px}.student-shell .clear-answer{position:absolute;top:0;right:0;min-width:56px;font-size:.8125rem}
 .submission-dock{gap:8px;padding:10px 14px calc(10px + env(safe-area-inset-bottom))}.submission-dock .dock-back span{display:none}.submission-dock .dock-progress{flex:1;min-width:0}.submission-dock .btn{font-size:.8125rem;padding-inline:12px}
 .student-home .portal-content{padding-top:20px}.student-home .portal-heading{gap:4px}.student-home .portal-heading h1{font-size:1.45rem}.student-home .portal-heading .eyebrow{display:none}
 .student-home .portal-heading p{font-size:.875rem}.student-home .portal-status{padding:16px}.student-home .portal-status .portal-notice{padding:10px 0}.student-home .portal-stats{padding:10px 0}.student-home .portal-stats strong{font-size:1.35rem}
 .student-home .portal-action{margin-top:4px}.student-home .portal-tiles{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.student-home .portal-tile{min-height:114px;padding:14px}.student-home .portal-tile small{font-size:.75rem}
 .student-home .portal-recent{margin-top:20px}.student-home .portal-result-state{font-size:.75rem}
}
@media(prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
@media print{.student-touch-nav,.submission-dock{display:none!important}}

.student-home .portal-menu nav>a{display:flex;align-items:center;min-height:44px;min-width:44px}
@media(max-width:700px){
 .teacher-shell .topbar{height:auto;min-height:62px;flex-wrap:wrap;padding-block:8px;gap:8px}
 .teacher-shell .topbar .header-actions{margin-left:auto;flex-wrap:wrap;max-width:100%}
}

/* Teacher item analysis can grow independently of the page width. */
.item-analysis{resize:vertical;height:340px;min-height:180px;max-height:none;overflow:auto}

/* Home shortcuts precede the status panel in reading and keyboard order. */
.student-home .portal-grid{grid-template-columns:minmax(0,1.2fr) minmax(300px,1fr)}
.portal-home .portal-tile{min-height:112px}
.portal-home .portal-heading{margin-bottom:20px}
.portal-home .portal-extra a{display:inline-flex;align-items:center;min-height:44px}
@media(max-width:1199px),(pointer:coarse){.student-home .portal-grid{grid-template-columns:1fr}}
@media(max-width:700px){
 .portal-home .portal-tile{min-height:100px;padding:14px}
 .portal-home .portal-tile-icon{width:34px;height:34px;margin-bottom:8px}
 .portal-home .portal-grid{gap:16px}
 .portal-home .portal-extra{gap:4px 18px;margin-top:10px}
 .teacher-shell .page-heading{margin-bottom:18px}
 .item-heading>.field{min-width:0}
 .item-heading .row{gap:8px}
 .score-lookup-tabs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
 .score-lookup-tabs .btn{padding-inline:8px}
}

.exam-hub-tabs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;border-bottom:1px solid var(--line);margin-bottom:20px}
.exam-hub-tabs a{display:flex;align-items:center;justify-content:center;min-height:48px;padding:12px 8px;border-bottom:3px solid transparent;color:var(--muted);font-weight:600}
.exam-hub-tabs a[aria-current]{border-color:var(--teal);color:var(--teal)}
.exam-hub-type{display:flex;align-items:center;gap:16px;margin-bottom:18px}
.exam-hub-type>span{white-space:nowrap;font-size:.875rem;color:var(--muted)}
.exam-hub-type select{flex:1;min-width:0}
@media(max-width:599px){.student-home .portal-tiles{grid-template-columns:repeat(2,minmax(0,1fr))}.student-home .portal-tile:last-child:nth-child(3){grid-column:1/-1;min-height:76px;flex-direction:row;align-items:center;gap:12px}.student-home .portal-tile:last-child:nth-child(3) .portal-tile-icon{margin-bottom:0}}

.history-exam-link{white-space:normal;text-align:left;text-decoration:underline;text-underline-offset:3px;min-height:44px}
#history-answer-dialog{width:min(680px,calc(100vw - 24px));max-height:85dvh;padding:24px;border:1px solid var(--line);border-radius:18px;background:var(--paper);color:var(--ink)}
#history-answer-dialog::backdrop{background:#07142699}
#history-answer-dialog h2{font-size:1.2rem;margin:0}
.history-answer-meta{margin:12px 0 20px;color:var(--muted);font-size:.875rem}
#history-answer-dialog .issue-box{max-height:60dvh;overflow:auto}
#history-answer-dialog table{width:100%;min-width:0}
#history-answer-dialog th,#history-answer-dialog td{white-space:nowrap;text-align:center;padding:12px 8px}
#history-answer-dialog thead th{position:sticky;top:0;background:var(--paper);z-index:1}
#history-answer-dialog .history-answer-wrong td:nth-child(4){color:var(--red);font-weight:700}
@media(max-width:480px){#history-answer-dialog{padding:16px}#history-answer-dialog th,#history-answer-dialog td{padding:12px 5px;font-size:.8125rem}}

.submission-type-options{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:16px}
.submission-type-button{min-height:44px;padding:10px 14px;border:1px solid var(--line);border-radius:12px;background:var(--paper);color:var(--muted);font:inherit;font-size:.875rem;cursor:pointer}
.submission-type-button[aria-pressed="true"]{background:var(--teal);border-color:var(--teal);color:#fff;font-weight:700}
html[data-theme="dark"] .submission-type-button[aria-pressed="true"]{color:#112522}
.submission-type-button:focus-visible{outline:2px solid var(--teal);outline-offset:3px}
@media(max-width:700px){.submission-type-filter{padding:14px}.submission-type-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}.submission-type-button{text-align:left;font-size:.8125rem;padding:10px 12px;overflow-wrap:anywhere}.submission-type-filter .student-filter-tools{gap:8px;flex-wrap:wrap}}
