/* دستیار طراحی سوال و آزمون — استایل‌ها (به‌ترتیب آبشاری؛ ترتیب بخش‌ها را تغییر ندهید) */

/* ===== base ===== */
:root {
  --bg: var(--s-bg, #fbfaf7);
  --fg: var(--s-tx, #1d2330);
  --mu: var(--s-mu, #5d6676);
  --ac: var(--s-ink, #0b6e6e);
  --cd: var(--s-cd, #fff);
  --bd: var(--s-bd, #d9d6cc);
  --hl: var(--s-gry, #e3f2f0);
  --ac2: #c2410c;
  --ok: #1a7f37;
  --no: #b3382c;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--s-bg, #12161d);
    --fg: var(--s-tx, #e8eaee);
    --mu: var(--s-mu, #a2a9b6);
    --ac: var(--s-ink, #5fd0c5);
    --cd: var(--s-cd, #1b212b);
    --bd: var(--s-bd, #2d3542);
    --hl: var(--s-gry, #183331);
    --ac2: #ff9a62;
    --ok: #4ade80;
    --no: #ff9186;
  }
}
:root[data-theme="dark"] {
  --bg: var(--s-bg, #12161d);
  --fg: var(--s-tx, #e8eaee);
  --mu: var(--s-mu, #a2a9b6);
  --ac: var(--s-ink, #5fd0c5);
  --cd: var(--s-cd, #1b212b);
  --bd: var(--s-bd, #2d3542);
  --hl: var(--s-gry, #183331);
  --ac2: #ff9a62;
  --ok: #4ade80;
  --no: #ff9186;
}
html,
body {
  height: 100%;
  margin: 0;
}
body {
  background: var(--bg);
  color: var(--fg);
  font-family: Vazirmatn, Tahoma, sans-serif;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
header {
  padding: 8px 12px;
  border-bottom: 1px solid var(--bd);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
}
header b {
  order: 2;
  flex: 1 1 100%;
  min-width: 0;
  font-size: 12px;
  color: var(--mu);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
select,
button,
input,
textarea {
  font: inherit;
  font-size: 14px;
  background: var(--cd);
  color: var(--fg);
  border: 1px solid var(--bd);
  border-radius: 10px;
  padding: 8px 12px;
}
textarea {
  width: 100%;
  min-height: 70px;
  resize: vertical;
}
input[type="number"] {
  text-align: center;
}
button {
  cursor: pointer;
  min-height: 40px;
} /*هدف لمسی حداقل ۴۰ پیکسل*/
button:disabled {
  opacity: 0.45;
  cursor: default;
}
#pg {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 20px;
  font-size: 15px;
  line-height: 1.9;
}
#pg > * {
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
}
footer {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-top: 1px solid var(--bd);
  flex-wrap: wrap;
}
footer button {
  min-height: 44px;
  padding: 9px 14px;
  border-radius: 12px;
  font-size: 13px;
}
footer span {
  font-size: 12px;
  /* color: var(--mu); */
  text-align: center;
}
h3 {
  margin: 0 0 10px;
  color: var(--fg);
  font-size: 16px;
  font-weight: 700;
}
h3::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: var(--ac);
  margin-left: 8px;
  vertical-align: -2px;
}
p {
  margin: 4px 0;
}
details summary {
  color: var(--ac);
  cursor: pointer;
  font-size: 0.9em;
}
mjx-container {
  margin: 2px 0 !important;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}
mjx-container > svg {
  max-width: 100%;
  height: auto;
}
.nav {
  order: 1;
  display: flex;
  gap: 4px;
  background: var(--cd);
  border: 1px solid var(--bd);
  border-radius: 12px;
  padding: 4px;
  max-width: 100%;
  overflow-x: auto;
}
.nv {
  border: none;
  background: transparent;
  padding: 7px 14px;
  border-radius: 9px;
  font-weight: 600;
  color: var(--mu);
  white-space: nowrap;
}
.nv.on {
  background: var(--ac);
  color: var(--bg);
}
/*ناوبری: کنترل قطعه‌ای (segmented) درست زیر نوار سایت — جایگزین دکمه‌های پایین موبایل*/
.navy {
  display: flex;
  gap: 4px;
  background: var(--cd);
  border: 1px solid var(--bd);
  border-radius: 14px;
  padding: 4px;
  margin: 8px auto 0;
  width: fit-content;
  max-width: calc(100% - 16px);
  overflow-x: auto;
  flex: none;
}
.navy .nv {
  border: none;
  background: transparent;
  padding: 8px 16px;
  border-radius: 11px;
  font-weight: 600;
  color: var(--mu);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
}
.navy .nv svg {
  width: 19px;
  height: 19px;
  display: block;
}
.navy .nv.on {
  background: var(--ac);
  color: var(--bg);
  box-shadow: 0 2px 8px rgba(11, 110, 110, 0.3);
}
.navy .nv #cx {
  font-size: 10.5px;
  font-weight: 700;
}
@media (max-width: 560px) {
  .navy {
    margin-top: 6px;
    border-radius: 12px;
  }
  .navy .nv {
    padding: 7px 11px;
    font-size: 12px;
  }
  .navy .nv svg {
    width: 17px;
    height: 17px;
  }
}
@media print {
  .navy {
    display: none !important;
  }
}
/*پاسخ کارت: دکمهٔ روشن کشویی*/
.ansD summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  background: var(--hl);
  color: var(--ac);
  border: 1.5px solid var(--bd);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
  user-select: none;
}
.ansD summary::-webkit-details-marker {
  display: none;
}
.ansD summary:hover {
  border-color: var(--ac);
}
.ansD[open] summary {
  background: transparent;
  border-color: var(--ac);
  color: var(--ac);
}
.ansD .anb {
  margin-top: 8px;
}
/*گزینه‌های کوتاه دو ستونه*/
.opts2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 22px;
}
@media (max-width: 640px) {
  .opts2 {
    grid-template-columns: 1fr;
  }
}
/*استپر بارم در برگهٔ امتحان*/
.step {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1.5px solid var(--bd);
  border-radius: 10px;
  overflow: hidden;
  flex: none;
}
.step button {
  border: none;
  border-radius: 0;
  min-height: 34px;
  min-width: 38px;
  padding: 2px 10px;
  font-size: 17px;
  font-weight: 700;
  background: var(--bg);
  color: var(--ac);
}
.step button:active {
  background: var(--hl);
}
.step .scv {
  min-width: 44px;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  padding: 3px 6px;
  background: var(--cd);
}
/*نوار خلاصهٔ برگه در فوتر*/
.xpg {
  width: 120px;
  height: 7px;
  margin: 0 4px;
  max-width: none;
  flex: none;
  align-self: center;
  border-radius: 4px;
}
.warnx {
  color: var(--no);
  font-size: 12px;
  font-weight: 600;
}
.warnx2 {
  color: var(--ac2);
  font-size: 12px;
  font-weight: 600;
}
.okk {
  color: var(--ok);
  font-size: 12px;
  font-weight: 600;
}
/*برگهٔ امتحان: فهرست + پیش‌نمایش A4 در رایانه*/
.xwrap {
  max-width: none !important;
}
.a4w {
  position: relative;
  margin: 12px auto 24px;
}
.a4pg {
  position: absolute;
  top: 0;
  /* left: 50%; */
  margin-left: -105mm;
  transform-origin: top center;
  width: 210mm;
  min-height: 297mm;
  background: #fff;
  color: #000;
  padding: 14mm 11mm;
  box-sizing: border-box;
  border: 1px solid var(--bd);
  border-radius: 4px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
  font-size: 13px;
  line-height: 1.9;
  font-family: Vazirmatn, Tahoma, sans-serif;
}
.a4pg * {
  max-width: 100%;
}
.pmu {
  display: block;
  text-align: center;
  font-size: 11.5px;
  color: var(--mu);
  margin-top: -14px;
  margin-bottom: 14px;
}
.pvz {
  border: 1.5px dashed var(--bd);
  border-radius: 10px;
  padding: 8px 12px;
  min-height: 70px;
  font-size: 14px;
  background: var(--hl);
  flex: 1;
  min-width: 0;
}
/*نوارابزار فرمول ساخت سوال*/
.mtb {
  display: inline-flex;
  gap: 4px;
  border: 1.5px solid var(--bd);
  border-radius: 10px;
  padding: 3px;
  background: var(--bg);
  margin-bottom: 5px;
}
.mtb button {
  border: none;
  border-radius: 7px;
  min-height: 32px;
  min-width: 42px;
  padding: 4px 10px;
  font-size: 14px;
  background: transparent;
  color: var(--ac);
  font-weight: 700;
}
.mtb button:hover {
  background: var(--hl);
}
@media (max-width: 760px) {
  .qrow {
    flex-direction: column;
  }
}
.card {
  background: var(--cd);
  border: 1px solid var(--bd);
  border-radius: 14px;
  padding: 16px 18px;
  margin-top: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.card h3 {
  margin-bottom: 12px;
}
.qcard {
  background: var(--cd);
  border: 1px solid var(--bd);
  border-radius: 14px;
  padding: 14px 18px;
  margin-top: 12px;
  transition: box-shadow 0.15s;
}
.qcard:hover {
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.07);
}
.meta {
  font-size: 12px;
  color: var(--mu);
  margin-bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: center;
}
.tag {
  background: var(--hl);
  color: var(--ac);
  border-radius: 20px;
  padding: 1px 10px;
  font-size: 11.5px;
  font-weight: 600;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  vertical-align: 1px;
  margin-left: 3px;
}
/* .d1 {
        background: var(--ok);
      }
      .d2 {
        background: var(--ac2);
      }
      .d3 {
        background: var(--no);
      } */
/*سطح سختی: سه دایرهٔ توخالی، به‌اندازهٔ سطح (۱/۲/۳) توپر می‌شوند*/
.dts {
  display: inline-flex;
  gap: 2.5px;
  margin-left: 4px;
  vertical-align: 1px;
}
.dt {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1.4px solid;
  display: inline-block;
  box-sizing: border-box;
}
.dts.d1 .dt {
  border-color: var(--ok);
}
.dts.d1 .dt.f {
  background: var(--ok);
}
.dts.d2 .dt {
  border-color: var(--ac2);
}
.dts.d2 .dt.f {
  background: var(--ac2);
}
.dts.d3 .dt {
  border-color: var(--no);
}
.dts.d3 .dt.f {
  background: var(--no);
}
.qtx {
  font-size: 16px;
}
.qtx p {
  margin: 3px 0;
}
.opt {
  display: block;
  padding: 10px 14px;
  border: 1.5px solid var(--bd);
  border-radius: 12px;
  margin: 6px 0;
  cursor: pointer;
  background: var(--cd);
}
.opt.sel {
  border-color: var(--ac);
  background: var(--hl);
  font-weight: 600;
}
.opt.ok {
  border-color: var(--ok);
}
.opt.no {
  border-color: var(--no);
}
.opt.dis {
  cursor: default;
}
.flt {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.lbl {
  font-size: 12px;
  color: var(--mu);
  margin-bottom: 3px;
  display: block;
}
/*رفع هم‌پوشانی و سرریز کادرهای فرم: محتوای هر خانهٔ گرید از سلول خودش بیرون نمی‌زند*/
.flt > div {
  min-width: 0;
}
.flt input,
.flt select,
.flt textarea {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.bp {
  background: var(--ac);
  color: var(--bg);
  border-color: var(--ac);
  font-weight: 600;
}
.bgh {
  background: transparent;
  color: var(--ac);
  border-color: var(--bd);
}
.bgh:hover {
  border-color: var(--ac);
}
.bd2 {
  color: var(--no);
  border-color: var(--bd);
  background: transparent;
}
.bd2:hover {
  border-color: var(--no);
}
.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.sp {
  flex: 1;
}
.mu {
  color: var(--mu);
  font-size: 13px;
}
.ic {
  width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  flex: none;
}
.anb {
  background: var(--hl);
  border-radius: 10px;
  padding: 8px 14px;
  margin-top: 8px;
  font-size: 14.5px;
}
.scr {
  width: 80px;
}
.prg {
  height: 6px;
  border-radius: 3px;
  background: var(--bd);
  overflow: hidden;
  margin: 8px 0;
  max-width: 820px;
}
.prg i {
  display: block;
  height: 100%;
  background: var(--ac);
  transition: width 0.2s;
}
#tm {
  font-variant-numeric: tabular-nums;
  color: var(--ac);
  font-weight: 700;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--hl);
  color: var(--ac);
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 12.5px;
  cursor: pointer;
  border: none;
}
.chip b {
  font-weight: 400;
  color: var(--fg);
}
.chip:hover {
  text-decoration: line-through;
}
.pgr {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
}
.empty {
  text-align: center;
  color: var(--mu);
  padding: 34px 10px;
}
.empty .big {
  font-size: 34px;
  display: block;
  margin-bottom: 8px;
}
.ios {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 12px;
}
.ios button,
.ios label {
  font-size: 12.5px;
  padding: 6px 14px;
  border: 1px dashed var(--bd);
  background: transparent;
  color: var(--mu);
  border-radius: 20px;
  cursor: pointer;
  text-align: center;
}
.ios button:hover,
.ios label:hover {
  color: var(--ac);
  border-color: var(--ac);
}
.ios input {
  display: none;
}
#pr {
  display: none;
}
#ts {
  position: fixed;
  bottom: 16px;
  right: 50%;
  transform: translateX(50%);
  background: var(--fg);
  color: var(--bg);
  border-radius: 20px;
  padding: 9px 20px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  z-index: 99;
}
#ts.on {
  opacity: 0.95;
}
/*مودال افزودن تصادفی*/
#rm {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 20, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
#rm.on {
  display: flex;
}
#rm .box {
  background: var(--cd);
  color: var(--fg);
  border: 1px solid var(--bd);
  border-radius: 14px;
  padding: 18px;
  min-width: 300px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}
#rm .row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 10px 0;
  flex-wrap: wrap;
}
#rm input[type="number"] {
  width: 100px;
  text-align: center;
}
#rm .msg {
  font-size: 12.5px;
  color: var(--mu);
  min-height: 19px;
}
#rm label {
  cursor: pointer;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
@media print {
  @page {
    size: A4;
    margin: 14mm 11mm 12mm 11mm;
  }
  body > *:not(#pr) {
    display: none !important;
  }
  /*قفل چاپ: بالانس‌های تمِ سایت نباید برگه را از بالای صفحه پایین بیندازند؛ بدون این قفل فقط صفحهٔ اول فاصلهٔ اضافه می‌گیرد.
یک selector با وزن بالا (body:not(#_)) استفاده شده تا از قوانین !important تم که ویژگی بیشتری دارند هم جلوتر باشد*/
  html:not(#_) {
    margin: 0 !important;
  }
  body:not(#_) {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    height: auto !important;
    overflow: visible !important;
    display: block !important;
  }
  /*برخی تم‌ها فاصلهٔ نوار ثابت را با شبه‌عنصر می‌سازند؛ در چاپ حذف می‌شود*/
  body::before,
  body::after {
    display: none !important;
    content: none !important;
  }
  #pr {
    display: block !important;
    margin: 0 !important;
    background: #fff;
    color: #000;
    font-family: Vazirmatn, Tahoma, sans-serif;
    font-size: 12.5px;
    line-height: 1.9;
    padding: 0;
  }
  #pr .eh-t {
    text-align: center;
    font-size: 17px;
    font-weight: 700;
  }
  #pr .eh-s {
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    margin: 2px 0 6px;
  }
  #pr table.et {
    width: 100%;
    border-collapse: collapse;
    margin: 4px 0;
  }
  #pr table.et td {
    border: 1px solid #000;
    padding: 3px 8px;
    font-size: 12px;
    text-align: center;
  }
  #pr .en {
    border: 1px solid #000;
    border-top: none;
    padding: 4px 8px;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
  }
  #pr ol.qs {
    margin: 12px 0;
    padding-right: 20px;
  }
  #pr ol.qs > li {
    margin: 0 0 10px;
    page-break-inside: avoid;
  }
  #pr .sc {
    float: left;
    border: 1px solid #000;
    border-radius: 4px;
    padding: 0 6px;
    font-size: 11px;
    margin-left: 4px;
  }
  #pr .pgbr {
    page-break-before: always;
  }
  #pr ol.qa {
    padding-right: 20px;
    font-size: 12px;
  }
  #pr ol.qa > li {
    margin-bottom: 4px;
  }
  #pr .qm {
    color: #444;
    font-size: 10.5px;
  }
  /*پاسخ‌نامهٔ جدولی: هماهنگ با برگهٔ امتحان، ردیف‌ها در صفحه‌شکنی دوپاره نمی‌شوند*/
  #pr table.anst {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    table-layout: fixed;
    margin-top: 6px;
  }
  #pr .anst td {
    border: 1px solid #000;
    vertical-align: top;
    padding: 5px 10px;
  }
  #pr .anst tr {
    page-break-inside: avoid;
  }
  #pr .anst .am {
    text-align: center;
    vertical-align: middle;
    font-weight: 700;
  }
  #pr .anst .atx {
    text-align: right;
  }

  /* --- برگهٔ رسمی (شیوهٔ نهایی) --- */
  #pr table.ws {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: fixed;
  }
  #pr .ws tr.hrow > td {
    border: none;
    padding: 0;
  }
  #pr .ws tr {
    page-break-inside: avoid;
  }
  #pr table.oh {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
  }
  #pr table.oh td {
    border: 1px solid #000;
    vertical-align: top;
    padding: 0;
  }
  #pr .oh .org {
    text-align: center;
    vertical-align: middle;
    font-size: 11.5px;
    line-height: 1.7;
  }
  #pr .oh .org b {
    font-size: 12px;
  }
  #pr .oh .exm {
    font-size: 12px;
    line-height: 1.85;
    padding: 2px 10px;
    font-weight: 600;
  }
  #pr .oh .stm {
    text-align: center;
    vertical-align: middle;
  }
  #pr .oh .stm .vt {
    writing-mode: vertical-rl;
    font-size: 11px;
    color: #333;
    letter-spacing: 1px;
    margin: 6px auto;
  }
  #pr .oh .ph {
    border: 0.35mm solid #000;
    width: 24mm;
    height: 31mm;
    margin: 2mm auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    line-height: 1.4;
    color: #555;
    overflow: hidden;
    background: #fff;
    text-align: center;
  }
  #pr .oh .ph img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
  #pr .oh .stu .row1 {
    display: flex;
    gap: 8px;
    padding: 4px 8px;
    font-size: 12px;
  }
  #pr .oh .stu .row3 {
    display: flex;
    gap: 10px;
    padding: 3px 8px;
    font-size: 11.5px;
    align-items: center;
  }
  #pr .oh .stu .fl {
    flex: 1;
  }
  #pr .oh .stu b {
    font-weight: 600;
  }
  #pr .oh .stu .kechi {
    color: #000;
  }
  #pr .oh .ln {
    border-top: 1px solid #000;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: 600;
  }
  #pr .oh .lgb {
    max-height: 58px;
    max-width: 90px;
    margin: 4px auto;
    display: block;
  }
  #pr .sig {
    display: flex;
    font-size: 12px;
  }
  #pr .sig span {
    padding: 4px 8px;
    font-weight: 600;
  }
  #pr .sig span + span {
    border-right: 1px solid #000;
  }
  #pr .qh th {
    border: 1px solid #000;
    text-align: center;
    font-size: 12.5px;
    padding: 2px 4px;
    font-weight: 700;
  }
  #pr .qs2 td {
    border: 1px solid #000;
    vertical-align: top;
    padding: 6px 10px;
  }
  #pr .rn {
    width: 36px;
    text-align: center;
    vertical-align: middle !important;
    padding-right: 2px !important;
    padding-left: 2px !important;
  }
  #pr .rs {
    width: 36px;
    text-align: center;
    vertical-align: middle !important;
    font-size: 12px;
    padding-right: 2px !important;
    padding-left: 2px !important;
  }
  #pr .qo {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 20px;
    font-size: 12.5px;
    margin: 4px 16px 0 0;
  }
  #pr .qo span {
    min-width: 38%;
  }
  #pr .qb {
    height: 72px;
  }
  #pr .sumr > td {
    border: 1px solid #000;
    font-weight: 700;
    font-size: 13px;
    padding: 5px 12px;
  }
  /*ردیف پایانی بدون خط عمودی داخلی: «موفق باشید» در مرکز کل ردیف و «جمع بارم» در یک خط در خانهٔ بزرگ سمت چپ*/
  #pr .sumf {
    display: flex;
    align-items: center;
  }
  #pr .sumf > span {
    flex: 1;
    white-space: nowrap;
  }
  #pr .sumf .smc {
    text-align: center;
  }
  #pr .sumf .sml {
    text-align: left;
  }
  #pr .sigrow > td {
    border: 1px solid #000;
    padding: 0;
  }
  /*ردیف شمارهٔ صفحه — سلول کامل با حاشیه (بدون ردیف/بارم) ابتدای جدول صفحات ۲ به بعد*/
  #pr .pnr > td {
    border: 1px solid #000;
    font-size: 11px;
    padding: 4px 10px;
    font-weight: 600;
    vertical-align: middle;
  }
  #pr .pgti {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  #pr .pgbrk {
    page-break-before: always;
    height: 0;
  }
  #pr img {
    max-width: 100%;
  }
}
.qimg {
  display: block;
  max-width: 340px;
  max-height: 240px;
  margin: 8px 10px;
  border: 1px solid var(--bd);
  border-radius: 8px;
  background: #fff;
  padding: 4px;
}
@media print {
  #pr .qimg {
    max-width: 100mm;
    max-height: 80mm;
  }
}
/*جای خالی پاسخ دانش‌آموز — خط‌دار، برحسب تعداد خط انتخابی در برگهٔ امتحان*/
.als {
  display: flex;
  flex-direction: column;
  margin-top: 6px;
}
.als i {
  display: block;
  height: 30px;
  border-bottom: 1px dashed #a7adb8;
  box-sizing: border-box;
}
@media print {
  #pr .als {
    margin-top: 2mm;
  }
  #pr .als i {
    height: 9.5mm;
    border-bottom: 1px dotted #666;
  }
}

