/* ==========================================================================
   Lab Survey — design system (RTL)
   Layout: one calm, centred editorial column. Warm paper ground, white cards
   with hairline borders, gold + crimson used sparingly, a giant faint mark in
   the background. Light by default; a header toggle switches to dark.
   ========================================================================== */

:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --fg: #1a1a1a;
  --fg-2: #4a4a4a;
  --muted: #8a8a8a;
  --line: rgba(26, 26, 26, 0.08);
  --line-strong: rgba(26, 26, 26, 0.16);
  --gold: #a3832f;
  --gold-bright: #d4a853;
  --gold-glow: rgba(212, 168, 83, 0.14);
  --crimson: #8e1b1b;
  --crimson-2: #b3302a;
  --danger: #b3302a;
  --danger-soft: rgba(179, 48, 42, 0.08);
  --ok: #3f7d4f;
  --btn-bg: #1a1a1a;
  --btn-fg: #f5f4f0;
  --header-bg: rgba(245, 244, 240, 0.82);
  --mark: rgba(26, 26, 26, 0.055);
  --ch1: #b8902f;
  --ch2: #3d63c9;
  --ch3: #2f8f6b;

  --f-ar: "IBM Plex Sans Arabic", "Noto Sans Arabic", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --f-naskh: "Amiri", "Traditional Arabic", serif;
  --f-ruqaa: "Aref Ruqaa", "Amiri", serif;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1.0625rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;
  --text-2xl: 2rem;
  --text-3xl: 2.75rem;

  --w-narrow: 640px;
  --w-normal: 780px;
  --w-wide: 960px;
  --r: 8px;
  --r-lg: 14px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0a0a0f;
  --surface: #12121a;
  --surface-2: #161620;
  --fg: #e8e6e1;
  --fg-2: #b4b2ad;
  --muted: #828290;
  --line: rgba(255, 255, 255, 0.06);
  --line-strong: rgba(255, 255, 255, 0.12);
  --gold: #d4a853;
  --gold-bright: #edc887;
  --gold-glow: rgba(212, 168, 83, 0.08);
  --crimson: #e06a5f;
  --crimson-2: #f08a7e;
  --danger: #f08a7e;
  --danger-soft: rgba(240, 138, 126, 0.1);
  --ok: #7fc493;
  --btn-bg: #e8e6e1;
  --btn-fg: #0a0a0f;
  --header-bg: rgba(10, 10, 15, 0.82);
  --mark: rgba(255, 255, 255, 0.035);
  --ch1: #d4a853;
  --ch2: #8fb3dd;
  --ch3: #6fcf9f;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--bg);
  accent-color: var(--gold);
  caret-color: var(--gold);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--f-ar);
  font-size: var(--text-base);
  line-height: 1.75;
  color: var(--fg);
  /* The ground is painted on <html>; a body background would cover the z-index:-1 watermark. */
  background: transparent;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  transition: color 0.3s;
}

img { max-width: 100%; height: auto; display: block; }
p { margin: 0; }
a { color: inherit; text-underline-offset: 4px; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
::selection { background: var(--gold-glow); color: var(--fg); }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }

.wrap {
  width: 100%;
  max-width: var(--w-wide);
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 32px);
}
.wrap--normal { max-width: calc(var(--w-normal) + 64px); }

