/* Public result page — Pashto, right-to-left, mobile first */
:root {
  --ink: #0e1240;
  --teal: #00046e;
  --teal-dark: #000350;
  --paper: #f3f4fa;
  --line: #d9dcee;
  --muted: #5a5f86;
  --gold: #c3922e;
  --pass: #1b7a48;
  --fail: #b3261e;
  --gold-soft: #fbf3e2;
  --gold-ink: #7a5714;
  --sans: "Noto Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, Arial, sans-serif;
  --display: "Noto Naskh Arabic", Tahoma, serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, p { margin: 0; }

.skip { position: absolute; inset-inline-start: -9999px; }
.skip:focus { inset-inline-start: 8px; top: 8px; z-index: 10; padding: 8px 14px; background: #fff; color: var(--teal); border-radius: 8px; }

/* Header */
.site-header { background: var(--teal); color: #fff; }
.site-header-inner {
  max-width: 64rem;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo { width: 44px; height: 44px; border-radius: 50%; object-fit: contain; flex: none; }
.logo-initial {
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--teal);
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
}
.site-name { min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.site-name strong { font-weight: 700; }
.site-name span { color: rgba(255, 255, 255, 0.75); font-size: 14px; }
.header-link {
  margin-inline-start: auto;
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  color: #fff;
  font-size: 14px;
  text-decoration: none;
}
.header-link:hover { background: rgba(255, 255, 255, 0.12); }

/* Hero */
.hero { background: linear-gradient(180deg, var(--teal) 0, #05098c 100%); color: #fff; padding: 36px 16px 88px; text-align: center; }
.hero-inner { max-width: 40rem; margin: 0 auto; }
.eyebrow { display: inline-block; margin-bottom: 12px; padding: 4px 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); font-size: 14px; font-weight: 500; }
.lead { margin-top: 10px; color: rgba(255, 255, 255, 0.85); font-size: 17px; }
@media (min-width: 640px) { .hero { padding: 56px 16px 104px; } }

/* Main */
.main { flex: 1; width: 100%; max-width: 36rem; margin: 0 auto; padding: 0 16px 48px; margin-top: -56px; }

.title {
  text-align: center;
  font-family: var(--display);
  font-weight: 700;
  font-size: 30px;
  line-height: 1.5;
}
@media (min-width: 640px) { .title { font-size: 36px; } }

/* Search card */
.search-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 1px 2px rgba(14, 18, 64, 0.04), 0 12px 32px -18px rgba(14, 18, 64, 0.25);
}
@media (min-width: 640px) { .search-card { padding: 28px; } }

.search-label { display: block; margin-bottom: 8px; font-size: 18px; font-weight: 700; }
.search-row { display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 640px) { .search-row { flex-direction: row; } }

.search-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font: 700 24px/1.4 var(--sans);
  letter-spacing: 0.15em;
  text-align: center;
  outline: none;
  transition: border-color 0.15s, background-color 0.15s;
}
.search-input::placeholder { color: var(--muted); opacity: 0.45; font-weight: 400; }
.search-input:focus { border-color: var(--teal); background: #fff; }

.search-button {
  padding: 12px 32px;
  border: 0;
  border-radius: 12px;
  background: var(--teal);
  color: #fff;
  font: 700 18px/1.4 var(--sans);
  cursor: pointer;
  transition: background-color 0.15s;
}
.search-button:hover { background: var(--teal-dark); }
.search-button { background: var(--teal); }
.search-button:focus-visible { outline: 4px solid rgba(0, 4, 110, 0.3); outline-offset: 1px; }
.search-button[aria-disabled="true"] { opacity: 0.6; cursor: progress; }

.hint { margin-top: 12px; color: var(--muted); font-size: 14px; }

/* Messages */
#result { margin-top: 24px; scroll-margin-top: 16px; }
.message {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 20px;
  border: 1px solid rgba(179, 38, 30, 0.25);
  border-radius: 12px;
  background: rgba(179, 38, 30, 0.05);
  color: var(--fail);
  font-weight: 500;
  text-align: center;
}

/* Result slip */
.slip {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(14, 18, 64, 0.04), 0 16px 40px -22px rgba(14, 18, 64, 0.3);
  animation: slip-in 260ms ease-out both;
}
@keyframes slip-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.slip.has-prize { border-color: #e7cf98; }

/* Prize ribbon — only shown when the participant has a prize */
.prize-ribbon {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  background: linear-gradient(90deg, #fdf6e6, #f8e8c4);
  border-bottom: 1px solid #ecd9ad;
  color: var(--gold-ink);
}
.prize-cup {
  display: grid;
  place-items: center;
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px #f1dca8;
  font-size: 24px;
  line-height: 1;
}
.prize-label { display: block; font-size: 13px; font-weight: 500; opacity: 0.85; }
.prize-name { display: block; font-family: var(--display); font-size: 20px; line-height: 1.5; overflow-wrap: anywhere; }
.slip-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.slip-who { min-width: 0; }
.slip-org { color: var(--muted); font-size: 14px; }
.slip-name {
  margin-top: 4px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 24px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.stamp {
  flex: none;
  padding: 4px 12px;
  border: 3px solid;
  border-radius: 8px;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  transform: rotate(-6deg);
  animation: stamp-in 380ms cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
.stamp span { display: block; font: 700 11px/1.2 var(--sans); letter-spacing: 0.15em; }
.stamp-pass { border-color: var(--pass); color: var(--pass); }
.stamp-fail { border-color: var(--fail); color: var(--fail); }
.stamp-other { border-color: var(--teal); color: var(--teal); max-width: 9rem; overflow-wrap: anywhere; }

@keyframes stamp-in {
  from { opacity: 0; transform: rotate(-6deg) scale(1.6); }
  to { opacity: 1; transform: rotate(-6deg) scale(1); }
}
@media (prefers-reduced-motion: reduce) { .stamp, .slip { animation: none; } }

.slip-table { width: 100%; border-collapse: collapse; font-size: 16px; }
.slip-table tr + tr { border-top: 1px solid var(--line); }
.slip-table th,
.slip-table td { padding: 12px 20px; text-align: right; vertical-align: top; }
.slip-table th { width: 40%; color: var(--muted); font-weight: 500; }
.slip-table td { font-weight: 700; overflow-wrap: anywhere; }
.slip-table td.tone-pass { color: var(--pass); }
.slip-table td.tone-fail { color: var(--fail); }
.slip-table td.tone-other { color: var(--teal); }
@media (min-width: 640px) {
  .slip-head, .slip-table th, .slip-table td, .slip-foot, .prize-ribbon { padding-left: 28px; padding-right: 28px; }
  .slip-table th { width: 11rem; }
}

.slip-foot { padding: 12px 20px; border-top: 1px solid var(--line); }
.print-button {
  padding: 6px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--teal);
  font: 700 14px/1.5 var(--sans);
  cursor: pointer;
}
.print-button:hover { background: var(--paper); }
.print-button:focus-visible { outline: 2px solid rgba(0, 4, 110, 0.4); }

/* Footer */
.site-footer { background: var(--teal); color: rgba(255, 255, 255, 0.8); }
.site-footer-inner {
  max-width: 64rem;
  margin: 0 auto;
  padding: 24px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  font-size: 14px;
}
.contacts { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.contacts a { color: inherit; text-decoration: none; }
.contacts a:hover { color: #fff; text-decoration: underline; }
.footer-brand { display: flex; flex-direction: column; color: #fff; }
.footer-brand span { color: rgba(255, 255, 255, 0.7); font-size: 13px; }
.copy { width: 100%; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.15); font-size: 13px; }

/* Three steps */
.steps { list-style: none; margin: 32px 0 0; padding: 0; display: grid; gap: 12px; }
@media (min-width: 640px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.steps li { display: flex; gap: 12px; align-items: flex-start; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.steps strong { display: block; }
.steps span:not(.step-num) { color: var(--muted); font-size: 14px; }
.step-num { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--teal); color: #fff; font-weight: 700; }

/* Print: only the result slip */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .main { padding: 0; max-width: none; }
  .slip { border-color: #999; box-shadow: none; animation: none; }
  .stamp { animation: none; }
  .prize-ribbon { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