/* ===== base-2 ===== */
:root {
  padding-top: 0;
}
body {
  box-sizing: border-box;
}

/* ===== ui-refresh ===== */
/* بهبود ظاهری رابط کاربری؛ بدون تغییر منطق برنامه */
:root {
  --ui-radius: 16px;
  --ui-shadow: 0 8px 24px rgba(25, 35, 50, 0.055);
}
body {
  background:
    radial-gradient(
      ellipse at 8% 0%,
      color-mix(in srgb, var(--ac) 7%, transparent),
      transparent 34%
    ),
    var(--bg);
  letter-spacing: -0.12px;
}
header {
  min-height: 48px;
  padding: 10px 20px;
  justify-content: flex-start;
  background: var(--cd);
  border-bottom: 1px solid var(--bd);
  box-shadow: 0 2px 12px rgba(20, 30, 45, 0.035);
  position: relative;
  z-index: 2;
}
header b {
  order: 0;
  flex: 1 1 auto;
  text-align: right;
  color: var(--fg);
  font-size: 15px;
  font-weight: 800;
}
.navy {
  width: min(100% - 28px, 980px);
  box-sizing: border-box;
  justify-content: space-between;
  margin: 12px auto 4px;
  padding: 5px;
  background: color-mix(in srgb, var(--cd) 94%, var(--bg));
  border-color: color-mix(in srgb, var(--bd) 80%, transparent);
  box-shadow: var(--ui-shadow);
}
.navy .nv {
  flex: 1 1 0;
  justify-content: center;
  padding: 9px 13px;
  min-height: 44px;
  font-size: 13px;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}
