/* Beta sign-up page. Colors and faces from the game's poster kit (night #0A1B2B, ink #0A1420, amber #FFC45C).
   Motion rule: only transform and opacity move; the blink and the slow glow are the only idle motion;
   prefers-reduced-motion switches every movement off (block at the end). */
@font-face { font-family: "Bricolage"; src: url(fonts/BricolageGrotesque-Regular.ttf); font-weight: 400; font-display: swap; }
@font-face { font-family: "Bricolage"; src: url(fonts/BricolageGrotesque-Bold.ttf); font-weight: 700; font-display: swap; }
@font-face { font-family: "Plex Arabic"; src: url(fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex Arabic"; src: url(fonts/ibm-plex-sans-arabic-arabic-700-normal.woff2); font-weight: 700; font-display: swap; }

:root {
  --ink: #04070D; --outline: #0A1420; --deep: #0A1B2B; --reed: #11363F; --teal: #35807A; --card: #0E2233;
  --cream: #F6EDD8; --amber: #FFC45C; --muted: #F6EDD8b3; --err: #FF9D7A;
}
* { box-sizing: border-box; }
html { background: var(--ink); color: var(--cream); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background: linear-gradient(var(--ink) 0, var(--deep) 220px, var(--deep) 70%, var(--reed) 100%);
  font: 400 17px/1.5 "Plex Arabic", "Bricolage", system-ui, sans-serif;
}
[lang="en"] { font-family: "Bricolage", system-ui, sans-serif; }
.en { display: block; color: var(--muted); font-size: 0.82em; line-height: 1.35; margin-top: 1px; }
.ar { display: block; }
main { max-width: 480px; margin: 0 auto; padding: 14px 18px 28px; }
a { color: var(--amber); }

header { text-align: center; }
.wordmark { display: block; width: 100%; max-width: 180px; height: auto; margin: 2px auto 8px; filter: drop-shadow(0 4px 14px #000a); }
.wordmark.small { max-width: 150px; }
.home { display: block; }
h1 { font-size: 26px; line-height: 1.3; margin: 0 0 6px; color: #FFF6E2; font-weight: 700;
  text-shadow: 0 2px 0 var(--outline), 0 0 18px #FFC45Ccc, 0 0 40px #FFC45C66; }
h1 .en { color: var(--amber); font-size: 14px; font-weight: 400; text-shadow: none; }
.intro { margin: 0; font-size: 13.5px; line-height: 1.45; }
.intro .en { font-size: 11.5px; }

/* Card; Mama sits behind it, so the opaque card hides her body below the scarf (poster-0024 v2). */
.card-wrap { position: relative; margin-top: 78px; }
.mama { position: absolute; z-index: 0; top: -86px; inset-inline-start: 16px; width: 96px;
  transform-origin: 50% 100%; animation: pop 0.62s 0.25s cubic-bezier(.3,1.5,.5,1) both; }
.mama svg { display: block; width: 100%; height: auto; filter: drop-shadow(0 0 14px #FFF3B066); transform-origin: 50% 90%; }
.mama .eye { transform-box: fill-box; transform-origin: center; animation: blink 4.8s 2.2s infinite; }
.mama .squint { opacity: 0; transition: opacity .12s; }
.mama.happy .eye { opacity: 0; animation: none; }
.mama.happy .squint { opacity: 1; }
.mama.happy svg { animation: bob 0.6s ease-out; }
/* Head pop: up from behind the card edge, a small overshoot, then one quick peck. */
@keyframes pop {
  0% { transform: translateY(78px); opacity: 0; }
  12% { opacity: 1; }
  55% { transform: translateY(-7px); }
  70% { transform: translateY(0) rotate(0); }
  82% { transform: translateY(3px) rotate(-7deg); }
  100% { transform: none; }
}
@keyframes blink { 0%, 93%, 100% { transform: none; } 95.5% { transform: scaleY(0.1); } }
@keyframes bob { 0%, 100% { transform: none; } 35% { transform: translateY(-9px) rotate(-3deg); } 70% { transform: translateY(1px); } }

.card { position: relative; z-index: 1; padding: 14px 16px 18px; background: var(--card); border: 2px solid #FFC45C66; border-radius: 20px;
  box-shadow: 0 10px 30px #0008; }

/* The nine lights: dim until earned; core and halo fade in (opacity), the light pops (transform). */
.lights { display: flex; justify-content: center; gap: min(13px, 2.2vw); height: 16px; margin: 2px 0 14px; }
.lights i { position: relative; flex: none; width: min(15px, 4.4vw); height: min(15px, 4.4vw); border-radius: 50%; background: #FFC45C24; box-shadow: inset 0 0 0 1.5px #FFC45C59; }
.lights i::before, .lights i::after { content: ""; position: absolute; border-radius: 50%; opacity: 0; transition: opacity .3s; }
.lights i::before { inset: 0; background: radial-gradient(circle at 40% 36%, #fff 0 20%, var(--amber) 52%, #F59A3C 100%); }
.lights i::after { inset: -11px; background: radial-gradient(circle, #FFC45Cbb 0, #FFC45C44 38%, transparent 70%); }
.lights i.on::before { opacity: 1; }
.lights i.on::after { opacity: 1; animation: glow 3.2s ease-in-out infinite alternate; }
.lights i:nth-child(odd).on::after { animation-delay: -1.6s; }
@keyframes glow { from { opacity: .55; } to { opacity: 1; } }
/* After a sign-up all nine drift up gently into the poster's arc and stay there. */
.lights i:nth-child(1), .lights i:nth-child(9) { --h: -5px; }
.lights i:nth-child(2), .lights i:nth-child(8) { --h: -9px; }
.lights i:nth-child(3), .lights i:nth-child(7) { --h: -12px; }
.lights i:nth-child(4), .lights i:nth-child(6) { --h: -14px; }
.lights i:nth-child(5) { --h: -15px; }
.lights.fly i { animation: drift 1.8s cubic-bezier(.25,.7,.3,1) both; }
.lights.fly i:nth-child(2), .lights.fly i:nth-child(8) { animation-delay: .07s; }
.lights.fly i:nth-child(3), .lights.fly i:nth-child(7) { animation-delay: .14s; }
.lights.fly i:nth-child(4), .lights.fly i:nth-child(6) { animation-delay: .21s; }
.lights.fly i:nth-child(5) { animation-delay: .28s; }
@keyframes drift { 0% { transform: none; } 55% { transform: translateY(calc(var(--h) * 1.5)); } 100% { transform: translateY(var(--h)); } }

form { display: grid; gap: 12px; transition: opacity .18s; }
form.leaving { opacity: 0; }
.field { min-width: 0; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.row .en { margin: 0; }
.field > label, legend { display: block; font-weight: 700; margin-bottom: 4px; padding: 0; width: 100%; }
.field > label.row, legend.row { display: flex; }
.field > label .en, legend .en { font-weight: 400; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
input[type="text"], input[type="email"] {
  width: 100%; min-height: 48px; padding: 9px 14px; font: inherit; font-size: 17px;
  color: var(--cream); background: var(--outline); border: 2px solid var(--teal); border-radius: 12px;
}
input[type="text"]:focus, input[type="email"]:focus { border-color: var(--amber); }
input[aria-invalid="true"]:focus { border-color: var(--err); }
input[type="email"] { direction: ltr; text-align: left; }

/* Segmented choices: real radio inputs, hidden visually but kept in the tab order. */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 6px; }
.choices label {
  min-height: 52px; display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 4px 6px; text-align: center; background: var(--outline); border: 2px solid var(--teal); border-radius: 12px; cursor: pointer;
  font-weight: 700; line-height: 1.25;
}
.choices label .en { margin: 0; font-size: 12px; font-weight: 400; }
.choices input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choices label:has(input:checked) { background: var(--amber); border-color: var(--amber); color: var(--ink); animation: pick .28s ease-out; }
.choices label:has(input:checked) .en { color: var(--ink); }
.choices label:has(input:focus-visible) { outline: 3px solid var(--cream); outline-offset: 2px; }
@keyframes pick { 0% { transform: scale(.94); } 60% { transform: scale(1.04); } 100% { transform: none; } }

/* Consent: one row, the whole row is the tap target. */
.field > label.agree { display: flex; align-items: center; gap: 12px; min-height: 60px; margin: 0; padding: 8px 12px; cursor: pointer; font-weight: 400;
  background: var(--outline); border: 2px solid var(--teal); border-radius: 14px; font-size: 15px; line-height: 1.4; }
.field > label.agree:has(input:checked) { border-color: var(--amber); }
.field > label.agree:has([aria-invalid="true"]) { border-color: var(--err); }
/* Own box drawing, so the unticked box matches the card; the tick is two borders of a pseudo-element. */
.agree input { flex: none; position: relative; width: 28px; height: 28px; margin: 0; cursor: pointer; appearance: none; -webkit-appearance: none;
  background: var(--deep); border: 2px solid var(--amber); border-radius: 8px; }
.agree input::after { content: ""; position: absolute; left: 8px; top: 3px; width: 7px; height: 13px;
  border: solid var(--ink); border-width: 0 3px 3px 0; transform: rotate(45deg) scale(0); transition: transform .18s; }
.agree input:checked { background: var(--amber); animation: pick .28s ease-out; }
.agree input:checked::after { transform: rotate(45deg) scale(1); }
.agree .txt { min-width: 0; text-align: start; }
.agree .en { font-size: 12.5px; text-align: left; }
/* The link to /privacy sits on its own line under the consent row (outside the label), 44 px tall. */
.policy-link { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 0 10px; width: fit-content; max-width: 100%; min-height: 44px; margin: 8px auto 0; padding: 0 8px;
  color: var(--amber); text-underline-offset: 3px; }
.policy-link .ar, .policy-link .en { display: inline; margin: 0; color: inherit; }
.nw { white-space: nowrap; }

input:focus-visible, button:focus-visible, a:focus-visible, .agree input:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }
[aria-invalid="true"], fieldset[aria-invalid="true"] .choices label, .agree:has([aria-invalid="true"]) { border-color: var(--err); }
.err { color: var(--err); margin: 6px 0 0; font-size: 14px; line-height: 1.4; }
.err .ar::before { content: "! "; font-weight: 700; } /* a mark beside the words, so the error does not rely on color */
.err .en { color: var(--err); }
.err:not([hidden]) { animation: rise .22s ease-out; }
.err:target { display: block !important; } /* the no-JavaScript path: /#err-retry and friends */
.top-errs { margin-bottom: -12px; } /* cancels the form's grid gap while nothing is shown */
.top-errs:has(.err:not([hidden]), .err:target) { margin-bottom: 0; }
@keyframes rise { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

button {
  position: relative; overflow: hidden; width: 100%; min-height: 58px; font: inherit; font-size: 19px; font-weight: 700; color: var(--ink);
  background: var(--amber); border: 0; border-radius: 14px; cursor: pointer; line-height: 1.3;
  box-shadow: 0 6px 20px #FFC45C33; transition: transform .12s;
}
button:active { transform: scale(.98); }
button .en { color: var(--ink); opacity: 0.8; font-size: 13px; }
button[aria-busy="true"] { cursor: progress; }
.ripple { position: absolute; width: 24px; height: 24px; margin: -12px 0 0 -12px; border-radius: 50%; background: #FFF6E2; opacity: 0; pointer-events: none; }
.dots { display: inline-flex; gap: 4px; margin-top: 3px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink); animation: dot 1s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 100% { opacity: .25; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }
/* Honeypot: clipped in place. An offset such as left: -10000px widens the scroll area in an RTL page. */
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

#done { text-align: center; padding: 10px 4px 6px; font-size: 20px; font-weight: 700; animation: enter .38s ease-out both; }
#done:focus { outline: none; }
#done span { text-wrap: balance; } /* no lone last word («محدود») on a phone */
#done .en { font-size: 15px; font-weight: 400; margin-top: 6px; }
@keyframes enter { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }

/* Privacy page */
.policy { margin-top: 18px; }
.policy h1 { font-size: 24px; margin-bottom: 4px; }
.policy h2 { font-size: 16px; color: var(--amber); margin: 18px 0 4px; }
.policy h2 .en { font-weight: 400; }
.policy p { margin: 0 0 10px; font-size: 15px; line-height: 1.6; }
.policy p .en { font-size: 13.5px; margin-top: 3px; }
.version { margin: 18px 0 0 !important; text-align: center; font-size: 12px !important; color: var(--muted); }
.back { text-align: center; margin: 20px 0 0; }
.pill { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-height: 52px; padding: 6px 28px;
  background: var(--amber); color: var(--ink); border-radius: 999px; font-weight: 700; text-decoration: none; }
.pill .en { color: var(--ink); opacity: .8; font-weight: 400; margin: 0; }

/* Footer: the Duck Studios mark alone, small and quiet; no text beside or under it (owner order 2026-11-15). */
footer { margin-top: 30px; }
footer .mark { display: block; width: 80px; height: auto; margin: 0 auto; opacity: 0.55; }
[hidden] { display: none !important; }

/* Reduced motion: nothing moves; every state change is instant (lights simply on or off). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
