/* Galaxy (جالاكسي) — calm navy/blue base with gold accents (design direction A), plus the
   motivating pieces of direction B: daily goal ring, streak, coloured quiz tiles, pressable buttons.
   Brand colours come from the logo: navy #021F47, royal blue #0148A6, gold star #E0A50C. */
:root {
  --bg: #f3f5fa;
  --surface: #ffffff;
  --surface-2: #eef2f9;
  --border: #e0e6f1;
  --text: #0b1a3a;
  --muted: #586582;
  --navy: #021f47;
  --navy-ink: #ffffff;
  --primary: #0148a6;
  --primary-strong: #013680;
  --primary-ink: #ffffff;
  --primary-soft: #e6eefb;
  --gold: #e0a50c;
  --gold-soft: #fff4d6;
  --gold-ink: #7a5000;
  --good: #0b8a5a;
  --good-soft: #e2f5ec;
  --good-border: #9bd9bf;
  --bad: #c8322a;
  --bad-soft: #fdeceb;
  --bad-border: #f2b4ae;
  --warn: #a35a00;
  --warn-soft: #fff3df;
  --warn-border: #f1cf94;
  --shadow: 0 1px 2px rgba(2, 31, 71, .05), 0 6px 20px rgba(2, 31, 71, .06);
  --radius: 18px;
  --display: "Readex Pro", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --body: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #080f20; --surface: #0f1a32; --surface-2: #16233f; --border: #23314f;
    --text: #e7ecf8; --muted: #9aa7c4; --navy: #0b1d44; --navy-ink: #ffffff;
    --primary: #6f9cff; --primary-strong: #4a78de; --primary-ink: #06122b; --primary-soft: #182b55;
    --gold: #f2bd3c; --gold-soft: #33280d; --gold-ink: #f6cd6a;
    --good: #45cf8f; --good-soft: #10301f; --good-border: #24704b;
    --bad: #ff8077; --bad-soft: #391a1c; --bad-border: #8a3b3a;
    --warn: #ffc066; --warn-soft: #362810; --warn-border: #7a5a1d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #080f20; --surface: #0f1a32; --surface-2: #16233f; --border: #23314f;
  --text: #e7ecf8; --muted: #9aa7c4; --navy: #0b1d44; --navy-ink: #ffffff;
  --primary: #6f9cff; --primary-strong: #4a78de; --primary-ink: #06122b; --primary-soft: #182b55;
  --gold: #f2bd3c; --gold-soft: #33280d; --gold-ink: #f6cd6a;
  --good: #45cf8f; --good-soft: #10301f; --good-border: #24704b;
  --bad: #ff8077; --bad-soft: #391a1c; --bad-border: #8a3b3a;
  --warn: #ffc066; --warn-soft: #362810; --warn-border: #7a5a1d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

/* Logo images: the light version by default, the dark version in dark mode. */
.on-dark { display: none !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .on-light { display: none !important; }
  :root:not([data-theme="light"]) .on-dark { display: block !important; }
}
:root[data-theme="dark"] .on-light { display: none !important; }
:root[data-theme="dark"] .on-dark { display: block !important; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.7 var(--body);
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.35; margin: 0 0 .5rem; text-wrap: balance; }
h1 { font-size: 1.65rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; font-weight: 600; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden { display: none !important; }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; }
[dir="auto"] { unicode-bidi: plaintext; text-align: start; }
.icon { flex: none; display: block; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; }

/* Layout */
.wrap { max-width: 1000px; margin: 0 auto; padding-inline: 16px; }
.wrap.narrow { max-width: 760px; }
.topbar, .app-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar .wrap, .app-header .wrap { display: flex; align-items: center; gap: 10px; min-height: 64px; }
.brand { font-family: var(--display); font-weight: 700; font-size: 1.15rem; display: flex; align-items: center; gap: 10px; margin-inline-end: auto; color: var(--text); text-decoration: none; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  background: var(--navy); color: var(--navy-ink); font-weight: 700;
}
.brand-logo { display: inline-flex; align-items: center; }
.brand-logo img { height: 100%; width: auto; }
main { padding: 22px 0 64px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.stack > * + * { margin-top: 16px; }

/* Surfaces */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card.flat { box-shadow: none; }

/* Controls: the primary button sits on a darker edge and presses down (direction B). */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 9px 16px; border-radius: 14px; cursor: pointer; font-weight: 600;
  text-decoration: none; transition: background .15s, border-color .15s, transform .08s, box-shadow .08s;
  min-height: 44px;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); box-shadow: 0 3px 0 var(--primary-strong); }
.btn.primary:hover { filter: brightness(1.06); background: var(--primary); }
.btn.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--primary-strong); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #1d1300; box-shadow: 0 3px 0 color-mix(in srgb, var(--gold) 70%, #000); }
.btn.gold:active { transform: translateY(2px); box-shadow: 0 1px 0 color-mix(in srgb, var(--gold) 70%, #000); }
.btn.light { background: #fff; border-color: #fff; color: #021f47; }
.btn.light:hover { background: #f2f5fb; }
.btn.good { background: var(--good); border-color: var(--good); color: #fff; }
.btn.danger { color: var(--bad); border-color: var(--bad-border); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 4px 12px; min-height: 36px; font-size: .875rem; border-radius: 11px; }
.btn.icon { width: 44px; padding: 0; }
.btn.sm.icon { width: 36px; }
.btn.block { width: 100%; }
.btn.lg { min-height: 52px; font-size: 1.05rem; border-radius: 16px; }

label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-weight: 600; margin-bottom: 6px; font-size: .95rem; }
.input, textarea.input, select.input {
  width: 100%; padding: 10px 14px; border-radius: 12px; min-height: 44px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea.input { min-height: 96px; resize: vertical; line-height: 1.6; }
textarea.input.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9rem; min-height: 260px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap;
}
.badge.good { background: var(--good-soft); color: var(--good); border-color: var(--good-border); }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-border); }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-border); }
.badge.info { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.badge.gold { background: var(--gold-soft); color: var(--gold-ink); border-color: transparent; }

.alert {
  padding: 12px 16px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface-2); margin-bottom: 16px;
}
.alert.bad { background: var(--bad-soft); border-color: var(--bad-border); color: var(--bad); }
.alert.warn { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn); }
.alert.good { background: var(--good-soft); border-color: var(--good-border); color: var(--good); }

