/* কাগজে পরীক্ষা · OMR (বেটা): the website's OMR screens (omr.js). Palette tokens and .tone-* from app.css; both themes.
   The printed sheet and its previews stay white paper in dark mode too. */

.omr { display: block; }
.omr > * + * { margin-top: 14px; }
.omr > .ui-head + * { margin-top: 0; }
.omr > section > .ui-section:first-child { margin-top: 22px; }
.omr-card { padding: 16px; }
.omr-calm { padding: 8px 16px; }
.omr-note { color: var(--muted); font-size: 12.5px; line-height: 19px; margin: 8px 0 0; }
.omr-note.bad { color: var(--bad-ink, var(--bad)); font-weight: 600; }
.omr-link {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 4px; border: 0; background: none;
  color: var(--brand); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.omr-link:hover { text-decoration: underline; }
.omr-link[hidden] { display: none; }
.omr-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
.omr-actions.center { justify-content: center; }
.omr-actions.two > .btn { flex: 1 1 140px; }
.omr-dl { display: contents; }
.omr-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* the hero: what it is (landing), or the clock (an attempt on paper) */
.omr-hero .ui-hero-side { align-self: stretch; }
.omr-hero .omr-thumb { width: 92px; box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .6); }
.omr-clock .ui-hero-title { font-size: 40px; line-height: 48px; font-variant-numeric: tabular-nums; letter-spacing: .5px; }
.omr-clock-label { color: var(--hero-muted); font-size: 12.5px; line-height: 18px; margin-bottom: -8px; }
.omr-hero-side { display: flex; align-self: flex-start; }
@media (max-width: 400px) { .omr-landing .omr-hero .ui-hero-side { display: none; } }

