/* Rate the name — shared styles (vote page + big-screen results). Light, white cards, Asiacell red. */
:root {
  --bg: #f4f2ee;
  --card: #ffffff;
  --ink: #16191f;
  --muted: #6a707c;
  --red: #e82228;
  --line: rgba(40, 52, 90, .08);
  --track: #efeee9;
  --grey: #b8bcc4;
  --shadow: 0 14px 36px rgba(40, 52, 90, .10);
}
/* Always light (brief: light background, white cards), also when the phone is in dark mode. */
:root { color-scheme: light; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: "DM Sans", "Noto Naskh Arabic", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
html[dir="rtl"] body { font-family: "Noto Naskh Arabic", "DM Sans", system-ui, sans-serif; }
i.ai { font-style: normal; color: var(--red); }
[hidden] { display: none !important; }

.page { max-width: 1120px; margin: 0 auto; padding: 20px 16px 40px; }
.top { display: flex; align-items: center; justify-content: space-between; }
.logo { height: 40px; display: block; }
.lang { font: 600 15px/1 "DM Sans", "Noto Naskh Arabic", sans-serif; color: var(--muted); text-decoration: none; padding: 10px 4px; }

/* LAILA / LAITH / CAPTAIN / ? */
.family { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 12px; margin-top: 28px; text-align: center; }
.member-name { display: block; font: 700 22px/1 "Space Grotesk", "DM Sans", sans-serif; letter-spacing: .14em; }
.member small { display: block; margin-top: 8px; font: 600 11px/1.3 "DM Sans", "Noto Naskh Arabic", sans-serif; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.slot b { display: inline-block; min-width: 72px; padding: 1px 0 3px; border: 2px dashed var(--grey); border-radius: 10px; font: 700 22px/1 "Space Grotesk", sans-serif; color: var(--grey); }
.slot small { color: var(--grey); }
.slot.filled small { color: var(--red); }
html[dir="rtl"] .member small:not(.ltr), html[dir="rtl"] .eyebrow { letter-spacing: 0; }

.h1 { margin: 36px 0 0; font: 700 40px/1.05 "Space Grotesk", "DM Sans", "Noto Naskh Arabic", sans-serif; letter-spacing: -.03em; }
html[dir="rtl"] .h1 { font-family: "Noto Naskh Arabic", sans-serif; letter-spacing: 0; line-height: 1.3; }
.lead { margin: 12px 0 0; font-weight: 500; font-size: 17px; line-height: 1.4; color: var(--muted); }
.eyebrow { margin: 0 0 12px; font: 700 13px/1 "DM Sans", "Noto Naskh Arabic", sans-serif; letter-spacing: .2em; text-transform: uppercase; color: var(--red); }

/* Name cards */
.form { margin-top: 24px; }
.cards { display: grid; gap: 12px; }
.card {
  position: relative; display: grid; grid-template-columns: 28px 1fr auto; grid-template-areas: "key name ar" "key meaning meaning";
  align-items: baseline; gap: 4px 12px; width: 100%; padding: 18px 46px 18px 20px; padding-inline: 20px 46px;
  border: 0; border-radius: 22px; background: var(--card); color: inherit; text-align: start; cursor: pointer; font: inherit;
  box-shadow: var(--shadow), inset 0 0 0 1.5px var(--line); transition: box-shadow .15s, transform .15s;
}
.card:active { transform: scale(.99); }
.card[aria-checked="true"] { box-shadow: 0 14px 36px rgba(232, 34, 40, .18), inset 0 0 0 2.5px var(--red); }
.card:disabled { cursor: default; opacity: .6; }
.card:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.card-key { grid-area: key; font: 700 15px/1 "DM Sans", sans-serif; letter-spacing: .2em; color: var(--red); }
.card-name { grid-area: name; font: 700 32px/1 "Space Grotesk", "DM Sans", sans-serif; letter-spacing: .06em; }
.card-ar { grid-area: ar; font: 700 24px/1.2 "Noto Naskh Arabic", "Geeza Pro", serif; }
.card-meaning { grid-area: meaning; font: 500 16px/1.3 "DM Sans", "Noto Naskh Arabic", sans-serif; color: var(--muted); }
.card-check { position: absolute; top: 50%; margin-top: -11px; inset-inline-end: 14px; display: none; width: 22px; height: 22px; border-radius: 50%; background: var(--red); color: #fff; font: 700 13px/22px sans-serif; text-align: center; }
.card[aria-checked="true"] .card-check { display: block; }

.note { display: block; margin-top: 20px; }
.note span { display: block; margin-bottom: 8px; font: 600 15px/1.3 "DM Sans", "Noto Naskh Arabic", sans-serif; }
.note textarea {
  display: block; width: 100%; padding: 12px 14px; border: 0; border-radius: 16px; resize: vertical;
  background: var(--card); color: var(--ink); font: 400 16px/1.4 "DM Sans", "Noto Naskh Arabic", sans-serif;
  box-shadow: inset 0 0 0 1.5px rgba(127, 135, 150, .35);
}
.note textarea:focus { outline: none; box-shadow: inset 0 0 0 2px var(--red); }

.turnstile { margin-top: 16px; min-height: 0; }
.error { margin: 14px 0 0; font: 600 15px/1.4 "DM Sans", "Noto Naskh Arabic", sans-serif; color: var(--red); }
.vote {
  display: block; width: 100%; margin-top: 18px; padding: 17px; border: 0; border-radius: 16px; cursor: pointer;
  background: var(--red); color: #fff; font: 700 18px/1 "Space Grotesk", "DM Sans", "Noto Naskh Arabic", sans-serif; letter-spacing: .04em;
}
.vote:disabled { background: var(--grey); cursor: default; }

/* Thank you + live results */
.thanks { margin-top: 28px; padding: 28px 20px; border-radius: 22px; background: var(--card); text-align: center; box-shadow: var(--shadow), inset 0 0 0 1.5px var(--line); }
.thanks-title { margin: 0; font: 700 26px/1.2 "Space Grotesk", "DM Sans", "Noto Naskh Arabic", sans-serif; }
.thanks-sub { margin: 10px 0 0; font-weight: 500; font-size: 16px; color: var(--muted); }
.thanks-name { margin: 8px 0 0; font: 700 48px/1 "Space Grotesk", "DM Sans", sans-serif; letter-spacing: .08em; }
.live { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); text-align: start; }
.live-title { display: flex; align-items: center; gap: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .dot { animation: none; } .bar-fill { transition: none !important; } }
.bar { margin-top: 14px; }
.bar-head { display: flex; justify-content: space-between; align-items: baseline; }
.bar-name { font: 700 20px/1 "Space Grotesk", "DM Sans", sans-serif; letter-spacing: .08em; }
.bar-pct { font: 700 18px/1 "Space Grotesk", "DM Sans", sans-serif; font-variant-numeric: tabular-nums; }
.bar-track { margin-top: 8px; height: 12px; border-radius: 6px; background: var(--track); overflow: hidden; }
.bar-fill { height: 100%; width: 0; border-radius: 6px; background: var(--grey); transition: width .6s ease; }
.bar.is-leader .bar-fill { background: var(--red); }
.bar.mine .bar-name::after { content: " \2713"; color: var(--red); }
.bar small { display: block; margin-top: 6px; font-size: 13px; color: var(--muted); }
.total { margin: 18px 0 0; font-size: 15px; color: var(--muted); text-align: center; }
.total b { color: var(--ink); font-variant-numeric: tabular-nums; }

.footer { margin-top: 28px; text-align: center; font: 500 16px/1.4 "DM Sans", "Noto Naskh Arabic", sans-serif; color: var(--muted); }
.footer p { margin: 0; }
.footer em { font-style: normal; font-weight: 700; color: var(--red); }
.footer a { display: inline-block; margin-top: 10px; color: var(--muted); font-weight: 600; }

@media (min-width: 768px) {
  .page { padding: 40px 40px 56px; }
  .logo { height: 52px; }
  .family { grid-template-columns: repeat(4, auto); justify-content: center; gap: 0 56px; margin-top: 24px; }
  .member-name, .slot b { font-size: 34px; }
  .member small { font-size: 14px; }
  .h1 { margin-top: 64px; font-size: 72px; }
  .lead { font-size: 24px; }
  .form { margin-top: 40px; }
  .cards { grid-template-columns: repeat(3, 1fr); gap: 22px; }
  .card { grid-template-columns: 1fr; grid-template-areas: "key" "name" "ar" "meaning"; justify-items: center; gap: 14px; padding: 36px 20px 34px; text-align: center; border-radius: 28px; }
  .card-name { font-size: 52px; }
  .card-ar { font-size: 34px; min-height: 41px; }
  .card-meaning { font-size: 20px; }
  .card-check { top: 16px; margin-top: 0; }
  .note, .vote, .error, .turnstile { max-width: 560px; }
  .thanks { max-width: 560px; margin-inline: auto; }
}

/* ---- Big-screen results page ---- */
.screen { max-width: 1600px; }
.screen-grid { display: grid; gap: 32px; margin-top: 28px; }
.screen-rows { margin-top: 28px; display: grid; gap: 22px; }
.row { padding: 20px; border-radius: 22px; background: var(--card); box-shadow: var(--shadow), inset 0 0 0 1.5px var(--line); }
.row.is-leader { box-shadow: 0 14px 36px rgba(232, 34, 40, .16), inset 0 0 0 2.5px var(--red); }
.row-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.row .card-name { font-size: 32px; }
.badge { padding: 4px 10px; border-radius: 999px; background: var(--red); color: #fff; font: 700 12px/1.2 "DM Sans", "Noto Naskh Arabic", sans-serif; letter-spacing: .08em; text-transform: uppercase; align-self: center; }
.row-pct { margin-inline-start: auto; font: 700 32px/1 "Space Grotesk", "DM Sans", sans-serif; font-variant-numeric: tabular-nums; }
.row .bar-track { margin-top: 14px; height: 18px; border-radius: 9px; }
.row .bar-fill { border-radius: 9px; transition: width .8s ease; }
.row.is-leader .bar-fill { background: var(--red); }
.row-count { margin: 10px 0 0; font-size: 15px; color: var(--muted); }
.row-count b { color: var(--ink); font-variant-numeric: tabular-nums; }
.screen-total { margin: 24px 0 0; font-size: 18px; color: var(--muted); }
.screen-total b { font: 700 28px/1 "Space Grotesk", "DM Sans", sans-serif; color: var(--ink); }
.side { display: flex; flex-direction: column; align-items: center; text-align: center; }
.qr { margin-top: 16px; padding: 16px; border-radius: 24px; background: #fff; box-shadow: var(--shadow), inset 0 0 0 1.5px rgba(40, 52, 90, .08); }
.qr img { display: block; width: 220px; height: 220px; }
.qr-link { margin: 16px 0 0; font: 700 20px/1.3 "Space Grotesk", "DM Sans", sans-serif; }
.qr-link i { display: block; font-style: normal; color: var(--muted); font-weight: 500; }
.closes { margin: 10px 0 0; font-size: 16px; color: var(--muted); }
.closes em { font-style: normal; font-weight: 700; color: var(--red); }

/* Phone: the QR card comes first and is compact (QR left, text right), so it is visible without scrolling. */
@media (max-width: 1023px) {
  .screen-grid { margin-top: 20px; gap: 24px; }
  .side { order: -1; display: grid; grid-template-columns: auto 1fr; grid-template-areas: "qr scan" "qr link" "qr closes"; align-items: center; column-gap: 16px; text-align: start; padding: 14px; border-radius: 22px; background: var(--card); box-shadow: var(--shadow), inset 0 0 0 1.5px var(--line); }
  .side .eyebrow { grid-area: scan; margin: 0; align-self: end; }
  .side .qr { grid-area: qr; margin: 0; padding: 8px; border-radius: 14px; box-shadow: inset 0 0 0 1.5px rgba(40, 52, 90, .08); }
  .side .qr img { width: 112px; height: 112px; }
  .side .qr-link { grid-area: link; margin: 6px 0 0; font-size: 16px; }
  .side .closes { grid-area: closes; margin: 4px 0 0; font-size: 14px; align-self: start; }
}

@media (min-width: 1024px) {
  .screen { padding: 40px 64px 56px; }
  .screen-grid { grid-template-columns: 1fr 360px; gap: 64px; align-items: start; margin-top: 32px; }
  .screen .h1 { margin-top: 14px; font-size: 64px; }
  .row { padding: 26px 30px; }
  .row .card-name { font-size: 52px; }
  .row .card-ar { font-size: 34px; }
  .row-pct { font-size: 52px; }
  .row .bar-track { height: 26px; border-radius: 13px; }
  .row-count { font-size: 18px; }
  .qr img { width: 300px; height: 300px; }
  .side { margin-top: 64px; }
}

/* 404 + no-JS message */
.notfound { text-align: center; padding-top: 80px; }
.notfound .logo { margin: 0 auto; }
.notfound a { color: var(--red); }

/* Test mode */
.test-badge { margin: 20px auto 0; width: fit-content; padding: 6px 12px; border-radius: 999px; background: #fff4d6; color: #7a5a00; font: 600 13px/1.2 "DM Sans", "Noto Naskh Arabic", sans-serif; }
.reset { margin-top: 20px; padding: 10px 16px; border: 1.5px dashed var(--grey); border-radius: 12px; background: none; color: var(--muted); font: 600 14px/1 "DM Sans", "Noto Naskh Arabic", sans-serif; cursor: pointer; }
.reset:disabled { opacity: .6; cursor: default; }
