/*
 * FormationAtHome Exams — frontend.
 * Brand tokens (--fha-primary, --fha-secondary, --fha-radius, --fha-font) are
 * injected from Settings → Branding. Logical properties keep RTL (Arabic) and
 * LTR (French) layouts correct.
 */

.fha-app {
	--fha-primary: #0F5B78;
	--fha-secondary: #D99A2B;
	--fha-radius: 14px;
	--fha-font: inherit;
	--fha-ink: #16242C;
	--fha-muted: #5B6B74;
	--fha-line: #DFE6EA;
	--fha-surface: #FFFFFF;
	--fha-wash: #F2F6F8;
	--fha-pass: #1F8A55;
	--fha-fail: #B8432F;
	--fha-warn: #A86A12;
	--fha-primary-soft: color-mix(in srgb, var(--fha-primary) 9%, #fff);
	--fha-secondary-soft: color-mix(in srgb, var(--fha-secondary) 16%, #fff);
	--fha-r-sm: calc(var(--fha-radius) * .55);
	--fha-r-lg: calc(var(--fha-radius) * 1.4);
	font-family: var(--fha-font);
	color: var(--fha-ink);
	line-height: 1.6;
	font-size: 1rem;
	text-align: start;
	margin-block: 1.5rem;
}
.fha-app *, .fha-app *::before, .fha-app *::after { box-sizing: border-box; }
.fha-app h2, .fha-app h3 { color: var(--fha-ink); line-height: 1.3; margin: 0; font-family: inherit; }
.fha-app p { margin: 0 0 .75em; }
.fha-app img { max-width: 100%; height: auto; }
.fha-app a { color: var(--fha-primary); }
.fha-app [hidden] { display: none !important; }
.fha-app .screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.fha-muted { color: var(--fha-muted); font-size: .92em; }
.fha-text-pass { color: var(--fha-pass); }
.fha-text-fail { color: var(--fha-fail); }

/* ---------- icons, logo ---------- */
.fha-icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }
.fha-logo { display: inline-flex; align-items: center; text-decoration: none; }
.fha-logo img { display: block; max-height: 46px; width: auto; }
.fha-logo--text { font-weight: 800; color: var(--fha-primary); font-size: 1.1rem; }

/* ---------- buttons ---------- */
.fha-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: .45em;
	min-height: 44px; padding: .55em 1.15em; border-radius: var(--fha-r-sm);
	border: 1.5px solid transparent; font: inherit; font-weight: 700; font-size: .95rem;
	line-height: 1.2; cursor: pointer; text-decoration: none !important;
	transition: background-color .15s, border-color .15s, color .15s, transform .1s;
}
.fha-btn:active { transform: translateY(1px); }
.fha-btn:focus-visible, .fha-option:focus-within, .fha-map__item:focus-visible, .fha-input:focus-visible {
	outline: 3px solid color-mix(in srgb, var(--fha-primary) 45%, transparent); outline-offset: 2px;
}
.fha-btn[disabled] { opacity: .45; cursor: not-allowed; }
.fha-btn--primary { background: var(--fha-primary); color: #fff !important; }
.fha-btn--primary:hover { background: color-mix(in srgb, var(--fha-primary) 86%, #000); }
.fha-btn--accent { background: var(--fha-secondary); color: #1d1405 !important; }
.fha-btn--accent:hover { background: color-mix(in srgb, var(--fha-secondary) 88%, #000); }
.fha-btn--ghost { background: var(--fha-surface); border-color: var(--fha-line); color: var(--fha-ink) !important; }
.fha-btn--ghost:hover { border-color: var(--fha-primary); color: var(--fha-primary) !important; }
.fha-btn--sm { min-height: 36px; padding: .35em .8em; font-size: .85rem; }
.fha-btn--lg { min-height: 52px; padding: .7em 1.6em; font-size: 1.02rem; }

/* ---------- chips, badges, status ---------- */
.fha-chip { display: inline-block; padding: .15em .65em; border-radius: 99px; background: var(--fha-primary-soft); color: var(--fha-primary); font-size: .78rem; font-weight: 700; white-space: nowrap; }
.fha-chip--warn { background: #FFF3DC; color: var(--fha-warn); }
.fha-badge {
	--fha-badge: var(--fha-primary);
	display: inline-flex; align-items: center; padding: .2em .75em; border-radius: 99px;
	background: color-mix(in srgb, var(--fha-badge) 13%, #fff); color: color-mix(in srgb, var(--fha-badge) 85%, #000);
	border: 1px solid color-mix(in srgb, var(--fha-badge) 30%, #fff);
	font-weight: 700; font-size: .82rem; white-space: nowrap;
}
.fha-status { display: inline-flex; align-items: center; gap: .3em; font-weight: 700; font-size: .85rem; white-space: nowrap; }
.fha-status::before { content: ""; width: .55em; height: .55em; border-radius: 50%; background: currentColor; }
.fha-status.is-pass { color: var(--fha-pass); }
.fha-status.is-fail { color: var(--fha-fail); }
.fha-result .fha-status::before { display: none; }

/* ---------- notices ---------- */
.fha-notice { display: flex; gap: .6em; align-items: center; flex-wrap: wrap; padding: .85em 1em; border-radius: var(--fha-r-sm); background: var(--fha-wash); border-inline-start: 4px solid var(--fha-primary); margin: 0 0 1em; }
.fha-notice--lock { border-color: var(--fha-warn); background: #FFF8EA; }
.fha-notice--resume { border-color: var(--fha-secondary); background: var(--fha-secondary-soft); }
.fha-notice--resume .fha-btn { margin-inline-start: auto; }
.fha-error { color: var(--fha-fail); font-weight: 600; margin-top: .75em; }
.fha-empty { padding: 1.5em; text-align: center; color: var(--fha-muted); background: var(--fha-wash); border-radius: var(--fha-r-sm); }
.fha-backlink { margin: 0 0 1em; }
.fha-backlink a { display: inline-flex; align-items: center; gap: .3em; text-decoration: none; font-weight: 600; }
[dir="ltr"] .fha-backlink .fha-icon, html:not([dir="rtl"]) .fha-backlink .fha-icon { transform: none; }
[dir="rtl"] .fha-backlink .fha-icon { transform: scaleX(-1); }

/* ---------- cards / panels ---------- */
.fha-card, .fha-exam__intro, .fha-run, .fha-result, .fha-panel, .fha-board, .fha-review__head {
	background: var(--fha-surface); border: 1px solid var(--fha-line); border-radius: var(--fha-r-lg);
}
.fha-login { padding: 2em; text-align: center; display: grid; justify-items: center; gap: .8em; }

/* ---------- exam intro ---------- */
.fha-exam__intro { padding: clamp(1.1rem, 3vw, 2rem); }
.fha-exam__head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding-bottom: 1rem; border-bottom: 1px solid var(--fha-line); margin-bottom: 1.25rem; }
.fha-exam__titles { display: grid; gap: .35rem; }
.fha-exam__title { font-size: clamp(1.35rem, 3.2vw, 1.85rem); font-weight: 800; }
.fha-exam__cover { margin: 0 0 1.25rem; border-radius: var(--fha-radius); overflow: hidden; }
.fha-exam__cover img { width: 100%; max-height: 280px; object-fit: cover; display: block; }
.fha-exam__desc { color: var(--fha-muted); max-width: 70ch; }
.fha-facts { list-style: none; margin: 1.25rem 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .6rem; }
.fha-facts li { display: flex; align-items: center; gap: .6em; padding: .7em .9em; background: var(--fha-wash); border-radius: var(--fha-r-sm); font-size: .93rem; }
.fha-facts .fha-icon { color: var(--fha-primary); width: 1.3em; height: 1.3em; }
.fha-instructions { padding: 1rem 1.15rem; border-radius: var(--fha-r-sm); background: var(--fha-secondary-soft); margin-bottom: 1.25rem; }
.fha-instructions h3 { font-size: 1rem; margin-bottom: .4rem; }
.fha-instructions p:last-child { margin-bottom: 0; }
.fha-history h3 { font-size: 1.05rem; margin-bottom: .6rem; }
.fha-history__list { list-style: none; margin: 0 0 1.25rem; padding: 0; display: grid; gap: .5rem; }
.fha-history__item { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; padding: .7rem .9rem; border: 1px solid var(--fha-line); border-radius: var(--fha-r-sm); }
.fha-history__item.is-best { border-color: color-mix(in srgb, var(--fha-secondary) 60%, #fff); background: var(--fha-secondary-soft); }
.fha-history__num { font-weight: 800; }
.fha-history__date { color: var(--fha-muted); font-size: .88rem; }
.fha-history__score { font-weight: 700; font-variant-numeric: tabular-nums; }
.fha-history__item .fha-btn { margin-inline-start: auto; }
.fha-exam__cta { display: flex; flex-wrap: wrap; align-items: center; gap: .9rem; padding-top: .5rem; }
.fha-exam__cta .fha-notice { flex-basis: 100%; margin: 0; }

/* ---------- runner ---------- */
.fha-run { padding: clamp(1rem, 3vw, 1.75rem); }
.fha-run__top { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; margin-bottom: 1rem; }
.fha-run__top .fha-logo img { max-height: 34px; }
.fha-run__title { font-size: 1.05rem; flex: 1 1 180px; }
.fha-run__tools { display: flex; align-items: center; gap: .6rem; }
.fha-save { font-size: .8rem; color: var(--fha-muted); min-height: 1em; }
.fha-save.is-offline { color: var(--fha-warn); }
.fha-save.is-saved::before { content: "✓ "; color: var(--fha-pass); }
.fha-timer { display: inline-flex; align-items: center; gap: .35em; padding: .35em .8em; border-radius: 99px; background: var(--fha-primary-soft); color: var(--fha-primary); font-weight: 800; font-variant-numeric: tabular-nums; direction: ltr; }
.fha-timer.is-low { background: #FCE9E5; color: var(--fha-fail); }
.fha-run__meta { display: flex; justify-content: space-between; font-weight: 700; font-size: .9rem; color: var(--fha-muted); margin-bottom: .45rem; }
.fha-progress { height: 10px; border-radius: 99px; background: var(--fha-wash); overflow: hidden; margin-bottom: 1.25rem; }
.fha-progress__bar { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--fha-primary), color-mix(in srgb, var(--fha-primary) 70%, var(--fha-secondary))); transition: width .35s ease; }
[dir="rtl"] .fha-progress__bar { background: linear-gradient(270deg, var(--fha-primary), color-mix(in srgb, var(--fha-primary) 70%, var(--fha-secondary))); margin-inline-start: 0; }
.fha-run__card { outline: none; }
.fha-q__head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .6rem; }
.fha-q__num { font-size: .85rem; font-weight: 700; color: var(--fha-primary); }
.fha-q__text { font-size: clamp(1.08rem, 2.6vw, 1.3rem); font-weight: 700; margin-bottom: 1rem; }
.fha-q__text p:last-child { margin-bottom: 0; }
.fha-q__hint { font-size: .88rem; color: var(--fha-muted); margin-top: -.4rem; }
.fha-options { display: grid; gap: .6rem; }
.fha-option {
	display: flex; align-items: center; gap: .8rem; padding: .85rem 1rem; min-height: 56px;
	border: 1.5px solid var(--fha-line); border-radius: var(--fha-radius); cursor: pointer;
	background: var(--fha-surface); transition: border-color .15s, background-color .15s;
}
.fha-option:hover { border-color: color-mix(in srgb, var(--fha-primary) 50%, var(--fha-line)); }
.fha-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.fha-option__key {
	flex: none; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%;
	border: 1.5px solid var(--fha-line); font-weight: 800; font-size: .85rem; color: var(--fha-muted);
}
.fha-option input[type="checkbox"] + .fha-option__key { border-radius: var(--fha-r-sm); }
.fha-option.is-selected { border-color: var(--fha-primary); background: var(--fha-primary-soft); }
.fha-option.is-selected .fha-option__key { background: var(--fha-primary); border-color: var(--fha-primary); color: #fff; }
.fha-option__text { font-weight: 600; }
.fha-input {
	width: 100%; padding: .85rem 1rem; border: 1.5px solid var(--fha-line); border-radius: var(--fha-radius);
	font: inherit; font-size: 1.05rem; background: var(--fha-surface); color: var(--fha-ink);
}
.fha-input:focus { border-color: var(--fha-primary); }
.fha-run__nav { display: flex; justify-content: space-between; gap: .75rem; margin-top: 1.5rem; }
.fha-run__nav .fha-btn { min-width: 130px; }
.fha-map { margin-top: 1.25rem; border-top: 1px solid var(--fha-line); padding-top: .9rem; }
.fha-map summary { cursor: pointer; font-weight: 700; display: flex; gap: .6rem; align-items: center; list-style: none; }
.fha-map summary::-webkit-details-marker { display: none; }
.fha-map summary::after { content: "▾"; margin-inline-start: auto; color: var(--fha-muted); }
.fha-map[open] summary::after { content: "▴"; }
.fha-map__count { color: var(--fha-muted); font-weight: 600; font-size: .88rem; }
.fha-map__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: .4rem; margin-top: .8rem; }
.fha-map__item { height: 42px; border-radius: var(--fha-r-sm); border: 1.5px solid var(--fha-line); background: var(--fha-surface); font: inherit; font-weight: 700; cursor: pointer; color: var(--fha-ink); }
.fha-map__item.is-done { background: var(--fha-primary-soft); border-color: color-mix(in srgb, var(--fha-primary) 35%, #fff); color: var(--fha-primary); }
.fha-map__item.is-current { border-color: var(--fha-primary); box-shadow: inset 0 0 0 1.5px var(--fha-primary); }

/* ---------- dialog / toast ---------- */
.fha-overlay { position: fixed; inset: 0; z-index: 100000; display: grid; place-items: center; padding: 1rem; margin: 0; background: rgba(15, 30, 38, .55); }
.fha-dialog { width: min(440px, 100%); background: var(--fha-surface); border-radius: var(--fha-r-lg); padding: 1.5rem; box-shadow: 0 24px 60px rgba(10, 25, 35, .3); animation: fha-pop .18s ease-out; }
.fha-dialog h3 { font-size: 1.2rem; margin-bottom: .5rem; }
.fha-dialog__actions { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: flex-end; margin-top: 1.25rem; }
@keyframes fha-pop { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.fha-toast { position: fixed; inset-inline: 1rem; bottom: 1rem; z-index: 100001; margin: 0 auto; max-width: 420px; padding: .9rem 1.1rem; border-radius: var(--fha-radius); background: var(--fha-ink); color: #fff; font-weight: 600; text-align: center; }

/* ---------- result ---------- */
.fha-result { padding: clamp(1.25rem, 4vw, 2.5rem); text-align: center; display: grid; justify-items: center; gap: .6rem; }
.fha-result > .fha-logo img { max-height: 40px; }
.fha-result__title { font-size: 1.3rem; font-weight: 800; }
.fha-ring { --ring: var(--fha-primary); position: relative; width: 190px; height: 190px; margin: .5rem 0; }
.fha-ring svg { width: 100%; height: 100%; }
.fha-ring circle { fill: none; stroke-width: 10; }
.fha-ring__track { stroke: var(--fha-wash); }
.fha-ring__value { stroke: var(--ring); stroke-linecap: round; transition: stroke-dashoffset 1.1s cubic-bezier(.2, .8, .2, 1); }
.fha-ring__label { position: absolute; inset: 0; display: grid; place-content: center; line-height: 1; }
.fha-ring__score { font-size: 3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.fha-ring__max { font-size: 1rem; color: var(--fha-muted); margin-top: .35rem; font-weight: 700; }
.fha-result__pct { font-size: 1.5rem; font-weight: 800; color: var(--fha-ink); margin: 0; }
.fha-result__tags { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; align-items: center; }
.fha-result__tags .fha-badge { font-size: .95rem; padding: .35em 1em; }
.fha-result__tags .fha-status { font-size: .95rem; padding: .3em .9em; border-radius: 99px; background: color-mix(in srgb, currentColor 10%, #fff); }
.fha-result__facts { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin: .75rem 0 0; }
.fha-result__facts div { min-width: 110px; padding: .6rem .9rem; border-radius: var(--fha-r-sm); background: var(--fha-wash); }
.fha-result__facts dt { font-size: .78rem; color: var(--fha-muted); }
.fha-result__facts dd { margin: 0; font-weight: 800; font-size: 1.15rem; }
.fha-result__actions { display: flex; flex-wrap: wrap; gap: .7rem; justify-content: center; margin-top: 1rem; }
.fha-review-holder { margin-top: 1.5rem; }
@media (prefers-reduced-motion: reduce) {
	.fha-ring__value, .fha-progress__bar, .fha-dialog { transition: none; animation: none; }
}

/* ---------- review ---------- */
.fha-review__head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 1rem 1.25rem; margin-bottom: 1rem; }
.fha-review__head .fha-logo img { max-height: 36px; }
.fha-review__title { font-size: 1.35rem; font-weight: 800; }
.fha-review__head p { margin: .2rem 0 0; }
.fha-attempt-tabs { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .25rem; margin-bottom: 1rem; }
.fha-attempt-tab { flex: none; display: grid; text-align: center; padding: .45rem .9rem; border-radius: var(--fha-r-sm); border: 1.5px solid var(--fha-line); text-decoration: none; color: var(--fha-ink) !important; font-weight: 700; font-size: .88rem; background: var(--fha-surface); }
.fha-attempt-tab small { font-weight: 600; color: var(--fha-muted); }
.fha-attempt-tab.is-current { border-color: var(--fha-primary); background: var(--fha-primary-soft); color: var(--fha-primary) !important; }
.fha-scoreboard { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; padding: 1.1rem 1.25rem; border-radius: var(--fha-r-lg); background: var(--fha-primary); color: #fff; margin-bottom: 1.25rem; }
.fha-scoreboard__main { display: grid; line-height: 1.1; padding-inline-end: 1.25rem; border-inline-end: 1px solid rgba(255, 255, 255, .25); }
.fha-scoreboard__value { font-size: 2.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.fha-scoreboard__value small { font-size: 1rem; opacity: .75; }
.fha-scoreboard__pct { font-weight: 700; opacity: .9; }
.fha-scoreboard__facts { display: flex; flex-wrap: wrap; gap: .5rem 1.4rem; margin: 0; }
.fha-scoreboard__facts dt { font-size: .75rem; opacity: .75; }
.fha-scoreboard__facts dd { margin: 0; font-weight: 800; }
.fha-scoreboard .fha-badge { background: #fff; }
.fha-scoreboard .fha-status { background: #fff; padding: .15em .7em; border-radius: 99px; }
.fha-review__list { list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem; }
.fha-rq { --state: var(--fha-muted); background: var(--fha-surface); border: 1px solid var(--fha-line); border-inline-start: 5px solid var(--state); border-radius: var(--fha-radius); padding: 1rem 1.15rem; }
.fha-rq.is-correct { --state: var(--fha-pass); }
.fha-rq.is-wrong, .fha-rq.is-unanswered { --state: var(--fha-fail); }
.fha-rq.is-partial, .fha-rq.is-pending { --state: var(--fha-warn); }
.fha-rq__head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; margin-bottom: .5rem; }
.fha-rq__num { font-weight: 800; color: var(--fha-muted); font-size: .88rem; }
.fha-rq__state { display: inline-flex; align-items: center; gap: .3em; font-weight: 800; color: var(--state); font-size: .9rem; }
.fha-rq__pts { margin-inline-start: auto; font-weight: 800; font-variant-numeric: tabular-nums; }
.fha-rq__question { font-weight: 700; font-size: 1.05rem; }
.fha-rq__question p:last-child { margin-bottom: .6rem; }
.fha-rq__options { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.fha-rq__opt { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .7rem; padding: .55rem .8rem; border-radius: var(--fha-r-sm); border: 1.5px solid var(--fha-line); }
.fha-rq__mark { width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 2px solid var(--fha-line); flex: none; }
.fha-rq__opt.is-chosen .fha-rq__mark { background: var(--fha-muted); border-color: var(--fha-muted); }
.fha-rq__opt.is-right { border-color: color-mix(in srgb, var(--fha-pass) 55%, #fff); background: color-mix(in srgb, var(--fha-pass) 8%, #fff); }
.fha-rq__opt.is-right .fha-rq__mark { border-color: var(--fha-pass); }
.fha-rq__opt.is-right.is-chosen .fha-rq__mark { background: var(--fha-pass); }
.fha-rq__opt.is-wrong { border-color: color-mix(in srgb, var(--fha-fail) 55%, #fff); background: color-mix(in srgb, var(--fha-fail) 7%, #fff); }
.fha-rq__opt.is-wrong .fha-rq__mark { background: var(--fha-fail); border-color: var(--fha-fail); }
.fha-rq__text { flex: 1 1 auto; }
.fha-rq__tag { font-size: .75rem; font-weight: 800; padding: .1em .6em; border-radius: 99px; background: var(--fha-wash); color: var(--fha-muted); }
.fha-rq__tag--right { background: color-mix(in srgb, var(--fha-pass) 14%, #fff); color: var(--fha-pass); }
.fha-rq__none { color: var(--fha-fail); font-weight: 600; font-size: .9rem; margin: .5rem 0 0; }
.fha-rq__pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .6rem; }
.fha-rq__answer { padding: .7rem .9rem; border-radius: var(--fha-r-sm); background: var(--fha-wash); }
.fha-rq__answer p { margin: .2rem 0 0; font-weight: 600; }
.fha-rq__answer--right { background: color-mix(in srgb, var(--fha-pass) 9%, #fff); }
.fha-rq__label { display: block; font-size: .78rem; font-weight: 800; color: var(--fha-muted); }
.fha-rq__explain { margin-top: .7rem; padding: .7rem .9rem; border-radius: var(--fha-r-sm); background: var(--fha-secondary-soft); }
.fha-rq__explain p:last-child { margin-bottom: 0; }
.fha-review__foot { margin-top: 1.25rem; text-align: center; }

/* ---------- dashboard ---------- */
.fha-dash__hero { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.25rem; margin-bottom: 1.25rem; }
.fha-dash__hello { flex: 1 1 220px; }
.fha-dash__hello h2 { font-size: clamp(1.35rem, 3.4vw, 1.9rem); font-weight: 800; }
.fha-dash__hello p { margin: .2rem 0 0; }
.fha-rankpill { display: inline-grid; grid-template-columns: auto auto; align-items: center; gap: 0 .5rem; padding: .55rem 1rem; border-radius: var(--fha-radius); background: var(--fha-secondary-soft); color: #5a3d06; }
.fha-rankpill .fha-icon { grid-row: span 2; width: 1.8rem; height: 1.8rem; color: var(--fha-secondary); }
.fha-rankpill__n { font-size: 1.4rem; font-weight: 800; line-height: 1; }
.fha-rankpill__of { font-size: .78rem; }
.fha-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .65rem; margin-bottom: 1.25rem; }
.fha-stat { display: grid; align-content: start; gap: .25rem; padding: .9rem 1rem; border-radius: var(--fha-radius); background: var(--fha-surface); border: 1px solid var(--fha-line); }
.fha-stat__label { font-size: .8rem; color: var(--fha-muted); font-weight: 600; }
.fha-stat__value { font-size: 1.45rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; }
.fha-stat__value small { font-size: .8rem; color: var(--fha-muted); font-weight: 600; }
.fha-stat--lead { grid-column: span 2; background: var(--fha-primary); border-color: var(--fha-primary); color: #fff; }
.fha-stat--lead .fha-stat__label { color: rgba(255, 255, 255, .8); }
.fha-stat--lead .fha-stat__value { font-size: 2.1rem; }
.fha-stat--lead .fha-stat__value small { color: rgba(255, 255, 255, .7); }
.fha-stat--lead .fha-badge { justify-self: start; background: #fff; }
.fha-panel { padding: clamp(1rem, 2.5vw, 1.4rem); margin-bottom: 1.25rem; }
.fha-panel__title { font-size: 1.1rem; font-weight: 800; margin-bottom: .9rem !important; }
.fha-panel__cta { margin: 1rem 0 0; }
.fha-tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .65rem; }
.fha-tile { display: grid; gap: .35rem; align-content: start; padding: 1rem; border-radius: var(--fha-radius); border: 1px solid var(--fha-line); background: var(--fha-surface); }
.fha-tile .fha-btn { justify-self: start; margin-top: .35rem; }

/* ---------- tables (stack into cards on phones) ---------- */
.fha-table-wrap { width: 100%; overflow-x: auto; }
.fha-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .94rem; margin: 0; }
.fha-table th { text-align: start; font-size: .78rem; font-weight: 700; color: var(--fha-muted); padding: .6rem .75rem; border-bottom: 1px solid var(--fha-line); background: transparent; white-space: nowrap; }
.fha-table td { padding: .75rem; border-bottom: 1px solid var(--fha-line); vertical-align: middle; background: transparent; }
.fha-table tr:last-child td { border-bottom: 0; }
.fha-table tr.is-best td, .fha-table tr.is-me td { background: var(--fha-secondary-soft); }
.fha-table__title { display: block; }
.fha-table__actions { text-align: end; white-space: nowrap; }
.fha-meter { display: inline-block; width: 56px; height: 6px; border-radius: 99px; background: var(--fha-wash); vertical-align: middle; margin-inline-end: .5rem; overflow: hidden; }
.fha-meter span { display: block; height: 100%; width: calc(var(--v, 0) * 1%); background: var(--fha-primary); border-radius: inherit; }
.fha-rankno { display: inline-grid; place-items: center; min-width: 2rem; height: 2rem; padding: 0 .4rem; border-radius: 99px; font-weight: 800; background: var(--fha-wash); }
.fha-rank-1 .fha-rankno { background: #F6D77A; color: #5a4200; }
.fha-rank-2 .fha-rankno { background: #DCE3E8; color: #36444c; }
.fha-rank-3 .fha-rankno { background: #EBC3A0; color: #5b3214; }
.fha-person { display: inline-flex; align-items: center; gap: .55rem; font-weight: 700; }
.fha-avatar { display: inline-grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--fha-primary-soft); color: var(--fha-primary); font-weight: 800; font-size: .85rem; flex: none; }
.fha-avatar--lg { width: 3.4rem; height: 3.4rem; font-size: 1.15rem; background: #fff; }

@media (max-width: 640px) {
	.fha-table--stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
	.fha-table--stack, .fha-table--stack tbody, .fha-table--stack tr, .fha-table--stack td { display: block; width: 100%; }
	.fha-table--stack tr { border: 1px solid var(--fha-line); border-radius: var(--fha-radius); margin-bottom: .6rem; padding: .35rem .2rem; background: var(--fha-surface); }
	.fha-table--stack tr.is-me, .fha-table--stack tr.is-best { background: var(--fha-secondary-soft); }
	.fha-table--stack td { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border: 0; padding: .4rem .75rem; text-align: end; background: transparent !important; }
	.fha-table--stack td[data-label]::before { content: attr(data-label); font-size: .78rem; font-weight: 700; color: var(--fha-muted); text-align: start; }
	.fha-table--stack .fha-table__actions { justify-content: flex-end; }
	.fha-stat--lead { grid-column: 1 / -1; }
	.fha-run__nav .fha-btn { flex: 1; min-width: 0; }
	.fha-history__item .fha-btn { margin-inline-start: 0; }
	.fha-scoreboard__main { border: 0; padding: 0; }
}

/* ---------- leaderboard ---------- */
.fha-board { padding: clamp(1rem, 2.5vw, 1.4rem); }
.fha-board__head { display: flex; align-items: center; gap: .6rem; margin-bottom: .9rem; }
.fha-board__head .fha-icon { width: 1.6rem; height: 1.6rem; color: var(--fha-secondary); }
.fha-board__head h3 { font-size: 1.2rem; font-weight: 800; }

/* ---------- public dashboard ---------- */
.fha-public__hero {
	position: relative; overflow: hidden; text-align: center; color: #fff;
	padding: clamp(1.5rem, 5vw, 3rem) 1rem clamp(8rem, 12vw, 8.5rem);
	border-radius: var(--fha-r-lg);
	background-color: var(--fha-primary);
	/* Zellige-inspired eight-point star tile. */
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.13' stroke-width='1.2'%3E%3Cpath d='M32 6l7.6 18.4L58 32l-18.4 7.6L32 58l-7.6-18.4L6 32l18.4-7.6z'/%3E%3Cpath d='M13.6 13.6h36.8v36.8H13.6z'/%3E%3Ccircle cx='32' cy='32' r='6'/%3E%3C/g%3E%3C/svg%3E"),
		radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--fha-primary) 70%, #fff) 0%, var(--fha-primary) 60%);
}
.fha-public__brand { display: inline-block; background: #fff; padding: .55rem 1rem; border-radius: var(--fha-radius); margin-bottom: 1rem; }
.fha-public__brand .fha-logo img { max-height: 42px; }
.fha-public__title { color: #fff !important; font-size: clamp(1.8rem, 5.5vw, 2.8rem); font-weight: 800; letter-spacing: -.01em; }
.fha-public__sub { opacity: .85; margin: .3rem 0 1.2rem; font-weight: 600; }
.fha-public__facts { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin: 0; }
.fha-public__facts div { min-width: 120px; padding: .55rem .9rem; border-radius: var(--fha-r-sm); background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .2); }
.fha-public__facts dt { font-size: .75rem; opacity: .8; }
.fha-public__facts dd { margin: 0; font-size: 1.3rem; font-weight: 800; }
.fha-filter { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .6rem; margin: 1rem 0; }
.fha-filter label { font-weight: 700; }
.fha-filter select { min-height: 42px; padding: .4rem .8rem; border-radius: var(--fha-r-sm); border: 1.5px solid var(--fha-line); font: inherit; background: var(--fha-surface); max-width: 100%; }
.fha-podium { list-style: none; padding: 0; margin: -4rem auto 1.5rem; position: relative; display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: .7rem; max-width: 760px; }
.fha-podium__step { display: grid; justify-items: center; gap: .25rem; text-align: center; padding: 1rem .6rem 1.1rem; border-radius: var(--fha-r-lg); background: var(--fha-surface); border: 1px solid var(--fha-line); box-shadow: 0 14px 34px rgba(12, 40, 55, .12); }
.fha-podium__step--1 { order: 2; padding-top: 1.5rem; padding-bottom: 1.6rem; border: 2px solid var(--fha-secondary); }
.fha-podium__step--2 { order: 1; }
.fha-podium__step--3 { order: 3; }
.fha-podium__step.is-me { background: var(--fha-secondary-soft); }
.fha-podium__medal { font-size: 1.9rem; line-height: 1; }
.fha-podium__step--1 .fha-podium__medal { font-size: 2.5rem; }
.fha-podium__step .fha-avatar { background: var(--fha-primary-soft); }
.fha-podium__name { font-weight: 800; font-size: 1rem; overflow-wrap: anywhere; }
.fha-podium__pct { font-size: 1.55rem; font-weight: 800; color: var(--fha-primary); font-variant-numeric: tabular-nums; line-height: 1.1; }
.fha-podium__step--1 .fha-podium__pct { font-size: 2rem; }
.fha-podium__main { font-size: .82rem; color: var(--fha-muted); font-weight: 600; }
@media (max-width: 560px) {
	.fha-podium { grid-template-columns: 1fr; margin-top: -3.5rem; }
	.fha-podium__step--1, .fha-podium__step--2, .fha-podium__step--3 { order: initial; }
	.fha-podium__step { grid-template-columns: auto auto 1fr auto; justify-items: start; align-items: center; text-align: start; padding: .8rem 1rem; }
	.fha-podium__name { grid-column: 3; }
	.fha-podium__pct, .fha-podium__step--1 .fha-podium__pct { font-size: 1.3rem; grid-row: 1; grid-column: 4; }
	.fha-podium__main, .fha-podium__step .fha-badge { grid-column: 3 / -1; }
	.fha-podium__step--1 .fha-podium__medal, .fha-podium__medal { font-size: 1.7rem; }
	.fha-podium .fha-avatar--lg { width: 2.6rem; height: 2.6rem; }
}

/* Scores read left-to-right ("17 / 20") inside Arabic text. */
.fha-stat__value, .fha-scoreboard__value, .fha-ring__label, .fha-history__score, .fha-rq__pts {
	direction: ltr; unicode-bidi: isolate;
}
.fha-stat__value, .fha-scoreboard__value { justify-self: start; }

/* Latin names inside Arabic pages ("Ahmed M.") keep their punctuation in place. */
.fha-app bdi { unicode-bidi: isolate; }
.fha-filter { position: relative; z-index: 1; margin-bottom: 1.25rem; }
.fha-public__hero + .fha-filter { margin-top: -5.25rem; margin-bottom: 4.75rem; }
.fha-public__hero + .fha-filter label { color: #fff; }
