/* ═══════════════════════════════════════════════════════════════
   EXAM PORTAL — student pages (Atlas)
   Shared tokens, plates, buttons and markers live in atlas.css.
   This file is only the layout of the five student pages.
══════════════════════════════════════════════════════════════════ */

/* ── Pages ──────────────────────────────────────────────────────── */
.page { display: none; min-height: 100vh; }
.page.active { display: block; }
.page-center.active { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: 1.5rem 1rem 2.5rem; }

/* ── Brand bar ──────────────────────────────────────────────────── */
.brandbar { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.5rem; }
.brand-pill {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: .65rem; padding: .35rem 1.1rem .35rem .4rem; border-radius: 999px;
  background: var(--plate); border: 1px solid var(--line); box-shadow: var(--shadow-soft);
}
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 50%;
  background: var(--fill); color: var(--on-fill); font: 700 13px/1 var(--font); letter-spacing: .02em;
}
.brand-names { min-width: 0; line-height: 1.15; }
.brand-institution { font: 600 11.5px/1.2 var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-portal { font: 700 16px/1.2 var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── The sign-in pages: the school's logo (or initials) as a large crest over the form ── */
.gate-top { margin-bottom: 1.4rem; }
.gate-tools { display: flex; justify-content: flex-end; gap: .5rem; }
.gate-crest { display: grid; justify-items: center; gap: .25rem; margin-top: -.4rem; text-align: center; }
.brand-mark.crest { width: 84px; height: 84px; font-size: 28px; margin-bottom: .55rem; box-shadow: 0 0 0 7px var(--map-2); }
.brand-mark.crest.has-logo { box-shadow: 0 0 0 7px var(--map-2), inset 0 0 0 1px rgba(18, 51, 42, .12); }
.crest-inst { font: 600 11.5px/1.2 var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); overflow-wrap: anywhere; }
.crest-portal { font: 800 1.25rem/1.2 var(--font); letter-spacing: -.02em; overflow-wrap: anywhere; }
@media (max-width: 560px) { .brand-mark.crest { width: 76px; height: 76px; font-size: 26px; } }

/* ── Gate pages (waiting / start / status) ──────────────────────── */
.gate { width: 100%; max-width: 540px; padding: 1.4rem 1.6rem 1.8rem; box-shadow: var(--shadow-pop); }
.gate-marker { display: flex; align-items: center; gap: .75rem; margin-bottom: .9rem; }
.gate-title { font-size: 2rem; line-height: 1.08; letter-spacing: -.03em; overflow-wrap: anywhere; margin-bottom: .4rem; }
.gate .chips { margin-top: 1rem; }
.form { margin-top: 1.5rem; display: grid; gap: 1.15rem; }
.field label { display: block; font: 600 14px/1.3 var(--font); margin: 0 0 .4rem; padding-inline: .6rem; }
.rules { background: var(--plate-2); border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 1rem 1.2rem; }
.rules-title { display: flex; align-items: center; gap: .5rem; font: 700 16px var(--font); margin-bottom: .65rem; }
.rules-title .icon { color: var(--brand-ink); }
.rules ul { display: grid; gap: .6rem; font-size: .92rem; color: var(--ink-2); }
.rules li { position: relative; padding-inline-start: 1.6rem; }
.rules li::before { content: ""; position: absolute; inset-inline-start: 0; top: .42em; width: 12px; height: 12px; border-radius: 50%; border: 2.5px solid var(--route); }
.rules b { color: var(--ink); }
.check { display: flex; gap: .7rem; align-items: center; margin-top: 1rem; font: 600 15px var(--font); cursor: pointer; }
.form .go-row { justify-self: start; margin-top: .2rem; }

.countdown { display: flex; gap: .6rem; margin: 1.4rem 0 1rem; }
.cd-unit { flex: 1; text-align: center; padding: .9rem .2rem; background: var(--plate-2); border: 1.5px solid var(--line); border-radius: var(--r-md); }
.cd-num { display: block; font: 700 2rem/1.1 var(--font); font-variant-numeric: tabular-nums; }
.cd-lbl { font: 600 12px var(--font); color: var(--ink-2); text-transform: uppercase; letter-spacing: .1em; }

.status-card { text-align: center; }
.status-icon {
  display: grid; place-items: center; width: 68px; height: 68px; margin: 0 auto 1rem; border-radius: 50%;
  background: var(--plate); border: 3.5px solid var(--ink); color: var(--ink);
}
.status-icon .icon { width: 30px; height: 30px; stroke-width: 2.4; }
.status-icon.ok   { background: var(--fill); border-color: var(--fill); color: var(--on-fill); }
.status-icon.bad  { border-color: var(--bad);  color: var(--bad); }
.status-icon.warn { border-color: var(--flag); color: var(--warn); }
.status-card .gate-title { margin-bottom: .5rem; }
.status-actions { margin-top: 1.4rem; }
.dialog .status-icon { margin-bottom: .8rem; }
.dialog-actions .go-row .go { width: 52px; height: 52px; }

/* ── Exam screen ────────────────────────────────────────────────── */
#page-exam.active { display: block; padding-bottom: calc(128px + env(safe-area-inset-bottom, 0px)); }
.exam-wrap { max-width: 700px; margin: 0 auto; padding: max(1rem, env(safe-area-inset-top, 0px)) 1rem 0; }
.x-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.x-titles { min-width: 0; }
.x-title { font: 700 1.3rem/1.15 var(--font); letter-spacing: -.015em; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.x-sub { display: flex; align-items: center; gap: .35rem; font-size: .9rem; color: var(--ink-2); margin-top: .25rem; }
.x-sub span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.x-head-right { display: flex; align-items: center; gap: .7rem; flex: none; }

/* the stopwatch ring */
.timer-ring {
  --p: 100; position: relative; display: grid; place-items: center; flex: none; width: 70px; height: 70px; border-radius: 50%;
  background: conic-gradient(var(--ink) calc(var(--p) * 1%), var(--line) 0);
}
.timer-ring::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--plate); box-shadow: var(--shadow-soft); }
.timer-face { position: relative; text-align: center; font: 700 17px/1 var(--font); font-variant-numeric: tabular-nums; }
.timer-face em { display: block; margin-top: 3px; font: 600 12px var(--font); font-style: normal; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.timer-ring.long .timer-face { font-size: 14px; }
.timer-ring.warn   { background: conic-gradient(var(--flag) calc(var(--p) * 1%), var(--line) 0); }
.timer-ring.urgent { background: conic-gradient(var(--bad) calc(var(--p) * 1%), var(--line) 0); animation: pulse 1.2s ease-in-out infinite; }
.timer-ring.urgent .timer-face { color: var(--bad); }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--bad) 22%, transparent); } }