.mono { font-family: var(--f-mono); font-feature-settings: "tnum"; }
/* Latin readings ("0 / 8000") keep their order inside RTL text. */
.ltr { direction: ltr; unicode-bidi: isolate; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Giant faint mark behind everything. */
.watermark {
  position: fixed;
  left: -6vw;
  bottom: -14vh;
  z-index: -1;
  font-family: var(--f-ruqaa);
  font-size: min(78vh, 90vw);
  line-height: 1;
  color: var(--mark);
  pointer-events: none;
  user-select: none;
}
.watermark--star {
  width: min(70vh, 80vw);
  aspect-ratio: 1;
  bottom: -18vh;
  /* The star is a solid shape, so it reads stronger than a letter at the same tint. */
  opacity: 0.55;
  background: var(--mark);
  -webkit-mask: url("/assets/img/star.svg?v=c5e3a5a433") center / contain no-repeat;
  mask: url("/assets/img/star.svg?v=c5e3a5a433") center / contain no-repeat;
}

/* --- Header ------------------------------------------------------------ */

.site-head {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-head__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 1.05rem;
  text-decoration: none;
}
.brand img { width: 26px; height: 26px; }
.site-head__tools { display: flex; align-items: center; gap: 14px; }
.site-head__note { font-size: var(--text-sm); color: var(--muted); }

.theme-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--fg);
  background: transparent;
  border: 1px solid var(--gold);
  border-radius: var(--r);
  cursor: pointer;
  transition: background-color 0.2s;
}
.theme-btn:hover { background: var(--gold-glow); }
.theme-btn svg { width: 17px; height: 17px; }
.theme-btn .icon-sun { display: none; }
:root[data-theme="dark"] .theme-btn .icon-sun { display: block; }
:root[data-theme="dark"] .theme-btn .icon-moon { display: none; }

/* --- Buttons & links --------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 10px 22px;
  font: inherit;
  font-size: 0.98rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1px solid var(--btn-bg);
  border-radius: var(--r);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s, transform 0.2s var(--ease);
}
.btn:hover { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn:active { transform: scale(0.98); }
.btn[disabled] { cursor: progress; opacity: 0.6; }
.btn svg { width: 16px; height: 16px; flex: none; transition: transform 0.25s var(--ease); }
.btn:hover svg { transform: translateX(-3px); }

.btn--ghost { color: var(--fg); background: transparent; border-color: var(--line-strong); }
.btn--ghost:hover { color: var(--gold); background: transparent; border-color: var(--gold); }
.btn--danger { color: var(--danger); background: transparent; border-color: var(--line); }
.btn--danger:hover { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.btn--sm { min-height: 36px; padding: 6px 14px; font-size: var(--text-sm); }
.btn--lg { min-height: 52px; padding: 12px 30px; font-size: 1.05rem; }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  color: var(--fg-2);
  text-decoration: none;
  transition: color 0.2s;
}
.link-arrow:hover { color: var(--gold); }

/* --- Ornament divider -------------------------------------------------- */

.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: min(100%, 560px);
  margin-inline: auto;
  color: var(--crimson);
}
.ornament::before,
.ornament::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(to left, transparent, var(--line-strong));
}
.ornament::after { background: linear-gradient(to right, transparent, var(--line-strong)); }
.ornament svg { width: 14px; height: 28px; }

/* --- Splash ------------------------------------------------------------ */

.splash {
  flex: 1;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 28px;
  padding-block: clamp(40px, 7vh, 80px) 64px;
  text-align: center;
}

.construction {
  position: absolute;
  inset: -6% 14%;
  z-index: -1;
  width: 72%;
  height: 112%;
  margin: auto;
  color: var(--line-strong);
  overflow: visible;
}
.construction circle, .construction path { fill: none; stroke: currentColor; stroke-width: 1; }
.construction .dot { fill: var(--gold); stroke: none; }

.saw { font-family: var(--f-naskh); font-size: 1.1em; }

.cta { display: grid; justify-items: center; gap: 12px; }
.cta__meta { font-size: var(--text-sm); color: var(--muted); }

.rise { animation: rise 0.9s var(--ease) both; }
.rise--2 { animation-delay: 0.12s; }
.rise--3 { animation-delay: 0.24s; }
.rise--4 { animation-delay: 0.36s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* --- Survey page ------------------------------------------------------- */

.hero {
  display: grid;
  justify-items: center;
  gap: 20px;
  padding-block: clamp(56px, 9vw, 104px) clamp(40px, 6vw, 64px);
  text-align: center;
}
.hero__eyebrow { font-size: var(--text-sm); font-weight: 500; color: var(--gold); }
.hero__title {
  max-width: 20ch;
  font-weight: 600;
  font-size: clamp(1.9rem, 4.4vw, var(--text-3xl));
  line-height: 1.45;
}
.hero__title em { font-style: normal; color: var(--crimson); }
.hero__lead { max-width: 46ch; font-size: var(--text-lg); font-weight: 300; color: var(--fg-2); }
.hero__actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px 22px; margin-top: 6px; }

