/* Beaver Egypt – offline practice test
   Colours: navy / blue / white / orange (matches thebotcup.com: #071a3d, #11346f, #ff9a1f)
   Idea: the 10 problems are stepping stones across the Nile.
   Each stone fills with gold stars as levels are solved. Everything else stays quiet. */


:root {
  --river: #11346f;
  --river-deep: #071a3d;
  --water: #dbe6f7;
  --reed: #f2f6fc;
  --sun: #ff9a1f;
  --sun-soft: #ffe9cf;
  --clay: #d9730d;
  --ink: #0b1733;
  --soft: #56657f;
  --line: #d3deef;
  --white: #ffffff;
  --danger: #b3261e;
  /* same font style as thebotcup.com: the system UI font, bold headings */
  --font: var(--be-font, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--reed); line-height: 1.5; font-size: 18px; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
h1, h2 { margin: 0; line-height: 1.2; font-weight: 700; }
/* thebotcup.com headings are slightly tight; only for Latin text (Arabic letters must stay joined) */
:lang(en) h1, :lang(fr) h1 { letter-spacing: -.02em; }
:lang(en) h2, :lang(fr) h2, :lang(en) .bubble, :lang(fr) .bubble, :lang(en) .tile b, :lang(fr) .tile b { letter-spacing: -.01em; }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 0 1.3rem; border-radius: 12px; cursor: pointer;
  border: 2px solid var(--line); background: var(--white); font-weight: 700;
  transition: transform .06s ease, background-color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-go { background: var(--river); border-color: var(--river); color: var(--white); }
.btn-go:hover { background: var(--river-deep); border-color: var(--river-deep); }
.btn-done { background: var(--sun); border-color: var(--sun); color: #1a1200; }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); border-color: #efc9c5; }
.link { background: none; border: 0; padding: .3rem .5rem; color: var(--soft); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--river); }

/* ---------- top bar ---------- */
.bar {
  height: 64px; padding: 0 1.25rem; display: flex; align-items: center; gap: 1rem;
  background: var(--river-deep); color: var(--white); position: relative; z-index: 5;
}
.logo { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.15rem; white-space: nowrap; }
/* logo: bottom-left corner, transparent background */
.corner-logo { position: fixed; left: .8rem; bottom: .6rem; height: 100px; width: auto; z-index: 3; pointer-events: none; user-select: none;
  filter: drop-shadow(0 3px 6px rgba(7,26,61,.18)); }
body[data-screen="screenTest"] .corner-logo { height: 112px; bottom: .35rem; left: .6rem; }
.bar-mid { flex: 1; display: flex; justify-content: center; align-items: center; gap: 1.6rem; }
.bar-end { display: flex; gap: .6rem; align-items: center; margin-inline-start: auto; }
.bar-mid + .bar-end { margin-inline-start: 0; }
.lang { background: transparent; border: 1.5px solid rgba(255,255,255,.4); color: var(--white); border-radius: 10px; padding: .3rem .9rem; cursor: pointer; }
.lang:hover { background: rgba(255,255,255,.1); }
.lang-menu { position: relative; }
#btnLangMenu { display: inline-flex; align-items: center; gap: .25rem; font-weight: 700; font-size: .85rem; padding: .15rem .55rem; border-radius: 8px; line-height: 1.5; }
#btnLangMenu span[aria-hidden] { font-size: .8rem; }
.lang-pop {
  position: absolute; top: calc(100% + 6px); inset-inline-end: 0; z-index: 40; min-width: 150px;
  background: var(--white); border-radius: 14px; padding: .35rem; box-shadow: 0 12px 30px -10px rgba(7,26,61,.45);
  display: flex; flex-direction: column; gap: .2rem;
}
.lang-pop button { border: 0; background: transparent; color: var(--ink); text-align: start; padding: .55rem .8rem; border-radius: 10px; font-weight: 700; font-size: 1.05rem; cursor: pointer; }
.lang-pop button:hover { background: var(--reed); }
.lang-pop button.on { background: var(--river); color: var(--white); }

.clock { display: flex; align-items: center; gap: .45rem; background: rgba(255,255,255,.1); border-radius: 999px; padding: .3rem 1rem .3rem .8rem; }
.clock svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.clock b { font-size: 1.45rem; font-variant-numeric: tabular-nums; direction: ltr; letter-spacing: .02em; }
.clock.warn { background: var(--sun); color: #1a1200; }
.clock.danger { background: var(--danger); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .7; } }
.points { display: flex; align-items: baseline; gap: .3rem; }
.points b { font-size: 1.45rem; color: var(--sun); }
.points span { opacity: .75; direction: ltr; }
.points small { opacity: .75; }

/* ---------- shared form bits (teacher panel) ---------- */
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: 1rem; font-weight: 700; }
.field input, .field select {
  height: 50px; padding: 0 .9rem; border: 2px solid var(--line); border-radius: 12px; background: var(--white); font-weight: 400; font-size: 1.05rem; width: 100%;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--river); }
