/* Fonts are served from this folder (web/fonts, OFL licence) so the page
   does not depend on an outside font service. */
@font-face { font-family: "Amiri Quran"; src: url("fonts/amiri-quran-arabic-400-normal.woff2") format("woff2"); font-weight: 400; font-display: block; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("fonts/ibm-plex-sans-arabic-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("fonts/ibm-plex-sans-arabic-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("fonts/ibm-plex-sans-arabic-arabic-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("fonts/ibm-plex-sans-arabic-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }

/* An element marked hidden stays hidden whatever display its class gives it. */
[hidden] { display: none !important; }

:root {
  --ground: #F4F6F5;
  --surface: #FFFFFF;
  --line: #DDE3E0;
  --ink: #16211D;
  --muted: #55615C;
  --primary: #0F5C4D;
  --primary-dark: #0A4338;
  --ok: #0E6B3F;
  --bad: #B42318;
  --bad-soft: #FCE9E6;
  --warn: #8A5A00;
  --warn-soft: #FBF1DA;
  --idle: #6B7672;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: "IBM Plex Sans Arabic", system-ui, sans-serif;
  line-height: 1.6;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.top, main, .foot { max-width: 760px; margin-inline: auto; padding-inline: 16px; }
.top { display: flex; align-items: center; justify-content: space-between; padding-block: 20px 8px; }
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand h1 { margin: 0; font-size: 1.6rem; color: var(--primary); }
.tag { font-size: .8rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; background: var(--surface); }

main { display: flex; flex-direction: column; gap: 16px; padding-block: 8px 24px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 18px; }
.card h2 { margin: 0 0 12px; font-size: 1.05rem; }
.card h3 { margin: 16px 0 8px; font-size: .95rem; }

.fields { display: flex; flex-wrap: wrap; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 110px; font-size: .85rem; color: var(--muted); }
.field.wide { flex: 3 1 240px; }
select, input[type="number"], textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-height: 46px; width: 100%;
}
select:focus-visible, input:focus-visible, textarea:focus-visible, .btn:focus-visible, summary:focus-visible {
  outline: 3px solid var(--primary); outline-offset: 2px;
}
.check { display: flex; align-items: center; gap: 10px; margin-top: 14px; min-height: 44px; font-size: .95rem; }
.check input { width: 22px; height: 22px; accent-color: var(--primary); }

.mushaf {
  margin: 0; text-align: center;
  font-family: "Amiri Quran", "Amiri", serif; font-size: 1.7rem; line-height: 2.5;
}
.w { color: var(--idle); border-radius: 8px; padding-inline: 2px; }
.w.correct { color: var(--ok); }
.w.wrong { color: var(--bad); background: var(--bad-soft); text-decoration: underline solid 2px; text-underline-offset: 10px; }
.w.missed { color: var(--bad); background: var(--bad-soft); text-decoration: underline dashed 2px; text-underline-offset: 10px; }
.w.close { color: var(--warn); background: var(--warn-soft); text-decoration: underline dotted 3px; text-underline-offset: 10px; }
.w.not_read { color: var(--idle); }
.hidden-text .w.pending { color: transparent; background: #E4EAE7; user-select: none; }
/* End-of-ayah sign: drawn by the Quran font, number inside. */
.ayah-end { color: var(--primary); margin-inline: 4px; font-size: 1em; }

.legend { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; font-size: .82rem; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 6px; }
.swatch { width: 18px; height: 0; border-top: 3px solid var(--idle); }
.swatch.correct { border-color: var(--ok); }
.swatch.wrong { border-color: var(--bad); }
.swatch.missed { border-color: var(--bad); border-top-style: dashed; }
.swatch.close { border-color: var(--warn); border-top-style: dotted; }

.actions { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.btn {
  font: inherit; font-weight: 700; cursor: pointer; border-radius: 14px;
  min-height: 48px; padding: 0 20px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.btn.primary { background: var(--primary); border-color: var(--primary); color: #FFFFFF; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.big { min-height: 60px; min-width: 240px; font-size: 1.1rem; }
.btn.recording { background: var(--bad); border-color: var(--bad); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.status { margin: 0; min-height: 1.6em; font-size: .92rem; color: var(--muted); }
.status.error { color: var(--bad); font-weight: 600; }
.upload { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .88rem; color: var(--muted); }
.upload input { font: inherit; max-width: 100%; }

.score { margin: 0; font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.counts { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.counts li { border: 1px solid var(--line); border-radius: 14px; padding: 10px; text-align: center; font-size: .82rem; color: var(--muted); }
.counts b { display: block; font-size: 1.3rem; color: var(--ink); }
.issues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.issues li { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-radius: 12px; padding: 10px 14px; background: var(--ground); font-size: .9rem; }
.issues li.bad { background: var(--bad-soft); }
.issues li.warn { background: var(--warn-soft); }
.issues .word { font-family: "Amiri Quran", serif; font-size: 1.35rem; line-height: 1.9; }
.issues small { display: block; color: var(--muted); }
.transcript { font-size: 1.05rem; line-height: 2; color: var(--muted); }
.note { margin: 14px 0 0; font-size: .85rem; color: var(--muted); }
details summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.dev { display: block; }
.dev[open] { display: flex; flex-direction: column; gap: 10px; }
.dev .btn { align-self: flex-start; }

.foot { padding-block: 0 28px; font-size: .78rem; color: var(--muted); text-align: center; }

/* ---------- added in stage 1 hardening ---------- */
.links { display: flex; align-items: center; gap: 12px; }
.links a { color: var(--primary); font-weight: 600; font-size: .92rem; min-height: 44px; display: flex; align-items: center; }
.links a:hover { color: var(--primary-dark); }
.gate { border-color: var(--primary); }
.gate-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.gate-form input { font: inherit; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-height: 46px; width: 100%; }
.hint { margin: 6px 0 0; font-size: .85rem; color: var(--muted); }
.hint.center { text-align: center; min-height: 1.4em; }
.note.first { margin: 0 0 14px; }
.hidden-text .w.pending[role="button"] { cursor: pointer; }
.hidden-text .w.pending[role="button"]:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.w.peeked { color: var(--warn); }
.review-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.review-list li { border-bottom: 1px solid var(--line); padding: 10px 0 16px; display: flex; flex-direction: column; gap: 6px; }
.review-list li:last-child { border-bottom: none; }
.review-list li.noted { background: var(--warn-soft); border-radius: 14px; padding-inline: 12px; }
.review-list .mushaf { text-align: start; color: var(--ink); }
.review-list input { font: inherit; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; min-height: 44px; width: 100%; background: var(--surface); color: var(--ink); }
.review-list .field { flex: none; }

/* AI advisory notice (required by the Quran Muaalem License). It must stay at
   least as prominent as other text on the page: do not shrink or hide it. */
.notice { border: 2px solid var(--warn); background: var(--warn-soft); display: flex; flex-direction: column; gap: 10px; }
.notice[hidden] { display: none; }
.notice .btn { align-self: flex-start; }
.notice-text { margin: 0; font-size: 1rem; line-height: 1.8; color: var(--ink); }
.notice-text:empty { display: none; }
.foot .notice-text { margin-bottom: 8px; }
.locked { opacity: .45; pointer-events: none; }

/* ---------- platform pages (stage 1) ---------- */
.top { flex-wrap: wrap; gap: 8px 16px; }
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: var(--primary); }
.brand-name { font-size: 1.5rem; font-weight: 700; }
.links { flex-wrap: wrap; gap: 4px 14px; }
.links a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-underline-offset: 6px; }
.page-title { margin: 0 0 4px; font-size: 1.4rem; }
.muted { color: var(--muted); }
.strong { font-weight: 700; }
.error-text { color: var(--bad); font-weight: 600; }
.warn-text { color: var(--warn); font-weight: 600; }
.narrow { max-width: 460px; margin-inline: auto; width: 100%; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.row.center { justify-content: center; }
.row-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.form-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.form-row > input, .form-row > select { flex: 1 1 160px; }
.field input, .field textarea, .form-row input, .form-row select, .stack textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; min-height: 46px; width: 100%;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, button:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.choice { border: 1px solid var(--line); border-radius: 14px; padding: 8px 14px 12px; margin: 12px 0 0; }
.choice legend { padding: 0 6px; font-weight: 600; font-size: .9rem; }
.choice .check { margin-top: 6px; }
.choice small { color: var(--muted); }
.modes { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.btn.small { min-height: 44px; padding: 0 14px; font-size: .9rem; }
.btn.light { background: var(--surface); color: var(--primary); border-color: var(--surface); display: inline-flex; align-items: center; text-decoration: none; }
.btn.link { background: none; border: none; color: var(--muted); font-weight: 600; text-decoration: underline; }
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.tabs { display: flex; gap: 6px; margin: 8px 0 14px; }
.tab { font: inherit; font-weight: 600; flex: 1; min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--ground); color: var(--ink); cursor: pointer; }
.tab[aria-selected="true"] { background: var(--primary); color: #FFFFFF; border-color: var(--primary); }
.greeting { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 12px; font-size: .85rem; font-weight: 600; }
.pill.ok { background: #DCEFE7; border-color: #DCEFE7; color: #0B4F2F; }
.pill.danger { background: var(--bad-soft); border-color: var(--bad-soft); color: #8F1D13; }
.hero { background: var(--primary); color: #FFFFFF; border-color: var(--primary); display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.hero h2 { margin: 0; font-size: 1.6rem; }
.hero .eyebrow, .hero .sub { color: #CFE5DE; font-size: .9rem; margin: 0; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.list-link { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 52px; padding: 8px 14px; background: var(--ground); border-radius: 12px; color: var(--ink); text-decoration: none; }
.list-link:hover { background: #E8EDEB; }
.item { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px; background: var(--ground); border-radius: 12px; }
.item.column { flex-direction: column; align-items: stretch; }
.bar { height: 10px; background: #E4EAE7; border-radius: 999px; overflow: hidden; margin: 6px 0; }
.bar > span { display: block; height: 100%; width: 0; background: var(--primary); border-radius: 999px; }
.banner { border-radius: 14px; padding: 12px 14px; background: var(--warn-soft); color: var(--ink); font-weight: 600; margin: 0; }
.banner.ok { background: #DCEFE7; color: #0B4F2F; }
.banner.danger { background: var(--bad-soft); color: #8F1D13; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-btn { font: inherit; font-weight: 600; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.pill-btn.on { background: var(--primary); border-color: var(--primary); color: #FFFFFF; }
.pill-btn:disabled { opacity: .5; cursor: not-allowed; }
.sheikh { border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.sheikh h3 { margin: 0; font-size: 1.05rem; }
.slots { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.correction { border: 2px solid var(--bad); display: flex; flex-direction: column; gap: 10px; }
.correction h2 { margin: 0; color: #8F1D13; }
.correction .answer { background: var(--ground); border-radius: 14px; padding: 10px 14px; }
.w.fix { color: var(--ok); font-weight: 700; background: #DCEFE7; border-radius: 8px; padding-inline: 4px; }
.w.seg { box-shadow: inset 0 -3px 0 var(--primary); }
.foot-links a { color: var(--primary); font-weight: 600; }

/* Certificate: shown on screen and printed as is. */
.certificate { display: flex; flex-direction: column; gap: 12px; }
.cert-frame { background: var(--surface); border: 2px solid var(--primary); outline: 8px solid var(--surface); box-shadow: 0 0 0 9px var(--line);
  border-radius: 14px; padding: 32px 24px; text-align: center; display: flex; flex-direction: column; gap: 10px; margin: 10px; }
.cert-assoc { margin: 0; color: var(--primary); font-weight: 700; }
.cert-title { margin: 0; font-size: 1.8rem; }
.cert-line { margin: 0; color: var(--muted); }
.cert-name { margin: 0; font-size: 1.6rem; font-weight: 700; }
.cert-scope { margin: 0; font-size: 1.25rem; font-weight: 700; color: var(--primary); }
.cert-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 8px; text-align: start; }
.cert-foot dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; }
.cert-foot dt { color: var(--muted); font-size: .85rem; }
.cert-foot dd { margin: 0; font-weight: 700; }
.cert-foot figure { margin: 0; text-align: center; font-size: .8rem; color: var(--muted); }
@media print {
  .top, .foot-links, .no-print, #gate { display: none !important; }
  body { background: #FFFFFF; }
  main { padding: 0; }
  .cert-frame { margin: 0; }
}