/* the route: one stop per question (indicators only) */
.x-route { --p: 0; position: relative; height: 28px; margin: 0 12px; }
.x-route-line { position: absolute; inset-inline: 0; top: 50%; margin-top: -1.5px; border-top: 3px dotted var(--lock); }
.x-route-fill { position: absolute; inset-inline-start: 0; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px; background: var(--route); width: calc(var(--p) * 100%); transition: width .3s ease; }
#route-nodes { position: absolute; inset: 0; }
.rn {
  position: absolute; inset-inline-start: calc(var(--k) * 100%); top: 50%; width: 10px; height: 10px; margin-top: -5px; margin-inline-start: -5px;
  border-radius: 50%; background: var(--plate); border: 2px solid var(--lock); z-index: 1;
}
.rn.answered { background: var(--fill); border-color: var(--fill); }
.rn.flagged { border-radius: 2px; transform: rotate(45deg); background: var(--flag); border-color: var(--flag); width: 11px; height: 11px; }
.rn.current {
  width: 24px; height: 24px; margin-top: -12px; margin-inline-start: -12px; background: var(--plate); border: 3.5px solid var(--route);
  box-shadow: 0 0 0 5px var(--route-soft); z-index: 2; transform: none; border-radius: 50%;
}
.rn.current::before { content: ""; position: absolute; inset: 3.5px; border-radius: 50%; background: var(--route); }
.x-route.dense .rn:not(.current):not(.flagged) { display: none; }
.x-route-labels { display: flex; justify-content: space-between; font-size: .9rem; color: var(--ink-2); margin: .4rem 4px 0; }

/* the question plate points at the pin */
.x-q { margin-top: 1.1rem; padding: 1.1rem 1.3rem 1.35rem; }
.x-q.pt-top::before { inset-inline-start: calc(12px + var(--k, .3) * (100% - 24px) - 7px); }
.x-q.enter { animation: enter .22s ease-out; }
.x-q.enter-back { animation: enter-back .22s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes enter-back { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
.x-q-meta { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .65rem; }
.q-text { font: 600 1.4rem/1.28 var(--font); letter-spacing: -.012em; white-space: pre-wrap; overflow-wrap: anywhere; }

/* answers are signposts */
.options { display: grid; gap: .8rem; margin-top: 1.15rem; }
.option-btn {
  position: relative; display: flex; align-items: center; gap: .9rem; width: 100%; min-height: 64px; padding: .65rem 3rem .65rem .95rem; border: 0;
  background: transparent; color: var(--ink); text-align: start; font: 600 19px/1.28 var(--font);
  filter: drop-shadow(0 4px 0 color-mix(in srgb, var(--ink) 16%, transparent)); transition: transform .1s;
}
.option-btn::before, .option-btn::after { content: ""; position: absolute; z-index: 0; }
.option-btn::before { inset: 0; background: var(--lock); border-radius: 18px 0 0 18px; clip-path: polygon(0 0, calc(100% - 26px) 0, 100% 50%, calc(100% - 26px) 100%, 0 100%); }
.option-btn::after { inset: 2.5px; background: var(--plate); border-radius: 16px 0 0 16px; clip-path: polygon(0 0, calc(100% - 25px) 0, 100% 50%, calc(100% - 25px) 100%, 0 100%); }
.option-btn > * { position: relative; z-index: 1; }
@media (hover: hover) { .option-btn:hover::before { background: var(--ink); } }
.option-btn:active { transform: translateY(2px); }
.option-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; border-radius: 14px; }
.option-letter {
  display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 50%; border: 2.5px solid var(--ink);
  font: 700 15px/1 var(--font); color: var(--ink);
}
.option-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.option-check { display: none; flex: none; }
.option-btn.selected { color: var(--on-fill); }
.option-btn.selected::before, .option-btn.selected::after { background: var(--fill); }
.option-btn.selected .option-letter { background: var(--on-fill); color: var(--fill); border-color: var(--on-fill); }
.option-btn.selected .option-check { display: block; }
/* right-to-left: the signpost points the other way */
[dir="rtl"] .option-btn { padding: .65rem .95rem .65rem 3rem; }
[dir="rtl"] .option-btn::before { border-radius: 0 18px 18px 0; clip-path: polygon(100% 0, 26px 0, 0 50%, 26px 100%, 100% 100%); }
[dir="rtl"] .option-btn::after  { border-radius: 0 16px 16px 0; clip-path: polygon(100% 0, 25px 0, 0 50%, 25px 100%, 100% 100%); }

.type-note { display: flex; align-items: center; gap: .45rem; font-size: .92rem; color: var(--ink-2); margin-bottom: .6rem; padding-inline: .4rem; }
.answer-input {
  width: 100%; padding: .95rem 1.2rem; background: var(--plate); border: 2px solid var(--line-strong); border-radius: var(--r-md);
  font: 500 17px/1.5 var(--font); color: var(--ink); transition: border-color .12s, box-shadow .12s;
}
.answer-input::placeholder { color: color-mix(in srgb, var(--ink-2) 78%, transparent); }
textarea.answer-input { min-height: 200px; resize: vertical; }
.answer-input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ink) 20%, transparent); }

