:root {
  --teal: #0F6B6A;
  --teal-dark: #0B4B4A;
  --teal-light: #E3F1EF;
  --teal-line: #9FD0CA;
  --amber: #8A5208;
  --amber-dark: #6B4006;
  --amber-light: #FBEFD9;
  --gold: #F2C46D;
  --bg: #F6F5F1;
  --card: #FFFFFF;
  --ink: #172033;
  --muted: #5B6475;
  --line: #E3E1DA;
  --line-soft: #ECEAE4;
  --field: #FBFAF8;
  --field-line: #CFCCC3;
  --ok: #1E7A46;
  --ok-light: #E4F3EA;
  --bad: #A42A1D;
  --bad-light: #FBE7E4;
  --radius: 18px;
  --font: 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --display: 'Readex Pro', 'IBM Plex Sans Arabic', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
}
a { color: var(--teal); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.35; margin: 0; }
p { margin: 0; }
.m { font-family: var(--display); direction: ltr; unicode-bidi: isolate; }
.sq { white-space: nowrap; }
.sq > span { display: inline-block; border-top: 2px solid currentColor; padding: 1px 2px 0; margin-inline-start: -1px; line-height: 1.1; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ===== Layout ===== */
.wrap { width: 100%; max-width: 560px; margin-inline: auto; padding: 20px 16px 40px; display: flex; flex-direction: column; gap: 18px; }
.topbar { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-in { max-width: 560px; margin-inline: auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand img { height: 38px; width: auto; flex-shrink: 0; }
.brand .sep { width: 1px; height: 28px; background: #D5D2C9; flex-shrink: 0; }
.brand b { font-family: var(--display); font-weight: 600; font-size: 16px; display: block; white-space: nowrap; }
.brand small { font-size: 12px; color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a, .nav button { min-height: 44px; min-width: 44px; padding: 0 12px; border-radius: 12px; border: 0; background: transparent; color: var(--ink); text-decoration: none; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; font-weight: 500; }
.nav a:hover, .nav button:hover { background: var(--line-soft); }
.nav a[aria-current="page"] { background: var(--teal-light); color: var(--teal-dark); font-weight: 600; }
@media (max-width: 767px) {
  .nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--card); border-top: 1px solid var(--line); justify-content: space-around; gap: 2px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
  .nav a, .nav button { flex: 1 1 0; flex-direction: column; gap: 2px; min-height: 52px; padding: 0 4px; font-size: 11px; }
  .wrap { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
}

/* ===== Common blocks ===== */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.btn { min-height: 50px; padding: 0 18px; border-radius: 12px; border: 0; background: var(--teal); color: #fff; font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:hover { background: var(--teal-dark); }
.btn[disabled] { background: var(--line-soft); color: var(--muted); cursor: not-allowed; }
.btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--field-line); font-weight: 500; }
.btn.ghost:hover { background: var(--field); }
.btn.danger { background: var(--card); color: var(--bad); border: 1px solid #E8B4AE; }
.btn.danger:hover { background: var(--bad-light); }
.back { color: var(--muted); text-decoration: none; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; align-self: flex-start; }
.back:hover { color: var(--ink); }
.pill { font-size: 12px; font-weight: 600; border-radius: 99px; padding: 3px 10px; white-space: nowrap; }
.pill.ok { background: var(--ok-light); color: var(--ok); }
.pill.soon { background: var(--line-soft); color: var(--muted); }
.bar { height: 6px; background: var(--line-soft); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--teal); border-radius: 99px; }
.note { display: flex; gap: 10px; align-items: flex-start; background: var(--teal-light); color: var(--teal-dark); border-radius: 12px; padding: 12px 14px; font-size: 13px; line-height: 1.7; }
.note svg { flex-shrink: 0; margin-top: 2px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 500; }
.field input { height: 50px; border: 1px solid var(--field-line); border-radius: 12px; padding: 0 14px; font-size: 16px; background: var(--field); }
.field input[dir="ltr"] { text-align: right; }
.field input:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px var(--teal-light); }
.err { color: var(--bad); font-size: 13px; min-height: 1em; }
.empty { text-align: center; color: var(--muted); font-size: 14px; padding: 18px; }

/* ===== Login ===== */
.login { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.login-hero { background: var(--teal); color: #fff; border-radius: 0 0 36px 36px; padding: 48px 20px 96px; text-align: center; position: relative; overflow: hidden; }
.login-hero .sym { position: absolute; font-family: var(--display); color: #fff; opacity: .08; line-height: 1; pointer-events: none; }
.login-hero img { height: 84px; width: auto; filter: brightness(0) invert(1); }
.login-hero p { color: #D7ECEA; font-size: 13px; }
.login-hero h1 { font-size: 30px; font-weight: 700; margin-top: 2px; }
.login-box { width: calc(100% - 32px); max-width: 420px; margin: -64px auto 0; position: relative; }
.login-box h2 { font-size: 20px; font-weight: 600; }
.login-foot { margin: auto 0 0; padding: 24px 16px; text-align: center; font-size: 13px; color: var(--muted); }

/* ===== Units ===== */
.hello { background: var(--teal); color: #fff; border-radius: 22px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.hello .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.hello small { color: #D7ECEA; font-size: 13px; }
.hello h1 { font-size: 20px; font-weight: 600; }
.hello .pct { font-family: var(--display); font-size: 30px; font-weight: 700; }
.hello .bar { height: 8px; background: rgba(255,255,255,.22); }
.hello .bar > i { background: var(--gold); }
.home-top { display: flex; flex-direction: column; gap: 18px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; align-items: center; gap: 14px; color: var(--ink); text-decoration: none; }
.tile:hover { border-color: var(--teal-line); }
.tile .ic { width: 48px; height: 48px; border-radius: 14px; background: var(--amber-light); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tile b { font-size: 16px; display: block; }
.tile span { font-size: 13px; color: var(--muted); }
.tile .grow { flex-grow: 1; }
.sec-title { font-size: 18px; font-weight: 600; margin-top: 6px; }

/* ===== Leaderboard ===== */
.board-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.board-head h2 { font-size: 18px; font-weight: 600; }
.board-head .muted { font-size: 13px; }
.my-rank { display: flex; flex-direction: column; align-items: center; background: var(--teal-light); color: var(--teal-dark); border-radius: 14px; padding: 6px 14px; flex-shrink: 0; }
.my-rank span { font-size: 11px; }
.my-rank b { font-size: 22px; line-height: 1.2; }
.board-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.board-list li { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 4px 12px; border-radius: 12px; background: var(--field); }
.board-list li.me { background: var(--teal-light); box-shadow: inset 0 0 0 1.5px var(--teal); }
.board-list .rk { width: 30px; height: 30px; border-radius: 99px; display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 14px; font-weight: 600; flex-shrink: 0; background: var(--line-soft); color: var(--muted); }
.board-list .rk1 { background: var(--gold); color: #4A3200; }
.board-list .rk2 { background: #DCDDE1; color: #2F3542; }
.board-list .rk3 { background: #EBC9A6; color: #5A3511; }
.board-list .nm { flex-grow: 1; min-width: 0; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-list .nm em { font-style: normal; font-size: 11px; font-weight: 600; color: #fff; background: var(--teal); border-radius: 99px; padding: 1px 8px; margin-inline-start: 4px; }
.board-list b { font-size: 15px; font-weight: 600; }
.board-list.solo { border-top: 1px dashed var(--field-line); padding-top: 8px; }
.board-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.linkish { background: none; border: 0; padding: 0; min-height: 44px; color: var(--teal); font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.how { font-size: 13px; color: var(--muted); }
.how summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.how p { line-height: 1.8; max-width: 60ch; }
.demo-note { font-size: 12px; color: var(--amber-dark); background: var(--amber-light); border-radius: 10px; padding: 8px 12px; }
.units { display: grid; gap: 12px; align-items: start; }
.unit { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.unit[open] { border-color: var(--teal); }
.unit summary { list-style: none; cursor: pointer; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.unit summary::-webkit-details-marker { display: none; }
.unit .head { display: flex; align-items: center; gap: 12px; }
.unit .num { width: 40px; height: 40px; border-radius: 12px; background: var(--teal-light); color: var(--teal); font-family: var(--display); font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.unit[open] .num { background: var(--teal); color: #fff; }
.unit .head .grow { flex-grow: 1; min-width: 0; }
.unit .head b { font-size: 15px; display: block; }
.unit .head span { font-size: 12px; color: var(--muted); }
.unit .chev { transition: transform .2s; flex-shrink: 0; }
.unit[open] .chev { transform: rotate(180deg); }
.unit .body { padding: 0 16px 16px; display: flex; flex-direction: column; }
.topic-row { display: flex; align-items: center; gap: 12px; min-height: 56px; border-top: 1px solid var(--line-soft); color: var(--ink); text-decoration: none; }
.topic-row:hover b { color: var(--teal); }
.topic-row .grow { flex-grow: 1; min-width: 0; }
.topic-row b { font-size: 14px; font-weight: 500; display: block; }
.topic-row span { font-size: 12px; color: var(--muted); }
.dot { width: 26px; height: 26px; border-radius: 99px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; border: 2px solid var(--field-line); }
.dot.done { background: var(--ok); border-color: var(--ok); }
.unit-exam { margin-top: 12px; display: flex; align-items: center; gap: 12px; background: var(--amber-light); border-radius: 14px; padding: 14px; color: var(--ink); text-decoration: none; }
.unit-exam b { font-size: 14px; display: block; }
.unit-exam span { font-size: 12px; color: var(--amber-dark); }
.unit-exam.off { opacity: .6; pointer-events: none; }

/* ===== Topic ===== */
.topic-grid { display: grid; gap: 16px; align-items: start; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--line-soft); border-radius: 14px; padding: 4px; }
.tabs button { height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 500; }
.tabs button[aria-selected="true"] { background: var(--card); color: var(--ink); font-weight: 600; }
.player { aspect-ratio: 16 / 9; border-radius: var(--radius); background: var(--ink); overflow: hidden; display: flex; align-items: center; justify-content: center; color: #C9CFDA; text-align: center; padding: 16px; font-size: 14px; }
.player iframe { width: 100%; height: 100%; border: 0; display: block; }
.player:has(iframe) { padding: 0; }
.player-wrap { padding: 0; }
.clips { display: flex; flex-direction: column; gap: 8px; }
.clip { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); text-align: start; width: 100%; font-size: 14px; font-weight: 500; }
.clip .n { width: 26px; height: 26px; border-radius: 8px; background: var(--line-soft); color: var(--muted); font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.clip[aria-current="true"] { background: var(--teal-light); border-color: var(--teal-line); }
.clip[aria-current="true"] .n { background: var(--teal); color: #fff; }
.attempts { display: flex; align-items: center; gap: 8px; font-size: 13px; flex-wrap: wrap; }
.attempts i { width: 22px; height: 8px; border-radius: 99px; background: var(--field-line); }
.attempts i.used { background: var(--teal); }
.best { display: flex; flex-direction: column; align-items: flex-end; }
.best span { font-size: 12px; color: var(--muted); }
.best b { font-family: var(--display); font-size: 18px; color: var(--ok); }
.quiz-card .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.quiz-card h2 { font-size: 17px; font-weight: 600; }

/* ===== Quiz ===== */
.quiz-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.quiz-head small { font-size: 12px; color: var(--muted); display: block; }
.quiz-head b { font-family: var(--display); font-size: 17px; font-weight: 600; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--muted); }
.progress-row { display: flex; justify-content: space-between; font-size: 13px; }
.question { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 22px 20px; display: flex; flex-direction: column; gap: 16px; }
.question p { font-size: 17px; font-weight: 500; line-height: 1.8; }
.question p bdi.m, .rv .qt bdi.m { white-space: nowrap; }
.mathbox { background: var(--bg); border-radius: 14px; padding: 18px; text-align: center; font-size: 26px; font-weight: 500; white-space: pre-line; }
.options { display: flex; flex-direction: column; gap: 10px; }
.opt { display: flex; align-items: center; gap: 14px; min-height: 58px; padding: 8px 16px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); text-align: start; width: 100%; }
.opt:hover { border-color: var(--teal-line); }
.opt .l { width: 32px; height: 32px; border-radius: 99px; background: var(--line-soft); color: var(--muted); font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.opt .v { font-family: var(--display); font-size: 18px; font-weight: 500; }
.opt[aria-checked="true"] { background: var(--teal-light); border: 2px solid var(--teal); padding: 7px 15px; }
.opt[aria-checked="true"] .l { background: var(--teal); color: #fff; }
.qnav { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qdots { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.qdots button { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-size: 13px; font-weight: 600; color: var(--muted); }
.qdots button.ans { background: var(--teal-light); color: var(--teal-dark); border-color: var(--teal-line); }
.qdots button[aria-current="true"] { border: 2px solid var(--teal); color: var(--ink); }

/* ===== Result ===== */
.score { display: flex; align-items: center; gap: 18px; }
.ring { width: 100px; height: 100px; border-radius: 99px; display: flex; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0; }
.ring-in { width: 80px; height: 80px; border-radius: 99px; background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring b { font-family: var(--display); font-size: 22px; line-height: 1.1; }
.ring span { font-size: 12px; color: var(--muted); }
.score h1 { font-size: 20px; font-weight: 600; }
.review { display: flex; flex-direction: column; gap: 10px; }
.review.only-wrong .rv.is-ok { display: none; }
.rv { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.rv .q { display: flex; gap: 10px; align-items: flex-start; }
.rv .mk { width: 28px; height: 28px; border-radius: 99px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.rv .mk.ok { background: var(--ok-light); }
.rv .mk.bad { background: var(--bad-light); }
.rv .qt { font-size: 14px; font-weight: 500; }
.rv .qm { font-size: 15px; display: block; white-space: pre-line; text-align: right; margin-top: 4px; }
.rv .ans { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; padding-inline-start: 38px; }
.rv .ans .you.wrong b { color: var(--bad); }
.rv .ans .right b { color: var(--ok); }

/* ===== My progress ===== */
.pg-stats { display: flex; flex-wrap: wrap; gap: 10px 26px; }
.pg-stats div { display: flex; flex-direction: column; }
.pg-stats b { font-family: var(--display); font-size: 22px; }
.pg-stats span { font-size: 12px; color: var(--muted); }
.weak-grid { display: grid; gap: 12px; }
.weak-card { border-color: #E8B4AE; }
.wk-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.wk-head b { display: block; font-size: 16px; }
.wk-head .muted { font-size: 12px; }
.wk-pct { font-size: 22px; }
.wk-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.wk-acts .btn { flex: 1 1 160px; min-height: 44px; font-size: 14px; }
.good-card { gap: 4px; background: var(--ok-light); border-color: transparent; }
.good-card .muted { font-size: 14px; }
.lv-list { display: flex; flex-direction: column; }
.lv-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); color: var(--ink); text-decoration: none; }
.lv-row:first-child { border-top: 0; }
.lv-row .grow { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.lv-row b { font-size: 14px; font-weight: 500; }
.lv-row .muted { font-size: 12px; }
.lv-chip { font-size: 12px; font-weight: 600; border-radius: 99px; padding: 3px 10px; white-space: nowrap; flex-shrink: 0; }
.lvbar { height: 5px; }
.lv-strong { color: var(--ok); } .lv-chip.lv-strong { background: var(--ok-light); } .lvbar.lv-strong > i { background: var(--ok); }
.lv-mid { color: #8A5208; } .lv-chip.lv-mid { background: var(--amber-light); } .lvbar.lv-mid > i { background: #B7791F; }
.lv-weak { color: var(--bad); } .lv-chip.lv-weak { background: var(--bad-light); } .lvbar.lv-weak > i { background: var(--bad); }
.lv-new { color: var(--muted); } .lv-chip.lv-new { background: var(--line-soft); }
details.how.card { padding: 14px 18px; }
@media (min-width: 768px) { .weak-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ===== Custom ===== */
.check { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); width: 100%; text-align: start; }
.check .box { width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--field-line); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.check[aria-checked="true"] { background: var(--teal-light); border: 1.5px solid var(--teal); }
.check[aria-checked="true"] .box { background: var(--teal); border-color: var(--teal); }
.check[disabled] { opacity: .55; cursor: not-allowed; }
.check .grow { flex-grow: 1; font-size: 14px; font-weight: 500; }
.check small { font-size: 12px; color: var(--muted); }
.counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.counts button { height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 14px; font-weight: 500; }
.counts button[aria-checked="true"] { background: var(--teal); color: #fff; border-color: var(--teal); font-weight: 600; }
.step-title { font-size: 15px; font-weight: 600; margin-top: 4px; }
.checks { display: grid; gap: 8px; }

/* ===== About ===== */
.about-hero { background: var(--teal); border-radius: 22px; height: 120px; }
.about-card { margin-top: -76px; align-items: center; text-align: center; padding-top: 0; }
.avatar { width: 112px; height: 112px; margin-top: -0px; border-radius: 99px; border: 4px solid var(--card); box-shadow: 0 0 0 2px var(--teal); background: var(--teal-light); color: var(--teal-dark); display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 40px; font-weight: 600; }
.about-card h1 { font-size: 24px; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chips span { font-size: 12px; font-weight: 600; border-radius: 99px; padding: 5px 12px; background: var(--teal-light); color: var(--teal-dark); }
.chips span + span { background: var(--amber-light); color: var(--amber-dark); }
.about-grid { display: grid; gap: 16px; align-items: start; }
.card h2 { font-size: 16px; font-weight: 600; color: var(--teal); }
.kv { display: flex; justify-content: space-between; align-items: center; min-height: 40px; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); font-size: 13px; }
.prose { font-size: 15px; line-height: 1.9; }
.motto { margin: 6px 0 0; background: var(--teal); color: #fff; border-radius: 18px; padding: 26px 22px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; position: relative; overflow: hidden; }
.motto::before, .motto::after { position: absolute; font-family: var(--display); font-size: 120px; line-height: 1; color: #fff; opacity: .08; pointer-events: none; }
.motto::before { content: '∑'; top: -14px; inset-inline-start: 10px; }
.motto::after { content: 'π'; bottom: -34px; inset-inline-end: 14px; }
.motto-ic { width: 48px; height: 48px; border-radius: 99px; background: rgba(255,255,255,.12); display: flex; align-items: center; justify-content: center; }
.motto blockquote { margin: 0; font-family: var(--display); font-size: 21px; font-weight: 600; line-height: 1.7; max-width: 22ch; position: relative; }
.motto blockquote::before { content: '«'; color: var(--gold); margin-inline-end: 4px; }
.motto blockquote::after { content: '»'; color: var(--gold); margin-inline-start: 4px; }
@media (min-width: 768px) {
  .about-grid > .welcome { grid-column: 1 / -1; }
  .motto blockquote { font-size: 26px; max-width: 30ch; }
}
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.timeline li { display: flex; gap: 12px; position: relative; }
.timeline li:not(:last-child)::after { content: ''; position: absolute; inset-inline-start: 5px; top: 16px; bottom: -14px; width: 2px; background: var(--line); }
.tl-dot { width: 12px; height: 12px; border-radius: 99px; background: var(--teal); flex-shrink: 0; margin-top: 6px; position: relative; z-index: 1; }
.timeline b { display: block; font-size: 15px; }
.timeline span { display: block; font-size: 13px; color: var(--muted); line-height: 1.7; }
.timeline small { display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--amber-dark); background: var(--amber-light); border-radius: 99px; padding: 1px 10px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags span { font-size: 13px; font-weight: 500; background: var(--teal-light); color: var(--teal-dark); border-radius: 99px; padding: 5px 12px; }
.honors { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.honors li::marker { color: var(--gold); }
.contact { background: var(--amber-light); border-color: transparent; }
.contact-row b[dir="ltr"] { overflow-wrap: anywhere; }
.contact h2 { color: var(--amber-dark); }
.contact-row { display: flex; align-items: center; gap: 12px; min-height: 44px; color: var(--ink); text-decoration: none; }
.contact-row .ic { width: 40px; height: 40px; border-radius: 12px; background: var(--card); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.contact-row small { display: block; font-size: 12px; color: var(--amber-dark); }
.contact-row b { font-size: 14px; }

/* ===== Tablet (iPad) ===== */
@media (min-width: 768px) {
  .wrap, .topbar-in { max-width: 920px; padding-inline: 28px; }
  .wrap { padding-top: 28px; gap: 22px; }
  .board-list { grid-auto-flow: column; grid-template-rows: repeat(5, auto); grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; }
  .board-list.solo { grid-auto-flow: row; grid-template-rows: none; }
  .units { display: block; columns: 2; column-gap: 12px; }
  .units .unit { break-inside: avoid; margin-bottom: 12px; }
  .checks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .about-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wrap.narrow { max-width: 680px; }
  .login-hero { padding-top: 64px; }
  .mathbox { font-size: 30px; }
}

/* ===== Desktop ===== */
@media (min-width: 1100px) {
  .wrap, .topbar-in { max-width: 1160px; }
  .units { columns: 3; }
  .topic-grid { grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); }
  .topic-grid .side { position: sticky; top: 84px; }
  .home-top { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
  .home-top .tile { height: 100%; }
}

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