/* the sheet as paper: a white page with a soft edge, in both themes */
.omr-thumb {
  display: block; flex: none; width: 96px; aspect-ratio: 210 / 297; overflow: hidden; border-radius: 6px; background: #fff;
  border: 1px solid var(--border); box-shadow: var(--shadow-sm, var(--shadow));
}
.omr-thumb-img { display: block; width: 100%; height: 100%; object-fit: cover; }
a.omr-thumb:hover { text-decoration: none; transform: translateY(-1px); }
.omr-paperbox { background: #fff; border-radius: 12px; border: 1px solid var(--border); padding: 10px; box-shadow: var(--shadow); }
.omr-svg { display: block; width: 100%; height: auto; }

/* the three numbered steps */
.omr-steps { display: grid; gap: 14px; }
.omr-step-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.omr-step-no {
  flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand); color: var(--on-brand); font-size: 15px; font-weight: 700;
}
.omr-step-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.omr-step-text strong { font-size: 15.5px; line-height: 23px; }
.omr-step-text span { color: var(--muted); font-size: 12.5px; line-height: 19px; }
.omr-step-ico { color: var(--muted); flex: none; padding-top: 4px; }
.omr-sheetrow { display: flex; gap: 14px; align-items: flex-start; }
.omr-sheetrow-text { flex: 1; min-width: 0; }
.omr-sheetrow-text p { margin: 0; font-size: 13.5px; line-height: 21px; color: var(--text-2); }
.omr-sheetrow .omr-actions { margin-top: 10px; }
.omr-own { margin-top: 6px; padding: 12px; border-radius: 14px; background: var(--surface-2); font-size: 13px; line-height: 20px; color: var(--text-2); }
.omr-own p { margin: 0; }
.omr-ranges { display: grid; gap: 4px; margin-top: 10px; }
.omr-range { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.omr-range b { color: var(--text); font-weight: 600; white-space: nowrap; }

/* step ৩: uploading, failures, tips, the proof note */
.omr-shot > * + * { margin-top: 10px; }
.omr-progress { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 14px; background: var(--gst-soft); }
.omr-progress strong { font-size: 13.5px; }
.omr-bar { height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.omr-bar-in { display: block; height: 100%; border-radius: 4px; background: var(--gst); transition: width .4s ease; width: 30%; }
.omr-bar-in.w20 { width: 20%; } .omr-bar-in.w40 { width: 40%; } .omr-bar-in.w55 { width: 55%; } .omr-bar-in.w85 { width: 85%; }
.omr-fail {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 14px; background: var(--tone-soft);
  border: 1px solid color-mix(in srgb, var(--tone) 35%, transparent); font-size: 13px; line-height: 20px; color: var(--text-2);
}
.omr-fail .ui-ico { flex: none; width: 34px; height: 34px; border-radius: 10px; color: var(--tone); background: var(--surface); display: grid; place-items: center; }
.omr-fail > div { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; min-width: 0; }
.omr-fail strong { color: var(--text); font-size: 14px; }
.omr-fail .btn { margin-top: 4px; }
.omr-again { border: 1px solid var(--border); border-radius: 14px; }
.omr-tips { display: flex; gap: 14px; align-items: center; margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--tone-soft); color: var(--tone); }
.omr-tips strong { display: block; color: var(--text); font-size: 13.5px; margin-bottom: 4px; }
.omr-tips ul { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 12.5px; line-height: 20px; }
.omr-tipart { flex: none; }
.omr-proof { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; padding: 12px; border-radius: 14px; background: var(--surface-2); }
.omr-proof .ui-ico { flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: var(--muted); background: var(--surface); }
.omr-proof-text { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; font-size: 12.5px; line-height: 19px; color: var(--text-2); }
.omr-proof-text strong { color: var(--text); font-size: 13px; }
.omr-proof-until { color: var(--muted); }
.omr-proofimg img { display: block; width: 100%; max-height: 70vh; object-fit: contain; border-radius: 10px; background: #fff; border: 1px solid var(--border); }

/* the explainer, the landing's steps */
.omr-explain-list, .omr-how { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.omr-explain-list li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 22px; }
.omr-explain-ico, .omr-how-ico { flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--gst-soft); color: var(--gst); }
.omr-how li { display: flex; gap: 10px; align-items: center; }
.omr-how-no { flex: none; width: 22px; color: var(--muted); font-weight: 700; text-align: center; }
.omr-how-text { font-size: 14px; line-height: 21px; }
.omr-start-how p { margin: 0 0 4px; font-size: 14px; line-height: 22px; }
.omr-start-how .btn { margin-top: 12px; }

/* the bank hub's door: an odd fifth way, so a full-width row at every width (icon · text · beta) */
.bk-way.omr-way { grid-column: 1 / -1; min-height: 0; flex-direction: row; align-items: center; gap: 12px; }
.bk-way.omr-way .bk-way-top { display: contents; }
.bk-way.omr-way .bk-way-top > .ui-ico { order: 0; flex: none; }
.bk-way.omr-way .bk-way-text { order: 1; flex: 1; min-width: 0; }
.bk-way.omr-way .bk-way-top > :not(.ui-ico) { order: 2; flex: none; }

/* the pre-start sheet's switch */
.omr-ps { margin-top: 18px; }
.omr-ps .ui-section { margin-bottom: 8px; }
.omr-armed { display: flex; align-items: center; gap: 6px; margin: 8px 2px 0; color: var(--gst); font-size: 12.5px; font-weight: 600; }
.omr-armed[hidden] { display: none; }

/* #/omr/sheet */
.omr-sheetlayout { display: grid; gap: 16px; }
.omr-sheet-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.omr-sheet-facts > div { display: flex; flex-direction: column; padding: 10px; border-radius: 12px; background: var(--surface-2); }
.omr-sheet-facts strong { font-size: 17px; line-height: 24px; }
.omr-sheet-facts span { color: var(--muted); font-size: 12px; }
.omr-rules { margin: 14px 0 0; padding-left: 18px; display: grid; gap: 6px; font-size: 13.5px; line-height: 21px; color: var(--text-2); }
@media (min-width: 1024px) {
  .omr-sheetlayout { grid-template-columns: 360px minmax(0, 1fr); align-items: start; }
  .omr-sheetside { position: sticky; top: 20px; }
  .omr-sheetview { max-width: 640px; }
}

/* #/omr/<attempt>/check: the numbers, the reader's notes */
.omr-checkhead > * + * { margin-top: 12px; }
.omr-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.omr-chips .push { margin-left: auto; }
.omr-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.omr-stats .skeleton { height: 72px; }
.omr-stat { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: var(--radius); background: var(--tone-soft); min-width: 0; }
.omr-stat strong { display: flex; align-items: center; gap: 6px; color: var(--tone); font-size: 24px; line-height: 30px; font-weight: 800; }
.omr-stat span { color: var(--text-2); font-size: 12px; line-height: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.omr-msg { display: flex; gap: 8px; align-items: flex-start; padding: 12px; border-radius: 14px; background: var(--brand-soft); color: var(--text-2); font-size: 13px; line-height: 20px; }
.omr-msg .icon { flex: none; color: var(--brand); margin-top: 2px; }
.omr-tip { display: flex; gap: 6px; align-items: flex-start; padding: 0 2px; color: var(--text-2); font-size: 12.5px; line-height: 19px; }
.omr-tip .icon { flex: none; color: var(--warn); margin-top: 2px; }

/* a row as on the sheet: number, bubbles, its state */
.omr-row {
  position: relative; display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 5px 8px; border-radius: 12px;
  break-inside: avoid; transition: background .15s, box-shadow .15s;
}
.omr-n { flex: none; width: 30px; text-align: right; color: var(--text-2); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.omr-bs { display: flex; flex-wrap: wrap; gap: 6px; }
.omr-cols .omr-bs { flex-wrap: nowrap; }
.omr-b {
  display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 50%;
  border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--text-2);
  font: inherit; font-size: 14px; font-weight: 600; line-height: 1; cursor: pointer; transition: background .12s, border-color .12s, transform .1s;
}
.omr-b:hover:not(:disabled) { border-color: var(--brand); }
.omr-b:active:not(:disabled) { transform: scale(.94); }
.omr-b:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.omr-b.on { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.omr-b.was { border-style: dashed; border-color: var(--warn); color: var(--warn-ink, var(--text)); }
.omr-b.extra { border-style: dotted; }
.omr-b:disabled { cursor: default; opacity: .75; }
.omr-b.mini { width: 22px; height: 22px; font-size: 11.5px; border-width: 1.5px; cursor: default; }
.omr-flag { display: inline-flex; align-items: center; gap: 4px; min-width: 0; margin-left: auto; padding-left: 4px; color: var(--muted); font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.omr-row.unsure { background: var(--warn-soft); box-shadow: inset 3px 0 0 var(--warn); }
.omr-row.unsure .omr-flag { color: var(--warn-ink, var(--warn)); }
.omr-row.changed { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.omr-row.changed .omr-flag { color: var(--brand); }
.omr-row.confirmed .omr-flag { color: var(--good-ink, var(--good)); }
.omr-row.locked { opacity: .8; }
.omr-row.locked .omr-b.on { background: var(--surface-3, var(--surface-2)); border-color: var(--border-strong); color: var(--text); }
.omr-row.flash { animation: omr-flash 1.2s ease; }
@keyframes omr-flash { 0%, 60% { box-shadow: 0 0 0 3px var(--warn); } 100% { box-shadow: inset 3px 0 0 var(--warn); } }

/* unsure rows: bigger, each with its "ঠিক আছে" */
.omr-unsure { display: grid; gap: 8px; }
.omr-row.big { flex-wrap: wrap; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--border)); }
.omr-row.big.confirmed { background: var(--surface); border-color: color-mix(in srgb, var(--good) 45%, var(--border)); box-shadow: inset 3px 0 0 var(--good); }
.omr-row.big.changed { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); }
.omr-row.big .omr-b { width: 42px; height: 42px; font-size: 16px; }
.omr-row.big .omr-n { font-size: 15px; }
.omr-ok { flex: none; }
.omr-okdone { display: inline-flex; align-items: center; gap: 4px; color: var(--good-ink, var(--good)); font-size: 12.5px; font-weight: 700; }

/* every row, flowing down the columns like the paper */
.omr-group .ui-section-sub { max-width: 640px; }
.omr-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 4px 0 12px; color: var(--muted); font-size: 12px; }
.omr-legend span { display: inline-flex; align-items: center; gap: 5px; }
.omr-legend i.lg { display: inline-block; width: 14px; height: 14px; border-radius: 4px; }
.omr-legend i.lg.unsure { background: var(--warn-soft); box-shadow: inset 3px 0 0 var(--warn); }
.omr-legend i.lg.changed { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.omr-legend .omr-b.mini { width: 14px; height: 14px; }
.omr-sec { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 8px; }
.omr-sec + .omr-sec { margin-top: 12px; }
.omr-sec-head { display: flex; justify-content: space-between; gap: 10px; padding: 2px 8px 8px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.omr-sec-head strong { font-size: 14px; }
.omr-sec-head span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.omr-cols { columns: 300px auto; column-gap: 18px; }
.omr-cols .omr-row + .omr-row { margin-top: 2px; }

/* the submit bar stays in reach */
.omr-foot { position: sticky; bottom: calc(var(--tabbar-h, 0px) + 10px); z-index: 5; margin-top: 18px; }
.omr-foot-in {
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; border-radius: 20px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--border); box-shadow: var(--shadow-lg, var(--shadow));
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.omr-foot-note { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 0; color: var(--muted); font-size: 12.5px; line-height: 18px; }
.omr-foot-note.warn { color: var(--warn-ink, var(--warn)); font-weight: 600; }
.omr-foot-note .omr-link { min-height: 28px; font-size: 12.5px; }
.omr-submit { flex: none; }
@media (max-width: 560px) {
  .omr-foot-in { flex-direction: column; align-items: stretch; padding: 10px; gap: 8px; }
  .omr-foot-note { justify-content: center; text-align: center; }
  .omr-submit { width: 100%; }
}
.omr-check .omr-proof { margin-top: 18px; }
/* Piku stands above the submit bar, not on its button (as room.css does for its docked bars) */
body.student:has(.omr-foot) .pk { bottom: calc(var(--tabbar-h, 0px) + 96px); }
@media (max-width: 560px) { body.student:has(.omr-foot) .pk { bottom: calc(var(--tabbar-h, 0px) + 132px); } }

/* #/omr/<attempt>/paper: the questions, read-only */
.omr-qs { display: grid; gap: 12px; }
.omr-qsec { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 14px 2px 0; font-size: 16px; }
.omr-qsec small { color: var(--muted); font-size: 12px; font-weight: 500; }
.omr-q { padding: 16px; }
.omr-q-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.omr-q-no { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 6px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); font-weight: 800; }
.omr-q-opts { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.omr-q-opts li { display: flex; gap: 10px; align-items: flex-start; }
.omr-q-opts li .omr-b { flex: none; margin-top: 1px; }
.omr-q-opts li.mine .omr-b { background: var(--surface-3, var(--surface-2)); color: var(--text); }
.omr-q-opts li.extra .omr-b { border-style: dotted; }
.omr-q-opt { min-width: 0; flex: 1; }
@media (min-width: 1024px) { .omr-q-opts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* print: only the sheet, on its own A4 page at 100% (other prints keep their margins) */
.omr-print-only { display: none; }
@page omrsheet { size: A4 portrait; margin: 0; }
@media print {
  body.omr-printing { background: #fff !important; }
  body.omr-printing > :not(.omr-print-only) { display: none !important; }
  body.omr-printing > .omr-print-only { display: block !important; page: omrsheet; margin: 0; padding: 0; break-after: avoid; }
  body.omr-printing > .omr-print-only .omr-svg { display: block; width: 100%; max-width: 210mm; height: auto; max-height: 296mm; margin: 0 auto; }
}

/* English "Done? Take a photo and hand it in" is longer than the Bangla: on a narrow phone it may take two lines */
html[lang="en"] .omr-paper > .btn.wide { white-space: normal; text-align: center; line-height: 20px; padding-top: 8px; padding-bottom: 8px; }

@media (prefers-reduced-motion: reduce) {
  .omr-b, .omr-row, .omr-bar-in, a.omr-thumb { transition: none; }
  .omr-row.flash { animation: none; }
}

/* on a phone (CLEANUI): body type at least 15 px, labels at least 12 px */
.omr-note { font-size: 15px; line-height: 22px; }
.omr-how-text, .omr-rules { font-size: 15px; line-height: 22px; }
.omr-sheet-facts span { font-size: 13px; }
.omr-start-how p { font-size: 15px; line-height: 23px; }
