/* Zabanyad design system (Figma "Zabanyad UI", Design System v0.08):
   brand #F26600 (darker #572401, lighter #FCE0CC, subtle #F7A366), states error #FF3B3B, warning #FFCC00,
   info #33357D, success #06C270, darks #1A1B21…#DEDEDE, lights #DDE5E9…#FEFEFF; UI font Vazir. */
@font-face {
  font-family: "Vazirmatn";
  src: url("/static/fonts/Vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --brand: #f26600;
  --brand-press: #c45200;
  --brand-darker: #572401;
  --brand-lighter: #fce0cc;
  --brand-subtle: #f7a366;
  --error: #ff3b3b;
  --warning: #ffcc00;
  --info: #33357d;
  --success: #06c270;
  --dark-1: #1a1b21;
  --dark-2: #212228;
  --dark-3: #3a4046;
  --dark-4: #6b7588;
  --dark-5: #8f90a6;
  --dark-6: #dedede;
  --light-1: #dde5e9;
  --light-2: #f0f1f7;
  --light-3: #f9faff;
  --light-4: #fafafc;
  --light-5: #fefeff;
  --radius: 8px;
  --radius-lg: 16px;
  --shadow: 0 2px 12px rgba(33, 34, 40, .06);
  --latin: "SF Pro Display", "SF UI Display", Roboto, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }

body {
  font-family: "Vazirmatn", Tahoma, sans-serif;
  color: var(--dark-2);
  background: var(--light-3);
  min-height: 100vh;
  line-height: 1.7;
  font-size: 14px;
  -webkit-tap-highlight-color: transparent;
}

/* ---------------- app bar (as in the app: title on the right, back chevron on the left) */
.appbar {
  position: sticky; top: 0; z-index: 5;
  background: #fff;
  box-shadow: 0 2px 10px rgba(33, 34, 40, .07);
}
.appbar-inner {
  max-width: 480px; margin: 0 auto; height: 56px; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.appbar h1 { font-size: 16px; font-weight: 700; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar .brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--dark-2); font-weight: 800; font-size: 16px; }
.appbar .brand img { width: 28px; height: 32px; }
.appbar .back {
  width: 36px; height: 36px; display: grid; place-items: center; color: var(--dark-2);
  border-radius: 50%; text-decoration: none;
}
.appbar .back svg { width: 22px; height: 22px; }

.page { max-width: 480px; margin: 0 auto; padding: 20px 16px 40px; }

.hero { margin: 4px 0 18px; }
.hero h2 { font-size: 22px; font-weight: 800; margin: 0; line-height: 1.5; }
.hero p { color: var(--dark-4); margin: 2px 0 0; font-size: 14px; }
.hero .eyebrow { color: var(--brand); font-weight: 700; font-size: 13px; margin: 0 0 2px; }

.card {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px 16px;
}

/* ---------------- inputs */
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 18px; }
.field label { font-size: 13px; color: var(--dark-3); font-weight: 500; }
.input {
  font: inherit; font-family: var(--latin); font-size: 18px; letter-spacing: 1px;
  text-align: center; direction: ltr;
  height: 50px; padding: 0 14px;
  border: 1px solid var(--light-1); border-radius: var(--radius);
  outline: none; background: #fff; color: var(--dark-2); width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--dark-5); letter-spacing: 0; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-lighter); }

/* ---------------- buttons (primary = orange with the darker "3D" bottom edge from the app) */
.btn {
  font: inherit; font-weight: 700; font-size: 15px;
  display: block; width: 100%; text-align: center; text-decoration: none;
  border: 0; border-radius: var(--radius);
  min-height: 48px; padding: 12px 16px; margin-top: 16px;
  cursor: pointer; color: #fff; background: var(--brand);
  box-shadow: 0 4px 0 var(--brand-press);
  transition: transform .08s, box-shadow .08s, opacity .2s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--brand-press); }