.form-error { color: var(--danger); margin: 0 0 .8rem; font-weight: 700; }
.tip { text-align: center; color: var(--soft); font-size: .92rem; margin: .8rem 0 0; }
.mode-tag { background: var(--sun); color: #1a1200; font-weight: 700; border-radius: 999px; padding: .2rem .9rem; }
.who-chip { background: rgba(255,255,255,.12); border-radius: 999px; padding: .25rem .9rem; font-weight: 700; max-width: 28ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { background: transparent; border: 1.5px solid rgba(255,255,255,.4); color: var(--white); border-radius: 10px; font-size: 1.15rem; line-height: 1; padding: .35rem .6rem; cursor: pointer; }
.icon-btn:hover { background: rgba(255,255,255,.1); }
.teacher-link { position: fixed; bottom: .7rem; right: .8rem; left: auto; z-index: 4; background: transparent; border: 0; color: var(--soft); font-size: .85rem; opacity: .65; cursor: pointer; }
.teacher-link:hover { opacity: 1; color: var(--river); }

/* =====================================================================
   Kid screens: the beaver asks ONE question; big targets; few words.
   ===================================================================== */
.stage-screen { min-height: calc(100vh - 64px); padding: 2rem 1rem 4rem; display: flex; flex-direction: column; align-items: center; gap: 1.4rem; }

.guide { width: min(640px, 100%); display: flex; align-items: flex-end; gap: .4rem; }
.guide img { width: 118px; flex: none; filter: drop-shadow(0 6px 8px rgba(7,26,61,.18)); }
.bubble {
  position: relative; flex: 1; margin: 0 0 2.2rem; background: var(--white); border-radius: 24px;
  padding: 1rem 1.4rem; font-size: 1.55rem; font-weight: 700; line-height: 1.35; color: var(--river-deep);
  box-shadow: 0 2px 0 var(--line), 0 14px 30px -18px rgba(7,26,61,.5);
}
.bubble::before {
  content: ""; position: absolute; bottom: 18px; inset-inline-start: -12px; width: 24px; height: 24px;
  background: var(--white); transform: rotate(45deg); border-radius: 4px;
}
.bubble.sad { background: #fdecea; color: var(--danger); }
.bubble.sad::before { background: #fdecea; }

.card {
  width: min(560px, 100%); background: var(--white); border-radius: 26px; padding: 1.6rem;
  display: flex; flex-direction: column; gap: 1rem;
  box-shadow: 0 2px 0 var(--line), 0 18px 40px -24px rgba(7,26,61,.45);
}
.big-input {
  width: 100%; height: 66px; padding: 0 1.1rem; font-size: 1.45rem; border-radius: 18px;
  border: 3px solid var(--line); background: var(--white);
}
.big-input:focus { outline: none; border-color: var(--river); }
.big-btn {
  width: 100%; min-height: 66px; border: 0; border-radius: 18px; cursor: pointer;
  background: var(--river); color: var(--white); font-size: 1.4rem; font-weight: 700;
  box-shadow: 0 6px 0 var(--river-deep); transition: transform .06s ease, box-shadow .06s ease;
}
.big-btn:hover { background: #1a4590; }
.big-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--river-deep); }
.card .link { align-self: center; font-size: 1rem; }
.oops { margin: 0; background: #fdecea; color: var(--danger); border-radius: 14px; padding: .6rem 1rem; font-weight: 700; }
.hint { margin: 0; color: var(--soft); font-size: .98rem; text-align: center; }
.back-link { font-size: 1.05rem; }

/* one-page sign in / sign up */
.kid-label { font-weight: 700; font-size: 1.1rem; color: var(--river-deep); margin-bottom: -.5rem; }
.hint-start { text-align: start; margin-top: -.5rem; }
.join-card { gap: .9rem; }
.big-select { cursor: pointer; padding-inline-end: .8rem; }
.picked { display: flex; align-items: center; gap: .8rem; font-size: 1.4rem; font-weight: 700; color: var(--ink); }
.picked .avatar { width: 56px; height: 56px; font-size: 1.6rem; }
.who-panel { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 1rem; }

/* sign-up progress */
.progress { list-style: none; margin: 0; padding: 0; display: flex; gap: .5rem; }
.progress li { width: 46px; height: 10px; border-radius: 999px; background: var(--line); }
.progress li.done { background: var(--river); }
.progress li.on { background: var(--sun); }

/* who are you? name tiles */
.search { width: min(440px, 100%); height: 56px; padding: 0 1.1rem; font-size: 1.2rem; border-radius: 16px; border: 3px solid var(--line); }
.search:focus { outline: none; border-color: var(--river); }
.name-grid { width: min(860px, 100%); display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
.name-tile {
  background: var(--white); border: 3px solid transparent; border-radius: 22px; padding: 1.1rem .6rem 1rem;
  cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: .35rem;
  box-shadow: 0 4px 0 var(--line); transition: transform .08s ease;
}
.name-tile:hover { border-color: var(--river); transform: translateY(-2px); }
.name-tile:active { transform: translateY(2px); }
.avatar { width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center; font-size: 1.9rem; font-weight: 700; color: var(--white); }
.name-tile b { font-size: 1.2rem; line-height: 1.2; text-align: center; }
.name-tile small { color: var(--soft); font-size: .88rem; }
.name-tile.new { border: 3px dashed var(--river); background: var(--reed); box-shadow: none; }
.name-tile.new .avatar { background: var(--river); font-size: 2.4rem; }

/* date of birth: day / month / year */
.dob { display: grid; grid-template-columns: 1fr 1.5fr 1.2fr; gap: .6rem; }
.dob select { height: 66px; padding: 0 .7rem; font-size: 1.25rem; border-radius: 16px; border: 3px solid var(--line); background: var(--white); cursor: pointer; }
.dob select:focus { outline: none; border-color: var(--river); }

/* school buttons */
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.choice { min-height: 66px; border-radius: 18px; border: 3px solid var(--line); background: var(--white); font-size: 1.3rem; font-weight: 700; cursor: pointer; }
.choice:hover { border-color: var(--river); }
.choice.on { background: var(--river); border-color: var(--river); color: var(--white); }

/* grade */
.grade-pick { display: flex; flex-direction: column; gap: .6rem; }
.grade-row { display: flex; align-items: center; gap: .8rem; }
.stage-name { width: 5.2rem; color: var(--soft); font-size: 1.05rem; font-weight: 700; flex: none; }
.chips { display: flex; gap: .5rem; flex-wrap: wrap; }
.chips button { width: 60px; height: 60px; border-radius: 16px; border: 3px solid var(--line); background: var(--white); font-weight: 700; font-size: 1.4rem; cursor: pointer; }
.chips button:hover { border-color: var(--river); }
.grade-chips { justify-content: center; max-width: 360px; margin: 0 auto; }
.chips button.on { background: var(--river); border-color: var(--river); color: var(--white); }

/* home: two big tiles */
.big-tiles { width: min(780px, 100%); display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
.tile {
  min-height: 240px; border: 0; border-radius: 30px; cursor: pointer; padding: 1.2rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem;
  transition: transform .08s ease, box-shadow .08s ease;
}
.tile-ic { font-size: 4.4rem; line-height: 1.1; }
.tile b { font-size: 2.1rem; }
.tile span:last-child { font-size: 1.1rem; opacity: .85; }
.tile:hover { transform: translateY(-3px); }
.tile:active { transform: translateY(5px); }
.tile-practice { background: #dfe9fa; color: var(--river-deep); box-shadow: 0 9px 0 #a7bde4; }
.tile-practice:active { box-shadow: 0 3px 0 #a7bde4; }
.tile-exam { background: var(--sun); color: #1a1200; box-shadow: 0 9px 0 #cc6f00; }
.tile-exam:active { box-shadow: 0 3px 0 #cc6f00; }

/* practice years */
.years { width: min(1080px, 100%); display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.year-box { display: flex; flex-direction: column; align-items: center; gap: .4rem; }
.year {
  width: 100%; border: 3px solid transparent; background: var(--white); border-radius: 26px; padding: 1.4rem .8rem 1.2rem;
  cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: .6rem; box-shadow: 0 6px 0 var(--line);
}
.year:hover { border-color: var(--river); }
.year:active { transform: translateY(3px); box-shadow: 0 3px 0 var(--line); }
.year-num { font-size: 2.8rem; font-weight: 700; color: var(--river-deep); line-height: 1; direction: ltr; }
.year-dots { display: grid; grid-template-columns: repeat(5, 16px); gap: 6px; direction: ltr; }
.year-dots i { width: 16px; height: 16px; border-radius: 50%; background: #dce5f2; }
.year-dots i.some { background: var(--sun-soft); box-shadow: 0 0 0 3px var(--sun) inset; }
.year-dots i.full { background: var(--sun); }
.year-stat { color: var(--soft); font-size: 1rem; }
.year-go { background: var(--river); color: var(--white); border-radius: 14px; padding: .45rem 1.6rem; font-weight: 700; font-size: 1.15rem; }
.year-box .link { font-size: .9rem; }

/* exam pin */
.exam-facts { display: flex; justify-content: center; gap: .6rem; margin: 0; flex-wrap: wrap; }
.exam-facts > span { background: var(--reed); border-radius: 999px; padding: .3rem 1rem; color: var(--soft); }
.exam-facts b { color: var(--ink); }
.gold, .exam-facts .gold { color: var(--sun); letter-spacing: 2px; }
.email-line { margin: 0; text-align: center; font-weight: 700; font-size: 1.15rem; color: var(--river-deep); background: var(--reed); border-radius: 12px; padding: .4rem .8rem; word-break: break-all; }
.pin-boxes { display: flex; justify-content: center; gap: .5rem; }
.pin-boxes input {
  width: 58px; height: 72px; text-align: center; font-size: 2.1rem; font-weight: 700; border-radius: 16px;
  border: 3px solid var(--line); background: var(--white); caret-color: var(--river);
}
.pin-boxes input:focus { outline: none; border-color: var(--river); background: var(--reed); }
.done-score { font-size: 1.5rem; margin: 0; color: var(--soft); direction: ltr; text-align: center; }
.done-score b { font-size: 3.6rem; color: var(--river); }

/* teacher extras */
.pin-cell { font-size: 1.35rem; font-weight: 700; letter-spacing: .12em; color: var(--river); text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.board .who small { display: block; }
.t-sec { padding-top: .4rem; }
.t-sec .t-actions { margin-bottom: .6rem; }
.t-left { text-align: start; }
.span2 { grid-column: span 2; }
textarea { width: 100%; font: inherit; border: 2px solid var(--line); border-radius: 12px; padding: .7rem .9rem; margin-bottom: .6rem; resize: vertical; }
textarea:focus { outline: none; border-color: var(--river); }

/* ---------- test ---------- */
.test { height: calc(100vh - 64px); display: flex; flex-direction: column; }
.stage-row { flex: 1; display: grid; grid-template-rows: 1fr auto; min-height: 0; }
/* round problem buttons under the problem */
.dock { background: var(--reed); border-top: 1px solid var(--line); padding: .55rem 1rem .5rem; overflow-x: auto; }
.dock-list { display: flex; justify-content: center; align-items: flex-start; gap: .7rem; min-width: max-content; margin: 0 auto; }
.dock-item { background: none; border: 0; padding: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: .25rem; }
.dock-num {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: var(--white); border: 3px solid var(--line); font-weight: 700; font-size: 1.3rem; color: var(--soft);
  box-shadow: 0 3px 0 var(--line); transition: transform .08s ease;
}
.dock-item:hover .dock-num { border-color: var(--river); color: var(--river); }
.dock-item:active .dock-num { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.dock-item.has-points .dock-num { border-color: var(--sun); background: var(--sun-soft); color: var(--ink); }
.dock-item.full .dock-num { background: var(--sun); border-color: var(--sun); color: #1a1200; }
.dock-item.current .dock-num { background: var(--river); border-color: var(--river); color: var(--white); transform: scale(1.12); box-shadow: 0 4px 0 var(--river-deep); }
.dock-item.current .dots i:not(.on) { background: #9fb3d6; }
.back-dock { margin-inline-start: .6rem; }
.back-dock .dock-num { border-style: dashed; border-color: var(--river); color: var(--river); background: var(--reed); box-shadow: none; }
.dock-word { font-size: .78rem; font-weight: 700; color: var(--river); }
/* name and level stars under each round button */
.dock-item { width: 86px; gap: .4rem; }
.dock-name {
  font-size: .74rem; font-weight: 700; line-height: 1.3; color: var(--ink); text-align: center;
  display: block; width: 100%; max-width: 86px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* problem picture inside the round button, number in a small badge */
.dock-num.has-img { position: relative; width: 58px; height: 58px; padding: 0; background: var(--white); overflow: visible; }
.dock-num.has-img img { width: 46px; height: 46px; object-fit: contain; border-radius: 50%; pointer-events: none; }
.dock-badge {
  position: absolute; top: -5px; inset-inline-start: -5px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px;
  display: grid; place-items: center; font-size: .75rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums;
  background: var(--white); color: var(--soft); border: 2px solid var(--line);
}
.dock-item.has-points .dock-num.has-img { background: var(--white); }
.dock-item.has-points .dock-badge { background: var(--sun-soft); border-color: var(--sun); color: var(--ink); }
.dock-item.full .dock-num.has-img { background: var(--sun-soft); }
.dock-item.full .dock-badge { background: var(--sun); border-color: var(--sun); color: #1a1200; }
.dock-item.current .dock-num.has-img { background: var(--white); border-color: var(--river); box-shadow: 0 0 0 3px rgba(17,52,111,.18), 0 4px 0 var(--river-deep); }
.dock-item.current .dock-badge { background: var(--river); border-color: var(--river); color: var(--white); }
.dock-item.current .dock-name { color: var(--river); }
.dock-stars { display: flex; gap: 1px; direction: ltr; font-size: .85rem; line-height: 1; }
.dock-stars i { font-style: normal; color: #c3d0e6; }
.dock-stars i.on { color: var(--sun); text-shadow: 0 0 1px #cc6f00; }
.back-dock { width: auto; }

.btn-all { min-height: 40px; background: var(--white); color: var(--river-deep); border-color: var(--white); font-size: 1.05rem; gap: .3rem; }
.btn-all:hover { background: var(--sun); border-color: var(--sun); }
.btn-all, .btn-exit { min-height: 34px; padding: .2rem .8rem; font-size: .92rem; border-radius: 10px; }
.btn-exit { background: transparent; color: var(--white); border: 1.5px solid rgba(255,255,255,.45); gap: .3rem; }
.btn-exit:hover { background: rgba(255,255,255,.12); }

/* all problems of a practice / exam */
.board-screen { min-height: calc(100vh - 64px); padding: 1.6rem 1rem 4rem; display: flex; flex-direction: column; align-items: center; gap: 1.2rem; }
.task-cards { width: min(1120px, 100%); display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 1.1rem; }
.task-card {
  position: relative; background: var(--white); border: 3px solid transparent; border-radius: 24px; padding: 1rem .8rem .9rem;
  cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: .45rem; box-shadow: 0 6px 0 var(--line);
  transition: transform .08s ease;
}
.task-card:hover { border-color: var(--river); transform: translateY(-2px); }
.task-card:active { transform: translateY(3px); box-shadow: 0 3px 0 var(--line); }
.task-card img { width: 104px; height: 104px; object-fit: contain; border-radius: 16px; }
.task-card b { font-size: 1.15rem; line-height: 1.25; text-align: center; min-height: 2.5em; display: flex; align-items: center; }
.tc-num { position: absolute; top: .6rem; inset-inline-start: .6rem; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--river); color: var(--white); }
.tc-pts { font-weight: 700; color: var(--soft); font-variant-numeric: tabular-nums; direction: ltr; }
.task-card .dots i { width: 11px; height: 11px; }
.task-card.has-points { border-color: var(--sun); }
.task-card.has-points .tc-pts { color: var(--ink); }
.task-card.full { background: var(--sun-soft); }
.back-card { justify-content: center; background: var(--reed); border: 3px dashed var(--river); box-shadow: none; color: var(--river-deep); min-height: 220px; }
.back-card:active { box-shadow: none; }
.back-ic { font-size: 3.2rem; line-height: 1; }
.back-item { background: var(--reed); border: 3px dashed var(--river); box-shadow: none; color: var(--river-deep); margin-top: .3rem; }
.back-item .si-num { background: var(--river); color: var(--white); font-size: 1.2rem; }
.counter { background: rgba(255,255,255,.14); border-radius: 999px; padding: .25rem 1rem; font-weight: 700; font-size: 1.1rem; white-space: nowrap; }
.stones { list-style: none; margin: 0; padding: 0; }
.stone { display: flex; flex-direction: column; align-items: center; gap: .15rem; min-width: 46px; }
.stone button { width: 48px; height: 48px; border-radius: 50%; padding: 0; border: 2px solid var(--line); background: var(--white); font-weight: 700; font-size: 1.15rem; color: var(--soft); }
.stone.has-points button { border-color: var(--sun); color: var(--ink); background: var(--sun-soft); }
.stone.full button { background: var(--sun); color: #1a1200; }
.dots { display: flex; gap: 3px; direction: ltr; justify-content: center; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: #cbd7ea; }
.dots i.on { background: var(--sun); box-shadow: 0 0 0 1px #cc6f00 inset; }
.frames { position: relative; background: var(--white); min-height: 0; box-shadow: 0 0 0 1px var(--line); }
.frames iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--white); }
.frame-loading { position: absolute; inset: 0; z-index: 3; background: var(--white); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .8rem; color: var(--soft); }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 4px solid var(--water); border-top-color: var(--river); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- results ---------- */
.sheet { background: var(--white); border-radius: 24px; width: min(520px, 100%); padding: 1.6rem 2rem 1.8rem; box-shadow: 0 1px 0 var(--line), 0 18px 40px -24px rgba(7,26,61,.45); }
.results { padding: 3.5rem 1rem 2rem; display: flex; justify-content: center; }
.result-sheet { width: min(760px, 100%); text-align: center; padding-top: 0; }
.medal-ring { width: 112px; height: 112px; margin: -56px auto .5rem; border-radius: 50%; background: var(--white); display: grid; place-items: center; font-size: 4rem; box-shadow: 0 0 0 6px var(--reed), 0 0 0 8px var(--line); }
.medal-ring.gold { box-shadow: 0 0 0 6px var(--reed), 0 0 0 9px var(--sun); }
.result-sheet h1 { font-size: 2rem; color: var(--river-deep); }
.res-medal { margin: .2rem 0 .4rem; color: var(--clay); font-weight: 700; }
.res-score { display: flex; justify-content: center; align-items: baseline; gap: .4rem; direction: ltr; }
.res-score b { font-size: 4.2rem; line-height: 1; color: var(--river); }
.res-score span { font-size: 1.4rem; color: var(--soft); }
.res-sub { color: var(--soft); margin: .4rem 0 1.6rem; }
.stones-static { display: grid; grid-template-columns: repeat(10, 1fr); gap: .6rem .2rem; padding: 1rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stones-static .stone { min-width: 0; }
.stones-static .stone button { cursor: default; }
.stone-pts { font-size: .85rem; font-weight: 700; color: var(--soft); }
.has-points .stone-pts { color: var(--ink); }
.res-actions { display: flex; justify-content: center; gap: .6rem; flex-wrap: wrap; margin-top: 1.6rem; }

/* ---------- modals ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(7, 26, 61, .55); display: grid; place-items: center; padding: 1rem; }
.modal-box { background: var(--white); border-radius: 20px; padding: 1.5rem; width: min(440px, 100%); max-height: 92vh; overflow: auto; }
.modal-box.wide { width: min(860px, 100%); }
.modal-box h2 { color: var(--river-deep); font-size: 1.4rem; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .8rem; }
.x { background: none; border: 0; font-size: 2rem; line-height: 1; cursor: pointer; color: var(--soft); }
.modal-actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.3rem; }
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .6rem; }
.tabs button { border: 2px solid var(--line); background: var(--white); border-radius: 999px; padding: .25rem .9rem; cursor: pointer; font-size: .92rem; }
.tabs button.on { background: var(--river); border-color: var(--river); color: var(--white); }
.table-wrap { max-height: 56vh; overflow: auto; }
.board { width: 100%; border-collapse: collapse; }
.board td { padding: .6rem .5rem; border-bottom: 1px solid var(--line); }
.board .rank { width: 3rem; text-align: center; font-weight: 700; color: var(--soft); font-size: 1.1rem; }
.board .who b { display: block; }
.board .who small { color: var(--soft); }
.board .num { text-align: end; font-weight: 700; font-size: 1.15rem; white-space: nowrap; }
.board .num small { display: block; font-weight: 400; color: var(--soft); font-size: .8rem; }
.board tr.me { background: var(--sun-soft); }
.board .empty { text-align: center; color: var(--soft); padding: 2rem; }
.pin-box { display: flex; flex-direction: column; max-width: 320px; }
.t-settings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 1rem; align-items: end; }
.check { display: flex; gap: .5rem; align-items: center; grid-column: 1 / -1; margin-bottom: 1rem; cursor: pointer; }
.check input { width: 20px; height: 20px; }
.t-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.t-msg { color: var(--river); font-weight: 700; min-height: 1.5em; margin: .6rem 0; }

/* ---------- toasts / time up ---------- */
.toasts { position: fixed; bottom: 11.5rem; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: .5rem; pointer-events: none; }
.toast { max-width: min(90vw, 520px); text-align: center; background: var(--river-deep); color: var(--white); padding: .7rem 1.3rem; border-radius: 999px; font-weight: 700; box-shadow: 0 10px 24px -10px rgba(0,0,0,.5); animation: rise .25s ease-out; }
.toast.gold { background: var(--sun); color: #1a1200; }
.toast.red { background: var(--danger); }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }
.timeup { position: fixed; inset: 0; background: rgba(7,26,61,.9); color: var(--white); z-index: 70; display: grid; place-items: center; text-align: center; }
.timeup-ic { font-size: 4rem; }
.timeup h2 { font-size: 2.4rem; }

/* ---------- certificate (print only) ---------- */
.certificate { display: none; }
@media print {
  @page { size: A4 landscape; margin: 0; }
  body.print-cert > *:not(#certificate) { display: none !important; }
  body.print-cert { background: #fff; }
  body.print-cert .certificate { display: flex !important; width: 100vw; height: 100vh; align-items: center; justify-content: center; }
}
.cert-inner { width: 92%; height: 88%; border: 3px solid var(--river); outline: 10px solid var(--water); outline-offset: -16px; border-radius: 16px; padding: 2rem 3rem; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; }
.cert-beaver { width: 120px; }
.cert-brand { color: var(--soft); margin: 0; }
.cert-inner h1 { color: var(--river-deep); font-size: 2.6rem; }
.cert-inner h2 { color: var(--clay); font-size: 2.3rem; border-bottom: 3px solid var(--sun); padding: 0 2rem .1rem; margin: .4rem 0; }
.cert-score { font-size: 2.4rem; font-weight: 700; color: var(--river); direction: ltr; }
.cert-medal { font-size: 1.3rem; margin: 0; }
.cert-date { color: var(--soft); }

/* ---------- small screens ---------- */
@media (max-width: 1300px) {
  body[data-screen="screenTest"] .corner-logo { display: none; }
}
@media (max-width: 860px) {
  body { font-size: 16px; }
  .bar { height: auto; min-height: 60px; flex-wrap: wrap; padding: .5rem .8rem; gap: .5rem; }
  .corner-logo { height: 56px; }
  body[data-screen="screenTest"] .corner-logo { display: none; }
  .bar-mid { gap: .8rem; }
  .clock b, .points b { font-size: 1.2rem; }
  .points small { display: none; }
  .test { height: auto; min-height: calc(100vh - 60px); }
  .frames { min-height: 80vh; }
  .dock-num { width: 42px; height: 42px; font-size: 1.1rem; }
  .dock-num.has-img { width: 48px; height: 48px; }
  .dock-num.has-img img { width: 38px; height: 38px; }
  .dock-item { width: 70px; }
  .dock-name { font-size: .68rem; max-width: 70px; }
  .dock-list { justify-content: flex-start; gap: .45rem; }
  .task-cards { grid-template-columns: repeat(2, 1fr); }
  .btn-all span:last-child, .btn-exit span:last-child { display: none; }
  .sheet { padding: 1.4rem 1.2rem; }
  .t-settings { grid-template-columns: 1fr; }
  .years { grid-template-columns: repeat(2, 1fr); }
  .big-tiles { grid-template-columns: 1fr; }
  .tile { min-height: 170px; }
  .guide img { width: 84px; }
  .bubble { font-size: 1.25rem; }
  .pin-boxes input { width: 46px; height: 62px; font-size: 1.7rem; }
  .name-grid { grid-template-columns: repeat(2, 1fr); }
  .teacher-link { position: static; margin: 1rem auto; display: block; }
  .span2 { grid-column: auto; }
  .who-chip { display: none; }
  .stones-static { grid-template-columns: repeat(5, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- professional typography ---------- */
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
:lang(ar) body, body:lang(ar) { line-height: 1.65; }
h1, h2, .tile b, .year-num, .res-score b, .done-score b { font-weight: 800; }
.bubble, .big-btn, .year-go, .mode-tag, .counter, .logo { font-weight: 700; }
.kid-label, .field, .stage-name, .who-chip, .dock-name, .tc-pts, .stone-pts, .name-tile small, .year-stat, .tip, .hint { font-weight: 600; }
.clock b, .points b, .counter, .tc-num, .dock-num, .chips button, .year-num, .pin-boxes input, .res-score b, .done-score b, .tc-pts, .pin-cell { font-variant-numeric: tabular-nums lining-nums; }
.task-card b { font-weight: 700; }
input::placeholder { color: #8a97ad; font-weight: 400; }

/* 12 practice years: compact cards */
.years .year { padding: 1rem .8rem .9rem; gap: .45rem; }
.years .year-num { font-size: 2.1rem; }
.years .year-dots { grid-template-columns: repeat(6, 11px); gap: 5px; }
.years .year-dots i { width: 11px; height: 11px; }
.years .year-stat { font-size: .88rem; }
.years .year-go { padding: .35rem 1.3rem; font-size: 1rem; border-radius: 12px; }
@media (max-width: 1000px) { .years { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .years { grid-template-columns: repeat(2, 1fr); } }
/* keep the round problem buttons clear of the corner logo */
/* inside a problem the logo sits at the left end of the bottom bar, as tall as the bar */
body[data-screen="screenTest"] .corner-logo { display: none !important; }
.dock { display: flex; align-items: center; gap: .6rem; overflow: hidden; padding-left: .5rem; direction: ltr; }
.dock-logo { height: 112px; width: auto; flex: none; pointer-events: none; user-select: none; filter: drop-shadow(0 3px 6px rgba(7,26,61,.18)); }
.dock-scroll { flex: 1; min-width: 0; overflow-x: auto; overflow-y: hidden; padding: 8px 4px 2px; direction: var(--page-dir, ltr); }
@media (max-width: 860px) { .dock-logo { height: 64px; } }

/* phones: the corner logo sits at the end of the page instead of floating over the content */
@media (max-width: 860px) {
  .corner-logo { position: static; display: block; height: 60px; margin: .5rem 0 1rem .8rem; filter: none; }
  body[data-screen="screenTest"] .corner-logo { display: none; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* Beaver Egypt's own practice sets (EGY1, EGY2…) */
.year { position: relative; }
.year-special { border-color: var(--sun); background: linear-gradient(180deg, #fff7ea, #fff); }
.year-special .year-num { color: #b35c00; }
.year-badge { position: absolute; top: -10px; inset-inline-end: 12px; background: var(--sun); color: #1a1200; font-size: .78rem; font-weight: 800; border-radius: 999px; padding: .1rem .6rem; box-shadow: 0 2px 0 #cc6f00; }

/* difficulty label on the problem cards (EGY2) */
.tc-diff { position: absolute; top: .6rem; inset-inline-end: .6rem; font-size: .72rem; font-weight: 800; border-radius: 999px; padding: .1rem .55rem; color: #fff; }
.tc-diff.d-easy { background: #2e7d32; } .tc-diff.d-medium { background: #1f5fbf; } .tc-diff.d-hard { background: #e65100; } .tc-diff.d-vhard { background: #b3261e; }

/* top bar: brand on the left, Exit and language always on the far right (every page, every language) */
.bar { direction: ltr; }
.bar .logo, .bar .bar-mid > *, .bar .bar-end > * { direction: var(--page-dir, ltr); }
html[dir="rtl"] { --page-dir: rtl; }
.bar-mid[hidden] + .bar-end { margin-inline-start: auto; }
.bar .lang-pop { right: 0; left: auto; }
.icon-home { font-size: 1rem; line-height: 1.5; padding: .15rem .55rem; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; min-height: 31px; }
.icon-home svg { display: block; }

/* ---- online: gender chips, server box, connection dot */
.gender-chips{justify-content:center}
.gender-chips button{width:auto;min-width:130px;padding:0 18px;font-size:1.1rem}
.gender-chips button span{font-size:1.3rem}
.none-msg{font-size:1.15rem;font-weight:700;color:var(--navy,#11346f);text-align:center;margin:8px 0}
.t-server{border:2px solid #dbe6f7;border-radius:14px;padding:12px 14px;margin-bottom:16px;background:#f6f9ff}
.t-server h3{margin:0 0 6px;font-size:1.05rem;color:#11346f}
.t-server [hidden]{display:none !important}
.net-dot{display:none;width:9px;height:9px;border-radius:50%;margin-inline-start:6px;vertical-align:middle;background:#9aa7bd}
.net-dot.on{display:inline-block;background:#22a559}
.net-dot.off{display:inline-block;background:#e2552b}
.net-dot.pack{display:inline-block;background:#ff9a1f}

/* practice years: all cards the same size */
.years { grid-auto-rows: 1fr; align-items: stretch; }
.years .year-box { height: 100%; }
.years .year { flex: 1; width: 100%; justify-content: space-between; }
.years .year-dots { height: 43px; align-content: center; justify-content: center; }

/* ---- exam: answers are not marked on screen (the server marks them) ---- */
body.blind .dock-stars, body.blind .task-card .dots, body.blind .task-card .tc-pts { display: none !important; }
body.blind .dock-item.has-points .dock-num, body.blind .task-card.has-points, body.blind .task-card.full { box-shadow: none; }
.dock-saved { display: block; font-size: .78rem; font-weight: 800; color: #157a43; min-height: 1em; }
.tc-saved { display: block; margin-top: 6px; font-weight: 800; font-size: .9rem; color: #157a43; }
.tc-saved.no { color: #8a96a8; }
.receipt { margin: 18px auto 6px; max-width: 520px; padding: 18px 20px; border-radius: 18px; background: #eef8f2; border: 2px solid #bfe6cf; text-align: center; }
.receipt.wait { background: #fff7e6; border-color: #ffd98a; }
.receipt-state { font-size: 1.35rem; font-weight: 800; margin: 0 0 8px; }
.receipt-code { font-size: 1.1rem; margin: 6px 0; }
.receipt-code b { font-size: 1.5rem; letter-spacing: 2px; background: #fff; padding: 2px 10px; border-radius: 8px; }
.receipt-note { margin: 6px 0 0; color: #475569; }
.done-score.submitted .of { display: none; }
.done-score.submitted { font-size: 1.4rem; color: #157a43; }

/* The problem screen stays laid out (off screen, full size) while hidden, so problems that load in the background
   (all problems are loaded at the start of an exam) are drawn at their real size. */
#screenTest[hidden] { display: flex !important; visibility: hidden !important; position: fixed !important; left: -30000px !important; top: 0 !important;
  width: 100vw !important; height: calc(100vh - 64px) !important; pointer-events: none !important; }

/* bottom bar with the problems: 25% lower than before (logo, round pictures, names) */
@media (min-width: 861px) {
  .dock { padding-top: .35rem; padding-bottom: .3rem; }
  .dock-logo { height: 87px; }
  .dock-scroll { padding-top: 6px; padding-bottom: 1px; }
  .dock-item { width: 72px; gap: .25rem; }
  .dock-name { font-size: .66rem; max-width: 72px; line-height: 1.2; }
  .dock-num.has-img { width: 44px; height: 44px; }
  .dock-num.has-img img { width: 35px; height: 35px; }
  .dock-badge { min-width: 18px; height: 18px; font-size: .66rem; top: -4px; inset-inline-start: -4px; padding: 0 4px; }
  .dock-stars { font-size: .7rem; }
  .back-dock .dock-num { width: 44px; height: 44px; font-size: 1.1rem; }
  .dock-word { font-size: .68rem; }
}