.navy .nv:not(.on):hover {
  background: var(--hl);
  color: var(--ac);
}
.navy .nv.on {
  box-shadow: 0 3px 10px color-mix(in srgb, var(--ac) 22%, transparent);
}
#pg {
  width: 100%;
  box-sizing: border-box;
  padding: 18px clamp(12px, 3vw, 30px) 28px;
  /* smooth باعث می‌شد اصلاح اسکرول بعد از رندر (pg.scrollTop = …) انیمیشن بگیرد و صفحه بپرد؛ پرش‌های عمدی با scrollIntoView({behavior:"smooth"}) انجام می‌شوند */
  scroll-behavior: auto;
  scrollbar-gutter: stable;
}
#pg > * {
  max-width: 1040px;
}
.card,
.qcard {
  border-radius: var(--ui-radius);
  border-color: color-mix(in srgb, var(--bd) 88%, transparent);
  box-shadow: var(--ui-shadow);
}
.card {
  padding: clamp(15px, 2.2vw, 24px);
  margin-top: 16px;
}
.qcard {
  padding: 16px clamp(14px, 2vw, 22px);
  margin-top: 12px;
  box-shadow: 0 2px 10px rgba(20, 30, 45, 0.035);
}
.qcard:hover {
  border-color: color-mix(in srgb, var(--ac) 45%, var(--bd));
  box-shadow: 0 6px 18px rgba(20, 30, 45, 0.07);
}
h3 {
  font-size: 16px;
  line-height: 1.8;
  margin-bottom: 12px;
}
.lbl {
  font-weight: 700;
  margin-bottom: 6px;
}
input,
select,
textarea {
  box-sizing: border-box;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}