.btn[disabled] { background: var(--light-2); color: var(--dark-5); box-shadow: 0 4px 0 var(--light-1); cursor: default; transform: none; }
.btn.outline { background: #fff; color: var(--brand); border: 1px solid var(--brand); box-shadow: none; }
.btn.outline:active { transform: none; background: var(--brand-lighter); }
.link {
  display: block; text-align: center; margin-top: 16px; color: var(--brand); font-weight: 700; font-size: 13px;
  text-decoration: underline; text-underline-offset: 4px; background: none; border: 0; font-family: inherit; cursor: pointer; width: 100%;
}

.error {
  margin-top: 14px; background: #ffeeee; color: #c41f1f; border-radius: var(--radius);
  padding: 10px 12px; font-size: 13px; border-inline-start: 3px solid var(--error);
}
.error a { color: inherit; font-weight: 700; }

.rules { font-size: 12px; color: var(--dark-4); text-align: center; margin-top: 18px; }
.closed { text-align: center; padding: 36px 10px; color: var(--dark-4); }
.hidden { display: none !important; }

/* ---------------- SMS code + notices */
.otp { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--light-2); }
.otp p { margin: 0 0 10px; font-size: 13px; color: var(--dark-3); }
.otp-input { letter-spacing: 10px; font-size: 24px; }
.otp-links { display: flex; justify-content: space-between; }
.otp-links .link { width: auto; margin-top: 12px; }
.link[disabled] { color: var(--dark-5); text-decoration: none; cursor: default; }
.notice {
  background: #fff8db; color: #7a5b00; border-radius: var(--radius); padding: 8px 12px;
  font-size: 12px; margin: 0 0 12px; border-inline-start: 3px solid var(--warning);
}
.sheet .notice { margin: 8px 0; }

/* ---------------- wheel */
.wheel-wrap { position: relative; width: min(320px, 100%); margin: 8px auto 4px; aspect-ratio: 1; }
.wheel-wrap svg.wheel { width: 100%; height: 100%; transition: transform 5.2s cubic-bezier(.12, .7, .08, 1); filter: drop-shadow(0 8px 18px rgba(242, 102, 0, .18)); }
.wheel-pointer {
  position: absolute; top: -4px; left: 50%; transform: translateX(-50%); z-index: 2;
  width: 34px; height: 40px;
}
.wheel-hub {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 66px; height: 66px; border-radius: 50%; background: #fff;
  border: 4px solid var(--dark-2); display: grid; place-items: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .18);
}
.wheel-hub img { width: 30px; height: 34px; }

/* ---------------- scratch card */
.scratch {
  position: relative; width: 100%; aspect-ratio: 16 / 10; border-radius: var(--radius-lg); overflow: hidden;
  background: var(--brand-lighter); display: grid; place-items: center; text-align: center; user-select: none;
}
.scratch .prize { font-size: 30px; font-weight: 900; color: var(--brand-darker); padding: 0 12px; line-height: 1.5; }
.scratch .prize small { display: block; font-size: 13px; font-weight: 500; color: var(--brand-darker); opacity: .75; }
.scratch canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.scratch-hint { text-align: center; color: var(--dark-4); font-size: 13px; margin: 12px 0 0; }