.section { display: grid; gap: 22px; padding-block: clamp(40px, 6vw, 64px); }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.section__title { font-weight: 600; font-size: var(--text-xl); }
.section__meta { font-size: var(--text-sm); color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: border-color 0.2s, background-color 0.3s;
}

.courses {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.course { display: grid; gap: 10px; padding: 20px 22px; }
.course:hover { border-color: var(--line-strong); }
.course__tag { font-family: var(--f-mono); font-size: var(--text-xs); color: var(--c); }
.course__name { font-weight: 600; font-size: 1.08rem; line-height: 1.6; }
.course__wave { width: 100%; height: 40px; color: var(--c); }
.course__wave path { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.course__wave .axis { stroke: var(--line-strong); stroke-width: 1; }
.ch-1 { --c: var(--ch1); }
.ch-2 { --c: var(--ch2); }
.ch-3 { --c: var(--ch3); }

.letter { display: grid; gap: 16px; padding: clamp(22px, 4vw, 36px); color: var(--fg-2); }
.letter__salute { font-weight: 600; color: var(--fg); }
.letter__sign { font-weight: 600; color: var(--fg); }

.note {
  display: flex;
  gap: 10px;
  margin-top: 4px;
  padding: 14px 16px;
  font-size: 0.92rem;
  line-height: 1.75;
  color: var(--fg-2);
  background: var(--gold-glow);
  border-radius: var(--r);
}
.note svg { flex: none; width: 18px; height: 18px; margin-top: 4px; color: var(--gold); }
.note strong { color: var(--fg); }

/* --- Form -------------------------------------------------------------- */

.form { padding: clamp(22px, 4vw, 40px); scroll-margin-top: 96px; }

.alert {
  margin-bottom: 22px;
  padding: 12px 16px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: var(--r);
}

.q { display: grid; gap: 12px; padding-block: 26px; }
.q + .q { border-top: 1px solid var(--line); }
.form > .alert + .q { padding-top: 0; }
.q__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.q__step { font-family: var(--f-mono); font-size: var(--text-xs); color: var(--gold); }
.tag { font-size: var(--text-xs); color: var(--muted); }
.tag--req { color: var(--crimson); }
.q__label { font-weight: 500; font-size: 1.12rem; line-height: 1.75; color: var(--fg); }
.q__hint { font-size: 0.95rem; color: var(--fg-2); }

.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chips__label { font-size: var(--text-sm); color: var(--muted); }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 3px 12px;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--fg-2);
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}
.chip::before { content: "+"; font-family: var(--f-mono); color: var(--gold); }
.chip:hover { color: var(--gold); border-color: var(--gold); }
.chip[aria-pressed="true"] { color: var(--gold); border-color: transparent; background: var(--gold-glow); }
.chip[aria-pressed="true"]::before { content: "✓"; }

.input {
  width: 100%;
  min-height: 50px;
  padding: 12px 16px;
  font: inherit;
  font-size: 1rem;
  color: var(--fg);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}
.input::placeholder { color: var(--muted); }
.input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--gold);
  box-shadow: 0 0 0 4px var(--gold-glow);
}
.input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }

.editor {
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}
.editor:focus-within { background: var(--surface); border-color: var(--gold); box-shadow: 0 0 0 4px var(--gold-glow); }
.editor:has([aria-invalid="true"]) { border-color: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.input--area {
  display: block;
  min-height: 240px;
  padding: 16px 18px;
  line-height: 2;
  resize: vertical;
  field-sizing: content;
  background: transparent;
  border: 0;
}
.input--area:focus { background: transparent; box-shadow: none; }
.editor__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  font-size: var(--text-xs);
  color: var(--muted);
  border-top: 1px solid var(--line);
}
.editor__draft { display: inline-flex; align-items: center; gap: 6px; }
.editor__draft::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }

.q__error { font-size: 0.9rem; font-weight: 500; color: var(--danger); }

.hp {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.form__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 22px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.form__privacy { flex: 1 1 240px; font-size: var(--text-sm); color: var(--muted); }

/* --- Thanks / message pages --------------------------------------------- */

.center { flex: 1; display: grid; place-items: center; padding-block: 72px; }
.done { display: grid; justify-items: center; gap: 16px; max-width: 540px; text-align: center; }
.done__check { width: 76px; height: 76px; margin-bottom: 6px; }
.done__check circle {
  fill: var(--gold-glow);
  stroke: var(--gold);
  stroke-width: 1.5;
  stroke-dasharray: 190;
  animation: draw-c 0.8s var(--ease) both;
}
.done__check path {
  fill: none;
  stroke: var(--gold);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  animation: draw-p 0.5s 0.6s var(--ease) both;
}
@keyframes draw-c { from { stroke-dashoffset: 190; } to { stroke-dashoffset: 0; } }
@keyframes draw-p { from { stroke-dashoffset: 48; } to { stroke-dashoffset: 0; } }
.done h1 { font-weight: 600; font-size: clamp(1.7rem, 4.5vw, var(--text-2xl)); }
.done p { color: var(--fg-2); }
.done__code { font-family: var(--f-mono); color: var(--gold); }

/* --- Footer ------------------------------------------------------------ */

.site-foot { padding-block: 40px 32px; font-size: var(--text-sm); color: var(--muted); }
.site-foot__inner { display: grid; justify-items: center; gap: 14px; text-align: center; }
.site-foot__brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--fg); }
.site-foot__brand img { width: 22px; height: 22px; }
.site-foot strong { color: var(--fg-2); font-weight: 600; }

/* --- Admin ------------------------------------------------------------- */

.admin { flex: 1; padding-block: 48px 72px; }
.login { display: grid; gap: 14px; max-width: 420px; margin: 40px auto; padding: 34px 30px; }
.login h1 { font-weight: 600; font-size: var(--text-xl); }
.login p { color: var(--muted); font-size: 0.95rem; }
.login .alert { margin: 0; }

.dash__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 26px; }
.dash__head h1 { font-weight: 600; font-size: var(--text-2xl); }
.dash__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { padding: 18px 20px; }
.stat__label { font-size: var(--text-sm); color: var(--muted); }
.stat__value { font-weight: 600; font-size: var(--text-2xl); line-height: 1.4; font-variant-numeric: tabular-nums; }
.dash .alert { margin: 0 0 20px; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--r); }

/* --- Splash: the poem alone ------------------------------------------ */

.poem-stage {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 26px;
  padding: clamp(28px, 6vw, 56px) 0;
}
.poem-stage::before {
  content: "";
  position: absolute;
  inset: -20% -10%;
  z-index: -1;
  background: radial-gradient(closest-side, var(--gold-glow), transparent);
}
.poem-stage .construction { inset: -30% 0; width: min(100%, 520px); height: 160%; opacity: 0.8; }
.poem-by { font-size: var(--text-base); color: var(--muted); }
.poem {
  position: relative;
  margin: 0;
  display: grid;
  justify-items: center;
  gap: 6px;
  font-family: var(--f-ruqaa);
  font-size: clamp(2.1rem, 6.2vw, 3.9rem);
  line-height: 1.75;
  color: var(--fg);
}
.poem::before {
  content: "“";
  position: absolute;
  top: -0.25em;
  right: -0.7em;
  font-family: var(--f-naskh);
  font-size: 1.1em;
  line-height: 1;
  color: var(--gold-bright);
}
.poem__sep { width: 18px; height: 18px; opacity: 0.9; }