input:not([type="radio"]):not([type="checkbox"]),
select,
textarea {
  min-height: 42px;
}
textarea {
  min-height: 92px;
  line-height: 1.9;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--ac) 27%, transparent);
  outline-offset: 2px;
  border-color: var(--ac);
}
button {
  transition:
    transform 0.12s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}
button:active:not(:disabled) {
  transform: translateY(1px);
}
button.bp {
  box-shadow: 0 3px 9px color-mix(in srgb, var(--ac) 18%, transparent);
}
button.bp:hover:not(:disabled) {
  filter: brightness(1.04);
  box-shadow: 0 5px 14px color-mix(in srgb, var(--ac) 24%, transparent);
}
.opt {
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    transform 0.12s ease;
}
.opt:hover {
  border-color: color-mix(in srgb, var(--ac) 55%, var(--bd));
}
.tag,
.chip {
  line-height: 1.8;
}
footer {
  background: color-mix(in srgb, var(--cd) 96%, var(--bg));
  padding: 10px 14px;
  padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -3px 14px rgba(20, 30, 45, 0.035);
  z-index: 2;
}
#ts {
  max-width: calc(100vw - 32px);
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.empty {
  background: var(--cd);
  border: 1px dashed var(--bd);
  border-radius: var(--ui-radius);
  margin-top: 16px;
}
@media (min-width: 900px) {
  #pg {
    padding-top: 24px;
  }
  .flt {
    gap: 14px;
  }
}
@media (max-width: 560px) {
  header {
    min-height: 42px;
    padding: 8px 14px;
  }
  header b {
    font-size: 13px;
  }
  .navy {
    width: calc(100% - 16px);
    margin-top: 8px;
    gap: 3px;
    padding: 4px;
  }
  .navy .nv {
    min-width: max-content;
    flex: 1 0 auto;
    padding: 8px 10px;
    font-size: 11.5px;
    gap: 5px;
  }
  #pg {
    padding: 12px 10px 20px;
  }
  .card {
    padding: 14px;
    border-radius: 14px;
  }
  .qcard {
    padding: 13px;
    border-radius: 13px;
  }
  .qtx {
    font-size: 15px;
    line-height: 2;
  }
  footer {
    gap: 6px;
  }
  footer button {
    flex: 1 1 auto;
    padding: 9px 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ===== usability-refresh ===== */
/* پایداری نوارهای رابط در هنگام جابه‌جایی بین بخش‌ها */
html,
body {
  height: 100%;
}
body {
  min-height: 0;
}
header,
.navy,
#quick-guide,
footer {
  flex-shrink: 0;
}
#pg {
  min-height: 0;
}

/* ساده‌سازی مسیر استفاده و راهنمای درون‌برنامه‌ای */
.navy {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: min(calc(100% - 28px), 1040px);
  max-width: 1040px;
  overflow: visible;
  margin: 14px auto 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.navy .nv {
  min-width: 0;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 11px;
  padding: 12px 14px;
  white-space: normal;
  text-align: right;
  color: var(--fg);
  background: var(--cd);
  border: 1px solid var(--bd);
  border-radius: 15px;
  box-shadow: 0 2px 7px rgba(20, 30, 45, 0.025);
}
.navy .nv svg {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}
.navcopy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1.45;
}
.navcopy .navtitle {
  font-weight: 800;
  font-size: 13px;
}
.navcopy small {
  display: block;
  font-weight: 400;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--mu);
}
.navy .nv:not(.on):hover {
  background: var(--hl);
  border-color: color-mix(in srgb, var(--ac) 45%, var(--bd));
  transform: translateY(-1px);
}
.navy .nv.on {
  color: var(--bg);
  background: var(--ac);
  border-color: var(--ac);
  box-shadow: 0 5px 15px color-mix(in srgb, var(--ac) 20%, transparent);
}
.navy .nv.on .navcopy small {
  color: color-mix(in srgb, var(--bg) 86%, var(--ac));
}
#cx {
  display: inline-block;
  vertical-align: 1px;
}

