/* Hafzeen — desert-oasis adventure theme (inspired by data/back-ground-sample.png) */
:root {
  --wood-900: #2a1407;
  --wood-800: #3d1f0c;
  --wood-700: #5a2f12;
  --wood-600: #7a4219;
  --wood-500: #a0602a;
  --leather: #8a4a20;
  --leather-hi: #ad6a33;
  --gold: #ffd35a;
  --gold-hi: #fff0a8;
  --gold-mid: #e9ae3c;
  --gold-dark: #a8701c;
  --lime: #b8f03e;
  --lime-dark: #2f5c0a;
  --cream: #fff4d8;
  --parch: #fbedc9;
  --parch-2: #efd29a;
  --ink: #3a1c09;
  --teal: #29a6cb;
  --sky: #8fd3f4;
  --ruby: #c62f3b;
  --ok: #5fbf3a;
  --ok-dark: #2e7a17;
  --bad: #e0483b;
  --stage-0: #8c7a68;
  --stage-1: #f0a63a;
  --stage-2: #39b2d6;
  --stage-3: #7fd83a;
  --radius: 16px;
  --font-ui: 'Baloo Bhaijaan 2', 'Segoe UI', system-ui, sans-serif;
  --font-title: 'Lilita One', 'Hafzeen Title AR', 'Baloo Bhaijaan 2', 'Arial Black', sans-serif;
  --font-quran: 'Amiri Quran', 'Amiri', 'Scheherazade New', 'Traditional Arabic', 'Noto Naskh Arabic', serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-ui);
  color: var(--cream);
  background: #3a6f9c;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
[hidden] { display: none !important; }

/* ---------- Scenery ---------- */
#scene { position: fixed; inset: 0; z-index: -2; }
#scene svg { width: 100%; height: 100%; display: block; }
#scene::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 40%, rgba(0,0,0,0) 40%, rgba(30,12,0,.45) 100%);
}
.cloud { animation: drift 90s linear infinite; }
.cloud.c2 { animation-duration: 140s; animation-delay: -40s; }
.cloud.c3 { animation-duration: 110s; animation-delay: -80s; }
@keyframes drift { from { transform: translateX(-300px); } to { transform: translateX(1500px); } }
.water-shine { animation: shimmer 4s ease-in-out infinite; }
@keyframes shimmer { 50% { opacity: .35; } }

/* ---------- Layout ---------- */
#app { max-width: 980px; margin: 0 auto; padding: 10px 16px calc(110px + env(safe-area-inset-bottom, 0px)); }
.screen { animation: screenIn .35s ease both; }
@keyframes screenIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.center { text-align: center; }
.mt { margin-top: 16px; }
.small { font-size: .85rem; opacity: .85; }