.x-status { display: flex; justify-content: center; flex-wrap: wrap; gap: .6rem; margin-top: 1.4rem; }
.monitor-pill { background: var(--plate); color: var(--ink); box-shadow: var(--shadow-soft); font-size: 13.5px; padding: .42rem 1rem; }
.monitor-pill.chip-warn { background: var(--warn-bg); color: var(--warn); }

/* the round buttons: Back, Questions, Flag, Next */
.x-foot {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 30; padding: 10px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--map) 90%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
}
.x-foot-in { max-width: 700px; margin: 0 auto; display: flex; align-items: flex-end; justify-content: space-between; gap: .4rem; }
.rbtn { display: grid; justify-items: center; gap: 6px; min-width: 64px; padding: 2px 4px; border: 0; background: none; color: var(--ink); font: 600 13px/1.1 var(--font); }
.rbtn .mini { width: 54px; height: 54px; box-shadow: 0 4px 0 color-mix(in srgb, var(--ink) 20%, transparent); }
@media (hover: hover) { .rbtn:hover:not(:disabled) .mini { background: var(--map-2); } }
.rbtn:active:not(:disabled) .mini { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--ink) 20%, transparent); }
.rbtn:disabled { color: var(--lock); cursor: not-allowed; }
.rbtn:disabled .mini { border-style: dashed; border-color: var(--lock); color: var(--lock); box-shadow: none; background: transparent; }
.rbtn[aria-pressed="true"] .mini { background: var(--warn-bg); border-color: var(--flag); color: var(--warn); }
.rbtn:focus-visible { outline-offset: 2px; border-radius: 16px; }
@media (hover: hover) { .rbtn-go:hover:not(:disabled) .go { transform: translateY(-2px); box-shadow: 0 8px 0 var(--go-deep); } }
.rbtn-go:active:not(:disabled) .go { transform: translateY(4px); box-shadow: 0 2px 0 var(--go-deep); }

/* the question list opens as a sheet */
.palette { position: fixed; inset: 0; z-index: 120; display: none; align-items: flex-end; justify-content: center; background: var(--scrim); }
.palette.open { display: flex; animation: fade .16s ease-out; }
.palette-card { width: 100%; max-width: 680px; max-height: 82vh; overflow: auto; border: 0; border-radius: 28px 28px 0 0; padding: 1rem 1.4rem calc(1.4rem + env(safe-area-inset-bottom, 0px)); box-shadow: var(--shadow-pop); animation: sheet .22s ease-out; }
.palette-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .9rem; }
.palette-head h3 { font-size: 1.25rem; }
.palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: .55rem; max-height: 46vh; overflow: auto; padding: 8px 6px; }
.dot {
  position: relative; height: 48px; border-radius: 50%; background: var(--plate); border: 2.5px solid var(--lock); color: var(--ink);
  font: 700 14px var(--font); font-variant-numeric: tabular-nums;
}
@media (hover: hover) { .dot:hover { background: var(--map-2); } }
.dot.answered { background: var(--fill); color: var(--on-fill); border-color: var(--fill); }
.dot.current { border-color: var(--route); box-shadow: 0 0 0 4px var(--route-soft); }
.dot.flagged::after { content: ""; position: absolute; top: -5px; inset-inline-end: -5px; width: 12px; height: 12px; border-radius: 2px; transform: rotate(45deg); background: var(--flag); border: 2px solid var(--plate); }
.legend { display: flex; flex-wrap: wrap; gap: .5rem 1.3rem; margin-top: 1rem; font-size: .88rem; color: var(--ink-2); }
.legend li { display: flex; align-items: center; gap: .5rem; }
.dot-sample { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid var(--lock); background: var(--plate); }
.dot-sample.answered { background: var(--fill); border-color: var(--fill); }
.dot-sample.flagged { border-radius: 3px; transform: rotate(45deg); background: var(--flag); border-color: var(--flag); width: 14px; height: 14px; }

.watermark { position: fixed; inset: 0; z-index: 90; pointer-events: none; background-repeat: repeat; }

