:root {
  --yellow: #FFC72C;
  --yellow-deep: #F2A900;
  --yellow-soft: #FFF4CC;
  --red: #D52B1E;
  --red-deep: #A51F15;
  --ink: #1F1A12;
  --muted: #6E6455;
  --bg: #FFF9E6;
  --card: #FFFFFF;
  --line: #F1E4BD;
  --ok: #1E8A4C;
  --ok-soft: #E3F5EA;
  --warn: #A86400;
  --warn-soft: #FFF0D6;
  --bad: #B8322A;
  --bad-soft: #FDE7E5;
  --info: #1F5FA8;
  --info-soft: #E5EFFB;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(60, 40, 0, .06), 0 6px 20px rgba(60, 40, 0, .07);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Arabic", "Geeza Pro", Tahoma, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2 { margin: 0 0 6px; line-height: 1.25; }
h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 19px; font-weight: 800; }
p { margin: 0 0 12px; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top));
  background: var(--yellow);
  box-shadow: 0 3px 0 var(--yellow-deep);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand-mark {
  padding: 4px 14px; border-radius: 999px;
  background: var(--red); color: #fff;
  font-weight: 900; font-style: italic; font-size: 18px; letter-spacing: .3px;
  border: 3px solid #fff; box-shadow: 0 0 0 2px var(--red);
}
.brand-sub { font-weight: 800; font-size: 16px; }
.lang {
  min-height: 36px; padding: 6px 14px; border: 0; border-radius: 999px;
  background: #fff; color: var(--ink); font: inherit; font-weight: 700; cursor: pointer;
}

main { flex: 1; width: 100%; max-width: 460px; margin: 0 auto; padding: 20px 16px 32px; }
.foot { padding: 16px; text-align: center; color: var(--muted); font-size: 12px; }

