/* البيت: شاشة ليل، وعقل من نقاط ضوء يتكوّن قدّام العين ويصير هو السؤال. لازورد الليل وذهب أور، وتحته المدرّس ويوم الامتحان */
:root {
  --night: #050A1C; --night-2: #0B1640; --star: #C9D7FF; --star-dim: #8C9CC8;
  --bg: #EDF0F5; --ink: #17306E; --ink-2: #2A3550; --muted: #556070;
  --gold: #F2C14E; --gold-deep: #D6A021; --gold-ink: #14213F; --gold-soft: #FFE6A6;
  --card: #FFFFFF; --night-text: #D9E1F2;
  --wrong: #FF9C7A;
  --kufi: 'Noto Kufi Arabic', 'Segoe UI', Tahoma, sans-serif;
  --naskh: 'Noto Naskh Arabic', 'Traditional Arabic', 'Times New Roman', serif;
  color-scheme: light;
}
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--kufi); }
a:focus-visible, button:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

/* ── العقل ── */
.mind {
  position: relative; min-height: 100svh; min-height: max(100svh, 600px); overflow: hidden;
  background: radial-gradient(ellipse 90% 60% at 50% 34%, var(--night-2), var(--night) 70%);
  color: #FFFFFF; display: flex; flex-direction: column; touch-action: pan-y;
  padding: 0 max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
}
#sky { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.halo { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse 70% 42% at 50% 36%, rgba(70, 110, 230, .16), transparent 70%); }

.top { position: relative; display: flex; align-items: baseline; gap: 10px; padding-top: max(18px, env(safe-area-inset-top, 0px)); max-width: 560px; width: 100%; margin: 0 auto; }
.word { font-family: var(--naskh); font-weight: 700; font-size: 26px; line-height: 1; color: var(--gold); }
.for { font-size: 12.5px; color: var(--star-dim); margin-inline-start: auto; }

.deck { position: relative; margin: auto auto 0; width: 100%; max-width: 560px; padding-bottom: max(26px, env(safe-area-inset-bottom, 0px)); pointer-events: none; }
.deck > * { pointer-events: auto; }
.intro, .puzzle { display: flex; flex-direction: column; gap: 12px; }
.mind h1 { margin: 0; font-family: var(--naskh); font-weight: 700; font-size: clamp(34px, 9.6vw, 52px); line-height: 1.35; text-shadow: 0 2px 24px rgba(5, 10, 28, .9); }
.mind h2 { margin: 0; font-size: 21px; font-weight: 800; text-shadow: 0 2px 18px rgba(5, 10, 28, .9); outline: none; }
.sub { margin: 0; font-size: 15.5px; line-height: 1.85; color: var(--night-text); text-shadow: 0 1px 12px rgba(5, 10, 28, .95); }
.proof { margin: 2px 0 0; font-size: 12.5px; line-height: 1.7; color: var(--star-dim); }
.cta {
  height: 58px; border: 0; border-radius: 18px; cursor: pointer; margin-top: 4px;
  background: linear-gradient(180deg, #FFD571, var(--gold-deep)); color: var(--gold-ink);
  font-family: var(--kufi); font-size: 18px; font-weight: 800; text-decoration: none;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 1px rgba(255, 220, 140, .4), 0 10px 34px rgba(242, 193, 78, .35);
}
.cta:active { transform: translateY(1px); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.tokens { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tokens button {
  height: 60px; border-radius: 16px; cursor: pointer; color: #FFFFFF;
  border: 1px solid rgba(201, 215, 255, .28); background: rgba(20, 34, 84, .62);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  font-family: var(--naskh); font-weight: 700; font-size: 28px; line-height: 1;
  transition: background .2s ease, border-color .2s ease, transform .12s ease;
}
.tokens button:active { transform: scale(.96); }
.tokens button.is-wrong { color: var(--wrong); border-color: rgba(255, 156, 122, .5); background: rgba(70, 24, 20, .55); animation: shake .32s ease; }
.tokens button.is-right { color: var(--gold-ink); border-color: var(--gold); background: var(--gold); box-shadow: 0 0 30px rgba(242, 193, 78, .6); }
.tokens button:disabled { cursor: default; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.say { border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; background: rgba(11, 22, 64, .78); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-inline-start: 3px solid var(--wrong); }
.say.ok { border-inline-start-color: var(--gold); }
.who { font-size: 12.5px; font-weight: 800; color: var(--wrong); }
.say.ok .who { color: var(--gold); }
.say p { margin: 0; font-size: 15px; line-height: 1.85; color: var(--night-text); }

/* ── تحت العقل: المدرّس ويوم الامتحان ── */
.page { max-width: 440px; margin: 0 auto; padding: 22px max(16px, env(safe-area-inset-right, 0px)) 28px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 18px; }
.page a { color: var(--ink); }
.teach { background: var(--ink); border-radius: 28px; padding: 22px 20px 20px; display: flex; flex-direction: column; gap: 14px; color: #FFFFFF; }
.teach .badge { align-self: flex-start; background: rgba(255, 255, 255, .12); color: var(--gold-soft); border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 800; }
.teach h2 { margin: 0; font-size: 26px; font-weight: 800; }
.teach p { margin: 0; font-size: 15px; line-height: 1.85; color: var(--night-text); }
.rail { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.rail li { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--night-text); }
.rail i { display: block; height: 6px; border-radius: 3px; background: var(--gold-deep); }
.teach a { height: 58px; border-radius: 18px; background: var(--gold-deep); color: var(--gold-ink); font-size: 18px; font-weight: 800; display: flex; align-items: center; justify-content: center; text-decoration: none; }

.exam { background: var(--card); border-radius: 24px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.exam .row { display: flex; align-items: center; gap: 14px; }
.clock { position: relative; width: 76px; height: 76px; flex: none; }
.clock i { position: absolute; left: 50%; top: 50%; width: 4px; height: 11px; margin: -5.5px 0 0 -2px; border-radius: 2px; background: var(--gold-deep); }
.clock span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 800; }
.exam h2 { margin: 0; font-size: 19px; font-weight: 800; }
.exam p { margin: 0; font-size: 14px; line-height: 1.7; color: var(--ink-2); }
.exam a { height: 52px; border-radius: 16px; border: 1.5px solid var(--ink); font-size: 16px; font-weight: 800; display: flex; align-items: center; justify-content: center; text-decoration: none; }

.foot { display: flex; justify-content: center; padding-top: 4px; }
.stamp { font-size: 11px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) { .tokens button { transition: none; animation: none !important; } }