/* ── Results ────────────────────────────────────────────────────── */
.results-wrap { max-width: 760px; margin: 0 auto; padding: 1.2rem 1rem 3.5rem; display: grid; gap: 1.5rem; }
.results-hero { padding: 1.4rem 1.6rem 1.8rem; box-shadow: var(--shadow-pop); }
.score-block { display: grid; grid-template-columns: 170px 1fr; gap: 1.6rem; align-items: center; margin-top: 1.5rem; }
.ring { position: relative; width: 170px; height: 170px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg, .ring-fill { fill: none; stroke-width: 11; }
.ring-bg { stroke: var(--map-2); }
.ring-fill { stroke: var(--route); stroke-linecap: round; transition: stroke-dashoffset 1.1s cubic-bezier(.2, .8, .2, 1); }
.ring-fill.ok { stroke: var(--ok); } .ring-fill.mid { stroke: var(--flag); } .ring-fill.bad { stroke: var(--bad); }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-pct { font: 800 2.3rem/1 var(--font); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.ring-score { font-size: .9rem; color: var(--ink-2); margin-top: .3rem; font-variant-numeric: tabular-nums; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .65rem; }
.stat { padding: .85rem 1.1rem; border-radius: var(--r-md); display: grid; }
.stat-num { font: 700 1.7rem/1.1 var(--font); font-variant-numeric: tabular-nums; }
.stat-lbl { font: 600 12px var(--font); text-transform: uppercase; letter-spacing: .08em; }
.stat-ok { background: var(--ok-bg); color: var(--ok); } .stat-bad { background: var(--bad-bg); color: var(--bad); }
.stat-warn { background: var(--warn-bg); color: var(--warn); } .stat-info { background: var(--info-bg); color: var(--info); }
.verdict { margin-top: 1.2rem; font: 700 1.1rem var(--font); text-align: center; }
.verdict.pass { color: var(--ok); } .verdict.fail { color: var(--bad); }
.results-hero .notice { margin-top: 1rem; }
.section-title { font-size: 1.4rem; margin-bottom: 1rem; }
.review-item { overflow: hidden; }
.review-item-header { display: flex; gap: .75rem; align-items: flex-start; padding: .95rem 1.1rem; border-bottom: 1px solid var(--line); }
.review-q-num { flex: none; font: 700 12px var(--font); padding: .22rem .65rem; border-radius: 999px; background: var(--map-2); color: var(--ink-2); }
.review-q-text { flex: 1; font: 600 1rem/1.4 var(--font); overflow-wrap: anywhere; white-space: pre-wrap; }
.review-status-badge { flex: none; font: 700 12px var(--font); padding: .22rem .7rem; border-radius: 999px; }
.badge-correct { background: var(--ok-bg); color: var(--ok); } .badge-wrong { background: var(--bad-bg); color: var(--bad); }
.badge-skipped { background: var(--warn-bg); color: var(--warn); } .badge-pending { background: var(--info-bg); color: var(--info); }
.review-options { display: grid; gap: .4rem; padding: .85rem 1.1rem 1rem; }
.review-option { display: flex; gap: .7rem; align-items: flex-start; padding: .5rem .75rem; border-radius: 12px; border: 1.5px solid transparent; font-size: .95rem; color: var(--ink-2); }
.review-option.correct-ans { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.review-option.wrong-ans   { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.review-opt-letter { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; border: 2px solid currentColor; font: 700 12px var(--font); }
.review-text-answer { display: grid; gap: .65rem; padding: .9rem 1.1rem 1rem; }
.review-text-row { display: grid; gap: .15rem; }
.review-text-label { font: 600 12px var(--font); text-transform: uppercase; letter-spacing: .1em; color: var(--ink-2); }
.review-text-value { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .97rem; }
.review-text-value.correct-text { color: var(--ok); } .review-text-value.wrong-text { color: var(--bad); }

/* ── Small screens ──────────────────────────────────────────────── */
@media (max-width: 560px) {
  .gate, .results-hero { padding: 1.2rem 1.2rem 1.5rem; }
  .gate-title { font-size: 1.7rem; }
  .q-text { font-size: 1.25rem; }
  .option-btn { font-size: 18px; }
  .score-block { grid-template-columns: 1fr; justify-items: center; }
  .stat-grid { width: 100%; }
  .cd-num { font-size: 1.5rem; }
  .rbtn { min-width: 56px; }
  .review-item-header { flex-wrap: wrap; }
}
@media (min-width: 900px) {
  .x-title { font-size: 1.45rem; }
  .q-text { font-size: 1.55rem; }
  .option-btn { font-size: 20px; min-height: 68px; }
}

/* Students cannot print the exam (the teacher's pages can be printed, so this is not in atlas.css) */
@media print { body > * { display: none !important; } body::before { content: "Printing is disabled."; display: block; padding: 2rem; position: static; } }

/* ── Student account pages (join, sign in, my classes) ──────────── */
.stack { display: grid; gap: 1rem; margin-top: 1.2rem; }
.hint { margin: .35rem 0 0; padding-inline: .6rem; font-size: .85rem; color: var(--ink-2); }
.who { display: flex; align-items: center; gap: .5rem; padding: .7rem 1rem; border-radius: var(--r-md); background: var(--plate-2); border: 1.5px solid var(--line); overflow-wrap: anywhere; }
.who .icon { color: var(--brand-ink); }
.small-check { margin-top: -.3rem; font-size: 14px; }
.form .link { justify-self: start; }
.foot-links { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--map-2); }
.seg button { border: 0; background: transparent; border-radius: 999px; padding: .55rem 1rem; min-height: 44px; font: 600 15px var(--font); color: var(--ink-2); }
.seg button[aria-selected="true"] { background: var(--plate); color: var(--ink); box-shadow: var(--shadow-soft); }
.seg-wide { display: flex; margin-top: 1.4rem; }
.seg-wide button { flex: 1; }
#join-anon .form { margin-top: 1.2rem; }
.me-wrap { max-width: 640px; margin: 0 auto; padding: 1.2rem 1rem 3rem; display: grid; gap: 1.4rem; }
.me-head { padding: 1.4rem 1.6rem 1.6rem; box-shadow: var(--shadow-pop); }
.me-head .chips { margin-top: .6rem; }
.me-actions, .row-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.2rem; align-items: center; }
.me-class { padding: 1rem 1.2rem; }
.me-class-name { font: 700 1.2rem/1.2 var(--font); overflow-wrap: anywhere; }
.me-empty { display: grid; gap: .6rem; justify-items: start; padding: 1.4rem 1.5rem; }
@media (max-width: 560px) { .me-head { padding: 1.2rem 1.2rem 1.4rem; } }
.me-route:has(> li:only-child)::before { display: none; }
/* a personal invite: who the account is for, then the password */
.wel-facts { display: grid; gap: .5rem; margin: 1.1rem 0 .4rem; padding: .85rem 1rem; border-radius: var(--r-md); background: var(--plate-2); border: 1.5px solid var(--line); }
.wel-fact { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .1rem 1rem; }
.wel-fact dt { font-size: .85rem; color: var(--ink-2); }
.wel-fact dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
#wel-id { font-size: 1.15rem; letter-spacing: .04em; }
#wel-classes { margin-top: .3rem; }
.wel-news { align-items: flex-start; font-weight: 500; line-height: 1.4; }
.wel-news input { margin-top: 2px; flex: none; }
.me-news { margin-top: 1rem; font-weight: 500; }
.me-head .chips .chip span { overflow-wrap: anywhere; }

/* ── A student's class page ─────────────────────────────────────── */
a.me-class { display: flex; align-items: center; gap: 1rem; justify-content: space-between; color: var(--ink); text-decoration: none; }
a.me-class:focus-visible { outline-offset: 4px; border-radius: var(--r-lg); }
@media (hover: hover) { a.me-class:hover .go { transform: translateY(-2px); box-shadow: 0 6px 0 var(--go-deep); } }
.me-class-text { min-width: 0; }
.back-link { display: inline-flex; align-items: center; gap: .4rem; margin-bottom: .9rem; color: var(--ink); font: 600 15px var(--font); text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.cl-progress { margin-top: .2rem; }
.me-head .seg-wide { margin-top: 1.2rem; }
.tab-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; margin-inline-start: .3rem; border-radius: 99px; background: var(--go); color: var(--on-go); font: 700 12px/1 var(--font); }
.cl-route { gap: 1.1rem; }
.cl-lesson { padding: 1rem 1.2rem 1.15rem; }
.cl-lesson-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .2rem; }
.cl-lesson-title { font-size: 1.25rem; overflow-wrap: anywhere; }
.cl-lesson-sum { margin-top: .3rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.mats { display: grid; gap: .55rem; margin-top: .9rem; }
.mat-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem 1rem; flex-wrap: wrap; padding: .6rem .8rem; border-radius: var(--r-md); background: var(--plate-2); border: 1.5px solid var(--line); }
.mat-name { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; min-width: 0; }
.mat-name > .icon { color: var(--brand-ink); }
.mat-title { font-weight: 600; overflow-wrap: anywhere; }
.mat-meta { font-size: .85rem; color: var(--ink-2); overflow-wrap: anywhere; }
.mat-acts { display: flex; gap: .45rem; flex-wrap: wrap; }
.cl-more { padding: 1rem 1.3rem; color: var(--ink-2); }
.cl-exams { display: grid; gap: 1rem; }
.cl-exam { display: grid; gap: .8rem; padding: 1.1rem 1.3rem 1.2rem; }
.cl-exam.is-open { border: 2px solid var(--route); }
.cl-exam-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .8rem; }
.cl-exam-titles { min-width: 0; }
.cl-exam-title { font-size: 1.25rem; overflow-wrap: anywhere; }
.cl-exam-result { font: 600 1rem var(--font); }
#cl-lessons-panel, #cl-exams-panel { display: grid; gap: 1.1rem; }
#cl-lessons-panel.hidden, #cl-exams-panel.hidden { display: none; }
.form-fields { display: grid; gap: 1.15rem; }
/* labs on the class page */
.cl-labs { display: grid; gap: 1rem; }
.cl-lab { display: grid; gap: .55rem; padding: 1.1rem 1.3rem 1.2rem; }
.lab-steps-label { margin-top: .4rem; }
.lab-pre { margin: 0; padding: .9rem 1rem; max-height: 420px; overflow: auto; border-radius: var(--r-md); background: var(--plate-2); border: 1.5px solid var(--line);
  font: 14px/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); -webkit-user-select: text; user-select: text; }