/* ---------- Wood & panels ---------- */
.wood {
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,.07) 0 2px, transparent 2px 11px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.04) 0 1px, transparent 1px 23px),
    linear-gradient(180deg, #8a4d20, #5e3112 60%, #4a250c);
  border: 3px solid var(--gold-mid);
  box-shadow: 0 0 0 3px var(--wood-900), 0 8px 20px rgba(0,0,0,.45), inset 0 2px 0 rgba(255,220,150,.35);
  border-radius: var(--radius);
}
.panel {
  position: relative;
  background:
    radial-gradient(ellipse at 50% 30%, var(--leather-hi), var(--leather) 55%, #6a3412 100%);
  border: 3px solid var(--gold-mid);
  border-radius: var(--radius);
  box-shadow:
    0 0 0 4px #4a240c, 0 0 0 7px #b8822c, 0 0 0 9px #3a1c08,
    0 14px 28px rgba(0,0,0,.5), inset 0 0 40px rgba(40,12,0,.55);
  padding: 18px;
  margin: 12px 9px 22px;
}
.panel::before, .panel::after {
  content: ''; position: absolute; top: -10px; width: 16px; height: 16px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ff8a8a, var(--ruby) 50%, #6b0f17);
  box-shadow: 0 0 0 3px var(--gold-mid), 0 2px 4px rgba(0,0,0,.6);
}
.panel::before { left: -10px; }
.panel::after { right: -10px; }
.panel.plain::before, .panel.plain::after { display: none; }
.panel-title {
  font-family: var(--font-title); font-weight: 400; letter-spacing: .5px;
  color: var(--lime); font-size: 1.45rem; margin: 0 0 6px; text-align: center;
  text-shadow: 0 2px 0 var(--lime-dark), 0 3px 6px rgba(0,0,0,.5);
}
.divider { height: 10px; margin: 6px auto 12px; width: 70%;
  background: radial-gradient(ellipse at center, var(--gold) 0 2px, transparent 3px) center/18px 10px repeat-x,
              linear-gradient(90deg, transparent, var(--gold-dark) 20%, var(--gold-dark) 80%, transparent) center/100% 2px no-repeat; }
.parch {
  background: radial-gradient(ellipse at 50% 35%, #fffaf0, var(--parch) 55%, var(--parch-2));
  color: var(--ink);
  border: 2px solid #c9953f;
  border-radius: 14px;
  box-shadow: inset 0 0 22px rgba(160,100,30,.35), 0 3px 0 #7a4a17;
  padding: 14px 16px;
}

/* ---------- Titles / text ---------- */
h1, h2, h3 { margin: 0; }
.title { font-family: var(--font-title); font-weight: 400; color: var(--gold); text-shadow: 0 2px 0 var(--wood-900), 0 0 12px rgba(0,0,0,.4); letter-spacing: .5px; }
.lime { color: var(--lime); text-shadow: 0 2px 0 var(--lime-dark), 0 3px 8px rgba(0,0,0,.5); font-family: var(--font-title); font-weight: 400; }
.gold { color: var(--gold); }
.ar { font-family: var(--font-quran); direction: rtl; unicode-bidi: isolate; }
.ayah-text { font-family: var(--font-quran); direction: rtl; text-align: center; font-size: clamp(1.55rem, 4.6vw, 2.15rem); line-height: 2.25; word-spacing: .12em; }
.ayah-num { display: inline-grid; place-items: center; min-width: 1.6em; height: 1.6em; margin: 0 .2em; font-size: .62em; color: #7a4a17;
  background: radial-gradient(circle, #fff6dc 55%, transparent 57%), conic-gradient(from 0deg, #d39a3c 0 12.5%, #f1cc7a 0 25%, #d39a3c 0 37.5%, #f1cc7a 0 50%, #d39a3c 0 62.5%, #f1cc7a 0 75%, #d39a3c 0 87.5%, #f1cc7a 0);
  border-radius: 50%; font-family: var(--font-ui); font-weight: 700; vertical-align: middle; line-height: 1; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-title); font-size: 1.15rem; letter-spacing: .6px; color: var(--gold);
  text-shadow: 0 2px 0 var(--wood-900);
  padding: 10px 22px; min-height: 48px; border-radius: 14px;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,.08) 0 2px, transparent 2px 10px),
    linear-gradient(180deg, #b06c2f, #7d441a 55%, #5e3011);
  border: 3px solid var(--gold-mid);
  box-shadow: 0 0 0 2px var(--wood-900), 0 5px 0 2px #2a1205, 0 8px 16px rgba(0,0,0,.45), inset 0 2px 0 rgba(255,230,170,.4);
  transition: transform .08s, box-shadow .08s, filter .15s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 2px var(--wood-900), 0 1px 0 2px #2a1205, 0 3px 8px rgba(0,0,0,.4), inset 0 2px 0 rgba(255,230,170,.4); }
.btn[disabled] { filter: grayscale(.8) brightness(.8); pointer-events: none; }
.btn.green { background: linear-gradient(180deg, #8ad84a, #4f9e21 55%, #387a14); color: #fff; border-color: #e6ff9c; text-shadow: 0 2px 0 #1f4a08; }
.btn.small { font-size: .95rem; padding: 6px 14px; min-height: 38px; }
.btn.big { font-size: 1.9rem; padding: 12px 46px; min-height: 66px; border-radius: 18px; }
.btn.glow { animation: glow 1.8s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 2px var(--wood-900), 0 5px 0 2px #2a1205, 0 0 26px 6px rgba(255,211,90,.75), inset 0 2px 0 rgba(255,230,170,.4); } }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 1.3rem;
  background: radial-gradient(circle at 35% 30%, #b8732f, #6b3814); border: 3px solid var(--gold-mid); box-shadow: 0 0 0 2px var(--wood-900), 0 3px 6px rgba(0,0,0,.5); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-weight: 700;
  background: rgba(30,10,0,.45); border: 2px solid rgba(255,211,90,.55); font-size: .9rem; }
.chip.sel { background: var(--gold); color: var(--ink); border-color: var(--gold-hi); }
button.chip { min-height: 36px; }

/* ---------- HUD ---------- */
#hud { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; padding-top: 6px; }
.hud-bar { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; }
.avatar {
  --size: 54px; width: var(--size); height: var(--size); flex: none; border-radius: 50%; display: grid; place-items: center;
  font-size: calc(var(--size) * .58); line-height: 1;
  background: radial-gradient(circle at 50% 35%, #8fe0a0, #2f9a5a 70%, #1e6a3b);
  border: 3px solid var(--gold); box-shadow: 0 0 0 3px var(--wood-900), 0 0 0 5px var(--frame, #b8822c), 0 4px 10px rgba(0,0,0,.5);
  position: relative;
}
.avatar .lvl { position: absolute; bottom: -8px; right: -8px; min-width: 26px; height: 26px; padding: 0 5px; border-radius: 13px; font-size: .8rem;
  font-family: var(--font-title); color: var(--ink); background: var(--gold); border: 2px solid var(--wood-900); display: grid; place-items: center; }
.hud-name { min-width: 0; flex: 1; }
.hud-name b { display: block; font-family: var(--font-title); font-weight: 400; color: var(--gold); font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xpbar { height: 12px; border-radius: 8px; background: #2a1205; border: 2px solid #c48a2c; overflow: hidden; margin-top: 3px; }
.xpbar > i { display: block; height: 100%; background: linear-gradient(180deg, #e6ff8a, #8bd33a 50%, #4e9a1c); border-radius: 6px; transition: width .8s cubic-bezier(.2,.8,.2,1); }
.stat { display: flex; align-items: center; gap: 4px; font-family: var(--font-title); font-size: 1.05rem; color: var(--gold); text-shadow: 0 2px 0 var(--wood-900); white-space: nowrap; }
.stat .ic { font-size: 1.25rem; filter: drop-shadow(0 2px 0 rgba(0,0,0,.4)); }
.streak.lit .ic { animation: flick 1.2s ease-in-out infinite; }
@keyframes flick { 50% { transform: scale(1.15) rotate(-4deg); } }

/* ---------- Bottom nav ---------- */
#nav { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(8px + env(safe-area-inset-bottom, 0px)); z-index: 30;
  width: min(640px, calc(100% - 20px)); display: flex; justify-content: space-around; padding: 6px; }
#nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0; padding: 4px 2px; border-radius: 12px; font-family: var(--font-title); font-size: .78rem; color: #f0c98a; }
#nav button .ic { font-size: 1.55rem; line-height: 1.2; transition: transform .2s; }
#nav button.on { color: var(--gold); background: rgba(255,211,90,.16); box-shadow: inset 0 0 0 2px rgba(255,211,90,.5); }
#nav button.on .ic { transform: translateY(-3px) scale(1.15); }
#nav .dot { position: absolute; margin: -2px 0 0 26px; width: 12px; height: 12px; border-radius: 50%; background: var(--ruby); border: 2px solid var(--gold); }

/* ---------- Home ---------- */
.hero { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.hero .avatar { --size: 96px; }
.hero h1 { font-family: var(--font-title); font-weight: 400; font-size: 1.6rem; color: var(--gold); text-shadow: 0 2px 0 var(--wood-900); }
.hero .title-line { color: var(--lime); font-family: var(--font-title); text-shadow: 0 2px 0 var(--lime-dark); font-size: 1.05rem; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0 16px; }
.step { text-align: center; padding: 10px 4px; border-radius: 12px; background: rgba(30,10,0,.35); border: 2px dashed rgba(255,211,90,.35); position: relative; }
.step .ic { font-size: 1.8rem; display: block; }
.step b { font-family: var(--font-title); font-weight: 400; font-size: .9rem; color: var(--gold); display: block; line-height: 1.15; }
.step small { opacity: .75; font-size: .75rem; }
.step.done { border-style: solid; border-color: var(--lime); background: rgba(80,140,20,.3); }
.step.done::after { content: '✔'; position: absolute; top: -10px; right: -6px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ok); color: #fff; border: 2px solid var(--gold-hi); font-size: .9rem; }
.step.now { border-style: solid; border-color: var(--gold); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 18px rgba(255,211,90,.6); } }
.quest { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 6px 0; }
.quest .ic { font-size: 1.5rem; text-align: center; }
.quest .t { font-weight: 700; line-height: 1.2; }
.bar { height: 14px; border-radius: 8px; background: #2a1205; border: 2px solid #9a6a24; overflow: hidden; margin-top: 4px; }
.bar > i { display: block; height: 100%; background: linear-gradient(180deg, #ffe58a, #f0b43a 60%, #c9861c); transition: width .6s; }
.bar.lime > i { background: linear-gradient(180deg, #e6ff8a, #8bd33a 60%, #4e9a1c); }
.quest.ok .t { text-decoration: line-through; opacity: .7; }
.stack { display: flex; height: 22px; border-radius: 11px; overflow: hidden; border: 2px solid var(--gold-mid); background: #2a1205; }
.stack > i { display: block; height: 100%; transition: width .6s; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .85rem; margin-top: 8px; }
.legend span::before { content: ''; display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-inline-end: 5px; background: var(--c); vertical-align: -1px; }
.big-num { font-family: var(--font-title); font-size: 2.2rem; color: var(--gold); line-height: 1; text-shadow: 0 3px 0 var(--wood-900); }
.gift {
  position: fixed; right: 16px; bottom: calc(100px + env(safe-area-inset-bottom, 0px)); z-index: 25; font-size: 2.6rem; width: 74px; height: 74px; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #ffe9a0, #e9a43a 60%, #a8651a); border: 4px solid var(--gold-hi);
  box-shadow: 0 0 0 3px var(--wood-900), 0 0 30px rgba(255,220,100,.8); animation: bob 1.4s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(-8px) rotate(6deg); } }

/* ---------- League ---------- */
.league-row { display: grid; grid-template-columns: 32px 36px 1fr auto; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 10px; }
.league-row:nth-child(odd) { background: rgba(30,10,0,.25); }
.league-row.me { background: linear-gradient(90deg, rgba(255,211,90,.35), rgba(255,211,90,.1)); outline: 2px solid var(--gold); }
.league-row .rk { font-family: var(--font-title); color: var(--gold); text-align: center; }
.league-row .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.league-row .tag { font-size: .7rem; padding: 0 6px; border-radius: 6px; background: rgba(0,0,0,.3); margin-inline-start: 4px; font-weight: 500; opacity: .8; }
.league-row.promo .rk { color: var(--lime); }
.zone { font-size: .75rem; text-align: center; color: var(--lime); border-top: 2px dashed rgba(184,240,62,.5); margin: 4px 0; padding-top: 2px; }

/* ---------- Mode cards ---------- */
.modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.mode-card { text-align: center; padding: 16px 12px; border-radius: 16px; cursor: pointer; transition: transform .15s; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.mode-card:hover { transform: translateY(-4px) rotate(-.5deg); }
.mode-card .ic { font-size: 2.6rem; filter: drop-shadow(0 3px 0 rgba(0,0,0,.4)); }
.mode-card h3 { font-family: var(--font-title); font-weight: 400; color: var(--lime); text-shadow: 0 2px 0 var(--lime-dark); font-size: 1.2rem; }
.mode-card p { margin: 0; font-size: .88rem; opacity: .9; line-height: 1.3; }
.mode-card .chip { margin-top: 6px; }

/* ---------- Journey map ---------- */
.map { position: relative; padding: 10px 0 30px; }
.map svg.path { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.node-row { position: relative; height: 112px; }
.node { position: absolute; transform: translateX(-50%); width: 92px; display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.node .disc { width: 70px; height: 70px; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: radial-gradient(circle at 40% 35%, #c88a45, #7a4219 70%); border: 4px solid var(--gold-mid); box-shadow: 0 0 0 3px var(--wood-900), 0 6px 12px rgba(0,0,0,.5);
  font-family: var(--font-title); font-size: 1.3rem; color: var(--gold); text-shadow: 0 2px 0 var(--wood-900); }
.node .ring { position: absolute; inset: -9px; border-radius: 50%; background: conic-gradient(var(--stage-3) 0 var(--m), var(--stage-1) var(--m) var(--l), rgba(0,0,0,.35) var(--l) 100%);
  -webkit-mask: radial-gradient(circle, transparent 42px, #000 43px); mask: radial-gradient(circle, transparent 42px, #000 43px); }
.node .lbl { margin-top: 6px; font-family: var(--font-quran); font-size: 1.05rem; color: var(--cream); text-shadow: 0 2px 3px #000, 0 0 6px #000; white-space: nowrap; line-height: 1.2; }
.node .en { font-size: .72rem; color: #ffe7b0; text-shadow: 0 1px 2px #000; }
.node.locked .disc { filter: grayscale(1) brightness(.6); }
.node.done .disc { background: radial-gradient(circle at 40% 35%, #b8f06a, #4f9e21 70%); color: #fff; }
.node.current .disc { animation: pulse 1.6s infinite; }
.node .me { position: absolute; top: -34px; font-size: 2rem; animation: bob 1.4s ease-in-out infinite; }
.group-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px; border-radius: 12px; background: rgba(30,10,0,.3); margin-bottom: 8px; }
.dots { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.dots i { width: 14px; height: 14px; border-radius: 4px; background: var(--c); border: 1px solid rgba(0,0,0,.4); }

/* ---------- Game round ---------- */
.round-top { display: flex; align-items: center; gap: 10px; padding: 6px 10px; margin-bottom: 10px; }
.pips { flex: 1; display: flex; gap: 4px; }
.pips i { flex: 1; height: 10px; border-radius: 5px; background: rgba(0,0,0,.45); border: 1px solid rgba(255,211,90,.35); }
.pips i.ok { background: var(--ok); } .pips i.bad { background: var(--bad); } .pips i.cur { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.combo { font-family: var(--font-title); color: #ffb03a; text-shadow: 0 2px 0 #5a1d00; font-size: 1.15rem; min-width: 64px; text-align: center; transition: transform .2s; }
.combo.hot { animation: comboPop .4s ease; color: #ff7a2a; }
@keyframes comboPop { 40% { transform: scale(1.5) rotate(-6deg); } }
.q-head { text-align: center; margin-bottom: 8px; }
.q-head h2 { font-family: var(--font-title); font-weight: 400; color: var(--lime); text-shadow: 0 2px 0 var(--lime-dark), 0 3px 8px rgba(0,0,0,.5); font-size: 1.5rem; }
.q-head .sub { display: inline-flex; gap: 8px; align-items: center; margin-top: 4px; }
.blank { display: inline-block; min-width: 3.2em; height: 1.35em; vertical-align: middle; margin: 0 .15em; border-radius: 10px;
  background: rgba(240,170,60,.25); border: 3px dashed #c47d1c; animation: blink 1.2s ease-in-out infinite; }
.blank.next { animation: none; opacity: .5; }
@keyframes blink { 50% { background: rgba(240,170,60,.5); } }
.filled { color: var(--ok-dark); animation: popIn .4s ease; display: inline-block; }
.filled.miss { color: var(--bad); }
@keyframes popIn { 0% { transform: scale(.3); opacity: 0; } 70% { transform: scale(1.25); } }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.options.one { grid-template-columns: 1fr; }
.opt {
  font-family: var(--font-quran); direction: rtl; font-size: clamp(1.35rem, 4.2vw, 1.8rem); line-height: 1.9; color: var(--ink);
  padding: 8px 14px; min-height: 62px; border-radius: 14px;
  background: linear-gradient(180deg, #fff6dc, #f2d69c); border: 3px solid #b77a2a;
  box-shadow: 0 5px 0 #7a4a17, 0 8px 14px rgba(0,0,0,.35); transition: transform .08s, box-shadow .08s, opacity .3s;
}
.opt:active { transform: translateY(4px); box-shadow: 0 1px 0 #7a4a17, 0 3px 8px rgba(0,0,0,.3); }
.opt.ok { background: linear-gradient(180deg, #d9ffb5, #8ad84a); border-color: var(--ok-dark); animation: popIn .35s; }
.opt.bad { background: linear-gradient(180deg, #ffd0c9, #f08a7e); border-color: #8a1d14; animation: shake .4s; }
.opt.gone { opacity: .25; pointer-events: none; }
.opt.long { font-size: clamp(1.15rem, 3.6vw, 1.5rem); text-align: center; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.shake { animation: shake .4s; }
.tools { display: flex; justify-content: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.hint-note { font-size: .8rem; opacity: .8; }
.tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; direction: rtl; margin-top: 14px; }
.tile { font-family: var(--font-quran); font-size: clamp(1.25rem, 4vw, 1.65rem); line-height: 1.8; color: var(--ink); padding: 4px 14px; border-radius: 12px;
  background: linear-gradient(180deg, #fff6dc, #f2d69c); border: 3px solid #b77a2a; box-shadow: 0 4px 0 #7a4a17; transition: transform .1s; }
.tile:active { transform: translateY(3px); box-shadow: 0 1px 0 #7a4a17; }
.tile.used { visibility: hidden; }
.tile.bad { animation: shake .4s; background: #f8b4aa; }
.answer-line { min-height: 4.2em; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 10px; direction: rtl; }
.answer-line .placed { font-family: var(--font-quran); font-size: clamp(1.35rem, 4.4vw, 1.9rem); animation: popIn .3s; color: var(--ink); }
.answer-line .ctx { font-family: var(--font-quran); font-size: clamp(1.2rem, 4vw, 1.6rem); opacity: .45; }
.slot { display: inline-block; height: 1.1em; border-radius: 8px; background: repeating-linear-gradient(90deg, #d8a659 0 6px, #c48a3c 6px 9px); vertical-align: middle; opacity: .8; }
.slot.cur { background: rgba(240,170,60,.35); border: 3px dashed #c47d1c; animation: blink 1.2s infinite; }
.timer { font-family: var(--font-title); color: var(--gold); min-width: 54px; text-align: center; }

/* feedback sheet */
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; padding: 16px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateY(110%); transition: transform .3s cubic-bezier(.2,.9,.3,1.2); }
.sheet:not(.show) { visibility: hidden; transition: transform .3s, visibility 0s .3s; }
.sheet.show { transform: none; }
.sheet .inner { max-width: 760px; margin: 0 auto; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 18px; border-radius: 18px; border: 3px solid var(--gold-hi); box-shadow: 0 0 0 3px var(--wood-900), 0 -6px 24px rgba(0,0,0,.4); }
.sheet.good .inner { background: linear-gradient(180deg, #6fcf3a, #3f8f1a); }
.sheet.bad .inner { background: linear-gradient(180deg, #e66a4a, #a8321f); }
.sheet .msg { flex: 1; min-width: 200px; }
.sheet .msg b { font-family: var(--font-title); font-weight: 400; font-size: 1.5rem; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.35); display: block; }
.sheet .msg .ar { font-size: 1.4rem; line-height: 1.8; display: block; }
.sheet .reward { font-family: var(--font-title); color: var(--gold-hi); text-shadow: 0 2px 0 rgba(0,0,0,.4); font-size: 1.2rem; }

/* ---------- Learn ---------- */
.learn-card { margin-bottom: 14px; cursor: pointer; transition: transform .1s; position: relative; }
.learn-card:active { transform: scale(.985); }
.beads { display: flex; justify-content: center; gap: 8px; margin-top: 6px; }
.beads i { width: 16px; height: 16px; border-radius: 50%; background: #d8bf8e; border: 2px solid #a8701c; }
.beads i.on { background: radial-gradient(circle at 35% 35%, #e6ff8a, #4e9a1c); border-color: var(--ok-dark); animation: popIn .3s; }
.hidden-word { display: inline-block; border-radius: 8px; background: linear-gradient(180deg, #e2b866, #c48a3c); color: transparent; cursor: pointer; padding: 0 .1em; line-height: 1.2; }
.hidden-word.peek { background: rgba(240,170,60,.3); color: var(--ink); }
.tabs { display: flex; justify-content: center; gap: 8px; margin: 6px 0 14px; flex-wrap: wrap; }

/* ---------- Results ---------- */
.stars { display: flex; justify-content: center; gap: 6px; font-size: 3.4rem; margin: 6px 0; }
.stars span { filter: grayscale(1) brightness(.5); transform: scale(.6); transition: .4s; }
.stars span.on { filter: drop-shadow(0 0 10px rgba(255,211,90,.8)); transform: scale(1); animation: starIn .6s ease both; }
.stars span:nth-child(2) { margin-top: -18px; }
@keyframes starIn { 0% { transform: scale(0) rotate(-90deg); } 70% { transform: scale(1.3) rotate(10deg); } 100% { transform: scale(1); } }
.reward-lines { display: grid; gap: 6px; max-width: 420px; margin: 10px auto; }
.reward-lines div { display: flex; justify-content: space-between; padding: 6px 12px; border-radius: 10px; background: rgba(30,10,0,.35); font-weight: 700; }
.reward-lines div b { color: var(--gold); font-family: var(--font-title); font-weight: 400; }
.promo-list { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }

/* ---------- Badges ---------- */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.badge { text-align: center; padding: 12px 8px; border-radius: 14px; background: rgba(30,10,0,.35); border: 2px solid rgba(255,211,90,.3); }
.badge .ic { font-size: 2.3rem; width: 64px; height: 64px; margin: 0 auto 4px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 40% 35%, #ffe9a0, #d99a32 60%, #8a5212); border: 3px solid var(--gold-hi); box-shadow: 0 0 0 2px var(--wood-900); }
.badge.locked .ic { filter: grayscale(1) brightness(.55); }
.badge b { display: block; font-family: var(--font-title); font-weight: 400; color: var(--gold); line-height: 1.15; font-size: .95rem; }
.badge small { display: block; font-size: .75rem; opacity: .85; line-height: 1.2; margin-top: 2px; }
.titles { display: flex; gap: 8px; overflow-x: auto; padding: 6px 2px 10px; }
.titles .t { flex: none; text-align: center; padding: 8px 12px; border-radius: 12px; background: rgba(30,10,0,.35); min-width: 110px; }
.titles .t.on { background: rgba(184,240,62,.25); outline: 2px solid var(--lime); }
.titles .t.lock { opacity: .5; }
.log { max-height: 320px; overflow-y: auto; }
.log div { display: flex; gap: 10px; padding: 6px 4px; border-bottom: 1px dashed rgba(255,211,90,.25); font-size: .92rem; }

/* ---------- Modal ---------- */
#modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(25,10,0,.72); animation: fadeIn .25s; overflow-y: auto; }
#modal .panel { width: min(560px, 100%); animation: zoomIn .35s cubic-bezier(.2,.9,.3,1.3); margin: 20px 9px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes zoomIn { from { transform: scale(.6); opacity: 0; } }
.title-art { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; }
.title-art .big { font-size: 5rem; filter: drop-shadow(0 4px 0 rgba(0,0,0,.4)); }
.title-art p { margin: 0; line-height: 1.5; font-size: 1.02rem; }
.chest { font-size: 6rem; display: block; margin: 0 auto; cursor: pointer; animation: bob 1.2s infinite; }
.chest.open { animation: chestOpen .6s ease forwards; }
@keyframes chestOpen { 30% { transform: scale(1.3) rotate(-10deg); } 60% { transform: scale(1.4) rotate(10deg); } 100% { transform: scale(1); } }
input[type=text] { font: inherit; font-size: 1.1rem; padding: 10px 14px; border-radius: 12px; border: 3px solid var(--gold-mid); background: var(--parch); color: var(--ink); width: 100%; user-select: text; }
.avatars { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px; }
.avatars button { position: relative; }
.avatars .avatar { --size: 60px; margin: 0 auto; }
.avatars button.sel .avatar { box-shadow: 0 0 0 3px var(--wood-900), 0 0 0 6px var(--lime), 0 0 16px var(--lime); }
.avatars button.lock .avatar { filter: grayscale(1) brightness(.5); }
.avatars button.lock::after { content: attr(data-req); position: absolute; left: 50%; bottom: -4px; transform: translateX(-50%); font-size: .7rem; background: var(--wood-900); padding: 0 6px; border-radius: 6px; white-space: nowrap; }

/* ---------- FX ---------- */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 80; }
.floater { position: fixed; z-index: 81; pointer-events: none; font-family: var(--font-title); font-size: 1.5rem; color: var(--gold-hi);
  text-shadow: 0 2px 0 var(--wood-900), 0 0 10px rgba(0,0,0,.5); animation: floatUp 1.2s ease-out forwards; white-space: nowrap; }
.floater.cp { color: #8fe8ff; }
@keyframes floatUp { 0% { transform: translate(-50%, 0) scale(.6); opacity: 0; } 15% { transform: translate(-50%, -10px) scale(1.15); opacity: 1; } 100% { transform: translate(-50%, -90px) scale(1); opacity: 0; } }
#toasts { position: fixed; top: calc(10px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; width: min(420px, calc(100% - 32px)); pointer-events: none; }
.toast { display: flex; gap: 12px; align-items: center; padding: 10px 14px; animation: toastIn .4s cubic-bezier(.2,.9,.3,1.3), toastOut .4s ease 3.4s forwards; }
.toast .ic { font-size: 2rem; }
.toast b { font-family: var(--font-title); font-weight: 400; color: var(--lime); display: block; text-shadow: 0 2px 0 var(--lime-dark); }
@keyframes toastIn { from { transform: translateY(-40px) scale(.8); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(-30px); opacity: 0; } }

@media (max-width: 560px) {
  #app { padding-left: 16px; padding-right: 16px; }
  .panel { padding: 14px 12px; }
  .hero { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .options { grid-template-columns: 1fr; }
  .hud-bar .stat.cpstat { display: none; }
  .btn.big { font-size: 1.6rem; padding: 10px 34px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Language: Arabic UI (right-to-left) ---------- */
.lang-btn { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--gold); background: rgba(0,0,0,.28);
  color: var(--gold); font-family: var(--font-ui); font-weight: 800; font-size: 1rem; line-height: 1; cursor: pointer; }
.lang-btn:hover { filter: brightness(1.15); }
[dir="rtl"] body { font-size: 1.04em; }
[dir="rtl"] .gift { right: auto; left: 16px; }
[dir="rtl"] .hud-name b, [dir="rtl"] .panel-title, [dir="rtl"] .btn, [dir="rtl"] .hero h1 { letter-spacing: 0; }
[dir="rtl"] .xpbar i, [dir="rtl"] .bar i { margin-inline-start: 0; }
/* Keep "+130 XP", "0 / 100 XP" etc. reading left-to-right inside Arabic text */
[dir="rtl"] .reward-lines b, [dir="rtl"] .sheet .reward, [dir="rtl"] .floater, [dir="rtl"] .big-num,
[dir="rtl"] .hud-name .small, [dir="rtl"] .xp-txt, [dir="rtl"] .toast .small, [dir="rtl"] .mode-card .chip { unicode-bidi: plaintext; }

/* Secret love note (Profile) */
.secret-tap { cursor: default; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.love { text-align: center; }
.love-hearts { font-size: 2.6rem; animation: lovePulse 1.4s ease-in-out infinite; }
.love-names { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 14px; margin: 6px 0 12px; }
.love-names span { font-family: var(--font-title); font-size: 1.6rem; color: var(--gold); text-shadow: 0 2px 0 var(--wood-900);
  padding: 2px 16px; border-radius: 999px; background: rgba(255, 211, 90, .12); border: 2px solid rgba(255, 211, 90, .45); }
.love-text { font-size: 1.12rem; line-height: 1.75; margin: 0 auto; max-width: 30em; }
@keyframes lovePulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .love-hearts { animation: none; } }