/* Cards and text */
.card {
  margin-bottom: 16px; padding: 20px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
}
.card.subtle { background: var(--yellow-soft); box-shadow: none; font-weight: 600; }
.center { display: grid; place-items: center; gap: 10px; min-height: 160px; }
.center-text { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hint { color: var(--muted); font-size: 14px; text-align: center; margin: 4px 8px 16px; }
.icon-lg { font-size: 40px; line-height: 1; margin-bottom: 8px; }
.error {
  margin: 4px 0 12px; padding: 10px 12px; border-radius: 10px;
  background: var(--bad-soft); color: var(--bad); font-size: 14px; font-weight: 600;
}

/* Buttons */
.btn {
  display: block; width: 100%; min-height: 52px; margin-top: 10px; padding: 12px 18px;
  border: 0; border-radius: 14px; font: inherit; font-weight: 800; font-size: 17px; cursor: pointer;
  transition: transform .08s ease, filter .15s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.primary { background: var(--red); color: #fff; box-shadow: 0 3px 0 var(--red-deep); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.05); }
.btn.ghost { background: transparent; color: var(--ink); border: 2px solid var(--line); }
.btn.big { min-height: 60px; font-size: 19px; }
.btn.small { display: inline-block; width: auto; min-height: 36px; margin: 0; padding: 6px 14px; font-size: 14px; }
.link {
  display: block; width: 100%; margin-top: 12px; padding: 8px; border: 0; background: none;
  color: var(--red); font: inherit; font-weight: 700; cursor: pointer;
}
.link:disabled { color: var(--muted); cursor: default; }

/* Home */
.hero { text-align: center; padding: 8px 4px 20px; }
.lead { color: var(--muted); font-size: 17px; }
.bag {
  position: relative; width: 150px; height: 190px; margin: 4px auto 18px;
  background: linear-gradient(160deg, #FFD54A 0%, var(--yellow) 45%, var(--yellow-deep) 100%);
  border-radius: 28px 28px 22px 22px;
  clip-path: polygon(0 6%, 8% 0, 16% 6%, 24% 0, 32% 6%, 40% 0, 48% 6%, 56% 0, 64% 6%, 72% 0, 80% 6%, 88% 0, 96% 6%, 100% 2%, 100% 96%, 92% 100%, 84% 96%, 76% 100%, 68% 96%, 60% 100%, 52% 96%, 44% 100%, 36% 96%, 28% 100%, 20% 96%, 12% 100%, 4% 96%, 0 100%);
  box-shadow: inset 0 -12px 30px rgba(160, 90, 0, .25);
  animation: float 3.5s ease-in-out infinite;
}
.bag-logo {
  position: absolute; top: 38px; left: 50%; transform: translateX(-50%) rotate(-6deg);
  padding: 6px 18px; border-radius: 999px; background: var(--red); color: #fff;
  font-weight: 900; font-style: italic; font-size: 24px; border: 3px solid #fff;
}
.bag-qr {
  position: absolute; bottom: 30px; left: 50%; width: 46px; height: 46px; transform: translateX(-50%);
  background:
    linear-gradient(90deg, #000 30%, transparent 30%, transparent 70%, #000 70%) 0 0 / 14px 14px,
    #fff;
  border: 5px solid #fff; border-radius: 4px; box-shadow: 0 0 0 2px rgba(0, 0, 0, .1);
}
@keyframes float { 50% { transform: translateY(-6px) rotate(-1.5deg); } }
.steps { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 12px; }
.steps li { display: flex; align-items: center; gap: 12px; }
.steps .n {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--yellow); font-weight: 900;
}

/* Code status */
.status { text-align: center; margin-bottom: 16px; padding: 24px 20px; border-radius: var(--radius); }
.status-icon { font-size: 44px; line-height: 1; margin-bottom: 10px; }
.status.ok { background: var(--ok-soft); }
.status.ok h1 { color: var(--ok); }
.status.info { background: var(--info-soft); }
.status.info h1 { color: var(--info); }
.status.warn { background: var(--warn-soft); }
.status.warn h1 { color: var(--warn); }
.status.bad { background: var(--bad-soft); }
.status.bad h1 { color: var(--bad); }
.status p { margin: 0; }

/* Forms */
label { display: block; margin-bottom: 8px; font-weight: 800; }
.phone {
  display: flex; direction: ltr; overflow: hidden;
  border: 2px solid var(--line); border-radius: 14px; background: #fff;
}
.phone:focus-within { border-color: var(--red); }
.cc { display: grid; place-items: center; padding: 0 14px; background: var(--yellow-soft); font-weight: 800; }
.phone input {
  flex: 1; min-width: 0; min-height: 52px; padding: 10px 14px; border: 0; outline: 0;
  font: inherit; font-size: 18px; letter-spacing: .5px; background: transparent;
}
.otp {
  display: block; width: 100%; max-width: 260px; margin: 8px auto 12px; padding: 12px;
  border: 2px solid var(--line); border-radius: 14px; outline: 0;
  text-align: center; direction: ltr; font: inherit; font-size: 30px; font-weight: 800; letter-spacing: 10px;
}
.otp:focus { border-color: var(--red); }

/* Result */
.burst { position: relative; text-align: center; padding: 28px 12px 12px; }
.burst-ring {
  position: absolute; top: 10px; left: 50%; width: 150px; height: 150px; margin-left: -75px;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, var(--yellow) 0 10deg, transparent 10deg 20deg);
  opacity: .6; animation: spin 14s linear infinite;
}
.pts {
  position: relative; display: grid; place-items: center; width: 116px; height: 116px; margin: 7px auto 18px;
  border-radius: 50%; background: var(--red); color: #fff; border: 5px solid #fff;
  box-shadow: 0 6px 18px rgba(165, 31, 21, .35);
  font-size: 40px; font-weight: 900; direction: ltr; animation: pop .5s cubic-bezier(.2, 1.6, .4, 1) both;
}
.balance-line { font-size: 15px; color: var(--muted); }
.prize { text-align: center; background: linear-gradient(180deg, #fff, var(--yellow-soft)); border: 2px solid var(--yellow); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }

/* Wallet */
.balance {
  display: grid; justify-items: center; gap: 2px; margin-bottom: 12px; padding: 24px;
  border-radius: var(--radius); background: var(--red); color: #fff; box-shadow: 0 4px 0 var(--red-deep);
}
.balance strong { font-size: 52px; line-height: 1.1; font-weight: 900; }
.balance small { opacity: .85; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.stats div { display: grid; padding: 14px; border-radius: 14px; background: #fff; box-shadow: var(--shadow); text-align: center; }
.stats b { font-size: 24px; }
.stats span { color: var(--muted); font-size: 13px; }
.list { list-style: none; margin: 8px 0 0; padding: 0; }
.list li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-top: 1px solid var(--line);
}
.list li:first-child { border-top: 0; }
.list .empty { color: var(--muted); justify-content: center; }
.li-main { display: grid; }
.li-main small { color: var(--muted); font-size: 12px; }
.plus { color: var(--ok); direction: ltr; unicode-bidi: isolate; }
.tag { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }

/* Demo SMS notification */
.sms {
  position: fixed; top: 10px; left: 50%; z-index: 50; width: min(420px, calc(100% - 24px));
  padding: 12px 14px; border-radius: 16px; cursor: pointer;
  background: rgba(250, 250, 250, .96); box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  transform: translate(-50%, -140%); transition: transform .3s ease;
  backdrop-filter: blur(8px);
}
.sms.in { transform: translate(-50%, 0); }
.sms-head { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.sms-app { font-weight: 700; color: var(--ink); }
.sms-body { margin: 2px 0; font-weight: 600; }
.sms-tap { color: var(--red); font-size: 12px; font-weight: 700; }

.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 4px solid var(--yellow-soft); border-top-color: var(--red);
  animation: spin .8s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
