/* Global Solutions Sales Academy — design system
   Tokens: deep navy #101C35, teal #0E9F91, amber #F6B847, off-white #F7F9FC, charcoal #172338.
   Logical properties throughout so RTL mirrors automatically. */

:root {
    --navy: #101C35;
    --navy-2: #1B2A4A;
    --teal: #0E9F91;
    --teal-ink: #0A7A6F;          /* AA on white for text */
    --teal-soft: #DDF4F1;
    --amber: #F6B847;
    --amber-ink: #8A5A00;
    --amber-soft: #FDF1D8;
    --red: #C2413B;
    --red-soft: #FBE4E2;
    --green: #1F8A4C;

    --bg: #F7F9FC;
    --surface: #FFFFFF;
    --surface-2: #EEF2F8;
    --border: #DCE3EE;
    --text: #172338;
    --text-2: #4A5A74;
    --muted: #5B6B84;
    --focus: #F6B847;
    --shadow: 0 1px 2px rgba(16, 28, 53, .06), 0 6px 20px rgba(16, 28, 53, .06);
    --shadow-lg: 0 10px 40px rgba(16, 28, 53, .14);

    --radius: 18px;
    --radius-sm: 12px;
    --radius-lg: 24px;
    --sidebar: 248px;
    --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --font-ar: "Segoe UI", "Noto Kufi Arabic", "Noto Naskh Arabic", Tahoma, "Geeza Pro", "Arabic Typesetting", sans-serif;
    --mono: ui-monospace, "Cascadia Code", Consolas, "SF Mono", monospace;
    --ease: cubic-bezier(.2, .8, .2, 1);
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0B1426; --surface: #13203A; --surface-2: #1A2948; --border: #263757;
        --text: #E8EEF8; --text-2: #B7C3D9; --muted: #93A2BD;
        --teal-ink: #4FD1C1; --teal-soft: #0F3B3C; --amber-ink: #F6C76B; --amber-soft: #3A2E12;
        --red-soft: #3D1C1E; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #0B1426; --surface: #13203A; --surface-2: #1A2948; --border: #263757;
    --text: #E8EEF8; --text-2: #B7C3D9; --muted: #93A2BD;
    --teal-ink: #4FD1C1; --teal-soft: #0F3B3C; --amber-ink: #F6C76B; --amber-soft: #3A2E12;
    --red-soft: #3D1C1E; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0; font-family: var(--font); font-size: clamp(15px, 0.9rem + 0.15vw, 17px); line-height: 1.55;
    color: var(--text); background: var(--bg); min-height: 100vh; overflow-x: hidden;
}
[lang="ar"], [dir="rtl"] { font-family: var(--font-ar); }
html[dir="rtl"] body { font-family: var(--font-ar); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.45rem, 1.1rem + 1.4vw, 2.1rem); }
h2 { font-size: clamp(1.1rem, 1rem + .4vw, 1.3rem); }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .7em; }
a { color: var(--teal-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
kbd { font-family: var(--mono); font-size: .72em; padding: .05em .4em; border: 1px solid currentColor; border-radius: 6px; opacity: .65; margin-inline-start: .3em; }
.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
.icon-lg { width: 1.6em; height: 1.6em; }
.icon-xl { width: 3rem; height: 3rem; color: var(--teal); }
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.skip-link { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 100; background: var(--navy); color: #fff; padding: .6rem 1rem; border-radius: 10px; }
.skip-link:focus { top: 12px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.tiny { font-size: .76rem; }
.center { text-align: center; }
.mono { font-family: var(--mono); letter-spacing: .02em; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; }
.row.gap, .gap { gap: .75rem; }
.wrap { flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.stack-sm { display: flex; flex-direction: column; gap: .5rem; }
.inline { display: inline; }
[hidden] { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 44px; padding: .55rem 1.1rem;
    border-radius: 14px; border: 1.5px solid transparent; font-weight: 650; text-decoration: none; cursor: pointer;
    transition: transform .15s var(--ease), box-shadow .15s var(--ease), background .15s; user-select: none; white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--teal); color: #fff; box-shadow: 0 3px 0 #0A7A6F; }
.btn-primary:hover { background: #0C8E81; }
.btn-primary:disabled { background: var(--surface-2); color: var(--muted); box-shadow: none; cursor: not-allowed; }
.btn-secondary { background: var(--navy); color: #fff; box-shadow: 0 3px 0 #050B18; }
:root[data-theme="dark"] .btn-secondary { background: var(--navy-2); }
.btn-accent { background: var(--amber); color: #2B1D00; box-shadow: 0 3px 0 #C98F1D; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { min-height: 36px; padding: .3rem .75rem; font-size: .88rem; border-radius: 10px; }
.btn-lg { min-height: 52px; padding: .7rem 1.5rem; font-size: 1.04rem; }
.btn-block { width: 100%; }
.btn.is-disabled, .is-disabled { opacity: .55; pointer-events: none; }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .15rem; min-width: 44px; min-height: 44px;
    border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn-sm { min-width: 36px; min-height: 36px; }
.link { color: var(--teal-ink); font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: .3rem; }
.link:hover { text-decoration: underline; }

/* ---------- Chips & badges ---------- */
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .7rem; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: .85rem; font-weight: 600; white-space: nowrap; }
.chip-sm { padding: .15rem .55rem; font-size: .76rem; }
.chip-teal { background: var(--teal-soft); color: var(--teal-ink); }
.chip-amber { background: var(--amber-soft); color: var(--amber-ink); }
.chip-red { background: var(--red-soft); color: var(--red); }
.badge-pill { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .8rem; background: var(--teal-soft); color: var(--teal-ink); border-radius: 999px; font-weight: 650; font-size: .85rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .06em; font-size: .74rem; font-weight: 700; color: var(--muted); margin-bottom: .25rem; }
[dir="rtl"] .eyebrow, .eyebrow [lang="ar"] { letter-spacing: 0; text-transform: none; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: clamp(1rem, .8rem + .8vw, 1.4rem); box-shadow: var(--shadow); min-width: 0; }
.card-title { font-size: 1.06rem; margin-bottom: .75rem; display: flex; align-items: center; gap: .45rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .75rem; }
.card-head h2 { margin: 0; font-size: 1.06rem; }
.sub-head { font-size: .95rem; margin: 1rem 0 .5rem; color: var(--text-2); }
.section-title { font-size: 1.15rem; margin: 1.5rem 0 .75rem; }
.section { margin-block: 2.5rem; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    position: sticky; top: 0; height: 100vh; width: var(--sidebar); flex: none; display: none; flex-direction: column; gap: 1rem;
    padding: 1.1rem .9rem; background: var(--navy); color: #DCE5F4; overflow-y: auto; transition: width .2s var(--ease);
}
.sidebar .brand { color: #fff; }
.sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.sidebar .icon-btn { background: transparent; border-color: rgba(255,255,255,.15); color: #fff; }
.side-nav { display: flex; flex-direction: column; gap: .2rem; }
.side-nav a, .side-logout {
    display: flex; align-items: center; gap: .75rem; padding: .65rem .8rem; border-radius: 12px; color: #C9D4E8; text-decoration: none; font-weight: 600;
    min-height: 44px; border: 0; background: none; width: 100%; cursor: pointer; text-align: start;
}
.side-nav a:hover, .side-logout:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-nav a.is-active { background: rgba(14,159,145,.22); color: #fff; box-shadow: inset 3px 0 0 var(--teal); }
[dir="rtl"] .side-nav a.is-active { box-shadow: inset -3px 0 0 var(--teal); }
.side-sep { height: 1px; background: rgba(255,255,255,.1); margin: .5rem .3rem; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: .6rem; }
.sidebar .lang-switch { background: rgba(255,255,255,.08); }
.sidebar .lang-switch button { color: #C9D4E8; }
.sidebar .lang-switch button.is-active { background: #fff; color: var(--navy); }
body.sidebar-collapsed .sidebar { width: 84px; }
body.sidebar-collapsed .sidebar .brand-text, body.sidebar-collapsed .side-nav span, body.sidebar-collapsed .side-logout span, body.sidebar-collapsed .sidebar .lang-switch { display: none; }
body.sidebar-collapsed .sidebar-top { flex-direction: column; }
body.sidebar-collapsed .sidebar-collapse .icon { transform: scaleX(-1); }

.app-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    padding: .55rem 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.topbar-actions { display: flex; align-items: center; gap: .4rem; }
.content { width: 100%; max-width: 1240px; margin: 0 auto; padding: 1rem 16px calc(88px + env(safe-area-inset-bottom)); }
.content:focus { outline: none; }

.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text); min-width: 0; }
.brand-mark { display: inline-flex; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-text strong { font-size: .98rem; white-space: nowrap; }
.brand-text small { font-size: .72rem; color: var(--muted); }
.sidebar .brand-text small { color: #93A2BD; }

.bottom-nav {
    position: fixed; inset-inline: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(6, 1fr);
    background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -6px 20px rgba(16,28,53,.06);
}
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 60px; padding: .35rem .1rem; color: var(--muted); text-decoration: none; font-size: .66rem; font-weight: 650; text-align: center; }
.bottom-nav a .icon { width: 1.35rem; height: 1.35rem; }
.bottom-nav a.is-active { color: var(--teal-ink); }
.bottom-nav a.is-active .icon { filter: drop-shadow(0 2px 4px rgba(14,159,145,.35)); }
.bottom-nav span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (min-width: 1024px) {
    .sidebar { display: flex; }
    .topbar { display: none; }
    .bottom-nav { display: none; }
    .content { padding: 1.75rem 2rem 3rem; }
}
@media (min-width: 768px) and (max-width: 1023px) {
    .bottom-nav a { flex-direction: row; gap: .4rem; font-size: .8rem; }
}

/* Language switch */
.lang-switch { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); gap: 2px; }
.lang-switch button { min-height: 36px; min-width: 40px; padding: 0 .55rem; border: 0; border-radius: 9px; background: transparent; font-weight: 700; font-size: .8rem; cursor: pointer; color: var(--text-2); }
.lang-switch button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.theme-light-icon { display: none; }
:root[data-theme="dark"] .theme-light-icon { display: inline; }
:root[data-theme="dark"] .theme-dark-icon { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-light-icon { display: inline; }
    :root:not([data-theme="light"]) .theme-dark-icon { display: none; }
}

/* ---------- Page heads ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head > div { min-width: 0; }
.page-head h1 { margin-bottom: .2rem; }
.breadcrumbs { display: flex; gap: 1rem; margin-bottom: .75rem; font-size: .9rem; flex-wrap: wrap; }
.breadcrumbs a { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: .3rem; min-height: 32px; }
.breadcrumbs a:hover { color: var(--text); }
.dash-head h1 { font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.3rem); }
.head-chips { display: flex; gap: .5rem; flex-wrap: wrap; }
.wave { display: inline-block; transform-origin: 70% 70%; animation: wave 2.2s ease 1; }
@keyframes wave { 10%, 30% { transform: rotate(14deg); } 20% { transform: rotate(-8deg); } 40%, 100% { transform: rotate(0); } }
.flame-on { color: #F28C28; animation: flicker 1.8s ease-in-out infinite; }
@keyframes flicker { 50% { transform: scale(1.12) translateY(-1px); } }

/* ---------- Continue card ---------- */
.continue-card {
    display: flex; align-items: center; gap: 1rem; padding: 1rem 1.1rem; margin-bottom: 1.25rem; border-radius: var(--radius-lg);
    background: linear-gradient(120deg, var(--navy) 0%, #15335A 60%, #0E5F66 100%); color: #fff; text-decoration: none; box-shadow: var(--shadow-lg);
    flex-wrap: wrap; position: relative; overflow: hidden;
}
.continue-card::after { content: ""; position: absolute; inset-inline-end: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(246,184,71,.14); }
.continue-card.is-final { background: linear-gradient(120deg, #3A2A05, #8A5A00); }
.continue-icon { width: 52px; height: 52px; border-radius: 16px; background: var(--amber); color: var(--navy); display: grid; place-items: center; flex: none; }
.continue-icon .icon { width: 1.5rem; height: 1.5rem; }
.continue-body { display: flex; flex-direction: column; gap: .15rem; flex: 1 1 220px; min-width: 0; position: relative; z-index: 1; }
.continue-body small { color: #B9C7E0; font-weight: 600; }
.continue-body strong { font-size: 1.12rem; }
.continue-body .muted { color: #B9C7E0; }
.continue-card .btn { position: relative; z-index: 1; }

/* ---------- Rings & bars ---------- */
.ring {
    --p: 0; --size: 64px; --track: var(--surface-2); --fill: var(--teal);
    width: var(--size); height: var(--size); border-radius: 50%; flex: none; display: grid; place-items: center;
    background: conic-gradient(var(--fill) calc(var(--p) * 1%), var(--track) 0); position: relative;
}
.ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--surface); }
.ring > span { position: relative; font-weight: 800; font-size: .9rem; display: inline-flex; }
.ring-sm { --size: 42px; }
.ring-sm::before { inset: 5px; }
.ring-sm > span { font-size: .78rem; }
.ring-lg { --size: 84px; }
.ring-lg > span { font-size: 1.1rem; }
.ring-xl { --size: 120px; }
.ring-xl::before { inset: 10px; }
.ring-xl > span { font-size: 1.6rem; }
.ring-amber { --fill: var(--amber); }
.page-head .ring::before, .module-hero .ring::before { background: var(--bg); }
.bar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), #2BC4B3); transition: width .6s var(--ease); }
[dir="rtl"] .bar > span { background: linear-gradient(-90deg, var(--teal), #2BC4B3); }
.bar-thin { height: 7px; margin: .5rem 0; }

/* ---------- Dashboard ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat { display: flex; align-items: center; gap: 1rem; }
.stat-title { font-size: 1rem; margin: 0 0 .2rem; }
.stat p { margin: 0; }
.stat-icon { width: 56px; height: 56px; flex: none; border-radius: 16px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.stat-icon.is-hot { background: #FFE9D2; color: #E2711D; }
:root[data-theme="dark"] .stat-icon.is-hot { background: #3E2614; }
.level-badge { background: linear-gradient(135deg, var(--amber), #F39C3D); color: var(--navy); font-weight: 900; font-size: 1.4rem; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 1rem; }
@media (min-width: 1024px) { .span-2 { grid-column: span 2; } }
.big-number { font-size: 2.6rem; font-weight: 900; margin: 0; color: var(--teal-ink); }
.metric-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: .75rem; margin-bottom: 1rem; }
.metric { display: flex; flex-direction: column; gap: .1rem; padding: .9rem 1rem; }
.metric strong { font-size: 1.5rem; }
.metric-label { font-size: .78rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
[dir="rtl"] .metric-label { letter-spacing: 0; }

.mini-path { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: .5rem; }
.mini-node a { display: flex; align-items: center; gap: .6rem; padding: .45rem; border-radius: 12px; text-decoration: none; color: var(--text); min-height: 44px; }
.mini-node a:hover { background: var(--surface-2); }
.mini-title { font-size: .82rem; font-weight: 600; line-height: 1.25; min-width: 0; }
.mini-node.state-locked { opacity: .55; }
.mini-node.state-passed .ring { --fill: var(--green); }
.mini-node.state-passed .ring::before { background: var(--teal-soft); }

.skill-bars { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .7rem; }
.skill-bars .row-between { margin-bottom: .25rem; }
.tag-list { list-style: none; padding: 0; margin: .5rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem; }

.badge-row { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: .75rem; }
.badge-medal { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .35rem; }
.medal { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 30% 30%, #FFE2A3, var(--amber)); color: var(--navy); box-shadow: 0 4px 0 #C98F1D; }
.medal-lg { width: 72px; height: 72px; }

.heatmap-wrap { overflow-x: auto; padding-bottom: .25rem; }
.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 13px); gap: 3px; width: max-content; }
.hm-cell { width: 13px; height: 13px; border-radius: 3px; background: var(--surface-2); display: inline-block; }
.hm-pad { background: transparent; }
.hm-1 { background: #BDEBE5; } .hm-2 { background: #6FD3C6; } .hm-3 { background: var(--teal); } .hm-4 { background: #076E64; }
:root[data-theme="dark"] .hm-1 { background: #14504C; }
.heatmap-legend { display: flex; align-items: center; gap: 3px; margin-top: .5rem; }

/* ---------- Learning path ---------- */
.path-layout { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1024px) { .path-layout { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; } .plan-card { position: sticky; top: 1.5rem; } }
.learning-path { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 1.25rem; }
.chapter-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.chapter-head { display: flex; align-items: center; gap: .85rem; }
.chapter-head h2 { margin: 0; font-size: 1.08rem; }
.chapter-head h2 a { color: inherit; text-decoration: none; }
.chapter-head h2 a:hover { text-decoration: underline; }
.chapter-num { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-weight: 900; background: var(--navy); color: #fff; flex: none; }
.chapter.state-passed .chapter-num { background: var(--green); }
.chapter.state-locked .chapter-num { background: var(--surface-2); color: var(--muted); }
.chapter.state-locked .chapter-card { opacity: .8; }
.chip-state { background: var(--surface-2); }
.chapter.state-passed .chip-state { background: var(--teal-soft); color: var(--teal-ink); }
.chapter.state-in_progress .chip-state { background: var(--amber-soft); color: var(--amber-ink); }

.node-trail { list-style: none; padding: .75rem 0 .25rem; margin: 0; position: relative; display: flex; flex-direction: column; gap: .4rem; }
.node-trail::before { content: ""; position: absolute; inset-inline-start: 37px; top: 1rem; bottom: 1.5rem; width: 4px; border-radius: 4px; background: repeating-linear-gradient(to bottom, var(--border) 0 10px, transparent 10px 16px); }
.node { display: flex; align-items: center; gap: .9rem; padding-inline-start: 12px; position: relative; }
.node-alt { padding-inline-start: 12px; }
@media (min-width: 640px) { .node-alt { padding-inline-start: 56px; } .node-trail::before { inset-inline-start: 58px; } }
.node-btn {
    width: 54px; height: 54px; border-radius: 50%; flex: none; display: grid; place-items: center; text-decoration: none; position: relative; z-index: 1;
    background: var(--surface-2); color: var(--muted); border: 3px solid var(--surface); box-shadow: 0 4px 0 var(--border);
    transition: transform .15s var(--ease);
}
a.node-btn:hover { transform: translateY(-2px); }
.node-btn .icon { width: 1.4rem; height: 1.4rem; }
.node-btn-lg { width: 62px; height: 62px; border-radius: 18px; }
.node-available .node-btn, .node-in_progress .node-btn { background: var(--teal); color: #fff; box-shadow: 0 5px 0 #0A7A6F; }
.node-in_progress .node-btn { animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 5px 0 #0A7A6F, 0 0 0 0 rgba(14,159,145,.45); } 70% { box-shadow: 0 5px 0 #0A7A6F, 0 0 0 14px rgba(14,159,145,0); } 100% { box-shadow: 0 5px 0 #0A7A6F, 0 0 0 0 rgba(14,159,145,0); } }
.node-completed .node-btn { background: var(--amber); color: var(--navy); box-shadow: 0 5px 0 #C98F1D; }
.node-mastered .node-btn { background: linear-gradient(135deg, var(--amber), #F39C3D); color: var(--navy); box-shadow: 0 5px 0 #C98F1D; }
.node-quiz.node-available .node-btn { background: var(--navy); box-shadow: 0 5px 0 #050B18; }
.node-label { display: flex; flex-direction: column; font-weight: 600; font-size: .94rem; line-height: 1.3; min-width: 0; }
.node-label small { font-weight: 500; }
.roleplay-link { display: flex; align-items: center; gap: .6rem; margin-top: .5rem; padding: .7rem .9rem; border-radius: 14px; background: var(--teal-soft); color: var(--teal-ink); text-decoration: none; font-weight: 650; flex-wrap: wrap; min-height: 44px; }
.final-card { border: 2px solid var(--amber); }
.checklist { list-style: none; padding: 0; margin: .5rem 0 1rem; display: flex; flex-direction: column; gap: .5rem; }
.checklist li { display: flex; align-items: center; gap: .6rem; color: var(--muted); flex-wrap: wrap; }
.checklist li > span:first-of-type { flex: 1 1 200px; }
.checklist li.is-ok { color: var(--text); }
.checklist li.is-ok > .icon { color: var(--green); }
.checklist.big li { padding: .7rem .8rem; border-radius: 12px; background: var(--surface-2); }
.plan-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .7rem; }
.plan-list > li { display: flex; gap: .7rem; align-items: flex-start; }
.plan-list ul { list-style: none; padding: 0; margin: .2rem 0 0; }
.plan-list a { color: var(--text-2); text-decoration: none; }
.plan-week { width: 30px; height: 30px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-weight: 800; font-size: .85rem; flex: none; }
.plan-list li.is-done .plan-week { background: var(--green); color: #fff; }
.plan-list.compact > li { align-items: center; }

/* Module page */
.module-hero .prose { color: var(--text-2); }
.two-col { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .two-col { grid-template-columns: minmax(0, 1fr) minmax(0, 360px); align-items: start; } .two-col.wide-left { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); } }
.lesson-list { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-direction: column; gap: .6rem; }
.lesson-row { display: flex; align-items: center; gap: .9rem; padding: .9rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); flex-wrap: wrap; }
.lesson-row h3 { margin: 0 0 .15rem; }
.lesson-row h3 a { color: inherit; text-decoration: none; }
.lesson-row p { margin: 0; }
.lesson-idx { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; background: var(--surface-2); flex: none; }
.lesson-row.state-completed .lesson-idx, .lesson-row.state-mastered .lesson-idx { background: var(--amber); color: var(--navy); }
.lesson-row.state-locked { opacity: .65; }
.assessment-card.is-passed { border-color: var(--teal); }
.roleplay-card { display: flex; gap: .9rem; align-items: center; text-decoration: none; color: var(--text); margin-bottom: 1rem; }
.roleplay-card > span:last-child { display: flex; flex-direction: column; gap: .2rem; }
.phrase-mini { list-style: none; padding: 0; margin: 0 0 .75rem; display: flex; flex-direction: column; gap: .7rem; }
.phrase-mini li { display: flex; flex-direction: column; gap: .15rem; font-size: .9rem; border-inline-start: 3px solid var(--teal); padding-inline-start: .6rem; }
details.history summary { cursor: pointer; font-weight: 600; min-height: 32px; padding-top: .5rem; }

/* ---------- Notices, toasts ---------- */
.notice { display: flex; gap: .6rem; align-items: flex-start; padding: .85rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: .93rem; }
.notice-info { background: var(--teal-soft); color: var(--teal-ink); }
.notice-warning { background: var(--amber-soft); color: var(--amber-ink); }
.offline-banner { background: var(--amber-soft); color: var(--amber-ink); padding: .5rem 16px; font-size: .88rem; display: flex; gap: .5rem; align-items: center; }
.toasts { position: fixed; z-index: 90; inset-inline-end: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: .5rem; max-width: min(420px, calc(100vw - 32px)); }
@media (min-width: 1024px) { .toasts { bottom: 20px; } }
.toast { display: flex; align-items: center; gap: .6rem; padding: .75rem .8rem .75rem 1rem; border-radius: 14px; background: var(--navy); color: #fff; box-shadow: var(--shadow-lg); animation: toast-in .35s var(--ease); }
.toast-success { background: #0B6F65; }
.toast-warning { background: #7A4E00; }
.toast span { flex: 1; }
.toast-close { background: none; border: 0; color: inherit; cursor: pointer; min-width: 36px; min-height: 36px; border-radius: 8px; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.field label, .rating legend { font-weight: 650; font-size: .92rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], select, textarea {
    width: 100%; min-height: 46px; padding: .6rem .8rem; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); outline: 3px solid color-mix(in srgb, var(--teal) 25%, transparent); outline-offset: 0; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--red); }
.error-text { color: var(--red); font-size: .85rem; margin: 0; display: flex; gap: .3rem; align-items: center; }
.hint { color: var(--muted); font-size: .82rem; margin: 0; }
.check { display: flex; gap: .55rem; align-items: center; font-size: .93rem; cursor: pointer; min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--teal); flex: none; }
.input-sm { min-height: 36px !important; padding: .3rem .6rem !important; font-size: .85rem; max-width: 160px; }
.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); margin-bottom: 1rem; }
.form-grid .span-2 { grid-column: 1 / -1; }
.filter-bar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: 1rem; padding: .75rem; }
.filter-bar > label { flex: 1 1 160px; min-width: 0; }
.filter-bar .check { flex: 0 0 auto; }
.filter-bar.compact { padding: .6rem; }
.search-field { position: relative; display: flex; align-items: center; flex: 2 1 240px !important; }
.search-field .icon { position: absolute; inset-inline-start: .8rem; color: var(--muted); }
.search-field input { padding-inline-start: 2.4rem; }
.json-editor { font-size: .82rem; line-height: 1.45; min-height: 360px; white-space: pre; overflow-wrap: normal; overflow-x: auto; tab-size: 2; }

/* ---------- Auth & landing ---------- */
.auth-shell { display: flex; flex-direction: column; min-height: 100vh; background:
    radial-gradient(1200px 500px at 110% -10%, rgba(14,159,145,.16), transparent 60%),
    radial-gradient(800px 400px at -10% 110%, rgba(246,184,71,.14), transparent 60%), var(--bg); }
.auth-header { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .8rem 16px; max-width: 1200px; width: 100%; margin: 0 auto; flex-wrap: wrap; }
.auth-main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 1rem 16px 2rem; }
.auth-main:focus { outline: none; }
.auth-footer { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1rem 16px; max-width: 1200px; margin: 0 auto; width: 100%; font-size: .85rem; color: var(--muted); }
.auth-card { max-width: 440px; margin: 2rem auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: clamp(1.25rem, 1rem + 2vw, 2.2rem); box-shadow: var(--shadow-lg); }
.auth-card-head { margin-bottom: 1.25rem; display: flex; flex-direction: column; gap: .4rem; align-items: flex-start; }
.auth-alt { text-align: center; margin: 1.2rem 0 0; font-size: .93rem; }
.verify-card { max-width: 560px; }
.verify-result { display: flex; gap: .9rem; align-items: flex-start; margin-top: 1.25rem; padding: 1rem; border-radius: var(--radius); }
.verify-result.is-valid { background: var(--teal-soft); color: var(--text); }
.verify-result.is-valid > .icon { color: var(--teal-ink); }
.verify-result.is-invalid, .verify-result.is-revoked { background: var(--red-soft); color: var(--red); }
.verify-fields { display: grid; gap: .4rem; margin: .5rem 0 0; }
.verify-fields div { display: flex; gap: .5rem; flex-wrap: wrap; }
.verify-fields dt { font-weight: 700; min-width: 110px; color: var(--text-2); }
.verify-fields dd { margin: 0; }

.hero { display: grid; gap: 2rem; align-items: center; padding: 1.5rem 0 1rem; }
@media (min-width: 900px) { .hero { grid-template-columns: 1.15fr .85fr; padding-top: 3rem; } }
.hero h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.3rem); line-height: 1.08; margin: .8rem 0; }
.lead { font-size: 1.1rem; color: var(--text-2); max-width: 60ch; }
.hero-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .75rem; margin: 1.75rem 0 0; }
.hero-stats div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .7rem .9rem; display: flex; flex-direction: column-reverse; }
.hero-stats dd { margin: 0; font-size: 1.6rem; font-weight: 900; color: var(--teal-ink); }
.hero-stats dt { font-size: .82rem; color: var(--muted); }
.hero-art { position: relative; min-height: 320px; }
.hero-card { position: absolute; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 1rem 1.1rem; }
.hero-card p { margin: .4rem 0 0; font-weight: 600; }
.hero-card-a { inset-inline-start: 0; top: 10px; max-width: 330px; }
.hero-card-b { inset-inline-end: 0; top: 165px; display: flex; gap: .8rem; align-items: center; }
.hero-card-b small { display: block; color: var(--muted); }
.hero-card-c { inset-inline-start: 18%; top: 250px; display: flex; gap: .4rem; align-items: center; background: var(--amber-soft); color: var(--amber-ink); }
.grid-3 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.feature .icon { color: var(--teal); margin-bottom: .5rem; }
.curriculum { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.curriculum li { display: flex; gap: .9rem; align-items: flex-start; }
.curriculum h3 { margin-bottom: .2rem; }
.curriculum p { margin: 0; }
.num { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--navy); color: #fff; font-weight: 800; flex: none; }
.curriculum .chip { margin-inline-start: auto; }

/* ---------- Bilingual ---------- */
.bi { display: inline-flex; flex-direction: column; gap: .15rem; }
.bi .bi-ar { color: var(--text-2); }
div.bi { display: flex; }
.bi-block { display: grid; gap: .75rem; }
/* Side-by-side EN/AR only where there is room; narrow cards stack the two languages. */
.bi-block > [lang="ar"] { border-top: 1px dashed var(--border); padding-top: .6rem; }
@media (min-width: 720px) { .module-hero .bi-block, .step-card .bi-block, .conversation .bi-block, .example .bi-block { grid-template-columns: 1fr 1fr; }
  .module-hero .bi-block > [lang="ar"], .step-card .bi-block > [lang="ar"], .conversation .bi-block > [lang="ar"], .example .bi-block > [lang="ar"] { border-top: 0; padding-top: 0; border-inline-start: 2px solid var(--border); padding-inline-start: 1rem; } }
.prose p:last-child { margin-bottom: 0; }

/* ---------- Lesson player ---------- */
.focus-shell { background: var(--bg); }
.focus-main { min-height: 100vh; }
.focus-main:focus { outline: none; }
.player, .quiz-wrap { max-width: 820px; margin: 0 auto; padding: 0 16px; min-height: 100vh; display: flex; flex-direction: column; }
.player-head { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: .75rem; padding: .7rem 0; background: var(--bg); }
.player-progress { flex: 1; display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.bar-player { height: 14px; }
.bar-player > span { width: 0; background: linear-gradient(90deg, var(--teal), #3DD6C4); position: relative; }
.bar-player > span::after { content: ""; position: absolute; inset: 3px 6px auto; height: 3px; border-radius: 2px; background: rgba(255,255,255,.45); }
.player-head .lang-switch button { min-width: 34px; padding: 0 .4rem; }
.player-intro { padding: .5rem 0 0; }
.player-title { font-size: clamp(1.3rem, 1.05rem + 1vw, 1.75rem); }
.player-stage { flex: 1; padding: 1rem 0 2rem; }
.player-stage:focus { outline: none; }
.player-foot { position: sticky; bottom: 0; background: var(--bg); padding: .75rem 0 calc(.9rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); z-index: 5; }
.player-actions { display: flex; justify-content: flex-end; align-items: center; gap: .75rem; }
.player-actions .btn { min-width: 160px; }
@media (max-width: 520px) { .player-actions .btn { flex: 1; } }
.feedback { border-radius: var(--radius); padding: .9rem 1rem; margin-bottom: .75rem; animation: rise .3s var(--ease); }
.feedback.is-correct { background: var(--teal-soft); color: var(--text); border: 2px solid var(--teal); }
.feedback.is-wrong { background: var(--red-soft); color: var(--text); border: 2px solid var(--red); }
.feedback h3 { display: flex; align-items: center; gap: .4rem; margin: 0 0 .3rem; }
.feedback.is-correct h3 { color: var(--teal-ink); }
.feedback.is-wrong h3 { color: var(--red); }
.feedback p { margin: .25rem 0 0; }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.pop { animation: pop .35s var(--ease); }
@keyframes pop { 50% { transform: scale(1.04); } }

.step { animation: slide-in .35s var(--ease); }
@keyframes slide-in { from { opacity: 0; transform: translateX(24px); } }
[dir="rtl"] .step { animation-name: slide-in-rtl; }
@keyframes slide-in-rtl { from { opacity: 0; transform: translateX(-24px); } }
.step-kind { display: inline-flex; align-items: center; gap: .35rem; font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--teal-ink); background: var(--teal-soft); border-radius: 999px; padding: .2rem .6rem; margin-bottom: .75rem; }
.step h2 { font-size: 1.25rem; }
.step-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
.example { margin-top: 1rem; padding: .9rem 1rem; border-radius: var(--radius-sm); background: var(--amber-soft); border-inline-start: 4px solid var(--amber); }
.example strong { display: block; margin-bottom: .25rem; color: var(--amber-ink); font-size: .85rem; }

.options { display: flex; flex-direction: column; gap: .6rem; }
.option, .choice-opt {
    display: flex; align-items: center; gap: .8rem; padding: .85rem 1rem; border-radius: 16px; border: 2px solid var(--border); background: var(--surface);
    cursor: pointer; min-height: 56px; text-align: start; width: 100%; box-shadow: 0 3px 0 var(--border); transition: border-color .15s, background .15s, transform .1s;
}
.option:hover, .choice-opt:hover { border-color: color-mix(in srgb, var(--teal) 50%, var(--border)); }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option-mark { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); flex: none; display: grid; place-items: center; }
.option input[type="checkbox"] + .option-mark { border-radius: 7px; }
.option:has(input:checked), .choice-opt.is-selected { border-color: var(--teal); background: var(--teal-soft); box-shadow: 0 3px 0 var(--teal); }
.option:has(input:checked) .option-mark { border-color: var(--teal); background: var(--teal); box-shadow: inset 0 0 0 3px var(--surface); }
.option:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice-opt.is-correct { border-color: var(--green); background: var(--teal-soft); box-shadow: 0 3px 0 var(--green); }
.choice-opt.is-wrong { border-color: var(--red); background: var(--red-soft); box-shadow: 0 3px 0 var(--red); }
.choice-opt[disabled] { cursor: default; }
.option-key, .choice-key { width: 30px; height: 30px; flex: none; border-radius: 9px; border: 2px solid var(--border); display: grid; place-items: center; font-weight: 800; font-size: .8rem; color: var(--muted); }
.option-text { flex: 1; min-width: 0; }

.flip-grid { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.flip { perspective: 900px; min-height: 170px; cursor: pointer; border: 0; background: none; padding: 0; text-align: start; width: 100%; }
.flip-inner { position: relative; width: 100%; height: 100%; min-height: 170px; transition: transform .5s var(--ease); transform-style: preserve-3d; }
.flip.is-flipped .flip-inner { transform: rotateY(180deg); }
.flip-face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; justify-content: space-between; gap: .4rem; border: 2px solid var(--border); background: var(--surface); box-shadow: 0 4px 0 var(--border); }
.flip-back { transform: rotateY(180deg); background: var(--navy); color: #fff; border-color: var(--navy); box-shadow: 0 4px 0 #050B18; }
.flip-back .muted { color: #B9C7E0; }
.flip-face p { margin: 0; font-weight: 650; font-size: 1.02rem; }
.flip-hint { font-size: .75rem; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: .3rem; }
.flip-back .flip-hint { color: #B9C7E0; }

.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.match-col { display: flex; flex-direction: column; gap: .6rem; }
.match-item { padding: .7rem .8rem; border-radius: 14px; border: 2px solid var(--border); background: var(--surface); cursor: pointer; text-align: start; min-height: 56px; font-weight: 600; font-size: .92rem; box-shadow: 0 3px 0 var(--border); }
.match-item.is-selected { border-color: var(--teal); background: var(--teal-soft); }
.match-item.is-paired { border-color: var(--navy); background: var(--surface-2); opacity: .85; }
.match-item .pair-num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--navy); color: #fff; font-size: .72rem; margin-inline-end: .4rem; }
.match-item.is-good { border-color: var(--green); }
.match-item.is-bad { border-color: var(--red); }

.sentence { font-size: 1.15rem; font-weight: 650; line-height: 1.9; }
.blank { display: inline-block; min-width: 110px; border-bottom: 3px solid var(--teal); text-align: center; color: var(--teal-ink); padding: 0 .3rem; }
.word-bank { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.word { padding: .55rem .95rem; border-radius: 12px; border: 2px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 650; min-height: 44px; box-shadow: 0 3px 0 var(--border); }
.word.is-selected { border-color: var(--teal); background: var(--teal-soft); }

.order-target { min-height: 64px; border: 2px dashed var(--border); border-radius: var(--radius); padding: .5rem; display: flex; flex-direction: column; gap: .45rem; margin-bottom: .8rem; }
.order-target:empty::before { content: attr(data-empty); color: var(--muted); font-size: .88rem; padding: .6rem; }
.order-pool { display: flex; flex-direction: column; gap: .45rem; }
.order-item { display: flex; gap: .6rem; align-items: flex-start; padding: .65rem .8rem; border-radius: 14px; border: 2px solid var(--border); background: var(--surface); cursor: pointer; text-align: start; width: 100%; min-height: 48px; box-shadow: 0 3px 0 var(--border); }
.order-item .order-n { width: 24px; height: 24px; border-radius: 7px; background: var(--navy); color: #fff; display: grid; place-items: center; font-size: .75rem; font-weight: 800; flex: none; }
.order-target .order-item { border-color: var(--teal); }

.reflect textarea { min-height: 120px; }
.model-answer { margin-top: .8rem; padding: .9rem 1rem; border-radius: var(--radius-sm); background: var(--teal-soft); }
.summary-points { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .6rem; }
.summary-points li { display: flex; gap: .6rem; align-items: flex-start; }
.summary-points li > .icon { color: var(--teal); margin-top: .2rem; }
.takeaway { margin-top: 1rem; padding: 1rem; border-radius: var(--radius); background: linear-gradient(120deg, var(--navy), #15335A); color: #fff; }
.takeaway strong { color: var(--amber); }

.complete-screen { text-align: center; display: flex; flex-direction: column; align-items: center; gap: .75rem; padding: 2rem 0; }
.complete-screen .ring { margin: .5rem auto; }
.xp-pop { display: inline-flex; align-items: center; gap: .35rem; font-weight: 900; font-size: 1.3rem; color: var(--amber-ink); background: var(--amber-soft); padding: .35rem .9rem; border-radius: 999px; animation: pop .5s var(--ease); }
.skeleton { display: flex; flex-direction: column; gap: .7rem; }
.skeleton span { height: 18px; border-radius: 8px; background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skeleton span:nth-child(2) { width: 80%; } .skeleton span:nth-child(3) { width: 60%; }
@keyframes shimmer { to { background-position: -200% 0; } }
.saved-indicator { display: inline-flex; gap: .3rem; align-items: center; color: var(--teal-ink); }

/* ---------- Quiz ---------- */
.quiz-form { display: flex; flex-direction: column; gap: 1rem; padding-bottom: 2rem; }
.question { border: 1px solid var(--border); margin: 0; }
.question legend { display: flex; gap: .7rem; align-items: flex-start; font-weight: 650; font-size: 1.02rem; padding: 0; margin-bottom: .9rem; float: left; width: 100%; }
[dir="rtl"] .question legend { float: right; }
.question legend + * { clear: both; }
.q-num { width: 30px; height: 30px; border-radius: 9px; background: var(--navy); color: #fff; display: grid; place-items: center; font-size: .82rem; font-weight: 800; flex: none; }
.q-prompt { flex: 1; min-width: 0; }
.question.is-answered { border-color: color-mix(in srgb, var(--teal) 45%, var(--border)); }
.reorder-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .45rem; counter-reset: ro; }
.reorder-list li { display: flex; align-items: center; gap: .6rem; padding: .55rem .7rem; border: 2px solid var(--border); border-radius: 14px; background: var(--surface); counter-increment: ro; }
.reorder-list li::before { content: counter(ro); width: 26px; height: 26px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; font-weight: 800; font-size: .8rem; flex: none; }
.reorder-btns { display: flex; gap: .3rem; flex: none; }
.quiz-submit { position: sticky; bottom: 0; background: var(--bg); padding: .75rem 0 calc(.75rem + env(safe-area-inset-bottom)); }
.result-hero { display: flex; gap: 1.5rem; align-items: center; flex-wrap: wrap; padding: 1.5rem; border-radius: var(--radius-lg); margin-bottom: 1.25rem; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.result-hero > div:last-child { flex: 1 1 260px; }
.result-hero.is-pass { background: linear-gradient(120deg, var(--teal-soft), var(--surface)); border-color: var(--teal); }
.result-hero.is-fail { background: linear-gradient(120deg, var(--amber-soft), var(--surface)); }
.result-hero .ring::before { background: var(--surface); }
.result-hero.is-fail .ring { --fill: var(--amber); }
.review-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .8rem; }
.review-item { border-inline-start: 5px solid var(--border); }
.review-item.is-correct { border-inline-start-color: var(--green); }
.review-item.is-wrong { border-inline-start-color: var(--red); }
.review-head { display: flex; gap: .6rem; align-items: flex-start; }
.review-head h3 { flex: 1; }
.review-mark { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff; }
.is-correct .review-mark { background: var(--green); } .is-wrong .review-mark { background: var(--red); }
.review-answers { display: grid; grid-template-columns: max-content 1fr; gap: .3rem .8rem; margin: .5rem 0; font-size: .92rem; }
.review-answers dt { font-weight: 700; color: var(--muted); }
.review-answers dd { margin: 0; }
@media (max-width: 520px) { .review-answers { grid-template-columns: 1fr; } }
.explain { background: var(--surface-2); border-radius: 12px; padding: .7rem .9rem; font-size: .92rem; }
.inline-list { margin: 0; padding-inline-start: 1.2rem; }
.history-bars { list-style: none; padding: 0; margin: 0; display: flex; align-items: flex-end; gap: .4rem; height: 110px; }
.history-bars.tall { height: 150px; }
.history-bars li { flex: 1; max-width: 42px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: .2rem; }
.hb { width: 100%; border-radius: 8px 8px 3px 3px; background: var(--amber); min-height: 4px; }
.hb.is-pass { background: var(--teal); }
.history-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.history-list li { display: flex; align-items: center; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid var(--border); }
.history-list li:last-child { border-bottom: 0; }
.history-list a { color: var(--text); text-decoration: none; }
.xp-text { color: var(--amber-ink); }

/* ---------- Scenarios ---------- */
.tile-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); }
.tile { display: flex; flex-direction: column; gap: .4rem; text-decoration: none; color: var(--text); transition: transform .15s var(--ease), box-shadow .15s; }
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.tile h2 { margin: .3rem 0 0; font-size: 1.08rem; }
.tile .chip { align-self: flex-start; }
.tile-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; }
.tile-teal { background: var(--teal-soft); color: var(--teal-ink); }
.tile-amber { background: var(--amber-soft); color: var(--amber-ink); }
.tile-navy { background: var(--navy); color: #fff; }
.scenario-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); }
.scenario-card { display: flex; flex-direction: column; gap: .8rem; }
.scenario-card.is-capstone { border: 2px solid var(--amber); }
.scenario-card.is-locked { opacity: .75; }
.avatar { width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 900; color: #fff; background: linear-gradient(135deg, var(--navy), var(--teal)); }
.avatar-lg { width: 60px; height: 60px; font-size: 1.3rem; }
.difficulty { display: inline-flex; gap: 3px; }
.difficulty span { width: 16px; height: 6px; border-radius: 3px; background: var(--surface-2); }
.difficulty span.on { background: var(--amber); }
.scenario-layout { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1024px) { .scenario-layout { grid-template-columns: 340px minmax(0, 1fr); align-items: start; } .persona-card { position: sticky; top: 1.5rem; } }
.conversation { min-width: 0; }
.transcript { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-direction: column; gap: 1rem; }
.turn { display: flex; flex-direction: column; gap: .5rem; }
.bubble { max-width: min(640px, 92%); padding: .8rem 1rem; border-radius: 18px; box-shadow: var(--shadow); }
.bubble p { margin: 0; }
.bubble .speaker { display: block; font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; margin-bottom: .25rem; opacity: .75; }
[dir="rtl"] .bubble .speaker { letter-spacing: 0; }
.bubble-client { background: var(--surface); border: 1px solid var(--border); border-start-start-radius: 6px; align-self: flex-start; }
.bubble-client.is-current { border: 2px solid var(--teal); }
.bubble-you { background: var(--navy); color: #fff; border-start-end-radius: 6px; align-self: flex-end; }
.bubble-you .bi-ar { color: #C9D4E8; }
.coach { display: flex; gap: .6rem; padding: .7rem .9rem; border-radius: 14px; font-size: .9rem; align-self: stretch; }
.coach.q-2 { background: var(--teal-soft); }
.coach.q-1 { background: var(--amber-soft); }
.coach.q-0 { background: var(--red-soft); }
.coach-mark { flex: none; }
.coach.q-2 .coach-mark { color: var(--green); } .coach.q-1 .coach-mark { color: var(--amber-ink); } .coach.q-0 .coach-mark { color: var(--red); }
.stronger { margin-top: .4rem; padding-top: .4rem; border-top: 1px dashed currentColor; }
.choice-form fieldset { border: 0; padding: 0; margin: .5rem 0 0; display: flex; flex-direction: column; gap: .6rem; }
.choice-btn { display: flex; align-items: flex-start; gap: .75rem; width: 100%; text-align: start; padding: .85rem 1rem; border-radius: 16px; border: 2px solid var(--border); background: var(--surface); cursor: pointer; min-height: 56px; box-shadow: 0 3px 0 var(--border); transition: border-color .15s, transform .1s; }
.choice-btn:hover { border-color: var(--teal); }
.choice-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--border); }
.choice-btn.is-picked { border-color: var(--navy); background: var(--surface-2); }
.choice-btn[disabled] { cursor: default; }
.abandon-form { margin-top: 1rem; }
.result-card.is-pass { border: 2px solid var(--teal); }
.start-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .75rem; padding: 2rem 1rem; }

/* Drills / calculators */
.drill-list { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-direction: column; gap: 1rem; }
.drill fieldset { border: 0; padding: 0; margin: .75rem 0 0; display: flex; flex-direction: column; gap: .5rem; }
.drill .bubble { max-width: 100%; }
.calc-out { display: grid; gap: .1rem; margin: 1rem 0; }
.calc-out div { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--border); }
.calc-out dt { color: var(--text-2); }
.calc-out dd { margin: 0; font-weight: 800; text-align: end; }
.calc-out .is-warn dd { color: var(--red); }
.milestones { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .4rem; }
.milestones li { display: flex; justify-content: space-between; gap: .5rem; font-size: .9rem; padding: .45rem .6rem; background: var(--surface-2); border-radius: 10px; flex-wrap: wrap; }
.roi-big { font-size: clamp(2rem, 1.5rem + 2vw, 2.8rem); font-weight: 900; color: var(--teal-ink); margin: 0; }
.formula { font-family: var(--mono); background: var(--surface-2); border-radius: 10px; padding: .7rem .8rem; font-size: .9rem; overflow-x: auto; }
.bullets { padding-inline-start: 1.1rem; margin: 0; display: flex; flex-direction: column; gap: .3rem; }
.range-field input[type="range"] { flex: 1; accent-color: var(--teal); min-width: 0; height: 44px; }
.num-input { max-width: 120px; }

/* Phrases */
.phrase-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.phrase-card { display: flex; flex-direction: column; gap: .5rem; }
.phrase-top { display: flex; justify-content: space-between; align-items: center; }
.phrase-en { font-weight: 700; font-size: 1.03rem; margin: 0; }
.phrase-ar { font-size: 1.08rem; margin: 0; color: var(--text-2); text-align: start; }
.phrase-when { margin: 0; color: var(--text-2); }
.phrase-actions { display: flex; gap: .4rem; margin-top: auto; padding-top: .3rem; flex-wrap: wrap; }
.phrase-actions form { margin: 0; }
.fav-btn.is-fav { color: #D9435B; background: #FCE8EC; border-color: #F4C2CC; }
.fav-btn.is-fav .icon { fill: currentColor; }
.mini-stats { display: flex; gap: .5rem; margin: 0; flex-wrap: wrap; }
.mini-stats div { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .4rem .8rem; text-align: center; }
.mini-stats dt { font-size: .72rem; color: var(--muted); }
.mini-stats dd { margin: 0; font-weight: 800; }
.session-goal { margin-bottom: .75rem; color: var(--text-2); }
.flash-stage { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: .9rem; }
.flash-card { min-height: 260px; border-radius: var(--radius-lg); background: var(--surface); border: 2px solid var(--border); box-shadow: 0 6px 0 var(--border); padding: 1.25rem; display: flex; flex-direction: column; justify-content: center; gap: 1rem; text-align: center; }
.flash-face { display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.flash-back { border-top: 2px dashed var(--border); padding-top: 1rem; }
.flash-text { font-size: clamp(1.2rem, 1rem + 1vw, 1.55rem); font-weight: 750; margin: 0; }
.grade-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.grade { flex-direction: column; gap: 0; font-size: .9rem; padding: .4rem; }
.grade kbd { margin: 0; }
.grade-0 { background: var(--red-soft); color: var(--red); } .grade-1 { background: var(--amber-soft); color: var(--amber-ink); }
.grade-2 { background: var(--teal-soft); color: var(--teal-ink); } .grade-3 { background: var(--navy); color: #fff; }
@media (max-width: 400px) { .grade-row { grid-template-columns: repeat(2, 1fr); } }

/* Progress / achievements */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: .6rem .5rem; text-align: start; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table td.actions { white-space: nowrap; display: flex; gap: .3rem; flex-wrap: wrap; }
.table a { color: var(--text); font-weight: 600; }
.state-chip-passed { background: var(--teal-soft); color: var(--teal-ink); }
.state-chip-in_progress { background: var(--amber-soft); color: var(--amber-ink); }
.status-published { background: var(--teal-soft); color: var(--teal-ink); }
.status-draft { background: var(--amber-soft); color: var(--amber-ink); }
.status-archived { background: var(--red-soft); color: var(--red); }
.badge-grid { list-style: none; padding: 0; margin: 0 0 1.25rem; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); }
.badge-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .5rem; }
.badge-card.is-locked .medal { background: var(--surface-2); color: var(--muted); box-shadow: 0 4px 0 var(--border); }
.badge-card.is-earned { border-color: var(--amber); }
.level-ladder { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); }
.level-ladder li { display: flex; gap: .6rem; align-items: center; padding: .6rem; border-radius: 14px; background: var(--surface-2); opacity: .7; }
.level-ladder li.is-reached { opacity: 1; }
.level-ladder li.is-current { outline: 2px solid var(--amber); }
.level-num { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--navy); color: #fff; font-weight: 900; flex: none; }
.rating { border: 0; padding: 0; margin: 0; }
.rating-scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; margin: .4rem 0; }
.rating-scale label { position: relative; }
.rating-scale input { position: absolute; opacity: 0; }
.rating-scale span { display: grid; place-items: center; min-height: 46px; border-radius: 12px; border: 2px solid var(--border); font-weight: 800; cursor: pointer; background: var(--surface); }
.rating-scale input:checked + span { background: var(--teal); color: #fff; border-color: var(--teal); }
.rating-scale input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.score-total { font-size: 1.1rem; }

/* Certificates */
.cert-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .8rem; }
.cert-item { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.cert-item.is-revoked { opacity: .7; }
.cert-thumb { width: 72px; height: 56px; border-radius: 10px; background: linear-gradient(135deg, var(--navy), #15335A); display: grid; place-items: center; flex: none; }
.cert-thumb .icon { color: var(--amber); width: 2rem; height: 2rem; }
.issue-form { margin: 1rem 0; padding: 1rem; border-radius: var(--radius); background: var(--amber-soft); }
.print-shell { background: var(--surface-2); }
.print-toolbar { max-width: 1120px; margin: 0 auto; padding: 1rem 16px; display: flex; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.certificate { max-width: 1120px; margin: 0 auto 2rem; padding: 0 16px; color: #172338; }
.cert-frame { position: relative; aspect-ratio: 297 / 210; background: #fff; border: 10px solid #101C35; outline: 2px solid #0E9F91; outline-offset: -22px; padding: clamp(1rem, 3.5vw, 3rem) clamp(1rem, 4.5vw, 3.8rem); display: flex; flex-direction: column; gap: clamp(.5rem, 1.5vw, 1.25rem); box-shadow: var(--shadow-lg); overflow: hidden; }
.cert-frame::before { content: ""; position: absolute; inset-inline-end: -80px; top: -80px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(246,184,71,.22), transparent 70%); }
.cert-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.cert-brand { display: flex; gap: .7rem; align-items: center; }
.cert-brand div { display: flex; flex-direction: column; font-size: clamp(.7rem, 1.2vw, .95rem); }
.cert-brand span { color: #0E9F91; }
.cert-titles { text-align: end; }
.cert-titles h1 { font-size: clamp(1.1rem, 2.8vw, 2.3rem); margin: 0; color: #101C35; font-family: Georgia, "Times New Roman", serif; }
.cert-title-ar { font-size: clamp(1rem, 2.2vw, 1.8rem); color: #0E9F91; margin: 0; }
.cert-body { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(.75rem, 3vw, 2.5rem); flex: 1; font-size: clamp(.62rem, 1.15vw, .98rem); align-content: center; }
.cert-col + .cert-col { border-inline-start: 1px solid #D7DEE8; padding-inline-start: clamp(.75rem, 3vw, 2.5rem); }
.cert-name { font-size: clamp(1.05rem, 2.6vw, 2.1rem); font-weight: 800; color: #101C35; margin: .2em 0 .4em; font-family: Georgia, "Times New Roman", serif; }
[lang="ar"] .cert-name { font-family: var(--font-ar); }
.cert-ach { color: #8A5A00; font-weight: 700; }
.cert-footer { display: grid; grid-template-columns: 1.1fr 1.4fr auto; gap: 1rem; align-items: end; font-size: clamp(.55rem, 1vw, .85rem); }
.cert-sign { display: flex; flex-direction: column; }
.sign-line { width: min(220px, 100%); border-top: 2px solid #101C35; margin-bottom: .3rem; }
.cert-id { display: flex; flex-direction: column; gap: .1rem; }
.cert-id strong { font-size: clamp(.7rem, 1.3vw, 1.05rem); color: #101C35; }
.cert-qr svg { width: clamp(56px, 10vw, 120px); height: auto; display: block; }
.cert-disclaimer { font-size: clamp(.5rem, .85vw, .72rem); color: #5B6B84; text-align: center; margin: 0; }
.revoked-stamp { position: absolute; top: 40%; inset-inline-start: 20%; transform: rotate(-14deg); border: 6px solid #C2413B; color: #C2413B; font-size: clamp(1.4rem, 5vw, 4rem); font-weight: 900; padding: .2em .6em; border-radius: 12px; opacity: .55; }
@media (max-width: 640px) { .cert-frame { aspect-ratio: auto; } .cert-body { grid-template-columns: 1fr; } .cert-col + .cert-col { border: 0; padding: 0; } .cert-footer { grid-template-columns: 1fr; } }
@media print {
    @page { size: A4 landscape; margin: 0; }
    body { background: #fff !important; }
    .no-print, .toasts { display: none !important; }
    .certificate { padding: 0; margin: 0; max-width: none; }
    .cert-frame { width: 297mm; height: 210mm; box-shadow: none; aspect-ratio: auto; }
}

/* Empty / error */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .6rem; padding: 2.5rem 1rem; }
.error-page { text-align: center; padding: 3rem 1rem; display: flex; flex-direction: column; align-items: center; gap: .8rem; }
.error-code { font-size: clamp(4rem, 3rem + 6vw, 7rem); font-weight: 900; line-height: 1; background: linear-gradient(135deg, var(--teal), var(--amber)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Admin */
.admin-topbar { display: flex; }
.admin-menu { position: relative; }
.admin-menu summary { list-style: none; }
.admin-menu summary::-webkit-details-marker { display: none; }
.admin-menu nav { position: absolute; inset-inline-end: 0; top: 52px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; min-width: 200px; padding: .4rem; z-index: 40; }
.admin-menu nav a { padding: .6rem .8rem; border-radius: 10px; text-decoration: none; color: var(--text); }
.admin-menu nav a:hover { background: var(--surface-2); }
.admin-content { padding-bottom: 3rem; }
.admin-form .card-title { margin-top: .5rem; }
.danger-zone { border-color: var(--red); }

/* Confetti */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 120; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
:root[data-motion="reduce"] *, :root[data-motion="reduce"] *::before, :root[data-motion="reduce"] *::after { animation: none !important; transition: none !important; }

/* Very small phones */
@media (max-width: 380px) {
    .brand-text small { display: none; }
    .brand-text strong { font-size: .86rem; }
    .lang-switch button { min-width: 34px; padding: 0 .35rem; }
    .topbar .icon-btn { min-width: 40px; }
    .match-grid { gap: .4rem; }
    .match-item { font-size: .84rem; padding: .55rem; }
}
@media (max-width: 340px) {
    .topbar .brand-text { display: none; }
}

/* Keep long feedback from covering the step on small screens */
.feedback { max-height: 42vh; overflow-y: auto; overscroll-behavior: contain; }
.result-card form { margin-top: 1rem; }

/* Landing hero cards: give the bilingual quote room; admin top bar is mobile-only. */
.hero-art { min-height: 360px; }
.hero-card-a { max-width: min(360px, 100%); }
.hero-card-b { top: 205px; }
.hero-card-c { top: 300px; }
@media (min-width: 1024px) { .admin-topbar { display: none; } }
