/* Mizan — styles
   Palette: parchment, ink indigo, antique brass, plus one colour per subject ("room").
   Type: Bodoni Moda (Latin display, large sizes only), IBM Plex Sans Arabic (all interface text, Arabic and Latin),
   Amiri (Arabic display). Amiri Quran is used only for Quranic text. */

:root {
    --parchment: #F5F0E6;
    --parchment-2: #FBF8F1;
    --sand: #E9E1D0;
    --line: #E4DCCB;
    --line-2: #D9CFBB;
    --ink: #1C2140;
    --ink-2: #4A4856;
    --muted: #6E6A74;
    --brass: #8C6F38;
    --brass-light: #E2C68C;
    --brass-soft: #CBB27C;
    --white: #FFFFFF;
    --ok: #2E6B52;
    --ok-bg: #E6F0EA;
    --bad: #9A3F22;
    --bad-bg: #F6E4DA;
    --warm: #B4593A;

    --room: var(--ink);
    --room-tint: #EEF1F8;
    --room-soft: #C9D3EC;

    --f-display: 'Bodoni Moda', 'Didot', 'Times New Roman', serif;
    --f-ui: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --f-ar: 'Amiri', 'Times New Roman', serif;
    --f-quran: 'Amiri Quran', 'Amiri', serif;

    --gutter: clamp(20px, 4vw, 48px);
    --max: 1280px;
    --radius: 0px;
    --ease: cubic-bezier(.2, .7, .2, 1);
}

