/* اختبارات أكاديمية النجوم — واجهة الطالب
   الألوان مأخوذة من الشعار: نجمة ذهبية وكتاب فيروزي */
.anq-app {
	--teal: #137a70;
	--teal-2: #2ec4b6;
	--teal-mist: #eaf7f5;
	--gold: #f5b301;
	--gold-ink: #3d2c00;
	--gold-mist: #fff6d9;
	--ink: #1d2b2a;
	--muted: #5f6f6d;
	--line: #dbe6e4;
	--ok: #13803d;
	--ok-mist: #e8f6ec;
	--bad: #c62828;
	--bad-mist: #fdeeee;
	--r: 14px;
	font-family: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, system-ui, sans-serif;
	font-size: 17px;
	line-height: 1.75;
	color: var(--ink);
	direction: rtl;
	text-align: right;
	max-width: 760px;
	margin: 0 auto;
	-webkit-text-size-adjust: 100%;
}
.anq-app *, .anq-app *::before, .anq-app *::after { box-sizing: border-box; }
.anq-app [hidden] { display: none !important; }
.anq-app img { max-width: 100%; height: auto; }
.anq-app p { margin: 0; }
.anq-app button, .anq-app input {
	font: inherit; letter-spacing: normal; text-transform: none; line-height: 1.4;
	box-shadow: none; text-shadow: none; min-height: 0; margin: 0;
}
.anq-app button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.anq-app button:focus-visible, .anq-app input:focus-visible { outline: 3px solid var(--teal-2); outline-offset: 2px; }