#quick-guide {
  width: min(calc(100% - 28px), 1040px);
  box-sizing: border-box;
  margin: 12px auto 2px;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid color-mix(in srgb, var(--ac) 22%, var(--bd));
  border-radius: 15px;
  background: color-mix(in srgb, var(--hl) 48%, var(--cd));
}
.guide-main {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 11px;
}
.guide-step {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--ac);
  color: var(--bg);
  font-size: 14px;
  font-weight: 800;
}
.guide-copy {
  min-width: 0;
}
.guide-title {
  color: var(--fg);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.7;
}
.guide-desc {
  margin: 2px 0 0;
  color: var(--mu);
  font-size: 12px;
  line-height: 1.9;
}
.guide-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.guide-meta span {
  padding: 3px 8px;
  border: 1px solid var(--bd);
  border-radius: 999px;
  color: var(--mu);
  background: var(--cd);
  font-size: 10.5px;
  line-height: 1.6;
}
.guide-action {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid color-mix(in srgb, var(--ac) 34%, var(--bd));
  border-radius: 11px;
  background: var(--cd);
  color: var(--ac);
  font-size: 12px;
  font-weight: 800;
}
.guide-action:hover {
  background: var(--hl);
}
#pg {
  padding-top: 10px;
}
#pg > .card:first-child {
  margin-top: 8px;
}
.lbl {
  display: block;
  line-height: 1.8;
}
input::placeholder,
textarea::placeholder {
  color: color-mix(in srgb, var(--mu) 82%, transparent);
  opacity: 1;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  box-shadow: none !important;
}
.empty {
  padding: 24px 16px;
  line-height: 2;
}
@media (max-width: 720px) {
  .navy {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    width: calc(100% - 20px);
    margin-top: 10px;
  }
  .navy .nv {
    min-height: 62px;
    padding: 10px 11px;
    gap: 9px;
    border-radius: 13px;
  }
  .navy .nv svg {
    width: 20px;
    height: 20px;
  }
  .navcopy .navtitle {
    font-size: 12.5px;
  }
  .navcopy small {
    font-size: 10px;
  }
  #quick-guide {
    width: calc(100% - 20px);
    margin-top: 10px;
    padding: 12px;
    gap: 10px;
  }
  .guide-desc {
    font-size: 11.5px;
  }
  .guide-action {
    padding: 8px 10px;
  }
  #pg {
    padding-top: 8px;
  }
}
@media (max-width: 460px) {
  header b {
    font-size: 13px;
  }
  #quick-guide {
    display: block;
  }
  .guide-main {
    gap: 9px;
  }
  .guide-step {
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }
  .guide-action {
    width: 100%;
    margin-top: 10px;
    min-height: 42px;
  }
  .guide-meta {
    margin-top: 7px;
  }
}
@media (max-width: 340px) {
  .navy .nv {
    padding: 9px 8px;
    gap: 7px;
  }
  .navy .nv svg {
    width: 18px;
    height: 18px;
  }
  .navcopy .navtitle {
    font-size: 11.5px;
  }
  .navcopy small {
    font-size: 9.5px;
  }
}
@media print {
  #quick-guide {
    display: none !important;
  }
}

/* ===== bottom-svg-navigation-and-print-fix ===== */
/* ناوبری ثابت در پایینِ چیدمان؛ آیکون SVG همراه با عنوان کوتاه برای جلوگیری از ابهام */
header,
#quick-guide,
#ft,
.navy {
  flex-shrink: 0;
}
#pg {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
#ft {
  max-width: none;
  box-sizing: border-box;
  margin: 0;
}
.navy {
  order: 10;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  margin: 0;
  padding: 6px 8px max(6px, env(safe-area-inset-bottom, 0px));
  overflow: visible;
  border: 0;
  border-top: 1px solid var(--bd);
  border-radius: 0;
  background: var(--cd);
  box-shadow: 0 -4px 16px rgba(20, 30, 45, 0.07);
  z-index: 5;
}
.navy .nv {
  position: relative;
  min-width: 0;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 5px 3px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--mu);
  box-shadow: none;
  text-align: center;
  white-space: normal;
}
.navy .nv svg {
  display: block;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}
.navcopy {
  display: block;
  min-width: 0;
  line-height: 1.25;
}
.navcopy .navtitle {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
}
.navcopy small {
  display: none !important;
}
.navy .nv.on {
  color: var(--ac);
  background: var(--hl);
  border-color: color-mix(in srgb, var(--ac) 18%, transparent);
  box-shadow: none;
}
.navy .nv.on::before {
  content: "";
  position: absolute;
  top: -6px;
  left: calc(50% - 12px);
  width: 24px;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: var(--ac);
}
.navy .nv.on .navcopy small {
  display: none !important;
}
.navy .nv #cx {
  font-size: 9px;
}
.dts {
  display: inline-block;
  font-family: Arial, Tahoma, sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  line-height: 1;
  white-space: nowrap;
  vertical-align: -1px;
}
.dts.d1 {
  color: var(--ok);
}
.dts.d2 {
  color: var(--ac2);
}
.dts.d3 {
  color: var(--no);
}
@media (max-width: 420px) {
  .navy {
    padding-left: 4px;
    padding-right: 4px;
    gap: 2px;
  }
  .navy .nv {
    min-height: 54px;
    border-radius: 9px;
  }
  .navy .nv svg {
    width: 21px;
    height: 21px;
  }
  .navcopy .navtitle {
    font-size: 10px;
  }
}
@media (max-height: 560px) and (max-width: 720px) {
  #quick-guide {
    display: none;
  }
  .navy .nv {
    min-height: 48px;
  }
  .navy .nv svg {
    width: 18px;
    height: 18px;
  }
}
@media print {
  .navy,
  #quick-guide,
  #ft {
    display: none !important;
  }
  .dts {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* برگهٔ امتحان: فهرست + پیش‌نمایش A4. چیدمان بر اساس عرض واقعی محتوا (نه عرض پنجره):
   عرض کم ← پیش‌نمایش زیر فهرست؛ عرض کافی ← دو ستون کنار هم */
.xcq {
  container-type: inline-size;
}
.xwrap {
  display: block;
  max-width: none !important;
}
.xlist {
  width: 100%;
  min-width: 0;
}
.xpv {
  min-width: 0;
  overflow: hidden;
  contain: paint;
  position: relative;
}
.xpv .a4w {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.xpv .a4pg {
  left: calc(50% - 105mm);
  right: auto;
  margin-left: 0;
} /* صفحهٔ A4 وسط ستون؛ قبلاً left کامنت شده بود و margin-left:-105mm از جای دیگر صفر می‌شد، پس صفحه به راست می‌چسبید و بریده می‌شد */
.xpv {
  margin-top: 18px;
} /* عرض کم: پیش‌نمایش زیر فهرست سوال‌ها */
.xj {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 3px 12px;
  font-size: 12px;
  border-radius: 999px;
}
@container (min-width: 700px) {
  .xwrap {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
  }
  .xpv {
    margin-top: 0;
  }
  .xj {
    display: none;
  }
}

/* ===== mobile-polish ===== */
.l-sm {
  display: none;
}
:root {
  --on-ac: var(--s-oi, var(--bg));
  --on-lav: var(--s-on-acc2, #1d2330);
}
/* ۲) متن روی رنگ اصلی همیشه از روی خود آن رنگ خوانا انتخاب شود (در تم‌های سفارشی) */
.bp,
.guide-step {
  color: var(--on-ac);
}
.fsum,
.fbtn {
  display: contents;
}
.xhh {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: none !important;
  box-shadow: none !important;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.xhh h3 {
  margin: 0;
  flex: 0 0 auto;
}
.xsum {
  display: none;
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--mu);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.xhd.closed .xsum {
  display: block;
}
.xhh .chev {
  margin-inline-start: auto;
  transition: transform 0.15s;
}
.xhd:not(.closed) .chev {
  transform: rotate(180deg);
}
.xhb {
  margin-top: 10px;
}
.xhd.closed .xhb {
  display: none;
}
.xhead {
  position: sticky;
  top: calc(-1 * var(--pgpt, 0px));
  z-index: 6;
  padding: 8px 14px;
  box-shadow: 0 8px 16px -12px rgba(0, 0, 0, 0.45);
}
.xhead {
  margin-top: 0 !important;
}
.xhead .row {
  flex-wrap: nowrap;
  gap: 8px;
}
.xhead h3 {
  flex: 0 0 auto !important;
  white-space: nowrap;
  font-size: 14px;
}
.xhead .mu {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: start;
}
.xj {
  flex: 0 0 auto;
}
.pgb {
  min-width: 44px;
}
@media (max-width: 720px) {
  /* ۱) صفحه‌بندی و دکمه‌های پایین بانک: فشرده */
  .l-lg {
    display: none;
  }
  .l-sm {
    display: inline;
  }
  footer {
    gap: 6px 8px;
    padding: 6px 10px;
    padding-bottom: max(6px, env(safe-area-inset-bottom, 0px));
  }
  .pgr {
    flex: 1 1 auto;
    justify-content: center;
    gap: 8px;
  }
  footer .pgb {
    flex: 0 0 40px;
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
  }
  .pgb .pgt,
  .pgn {
    display: none;
  }
  footer .pgi {
    min-width: 96px;
    font-size: 13px;
    font-weight: 700;
    color: var(--fg);
  }
  footer .bp,
  footer .bgh,
  footer .bd2 {
    flex: 0 1 auto;
    min-height: 36px;
    padding: 5px 12px;
    font-size: 12px;
    border-radius: 10px;
  }
  /* ۳) بانک: صفحه‌بندی و سه دکمه در یک ردیف (دکمه‌ها آیکونی) */
  footer .ib {
    flex: 0 0 40px;
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    border-radius: 50%;
    font-size: 17px;
    line-height: 1;
  }
  footer .ib .lb {
    display: none;
  }
  /* ۶) برگه: فوتر در دو ردیف */
  .xsp {
    display: none;
  }
  .fsum {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 100%;
    min-width: 0;
    font-size: 12px;
  }
  .fsum .prg {
    flex: 1 1 60px;
    min-width: 40px;
  }
  .fsum .warnx,
  .fsum .warnx2,
  .fsum .okk {
    font-size: 11.5px;
    white-space: nowrap;
  }
  .fbtn {
    display: flex;
    gap: 6px;
    flex: 1 1 100%;
  }
  footer .fbtn button {
    flex: 1 1 0;
    min-width: 0;
    min-height: 38px;
    padding: 5px 4px;
    font-size: 11.5px;
    border-radius: 10px;
    white-space: nowrap;
  }
  footer .fbtn .bp {
    flex: 1.4 1 0;
  }
  footer .fbtn .bd2 {
    flex: 0 0 40px;
  }

  /* ۲) راهنمای گام‌ها: یک خط؛ با لمس عنوان باز می‌شود */
  #quick-guide {
    display: flex;
    align-items: center;
    gap: 8px;
    width: calc(100% - 20px);
    margin: 8px auto 0;
    padding: 7px 10px;
  }
  #quick-guide .guide-main {
    flex: 1 1 auto;
    align-items: center;
    gap: 8px;
  }
  #quick-guide .guide-step {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    border-radius: 9px;
    font-size: 12px;
  }
  #quick-guide .guide-title {
    font-size: 12.5px;
    line-height: 1.5;
    cursor: pointer;
  }
  #quick-guide .guide-title::after {
    content: " ▾";
    color: var(--mu);
  }
  #quick-guide.open .guide-title::after {
    content: " ▴";
  }
  #quick-guide .guide-desc,
  #quick-guide .guide-meta {
    display: none;
  }
  #quick-guide.open .guide-desc {
    display: block;
  }
  #quick-guide.open .guide-meta {
    display: flex;
  }
  #quick-guide .guide-action {
    width: auto;
    margin: 0;
    min-height: 34px;
    padding: 4px 10px;
    font-size: 11.5px;
  }

  /* ۴) نوار پایین: قرص شناور وسط‌چین، نه تمام‌عرض */
  .navy {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2px;
    width: min(calc(100% - 24px), 400px);
    margin: 4px auto calc(10px + env(safe-area-inset-bottom, 0px));
    padding: 5px;
    border: 1px solid var(--bd);
    border-radius: 22px;
    background: var(--cd);
    box-shadow: 0 8px 24px rgba(20, 30, 45, 0.16);
  }
  .navy .nv {
    min-height: 50px;
    border-radius: 17px;
  }
  .navy .nv.on {
    background: var(--ac);
    color: #fff;
    border-color: transparent;
  }
  .navy .nv.on::before {
    display: none;
  }
}