/* ---------------- quiz (layout of the app's placement test) */
.ladder { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 4px; }
.ladder div {
  display: flex; justify-content: space-between; align-items: center; padding: 10px 12px;
  border-radius: var(--radius); background: var(--light-3); font-size: 13px; font-weight: 600;
}
.ladder b { color: var(--brand); }
.q-head { display: flex; justify-content: space-between; color: var(--dark-4); font-family: var(--latin); font-size: 15px; direction: ltr; }
.progress { height: 8px; background: var(--light-2); border-radius: 8px; overflow: hidden; margin: 8px 0 22px; }
.progress i { display: block; height: 100%; background: var(--brand); border-radius: 8px; transition: width .3s; }
.q-label { color: var(--dark-4); font-size: 13px; margin: 0 0 4px; }
.q-word { direction: ltr; text-align: left; font-family: var(--latin); font-size: 30px; font-weight: 700; margin: 0 0 20px; color: var(--dark-2); }
.options { display: flex; flex-direction: column; gap: 12px; }
.option {
  font: inherit; font-size: 15px; font-weight: 700; min-height: 50px; padding: 10px; border-radius: var(--radius);
  border: 1px solid var(--dark-3); background: #fff; cursor: pointer; color: var(--dark-2);
  transition: background .12s, color .12s;
}
.option.picked { background: var(--dark-3); color: #fff; }
.option:disabled { cursor: default; }
.timer-low { color: var(--error) !important; }

/* ---------------- result: bottom sheet like the app's "Daily Gift" */
.overlay {
  position: fixed; inset: 0; z-index: 10; background: rgba(26, 27, 33, .72);
  display: flex; align-items: flex-end; justify-content: center; animation: fade .25s;
}
.sheet {
  width: 100%; max-width: 480px; background: #fff; border-radius: 22px 22px 0 0;
  padding: 28px 20px calc(24px + env(safe-area-inset-bottom)); text-align: center;
  animation: up .35s cubic-bezier(.2, .9, .3, 1);
}
.sheet .big { font-size: 56px; line-height: 1.1; }
.sheet h2 { margin: 10px 0 4px; font-size: 20px; font-weight: 800; }
.sheet p { color: var(--dark-3); margin: 6px 0; font-size: 14px; }
.sheet .muted { color: var(--dark-4); font-size: 13px; }
.pill {
  display: inline-flex; gap: 8px; align-items: baseline; margin: 12px 0 4px; padding: 8px 22px;
  border-radius: 99px; background: var(--brand-lighter); color: var(--brand); font-weight: 800; font-size: 18px;
}
.code-box {
  direction: ltr; margin: 16px 0 6px; display: flex; align-items: center; gap: 8px;
  border: 1.5px dashed var(--brand); border-radius: 12px; padding: 8px 8px 8px 16px; background: #fff8f3;
}
.code-box b { flex: 1; text-align: left; font-family: var(--latin); font-size: 24px; letter-spacing: 3px; color: var(--dark-2); }
.code-box button {
  font: inherit; font-weight: 700; border: 0; background: var(--brand-lighter); color: var(--brand);
  border-radius: var(--radius); padding: 8px 14px; cursor: pointer;
}
.rows { display: flex; flex-direction: column; gap: 8px; margin: 16px 0 4px; text-align: right; }
.rows div { display: flex; justify-content: space-between; padding: 10px 14px; border-radius: var(--radius); background: var(--light-3); font-weight: 600; }
.rows b { color: var(--brand); }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 11; }

/* ---------------- home: colored cards like the app's "Levels" row */
.game-list { display: flex; flex-direction: column; gap: 14px; }
.game-link {
  position: relative; overflow: hidden; display: block; text-decoration: none; color: #fff;
  border-radius: var(--radius-lg); padding: 20px 18px; min-height: 104px;
  background: linear-gradient(110deg, var(--brand-subtle), var(--brand));
  box-shadow: 0 8px 20px -10px rgba(242, 102, 0, .7);
}
.game-link.kind-quiz { background: linear-gradient(110deg, #3bd98f, var(--success)); box-shadow: 0 8px 20px -10px rgba(6, 194, 112, .7); }
.game-link.kind-scratch { background: linear-gradient(110deg, #5a5cb3, var(--info)); box-shadow: 0 8px 20px -10px rgba(51, 53, 125, .7); }
.game-link b { display: block; font-size: 19px; font-weight: 800; }
.game-link span { display: block; font-size: 13px; opacity: .92; max-width: 75%; }
.game-link .icon { position: absolute; left: 14px; bottom: -6px; font-size: 58px; opacity: .9; transform: rotate(-12deg); }

@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(100%); } }

@media (prefers-reduced-motion: reduce) {
  .wheel-wrap svg.wheel { transition-duration: 1s; }
  .sheet, .overlay { animation: none; }
}