/* One colour per subject */
[data-room="french"] { --room: #2F4A8A; --room-tint: #EEF1F8; --room-soft: #C9D3EC; }
[data-room="arabic"] { --room: #2E6B52; --room-tint: #E8F2EC; --room-soft: #CFE5DA; }
[data-room="islamic"] { --room: #24676E; --room-tint: #EAF3F3; --room-soft: #CDE6E8; }
[data-room="social_english"] { --room: #B4593A; --room-tint: #F8EBE4; --room-soft: #F3D9CC; }
[data-room="social_arabic"] { --room: #8E4A3A; --room-tint: #F5E9E5; --room-soft: #EDD3CB; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--parchment);
    color: var(--ink);
    font-family: var(--f-ui);
    font-size: 17px;
    line-height: 1.6;
    font-variant-numeric: lining-nums;
    -webkit-font-smoothing: antialiased;
}
html[lang="ar"] body { font-size: 18px; line-height: 1.8; }
a { color: inherit; }
img, svg { max-width: 100%; }
button { font: inherit; color: inherit; }
[hidden], .hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; }

.skip-link { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 50; background: var(--ink); color: var(--parchment); padding: 10px 16px; text-decoration: none; }
.skip-link:focus { top: 12px; }
.wrap { max-width: var(--max); margin: 0 auto; padding-inline: var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Type ---------- */
.display { font-family: var(--f-display); font-weight: 400; letter-spacing: 0; line-height: 1.05; margin: 0; }
html[lang="ar"] .display { font-family: var(--f-ar); font-weight: 700; letter-spacing: 0; line-height: 1.35; }
.display em { font-style: italic; }
html[lang="ar"] .display em { font-style: normal; color: var(--brass); }
.ar-display { font-family: var(--f-ar); font-weight: 700; }
.en-display { font-family: var(--f-display); font-weight: 400; }
.kicker { margin: 0; font-size: 13px; letter-spacing: 2px; text-transform: uppercase; color: var(--brass); font-weight: 500; }
html[lang="ar"] .kicker { letter-spacing: 0; text-transform: none; font-size: 15px; }
.lede { color: var(--ink-2); max-width: 580px; }
.muted { color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    min-height: 48px; padding: 12px 26px;
    background: var(--ink); color: var(--parchment);
    border: 1px solid var(--ink); border-radius: var(--radius);
    font-family: var(--f-ui); font-size: 16px; font-weight: 500; line-height: 1.2;
    text-decoration: none; cursor: pointer;
    transition: background .25s, color .25s, border-color .25s, transform .25s;
}
.btn:hover { background: #2A3058; border-color: #2A3058; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: rgba(28, 33, 64, .06); }
.btn.light { background: var(--parchment); color: var(--ink); border-color: var(--parchment); }
.btn.light:hover { background: #FFFFFF; }
.btn.on-dark { background: transparent; color: var(--parchment); border-color: rgba(245, 240, 230, .5); }
.btn.on-dark:hover { background: rgba(245, 240, 230, .08); }
.btn.room { background: var(--room); border-color: var(--room); color: #FFFFFF; }
.btn.room:hover { filter: brightness(1.08); }
.btn.small { min-height: 40px; padding: 8px 16px; font-size: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Site header ---------- */
.site-head { background: var(--ink); color: var(--parchment); position: relative; z-index: 5; }
.site-head .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding-block: 16px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand svg { width: 30px; height: 30px; flex: none; }
.brand-ar { font-family: var(--f-ar); font-size: 30px; font-weight: 700; line-height: 1; }
.brand-en { font-family: var(--f-display); font-size: 16px; letter-spacing: 4px; color: var(--brass-soft); }
.nav { display: flex; flex-wrap: wrap; gap: 30px; font-size: 15px; }
.nav a { text-decoration: none; padding-block: 6px; border-bottom: 1px solid transparent; }
.nav a:hover, .nav a[aria-current="page"] { border-bottom-color: var(--brass-light); }
.head-tools { display: flex; align-items: center; gap: 16px; }
.lang-btn { background: none; border: 1px solid rgba(245, 240, 230, .45); color: var(--parchment); min-height: 40px; padding: 6px 16px; cursor: pointer; font-size: 15px; }
.lang-btn:hover { background: rgba(245, 240, 230, .08); }
.lang-btn .ar { font-family: var(--f-ar); font-size: 19px; line-height: 1; }

/* ---------- Hero (light through the lattice) ---------- */
.hero { position: relative; background: var(--ink); color: var(--parchment); overflow: hidden; }
.hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-fade { position: absolute; inset: 0; background: linear-gradient(90deg, var(--ink) 0%, rgba(28, 33, 64, .93) 36%, rgba(28, 33, 64, .2) 72%, rgba(28, 33, 64, 0) 100%); }
[dir="rtl"] .hero-fade { background: linear-gradient(270deg, var(--ink) 0%, rgba(28, 33, 64, .93) 36%, rgba(28, 33, 64, .2) 72%, rgba(28, 33, 64, 0) 100%); }
.hero-scale { position: absolute; inset-inline-end: 9%; top: 50%; width: 340px; height: 340px; margin-top: -170px; }
.hero-inner { position: relative; padding-block: clamp(80px, 11vw, 130px); }
.hero h1 { font-size: clamp(50px, 6.4vw, 92px); max-width: 780px; color: var(--parchment); }
.hero h1 em { color: var(--brass-light); }
html[lang="ar"] .hero h1 { font-size: clamp(56px, 7.2vw, 104px); }
html[lang="ar"] .hero h1 em { color: var(--brass-light); }
.hero-second { margin: 22px 0 0; color: var(--brass-light); line-height: 1.3; }
.hero-second.ar { font-family: var(--f-ar); font-weight: 700; font-size: clamp(32px, 3.6vw, 52px); }
.hero-second.en { font-family: var(--f-display); font-style: italic; font-size: clamp(24px, 2.4vw, 34px); }
.hero-lede { margin: 28px 0 0; max-width: 520px; font-size: 18px; font-weight: 300; color: #D9D4C8; line-height: 1.75; }
html[lang="ar"] .hero-lede { font-size: 20px; line-height: 1.9; }
.hero .actions { margin-top: 38px; }

@keyframes m-d1 { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(170px, 60px); } }
@keyframes m-d2 { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-210px, -40px); } }
@keyframes m-d3 { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(90px, -90px); } }
@keyframes m-far { 0%, 100% { transform: translate(0, 0) rotate(0); } 50% { transform: translate(-40px, 20px) rotate(2deg); } }
@keyframes m-tilt { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes m-pl { 0%, 100% { transform: translateY(5px); } 50% { transform: translateY(-5px); } }
@keyframes m-pr { 0%, 100% { transform: translateY(-5px); } 50% { transform: translateY(5px); } }
@keyframes m-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.m-l1 { animation: m-d1 28s ease-in-out infinite; }
.m-l2 { animation: m-d2 34s ease-in-out infinite; }
.m-l3 { animation: m-d3 24s ease-in-out infinite; }
.m-far { transform-origin: 700px 320px; animation: m-far 40s ease-in-out infinite; }
.m-beam { transform-origin: 150px 92px; animation: m-tilt 9s ease-in-out infinite; }
.m-pl { animation: m-pl 9s ease-in-out infinite; }
.m-pr { animation: m-pr 9s ease-in-out infinite; }
.m-rise { animation: m-rise 1.1s var(--ease) both; }
.m-d-1 { animation-delay: .15s; } .m-d-2 { animation-delay: .3s; } .m-d-3 { animation-delay: .45s; }

/* ---------- Home sections ---------- */
.block { padding-block: clamp(70px, 9vw, 120px) 0; }
.block-head .display { font-size: clamp(38px, 4.4vw, 60px); }
html[lang="ar"] .block-head .display { font-size: clamp(42px, 5vw, 66px); }
.block-head .lede { margin: 16px 0 0; font-size: 18px; }
html[lang="ar"] .block-head .lede { font-size: 20px; }

.continue { margin-top: 0; padding: 26px 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.continue p { margin: 0; }
.continue strong { font-weight: 600; }

.subjects { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 52px; }
.subject { text-decoration: none; display: flex; flex-direction: column; transition: transform .5s var(--ease); }
.subject:hover { transform: translateY(-6px); }
.cover { background: var(--room); color: var(--parchment); height: 250px; padding: 24px; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; }
.cover-ar { font-family: var(--f-ar); font-weight: 700; line-height: 1.25; font-size: 44px; direction: rtl; text-align: start; }
.cover-en { font-family: var(--f-display); line-height: 1; font-size: 24px; direction: ltr; text-align: start; }
.cover .lead-ar .cover-ar { font-size: 44px; }
.cover.lead-en .cover-en { font-size: 40px; color: var(--parchment); }
.cover.lead-en .cover-ar { font-size: 26px; font-weight: 400; color: var(--room-soft); }
.cover.lead-ar .cover-en { color: var(--room-soft); }
[dir="ltr"] .cover-ar { text-align: left; }
[dir="rtl"] .cover-en { text-align: right; }
.subject-meta { margin-top: 14px; font-size: 15px; color: var(--ink-2); }
.subject-levels { margin-top: 2px; font-size: 14px; font-weight: 500; color: var(--room); }
.subject-bar { margin-top: 12px; height: 2px; background: var(--line); position: relative; }
.subject-bar i { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--room); }

.ways { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 64px; }
.block:has(> .ways) { padding-bottom: clamp(80px, 10vw, 130px); }
.way-num { font-family: var(--f-display); font-size: 48px; line-height: 1; color: var(--brass); }
html[lang="ar"] .way-num { font-family: var(--f-ar); font-weight: 700; }
.way h3 { margin: 16px 0 0; font-size: 40px; }
html[lang="ar"] .way h3 { font-size: 44px; }
.way p { margin: 14px 0 0; color: var(--ink-2); max-width: 500px; font-size: 18px; line-height: 1.8; }
html[lang="ar"] .way p { font-size: 19px; line-height: 1.9; }


.site-foot { border-top: 1px solid var(--line-2); }
.site-foot .wrap { padding-block: 24px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px; font-size: 14px; color: var(--muted); }

/* ---------- Subject room ---------- */
.room-hero { background: var(--room); color: var(--parchment); }
.room-hero .wrap { padding-block: 40px 52px; }
.crumbs { font-size: 14px; color: var(--room-soft); }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.room-title { margin-top: 26px; display: flex; flex-direction: column; gap: 4px; }
.room-title .ar-display { font-size: clamp(48px, 6vw, 80px); line-height: 1.2; }
.room-title .en-display { font-size: clamp(30px, 3.4vw, 46px); line-height: 1.05; }
.room-title .first.en-display { font-size: clamp(48px, 6vw, 84px); }
.room-title .second { color: var(--room-soft); }
[dir="ltr"] .room-title .ar-display { direction: rtl; text-align: left; }
[dir="rtl"] .room-title .en-display { direction: ltr; text-align: right; }
.room-sub { margin: 14px 0 0; color: var(--room-soft); max-width: 640px; }

.levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-top: 40px; }
.level { text-align: start; background: var(--parchment-2); border: 1px solid var(--line); padding: 18px 18px 16px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; min-height: 150px; text-decoration: none; transition: border-color .25s, transform .25s; }
.level:hover { border-color: var(--room); }
.level[aria-current="true"] { border-color: var(--room); background: var(--room-tint); box-shadow: inset 0 3px 0 var(--room); }
.level-code { font-family: var(--f-ui); font-size: 24px; font-weight: 600; line-height: 1.1; color: var(--room); letter-spacing: .5px; }
.level-code.grade { font-size: 20px; letter-spacing: 0; }
.lvl-num { font-family: var(--f-ui); font-weight: 500; font-size: .82em; letter-spacing: 0; }
.level-can { font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.level-state { margin-top: auto; font-size: 13px; color: var(--muted); }
.level-state.soon { color: var(--brass); }
.level-state.mine { color: var(--room); font-weight: 600; }

.level-panel { padding-block: 56px 100px; }
.level-panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px; }
.level-panel-head .display { font-size: clamp(32px, 3.4vw, 46px); }
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); gap: 20px; margin-top: 32px; }
.skill { background: var(--white); padding: 28px; box-shadow: 0 1px 0 var(--line-2); }
.skill-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.skill-head h3 { margin: 0; font-size: 22px; font-weight: 600; }
.skill-head svg { width: 24px; height: 24px; color: var(--brass); flex: none; }
.skill-desc { margin: 6px 0 0; color: var(--muted); font-size: 15px; }
.set-row { margin-top: 22px; }
.set-row h4 { margin: 0 0 10px; font-size: 14px; font-weight: 600; display: flex; align-items: baseline; gap: 10px; }
.set-row h4 small { font-weight: 400; color: var(--muted); }
.squares { display: flex; flex-wrap: wrap; gap: 6px; }
.sq { position: relative; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line-2); background: var(--parchment-2); text-decoration: none; font-size: 15px; font-weight: 500; transition: border-color .2s, background .2s; }
.sq:hover { border-color: var(--room); }
.sq.done { background: var(--room-tint); border-color: var(--room); color: var(--room); }
.sq.test { border-color: var(--ink); }
.sq.test.scored { background: var(--ink); color: var(--parchment); }
.sq.test.scored.low { background: var(--warm); border-color: var(--warm); }
.sq small { position: absolute; bottom: -18px; inset-inline: 0; text-align: center; font-size: 11px; color: var(--muted); font-weight: 400; }
.set-row.tests .squares { padding-bottom: 16px; }
.soon-note { margin-top: 32px; padding: 28px; background: var(--parchment-2); border-top: 3px solid var(--brass); max-width: 760px; }
.soon-note h3 { margin: 0; font-size: 20px; }
.soon-note p { margin: 8px 0 0; color: var(--ink-2); }

/* ---------- Exam screens ---------- */
.exam-head { background: var(--parchment-2); border-bottom: 1px solid var(--line-2); position: sticky; top: 0; z-index: 10; }
.exam-head .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; padding-block: 12px; }
.exam-head .brand-ar { font-size: 26px; color: var(--ink); }
.exam-head .brand svg { width: 26px; height: 26px; }
.exam-sep { width: 1px; height: 28px; background: var(--line-2); }
.exam-meta { flex: 1 1 280px; min-width: 0; }
.exam-meta .kicker { color: var(--room); font-size: 12px; }
html[lang="ar"] .exam-meta .kicker { font-size: 13px; }
.exam-title { font-size: 18px; font-weight: 500; line-height: 1.35; }
.timer { display: flex; align-items: baseline; gap: 8px; }
.timer b { font-size: 26px; font-weight: 300; letter-spacing: .5px; direction: ltr; }
.timer span { font-size: 13px; color: var(--muted); }
.timer.low b { color: var(--bad); }
.mode-tag { font-size: 12px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; padding: 5px 10px; border: 1px solid var(--room); color: var(--room); }
html[lang="ar"] .mode-tag { letter-spacing: 0; font-size: 13px; }
.progress-line { height: 3px; background: var(--line); }
.progress-line i { display: block; height: 3px; width: 0; background: var(--room); transition: width .4s var(--ease); }

.exam-body { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; padding-block: 36px 90px; }
.source { flex: 1 1 400px; min-width: 0; display: flex; flex-direction: column; gap: 20px; position: sticky; top: 92px; max-height: calc(100vh - 110px); overflow: auto; }
.source.static { position: static; max-height: none; }
.work { flex: 999 1 560px; min-width: 0; }

.paper { background: var(--white); box-shadow: 0 1px 0 var(--line-2), 0 30px 60px -44px rgba(28, 33, 64, .3); }
.passage { padding: 36px clamp(22px, 3vw, 40px); position: relative; }
.passage::before { content: ""; position: absolute; top: 0; inset-inline: 0; height: 5px; background: var(--room); }
.passage h2 { margin: 0 0 18px; font-size: clamp(26px, 2.4vw, 32px); line-height: 1.2; }
.passage h2.display { font-size: clamp(26px, 2.4vw, 32px); }
.passage .text { white-space: pre-line; font-size: 18px; line-height: 1.85; color: #1E2438; }
.passage .text[dir="rtl"] { font-family: var(--f-ar); font-size: 22px; line-height: 2.05; }
.passage .text.quran { font-family: var(--f-quran); font-size: 28px; line-height: 2.3; text-align: center; }

.player { background: var(--room); color: var(--parchment); padding: 28px; }
.player-top { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--room-soft); }
html[lang="ar"] .player-top { letter-spacing: 0; font-size: 13px; }
.player h2 { margin: 14px 0 22px; font-size: 30px; line-height: 1.15; color: var(--parchment); }
.player-ctrl { display: flex; align-items: center; gap: 18px; }
.play { width: 60px; height: 60px; flex: none; border-radius: 50%; border: 0; background: var(--parchment); color: var(--room); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.play:disabled { opacity: .45; cursor: not-allowed; }
.play svg { width: 20px; height: 20px; }
[dir="rtl"] .play svg.tri { transform: scaleX(-1); }
.track { flex: 1; min-width: 0; }
.track-bar { height: 2px; background: rgba(245, 240, 230, .25); position: relative; }
.track-bar i { position: absolute; inset-block: 0; inset-inline-start: 0; width: 0; background: var(--parchment); }
.track-times { display: flex; justify-content: space-between; font-size: 12px; color: var(--room-soft); margin-top: 8px; direction: ltr; }
.player-hint { margin: 18px 0 0; font-size: 14px; color: #E6E9F2; }
.speakers { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(245, 240, 230, .2); font-size: 13px; color: #E6E9F2; }
.audio-missing { margin-top: 18px; padding: 14px 16px; background: rgba(245, 240, 230, .1); border-inline-start: 3px solid var(--brass-light); font-size: 14px; line-height: 1.6; }
.transcript { margin-top: 0; }
.transcript summary { cursor: pointer; padding: 16px 20px; font-weight: 500; list-style: none; display: flex; justify-content: space-between; }
.transcript summary::after { content: "+"; color: var(--brass); }
.transcript[open] summary::after { content: "–"; }
.transcript .text { padding: 0 20px 20px; white-space: normal; }
.tline { display: block; margin-bottom: 8px; }
.tline b { color: var(--room); font-weight: 600; }

.notice { border-top: 1px solid var(--ink); padding-top: 14px; font-size: 15px; color: var(--ink-2); line-height: 1.75; }
.notice .kicker { display: block; margin-bottom: 2px; font-size: 12px; }

/* Questions */
.q { min-width: 0; border: 0; margin: 0; padding: 32px clamp(20px, 3vw, 40px); display: flex; gap: 22px; border-bottom: 1px solid #ECE5D6; }
.q:last-child { border-bottom: 0; }
.q-num { font-family: var(--f-ui); font-weight: 300; font-size: 36px; line-height: .95; color: var(--room); width: 34px; flex: none; }
.q[dir="rtl"] .q-num { font-family: var(--f-ar); font-weight: 700; font-size: 36px; line-height: 1; }
.q-main { flex: 1; min-width: 0; }
.q legend, .q .q-text { padding: 0; font-size: 19px; line-height: 1.6; font-weight: 500; float: left; width: 100%; }
.q[dir="rtl"] legend, .q[dir="rtl"] .q-text { float: right; font-size: 20px; }
.opts { clear: both; display: flex; flex-direction: column; gap: 10px; padding-top: 18px; }
.opt { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border: 1px solid #E2DACA; background: var(--white); font-size: 16px; line-height: 1.5; cursor: pointer; transition: border-color .2s, background .2s; }
.q[dir="rtl"] .opt { font-size: 18px; }
.opt:hover { border-color: var(--room); }
.opt:has(input:checked) { border-color: var(--room); background: var(--room-tint); }
.opt.right { border-color: var(--ok) !important; background: var(--ok-bg) !important; }
.opt.wrong { border-color: var(--bad) !important; background: var(--bad-bg) !important; }
.locked .opt { cursor: default; }
.locked .opt:hover { border-color: #E2DACA; }
.opt .key { font-size: 13px; color: var(--muted); width: 14px; flex: none; }
input[type="radio"].r { appearance: none; -webkit-appearance: none; margin: 0; width: 18px; height: 18px; flex: none; border-radius: 50%; border: 1.5px solid #9A93A0; background: var(--white); cursor: pointer; }
input[type="radio"].r:checked { border-color: var(--room); background: radial-gradient(circle, var(--room) 0 4.5px, var(--white) 5px); }
.opt.right input.r:checked { border-color: var(--ok); background: radial-gradient(circle, var(--ok) 0 4.5px, var(--white) 5px); }
.opt.wrong input.r:checked { border-color: var(--bad); background: radial-gradient(circle, var(--bad) 0 4.5px, var(--white) 5px); }
.pts { font-size: 12px; color: var(--muted); flex: none; }
.why { margin-top: 14px; padding: 14px 16px; font-size: 15px; line-height: 1.7; background: var(--parchment-2); border-inline-start: 3px solid var(--ok); }
.why.wrong { border-inline-start-color: var(--bad); }
.why b { display: block; margin-bottom: 2px; }
.your { margin: 10px 0 0; font-size: 14px; color: var(--bad); }

.qnav { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 22px; }
.qnav button { width: 40px; height: 40px; border: 1px solid var(--line-2); background: var(--parchment-2); cursor: pointer; font-size: 14px; }
.qnav button.answered { background: var(--ink); border-color: var(--ink); color: var(--parchment); }
.qnav button.right { background: var(--ok); border-color: var(--ok); color: #FFFFFF; }
.qnav button.wrong { background: var(--bad); border-color: var(--bad); color: #FFFFFF; }
.qnav .count { margin-inline-start: auto; font-size: 14px; color: var(--muted); }
.submit-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 26px; }
.encourage { margin: 22px 0 0; display: flex; align-items: center; gap: 12px; font-size: 15px; color: var(--ink-2); min-height: 24px; }
.encourage::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--brass); flex: none; }
.encourage:empty { visibility: hidden; }

/* Writing & speaking */
.task-head { padding: 34px clamp(22px, 3vw, 40px); position: relative; }
.task-head::before { content: ""; position: absolute; top: 0; inset-inline: 0; height: 5px; background: var(--room); }
.task-head h2 { margin: 0; font-size: clamp(26px, 2.4vw, 32px); line-height: 1.2; }
.prompt { margin: 14px 0 0; font-size: 19px; line-height: 1.75; white-space: pre-line; }
.prompt[dir="rtl"] { font-family: var(--f-ar); font-size: 22px; line-height: 2; }
.tips { margin-top: 20px; padding: 16px 18px; background: var(--parchment-2); font-size: 15px; }
.tips strong { display: block; margin-bottom: 6px; color: var(--brass); }
.tips ul { margin: 0; padding-inline-start: 20px; }
.answer { display: block; width: 100%; min-height: 340px; margin-top: 20px; border: 0; border-bottom: 1px solid var(--ink); background: var(--white) repeating-linear-gradient(transparent 0 39px, var(--line) 39px 40px); padding: 0 clamp(16px, 2vw, 24px); font: 18px/40px var(--f-ui); color: var(--ink); resize: vertical; box-shadow: 0 1px 0 var(--line-2); }
.answer[dir="rtl"] { font: 21px/40px var(--f-ar); }
.answer:focus { outline: 2px solid var(--room); outline-offset: 0; }
.wc { margin-top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 14px; font-size: 14px; color: var(--muted); }
.wc .bar { flex: 1 1 160px; height: 3px; background: var(--line); position: relative; max-width: 300px; }
.wc .bar i { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--room); }

.rec { margin-top: 20px; padding: 40px 24px; text-align: center; background: var(--white); box-shadow: 0 1px 0 var(--line-2); }
.rec-btn { width: 96px; height: 96px; border-radius: 50%; border: 0; background: var(--room); color: #FFFFFF; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: transform .2s; }
.rec-btn svg { width: 36px; height: 36px; }
.rec-btn.on { background: var(--bad); animation: pulse 1.6s infinite; }
.rec-btn:disabled { opacity: .45; cursor: not-allowed; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(154, 63, 34, .45); } 100% { box-shadow: 0 0 0 22px rgba(154, 63, 34, 0); } }
.rec-time { margin-top: 16px; font-size: 32px; font-weight: 300; direction: ltr; }
.rec .hint { margin: 8px auto 0; max-width: 460px; color: var(--muted); font-size: 15px; }
.rec audio { margin-top: 18px; width: 100%; max-width: 460px; }

.rubric { margin-top: 24px; padding: 32px clamp(22px, 3vw, 40px); }
.rubric h2 { margin: 0; font-size: 30px; }
.rubric > p { margin: 8px 0 18px; color: var(--ink-2); }
.check { display: flex; align-items: flex-start; gap: 14px; padding: 14px 0; border-top: 1px solid #ECE5D6; cursor: pointer; font-size: 17px; line-height: 1.6; }
.check input { width: 20px; height: 20px; margin-top: 4px; accent-color: var(--room); flex: none; }

/* ---------- Results ---------- */
.result-band { background: var(--ink); color: var(--parchment); }
.result-band .wrap { padding-block: 52px 64px; display: flex; flex-wrap: wrap; gap: 40px; align-items: center; }
.verdict { flex: 1 1 420px; min-width: 0; }
.verdict .kicker { color: var(--brass-soft); }
.score-big { display: flex; align-items: baseline; gap: 12px; margin-top: 12px; direction: ltr; justify-content: flex-start; }
[dir="rtl"] .score-big { justify-content: flex-end; }
.score-big b { font-family: var(--f-display); font-weight: 400; font-size: clamp(100px, 11vw, 160px); line-height: .85; letter-spacing: -4px; }
.score-big span { font-size: 18px; color: var(--brass-soft); }
.verdict h1 { margin: 24px 0 0; font-size: clamp(30px, 2.8vw, 40px); color: var(--parchment); line-height: 1.15; }
.verdict h1 em { color: var(--brass-light); }
html[lang="ar"] .verdict h1 em { color: var(--brass-light); }
.verdict p { margin: 16px 0 0; max-width: 540px; color: #D9D4C8; font-weight: 300; line-height: 1.75; }
.verdict .actions { margin-top: 28px; }
.balance { flex: 1 1 480px; min-width: 0; margin: 0; }
.balance svg { display: block; width: 100%; height: auto; }
.balance figcaption { margin-top: 4px; text-align: center; font-size: 13px; color: #B8B4C8; }
@keyframes b-beam { from { transform: rotate(0); } }
@keyframes b-l { from { transform: translateY(0); } }
@keyframes b-r { from { transform: translateY(0); } }
@keyframes grow { from { transform: scaleY(0); } }
.b-beam { transform-origin: 300px 80px; transform: rotate(var(--tilt)); animation: b-beam 2.2s cubic-bezier(.3, .6, .2, 1) both .8s; }
.b-left { transform: translateY(var(--dl)); animation: b-l 2.2s cubic-bezier(.3, .6, .2, 1) both .8s; }
.b-right { transform: translateY(var(--dr)); animation: b-r 2.2s cubic-bezier(.3, .6, .2, 1) both .8s; }
.b-blk { transform-box: fill-box; transform-origin: bottom; animation: grow .8s var(--ease) both; }

.result-body { padding-block: 56px 100px; }
.result-body h2.display { font-size: clamp(30px, 3vw, 38px); }
.review { margin-top: 24px; }
.tabs-inline { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }

/* ---------- Progress ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 36px; }
.stat { background: var(--white); padding: 22px; box-shadow: inset 0 3px 0 var(--room), 0 1px 0 var(--line-2); }
.stat h3 { margin: 0; font-size: 18px; }
.stat p { margin: 6px 0 14px; color: var(--muted); font-size: 14px; }
.stat .subject-bar { margin-top: 0; }
.table-wrap { overflow-x: auto; margin-top: 20px; background: var(--white); box-shadow: 0 1px 0 var(--line-2); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: start; font-weight: 500; color: var(--muted); font-size: 13px; padding: 14px 16px; border-bottom: 1px solid var(--ink); }
td { padding: 13px 16px; border-bottom: 1px solid var(--line); }
td.low { color: var(--bad); font-weight: 600; }
td.high { color: var(--ok); font-weight: 600; }
.empty { padding: 48px 24px; text-align: center; color: var(--ink-2); }
.page-pad { padding-block: 56px 100px; }
.loading { padding: 120px 0; text-align: center; color: var(--muted); }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 24px; inset-inline-start: 50%; transform: translate(-50%, 20px); background: var(--ink); color: var(--parchment); padding: 12px 20px; font-size: 15px; opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s; z-index: 60; max-width: calc(100vw - 32px); }
[dir="rtl"] .toast { transform: translate(50%, 20px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
[dir="rtl"] .toast.show { transform: translate(50%, 0); }

/* ---------- Young grades (1–6): same parts, friendlier ---------- */
.young { --radius: 18px; }
.young .paper, .young .player, .young .opt, .young .skill, .young .q-wrap, .young .rec, .young .answer, .young .tips, .young .why { border-radius: 22px; }
.young .paper { overflow: hidden; }
.young .btn { border-radius: 999px; }
.young .opt { padding: 18px 20px; font-size: 20px; border-width: 2px; }
.young .q[dir="rtl"] .opt { font-size: 22px; }
.young .q legend, .young .q .q-text { font-size: 24px; font-weight: 600; line-height: 1.45; }
.young .q[dir="rtl"] legend { font-size: 26px; }
.young input[type="radio"].r { width: 24px; height: 24px; border-width: 2.5px; }
.young input[type="radio"].r:checked { background: radial-gradient(circle, var(--room) 0 6px, var(--white) 7px); }
.young .qnav button { border-radius: 50%; }
.young .passage .text { font-size: 20px; line-height: 1.9; }
.young .passage .text[dir="rtl"] { font-size: 25px; }
.young .play { width: 72px; height: 72px; }
.stars { display: inline-flex; gap: 4px; }
.stars svg { width: 26px; height: 26px; }
@keyframes pop { 0% { transform: scale(0); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
.stars .new { animation: pop .6s cubic-bezier(.2, .9, .3, 1.4) both; transform-box: fill-box; transform-origin: center; }
.cheer { margin-top: 14px; padding: 16px 20px; border-radius: 22px; border: 2px solid var(--ok); background: var(--white); font-size: 18px; display: flex; gap: 14px; align-items: flex-start; }
.cheer b { color: var(--ok); display: block; font-size: 20px; }

/* ---------- Phone ---------- */
@media (max-width: 900px) {
    .hero-scale { display: none; }
    .source { position: static; max-height: none; }
}
@media (max-width: 760px) {
    .nav { gap: 16px; font-size: 14px; order: 3; width: 100%; justify-content: flex-start; }
    .site-head .wrap { row-gap: 8px; }
    .site-head .wrap { padding-block: 12px; }
    .brand-en { display: none; }
    .q { padding: 24px 18px; gap: 14px; }
    .q-num { width: 26px; font-size: 32px; }
    .pts { display: none; }
    .exam-sep, .exam-head .brand { display: none; }
    .timer b { font-size: 22px; }
    .skill { padding: 22px 18px; }
    .levels { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .level { min-height: 0; }
}

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

@media print {
    .site-head, .exam-head, .actions, .qnav, .site-foot, .submit-row { display: none !important; }
    body { background: #FFFFFF; }
    .result-band { background: #FFFFFF; color: var(--ink); }
}

/* ---------- Learn ---------- */
.learn-strip { margin-top: 32px; padding: 28px; background: var(--room-tint); border-top: 3px solid var(--room); }
.learn-strip.help { margin: 0 0 32px; }
.learn-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.learn-head h3 { margin: 0; font-size: 22px; font-weight: 600; }
.learn-head p { margin: 4px 0 0; font-size: 15px; }
.lesson-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 14px; margin-top: 20px; }
.lesson-cards.all { margin-top: 24px; }
.lesson-card { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 20px 20px 22px; background: var(--white); text-decoration: none; color: var(--ink); box-shadow: 0 1px 0 var(--line-2); transition: transform .2s, box-shadow .2s; }
.lesson-card:hover { transform: translateY(-2px); box-shadow: 0 1px 0 var(--line-2), 0 18px 34px -24px rgba(28, 33, 64, .45); }
.lc-kind { font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--room); font-weight: 600; }
[lang="ar"] .lc-kind, .lc-kind:lang(ar) { letter-spacing: 0; text-transform: none; font-size: 14px; }
.lc-title { font-size: 19px; font-weight: 600; line-height: 1.35; }
.lc-sum { font-size: 15px; line-height: 1.6; color: var(--ink-2); }
.lc-done { position: absolute; top: 16px; inset-inline-end: 16px; font-size: 12px; color: var(--ok); font-weight: 600; }
.lesson-card.read { box-shadow: inset 3px 0 0 var(--ok), 0 1px 0 var(--line-2); }
[dir="rtl"] .lesson-card.read { box-shadow: inset -3px 0 0 var(--ok), 0 1px 0 var(--line-2); }
.lesson-wrap { max-width: 860px; padding-block: 48px 100px; display: flex; flex-direction: column; gap: 24px; }
.lesson { padding: clamp(26px, 4vw, 52px); }
.lesson .kicker { color: var(--room); }
.lesson-lede { font-size: 21px; line-height: 1.65; margin: 10px 0 8px; color: var(--ink); }
.lesson h2 { font-size: 22px; font-weight: 600; margin: 36px 0 10px; padding-top: 22px; border-top: 1px solid #ECE5D6; }
.lesson p { font-size: 17px; line-height: 1.85; margin: 0 0 14px; color: var(--ink-2); }
[lang="ar"] .lesson p, [lang="ar"] .lesson-lede { font-size: 19px; line-height: 2; }
.lesson-ex { list-style: none; margin: 12px 0 18px; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.lesson-ex li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 18px; padding: 12px 16px; background: var(--parchment-2); border-inline-start: 3px solid var(--room); }
.ex-t { font-size: 19px; font-weight: 500; color: var(--ink); }
.ex-t[lang="ar"] { font-family: var(--f-ar); font-size: 24px; line-height: 1.8; }
.ex-m { font-size: 15px; color: var(--muted); }
.lesson-table-wrap { overflow-x: auto; margin: 12px 0 18px; }
.lesson-table { border-collapse: collapse; width: 100%; font-size: 16px; }
.lesson-table th { text-align: start; font-size: 13px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 2px solid var(--ink); }
[lang="ar"] .lesson-table th { letter-spacing: 0; text-transform: none; font-size: 15px; }
.lesson-table td { padding: 11px 14px; border-bottom: 1px solid #ECE5D6; vertical-align: top; }
.lesson-table td[lang="ar"] { font-family: var(--f-ar); font-size: 21px; }
.lesson-table td[lang="fr"] { font-weight: 500; }
.lesson-tip { margin: 18px 0; padding: 16px 20px; background: var(--ink); color: var(--parchment); font-size: 16px; line-height: 1.75; }
.lesson-tip .kicker { display: block; color: #E2C68C; margin-bottom: 4px; font-size: 12px; }
.lesson-check { padding-bottom: 8px; }
.lc-head { padding: 30px clamp(20px, 3vw, 40px) 4px; }
.lc-head .display { font-size: 30px; margin: 0; }
.lc-head p { margin: 6px 0 0; }
.lesson-check .q:last-child { border-bottom: 0; }
.lesson-foot { display: flex; flex-direction: column; gap: 22px; }
.lesson-foot h3 { margin: 0 0 12px; font-size: 18px; font-weight: 600; }
.lesson-prac, .lesson-nav { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 760px) {
    .learn-strip { padding: 22px 18px; margin-inline: -4px; }
    .lesson-wrap { padding-block: 28px 70px; }
    .lesson-lede { font-size: 19px; }
    .lesson-table { font-size: 15px; }
    .lesson-table th, .lesson-table td { padding: 9px 8px; }
    .lesson-table td { overflow-wrap: anywhere; }
    .lesson-table td[lang="ar"] { font-size: 19px; }
    .lesson-nav .btn, .lesson-prac .btn { flex: 1 1 100%; justify-content: center; text-align: center; }
}
@media print { .lesson-check, .lesson-foot { display: none; } }

/* English display type: use Bodoni's sturdier optical sizes so hairlines stay readable (stronger on small screens) */
.display, .en-display, .brand-en, .hero-second.en, .cover-en, .way-num, .lc-head .display { font-optical-sizing: none; font-variation-settings: 'opsz' 28; }
@media (max-width: 900px) {
    .display, .en-display, .brand-en, .hero-second.en, .cover-en, .way-num, .lc-head .display { font-variation-settings: 'opsz' 11; font-weight: 500; }
}
[lang="ar"] .display, .ar-display { font-variation-settings: normal; }

/* ---------- Placement test ---------- */
.place-bar { border-bottom: 0; padding: 22px 0 0; }
.place-wrap { max-width: 860px; }
.place-wrap > .kicker { margin: 0 0 6px; }
.place-wrap > .muted { margin: 0 0 22px; }
.place-how { margin: 0 0 32px; padding-inline-start: 22px; line-height: 1.9; font-size: 17px; }
.place-how li::marker { color: var(--room); font-weight: 600; }
.place-line { position: sticky; top: 0; z-index: 5; }
.place-stages { flex: 0 1 340px; min-width: 260px; }
.place-stages h2 { font-size: 15px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--brass-soft); margin: 0 0 14px; }
html[lang="ar"] .place-stages h2 { letter-spacing: 0; text-transform: none; font-size: 16px; }
.place-stages ol { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 10px; }
.place-stages li { display: grid; grid-template-columns: 34px 1fr 52px; align-items: center; gap: 12px; font-size: 15px; direction: ltr; }
.pl-lvl { font-weight: 600; }
.pl-bar { height: 6px; background: rgba(245, 240, 230, .14); }
.pl-bar i { display: block; height: 6px; background: var(--brass-soft); }
.place-stages li.fail .pl-bar i { background: #D9805C; }
.place-stages li.skip { opacity: .4; }
.pl-sc { text-align: end; color: #D9D4C8; font-variant-numeric: tabular-nums; }

/* Lesson voice buttons */
.say { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--room); background: var(--white); color: var(--room); display: inline-grid; place-items: center; cursor: pointer; padding: 0; align-self: center; transition: background .2s, color .2s; }
.say svg { width: 12px; height: 12px; }
.say .tri { margin-inline-start: 2px; }
.say:hover, .say.on { background: var(--room); color: var(--white); }
.say:focus-visible { outline: 2px solid var(--room); outline-offset: 2px; }
.lesson-ex li { align-items: center; }
.td-say { display: inline-flex; align-items: center; gap: 10px; }
.td-say .say { width: 26px; height: 26px; }

/* ---------- Full exam ---------- */
.exam-strip { margin-top: 32px; padding: 24px 28px; border: 1px solid var(--line); border-top: 3px solid var(--ink); background: var(--white); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; }
.exam-strip h3 { margin: 0; font-size: 22px; font-weight: 600; }
.exam-strip h3 small { font-size: 14px; font-weight: 500; color: var(--room); margin-inline-start: 8px; letter-spacing: .04em; }
.exam-strip p { margin: 6px 0 0; max-width: 520px; }
.exam-h { font-size: 20px; font-weight: 600; margin: 0 0 14px; }
.exam-parts { list-style: none; margin: 0 0 36px; padding: 0; border-top: 1px solid var(--line); }
.exam-parts li { display: grid; grid-template-columns: 36px 1fr auto; gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.ep-num { font-family: var(--f-display); font-size: 26px; color: var(--room); }
.ep-name { font-weight: 600; display: flex; flex-direction: column; gap: 2px; }
.ep-name small { font-weight: 400; color: var(--muted, #6B6B6B); font-size: 14px; }
.ep-time { font-size: 14px; color: var(--muted, #6B6B6B); white-space: nowrap; }
.exam-between { font-size: clamp(30px, 3.4vw, 44px); margin: 8px 0 12px; }
.exam-res li { grid-template-columns: 96px 1fr 64px; }
.ex-sk { font-weight: 500; }
.exam-res li { direction: inherit; }