/* ---------- الأزرار ---------- */
.anq-app .anq-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	padding: 13px 22px; border-radius: 12px; border: 2px solid transparent;
	font-weight: 600; font-size: 17px; transition: background-color .15s, border-color .15s, transform .1s;
}
.anq-app .anq-btn:active { transform: translateY(1px); }
.anq-app .anq-btn:disabled { opacity: .45; cursor: not-allowed; }
.anq-app .anq-btn-primary { background: var(--teal); color: #fff; }
.anq-app .anq-btn-primary:hover:not(:disabled) { background: #0f665e; color: #fff; }
.anq-app .anq-btn-gold { background: var(--gold); color: var(--gold-ink); }
.anq-app .anq-btn-gold:hover:not(:disabled) { background: #e6a800; color: var(--gold-ink); }
.anq-app .anq-btn-ghost { background: #fff; color: var(--teal); border-color: var(--line); }
.anq-app .anq-btn-ghost:hover:not(:disabled) { border-color: var(--teal); background: #fff; color: var(--teal); }
.anq-app .anq-btn-block { width: 100%; }

/* ---------- صفحة البدء ---------- */
.anq-start { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 28px 24px 24px; }
.anq-start-head { text-align: center; padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.anq-logo { width: 132px; display: inline-block; }
.anq-app .anq-title { font-size: 25px; font-weight: 700; line-height: 1.45; margin: 10px 0 14px; color: var(--ink); text-align: center; font-family: inherit; }
.anq-facts { list-style: none; margin: 0; padding: 0; display: flex; justify-content: center; }
.anq-facts li { display: flex; align-items: baseline; gap: 6px; padding: 0 18px; margin: 0; }
.anq-facts li + li { border-right: 1px solid var(--line); }
.anq-facts b { font-size: 24px; font-weight: 700; color: var(--teal); }
.anq-facts span { color: var(--muted); font-size: 15px; }
.anq-intro { background: var(--gold-mist); border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; font-size: 16px; }
.anq-notice { text-align: center; padding: 18px; background: var(--teal-mist); border-radius: 12px; color: var(--teal); font-weight: 600; }

.anq-start-form { display: grid; gap: 14px; }
.anq-field { display: grid; gap: 6px; margin: 0; }
.anq-field span { font-weight: 600; font-size: 15px; }
.anq-app .anq-field input {
	width: 100%; padding: 12px 14px; border: 2px solid var(--line); border-radius: 12px;
	background: #fff; color: var(--ink); font-size: 17px; height: auto;
}
.anq-app .anq-field input[dir="ltr"] { text-align: left; }
.anq-app .anq-field input::placeholder { color: #a3b1af; }
.anq-app .anq-field input:focus { border-color: var(--teal-2); outline: none; }
.anq-app .anq-field input.is-invalid { border-color: var(--bad); background: var(--bad-mist); }
.anq-error { color: var(--bad); background: var(--bad-mist); border-radius: 10px; padding: 10px 14px; font-weight: 600; font-size: 15px; }
.anq-hint { color: var(--muted); font-size: 14px; text-align: center; }

/* ---------- شاشة الاختبار ---------- */
.anq-quiz { display: grid; gap: 14px; }
.anq-bar {
	position: sticky; top: 0; z-index: 20;
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 10px 14px 14px;
}
.admin-bar .anq-bar { top: 32px; }
.anq-bar-id { display: flex; align-items: center; gap: 10px; min-width: 0; }
.anq-bar-logo { width: 46px; flex: none; }
.anq-bar-title { font-weight: 700; font-size: 15px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.anq-bar-name { color: var(--muted); font-size: 13px; }
.anq-timer {
	flex: none; display: flex; flex-direction: column; align-items: center;
	background: var(--teal-mist); color: var(--teal); border-radius: 12px; padding: 6px 14px; min-width: 96px;
	transition: background-color .3s, color .3s;
}
.anq-timer-val { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; direction: ltr; line-height: 1.2; }
.anq-timer-lbl { font-size: 12px; }
.anq-timer.is-warn { background: var(--gold-mist); color: #8a6100; }
.anq-timer.is-danger { background: var(--bad); color: #fff; animation: anq-pulse 1s ease-in-out infinite; }
@keyframes anq-pulse { 50% { opacity: .78; } }
.anq-track { position: absolute; right: 14px; left: 14px; bottom: 6px; height: 4px; background: var(--teal-mist); border-radius: 4px; overflow: hidden; }
.anq-track i { display: block; height: 100%; width: 0; background: var(--teal-2); border-radius: 4px; transition: width .3s; }

.anq-qcard, .anq-review { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 20px; }
.anq-qcard { border-top: 4px solid var(--teal-2); }
.anq-qhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.anq-qnum { font-weight: 700; color: var(--teal); }
.anq-qhint { font-size: 14px; color: var(--muted); }
.anq-qtext { font-size: 19px; font-weight: 500; line-height: 1.8; margin-bottom: 14px; overflow-x: auto; }
.anq-qimg { margin: 0 0 16px; text-align: center; }
.anq-qimg img { border-radius: 10px; border: 1px solid var(--line); cursor: zoom-in; max-height: 420px; width: auto; }
.anq-qimg figcaption { font-size: 13px; color: var(--muted); margin-top: 4px; }

.anq-opts { display: grid; gap: 10px; }
.anq-qbody { text-align: start; }
.anq-qbody[dir="ltr"] { font-family: 'IBM Plex Sans Arabic', 'Segoe UI', Roboto, Arial, sans-serif; }
.anq-app .anq-opt {
	display: flex; align-items: center; gap: 12px; width: 100%; text-align: start;
	padding: 12px 14px; background: #fff; color: var(--ink);
	border: 2px solid var(--line); border-radius: 14px; font-weight: 400; font-size: 17px;
	transition: border-color .12s, background-color .12s;
}
.anq-app .anq-opt:hover { border-color: var(--teal-2); background: #fff; color: var(--ink); }
.anq-opt-key {
	flex: none; width: 34px; height: 34px; border-radius: 50%;
	display: inline-flex; align-items: center; justify-content: center;
	border: 2px solid var(--line); font-weight: 700; color: var(--muted); background: #fff;
}
.anq-opts-multi .anq-opt-key { border-radius: 8px; }
.anq-opt-body { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.anq-opt-body img { border-radius: 8px; max-height: 220px; width: auto; align-self: center; }
.anq-opt-text { overflow-x: auto; }
.anq-app .anq-opt.is-on { border-color: var(--teal); background: var(--teal-mist); }
.anq-opt.is-on .anq-opt-key { background: var(--teal); border-color: var(--teal); color: #fff; }
.anq-opts-img { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.anq-opts-img .anq-opt { flex-direction: column; align-items: stretch; }
.anq-opts-img .anq-opt-key { align-self: flex-start; }
.anq-opts-tf { grid-template-columns: 1fr 1fr; }
.anq-opts-tf .anq-opt { justify-content: center; font-size: 19px; font-weight: 600; padding: 16px; }
.anq-numeric { display: flex; align-items: center; gap: 10px; }
.anq-app .anq-num-input { flex: 1; max-width: 280px; padding: 14px 16px; font-size: 22px; border: 2px solid var(--line); border-radius: 14px; text-align: left; font-variant-numeric: tabular-nums; }
.anq-app .anq-num-input:focus { border-color: var(--teal-2); outline: none; }
.anq-unit { font-weight: 600; color: var(--muted); }
.anq-app .anq-clear { background: none; border: 0; color: var(--muted); text-decoration: underline; font-size: 14px; padding: 10px 0 0; }

.anq-nav { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.anq-map { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.anq-map-head { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.anq-map-head span:first-child { font-weight: 700; color: var(--ink); }
.anq-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; }
.anq-app .anq-grid button {
	height: 40px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; color: var(--muted);
	font-weight: 600; font-size: 15px; padding: 0; font-variant-numeric: tabular-nums;
}
.anq-app .anq-grid button.is-done { background: var(--teal-mist); border-color: var(--teal-2); color: var(--teal); }
.anq-app .anq-grid button.is-cur { border-color: var(--gold); box-shadow: inset 0 0 0 2px var(--gold); color: var(--ink); }

/* ---------- نافذة التأكيد ---------- */
.anq-modal { position: fixed; inset: 0; z-index: 99999; background: rgba(13, 30, 28, .55); display: flex; align-items: center; justify-content: center; padding: 18px; }
.anq-modal-box { background: #fff; border-radius: 18px; padding: 22px; max-width: 420px; width: 100%; text-align: center; }
.anq-app .anq-modal-box h3 { margin: 0 0 8px; font-size: 21px; color: var(--ink); font-family: inherit; }
.anq-modal-box p { color: var(--muted); margin-bottom: 18px; }
.anq-modal-btns { display: grid; gap: 8px; }

.anq-wait { text-align: center; padding: 48px 20px; background: #fff; border: 1px solid var(--line); border-radius: 18px; }
.anq-wait p { margin: 14px 0; color: var(--muted); }
.anq-spin { display: inline-block; width: 44px; height: 44px; border: 4px solid var(--teal-mist); border-top-color: var(--teal); border-radius: 50%; animation: anq-rot .8s linear infinite; }
@keyframes anq-rot { to { transform: rotate(360deg); } }

/* ---------- النتيجة: النجمة ---------- */
.anq-result { display: grid; gap: 14px; }
.anq-result-head { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 28px 20px 22px; text-align: center; }
.anq-star { --p: 0; position: relative; width: 210px; height: 210px; margin: 0 auto 4px; }
.anq-star-shape {
	position: absolute; inset: 0;
	clip-path: polygon(50% 0%, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0% 50%, 39% 39%);
	background: linear-gradient(to top, var(--gold) calc(var(--p) * 1%), #f1ecdc calc(var(--p) * 1%));
	animation: anq-star-in .7s cubic-bezier(.2, 1.4, .4, 1) both;
}
@keyframes anq-star-in { from { transform: scale(.4) rotate(-45deg); opacity: 0; } }
.anq-star-val { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.anq-star-val b { font-size: 30px; font-weight: 700; color: var(--gold-ink); direction: ltr; background: rgba(255, 255, 255, .82); border-radius: 10px; padding: 0 8px; line-height: 1.3; }
.anq-score { font-size: 18px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.anq-verdict { font-size: 21px; font-weight: 700; margin-top: 6px !important; }
.anq-verdict.is-pass { color: var(--ok); }
.anq-verdict.is-fail { color: var(--bad); }
.anq-result-quiz { color: var(--muted); font-size: 15px; }
.anq-note { margin-top: 8px !important; display: inline-block; background: var(--gold-mist); color: #8a6100; padding: 4px 12px; border-radius: 8px; font-size: 14px; }
.anq-tally { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 18px 0 0; }
.anq-tally div { border-radius: 12px; padding: 8px 4px; }
.anq-tally dt { font-size: 13px; }
.anq-tally dd { margin: 0; font-size: 24px; font-weight: 700; }
.anq-tally .t-ok { background: var(--ok-mist); color: var(--ok); }
.anq-tally .t-bad { background: var(--bad-mist); color: var(--bad); }
.anq-tally .t-skip { background: #f1f3f3; color: var(--muted); }
.anq-perfect { text-align: center; background: var(--ok-mist); color: var(--ok); padding: 14px; border-radius: 14px; font-weight: 600; }
.anq-app .anq-review-title { font-size: 20px; margin: 8px 0 0; color: var(--ink); font-family: inherit; }

.anq-review { border-right: 5px solid var(--line); }
.anq-review.is-bad { border-right-color: var(--bad); }
.anq-review.is-ok { border-right-color: var(--ok); }
.anq-qbody sup, .anq-qbody sub { font-size: .72em; line-height: 0; }
.anq-tag { font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 20px; background: #f1f3f3; color: var(--muted); }
.is-bad .anq-tag { background: var(--bad-mist); color: var(--bad); }
.is-ok .anq-tag { background: var(--ok-mist); color: var(--ok); }
.anq-review .anq-qtext { font-size: 17px; }
.anq-review .anq-qimg img { cursor: zoom-in; max-height: 300px; }
.anq-ropts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.anq-ropts.anq-opts-img { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.anq-ropts li { margin: 0; display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; color: var(--muted); }
.anq-ropts li img { border-radius: 8px; max-height: 160px; width: auto; align-self: center; cursor: zoom-in; }
.anq-ropts li em { font-style: normal; font-size: 13px; font-weight: 700; }
.anq-ropts li.r-ok { border-color: var(--ok); background: var(--ok-mist); color: var(--ink); }
.anq-ropts li.r-ok em { color: var(--ok); }
.anq-ropts li.r-bad { border-color: var(--bad); background: var(--bad-mist); color: var(--ink); }
.anq-ropts li.r-bad em { color: var(--bad); }
.anq-rnum { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.anq-rnum div { border-radius: 12px; padding: 10px 12px; display: grid; }
.anq-rnum span { font-size: 13px; }
.anq-rnum b { font-size: 20px; text-align: start; }
.anq-rnum .r-ok { background: var(--ok-mist); color: var(--ok); }
.anq-rnum .r-bad { background: var(--bad-mist); color: var(--bad); }
.anq-review .anq-expl { margin-top: 12px; background: var(--gold-mist); border-radius: 12px; padding: 10px 14px; font-size: 16px; }
.anq-review .anq-expl b { display: block; color: #8a6100; font-size: 14px; text-align: start; }

/* ---------- تكبير الصور ---------- */
.anq-zoom { position: fixed; inset: 0; z-index: 100000; background: rgba(10, 20, 19, .9); display: flex; align-items: center; justify-content: center; padding: 16px; cursor: zoom-out; }
.anq-zoom img { max-width: 100%; max-height: 100%; background: #fff; border-radius: 8px; }
.anq-zoom-x { position: absolute; top: 14px; left: 14px; width: 42px; height: 42px; border-radius: 50%; border: 0; background: #fff; color: #000; font-size: 18px; cursor: pointer; }

/* ---------- الجوال ---------- */
@media (max-width: 600px) {
	.anq-app { font-size: 16px; }
	.anq-start { padding: 22px 16px 18px; border-radius: 16px; }
	.anq-app .anq-title { font-size: 21px; }
	.anq-facts li { padding: 0 12px; }
	.anq-bar { padding: 8px 10px 12px; }
	.anq-bar-logo { width: 38px; }
	.anq-timer { min-width: 84px; padding: 4px 10px; }
	.anq-timer-val { font-size: 21px; }
	.anq-qcard, .anq-review { padding: 16px 14px; }
	.anq-qtext { font-size: 17px; }
	.anq-app .anq-opt { padding: 11px 12px; font-size: 16px; }
	.anq-opts-img, .anq-ropts.anq-opts-img { gap: 8px; }
	.anq-star { width: 180px; height: 180px; }
	.anq-star-val b { font-size: 26px; }
}
@media (max-width: 782px) { .admin-bar .anq-bar { top: 46px; } }
@media (prefers-reduced-motion: reduce) {
	.anq-star-shape, .anq-timer.is-danger, .anq-spin { animation: none; }
	.anq-app .anq-btn, .anq-track i { transition: none; }
}
