body { min-height: 100vh; min-height: 100dvh; }
#app { max-width: 760px; margin: 0 auto; padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }

.center-screen {
  min-height: calc(100dvh - 32px); display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; gap: .5rem;
}
.big-icon { font-size: 3.5rem; line-height: 1; margin-bottom: .5rem; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 8px 0 18px; }
.brand-logo img { display: block; width: 132px; height: auto; }
.brand-name { font-weight: 700; color: var(--muted); font-size: .9rem; }
.hero-logo img { display: block; width: 170px; height: auto; margin-bottom: 12px; }
.install { margin-top: 20px; width: 100%; }
.center-screen .install { max-width: 360px; }
.install-hint { text-align: center; margin-top: 20px; }

.exam-list { display: grid; gap: 12px; }
.exam-card {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); font: inherit; color: inherit; cursor: pointer;
}
.exam-card:hover:not(:disabled) { border-color: var(--primary); }
.exam-card:disabled { opacity: .6; cursor: default; }
.exam-card .title { font-size: 1.15rem; font-weight: 700; }
.exam-card .chev { margin-inline-start: auto; font-size: 1.4rem; color: var(--muted); }

.panel { max-width: 440px; margin: 8vh auto 0; }
.back { background: none; border: 0; color: var(--primary); font: inherit; font-weight: 600; padding: 8px 0; cursor: pointer; margin-bottom: 8px; }
.pin-input {
  font-size: 2rem; letter-spacing: .5em; text-align: center; font-variant-numeric: tabular-nums;
  padding-inline-start: .5em; direction: ltr;
}

.names { display: grid; gap: 8px; max-height: 55vh; overflow: auto; margin: 12px 0; padding: 2px; }
.name-btn {
  display: flex; align-items: center; gap: 10px; text-align: start; width: 100%;
  padding: 12px 14px; min-height: 52px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); font: inherit; cursor: pointer;
}
.name-btn:hover:not(:disabled) { border-color: var(--primary); }
.name-btn[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); }
.name-btn:disabled { opacity: .5; cursor: not-allowed; }
.name-btn .name { font-weight: 600; flex: 1; }

/* exam screen */
.exam-top {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  display: flex; align-items: center; gap: 10px; padding: 10px 0 12px; border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.exam-top .title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timer {
  margin-inline-start: auto; font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.25rem;
  padding: .2em .7em; border-radius: 10px; background: var(--surface-2); direction: ltr;
}
.timer.low { background: var(--danger-soft); color: var(--danger); }
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-bottom: 14px; }
.progress > div { height: 100%; background: var(--primary); transition: width .2s; }

.qnum { color: var(--muted); font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
/* Question text size follows the student's أ− / أ+ choice (--zoom on the card). */
.qcard { font-size: calc(1rem * var(--zoom, 1)); }
.qtools { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.qtools .qnum { margin: 0; flex: 1; min-width: 8em; }
.qtools .btn { min-height: 36px; padding: 4px 10px; font-size: .9rem; }
.qtext { font-size: 1.2em; font-weight: 600; margin-bottom: 16px; white-space: pre-wrap; unicode-bidi: plaintext; }
.options { display: grid; gap: 10px; }
.opt {
  display: flex; gap: 12px; align-items: flex-start; text-align: start; width: 100%;
  padding: 14px; min-height: 56px; border: 2px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text); font: inherit; cursor: pointer;
}
.opt:hover { border-color: color-mix(in srgb, var(--primary) 50%, var(--border)); }
.opt[aria-checked="true"] { border-color: var(--primary); background: var(--primary-soft); }
.opt .letter {
  flex: none; width: 1.9em; height: 1.9em; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); font-weight: 800; font-size: .9em;
}
.opt[aria-checked="true"] .letter { background: var(--primary); color: var(--primary-ink); }
.opt .otext { padding-top: 3px; unicode-bidi: plaintext; white-space: pre-wrap; }

.nav { display: flex; gap: 10px; margin-top: 20px; }
.nav .btn { flex: 1; white-space: nowrap; padding-inline: .5em; }
.save-state { font-size: .85rem; color: var(--muted); text-align: center; margin-top: 10px; min-height: 1.4em; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 8px; margin: 12px 0; }
.grid button {
  min-height: 46px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; font-weight: 700; cursor: pointer;
}
.grid button.answered { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.grid button.current { outline: 2px solid var(--text); outline-offset: 1px; }
.legend { display: flex; gap: 14px; font-size: .85rem; color: var(--muted); }

.overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(24, 33, 28, .92);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.overlay-box { background: var(--surface); color: var(--text); border-radius: 16px; padding: 26px; max-width: 420px; width: 100%; text-align: center; }
.overlay-icon { font-size: 3rem; margin-bottom: 6px; }

.net {
  position: fixed; top: 0; inset-inline: 0; z-index: 200; background: var(--warn); color: #000;
  text-align: center; font-weight: 700; padding: 8px; font-size: .9rem;
}

/* while answering: no text selection */
body.exam-mode { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
body.exam-mode input { -webkit-user-select: text; user-select: text; }