/* --- Intro ------------------------------------------------------------- */

.intro__cta {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding-block: 16px clamp(56px, 8vw, 88px);
  text-align: center;
}

/* --- Wizard ------------------------------------------------------------ */

.wrap--narrow { max-width: calc(var(--w-narrow) + 64px); }
.survey { flex: 1; padding-block: clamp(36px, 6vw, 64px) clamp(56px, 8vw, 88px); }

.wizard-head { display: grid; gap: 12px; margin-bottom: 22px; }
.wizard-head__row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.wizard-head__title { font-weight: 600; font-size: var(--text-lg); }
.progress__text { font-size: var(--text-sm); color: var(--muted); }
.progress { height: 4px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress__bar {
  display: block;
  width: 25%;
  height: 100%;
  background: linear-gradient(to left, var(--gold-bright), var(--gold));
  border-radius: inherit;
  transition: width 0.45s var(--ease);
}

.step { margin: 0; padding: 0; border: 0; min-width: 0; display: grid; gap: 14px; animation: step-in 0.4s var(--ease) both; }
@keyframes step-in {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: none; }
}
.step__title { font-weight: 600; font-size: clamp(1.2rem, 2.6vw, 1.4rem); line-height: 1.7; }
.step__title:focus { outline: none; }

.cats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cat { position: relative; cursor: pointer; }
.cat input { position: absolute; opacity: 0; pointer-events: none; }
.cat__box {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 2px 12px;
  height: 100%;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}
.cat__box::before {
  content: "";
  grid-row: span 2;
  width: 20px;
  height: 20px;
  margin-top: 4px;
  border: 1.5px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface) no-repeat center / 12px;
  transition: background-color 0.2s, border-color 0.2s;
}
.cat__name { font-weight: 500; line-height: 1.6; }
.cat__desc { font-size: var(--text-sm); line-height: 1.6; color: var(--muted); }
.cat:hover .cat__box { border-color: var(--gold); }
.cat input:focus-visible + .cat__box { box-shadow: 0 0 0 4px var(--gold-glow); border-color: var(--gold); }
.cat input:checked + .cat__box { background: var(--gold-glow); border-color: var(--gold); }
.cat input:checked + .cat__box::before {
  border-color: var(--gold);
  background-color: var(--gold);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}

.review {
  display: grid;
  gap: 10px;
  margin: 4px 0 0;
  padding: 16px 18px;
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r);
}
.review__title { font-size: var(--text-sm); font-weight: 600; color: var(--gold); }
.review dl { display: grid; gap: 10px; margin: 0; }
.review div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; font-size: 0.95rem; }
.review dt { color: var(--muted); }
.review dd { margin: 0; color: var(--fg-2); overflow-wrap: anywhere; }

.wizard-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.wizard-nav__end { display: flex; gap: 10px; margin-inline-start: auto; }

/* --- Admin: problem types ---------------------------------------------- */

.cat-stats { display: grid; gap: 12px; padding: 18px 20px; margin-bottom: 22px; }
.cat-stats h2 { font-weight: 600; font-size: var(--text-base); }
.cat-stats ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.cat-stats b { font-family: var(--f-mono); font-weight: 500; color: var(--gold); }

/* --- Blessing line, intro, corner entry -------------------------------- */

.pbuh {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--f-ruqaa);
  font-weight: 700;
  font-size: clamp(1.4rem, 3.4vw, 1.9rem);
  line-height: 1.6;
  color: var(--crimson);
}
.pbuh::before,
.pbuh::after {
  content: "";
  width: clamp(28px, 6vw, 56px);
  height: 1px;
  background: linear-gradient(to left, transparent, var(--gold));
}
.pbuh::after { background: linear-gradient(to right, transparent, var(--gold)); }

.intro-top { padding-top: clamp(48px, 8vw, 96px); }