/* Login and blocked screens */
.auth { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 16px; padding: 24px 16px; }
.auth .card { width: 100%; max-width: 420px; padding: 28px 26px; }
.auth .brand-mark { width: 56px; height: 56px; border-radius: 16px; font-size: 1.5rem; margin: 0 auto 12px; }
.auth h1 { text-align: center; }
.auth .lead { text-align: center; color: var(--muted); margin-bottom: 22px; }
.full-logo { display: flex; justify-content: center; margin: 0 auto 6px; }
.full-logo img { height: 132px; width: auto; }
.blocked { text-align: center; }
.blocked .icon-circle {
  width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 16px; display: grid; place-items: center;
  background: var(--bad-soft); color: var(--bad);
}

/* Student shell: header with streak, bottom tab bar on phones, header links on wide screens */
.app-header .head-nav { display: none; gap: 4px; }
.head-nav button, .tabbar button {
  border: 0; background: transparent; color: var(--muted); cursor: pointer; font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px;
}
.head-nav button { padding: 8px 12px; border-radius: 12px; }
.head-nav button:hover { background: var(--surface-2); }
.head-nav button.active { background: var(--primary-soft); color: var(--primary); }
.streak-chip {
  display: inline-flex; align-items: center; gap: 4px; height: 38px; padding: 0 12px; border-radius: 12px;
  background: var(--gold-soft); color: var(--gold-ink); font-family: var(--display); font-weight: 700; border: 0;
}
.streak-chip .icon { color: var(--gold); }
.streak-chip.cold { background: var(--surface-2); color: var(--muted); }
.streak-chip.cold .icon { color: var(--muted); }
.tabbar {
  position: fixed; bottom: 0; inset-inline: 0; z-index: 30;
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
}
.tabbar button { flex-direction: column; gap: 2px; font-size: .75rem; padding: 6px 0; border-radius: 14px; min-height: 52px; justify-content: center; position: relative; }
.tabbar button.active { color: var(--primary); background: var(--primary-soft); }
.tab-count {
  position: absolute; top: 4px; inset-inline-start: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 99px; background: var(--gold); color: #1d1300; font-size: .68rem; line-height: 18px; font-weight: 700;
}
body.has-tabbar main { padding-bottom: 110px; }
@media (min-width: 900px) {
  .app-header .head-nav { display: flex; }
  .tabbar { display: none; }
  body.has-tabbar main { padding-bottom: 64px; }
}

/* Home */
.greet { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 18px; }
@media (min-width: 600px) { .greet { flex-direction: row; align-items: flex-end; } }
.greet h1 { margin: 0; }
.greet .sub { color: var(--muted); font-size: .95rem; }
.sub-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--border); font-size: .85rem; font-weight: 600;
}
.sub-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.sub-chip.ending { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn); }
.sub-chip.ending .dot { background: var(--warn); }
.home-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .home-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; } }
.home-grid > * { min-width: 0; }

.goal-card { display: grid; gap: 14px; }
.goal-top { display: flex; align-items: center; gap: 16px; }
.goal-ring { position: relative; width: 84px; height: 84px; flex: none; }
.goal-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.goal-ring .val { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 1.05rem; direction: ltr; }
.goal-ring .track { stroke: var(--surface-2); }
.goal-ring .fill { stroke: var(--good); transition: stroke-dasharray .5s ease; }
.goal-top h2 { margin: 0; font-size: 1.15rem; }
.goal-top p { margin: 2px 0 0; color: var(--muted); font-size: .92rem; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; }
.week .day { display: grid; justify-items: center; gap: 4px; font-size: .72rem; color: var(--muted); }
.week .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: #fff; }
.week .met .dot { background: var(--gold); }
.week .today { color: var(--text); font-weight: 700; }
.week .today:not(.met) .dot { background: transparent; border: 3px solid var(--gold); }
.goal-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: .9rem; }

