@font-face { font-family: "Lilita One"; src: url("fonts/lilita-one-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Readex Pro"; src: url("fonts/readex-pro-arabic-wght-normal.woff2") format("woff2"); font-weight: 160 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F; }
@font-face { font-family: "Figtree"; src: url("fonts/figtree-latin-wght-normal.woff2") format("woff2"); font-weight: 300 900; font-display: swap; }

:root {
  --ground: #fff3e0;
  --ink: #1b1f3b;
  --soft: rgb(27 31 59 / 0.65);
  --line: rgb(27 31 59 / 0.16);
  --pointer: #e63946;
  --s0: #ff6b35; --s1: #ffc93c; --s2: #2ec4b6; --s3: #3a86ff; --s4: #8338ec; --s5: #ff006e;
  --display: "Lilita One", "Readex Pro", "Arial Rounded MT Bold", system-ui, sans-serif;
  --ui: "Figtree", "Readex Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --ground: #14172b; --ink: #fff3e0; --soft: rgb(255 243 224 / 0.7); --line: rgb(255 243 224 / 0.18); color-scheme: dark; }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 500 15px/1.45 var(--ui); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration-color: var(--soft); text-underline-offset: 3px; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--s3); outline-offset: 2px; }

.app { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 430px); grid-template-rows: auto 1fr; min-height: 100dvh; }
.bar { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 6px 20px; flex-wrap: wrap; padding: 16px 28px 0; }
.brand { margin: 0; font: 400 28px/1 var(--display); }
.brand span { color: var(--pointer); }
.purpose { flex: 1; margin: 0; color: var(--soft); font-size: 16px; }
.bar-meta { color: var(--soft); font-size: 12.5px; }

/* The wheel: the page is built around it */
.stage { display: grid; justify-items: center; align-content: center; gap: 14px; padding: 12px 28px 20px; min-height: 0; }
.wheel-wrap { position: relative; width: min(100%, calc(100dvh - 190px), 620px); aspect-ratio: 1; }
.wheel { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 6px 0 var(--ink)); }
#spin { transform-origin: 0 0; transition-property: transform; transition-timing-function: cubic-bezier(0.12, 0.75, 0.15, 1); }
#spin path, #spin .solo { stroke: var(--ink); stroke-width: 1.4; stroke-linejoin: round; }
.s0 { fill: var(--s0); background: var(--s0); } .s1 { fill: var(--s1); background: var(--s1); } .s2 { fill: var(--s2); background: var(--s2); }
.s3 { fill: var(--s3); background: var(--s3); } .s4 { fill: var(--s4); background: var(--s4); } .s5 { fill: var(--s5); background: var(--s5); }
.lbl { font-family: var(--ui); font-weight: 800; fill: #1b1f3b; } /* size comes from the slice width, set in app.js */
.lbl.t4 { fill: #ffffff; }
.empty { fill: none; stroke: var(--line); stroke-width: 3; stroke-dasharray: 6 6; }
/* After a spin: the other slices step back, the winner lifts out of the wheel */
#spin path { transition: opacity 0.3s, transform 0.3s; transform-origin: 0 0; }
#spin.won path:not(.win), #spin.won .lbl:not(.win) { opacity: 0.3; }
#spin.won path.win { transform: scale(1.05); }
.pointer { position: absolute; top: -18px; left: 50%; width: 40px; transform: translateX(-50%); z-index: 1; fill: var(--pointer); stroke: var(--ink); stroke-width: 3; stroke-linejoin: round; }
.hub { position: absolute; inset: 50% auto auto 50%; width: 22%; aspect-ratio: 1; transform: translate(-50%, -50%); border: 4px solid var(--ground); border-radius: 50%; background: var(--ink); color: var(--ground); font: 400 clamp(18px, 2.6vw, 30px) var(--display); cursor: pointer; box-shadow: 0 0 0 3px var(--ink); }
.hub:hover:not(:disabled) { transform: translate(-50%, -50%) scale(1.04); }
.hub:disabled { cursor: default; }
.few .hub, .hub:disabled { opacity: 0.85; }
.result { margin: 0; min-height: 1.2em; font: 400 clamp(30px, 4vw, 48px)/1.1 var(--display); text-align: center; overflow-wrap: anywhere; }
.result small { display: block; font: 600 15px var(--ui); color: var(--soft); }
.starter { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 0; color: var(--soft); font-size: 17px; font-weight: 600; }
.result.waiting { color: var(--soft); font-size: clamp(22px, 2.6vw, 30px); }
.result:not(.waiting) span { animation: pop 0.35s ease-out; }
@keyframes pop { from { transform: scale(0.7); opacity: 0; } }

/* The options: a plain ruled list, no cards */
.panel { display: flex; flex-direction: column; gap: 12px; padding: 18px 28px 22px 0; min-height: 0; }
.title { width: 100%; padding: 6px 0; border: 0; border-bottom: 3px solid var(--ink); background: none; font: 400 26px/1.2 var(--display); }
.title::placeholder { color: var(--soft); }
.title:focus { outline: none; border-bottom-color: var(--s3); }
.list-wrap { display: flex; flex-direction: column; gap: 10px; min-height: 0; margin: 0; padding: 0; border: 0; }
.list-head { display: grid; grid-template-columns: 1fr 96px 52px 28px; gap: 8px; margin: 0; padding-inline-start: 22px; color: var(--soft); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.list-head span:nth-child(2) { text-align: center; }
.list { margin: 0; padding: 0; list-style: none; overflow-y: auto; max-height: calc(100dvh - 430px); min-height: 120px; }
.list li { display: grid; grid-template-columns: 14px 1fr 96px 52px 28px; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.list:empty, .list-wrap:has(.list:empty) .list-head { display: none; }
.dot { width: 14px; height: 14px; border-radius: 4px; border: 2px solid var(--ink); }
.opt { min-width: 0; padding: 5px 4px; border: 0; border-radius: 6px; background: none; font-weight: 700; }
.opt:hover { background: var(--line); }
.weight { display: inline-flex; align-items: center; justify-content: center; gap: 2px; }
.weight output { min-width: 2ch; text-align: center; font: 400 18px var(--display); }
.step, .remove { width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; font-size: 18px; line-height: 1; cursor: pointer; }
.step:hover:not(:disabled), .remove:hover { background: var(--line); }
.step:disabled { opacity: 0.25; cursor: default; }
.remove { color: var(--soft); }
.chance { text-align: end; font-weight: 800; font-variant-numeric: tabular-nums; }
.add { display: flex; gap: 8px; }
.add input { flex: 1; min-width: 0; padding: 9px 12px; border: 2px solid var(--ink); border-radius: 12px; background: transparent; }
.add input::placeholder { color: var(--soft); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.history { margin: 0; color: var(--soft); font-size: 14px; overflow-wrap: anywhere; }
.history b { color: var(--ink); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.fair { margin: auto 0 0; padding-top: 12px; border-top: 1px solid var(--line); color: var(--soft); font-size: 13.5px; }
.fair b { color: var(--ink); }

/* A game-show push button: it sits on its own shadow and goes down when pressed */
.push { padding: 12px 26px; border: 3px solid var(--ink); border-radius: 12px; background: var(--s1); color: #1b1f3b; font: 400 20px var(--display); letter-spacing: 0.02em; box-shadow: 0 5px 0 var(--ink); cursor: pointer; transition: transform 0.08s, box-shadow 0.08s; }
.push:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.push:disabled { opacity: 0.45; cursor: default; }
.push.small { padding: 6px 16px; font-size: 16px; box-shadow: 0 3px 0 var(--ink); }
.plain { padding: 8px 4px; border: 0; background: none; font-weight: 700; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; cursor: pointer; }
.plain:hover { text-decoration-color: var(--ink); }
.plain:disabled { opacity: 0.4; cursor: default; }

.toast { position: fixed; left: 50%; bottom: 24px; margin: 0; padding: 10px 18px; border-radius: 12px; background: var(--ink); color: var(--ground); font-weight: 700; transform: translate(-50%, 14px); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { margin-inline-start: 6px; padding: 2px 10px; border: 2px solid var(--ground); border-radius: 8px; background: none; color: var(--ground); font-weight: 800; cursor: pointer; }

/* The reveal: a full-screen dialog, the ticket sits on the wheel's centre */
.reveal { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: none; overflow: hidden; }
.reveal::backdrop { background: rgb(27 31 59 / 0.35); }
.ticket { position: fixed; width: min(86vw, 380px); padding: 22px 26px 18px; border: 4px solid #1b1f3b; border-radius: 12px; color: #1b1f3b; text-align: center; box-shadow: 0 8px 0 #1b1f3b; transform: translate(-50%, -50%) rotate(-3deg); animation: drop 0.45s cubic-bezier(0.3, 1.5, 0.5, 1); }
.ticket.t4 { color: #ffffff; }
.ticket p { margin: 0; }
.kicker { font-weight: 800; font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; opacity: 0.8; }
.name { margin: 4px 0 2px !important; font: 400 clamp(38px, 9vw, 60px)/1.05 var(--display); overflow-wrap: anywhere; }
.note { min-height: 1.4em; font-weight: 700; }
.ticket-actions { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 14px; }
.ticket .push { background: #1b1f3b; color: #fff3e0; border-color: #1b1f3b; box-shadow: 0 4px 0 rgb(0 0 0 / 0.35); }
.ticket .plain { color: inherit; text-decoration-color: currentColor; }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
@keyframes drop { from { transform: translate(-50%, -80%) rotate(-14deg) scale(0.6); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .push, .toast { transition: none; }
  .result span, .ticket { animation: none !important; }
  #spin path { transition: none; }
}
@media (min-width: 900px) and (min-height: 640px) {
  .app { height: 100dvh; }
}
@media (max-width: 899px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto auto auto; }
  .bar { padding-inline: 16px; }
  .purpose { flex-basis: 100%; order: 3; }
  .stage { padding: 20px 16px 12px; }
  .wheel-wrap { width: min(100%, 520px); }
  .hub { font-size: clamp(18px, 6vw, 28px); }
  .panel { padding: 8px 16px 24px; }
  .list { max-height: none; overflow: visible; }
}

.bar-meta .lang { margin-inline-start: 12px; unicode-bidi: isolate; }
:lang(ar) :is(.list-head, .kicker, .push) { letter-spacing: 0; }

/* Questions under the tool: for people who scroll, and for search engines */
.faq { max-width: 920px; margin: 0 auto; padding: 56px 20px 64px; }
.faq h2 { margin: 0 0 20px; font: 700 22px/1.2 var(--display); letter-spacing: -0.02em; }
.faq-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px 32px; }
.faq h3 { margin: 0 0 6px; font-size: 15px; font-weight: 700; }
.faq p { margin: 0; color: var(--muted); line-height: 1.6; }