/* ===== center-sheet-button ===== */
/* نوار پایین: قرص شناور وسط‌چین با دکمهٔ گردِ برجستهٔ «برگهٔ امتحان» در وسط (موبایل و رایانه)
   چیدمان: دو دکمه | برگه | دو دکمه */
.navy {
  --raise: 26px;
  --ctr: 84px;
  grid-template-columns: 1fr 1fr var(--ctr) 1fr 1fr;
  gap: 2px;
  width: min(calc(100% - 24px), 440px);
  margin: calc(var(--raise) - 6px) auto
    calc(10px + env(safe-area-inset-bottom, 0px));
  padding: 5px;
  border: 1px solid var(--bd);
  border-radius: 24px;
  background: var(--cd);
  box-shadow: 0 8px 24px rgba(20, 30, 45, 0.16);
  overflow: visible;
}
.navy .nv {
  min-height: 52px;
  border-radius: 18px;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
.navy .nv:not(.on):hover {
  background: var(--hl);
  color: var(--ac);
}
.navy .nv.on {
  background: var(--ac);
  color: var(--bg);
  border-color: transparent;
}
.navy .nv.on::before {
  display: none;
}
.navy .nv.on .navcopy small {
  color: inherit;
}
.navy .nv[data-v="exam"] {
  justify-content: flex-end;
  padding: 0 0 8px;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--mu);
  overflow: visible;
}
.navy .nv[data-v="exam"]:hover {
  background: transparent;
}
.navy .nv[data-v="exam"] svg {
  box-sizing: border-box;
  width: 62px;
  height: 62px;
  padding: 12px;
  margin-top: calc(-1 * var(--raise));
  border: 5px solid var(--cd);
  border-radius: 50%;
  background: var(--ac);
  color: var(--bg);
  box-shadow: 0 6px 16px rgba(20, 30, 45, 0.28);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}
.navy .nv[data-v="exam"]:hover svg {
  transform: translateY(-2px);
}
.navy .nv[data-v="exam"]:active svg {
  transform: scale(0.94);
}
.navy .nv[data-v="exam"] .navcopy .navtitle {
  font-size: 10px;
}
.navy .nv[data-v="exam"].on {
  background: transparent;
  color: var(--ac);
}
.navy .nv[data-v="exam"].on svg {
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--ac) 35%, transparent),
    0 6px 16px rgba(20, 30, 45, 0.28);
}
.navy .nv[data-v="exam"]:focus-visible svg {
  outline: 2px solid var(--ac);
  outline-offset: 3px;
}
/* رایانه: قرص پهن‌تر، آیکون و متن بزرگ‌تر، توضیح کوتاه زیر هر دکمه */
@media (min-width: 900px) {
  .navy {
    --raise: 30px;
    --ctr: 128px;
    width: 760px;
    margin-top: calc(var(--raise) + 2px);
    margin-bottom: 18px;
    padding: 7px;
    border-radius: 28px;
    box-shadow: 0 12px 32px rgba(20, 30, 45, 0.18);
  }
  .navy .nv {
    min-height: 68px;
    border-radius: 21px;
    gap: 3px;
  }
  .navy .nv svg {
    width: 24px;
    height: 24px;
  }
  .navcopy .navtitle {
    font-size: 12px;
  }
  .navcopy small {
    display: block !important;
    margin-top: 1px;
    font-size: 10px;
    font-weight: 400;
    white-space: nowrap;
  }
  .navy .nv[data-v="exam"] {
    padding-bottom: 9px;
  }
  .navy .nv[data-v="exam"] svg {
    width: 70px;
    height: 70px;
    padding: 15px;
  }
  .navy .nv[data-v="exam"] .navcopy .navtitle {
    font-size: 12px;
  }
}
@media (max-width: 420px) {
  .navy {
    padding-left: 3px;
    padding-right: 3px;
  }
  .navy .nv {
    padding-left: 1px;
    padding-right: 1px;
  }
}
@media (max-width: 380px) {
  .navy {
    --ctr: 76px;
  }
  .navcopy .navtitle {
    font-size: 9.5px;
  }
}
@media (max-height: 560px) and (max-width: 720px) {
  .navy {
    --raise: 18px;
  }
  .navy .nv,
  .navy .nv[data-v="exam"] {
    min-height: 46px;
  }
  .navy .nv[data-v="exam"] svg {
    width: 50px;
    height: 50px;
    padding: 10px;
  }
}