.mat-sha { flex-basis: 100%; display: flex; gap: .5rem; align-items: baseline; min-width: 0; }
.mat-sha code { font: 12px var(--mono); color: var(--ink-2); overflow-wrap: anywhere; -webkit-user-select: all; user-select: all; }
#cl-labs-panel { display: grid; gap: 1.1rem; }
#cl-labs-panel.hidden { display: none; }
.seg-wide button { padding-inline: .6rem; }

/* ── Arabic and right-to-left ───────────────────────────────────── */
.lang-btn { font: 700 15px/1 var(--font); }
[lang="ar"] .lang-btn { font-size: 13px; letter-spacing: .02em; }
/* Arabic letters join: spacing them out (headings, labels) would break the words apart */
[lang="ar"] body, [lang="ar"] body * { letter-spacing: 0 !important; }
[lang="ar"] .label { text-transform: none; font-size: 13px; }
[lang="ar"] body { line-height: 1.6; }
/* IDs, codes and passwords are Latin: typed left to right, kept on the reading side of the field */
[dir="rtl"] .ltr { direction: ltr; text-align: right; }
[dir="rtl"] .ltr::placeholder { text-align: right; }
/* the next question slides in from the reading direction */
[dir="rtl"] .x-q.enter { animation-name: enter-back; }
[dir="rtl"] .x-q.enter-back { animation-name: enter; }
.review-mine { margin-inline-start: auto; flex: none; font: 600 .82rem var(--font); }
.status-lang { margin-top: 1.1rem; }
/* short things the teacher wrote in English (titles, names, answer options) still line up with the Arabic page;
   long English text (questions, lab steps) keeps its own left alignment so it reads naturally */
