.timed-quiz-page .lesson { max-width: 1120px; }
.timed-quiz-wrap { max-width: 1120px; padding-top: 0; padding-bottom: 20px; flex: 1; }
.timed-quiz-heading { margin-bottom: 34px; }
.timed-quiz-heading h1 { font-size: clamp(35px, 5vw, 60px); letter-spacing: -.055em; margin: 12px 0; line-height: 1.08; }
.timed-quiz-heading > p:last-child { color: light-dark(#526773,#afc2cd); margin-bottom: 0; }
.timed-quiz-setup { display: grid; grid-template-columns: 1.35fr 1fr; gap: 24px; align-items: start; }
.timed-quiz-card { border: 1px solid var(--line); border-radius: 18px; background: light-dark(#fff,#172630); padding: 28px; }
.timed-quiz-card h2 { font-size: 15px; color: light-dark(#6e837c,#afc2cd); display: flex; gap: 14px; margin: 0 0 26px; }
.timed-quiz-card h2 span { color: var(--ink); font-size: 22px; font-weight: 800; letter-spacing: -.025em; }
.timed-quiz-card-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.timed-quiz-wrap label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.timed-quiz-wrap input, .timed-quiz-wrap textarea, .timed-quiz-wrap select { font: inherit; border: 1px solid light-dark(#bccbc7,#49616b); border-radius: 9px; background: light-dark(#fff,#172630); color: var(--ink); }
.timed-quiz-wrap textarea { width: 100%; min-height: 300px; padding: 16px; line-height: 1.8; resize: vertical; }
.timed-quiz-wrap textarea::placeholder { color: light-dark(#788583,#aabdc6); }
.timed-quiz-wrap input { display: block; width: 100%; padding: 10px 14px; font-size: 22px; font-weight: 600; }
.timed-quiz-wrap select { max-width: 100%; display: block; padding: 8px 10px; font-size: 12px; margin-top: 8px; }
.timed-quiz-help { color: light-dark(#526773,#afc2cd); font-size: 12px; line-height: 1.6; }
.timed-quiz-settings .timed-quiz-help { margin: 8px 0 20px; }
.timed-quiz-list-footer { display: flex; justify-content: space-between; align-items: start; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.timed-quiz-list-footer > p { max-width: 190px; }
.timed-quiz-preset-info { background: light-dark(#edf7f1,#1c3536); border: 1px solid light-dark(#cee4d8,#365854); border-radius: 10px; padding: 16px; margin-bottom: 22px; }
.timed-quiz-preset-info > strong { font-size: 13px; color: light-dark(#205e47,#9cdec1); }
.timed-quiz-preset-info p { margin: 8px 0 12px; }
.timed-quiz-custom-list { border-top: 1px solid var(--line); padding-top: 16px; }
.timed-quiz-custom-list summary { cursor: pointer; color: light-dark(#176c62,#8ddbd1); font-size: 13px; font-weight: 700; }
.timed-quiz-custom-list[open] summary { margin-bottom: 16px; }
.timed-quiz-custom-list input[type="file"] { font-size: 12px; font-weight: 400; padding: 10px; }
.timed-quiz-custom-list input::file-selector-button { margin-right: 8px; padding: 6px; border: 1px solid light-dark(#b9cdc6,#49616b); border-radius: 5px; background: light-dark(#edf7f1,#1c3536); color: light-dark(#214149,#dfe9ef); }
.timed-quiz-local-note { border-top: 1px solid var(--line); padding-top: 18px; margin: 12px 0 0; }
.timed-quiz-badge { display: inline-block; border-radius: 6px; background: light-dark(#edf3f0,#213b3c); color: light-dark(#43685d,#a8d2c5); padding: 5px 9px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.timed-quiz-presets { display: flex; gap: 8px; margin-top: 10px; }
.timed-quiz-presets button { border: 1px solid var(--line); background: light-dark(#f4f7f5,#22383e); color: light-dark(#34554c,#bdd9ce); padding: 5px 16px; border-radius: 6px; font-size: 12px; cursor: pointer; }
.timed-quiz-page button:disabled { opacity: .45; cursor: not-allowed; }
.timed-quiz-budget { background: light-dark(#edf7f1,#1c3536); border: 1px solid light-dark(#cee4d8,#365854); border-radius: 12px; padding: 18px 22px; margin: 24px 0 20px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 16px; }
.timed-quiz-budget > span, .timed-quiz-timer > span, .timed-quiz-grade > span { font-size: 10px; font-weight: 700; letter-spacing: .12em; }
.timed-quiz-budget strong { font: 600 34px/1.1 'DM Sans', sans-serif; letter-spacing: -.04em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.timed-quiz-budget small { color: light-dark(#4f7468,#a8d2c5); font-size: 12px; grid-column: 1 / -1; }
.timed-quiz-button { display: inline-flex; align-items: center; justify-content: center; gap: 20px; border: 1px solid transparent; border-radius: 10px; padding: 13px 20px; font-size: 13px; font-weight: 700; cursor: pointer; }
.timed-quiz-primary { background: #123c42; color: #fff; }
.timed-quiz-primary:hover { background: #1b5360; }
.timed-quiz-secondary { background: light-dark(#fff,#172630); color: light-dark(#214149,#dfe9ef); border-color: light-dark(#b9cdc6,#49616b); }
.timed-quiz-secondary:hover { background: light-dark(#eaf4ef,#25434a); }
.timed-quiz-settings .timed-quiz-button { width: 100%; justify-content: space-between; }
.timed-quiz-how { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin: 28px 4px 0; font-size: 12px; color: light-dark(#526773,#afc2cd); }
.timed-quiz-how p { margin: 0; }
.timed-quiz-how strong { color: var(--ink); }
.timed-quiz-how span { display: inline-block; margin-top: 10px; }
.timed-quiz-page kbd { font: 600 12px 'DM Sans', sans-serif; display: inline-block; border: 1px solid light-dark(#a9bfb6,#49616b); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; background: light-dark(#ffffff80,#ffffff14); color: light-dark(#264b40,#c1ded2); }
.timed-quiz-error, .timed-quiz-notice { padding: 12px 16px; border: 1px solid light-dark(#e7cfab,#6f5a39); background: light-dark(#fff5e7,#392f23); color: light-dark(#754620,#f0cf9a); border-radius: 10px; font-size: 13px; }
.timed-quiz-error { background: light-dark(#fff1ef,#3b282d); color: light-dark(#992f2f,#ffb9af); border-color: light-dark(#e8bab3,#784a47); }
.timed-quiz-session-top { display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.timed-quiz-session-top h2 { font-size: clamp(23px, 3vw, 31px); letter-spacing: -.04em; margin: 8px 0; }
#progress-label { color: light-dark(#526773,#afc2cd); font-size: 13px; margin: 0; }
.timed-quiz-timer { background: #123c42; color: #d7f6e9; border-radius: 14px; padding: 16px 24px; display: grid; text-align: center; min-width: 180px; }
.timed-quiz-timer strong { font: 600 44px/1.3 'DM Sans', sans-serif; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.timed-quiz-timer small { font-size: 11px; color: #cee1dd; }
.timed-quiz-time-low { background: #8e3227; color: #fff5ec; }
.timed-quiz-time-low small { color: #ffe0d9; }
#session-progress { display: block; appearance: none; border: 0; border-radius: 99px; width: 100%; height: 6px; background: #dce7e0; color: #247968; margin: 24px 0; overflow: hidden; }
#session-progress::-webkit-progress-bar { background: #dce7e0; }
#session-progress::-webkit-progress-value { background: #247968; border-radius: 99px; }
#session-progress::-moz-progress-bar { background: #247968; }
.timed-quiz-prompt-card { position: relative; overflow: hidden; min-height: 330px; display: flex; flex-direction: column; justify-content: space-between; padding: 24px 32px; background: light-dark(#fff,#172630); border: 1px solid light-dark(#cddfd5,#365854); border-radius: 18px; }
.timed-quiz-prompt-meta { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: center; gap: 10px; min-height: 28px; }
#item-position { font-size: 11px; letter-spacing: .1em; color: light-dark(#526f65,#afc2cd); font-weight: 700; }
#current-term { margin: 28px 0; text-align: center; font-size: clamp(28px, 4vw, 48px); letter-spacing: -.035em; line-height: 1.22; overflow-wrap: anywhere; }
.timed-quiz-term-ghost { position: absolute; pointer-events: none; margin: 0; text-align: center; font-size: clamp(28px, 4vw, 48px); letter-spacing: -.035em; line-height: 1.22; overflow-wrap: anywhere; z-index: 2; }
.timed-quiz-next { margin: 6px 0 18px; }
.timed-quiz-next-caption { display: block; text-align: center; font-size: 9px; letter-spacing: .14em; color: light-dark(#526773,#afc2cd); margin-bottom: 8px; }
#next-items { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 0; margin: 0; list-style: none; }
#next-items li { padding: 10px; border: 1px solid light-dark(#e1e9e4,#344b59); border-radius: 9px; background: light-dark(#f7faf8,#1e3039); text-align: center; min-width: 0; }
.timed-quiz-next-number { display: block; font-size: 9px; color: light-dark(#526773,#afc2cd); margin-bottom: 5px; }
.timed-quiz-next-label { display: block; font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; color: light-dark(#405a4d,#bdd9ce); }
#next-items .timed-quiz-next-skipped { border-color: light-dark(#e4d2af,#6b5836); background: light-dark(#fff8ed,#352f24); }
#next-empty { text-align: center; margin: 0; }
#current-term:focus, #results-title:focus { outline: none; }
#queue-hint { text-align: center; margin: 0; }
.timed-quiz-answer-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 20px; }
.timed-quiz-answer { border: 1px solid light-dark(#c8d9ce,#49616b); border-radius: 12px; padding: 18px; display: grid; justify-items: center; gap: 6px; cursor: pointer; color: var(--ink); }
.timed-quiz-answer:hover { filter: brightness(.96); }
.timed-quiz-answer > span { font-size: 17px; font-weight: 700; }
.timed-quiz-answer kbd { margin-right: 7px; vertical-align: 1px; }
.timed-quiz-answer small { font-size: 11px; }
.timed-quiz-skip, .timed-quiz-skipped, .timed-quiz-status-skipped { background: light-dark(#fff2dc,#3c3121); color: light-dark(#805119,#f0ce94); border-color: light-dark(#e4d2af,#6b5836); }
.timed-quiz-wrong, .timed-quiz-status-wrong { background: light-dark(#fcece8,#3e282c); color: light-dark(#983f31,#ffb9af); border-color: light-dark(#e9c8c0,#784a47); }
.timed-quiz-correct, .timed-quiz-status-correct { background: light-dark(#dcf1e6,#213e34); color: light-dark(#205e47,#9cdec1); border-color: light-dark(#afcfbd,#436b58); }
.timed-quiz-status-pending { background: light-dark(#eaf0f2,#233a44); color: light-dark(#526773,#afc2cd); }
.timed-quiz-session-bottom { display: flex; justify-content: space-between; align-items: start; gap: 24px; margin-top: 24px; }
.timed-quiz-session-bottom p { color: light-dark(#526773,#afc2cd); font-size: 12px; max-width: 540px; }
.timed-quiz-library { margin: 22px 0; }
.timed-quiz-library-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.timed-quiz-library-head h3 { font-size: 16px; margin: 0; }
.timed-quiz-library-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.timed-quiz-library-actions .timed-quiz-presets { margin-top: 0; }
.timed-quiz-library-actions .timed-quiz-presets button { padding: 8px 10px; }
.timed-quiz-library-actions .timed-quiz-button { padding: 8px 10px; font-size: 12px; }
#selection-count { font-size: 12px; color: light-dark(#205e47,#9cdec1); }
.timed-quiz-library .timed-quiz-presets [aria-pressed="true"] { background: #254c38; color: white; }
.timed-quiz-pool-scroll { max-height: 380px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; overscroll-behavior: contain; scrollbar-gutter: stable; }
#pool-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; list-style: none; padding: 8px; margin: 0; }
#pool-list li { display: flex; justify-content: space-between; align-items: start; gap: 8px; padding: 10px; background: light-dark(#f5f7f5,#1e3039); border: 1px solid transparent; border-radius: 6px; font-size: 12px; }
#pool-list .timed-quiz-pool-selected { background: light-dark(#e7f4eb,#213e34); border-color: light-dark(#b8d6c4,#436b58); }
#pool-list .timed-quiz-pool-rest-start { grid-column: 1; }
.timed-quiz-pool-label { overflow-wrap: anywhere; }
.timed-quiz-pool-rank { flex-shrink: 0; font-size: 10px; font-weight: 700; color: light-dark(#205e47,#9cdec1); }
.timed-quiz-text-button { padding: 0; border: 0; background: transparent; color: light-dark(#526773,#afc2cd); text-decoration: underline; text-underline-offset: 4px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.timed-quiz-result-head { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 26px; }
.timed-quiz-result-head h2 { font-size: clamp(28px, 4vw, 40px); letter-spacing: -.04em; margin: 10px 0; }
.timed-quiz-result-head p:last-child { color: light-dark(#526773,#afc2cd); margin: 0; font-size: 13px; }
.timed-quiz-grade { border: 1px solid light-dark(#b6d9c5,#436b58); background: light-dark(#dff2e7,#213e34); color: light-dark(#205e47,#9cdec1); padding: 18px 26px; border-radius: 14px; white-space: nowrap; }
.timed-quiz-grade strong { font: 600 44px/1.2 'DM Sans', sans-serif; letter-spacing: -.05em; }
.timed-quiz-result-counts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.timed-quiz-stat { padding: 18px 22px; border-radius: 12px; display: flex; align-items: baseline; gap: 14px; }
.timed-quiz-stat strong { font: 600 30px 'DM Sans', sans-serif; }
.timed-quiz-stat span { font-size: 12px; }
.timed-quiz-result-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0; }
.timed-quiz-average { margin-top: 22px; }
.timed-quiz-average h3 { font-size: 20px; margin-bottom: 8px; }
.timed-quiz-average textarea { min-height: 90px; }
.timed-quiz-average-result { background: light-dark(#edf7f1,#1c3536); border-radius: 10px; padding: 16px 20px; }
.timed-quiz-average-result > span { font-size: 11px; font-weight: 700; letter-spacing: .1em; }
.timed-quiz-average-result output { display: block; color: light-dark(#205e47,#9cdec1); font: 600 36px/1.4 'DM Sans', sans-serif; }
.timed-quiz-average-result p { margin: 4px 0 0; overflow-wrap: anywhere; }
.timed-quiz-review h3 { margin-bottom: 8px; font-size: 20px; }
#result-list { margin: 20px 0 0; padding-left: 25px; }
#result-list li { padding: 12px 0 12px 6px; border-top: 1px solid var(--line); }
#result-list li::marker { color: light-dark(#748980,#afc2cd); font-size: 12px; }
.timed-quiz-result-term { overflow-wrap: anywhere; }
.timed-quiz-result-badges { display: inline-flex; gap: 8px; flex-wrap: wrap; margin-left: 16px; }
.timed-quiz-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.timed-quiz-running .timed-quiz-heading { margin-bottom: 28px; }
.timed-quiz-running .timed-quiz-heading h1 { font-size: 27px; }
.timed-quiz-running .timed-quiz-heading > p:last-child { display: none; }
@media (max-width: 850px) {
  .timed-quiz-setup { grid-template-columns: 1fr; }
  .timed-quiz-result-counts { grid-template-columns: repeat(2, 1fr); }
  .timed-quiz-card { padding: 22px; }
}
@media (max-width: 600px) {
  #pool-list { grid-template-columns: 1fr; }
  .timed-quiz-pool-scroll { max-height: 320px; }
  #next-items { gap: 5px; }
  #next-items li { padding: 7px 5px; }
  .timed-quiz-next-label { font-size: 10px; }
  .timed-quiz-wrap { padding-top: 28px; padding-bottom: 40px; }
  .timed-quiz-heading { margin-bottom: 24px; }
  .timed-quiz-how { grid-template-columns: 1fr; gap: 18px; }
  .timed-quiz-session-top { align-items: stretch; gap: 12px; }
  .timed-quiz-session-top h2 { font-size: 19px; }
  .timed-quiz-session-top .section-kicker { font-size: 9px; }
  #progress-label { font-size: 11px; }
  .timed-quiz-timer { min-width: 118px; padding: 13px 10px; align-content: center; }
  .timed-quiz-timer strong { font-size: 32px; }
  .timed-quiz-timer small { font-size: 10px; }
  .timed-quiz-prompt-card { padding: 18px; min-height: 240px; }
  .timed-quiz-answer-actions { gap: 8px; }
  .timed-quiz-answer { padding: 14px 4px; }
  .timed-quiz-answer > span { font-size: 14px; }
  .timed-quiz-answer kbd { margin-right: 2px; }
  .timed-quiz-answer small { font-size: 10px; }
  .timed-quiz-session-bottom { flex-direction: column; gap: 0; }
  .timed-quiz-result-head { flex-direction: column; align-items: stretch; gap: 18px; }
  .timed-quiz-grade { display: flex; align-items: center; justify-content: space-between; }
  .timed-quiz-result-actions > .timed-quiz-button { width: 100%; }
  .timed-quiz-card-heading { flex-wrap: wrap; gap: 0; margin-bottom: 18px; }
  .timed-quiz-card-heading h2 { margin-bottom: 10px; }
  .timed-quiz-result-badges { display: flex; margin: 8px 0 0; }
}

/* The shared shell owns navigation; these controls belong only to the standalone tool. */
.timed-quiz-page [hidden] { display: none !important; }
.timed-quiz-wrap { margin: 0 auto; }
.timed-quiz-kicker { color: var(--teal); font-size: 11px; font-weight: 700; letter-spacing: .12em; }
.timed-quiz-wrap :is(input, textarea, select) { font-size: 16px; min-width: 0; }
.timed-quiz-setup > * { min-width: 0; }
.timed-quiz-presets { flex-wrap: wrap; }
.timed-quiz-presets button, .timed-quiz-custom-list summary, .timed-quiz-text-button { min-height: 44px; }
.timed-quiz-button { min-height: 48px; }
.timed-quiz-badge { white-space: normal; }
.timed-quiz-dialog { width: min(520px, calc(100vw - 32px)); max-height: 85vh; overflow: auto; border: 1px solid var(--line); border-radius: 16px; padding: 24px; background: var(--paper); color: var(--ink); }
.timed-quiz-dialog::backdrop { background: #071b2a99; backdrop-filter: blur(4px); }
.timed-quiz-wrap :is(input, textarea, select):focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
@media (max-width: 600px) {
  .timed-quiz-session-top { position: sticky; top: 64px; z-index: 5; background: var(--bg); padding: 10px 0; }
  .timed-quiz-card { padding: 18px; }
  .timed-quiz-stat { padding: 14px; gap: 8px; }
}

@media (max-width: 600px) {
  .timed-quiz-page .topbar .crumb > span, .timed-quiz-page .top-account-link { display: none; }
  .timed-quiz-page .crumb-current { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
}

/* Compact shell and a session that uses the available viewport height. */
.timed-quiz-page .topbar { height: 44px; min-height: 44px; padding: 3px 16px; }
.timed-quiz-page .topbar :is(.theme-control, .menu-toggle) { min-height: 34px; height: 34px; padding-top: 4px; padding-bottom: 4px; }
.timed-quiz-page .top-account-link { display: none; }
.timed-quiz-heading { margin-bottom: 20px; }
.timed-quiz-heading h1 { font: 700 clamp(24px, 3vw, 32px)/1.2 'DM Sans', sans-serif; margin: 0; }
.timed-quiz-setup-toggles { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.timed-quiz-wrap .timed-quiz-bone-toggle { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; cursor: pointer; min-height: 36px; }
.timed-quiz-wrap .timed-quiz-bone-toggle input { appearance: auto; width: 17px; height: 17px; margin: 0; padding: 0; flex: 0 0 auto; accent-color: var(--teal); }
.timed-quiz-running .main-wrap { height: calc(100dvh - 44px); padding: 12px 20px max(12px, env(safe-area-inset-bottom)); }
.timed-quiz-running :is(.lesson, .timed-quiz-wrap) { height: 100%; min-height: 0; padding: 0; }
.timed-quiz-running .lesson { margin: 0 auto; }
.timed-quiz-running :is(.timed-quiz-heading, .page-footer) { display: none; }
.timed-quiz-running #storage-status { position: fixed; bottom: 8px; right: 8px; z-index: 40; max-width: min(340px, 90vw); }
.timed-quiz-running #session-panel { height: 100%; display: grid; grid-template-rows: auto 4px minmax(0, 1fr) auto auto; gap: 10px; }
.timed-quiz-running .timed-quiz-session-top { position: static; padding: 0; gap: 12px; align-items: center; background: none; }
.timed-quiz-running .timed-quiz-session-top > div:first-child { min-width: 0; }
.timed-quiz-running #progress-label { font-size: 13px; line-height: 1.35; }
.timed-quiz-running .timed-quiz-timer { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 6px 12px; border-radius: 9px; flex-shrink: 0; }
.timed-quiz-running .timed-quiz-timer > span { font-size: 9px; letter-spacing: .06em; }
.timed-quiz-running .timed-quiz-timer strong { font-size: 30px; line-height: 1; }
.timed-quiz-running #session-progress { height: 4px; margin: 0; }
.timed-quiz-running #session-progress, .timed-quiz-running #session-progress::-webkit-progress-bar { background: var(--line); }
.timed-quiz-running .timed-quiz-prompt-card { min-height: 0; padding: clamp(10px, 2dvh, 20px); display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; gap: 8px; }
.timed-quiz-running .timed-quiz-prompt-meta { min-height: 20px; gap: 6px; }
.timed-quiz-running #current-term { min-height: 0; margin: 0; display: flex; align-items: center; justify-content: center; font: 700 clamp(26px, min(4.5vw, 6.5dvh), 52px)/1.16 'DM Sans', sans-serif; letter-spacing: -.025em; }
.timed-quiz-running .timed-quiz-next { margin: 0; }
.timed-quiz-running .timed-quiz-next-caption { margin-bottom: 5px; }
.timed-quiz-running #next-items li { padding: 8px; }
.timed-quiz-running .timed-quiz-next-label { font-size: 12px; line-height: 1.3; }
.timed-quiz-running .timed-quiz-answer-actions { margin: 0; gap: 10px; }
.timed-quiz-running .timed-quiz-answer { display: flex; align-items: center; justify-content: center; padding: 12px 8px; min-height: 52px; }
.timed-quiz-running .timed-quiz-answer > span { font-size: 17px; }
.timed-quiz-running .timed-quiz-session-bottom { display: flex; flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 0; gap: 4px 12px; }
.timed-quiz-running .timed-quiz-text-button { min-height: 36px; }
@media (max-width: 600px) {
  .timed-quiz-running .main-wrap { padding: 8px 10px max(8px, env(safe-area-inset-bottom)); }
  .timed-quiz-running #session-panel { gap: 8px; }
  .timed-quiz-running #progress-label { font-size: 11px; }
  .timed-quiz-running .timed-quiz-timer { gap: 5px; padding: 6px 8px; }
  .timed-quiz-running .timed-quiz-timer > span { max-width: 38px; font-size: 8px; }
  .timed-quiz-running .timed-quiz-timer strong { font-size: 28px; }
  .timed-quiz-running .timed-quiz-next-label { font-size: 10px; }
  .timed-quiz-running #next-items { gap: 5px; }
  .timed-quiz-running #next-items li { padding: 6px 4px; }
  .timed-quiz-running .timed-quiz-answer-actions { gap: 6px; }
  .timed-quiz-running .timed-quiz-answer { min-height: 48px; padding: 10px 4px; }
  .timed-quiz-running .timed-quiz-answer > span { font-size: 14px; }
  .timed-quiz-running .timed-quiz-session-bottom { gap: 4px 8px; }
  .timed-quiz-running .timed-quiz-bone-toggle { font-size: 12px; gap: 5px; }
}
@media (max-height: 480px) {
  .timed-quiz-running .main-wrap { padding-top: 5px; padding-bottom: 5px; }
  .timed-quiz-running #session-panel { gap: 4px; }
  .timed-quiz-running .timed-quiz-prompt-card { padding: 6px 10px; gap: 3px; }
  .timed-quiz-running #current-term { font-size: clamp(18px, 5.5dvh, 26px); }
  .timed-quiz-running .timed-quiz-prompt-meta { min-height: 14px; }
  .timed-quiz-running #item-position { font-size: 9px; }
  .timed-quiz-running .timed-quiz-badge { font-size: 9px; padding: 2px 5px; }
  .timed-quiz-running .timed-quiz-timer strong { font-size: 24px; }
  .timed-quiz-running .timed-quiz-next-caption { display: none; }
  .timed-quiz-running .timed-quiz-next-number { display: inline; margin-right: 4px; }
  .timed-quiz-running .timed-quiz-next-label { display: inline; font-size: 10px; }
  .timed-quiz-running #next-items li { padding: 4px; }
  .timed-quiz-running .timed-quiz-answer { min-height: 40px; padding: 5px; }
}

.timed-quiz-running .timed-quiz-term-ghost { display: flex; align-items: center; justify-content: center; }

/* Optional image practice uses the same viewport-sized session and result flow. */
#practice-mode { width: 100%; margin-bottom: 14px; }
#image-setup { margin-bottom: 20px; }
.image-practice-sources { margin: 10px 0; font-size: 12px; }
.image-practice-sources summary { cursor: pointer; padding: 8px 0; font-weight: 600; }
#image-sources, #unavailable-terms { max-height: 260px; overflow: auto; margin: 8px 0; padding: 0; }
#unavailable-terms { padding-left: 20px; line-height: 1.6; }
.timed-quiz-wrap .image-source { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 12px; font-weight: 400; }
.timed-quiz-wrap .image-source input { width: 18px; height: 18px; padding: 0; flex-shrink: 0; accent-color: var(--teal); }
.image-source img { width: 35px; height: 42px; object-fit: contain; background: white; border-radius: 4px; }
.image-source-actions { display: flex; gap: 8px; }
.image-source-actions button { font: inherit; min-height: 36px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--ink); cursor: pointer; }
#pool-list .timed-quiz-pool-unavailable { opacity: .65; }
#pool-list .timed-quiz-pool-unavailable .timed-quiz-pool-rank { font-weight: 400; color: var(--muted); max-width: 65px; }
#timer-settings { margin-top: 10px; }
#timer-enabled { margin-bottom: 0; }
.image-practice-running .timed-quiz-prompt-card { grid-template-rows: auto auto minmax(0, 1fr) auto; gap: 6px; padding: 10px; }
.image-practice-running #current-term { font-size: clamp(20px, 2.8vw, 30px); line-height: 1.12; max-height: 66px; overflow: auto; padding: 2px 0; }
.image-practice-workspace { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(195px, 25%); gap: 12px; }
.image-practice-plate { display: grid; grid-template-rows: auto auto minmax(0,1fr) auto; min-width: 0; min-height: 0; gap: 5px; }
.image-practice-toolbar { display: flex; align-items: center; gap: 6px; min-width: 0; }
.image-practice-toolbar #image-view { margin: 0; flex: 1; min-width: 0; font-size: 12px; height: 38px; padding: 5px 8px; }
.image-practice-toolbar button, .image-practice-input button, .image-practice-numbers button, #image-retry, .image-browser-heading button { min-height: 36px; border: 1px solid var(--line); border-radius: 7px; background: light-dark(#f2f7f4,#22383e); color: var(--ink); cursor: pointer; font: 600 12px 'DM Sans',sans-serif; padding: 5px 9px; }
.image-practice-frame { position: relative; min-height: 0; min-width: 0; overflow: auto; background: #fff; color: #214149; border-radius: 8px; border: 1px solid var(--line); overscroll-behavior: contain; display: flex; align-items: center; justify-content: center; }
.image-practice-frame > img { display: block; width: 100%; height: 100%; object-fit: contain; }
.image-practice-frame > p { padding: 20px; text-align: center; max-width: 380px; font-size: 13px; }
.image-practice-frame.image-practice-zoomed { display: block; }
.image-practice-frame.image-practice-zoomed > img { width: 200%; height: auto; max-width: none; max-height: none; object-fit: contain; }
#image-retry { margin: 12px; }
#image-view-note { margin: 0; font-size: 10px; line-height: 1.25; }
.image-practice-answer { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow: auto; }
.image-practice-answer label { font-size: 12px; margin-bottom: 5px; }
.image-practice-input { display: flex; gap: 6px; }
.image-practice-input input { width: 100%; min-width: 0; padding: 6px 9px; font-size: 17px; }
.image-practice-numbers { display: grid; grid-template-columns: repeat(auto-fill,minmax(35px,1fr)); gap: 4px; overflow: auto; min-height: 0; align-content: start; }
.image-practice-numbers button { min-height: 34px; padding: 4px; font-variant-numeric: tabular-nums; }
.image-practice-numbers .image-number-correct { background: #d7f3e4; color: #145638; border-color: #63ad83; opacity: 1; }
.image-practice-numbers .image-number-wrong { background: #fce2de; color: #9c3023; border-color: #d38174; opacity: 1; }
.image-practice-feedback { padding: 10px; border: 1px solid; border-radius: 8px; font-size: 12px; overflow: auto; flex-shrink: 0; max-height: 55%; }
.image-practice-feedback p { margin: 6px 0; line-height: 1.35; }
#image-corrections { display: grid; gap: 4px; }
#image-corrections button { color: inherit; text-align: left; background: transparent; border: 0; text-decoration: underline; cursor: pointer; padding: 4px 0; font: inherit; }
.image-practice-actions { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.image-practice-actions #image-skip { min-height: 44px; padding: 7px 18px; }
.image-practice-actions p { flex: 1; font-size: 12px; color: var(--muted); margin: 0; }
.image-practice-actions #image-continue { min-height: 44px; padding: 8px 18px; }
.image-practice-running #next-items li { padding: 4px 6px; }
.image-practice-running .timed-quiz-next-caption { display: none; }
.image-practice-running .timed-quiz-next-label { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 10px; }
.image-practice-running .timed-quiz-next-number { margin-bottom: 2px; font-size: 8px; }
.image-practice-browser { width: min(900px, calc(100vw - 24px)); }
.image-browser-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.image-browser-heading h2 { font-size: 20px; }
#image-browser-plates { display: grid; grid-template-columns: repeat(auto-fill,minmax(145px,1fr)); gap: 10px; }
#image-browser-plates button { display: grid; gap: 8px; background: var(--paper); border: 1px solid var(--line); padding: 10px; border-radius: 9px; color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
#image-browser-plates img { height: 100px; width: 100%; object-fit: contain; background: white; border-radius: 5px; }
#image-browser-plates span { font-size: 12px; }
@media (max-width: 650px) {
  .image-practice-running .timed-quiz-prompt-card { padding: 7px; gap: 4px; }
  .image-practice-workspace { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(0,1fr) auto; gap: 6px; }
  .image-practice-answer { display: grid; grid-template-columns: minmax(0,1fr); gap: 5px; max-height: 155px; }
  .image-practice-answer form { display: flex; align-items: center; gap: 8px; }
  .image-practice-answer label { margin: 0; width: 100px; flex-shrink: 0; font-size: 11px; }
  .image-practice-input { flex: 1; min-width: 0; }
  .image-practice-numbers { max-height: 76px; grid-template-columns: repeat(auto-fill,minmax(32px,1fr)); }
  .image-practice-feedback { max-height: 90px; padding: 6px 8px; font-size: 11px; }
  .image-practice-workspace:has(#image-feedback:not([hidden])) :is(#image-answer-form,#image-numbers) { display: none; }
  .image-practice-toolbar #image-view { font-size: 11px; }
  .image-practice-toolbar button { font-size: 10px; padding: 4px 6px; }
  .image-practice-actions { gap: 8px; }
  .image-practice-actions #image-skip { padding: 6px 10px; }
  .image-practice-actions p { font-size: 10px; }
  .image-practice-running #current-term { max-height: 60px; }
}
@media (max-height: 520px) and (min-width: 651px) {
  .image-practice-running .timed-quiz-prompt-meta { display: none; }
  .image-practice-running .timed-quiz-prompt-card { grid-template-columns: minmax(0,45%) minmax(0,55%); grid-template-rows: auto minmax(0,1fr); }
  .image-practice-running #current-term { grid-area: 1 / 1; font-size: 20px; }
  .image-practice-running .timed-quiz-next { grid-area: 1 / 2; }
  .image-practice-running .image-practice-workspace { grid-area: 2 / 1 / 3 / 3; }
  .image-practice-running .timed-quiz-next-label { -webkit-line-clamp: 1; }
  .image-practice-running .image-practice-actions { min-height: 36px; }
}

/* Compact setup controls keep both choices and quick counts on one phone row. */
.timed-quiz-preset-row { display: flex; align-items: center; gap: 8px; }
.timed-quiz-preset-row select { flex: 1; min-width: 0; margin: 0; }
.timed-quiz-download { display: inline-flex; align-items: center; justify-content: center; width: 40px; min-height: 40px; flex-shrink: 0; border: 1px solid var(--line); border-radius: 8px; font-size: 22px; color: var(--ink); text-decoration: none; }
.timed-quiz-field-label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.timed-quiz-mode-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-bottom: 16px; }
.timed-quiz-mode-options button { min-width: 0; min-height: 66px; padding: 10px 6px; border: 1px solid var(--line); border-radius: 9px; background: light-dark(#f4f7f5,#22383e); color: var(--ink); cursor: pointer; font: inherit; }
.timed-quiz-mode-options strong, .timed-quiz-mode-options small { display: block; font-size: 12px; line-height: 1.4; }
.timed-quiz-mode-options small { font-size: 11px; margin-top: 3px; }
.timed-quiz-mode-options [aria-pressed="true"] { background: #254c38; color: white; border-color: #56876b; }
.timed-quiz-mode-options button:focus-visible, .timed-quiz-download:focus-visible { outline: 2px solid #56876b; outline-offset: 3px; }
.timed-quiz-count-row { display: flex; align-items: center; gap: 8px; }
.timed-quiz-count-row #question-count { flex: 1; min-width: 0; width: 80px; padding: 8px; font-size: 18px; }
.timed-quiz-count-row .timed-quiz-presets { margin: 0; gap: 6px; flex-shrink: 0; }
.timed-quiz-count-row .timed-quiz-presets button { padding: 5px 12px; }

/* Larger image practice uses natural page scrolling instead of shrinking the plate. */
.timed-quiz-page.image-practice-running .main-wrap { height: auto; min-height: calc(100dvh - 44px); }
.image-practice-running :is(.lesson,.timed-quiz-wrap,#session-panel) { height: auto; }
.image-practice-running #session-panel { grid-template-rows: auto 4px auto auto; }
.image-practice-running .timed-quiz-prompt-card { display: flex; flex-direction: column; gap: 10px; }
.image-practice-toolbar #image-browse {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  gap: 12px;
  min-width: 0;
  min-height: 50px;
  padding: 10px 14px;
  text-align: left;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}
#image-browse::after {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-top: 2px solid currentColor;
  transform: rotate(45deg);
}
.image-practice-plate:has(#image-placeholder:not([hidden])) #image-browse {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--paper);
}
.image-practice-running .image-practice-workspace { display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: auto auto; }
.image-practice-running .image-practice-frame { height: clamp(400px,65dvh,850px); }
.image-practice-running .image-practice-answer { display: flex; max-height: none; overflow: visible; }
.image-practice-running .image-practice-numbers { max-height: 110px; }
.image-practice-running .timed-quiz-next { opacity: .7; }
.image-practice-running #next-items { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; }
.image-practice-running #next-items li { border: 0; background: none; padding: 0; }
.image-practice-running .timed-quiz-next-label { font-size: 10px; }
.image-practice-running .image-practice-actions { margin: 0; }
@media (max-width:650px) {
 .image-practice-running .image-practice-frame { height: max(360px,55dvh); }
 .image-practice-running .image-practice-workspace:has(#image-feedback:not([hidden])) :is(#image-answer-form,#image-numbers) { display: none; }
}