/* Ring strokes shared by the goal ring, resume ring and result ring */
.goal-track { stroke: var(--surface-2); }
.goal-fill-blue { stroke: var(--primary); }
.goal-fill-bad { stroke: var(--bad); }
@media (min-width: 900px) {
  .home-grid > .goal-card { grid-column: 2; grid-row: 1 / span 3; }
  .home-grid > :not(.goal-card) { grid-column: 1; }
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Mock exam hero: navy, with the logo's orbit and gold star */
.hero {
  position: relative; overflow: hidden; border-radius: 24px; padding: 22px;
  background: var(--navy); color: #fff; display: grid; gap: 14px; box-shadow: var(--shadow);
}
.hero::before {
  content: ""; position: absolute; width: 360px; height: 120px; inset-inline-start: -90px; top: -10px;
  border: 10px solid #1d5fd0; border-color: #1d5fd0 transparent transparent transparent; border-radius: 50%;
  transform: rotate(-14deg); opacity: .8;
}
.hero .star { position: absolute; top: 18px; inset-inline-start: 22px; color: var(--gold); }
.hero > * { position: relative; }
.hero .pill { justify-self: start; display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; background: rgba(255, 255, 255, .14); padding: 4px 10px; border-radius: 99px; }
.hero h2 { margin: 0; font-size: 1.6rem; }
.hero p { margin: 0; color: #c3cde6; font-size: .95rem; }
.hero .hero-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.hero .hero-row .btn { flex: 1 1 180px; }
.hero .last { display: grid; justify-items: center; line-height: 1.2; padding: 0 6px; }
.hero .last b { font-family: var(--display); font-size: 1.35rem; }
.hero .last span { font-size: .72rem; color: #c3cde6; }

.resume-card { display: flex; align-items: center; gap: 14px; }
.resume-card .meta { flex: 1; min-width: 0; display: grid; }
.resume-card .meta b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-ring { position: relative; width: 52px; height: 52px; flex: none; }
.mini-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.mini-ring span { position: absolute; inset: 0; display: grid; place-items: center; font-size: .75rem; font-weight: 700; direction: ltr; }
.flag-card { display: flex; align-items: center; gap: 14px; background: var(--gold-soft); border-color: transparent; }
.flag-card .ico { width: 44px; height: 44px; border-radius: 14px; background: var(--gold); color: #1d1300; display: grid; place-items: center; flex: none; }
.flag-card .meta { flex: 1; min-width: 0; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 26px 0 12px; }
.section-head h2 { margin: 0; }

/* Coloured quiz tiles (direction B). --tile is set per tile. */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.tile {
  --tile: #0148a6;
  text-align: start; cursor: pointer; display: grid; gap: 10px; align-content: start;
  padding: 16px; border-radius: 22px; border: 1px solid color-mix(in srgb, var(--tile) 22%, transparent);
  background: color-mix(in srgb, var(--tile) 10%, var(--surface));
  box-shadow: 0 4px 0 color-mix(in srgb, var(--tile) 22%, transparent);
  transition: transform .08s, box-shadow .08s;
}
.tile:hover { background: color-mix(in srgb, var(--tile) 15%, var(--surface)); }
.tile:active { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--tile) 22%, transparent); }
.tile .ico { width: 44px; height: 44px; border-radius: 14px; background: var(--tile); color: #fff; display: grid; place-items: center; }
.tile b { font-size: 1rem; line-height: 1.4; }
.tile .bar { height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--tile) 18%, transparent); overflow: hidden; }
.tile .bar i { display: block; height: 100%; border-radius: 99px; background: var(--tile); }
.tile .foot { font-size: .8rem; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.t-blue { --tile: #1d64d8; } .t-green { --tile: #0f9a63; } .t-gold { --tile: #d1940a; }
.t-coral { --tile: #e0533f; } .t-violet { --tile: #6a4fd6; } .t-teal { --tile: #0e8a8a; }

.services-card { display: grid; gap: 10px; background: var(--primary-soft); border-color: transparent; box-shadow: none; }
.services-card h2 { margin: 0; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; }
.services-card h2 .icon { color: var(--gold); }
.services-list { margin: 0; padding-inline-start: 22px; line-height: 1.95; font-weight: 500; }
.services-card .btn { justify-self: start; }
.auth .services-card { max-width: 420px; width: 100%; }

/* Question counter, free trial */
.alert.info { background: var(--primary-soft); border-color: transparent; color: var(--text); }
.q-counter {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin: -6px 0 18px;
  border-radius: 14px; background: var(--primary-soft);
}
.q-counter .ico { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--primary); color: var(--primary-ink); flex: none; }
.q-counter b { display: block; font-family: var(--display); font-size: 1.5rem; line-height: 1.1; color: var(--primary); }
.q-counter span { font-size: .88rem; color: var(--muted); font-weight: 500; }
.trial-cta {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 18px; padding: 14px; border-radius: 14px; background: var(--gold-soft);
}
.trial-cta b { display: block; color: var(--gold-ink); }
.trial-cta span { font-size: .88rem; color: var(--muted); }
.auth .card.trial-intro { max-width: 480px; }
.trial-pill {
  display: flex; width: max-content; align-items: center; gap: 6px; margin: 4px auto 8px; padding: 4px 12px;
  border-radius: 99px; background: var(--gold-soft); color: var(--gold-ink); font-size: .8rem; font-weight: 700;
}
.trial-intro h1 { margin-bottom: 6px; }
.trial-features { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.trial-features li { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: .93rem; }
.trial-features .ico { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--good-soft); color: var(--good); flex: none; }
.cta-card { margin-top: 16px; display: grid; gap: 10px; justify-items: center; text-align: center; background: var(--primary-soft); border-color: transparent; }
.cta-card .ico { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--gold); color: #1d1300; }
.cta-card h2 { margin: 0; }
.cta-card p { margin: 0; color: var(--muted); max-width: 46ch; line-height: 1.8; }
.cta-card .stack { width: 100%; max-width: 360px; }
.cta-card.big { background: linear-gradient(135deg, #021f47, #0148a6); color: #fff; }
.cta-card.big p { color: #c3cde6; }
.cta-card.big .btn.ghost { color: #fff; }
.cta-card.big .btn.ghost:hover { background: rgba(255, 255, 255, .1); }
.cta-stats { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 4px 0; }
.cta-stats div { min-width: 92px; padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, .1); display: grid; }
.cta-stats b { font-family: var(--display); font-size: 1.35rem; color: var(--gold); }
.cta-stats span { font-size: .78rem; color: #c3cde6; }

/* Quiz list (kept for older markup) */
.quiz-card { display: flex; flex-direction: column; gap: 10px; }
.quiz-card h3 { margin: 0; }
.quiz-card .actions { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.mini-progress { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.mini-progress > i { display: block; height: 100%; background: var(--primary); }
.sheet-actions { display: grid; gap: 10px; }

/* Question player */
.focus-head { display: flex; align-items: center; gap: 10px; }
.focus-head .prog { flex: 1; min-width: 0; display: grid; gap: 6px; }
.focus-head .prog .line { display: flex; justify-content: space-between; gap: 8px; font-size: .85rem; }
.player-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.player-head h2 { margin: 0; font-size: 1.15rem; }
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: var(--primary); transition: width .35s ease; }
.score-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.flag-btn.on { background: var(--gold-soft); border-color: var(--gold); color: var(--gold-ink); }

.q-card {
  background: var(--surface); border: 2px solid var(--border); border-radius: 22px;
  padding: 22px; box-shadow: var(--shadow); margin-top: 16px;
  transition: border-color .25s, background .25s;
  -webkit-user-select: none; user-select: none;
}
.q-card.is-correct { border-color: var(--good); }
.q-card.is-wrong { border-color: var(--bad); animation: shake .4s ease; }
.q-num { font-weight: 600; color: var(--muted); font-size: .88rem; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.q-text { font-family: var(--display); font-size: 1.18rem; font-weight: 600; line-height: 1.6; margin-bottom: 14px; white-space: pre-wrap; }
.player .q-text { -webkit-user-select: text; user-select: text; cursor: text; }
.q-text mark { background: #ffe58a; color: #1d1300; border-radius: 4px; padding: 0 1px; cursor: pointer; }
.q-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: -4px 0 14px; font-size: .82rem; color: var(--muted); }
.q-tools .btn { min-height: 34px; }
.options { display: grid; gap: 10px; }
.opt-wrap { display: flex; align-items: stretch; gap: 6px; }
.opt-wrap .option { flex: 1; }
.strike-btn {
  flex: none; width: 44px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); cursor: pointer; display: grid; place-items: center;
}
.strike-btn:hover { background: var(--surface-2); }
.strike-btn.on { background: var(--surface-2); color: var(--bad); }
.option {
  display: flex; align-items: center; gap: 12px; text-align: start; width: 100%;
  padding: 12px 14px; border-radius: 16px; border: 2px solid var(--border);
  background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s, transform .1s, opacity .15s;
  font-size: 1rem; line-height: 1.6; box-shadow: 0 3px 0 var(--border);
}
button.option:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-soft); }
button.option:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--border); }
.option:disabled { cursor: default; }
.option .letter {
  flex: none; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  background: var(--surface-2); font-weight: 700; border: 1px solid var(--border);
}
.option .otext { flex: 1; white-space: pre-wrap; }
.option .mark { flex: none; display: grid; place-items: center; }
.option.correct { border-color: var(--good); background: var(--good-soft); box-shadow: 0 3px 0 var(--good-border); }
.option.correct .letter { background: var(--good); color: #fff; border-color: var(--good); }
.option.correct .mark { color: var(--good); }
.option.wrong { border-color: var(--bad); background: var(--bad-soft); box-shadow: 0 3px 0 var(--bad-border); }
.option.wrong .letter { background: var(--bad); color: #fff; border-color: var(--bad); }
.option.wrong .mark { color: var(--bad); }
.option.dim { opacity: .6; box-shadow: none; }
.option.struck { opacity: .45; }
.option.struck .otext { text-decoration: line-through; text-decoration-thickness: 2px; }
.option.pop { animation: pop .35s ease; }
.option.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 3px 0 var(--primary); }
.option.selected .letter { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }

.feedback { margin-top: 16px; border-radius: 18px; padding: 16px; border: 1px solid var(--border); background: var(--surface-2); animation: rise .3s ease; }
.feedback.good { background: var(--good-soft); border-color: var(--good-border); }
.feedback.bad { background: var(--bad-soft); border-color: var(--bad-border); }
.feedback .verdict { font-family: var(--display); font-weight: 700; font-size: 1.05rem; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.feedback.good .verdict { color: var(--good); }
.feedback.bad .verdict { color: var(--bad); }
.feedback .explain { white-space: pre-wrap; background: color-mix(in srgb, var(--surface) 70%, transparent); border-radius: 12px; padding: 10px 12px; margin-top: 8px; }
.feedback .explain-title { font-weight: 700; margin-top: 8px; }

.player-nav { display: flex; gap: 10px; margin-top: 18px; align-items: center; flex-wrap: wrap; }
.navigator { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 20px; }
.navigator button {
  width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-weight: 600; font-size: .85rem; position: relative;
}
.navigator button.correct { background: var(--good); border-color: var(--good); color: #fff; }
.navigator button.wrong { background: var(--bad); border-color: var(--bad); color: #fff; }
.navigator button.current { outline: 3px solid var(--primary); outline-offset: 1px; }
.navigator button.flagged::after { content: ""; position: absolute; top: -3px; inset-inline-end: -3px; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); border: 2px solid var(--surface); }

/* Mock exam timer */
.timer {
  display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 12px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  font-family: var(--display); font-weight: 700; font-variant-numeric: tabular-nums; direction: ltr;
}
.timer svg { transform: rotate(-90deg); }
.timer .t-track { stroke: var(--gold-soft); }
.timer .t-fill { stroke: var(--gold); transition: stroke-dasharray .25s linear; }
.timer.low { background: var(--bad-soft); border-color: var(--bad-border); color: var(--bad); }
.timer.low .t-fill { stroke: var(--bad); }
.timer.is-hidden { display: none; }
.rules { margin: 0; padding-inline-start: 20px; line-height: 1.9; }
.warn-text { color: var(--warn); font-weight: 700; }

/* Results */
.result-hero { text-align: center; padding: 28px 20px; display: grid; justify-items: center; gap: 10px; }
.result-hero h1 { margin: 0; }
.ring { width: 168px; height: 168px; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .val { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; font-family: var(--display); font-size: 2.6rem; font-weight: 700; line-height: 1; }
.ring .val small { display: block; font-family: var(--body); font-size: .85rem; font-weight: 500; color: var(--muted); margin-top: 6px; }
.delta-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; font-weight: 600; font-size: .9rem; background: var(--surface-2); }
.delta-chip.up { background: var(--good-soft); color: var(--good); }
.delta-chip.down { background: var(--bad-soft); color: var(--bad); }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 10px; width: 100%; }
.stat-tiles > div { background: var(--surface-2); border-radius: 16px; padding: 12px 6px; display: grid; justify-items: center; }
.stat-tiles b { font-family: var(--display); font-size: 1.4rem; line-height: 1.3; }
.stat-tiles span { font-size: .8rem; color: var(--muted); }
.result-actions { display: grid; gap: 10px; width: 100%; max-width: 420px; }
.stats { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin: 16px 0 20px; }
.stat { min-width: 110px; padding: 10px 14px; border-radius: 14px; background: var(--surface-2); }
.stat b { display: block; font-size: 1.4rem; }

/* Score per file (feature 5): horizontal bars, weakest highlighted */
.topics { display: grid; gap: 14px; }
.topic { display: grid; gap: 6px; }
.topic .line { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: .95rem; }
.topic .line b { font-family: var(--display); font-variant-numeric: tabular-nums; }
.topic .bar { height: 12px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.topic .bar i { display: block; height: 100%; border-radius: 99px; background: var(--primary); }
.topic.weak .bar i { background: var(--bad); }
.topic.weak .line b { color: var(--bad); }
.topic.strong .bar i { background: var(--good); }
.topic .focus { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 600; color: var(--bad); }

.review-item { border-inline-start: 5px solid var(--border); }
.review-item.correct { border-inline-start-color: var(--good); }
.review-item.wrong { border-inline-start-color: var(--bad); }
.review-item.skipped { border-inline-start-color: var(--warn); }
.review-item .q-text { font-size: 1.02rem; margin-bottom: 10px; }
.review-item .option { cursor: default; padding: 8px 12px; box-shadow: none; }

/* Flagged questions and account pages */
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.flag-list { display: grid; gap: 10px; }
.flag-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.flag-item .meta { flex: 1; min-width: 0; display: grid; gap: 4px; }
.flag-item .meta .q { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 500; }
.settings-list { display: grid; }
.settings-list > .item { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.settings-list > .item:last-child { border-bottom: 0; }
.settings-list .item .meta { flex: 1; min-width: 0; display: grid; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  min-height: 40px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; font-weight: 600; font-family: var(--display);
}
.chip.active { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.avatar {
  width: 56px; height: 56px; border-radius: 18px; background: var(--navy); color: #fff;
  display: grid; place-items: center; font-family: var(--display); font-weight: 700; font-size: 1.4rem; flex: none;
}

/* Tabs and tables (dashboard) */
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs button {
  border: 0; background: transparent; padding: 10px 14px; border-radius: 12px; cursor: pointer;
  font-weight: 600; color: var(--muted); white-space: nowrap;
}
.tabs button.active { background: var(--primary-soft); color: var(--primary); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .82rem; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td .row { gap: 6px; flex-wrap: nowrap; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .input { max-width: 280px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.kpi b { display: block; font-family: var(--display); font-size: 1.6rem; line-height: 1.2; }

/* Question editor */
.q-edit { position: relative; }
.q-edit .q-edit-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.q-edit .opt-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.q-edit .opt-row input[type="radio"] { width: 20px; height: 20px; accent-color: var(--good); flex: none; }
.q-edit .opt-row .input { flex: 1; }
.q-edit.invalid { border-color: var(--bad); }
.parsed-list .card { padding: 14px 16px; }
.parsed-list ol { margin: 6px 0 0; padding-inline-start: 22px; }
.parsed-list li.is-correct { color: var(--good); font-weight: 700; }

/* Question images */
.q-img {
  display: block; padding: 0; margin: 0 0 16px; max-width: 100%; border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden; background: #fff; cursor: zoom-in;
}
.q-img img { display: block; max-width: 100%; max-height: 420px; width: auto; height: auto; -webkit-user-drag: none; }
.review-item .q-img img { max-height: 260px; }
.lightbox {
  position: fixed; inset: 0; z-index: 80; background: rgba(2, 8, 22, .9);
  display: grid; place-items: center; padding: 16px; cursor: zoom-out; animation: fade .15s ease;
}
.lightbox img { max-width: 100%; max-height: calc(100vh - 32px); border-radius: 8px; background: #fff; }
.lightbox .btn { position: fixed; top: 12px; inset-inline-end: 12px; }
.img-control { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 4px; }
.img-control .q-img { margin: 0; }
.img-control .q-img img { max-height: 120px; }
.q-edit.drop-target { outline: 3px dashed var(--primary); outline-offset: 2px; }

/* Progress chart (single series: the brand blue) */
.chart { position: relative; width: 100%; min-height: 240px; margin-top: 8px; }
.chart-svg { display: block; overflow: visible; outline: none; border-radius: 8px; }
.chart-svg:focus-visible { box-shadow: 0 0 0 3px var(--primary-soft); }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-base { stroke: var(--muted); stroke-width: 1; opacity: .45; }
.chart-axis { fill: var(--muted); font-size: 11px; font-family: var(--body); }
.chart-line { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: var(--primary); opacity: .1; }
.chart-dot { fill: var(--primary); stroke: var(--surface); stroke-width: 2; transition: r .1s; }
.chart-cross { stroke: var(--muted); stroke-width: 1; opacity: 0; }
.chart-label { fill: var(--text); font-size: 12px; font-weight: 700; font-family: var(--display); }
.chart-tip {
  position: absolute; display: none; flex-direction: column; pointer-events: none; z-index: 2;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  border-radius: 10px; padding: 6px 10px; font-size: .8rem; line-height: 1.5; white-space: nowrap; direction: rtl;
}
.chart-tip b { font-size: 1.05rem; }
.kpi .badge { margin-top: 4px; }

/* Modal (a bottom sheet on phones) */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(2, 10, 28, .55);
  display: grid; place-items: center; padding: 16px; animation: fade .15s ease;
}
.modal {
  width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto;
  background: var(--surface); border-radius: 24px; padding: 24px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
.modal.wide { max-width: 920px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
@media (max-width: 600px) {
  .modal-backdrop { place-items: end stretch; padding: 0; }
  .modal { border-radius: 24px 24px 0 0; max-height: 88vh; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); animation: rise .2s ease; }
  .modal-actions .btn { flex: 1; }
}

/* Toast, spinner, confetti */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, calc(100% + 60px)); z-index: 60; visibility: hidden;
  background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 14px; box-shadow: var(--shadow);
  font-weight: 600; transition: transform .25s ease, visibility .25s; max-width: calc(100vw - 32px); text-align: center;
}
body.has-tabbar #toast { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
#toast.show { transform: translate(-50%, 0); visibility: visible; }
#toast.bad { background: var(--bad); color: #fff; }
.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 4px solid var(--border); border-top-color: var(--primary); animation: spin .8s linear infinite; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); display: grid; justify-items: center; gap: 8px; }
.empty .big { width: 64px; height: 64px; border-radius: 20px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes pop { 50% { transform: scale(1.03); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes pulse { 50% { opacity: .55; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 600px) {
  h1 { font-size: 1.4rem; }
  .card { padding: 16px; }
  .q-card { padding: 18px 16px; }
  .q-text { font-size: 1.08rem; }
  .player-nav .btn { flex: 1; }
  .hide-sm { display: none !important; }
  .modal { padding: 18px; }
  .hero h2 { font-size: 1.4rem; }
}

@media print {
  .topbar, .app-header, .tabbar, .player-nav, .navigator, .btn { display: none !important; }
}

/* Arabic translation */
.tr-box {
  margin: 10px 0 0; padding: 10px 14px; border-radius: 12px; background: var(--gold-soft); color: var(--text);
  border-inline-start: 4px solid var(--gold); line-height: 1.9; font-weight: 500; white-space: pre-wrap;
  display: flex; align-items: center; gap: 10px;
}
.tr-box.muted { color: var(--muted); font-weight: 400; }
.option .otr { display: block; margin-top: 4px; font-size: .9em; color: var(--muted); font-weight: 500; direction: rtl; text-align: right; }
.option.struck .otr { text-decoration: line-through; }
.explain-ar { margin-top: 10px; border-top: 1px dashed var(--border); padding-top: 10px; }
.btn.tr-on { background: var(--gold-soft); border-color: var(--gold); color: var(--gold-ink); }
.spinner.sm { width: 18px; height: 18px; border-width: 3px; flex: none; }

/* Search */
.search-bar { position: relative; margin-bottom: 16px; }
.search-bar .ico { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); display: flex; pointer-events: none; }
.search-bar .input { padding-inline-start: 44px; height: 52px; font-size: 1.05rem; border-radius: 14px; }
.search-item .q-num { display: flex; align-items: center; gap: 8px; }
.search-item .q-text mark, .search-item .otext mark, .admin-search mark { background: #ffe58a; color: #1d1300; border-radius: 4px; padding: 0 1px; }
.search-item .option { cursor: default; }
.admin-search { margin-bottom: 16px; }
.admin-search .hit { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--border); }
.admin-search .hit:first-of-type { border-top: 0; }
.admin-search .hit .txt { flex: 1; }

.tr-edit { margin-top: 12px; border: 1px dashed var(--border); border-radius: 12px; padding: 8px 12px; }
.tr-edit summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 8px; list-style: none; }
.tr-edit summary::-webkit-details-marker { display: none; }
.tr-edit .opt-row { margin-top: 6px; }
.q-edit.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 4px var(--gold); } 100% { box-shadow: none; } }

/* Why each option is right or wrong (after answering) */
.option .onote {
  display: block; margin-top: 8px; padding: 8px 10px; border-radius: 10px; font-size: .9em; line-height: 1.7;
  background: var(--surface-2); color: var(--text); font-weight: 400; white-space: normal; text-align: start;
}
.option .onote b { display: block; font-size: .85em; margin-bottom: 2px; color: var(--muted); }
.option .onote.right { background: var(--good-soft); }
.option .onote.right b { color: var(--good); }
.option .onote.chosen { background: var(--bad-soft); }
.option .onote.chosen b { color: var(--bad); }
.option.dim:has(.onote) { opacity: 1; }
.option.dim:has(.onote) .letter, .option.dim:has(.onote) .otext > :not(.onote) { opacity: .65; }
.option .onote-ar { display: block; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border); direction: rtl; text-align: right; font-weight: 500; }

/* Content protection: watermark with the viewer's name, no printing */
#wm {
  position: fixed; inset: -20%; z-index: 60; pointer-events: none; user-select: none;
  display: grid; grid-template-columns: repeat(4, 1fr); align-content: space-around; gap: 70px 30px;
  transform: rotate(-24deg); opacity: .07; overflow: hidden;
}
#wm span { white-space: nowrap; font: 600 15px/1 var(--display); color: var(--text); text-align: center; }
body.protect .q-card, body.protect .search-item, body.protect .review-item, body.protect .result-hero { -webkit-touch-callout: none; }
@media print {
  body.protect #app, body.protect #wm, body.protect .tabbar { display: none !important; }
  body.protect::before { content: "طباعة محتوى المنصة غير مسموحة"; display: block; padding: 40px; font-size: 20px; text-align: center; }
}

.tabs .tab-count { position: static; display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-inline-start: 6px;
  border-radius: 99px; background: var(--bad); color: #fff; font-size: .72rem; font-weight: 700; }
table.events tr.unseen td { background: color-mix(in srgb, var(--bad-soft) 60%, transparent); }

.terms-text { white-space: pre-wrap; line-height: 1.9; max-height: 45vh; overflow: auto; padding: 14px; border-radius: 12px;
  background: var(--surface-2); font-size: .93rem; text-align: start; }
.copyright { margin: 28px auto 8px; text-align: center; font-size: .75rem; color: var(--muted); max-width: 520px; line-height: 1.7; }
.auth .copyright { margin-top: 4px; }

.q-tools .report-btn, .search-item .report-btn { color: var(--muted); font-weight: 500; }
.q-tools .spacer { flex: 1; }

.ref-code { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-radius: 12px;
  border: 2px dashed var(--gold); background: var(--gold-soft); }
.ref-code b { font: 700 1.5rem/1 var(--display); letter-spacing: .15em; color: var(--gold-ink); }
.icon-circle.good { background: var(--good-soft); color: var(--good); }
.request-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: start; padding: 12px 0; border-top: 1px solid var(--border); }
.request-row:first-of-type { border-top: 0; }
.request-row .receipt { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); cursor: zoom-in; }

/* Study tools on the home page: readiness, smart review, exam simulation, weekly challenge */
.study-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); align-items: start; }
.study-card { display: grid; gap: 12px; }
.study-card h3 { margin: 0; font-size: 1.05rem; }
.study-card p { margin: 2px 0 0; }
.study-top { display: flex; align-items: center; gap: 14px; }
.study-top > div { min-width: 0; }
.study-ico { width: 44px; height: 44px; border-radius: 14px; color: #fff; display: grid; place-items: center; flex: none; }
.study-ico.t-blue { background: var(--primary); }
.study-ico.t-green { background: var(--good); }
.study-ico.t-navy { background: var(--primary-strong); }
.study-ico.t-gold { background: var(--gold); color: #1d1300; }
.mini-ring.big { width: 76px; height: 76px; }
.mini-ring.big span { font-size: 1.05rem; font-family: var(--display); }
.ready-good { stroke: var(--good); }
.ready-warn { stroke: var(--gold); }
.ready-bad { stroke: var(--bad); }
.readiness .badge { margin-top: 6px; }
.ready-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ready-facts > div { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; display: grid; }
.ready-facts b { font-family: var(--display); font-size: 1.2rem; }
.ready-facts span { font-size: .8rem; color: var(--muted); }
.weak-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.board { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.board li { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); }
.board li.me { background: var(--primary-soft); font-weight: 700; }
.board .rank { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem; background: var(--surface); }
.board .rank.top1 { background: var(--gold); color: #1d1300; }
.board .rank.top2 { background: #c9d1de; color: #1b2433; }
.board .rank.top3 { background: #d9a273; color: #2b1606; }
.board .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .score { font-family: var(--display); font-weight: 700; direction: ltr; }
.board .time { direction: ltr; min-width: 44px; text-align: end; }
.challenge-rank { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.challenge-rank:empty { display: none; }

/* Exam simulation player */
.navigator button.answered { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.icon.is-on { color: var(--gold); border-color: var(--gold); }

/* ---------- Public landing page (lib/seo.php) ---------- */
.lp { background: var(--bg); color: var(--text); }
.lp main { padding: 0; }
.lp-logo.on-dark { display: none; }
.lp[hidden] { display: none; }
.lp-wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.lp-narrow { max-width: 780px; }
.lp a { color: inherit; }
.lp-top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.lp-top-in { display: flex; align-items: center; gap: 18px; height: 68px; }
.lp-brand { display: flex; align-items: center; flex: none; }
.lp-logo { height: 52px; width: auto; }
.lp-logo-text { font-family: var(--display); font-size: 1.3rem; }
.lp-top nav { display: flex; gap: 4px; margin-inline-start: auto; }
.lp-top nav a { text-decoration: none; padding: 8px 12px; border-radius: 10px; font-weight: 600; font-size: .92rem; color: var(--muted); }
.lp-top nav a:hover { background: var(--surface-2); color: var(--text); }
@media (max-width: 820px) { .lp-top nav { display: none; } .lp-top .lp-btn.small { margin-inline-start: auto; } }
.lp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 22px; border-radius: 14px;
  font-weight: 700; text-decoration: none; background: var(--primary); color: var(--primary-ink) !important; border: 1px solid transparent; font-family: var(--display); }
.lp-btn:hover { filter: brightness(1.06); }
.lp-btn.small { min-height: 40px; padding: 8px 16px; font-size: .92rem; }
.lp-btn.gold { background: var(--gold); color: #1d1300 !important; box-shadow: 0 4px 0 color-mix(in srgb, var(--gold) 55%, #000); }
.lp-btn.ghost { background: transparent; border-color: rgba(255, 255, 255, .45); color: #fff !important; }
.lp-btn.light { background: #fff; color: #021f47 !important; }
.lp-hero { background: var(--navy); color: #fff; padding: 56px 0 100px; position: relative; overflow: hidden; }
.lp-hero::before { content: ""; position: absolute; width: 900px; height: 280px; inset-inline-end: -260px; top: -40px; border: 18px solid #1d5fd0;
  border-color: #1d5fd0 transparent transparent transparent; border-radius: 50%; transform: rotate(-12deg); opacity: .5; pointer-events: none; }
.lp-hero-in { display: grid; gap: 40px; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); align-items: center; position: relative; }
@media (max-width: 900px) { .lp-hero-in { grid-template-columns: minmax(0, 1fr); } }
.lp-tag { display: inline-block; margin: 0 0 14px; padding: 6px 14px; border-radius: 99px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18); font-size: .85rem; font-weight: 600; }
.lp-hero h1 { font-size: clamp(1.9rem, 4.6vw, 3rem); line-height: 1.3; margin: 0 0 14px; }
.lp-lead { color: #c3cde6; font-size: 1.08rem; line-height: 1.9; margin: 0 0 24px; max-width: 620px; }
.lp-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.lp-cta.center { justify-content: center; }
.lp-by { color: #c3cde6; margin: 18px 0 0; font-size: .95rem; }
.lp-by b { color: #fff; }
.lp-mock { background: var(--surface); color: var(--text); border-radius: 22px; padding: 18px; box-shadow: 0 20px 50px rgba(0, 0, 0, .35); display: grid; gap: 10px; }
.lp-mock-head { display: flex; justify-content: space-between; font-size: .85rem; color: var(--muted); font-weight: 600; }
.lp-mock-time { direction: ltr; font-family: var(--display); color: var(--text); }
.lp-mock-q { font-weight: 700; margin: 4px 0; text-align: left; }
.lp-mock-opt { display: flex; gap: 10px; align-items: center; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; font-size: .92rem; text-align: left; }
.lp-mock-opt b { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); flex: none; font-size: .8rem; }
.lp-mock-opt.ok { border-color: var(--good); background: var(--good-soft); }
.lp-mock-opt.ok b { background: var(--good); color: #fff; }
.lp-mock-opt.bad { border-color: var(--bad-border); background: var(--bad-soft); }
.lp-mock-note { font-size: .85rem; color: var(--good); margin: -4px 4px 0; line-height: 1.6; }
.lp-mock-note.bad { color: var(--bad); }
.lp-stats-wrap { margin-top: -56px; position: relative; z-index: 2; }
.lp-stats { list-style: none; margin: 0; padding: 20px 10px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--surface);
  color: var(--text); border-radius: 22px; box-shadow: var(--shadow); position: relative; }
.lp-stats li { text-align: center; display: grid; gap: 2px; padding: 4px 8px; }
.lp-stats li + li { border-inline-start: 1px solid var(--border); }
.lp-stats b { font-family: var(--display); font-size: 1.6rem; color: var(--primary); }
.lp-stats span { color: var(--muted); font-size: .88rem; }
@media (max-width: 640px) { .lp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 16px; } .lp-stats li:nth-child(3) { border: 0; } }
.lp-sec { padding: 64px 0; }
.lp-sec.alt { background: var(--surface); padding: 64px 0; }
.lp-sec h2, .lp-final h2 { font-size: clamp(1.45rem, 3vw, 2rem); margin: 0 0 8px; text-align: center; }
.lp-sub { text-align: center; color: var(--muted); margin: 0 auto 32px; max-width: 640px; line-height: 1.8; }
.lp-muted { color: var(--muted); line-height: 1.8; }
.lp-center { text-align: center; }
.lp-features { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.lp-feature { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 20px; }
.lp-sec.alt .lp-feature { background: var(--bg); }
.lp-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); margin-bottom: 12px; }
.lp-ic svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.lp-feature h3 { margin: 0 0 6px; font-size: 1.08rem; }
.lp-feature p { margin: 0; color: var(--muted); line-height: 1.75; font-size: .95rem; }
.lp-topics { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.lp-topics li { background: var(--bg); border-radius: 16px; padding: 14px 16px; display: grid; gap: 2px; border-inline-start: 4px solid var(--gold); }
.lp-topics span { color: var(--muted); font-size: .85rem; text-align: right; }
.lp-steps { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.lp-steps li { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 20px; }
.lp-n { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: var(--primary-ink); font-family: var(--display); font-weight: 700; margin-bottom: 10px; }
.lp-steps h3 { margin: 0 0 6px; font-size: 1.05rem; }
.lp-steps p { margin: 0; color: var(--muted); line-height: 1.7; font-size: .93rem; }
.lp-h2-small { margin-top: 48px !important; }
.lp-plans { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin: 22px 0 10px; }
.lp-plan { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 22px; text-align: center; }
.lp-plan.best { background: var(--navy); color: #fff; border-color: var(--navy); }
.lp-plan h3 { margin: 0 0 6px; }
.lp-plan p { margin: 4px 0 0; color: var(--muted); }
.lp-plan.best p { color: #c3cde6; }
.lp-plan .lp-price { font-family: var(--display); font-size: 1.6rem; font-weight: 700; color: var(--primary); }
.lp-plan.best .lp-price { color: var(--gold); }
.lp-faq { display: grid; gap: 10px; margin-top: 24px; }
.lp-faq details { background: var(--bg); border-radius: 16px; padding: 4px 18px; border: 1px solid var(--border); }
.lp-faq summary { cursor: pointer; font-weight: 700; padding: 14px 0; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
.lp-faq summary::-webkit-details-marker { display: none; }
.lp-faq summary::after { content: "+"; font-size: 1.3rem; line-height: 1; color: var(--primary); }
.lp-faq details[open] summary::after { content: "−"; }
.lp-faq p { margin: 0 0 14px; color: var(--muted); line-height: 1.8; }
.lp-en { padding: 48px 0; text-align: left; }
.lp-en h2 { text-align: left; font-size: 1.3rem; }
.lp-en p { color: var(--muted); line-height: 1.8; margin: 0; }
.lp-final { background: var(--navy); color: #fff; text-align: center; padding: 64px 0; }
.lp-final p { color: #c3cde6; margin: 0 0 24px; }
.lp-foot { background: var(--navy); color: #c3cde6; border-top: 1px solid rgba(255, 255, 255, .1); padding: 40px 0 24px; }
.lp-foot-in { display: grid; gap: 28px; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
@media (max-width: 720px) { .lp-foot-in { grid-template-columns: minmax(0, 1fr); } }
.lp-foot img { height: 80px; width: auto; }
.lp-foot h3 { color: var(--gold); margin: 0 0 10px; font-size: 1.05rem; }
.lp-foot ul { margin: 0; padding-inline-start: 18px; line-height: 1.9; }
.lp-foot p { line-height: 1.8; }
.lp-wa { display: inline-flex; gap: 10px; align-items: center; background: #0b8a5a; color: #fff !important; text-decoration: none; padding: 10px 18px; border-radius: 14px; font-weight: 700; }
.lp-wa b { font-family: var(--display); letter-spacing: .5px; }
.lp-copy { margin-top: 28px; padding-top: 18px; border-top: 1px solid rgba(255, 255, 255, .1); font-size: .82rem; color: #93a3c6; }
body.protect .lp { -webkit-user-select: text; user-select: text; }
@media print { body.protect:has(#landing:not([hidden]))::before { display: none; } }

/* ---------- Articles (lib/articles.php) ---------- */
.ar-main { padding: 28px 0 64px; }
.ar-crumbs { font-size: .88rem; color: var(--muted); margin-bottom: 14px; }
.ar-crumbs a { color: var(--primary); text-decoration: none; }
.ar-article h1, .ar-index-title { font-size: clamp(1.7rem, 4vw, 2.4rem); line-height: 1.4; margin: 0 0 12px; }
.ar-lead { font-size: 1.12rem; color: var(--muted); line-height: 1.9; margin: 0 0 10px; }
.ar-meta { font-size: .85rem; color: var(--muted); margin: 0 0 22px; display: block; }
.ar-toc { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 16px 20px; margin: 0 0 28px; }
.ar-toc b { display: block; margin-bottom: 8px; font-family: var(--display); }
.ar-toc ol { margin: 0; padding-inline-start: 22px; line-height: 2; }
.ar-toc a { color: var(--primary); text-decoration: none; }
.ar-toc a:hover { text-decoration: underline; }
.ar-body { font-size: 1.06rem; line-height: 2; }
.ar-body h2 { font-size: 1.45rem; margin: 40px 0 12px; line-height: 1.5; scroll-margin-top: 84px; }
.ar-body h3 { font-size: 1.15rem; margin: 26px 0 8px; }
.ar-body p { margin: 0 0 16px; }
.ar-body ul, .ar-body ol { margin: 0 0 18px; padding-inline-start: 26px; }
.ar-body li { margin-bottom: 6px; }
.ar-body a { color: var(--primary); }
.ar-body blockquote { margin: 20px 0; padding: 14px 18px; border-radius: 14px; background: var(--gold-soft); border-inline-start: 5px solid var(--gold); }
.ar-body blockquote p { margin: 0; }
.ar-table { overflow-x: auto; margin: 0 0 20px; border: 1px solid var(--border); border-radius: 14px; }
.ar-table table { width: 100%; border-collapse: collapse; font-size: .95rem; line-height: 1.7; }
.ar-table th, .ar-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: start; vertical-align: top; }
.ar-table th { background: var(--surface-2); font-family: var(--display); font-weight: 600; }
.ar-table tr:last-child td { border-bottom: 0; }
.ar-cta { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; background: var(--navy); color: #fff; border-radius: 20px; padding: 22px; margin: 36px 0; }
.ar-cta > div { flex: 1 1 260px; }
.ar-cta b { font-family: var(--display); font-size: 1.15rem; }
.ar-cta p { margin: 6px 0 0; color: #c3cde6; line-height: 1.8; }
.ar-related { margin-top: 40px; border-top: 1px solid var(--border); padding-top: 20px; }
.ar-related h2 { font-size: 1.2rem; margin: 0 0 10px; }
.ar-related ul { margin: 0; padding-inline-start: 22px; line-height: 2.1; }
.ar-related a { color: var(--primary); text-decoration: none; }
.ar-cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin: 22px 0; }
.ar-card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 20px; display: grid; gap: 8px; align-content: start; }
.ar-card h2, .ar-card h3 { margin: 0; font-size: 1.12rem; line-height: 1.6; }
.ar-card a { color: inherit; text-decoration: none; }
.ar-card a:hover { color: var(--primary); }
.ar-card p { margin: 0; color: var(--muted); line-height: 1.8; font-size: .95rem; }
.ar-card .ar-meta { margin: 0; }
.ar-empty { text-align: center; padding: 60px 0; }
.ar-preview { margin-top: 16px; }