/*فیلتر مدرن بانک سوالات (چیپ‌ها)*/
.fx {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.fxs {
  position: relative;
  display: flex;
  align-items: center;
}
.fxs svg {
  position: absolute;
  right: 12px;
  color: var(--mu);
  pointer-events: none;
}
.fxs input {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 40px 11px 14px;
  border-radius: 12px;
  background: var(--bg);
  border: 1.5px solid var(--bd);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.fxs input:focus {
  outline: none;
  border-color: var(--ac);
  box-shadow: 0 0 0 3px var(--hl);
}
.fxt,
.fxa {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--bd);
  border-radius: 12px;
  background: var(--bg);
}
.fxa {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.fxg {
  min-width: 0;
}
.fxl {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--mu);
  margin-bottom: 6px;
}
.fxc {
  border: none;
  background: none;
  padding: 0;
  min-height: 0;
  font-size: 11.5px;
  color: var(--ac);
  font-weight: 600;
  cursor: pointer;
}
.fxc:hover {
  text-decoration: underline;
}
.fxr {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.fxh {
  font-size: 12.5px;
  color: var(--mu);
  padding: 6px 2px;
  opacity: 0.8;
}
.fc {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--bd);
  background: var(--cd);
  color: var(--fg);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s,
    transform 0.1s;
}
.fc:hover {
  border-color: var(--ac);
}
.fc:active {
  transform: scale(0.97);
}
.fc i {
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--hl);
  color: var(--ac);
  text-align: center;
  line-height: 18px;
}
.fc.on {
  background: var(--ac);
  border-color: var(--ac);
  color: var(--bg);
}
.fc.on i {
  background: rgba(255, 255, 255, 0.22);
  color: var(--bg);
}
.fc.z {
  opacity: 0.45;
}
.fc .dts {
  margin-left: 0;
  background: none !important;
  width: auto;
  height: auto;
  border-radius: 0;
  font-size: 11px;
  letter-spacing: 1px;
  line-height: 1;
}
.fc .dts.d1 {
  color: var(--ok);
}
.fc .dts.d2 {
  color: var(--ac2);
}
.fc .dts.d3 {
  color: var(--no);
}
.fc.on .dts {
  color: var(--bg) !important;
}
.fc.fl1.on {
  background: var(--ok);
  border-color: var(--ok);
}
.fc.fl2.on {
  background: var(--ac2);
  border-color: var(--ac2);
}
.fc.fl3.on {
  background: var(--no);
  border-color: var(--no);
}
@media (max-width: 560px) {
  .fxr {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .fxr::-webkit-scrollbar {
    display: none;
  }
  .fxt,
  .fxa {
    padding: 10px;
  }
}
@media print {
  .fx {
    display: none !important;
  }
}

/* ===== filter-polish-and-compact-nav ===== */
.fxa {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 16px;
  align-items: start;
}
.fxa > .fxg {
  display: flex;
  flex-direction: column;
}
.fxa .fxr {
  flex: 1;
  align-content: flex-start;
}
.fxl {
  min-height: 20px;
}
@media (max-width: 760px) {
  .fxa {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 560px) {
  .fxr {
    flex-wrap: wrap;
    overflow: visible;
    padding-bottom: 0;
    gap: 5px;
  }
  .fc {
    min-height: 30px;
    padding: 4px 9px;
    font-size: 12px;
    gap: 4px;
  }
  .fc i {
    font-size: 10px;
    min-width: 16px;
    padding: 0 5px;
    line-height: 16px;
  }
  .fxl {
    font-size: 11.5px;
  }
  .fxt,
  .fxa {
    padding: 9px;
    gap: 9px;
  }
}
@media (min-width: 900px) {
  .navy {
    --raise: 20px;
    --ctr: 116px;
    margin-top: calc(var(--raise) + 2px);
    margin-bottom: 8px;
    padding: 5px;
    width: 700px;
  }
  .navy .nv {
    min-height: 50px;
    gap: 1px;
    border-radius: 17px;
  }
  .navy .nv svg {
    width: 20px;
    height: 20px;
  }
  .navy .nv[data-v="exam"] svg {
    width: 54px;
    height: 54px;
    padding: 11px;
    border-width: 4px;
  }
  .navy .nv[data-v="exam"] {
    padding-bottom: 5px;
  }
  .navcopy small {
    font-size: 9.5px;
    margin-top: 0;
  }
}

/* ===== exam-badges ===== */
/* بج هلالی دوتکه دور دکمهٔ گرد «برگهٔ امتحان»: راست = تعداد سؤال، چپ = نمرهٔ کل */
.navy {
  --cs: 62px;
}
@media (min-width: 900px) {
  .navy {
    --cs: 70px;
  }
}
@media (max-height: 560px) and (max-width: 720px) {
  .navy {
    --cs: 50px;
  }
}
.xic {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}
.xcr {
  position: absolute;
  left: 50%;
  top: calc(var(--cs) / 2 - var(--raise, 26px));
  width: calc(var(--cs) * 1.935);
  height: calc(var(--cs) * 1.935);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 2;
}
.xcr[hidden] {
  display: none;
}
.navy .nv[data-v="exam"] .xcr svg,
.navy .nv[data-v="exam"]:hover .xcr svg,
.navy .nv[data-v="exam"]:active .xcr svg,
.navy .nv[data-v="exam"].on .xcr svg,
.navy .nv[data-v="exam"]:focus-visible .xcr svg {
  all: initial;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.xcr path.c1,
.xcr path.c2 {
  stroke: var(--cd);
  stroke-width: 2;
  stroke-linejoin: round;
}
.xcr path.c1 {
  fill: var(--fg);
}
.xcr path.c2 {
  fill: var(--ok);
}
.xcr text {
  fill: var(--bg);
  font-family: Vazirmatn, Tahoma, sans-serif;
  font-size: 11px;
  font-weight: 700;
}
@media (max-width: 899px) {
  .navy .nv[data-v="exam"] .navcopy small {
    display: none !important;
  }
}

/* سوال‌های انتخاب‌شده (در برگه) که ابتدای فهرست بانک می‌آیند */
.qcard.insel {
  border-color: var(--ac2, var(--ac));
}

/* ---- نوار کامل فرمول (منتقل‌شده از ویرایشگر بانک) ---- */
.math-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 7px;
}
.math-tools button,
.math-more button {
  min-height: 32px;
  padding: 4px 9px;
  font-size: 12.5px;
  border: 1.5px solid var(--bd);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ac);
  font-weight: 700;
}
.math-tools button:hover,
.math-more button:hover {
  background: var(--hl);
}
.mt-sep {
  flex: 0 0 1px;
  align-self: stretch;
  background: var(--bd);
  margin: 0 2px;
}
.mt-target {
  font-size: 11.5px;
  color: var(--mu);
  align-self: center;
  white-space: nowrap;
}
.math-more {
  margin: 0 0 8px;
  padding: 8px 10px;
  border: 1px solid var(--bd);
  border-radius: 10px;
  background: var(--bg);
}
.math-more.hidden {
  display: none;
}
.math-more .mg {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin: 2px 0 9px;
}
.math-more .mg:last-child {
  margin-bottom: 0;
}
.math-more .mgt {
  flex: 0 0 100%;
  font-size: 11.5px;
  color: var(--mu);
  font-weight: 700;
}
.math-more button {
  font-size: 13px;
  min-width: 34px;
  direction: ltr;
  unicode-bidi: isolate;
}
@media (max-width: 760px) {
  .math-tools {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .math-tools::-webkit-scrollbar {
    display: none;
  }
  .math-tools button {
    flex-shrink: 0;
    white-space: nowrap;
  }
}
/* ---- کشیدن و رها کردن سوال‌های برگه ---- */
.dgh {
  cursor: grab;
  font-size: 18px;
  line-height: 1;
  color: var(--mu);
  padding: 2px 6px;
  user-select: none;
  touch-action: none;
}
.dgh:active {
  cursor: grabbing;
}
.xrow.dragging {
  opacity: 0.45;
}
.xrow[data-drop="b"] {
  box-shadow: 0 -3px 0 var(--ac);
}
.xrow[data-drop="a"] {
  box-shadow: 0 3px 0 var(--ac);
}

/* کلید پاسخ نسخه‌های شخصی (چاپ کلاسی با جابه‌جایی) */
#pr .skey {
  font-size: 12px;
  line-height: 2;
  padding: 1.5mm 0;
  border-bottom: 1px dotted #999;
  break-inside: avoid;
}
#pr .skey span {
  display: inline-block;
  min-width: 46px;
  margin-left: 8px;
}

