/* مُستخرَج من student-session.html (كتلة <style> رقم 1، الجزء 1 من 2) — منقولٌ حرفيّاً، وموضعُ وسمَي الجزأين في الصفحة هو موضعُ الكتلة نفسُه (ترتيبُ التتالي كما كان). */
    /* ‏[hidden] يغلب دائماً (تدقيق تجربة الطفل ٢٠٢٦-١٠-٠٥): قواعدُ مثل `.cert-wrap{display:flex}` و
       `.ayah-progress{display:flex}` و`.btn{display:inline-flex}` كانت تُلغي سمةَ hidden فتظهر
       شهادةٌ فارغة، وصندوقُ تقدّمٍ فارغ، وأزرارٌ خاملة («إعادة المحاولة») على كلّ شاشة نهاية.
       قاعدةٌ واحدةٌ شاملةٌ بدل ترقيعِ كلّ عنصر: ما يُخفى بـhidden مخفيٌّ فعلاً. */
    [hidden] { display: none !important; }
    /* خط مجمع الملك فهد للرسم العثماني (رواية حفص) — للعرض فقط.
       لا يمسّ منطق المطابقة/التصحيح/التقييم إطلاقاً.
       المصدر موثّق في frontend/fonts/kfgqpc/README.md */
    @font-face {
      font-family: "KFGQPC Hafs";
      src: url("/fonts/kfgqpc/hafs.18.woff2") format("woff2"),
           url("/fonts/kfgqpc/hafs.18.ttf") format("truetype");
      font-display: swap;
    }
    :root {
      --bg-1: #f0fdfa;
      --bg-2: #ebfaf3;
      --ink: #052116;
      --muted: #4f6d61;
      --line: #cfeadc;
      --quran-paper: #fffdf3;
      --quran-ink: #073625;
      --quran-border: #7fb596;
      --quran-gold: #b79243;
      --brand: #0f997f;
      --brand-2: #17b891;
      --warn: #9a5a08;
      --err: #a43737;
      --ok: #157347;
      --current: #fff0c7;
      --spoken: #0f997f;
      --spoken-soft: #cef0e7;
      --student-current: #dce8ff;
    }

    * { box-sizing: border-box; }

    body {
      margin: 0;
      min-height: 100vh;
      font-family: "Noto Naskh Arabic", "Tajawal", "Cairo", sans-serif;
      background:
        radial-gradient(circle at 12% 16%, rgba(255,255,255,.62), transparent 36%),
        radial-gradient(circle at 88% 10%, rgba(255,255,255,.42), transparent 28%),
        linear-gradient(160deg, var(--bg-1), var(--bg-2));
      color: var(--ink);
      padding: 18px;
      display: grid;
      place-items: center;
      overflow-x: hidden;
    }

    .shell {
      width: min(940px, 100%);
      min-height: min(860px, calc(100vh - 36px));
      position: relative;
    }

    .glass-card {
      background: rgba(255, 255, 255, 0.82);
      backdrop-filter: blur(10px);
      border: 1px solid rgba(255, 255, 255, 0.36);
      box-shadow: 0 10px 36px rgba(15, 153, 127, 0.12);
      border-radius: 28px;
    }

    .view {
      display: none;
      min-height: min(820px, calc(100vh - 40px));
      padding: 20px;
    }

    .view.active {
      display: grid;
      align-content: center;
      gap: 16px;
    }

    .tag {
      justify-self: center;
      background: #dff7ed;
      color: #0a6a56;
      border: 1px solid #bce9d9;
      border-radius: 999px;
      padding: 7px 14px;
      font-weight: 800;
      font-size: .9rem;
    }

    .headline {
      margin: 0;
      text-align: center;
      font-size: clamp(1.9rem, 4.2vw, 2.8rem);
      font-weight: 900;
      color: #0b4b3d;
    }

    .subhead {
      margin: 0;
      text-align: center;
      color: var(--muted);
      font-size: 1.1rem;
      font-weight: 700;
    }

    .quran-frame {
      border: 1px solid rgba(127, 181, 150, .82);
      outline: 7px double rgba(183, 146, 67, .34);
      outline-offset: -12px;
      background:
        radial-gradient(circle at 9% 14%, rgba(127, 181, 150, .14) 0 34px, transparent 35px),
        radial-gradient(circle at 91% 14%, rgba(127, 181, 150, .14) 0 34px, transparent 35px),
        radial-gradient(circle at 9% 86%, rgba(127, 181, 150, .14) 0 34px, transparent 35px),
        radial-gradient(circle at 91% 86%, rgba(127, 181, 150, .14) 0 34px, transparent 35px),
        linear-gradient(135deg, rgba(232, 246, 237, .88), rgba(255, 253, 243, .98) 24%, rgba(255, 253, 243, .98) 76%, rgba(232, 246, 237, .88));
      position: relative;
      border-radius: 30px;
      padding: 34px 26px;
      box-shadow:
        0 16px 34px rgba(15, 91, 72, .10),
        inset 0 0 0 1px rgba(255,255,255,.8),
        inset 0 0 0 14px rgba(231, 247, 238, .58);
      overflow: hidden;
    }

    .quran-frame::before {
      content: '';
      position: absolute;
      inset: 14px;
      border: 1px solid rgba(15, 153, 127, .32);
      border-radius: 20px;
      pointer-events: none;
    }

    .quran-frame::after {
      content: '';
      position: absolute;
      inset: 24px;
      border-radius: 14px;
      pointer-events: none;
      background:
        linear-gradient(90deg, rgba(183, 146, 67, .26), transparent 18%, transparent 82%, rgba(183, 146, 67, .26)),
        linear-gradient(0deg, rgba(183, 146, 67, .18), transparent 16%, transparent 84%, rgba(183, 146, 67, .18));
      opacity: .45;
      mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
      -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
      padding: 1px;
      -webkit-mask-composite: xor;
      mask-composite: exclude;
    }

    .quran-frame > * {
      position: relative;
      z-index: 1;
    }

    .meta-line {
      text-align: center;
      color: #2b6b59;
      font-weight: 700;
      margin-top: 10px;
    }

    .topbar {
      display: flex;
      justify-content: space-between;
      gap: 8px;
      flex-wrap: wrap;
      margin-bottom: 8px;
      align-items: center;
    }

    .top-pill {
      background: linear-gradient(180deg, #f9fff8, #e6f7ec);
      border: 1px solid #b9dec9;
      color: #0c6552;
      border-radius: 999px;
      padding: 6px 12px;
      font-weight: 800;
      font-size: .95rem;
      box-shadow: inset 0 1px 0 rgba(255,255,255,.84);
    }

    .parent-return-btn {
      background: #0f766e;
      color: #fff;
      border: none;
      border-radius: 999px;
      padding: 10px 16px;
      font-weight: 800;
      font-size: .95rem;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      cursor: pointer;
      min-height: 44px;
      box-shadow: 0 2px 8px rgba(15,118,110,.28);
      -webkit-tap-highlight-color: transparent;
    }
    .parent-return-btn:active { transform: scale(.97); }

    #surahName {
      border-color: rgba(183, 146, 67, .45);
      color: #0b543f;
      background:
        linear-gradient(90deg, rgba(183, 146, 67, .14), transparent 22%, transparent 78%, rgba(183, 146, 67, .14)),
        linear-gradient(180deg, #fffdf3, #eaf7ee);
    }

    .ayah {
      width: 100%;
      min-height: 190px;
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      align-content: center;
      gap: 12px;
      font-family: "KFGQPC Hafs", "Amiri Quran", "Traditional Arabic", "Noto Naskh Arabic", serif;
      font-size: clamp(2.35rem, 6.2vw, 4.2rem);
      line-height: 2.05;
      text-align: center;
      user-select: none;
      color: var(--quran-ink);
      letter-spacing: .01em;
      text-shadow: 0 1px 0 rgba(255,255,255,.75);
    }

    .ayah-basmala-intro {
      width: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 14px;
      font-size: clamp(2rem, 4.8vw, 3.15rem);
      line-height: 1.8;
      color: #0b5a47;
      margin-bottom: 10px;
      padding: 0 8px 8px;
    }

    .ayah-basmala-intro::before,
    .ayah-basmala-intro::after {
      content: '';
      flex: 1 1 42px;
      max-width: 118px;
      height: 9px;
      border-block: 1px solid rgba(183, 146, 67, .42);
      background: radial-gradient(circle, rgba(15, 153, 127, .36) 0 2px, transparent 3px) center / 18px 9px repeat-x;
    }

    .ayah-core-line {
      width: 100%;
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      align-content: center;
      /* و٣: تقليصُ الفجوةِ بين الكلمات (كانت ١٢px تُفكّكُ انسيابَ السطر). */
      gap: 6px;
    }

    .ayah-word {
      display: inline-block;
      padding: 0 9px 3px;
      border-radius: 13px;
      transition: background-color .2s ease, color .2s ease, transform .2s ease, box-shadow .2s ease;
    }

    .ayah-word.current {
      background: var(--current);
      transform: translateY(-1px);
      box-shadow: 0 0 0 2px rgba(183, 146, 67, .22) inset;
    }

    .ayah-word.spoken {
      color: var(--spoken);
      background: var(--spoken-soft);
    }

    .ayah-word.student-current {
      background: var(--student-current);
      color: #2752a5;
    }

    .ayah-word.correct {
      color: #176f43;
      background: #dff7ea;
      box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.18) inset;
    }

    .ayah-word.wrong,
    .ayah-word.missing {
      color: #991b1b;
      background: #fee2e2;
      box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2) inset;
    }

    .ayah-word.extra,
    .ayah-word.partial {
      color: #92400e;
      background: #fef3c7;
      box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.22) inset;
    }

    .ayah-word.focus-word {
      color: #5b21b6;
      background: #ede9fe;
      box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.28) inset;
      transform: translateY(-1px) scale(1.03);
    }

    .ayah-number-marker {
      display: inline-grid;
      place-items: center;
      width: 1.25em;
      height: 1.25em;
      margin-inline: .18em;
      border-radius: 50%;
      border: .075em solid var(--quran-gold);
      color: #75591f;
      background:
        radial-gradient(circle at center, var(--quran-paper) 40%, transparent 42%),
        radial-gradient(circle at center, rgba(127, 181, 150, .22) 52%, transparent 54%),
        conic-gradient(from 45deg, #bfa052 0 12.5%, #fff9de 0 25%, #bfa052 0 37.5%, #fff9de 0 50%, #bfa052 0 62.5%, #fff9de 0 75%, #bfa052 0 87.5%, #fff9de 0);
      /* و٣ (لجنةُ تجربةِ الطفل ٢٠٢٦-٠٩): خطُّ المصحفِ الموحّدُ بدل Noto Naskh — اتّساقٌ بصريّ
         مع نصِّ الآيةِ نفسِه (الذي يُرسَمُ بـKFGQPC). */
      font-family: "KFGQPC Hafs", "Amiri Quran", "Traditional Arabic", serif;
      font-size: .58em;
      font-weight: 900;
      line-height: 1;
      vertical-align: middle;
      box-shadow:
        0 0 0 .04em rgba(143, 122, 63, .28) inset,
        0 2px 5px rgba(91, 71, 26, .12);
    }