/* Deliberately faint: the admin entry is there, but not advertised. */
.corner-admin {
  position: fixed;
  left: max(14px, env(safe-area-inset-left, 0px));
  bottom: max(14px, env(safe-area-inset-bottom, 0px));
  z-index: 15;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--muted);
  border-radius: 50%;
  opacity: 0.22;
  transition: opacity 0.25s, color 0.25s, background-color 0.25s;
}
.corner-admin svg { width: 14px; height: 14px; }
.corner-admin:hover,
.corner-admin:focus-visible { opacity: 1; color: var(--gold); background: var(--gold-glow); }

/* --- Admin: login + table ---------------------------------------------- */

.wrap--wide { max-width: 1264px; }
.login__mark { width: 40px; height: 40px; margin-bottom: 4px; }
.field-label { margin-bottom: -6px; font-size: var(--text-sm); font-weight: 500; color: var(--fg-2); }
.cat-stats__hint { font-weight: 400; font-size: var(--text-xs); color: var(--muted); }
.cat-stats button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 2px 12px;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--fg-2);
  background: var(--gold-glow);
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
}
.cat-stats button:hover { border-color: var(--gold); }
.cat-stats button[aria-pressed="true"] { color: var(--surface); background: var(--gold); }
.cat-stats button[aria-pressed="true"] b { color: inherit; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 16px; }
.toolbar__search { flex: 1 1 280px; width: auto; }
.toolbar__select { flex: 0 1 240px; width: auto; min-height: 50px; }
.toolbar__count { font-size: var(--text-sm); color: var(--muted); white-space: nowrap; }

.table-wrap { overflow-x: auto; }
.rtable { width: 100%; min-width: 900px; border-collapse: collapse; font-size: 0.95rem; }
.rtable th {
  padding: 12px 16px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--muted);
  text-align: start;
  white-space: nowrap;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-strong);
}
.rtable td { padding: 14px 16px; vertical-align: top; border-bottom: 1px solid var(--line); }
.rtable tbody tr:last-child td { border-bottom: 0; }
.rtable tbody tr:hover { background: var(--surface-2); }
.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}
.th-sort::after { content: "↕"; font-size: 0.8em; opacity: 0.4; }
[aria-sort="ascending"] .th-sort,
[aria-sort="descending"] .th-sort { color: var(--gold); }
[aria-sort="ascending"] .th-sort::after { content: "↑"; opacity: 1; }
[aria-sort="descending"] .th-sort::after { content: "↓"; opacity: 1; }

.cell-id { color: var(--gold); white-space: nowrap; }
.cell-date { color: var(--muted); font-size: var(--text-sm); white-space: nowrap; direction: ltr; text-align: end; }
.cell-name { font-weight: 500; white-space: nowrap; }
.cell-name--anon { color: var(--muted); font-weight: 400; }
.cell-tags { min-width: 150px; }
.cell-tags span {
  display: inline-block;
  margin: 0 0 4px 4px;
  padding: 0 10px;
  font-size: var(--text-xs);
  line-height: 1.9;
  color: var(--fg-2);
  background: var(--gold-glow);
  border-radius: 999px;
}
.cell-problem { min-width: 300px; max-width: 460px; }
.cell-problem p {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--fg-2);
}
tr.is-open .cell-problem p { display: block; -webkit-line-clamp: unset; }
.more-btn {
  margin-top: 4px;
  padding: 0;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--gold);
  background: none;
  border: 0;
  cursor: pointer;
}
.cell-sem { min-width: 120px; color: var(--fg-2); font-size: var(--text-sm); }
.cell-act { width: 1%; }
.table-wrap .empty { margin: 0; border: 0; }

[hidden] { display: none !important; }

/* --- Responsive -------------------------------------------------------- */

@media (max-width: 760px) {
  .courses, .stats, .cats { grid-template-columns: minmax(0, 1fr); }
  .poem::before { right: 50%; transform: translateX(50%); top: -0.75em; }
  .review div { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .site-head__note { display: none; }
}
@media (max-width: 520px) {
  body { font-size: 1rem; }
  .form__foot .btn, .hero__actions .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