/* پاسخ‌برگ (حبابی + کادر) — فقط داخل #pr؛ رنگ‌های چاپ عمداً ثابت */
#pr .bsh .bt {
  margin-top: 4mm;
}
#pr .bgrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0 4mm;
  margin-top: 4mm;
  direction: rtl;
}
#pr .br {
  display: flex;
  align-items: center;
  gap: 1.6mm;
  height: 9mm;
  border-bottom: 0.2mm solid #bbb;
  break-inside: avoid;
}
#pr .br:nth-child(5n) {
  border-bottom: 0.3mm solid #000;
}
#pr .bn {
  width: 8mm;
  text-align: center;
  font-size: 12px;
}
#pr .bb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 6.2mm;
  height: 6.2mm;
  border: 0.35mm solid #000;
  border-radius: 50%;
  font-size: 10px;
  line-height: 1;
  color: #000;
}
#pr .bxt {
  margin: 6mm 0 3mm;
  padding-top: 2mm;
  border-top: 0.4mm solid #000;
  font-weight: 700;
  font-size: 12.5px;
}
#pr .abx {
  position: relative;
  border: 0.35mm solid #000;
  margin-bottom: 3mm;
  break-inside: avoid;
}
#pr .abn {
  position: absolute;
  top: -0.35mm;
  right: -0.35mm;
  background: #000;
  color: #fff;
  padding: 0 2.5mm;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.7;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* پنل «چاپ…» (خارج از #pr؛ در چاپ پنهان می‌شود) */
#prpb {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(0, 0, 0, 0.12);
}
#prp {
  position: fixed;
  z-index: 100001;
  width: 340px;
  max-height: calc(100vh - 150px);
  overflow: auto;
  background: var(--cd);
  color: var(--fg);
  border: 1px solid var(--bd);
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
  padding: 14px 16px;
  font-size: 14px;
}
#prp.m {
  left: 0;
  right: 0;
  width: auto;
  border-radius: 16px 16px 0 0;
}
#prp .h {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  margin-bottom: 8px;
}
#prp .it {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  min-height: 40px;
  cursor: pointer;
}
#prp .it.dis,
#prp .sub.dis {
  opacity: 0.45;
  pointer-events: none;
}
#prp .cb {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--mu);
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  flex: none;
}
#prp .cb.on {
  background: var(--ac);
  border-color: var(--ac);
  color: var(--bg);
}
#prp .rd {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--mu);
  border-radius: 50%;
  display: inline-block;
  flex: none;
}
#prp .rd.on {
  border-color: var(--ac);
  background: radial-gradient(var(--ac) 45%, transparent 50%);
}
#prp .sub {
  display: flex;
  gap: 14px;
  margin: 0 26px 4px;
  font-size: 13px;
  color: var(--mu);
  align-items: center;
  flex-wrap: wrap;
}
#prp .sub .it {
  min-height: 0;
  padding: 2px 0;
}
#prp .sub.nt {
  margin-top: -4px;
}
#prp .sep {
  border-top: 1px solid var(--bd);
  margin: 8px 0;
}
#prp .sum {
  font-size: 12px;
  color: var(--mu);
  margin: 8px 0;
  line-height: 1.8;
}
#prp .row2 {
  display: flex;
  gap: 8px;
}

/* عکس دانش‌آموزان در تب برگهٔ امتحان + گزینهٔ غیرفعال «ویرایش بانک» */
.phg {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 8px;
  margin-top: 6px;
}
.phc2 {
  min-width: 0;
}
@media (max-width: 600px) {
  .phg {
    grid-template-columns: repeat(3, 1fr);
  }
}
.pht {
  aspect-ratio: 3 / 4;
  border: 1px dashed var(--bd);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg);
  color: var(--mu);
}
.pht img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.phn {
  font-size: 12px;
  text-align: center;
  margin: 4px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.phb {
  font-size: 12px;
  padding: 3px 8px;
}
.nv.dis {
  opacity: 0.42;
  cursor: not-allowed;
}
label.bgh {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--bd);
  border-radius: 10px;
  padding: 6px 12px;
  background: var(--cd);
  color: var(--ac);
  font-weight: 600;
  font-size: 13px;
}

/* کادر «اطلاعات سربرگ دانش‌آموزان»: نوار جمع‌وجور + پنجره، و انتخاب دانش‌آموز در سرتیتر پیش‌نمایش */
.pvbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.pvbar .sp,
.pvdh .sp {
  flex: 1;
}
.pvc {
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 99px;
  border: 1px solid var(--bd);
  color: var(--mu);
  white-space: nowrap;
}
.pvc.ok {
  color: var(--ok, #0a7a55);
  border-color: var(--ok, #0a7a55);
}
.pvc.w {
  color: #b45309;
  border-color: #b45309;
  background: rgba(180, 83, 9, 0.08);
}
#pvdb {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(0, 0, 0, 0.35);
}
#pvd {
  position: fixed;
  z-index: 100001;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(760px, 94vw);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: var(--cd);
  color: var(--fg);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}
#pvd .pvdh {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--bd);
}
#pvd .pvdbody {
  overflow: auto;
  padding: 6px 18px;
  flex: 1;
}
#pvd .pvt {
  max-height: none;
  border: 0;
  overflow: visible;
}
#pvd .pvdf {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 18px;
  border-top: 1px solid var(--bd);
}
#pvd .bgh.on {
  border-color: var(--ac);
  color: var(--ac);
}
.pvph {
  width: 34px;
  height: 44px;
  border: 1px dashed var(--bd);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  color: var(--mu);
  flex: none;
}
.pvph img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pvpk {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.pvpk select {
  max-width: 190px;
  padding: 4px 8px;
}
.pvpk .bgh {
  padding: 2px 10px;
}