[dir="rtl"] .gate-title[dir="auto"], [dir="rtl"] .cl-lesson-title, [dir="rtl"] .cl-exam-title, [dir="rtl"] .me-class-name,
[dir="rtl"] .me-class-text .muted, [dir="rtl"] .option-text, [dir="rtl"] .x-title, [dir="rtl"] .cl-lesson-sum { text-align: right; }

/* ── A class's lectures: the next one above the tabs, all of them in their tab ── */
.cl-next { padding: 1.1rem 1.3rem 1.2rem; display: grid; gap: .35rem; }
.cl-next-top { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.cl-next-when { margin: 0; font: 700 1.15rem/1.3 var(--font); }
.cl-next-what { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.cl-next-note { margin: 0; }
.cl-next-acts { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .5rem; }
.cl-next-acts .btn { display: inline-flex; align-items: center; gap: .45rem; text-decoration: none; }
.cl-att { margin: .3rem 0 0; }
.cl-lectures { display: grid; gap: .8rem; }
.cl-lec-when { margin: .1rem 0 0; font-weight: 600; }
.cl-lesson.is-next { box-shadow: 0 0 0 2px var(--route), var(--shadow-plate); }
.me-next { margin-top: .25rem; font-size: .88rem; font-weight: 600; color: var(--route); }
/* four class tabs (Lessons, Lectures, Labs, Exams) fit a narrow phone in both languages */
.seg-wide button { min-width: 0; }
@media (max-width: 430px) { .seg-wide button { padding-inline: .45rem; font-size: 14px; } }

/* ═══════════════════════════════════════════════════════════════════════
   COMPUTERS (a wide screen with a mouse): the student pages use the width.
   Phones and tablets keep the layout above, unchanged.
   · My classes and a class: a top bar (brand, language, theme, the student's menu);
     a class: its sections on the left, a side column (next lecture, open exams, progress) that stays in view;
     My classes: "Up next" and the classes side by side, the account card on the side.
   · Sign-in, invite and password pages: a calm panel on one half, the form on the other.
═══════════════════════════════════════════════════════════════════════ */
.topbar, .gate-side, .me-classes-h, .me-upnext, .side-card { display: none; }

/* ── The sign-in pages' brand half (the same look as the teacher's sign-in) ──
   The school's colour (--go / --on-go: the brand colour nudged to stay readable in each theme), a welcome, and on a
   computer a drawing of a phone with an exam. On a phone or tablet it is a band over the form, which overlaps it. */
body[data-shell="gate"] .gate-side { display: block; position: relative; overflow: hidden; background: var(--go); color: var(--on-go); }
.gate-side::before, .gate-side::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.gate-side::before { width: 46vmax; height: 46vmax; inset-inline-end: -16vmax; top: -18vmax; background: color-mix(in srgb, var(--go) 86%, var(--on-go)); }
.gate-side::after  { width: 30vmax; height: 30vmax; inset-inline-start: -12vmax; bottom: -14vmax; background: color-mix(in srgb, var(--go) 82%, #000); }
.gate-side-in { position: relative; z-index: 1; display: grid; gap: .9rem; padding: 1.2rem 1.25rem 3.2rem; }
.gate-side-inst { font: 600 11.5px/1.2 var(--font); letter-spacing: .12em; text-transform: uppercase; opacity: .85; overflow-wrap: anywhere; }
.gate-side-portal { font: 800 1.05rem/1.2 var(--font); overflow-wrap: anywhere; }
.gs-kicker { margin: 0 0 .3rem; font: 700 12px var(--font); letter-spacing: .14em; text-transform: uppercase; opacity: .85; }
.gs-hello { margin: 0 0 .35rem; font: 800 2rem/1.05 var(--font); letter-spacing: -.03em; }
.gate-side-line { margin: 0; font-size: 1rem; line-height: 1.45; max-width: 26rem; }
.gs-art { display: none; }
body[data-shell="gate"] .page-center.active { min-height: 0; justify-content: flex-start; padding-top: 0; }
body[data-shell="gate"] .page-center.active > .gate { margin-top: -2rem; position: relative; z-index: 2; }
body[data-shell="gate"] .gate-crest .crest-inst, body[data-shell="gate"] .gate-crest .crest-portal { display: none; }   /* the brand half already names the portal */

/* the drawing: painted with the theme's own colours, so the night theme gets a night drawing */
.sa-body { fill: var(--ink); }
.sa-screen { fill: var(--plate); }
.sa-notch { fill: color-mix(in srgb, var(--plate) 30%, var(--ink)); }
.sa-ink { fill: var(--ink); }
.sa-ink2, .sa-optl { fill: color-mix(in srgb, var(--ink) 35%, var(--plate)); }
.sa-opt { fill: var(--plate-2); stroke: var(--line); stroke-width: 1.2; }
.sa-pick { fill: var(--ink); stroke: var(--ink); }
.sa-pickl { fill: var(--plate); }
.sa-tick { fill: none; stroke: var(--plate); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 18; stroke-dashoffset: 0; }
.sa-go { fill: var(--go); }
.sa-badge circle { fill: var(--plate); stroke: var(--on-go); stroke-width: 3; }
.sa-badge text { font: 800 22px var(--font); fill: var(--brand-ink); }
.sa-star path { fill: var(--on-go); opacity: .9; }

/* small motion: the card and the welcome arrive, an answer gets chosen and ticked, the A+ floats.
   Nothing moves for anyone whose device asks for reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  body[data-shell="gate"] .page-center.active > .gate { animation: gs-in .5s cubic-bezier(.2, .8, .2, 1) both; }
  body[data-shell="gate"] .gs-welcome { animation: gs-in .6s .08s cubic-bezier(.2, .8, .2, 1) both; }
  .sa-pick { animation: sa-pick .45s 1s ease-out both; }
  .sa-pickl { animation: sa-pickl .45s 1s ease-out both; }
  .sa-tick { animation: sa-tick .5s 1.45s ease-out both; }
  .sa-badge { animation: sa-float 4.5s 2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
  .sa-star { animation: sa-twinkle 3.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
  .gs-phone { animation: sa-bob 6s ease-in-out infinite; }
  @keyframes gs-in { from { opacity: 0; transform: translateY(12px); } }
  @keyframes sa-pick { from { fill: var(--plate-2); stroke: var(--line); } }
  @keyframes sa-pickl { from { fill: color-mix(in srgb, var(--ink) 35%, var(--plate)); } }
  @keyframes sa-tick { from { stroke-dashoffset: 18; } }
  @keyframes sa-float { 50% { transform: translateY(-7px) rotate(-5deg); } }
  @keyframes sa-twinkle { 50% { transform: scale(.75) rotate(20deg); opacity: .6; } }
  @keyframes sa-bob { 50% { transform: translateY(-4px); } }
}
.cl-side { display: contents; }                       /* phones: the next-lecture card sits where it always did */
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: .55rem; min-height: 44px; padding: .25rem .75rem .25rem .3rem; border-radius: 999px; border: 1.5px solid var(--line-strong);
  background: var(--plate); color: var(--ink); font: 600 15px var(--font); cursor: pointer; }
.user-btn .icon { width: 16px; height: 16px; color: var(--ink-2); }
.user-av { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--map-2); font: 700 13px var(--font); }
.user-name { max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-pop { position: absolute; inset-inline-end: 0; top: calc(100% + .5rem); min-width: 250px; padding: .45rem; display: grid; gap: .1rem; z-index: 40; box-shadow: var(--shadow-pop); }
.user-who { display: grid; gap: .1rem; padding: .5rem .7rem .7rem; margin-bottom: .25rem; border-bottom: 1px solid var(--line); }
.user-who .mono { font-size: .85rem; color: var(--ink-2); }
.user-item { display: flex; align-items: center; gap: .65rem; width: 100%; padding: .6rem .7rem; border: 0; border-radius: var(--r-sm); background: none;
  color: var(--ink); font: 600 15px var(--font); text-decoration: none; text-align: start; cursor: pointer; }
.user-item .icon { width: 18px; height: 18px; color: var(--ink-2); }
@media (hover: hover) { .user-item:hover { background: var(--map-2); } }

@media (min-width: 1024px) and (hover: hover) and (pointer: fine) {
  /* the top bar */
  body[data-shell="app"] .topbar { display: block; position: sticky; top: 0; z-index: 30; background: var(--map); border-bottom: 1px solid var(--line); }
  .topbar-in { max-width: 1240px; margin: 0 auto; padding: .65rem 1.5rem; display: flex; align-items: center; gap: .7rem; }
  .topbar .brandbar { flex: 1; margin: 0; }
  .topbar .brand-pill { flex: 0 1 auto; box-shadow: none; }
  .topbar .js-lang { margin-inline-start: auto; }
  body[data-shell="app"] .me-head .brandbar { display: none; }

  /* My classes */
  #page-me .me-wrap { max-width: 1240px; padding: 1.8rem 1.5rem 3rem; grid-template-columns: minmax(0, 1fr) 360px; column-gap: 2rem; row-gap: 0; align-items: start;
    grid-template-areas: "notice side" "upnext side" "classesh side" "classes side" "empty side" "foot side"; }
  #page-me .me-head { grid-area: side; position: sticky; top: 92px; margin-bottom: 1.2rem; }
  #page-me .me-head .gate-title { font-size: 1.6rem; }
  #me-notice { grid-area: notice; margin-bottom: 1.2rem; }
  .me-upnext { grid-area: upnext; display: grid; gap: .7rem; margin-bottom: 1.8rem; }
  .me-upnext.hidden { display: none; }
  .me-classes-h { grid-area: classesh; display: block; margin-bottom: .7rem; }
  #me-classes { grid-area: classes; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
  #me-classes::before { display: none; }
  #me-classes > li { display: block; }
  #me-classes > li > .node { display: none; }
  #me-classes .me-class { height: 100%; min-height: 128px; align-items: flex-start; padding: 1.2rem 1.3rem; }
  #me-classes .me-class .go { align-self: flex-end; }
  #me-empty { grid-area: empty; }
  #page-me .me-wrap > p.center { grid-area: foot; text-align: start; }
  .upnext-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: .8rem; }
  .upnext-item { display: flex; align-items: center; gap: .85rem; padding: .95rem 1rem; color: var(--ink); text-decoration: none; height: 100%; }
  .upnext-item.is-exam { border: 2px solid var(--route); }
  .upnext-ic { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 50%; background: var(--map-2); color: var(--ink); }
  .upnext-item.is-exam .upnext-ic { background: var(--route); color: var(--on-go); }
  .upnext-ic .icon { width: 20px; height: 20px; }
  .upnext-tx { display: grid; gap: .1rem; flex: 1; min-width: 0; }
  .upnext-tx b, .upnext-tx .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .upnext-when { font-weight: 700; font-size: .9rem; color: var(--route); }

  /* a class */
  #page-class .me-wrap { max-width: 1240px; padding: 1.8rem 1.5rem 3rem; grid-template-columns: minmax(0, 1fr) 360px; grid-template-areas: "head head" "main side";
    column-gap: 2rem; row-gap: 1.4rem; align-items: start; }
  #page-class .me-head { grid-area: head; padding: 0; background: none; border: 0; box-shadow: none; }
  #page-class .me-head .gate-title { font-size: 2.4rem; }
  #page-class .seg-wide { display: inline-flex; margin-top: 1.1rem; }
  #page-class .seg-wide button { flex: none; padding-inline: 1.3rem; }
  #page-class [role="tabpanel"] { grid-area: main; min-width: 0; }
  .cl-side { grid-area: side; position: sticky; top: 92px; display: grid; gap: 1rem; }
  .side-card { display: grid; gap: .55rem; padding: 1.05rem 1.2rem 1.15rem; }
  .side-card.hidden { display: none; }
  .side-exams { display: grid; gap: .6rem; }
  .side-exam { min-height: 0; }
  .side-exam-tx { display: grid; min-width: 0; }
  .side-exam-tx b { overflow-wrap: anywhere; }
  .side-prog { margin: 0; font-weight: 600; }
  .side-bar { display: block; height: 10px; border-radius: 999px; background: var(--map-2); overflow: hidden; }
  .side-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--route); }
  .cl-next { box-shadow: var(--shadow-pop); }

  /* sign-in, invite, password pages: two halves (the brand half is styled above) */
  body[data-shell="gate"] .gate-side { display: flex; position: fixed; inset-block: 0; inset-inline-start: 0; width: min(46vw, 660px); z-index: 1; }
  .gate-side-in { width: 100%; display: flex; flex-direction: column; gap: 2rem; padding: clamp(2rem, 4vw, 3.2rem); }
  .gate-side-portal { font-size: 1.15rem; }
  .gs-welcome { margin-top: auto; max-width: 30rem; }
  .gs-hello { font-size: clamp(2.4rem, 4.2vw, 3.6rem); margin-bottom: .8rem; }
  .gs-kicker { margin-bottom: .6rem; font-size: 13px; }
  .gate-side-line { font-size: 1.1rem; }
  .gs-art { display: block; width: min(100%, 380px); height: auto; margin: 0 auto auto; }
  body[data-shell="gate"] .page-center.active { min-height: 100vh; justify-content: center; padding-block: 1.5rem 2.5rem; padding-inline: calc(min(46vw, 660px) + 1.5rem) 1.5rem; background: var(--plate); }
  body[data-shell="gate"] .page-center.active > .gate { margin-top: 0; box-shadow: none; border-color: transparent; }
}
@media (min-width: 1024px) and (hover: hover) and (pointer: fine) {
  .side-exam, .side-exam:hover { text-decoration: none; color: var(--ink); }
  .side-exam-tx .muted { font-size: .88rem; }
  #me-classes .me-class::before, #me-classes .me-class::after { display: none; }
  body[data-shell="gate"] .gate .brand-pill { display: none; }        /* the other half already shows the portal */
  body[data-shell="gate"] .gate .brandbar { justify-content: flex-end; margin-bottom: .6rem; }
  /* the other half shows the portal's name: the crest is the logo alone, and the half no longer repeats it */
  body[data-shell="gate"] .gate-crest .crest-inst, body[data-shell="gate"] .gate-crest .crest-portal { display: none; }
  body[data-shell="gate"] .gate-side-mark { display: none; }
  body[data-shell="gate"] .brand-mark.crest { width: 92px; height: 92px; font-size: 30px; }
}
/* the same for the course line over a class, the lecture lines, Up next and the side column */
[dir="rtl"] #cl-course, [dir="rtl"] .cl-next-what, [dir="rtl"] .cl-next-note, [dir="rtl"] .upnext-tx b, [dir="rtl"] .upnext-tx .muted,
[dir="rtl"] .side-exam-tx b, [dir="rtl"] #user-name, [dir="rtl"] #user-pop-name { text-align: right; }
