:root {
  --cream: #EFF6FF;
  --paper: #FFFDF9;
  --ink: #1E1E1F;
  --dark: #2A2A2C;
  --muted: #8E8980;
  --line: #E9E3D8;
  --grey: #EFEAE2;
  --pink: #EE6CC8;
  --pink-d: #D24DAE;
  --pink-l: #FBD9F1;
  --green: #3F9C4A;
  --green-d: #2F7F39;
  --green-l: #DDF1DA;
  --blue: #2C6BE0;
  --blue-l: #D9E6FB;
  --yellow: #F4C247;
  --yellow-l: #FCEFC8;
  --orange: #F29A3B;
  --r-lg: 28px;
  --r-md: 20px;
  --ar: "Amiri Quran", "Scheherazade New", "Traditional Arabic", serif;
  --ui: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--ui);
  color: var(--ink);
  background: #DDE8F7;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
input { font: inherit; }

.app {
  position: relative;
  max-width: 440px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--cream);
  overflow-x: hidden;
}
@media (min-width: 520px) {
  .app { box-shadow: 0 0 0 1px #0000000a, 0 30px 80px -20px #0000002e; }
}

.screen { min-height: 100dvh; display: flex; flex-direction: column; padding: 18px 20px calc(24px + var(--safe-b)); animation: in .32s ease both; }
.screen.pink { background: var(--pink); color: #fff; }
.screen.has-nav { padding-bottom: calc(110px + var(--safe-b)); }
@keyframes in { from { opacity: 0; } to { opacity: 1; } }
@keyframes up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.ar { font-family: var(--ar); direction: rtl; line-height: 2.05; font-weight: 400; }

/* ---------- Typography ---------- */
.h1 { font-size: 34px; line-height: 1.05; font-weight: 800; letter-spacing: -.035em; margin: 0; }
.h2 { font-size: 27px; line-height: 1.1; font-weight: 800; letter-spacing: -.03em; margin: 0; }
.h3 { font-size: 19px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.sub { color: var(--muted); font-size: 13.5px; line-height: 1.45; margin: 6px 0 0; font-weight: 500; }
.pink .sub { color: #ffffffd0; }

/* ---------- Buttons ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 56px; border-radius: 999px;
  background: var(--dark); color: #fff; font-weight: 700; font-size: 16px; letter-spacing: -.01em;
  transition: transform .12s ease, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .35; pointer-events: none; }
.btn.outline { background: transparent; color: var(--ink); border: 1.5px solid var(--dark); }
.btn.white { background: #fff; color: var(--ink); }
.btn.pink { background: var(--pink); }
.btn.green { background: var(--green); }
.btn.sm { height: 44px; font-size: 14px; }
.btn-row { display: flex; gap: 10px; }
.bottom { margin-top: auto; padding-top: 18px; display: grid; gap: 10px; }

.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; border: 1.5px solid var(--line); flex: none;
}
.pink .icon-btn { background: #ffffff2b; border-color: transparent; color: #fff; }
.icon-btn svg { width: 20px; height: 20px; }

.topbar { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.topbar .grow { flex: 1; }
.progress { height: 6px; width: 96px; border-radius: 9px; background: var(--grey); overflow: hidden; margin: 6px auto 22px; }
.progress > i { display: block; height: 100%; background: var(--green); border-radius: 9px; transition: width .4s ease; }
.progress.wide { width: auto; flex: 1; margin: 0; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px;
  border-radius: 999px; border: 1.5px solid var(--dark); font-size: 13px; font-weight: 600; background: transparent;
}
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: #ffffff3a; font-size: 12px; font-weight: 700; }

/* ---------- Splash ---------- */
.splash {
  position: relative; overflow: hidden; color: #fff; justify-content: center; align-items: center; cursor: pointer;
  background: linear-gradient(165deg, #1B0838 0%, #3D1170 30%, #7A1F9E 58%, #C93CA8 82%, #FF6FB8 100%);
}
.space { position: absolute; inset: 0; pointer-events: none; }
.nebula { position: absolute; border-radius: 50%; filter: blur(50px); opacity: .75; animation: drift 14s ease-in-out infinite alternate; }
.nebula.n1 { width: 70vmax; height: 70vmax; left: -30vmax; top: -24vmax; background: radial-gradient(circle, #FF5FC8 0%, #FF5FC800 65%); }
.nebula.n2 { width: 60vmax; height: 60vmax; right: -28vmax; top: 14%; background: radial-gradient(circle, #8B5CFF 0%, #8B5CFF00 65%); animation-delay: -5s; }
.nebula.n3 { width: 80vmax; height: 50vmax; left: -10vmax; bottom: -26vmax; background: radial-gradient(circle, #FF8AD0 0%, #B44CFF55 40%, #B44CFF00 70%); animation-delay: -9s; }
@keyframes drift { to { transform: translate(4vmax, 3vmax) scale(1.08); } }
.stars i { position: absolute; border-radius: 50%; background: #fff; box-shadow: 0 0 6px #fff; animation: twinkle 2.5s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: .25; transform: scale(.7); } 50% { opacity: 1; transform: scale(1.15); } }
.shoot { position: absolute; width: 120px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, #fff, #ffffff00); transform: rotate(-28deg); opacity: 0; animation: shoot 5s ease-in infinite; }
.shoot.s1 { top: 16%; left: 58%; animation-delay: .8s; }
.shoot.s2 { top: 52%; left: 70%; animation-delay: 3.2s; }
@keyframes shoot { 0% { opacity: 0; translate: 0 0; } 4% { opacity: 1; } 16% { opacity: 0; translate: -260px 140px; } 100% { opacity: 0; translate: -260px 140px; } }
.planet { position: absolute; width: clamp(150px, 42vmin, 300px); right: -6%; top: 7%; filter: drop-shadow(0 0 30px #FF8FD066); animation: floaty 7s ease-in-out infinite; }
.moon { position: absolute; width: clamp(56px, 14vmin, 96px); left: 9%; top: 12%; filter: drop-shadow(0 0 18px #FFE7A080); animation: floaty 6s ease-in-out -2s infinite; }
.rocket { position: absolute; width: clamp(86px, 22vmin, 150px); left: 6%; bottom: 11%; filter: drop-shadow(0 10px 18px #2a0a4a88); animation: fly 4s ease-in-out infinite; }
@keyframes floaty { 50% { transform: translateY(-10px) rotate(3deg); } }
@keyframes fly { 50% { transform: translate(8px, -14px); } }
.sparkle { position: absolute; color: #FFE6F7; text-shadow: 0 0 12px #fff; animation: twinkle 2.2s ease-in-out infinite; }
.sparkle.a { right: 18%; bottom: 22%; font-size: 26px; }
.sparkle.b { left: 22%; top: 34%; font-size: 16px; animation-delay: .7s; }
.sparkle.c { right: 30%; top: 40%; font-size: 20px; animation-delay: 1.3s; }
.splash .brand { position: relative; z-index: 2; text-align: center; }
.splash .logo { margin: 0; font-size: clamp(88px, 30vw, 150px); font-weight: 800; letter-spacing: -.06em; line-height: .9; text-shadow: 0 0 40px #FF7FD4aa, 0 6px 30px #3a0b6a80; animation: rise .7s cubic-bezier(.2,.9,.3,1.2) both; }
.splash .tagline { margin: 14px 0 0; font-size: 19px; font-weight: 600; letter-spacing: -.01em; opacity: .95; text-shadow: 0 2px 12px #3a0b6a90; animation: rise .7s .18s cubic-bezier(.2,.9,.3,1.2) both; }

/* seamless drifting star tile (moves exactly one tile per loop) */
.starfield { position: absolute; inset: -160px; opacity: .55;
  background-image:
    radial-gradient(1.2px 1.2px at 20px 30px, #fff 99%, transparent),
    radial-gradient(1px 1px at 90px 70px, #fff 99%, transparent),
    radial-gradient(1.6px 1.6px at 130px 20px, #ffe6f7 99%, transparent),
    radial-gradient(1px 1px at 50px 120px, #fff 99%, transparent),
    radial-gradient(1.3px 1.3px at 140px 140px, #e8d8ff 99%, transparent);
  background-size: 160px 160px; animation: starDrift 24s linear infinite; }
@keyframes starDrift { from { transform: translate(0, 0); } to { transform: translate(-160px, 160px); } }

/* Onboarding header: nebula version */
.hero.nebula-hero { background: linear-gradient(165deg, #1B0838 0%, #3D1170 32%, #7A1F9E 60%, #C93CA8 84%, #FF6FB8 100%); }
.hero.nebula-hero::before, .hero.nebula-hero::after { display: none; }
.space.mini .nebula { filter: blur(40px); opacity: .6; }
.space.mini .nebula.n1 { background: radial-gradient(circle, #8B5CFF 0%, #8B5CFF00 65%) !important; }
.space.mini .nebula.n2 { background: radial-gradient(circle, #FF5FC8 0%, #FF5FC800 65%) !important; opacity: .45; }
.space.mini .nebula.n3 { background: radial-gradient(circle, #FF8AD0 0%, #B44CFF44 40%, #B44CFF00 70%) !important; opacity: .5; }
.space.mini .nebula.n1 { width: 420px; height: 420px; left: -200px; top: -200px; }
.space.mini .nebula.n2 { width: 360px; height: 360px; right: -160px; top: 20%; }
.space.mini .nebula.n3 { width: 520px; height: 300px; left: 10%; bottom: -180px; }
.space.mini .planet { width: auto; height: 62%; right: auto; left: 50%; top: 50%; translate: -50% -50%; }
.space.mini .moon { width: 13%; max-width: 70px; left: 8%; top: 12%; }
.space.mini .rocket { width: 64px; left: 50%; top: 50%; bottom: auto; margin: -32px 0 0 -32px; animation: orbit 9s linear infinite; }
@keyframes orbit {
  from { transform: rotate(0deg) translateX(var(--orbit, min(140px, 17dvh))) rotate(135deg); }
  to   { transform: rotate(360deg) translateX(var(--orbit, min(140px, 17dvh))) rotate(135deg); }
}
.space.mini .shoot.s1 { top: 18%; left: 70%; }
.space.mini .shoot.s2 { top: 62%; left: 88%; }
.space.mini .sparkle.a { right: 10%; bottom: 16%; }
.space.mini .sparkle.b { left: 16%; top: 60%; }
.space.mini .sparkle.c { right: 18%; top: 16%; }
@media (min-width: 640px) { .space.mini .rocket { width: 80px; margin: -40px 0 0 -40px; --orbit: min(200px, 17dvh); } }
@media (prefers-reduced-motion: reduce) { .space * { animation: none !important; } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ---------- Hero (pink) ---------- */
.hero { margin: -18px -20px 0; height: 46dvh; min-height: 300px; background: var(--pink); border-radius: 0 0 44px 44px; position: relative; overflow: hidden; display: grid; place-items: center; }
.hero::before { content: ""; position: absolute; width: 300px; height: 300px; border-radius: 50%; background: #ffffff1f; left: -80px; top: -60px; }
.hero::after { content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%; background: #ffffff14; right: -70px; bottom: -40px; }
@keyframes bob2 { 50% { transform: translateY(-8px) rotate(2deg); } }
.center { text-align: center; }

.field {
  display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 20px;
  border: 1.5px solid var(--dark); border-radius: 999px; background: #fff;
}
.field input { border: 0; outline: 0; flex: 1; font-size: 16px; font-weight: 600; background: transparent; min-width: 0; }
.field svg { width: 18px; height: 18px; opacity: .55; }

/* ---------- Juz bubbles ---------- */
.presets { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 6px; }
.preset { height: 34px; padding: 0 14px; border-radius: 999px; background: #fff; border: 1.5px solid var(--line); font-size: 13px; font-weight: 700; }
.preset.on { background: var(--dark); color: #fff; border-color: var(--dark); }
.bubbles { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 6px; padding: 12px 0 8px; }
.bubble {
  border-radius: 50%; display: grid; place-items: center; text-align: center;
  background: var(--grey); color: #B9B3A9; font-weight: 700; transition: transform .2s cubic-bezier(.3,1.6,.5,1), background .2s;
  line-height: 1.05;
}
.bubble b { display: block; font-size: 1.15em; font-weight: 800; }
.bubble small { display: block; font-size: 9px; font-weight: 600; opacity: .85; max-width: 90%; margin: 2px auto 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.bubble.on { color: #fff; transform: scale(1.06); }
.bubble.on.c0 { background: var(--pink); } .bubble.on.c1 { background: var(--green); }
.bubble.on.c2 { background: var(--blue); } .bubble.on.c3 { background: var(--yellow); color: #5a3d00; }
.sel-sum { text-align: center; font-size: 13px; font-weight: 600; color: var(--muted); }

/* ---------- Plan cards ---------- */
.plans { display: grid; gap: 12px; }
.plan {
  display: flex; align-items: center; gap: 16px; padding: 18px; border-radius: var(--r-md);
  border: 1.5px solid #CFE6CB; background: #fff; text-align: left; transition: background .2s, color .2s;
}
.plan .emo { font-size: 34px; width: 44px; text-align: center; }
.plan b { display: block; font-size: 15px; }
.plan span { font-size: 12.5px; color: var(--muted); font-weight: 500; line-height: 1.35; display: block; margin-top: 2px; }
.plan.on { background: var(--green); border-color: var(--green); color: #fff; }
.plan.on span { color: #ffffffd9; }

/* ---------- Loading swirl ---------- */
.swirl { width: 230px; height: 230px; position: relative; margin: auto; animation: spin 7s linear infinite; }
.swirl i { position: absolute; left: 50%; top: 50%; width: 46px; height: 112px; margin: -112px 0 0 -23px; transform-origin: 50% 100%; border-radius: 50% 50% 46% 46%; box-shadow: inset 0 0 12px #ffffff80, 0 4px 10px #0000001a; }
@keyframes spin { to { transform: rotate(360deg); } }
.screen.loading { position: relative; overflow: hidden; justify-content: space-between; background: linear-gradient(165deg, #1B0838 0%, #3D1170 30%, #7A1F9E 58%, #C93CA8 82%, #FF6FB8 100%); }
.loading .load-top, .loading .load-bot { position: relative; z-index: 2; }
.loading .h2 { color: #fff; text-align: center; margin-top: 40px; text-shadow: 0 4px 20px #3a0b6a90; }
.space.load .planet { height: auto; width: min(62vw, 300px); }
.load-bar { width: 180px; height: 6px; border-radius: 9px; background: #ffffff33; margin: 0 auto 10px; overflow: hidden; }
.load-bar i { display: block; height: 100%; width: 0; border-radius: 9px; background: linear-gradient(90deg, #FFD3A8, #FF8FD0); animation: loadfill 2.5s ease-in-out forwards; }
@keyframes loadfill { to { width: 100%; } }

/* ---------- Home ---------- */
.hello { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 6px 0 14px; }
.hello .h2 { font-size: 26px; }
.hello small { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.add { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10px; font-weight: 700; color: var(--muted); }
.add i { width: 46px; height: 46px; border-radius: 14px; background: var(--blue); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 16px -6px #2c6be080; }
.add i svg { width: 22px; height: 22px; }
.materi-pill { width: 100%; justify-content: center; margin-bottom: 14px; }

.dash { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.dash .mode { grid-column: 1 / -1; margin-bottom: 0; }
.nav-brand { display: none; }
.stat { border-radius: var(--r-md); padding: 14px 14px 16px; color: #fff; text-align: center; position: relative; }
.stat.g { background: var(--green); } .stat.p { background: var(--pink); }
.stat h4 { margin: 0 0 8px; font-size: 14px; font-weight: 700; }
.ring { width: 92px; height: 92px; margin: 0 auto; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .v { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-weight: 800; font-size: 22px; line-height: 1; }
.ring .v small { display: block; font-size: 10px; font-weight: 600; opacity: .85; margin-top: 3px; }

.section-t { display: flex; justify-content: space-between; align-items: baseline; margin: 18px 2px 10px; }
.section-t h3 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.section-t span { font-size: 12px; color: var(--muted); font-weight: 600; }

.mode {
  position: relative; display: flex; align-items: center; width: 100%; text-align: left; overflow: hidden;
  border-radius: var(--r-md); padding: 16px 16px 16px 18px; margin-bottom: 12px; color: #fff; min-height: 104px;
  transition: transform .12s;
}
.mode:active { transform: scale(.98); }
.mode.c0 { background: var(--pink); } .mode.c1 { background: var(--green); }
.mode.c2 { background: var(--yellow); color: #4b3500; } .mode.c3 { background: var(--blue); }
.mode .txt { flex: 1; position: relative; z-index: 1; }
.mode b { display: block; font-size: 21px; font-weight: 800; letter-spacing: -.03em; }
.mode p { margin: 3px 0 10px; font-size: 12.5px; opacity: .9; font-weight: 500; max-width: 210px; line-height: 1.35; }
.mode .meta { display: inline-flex; align-items: center; gap: 6px; }
.mode .meta span { background: #ffffff38; border-radius: 10px; padding: 5px 9px; font-size: 11px; font-weight: 700; }
.mode .meta em { width: 26px; height: 26px; border-radius: 9px; background: #ffffff38; display: grid; place-items: center; font-style: normal; }
.mode .emo { font-size: 64px; line-height: 1; filter: drop-shadow(0 8px 10px #00000030); transform: rotate(-8deg); margin-right: 4px; }
.mode .tag { position: absolute; top: 12px; right: 12px; background: #fff; color: var(--ink); font-size: 10px; font-weight: 800; padding: 4px 8px; border-radius: 8px; z-index: 2; }
.mode.big { min-height: 132px; }
.mode.big b { font-size: 25px; }

.resume { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--r-md); background: #fff; border: 1.5px solid var(--line); width: 100%; text-align: left; margin-bottom: 12px; }
.resume .ic { width: 44px; height: 44px; border-radius: 14px; background: var(--yellow-l); display: grid; place-items: center; font-size: 22px; }
.resume b { display: block; font-size: 15px; }
.resume span { font-size: 12px; color: var(--muted); font-weight: 600; }
.resume .go { margin-left: auto; }

/* ---------- Bottom nav ---------- */
.nav {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + var(--safe-b));
  width: min(400px, calc(100% - 32px)); height: 64px; border-radius: 999px; background: linear-gradient(135deg, #4A1B7E 0%, #2B2370 45%, #0D1B4C 100%);
  display: grid; grid-template-columns: repeat(3, 1fr); padding: 6px; z-index: 20; box-shadow: 0 14px 30px -10px #0007;
}
.nav button { border-radius: 999px; color: #ffffffa0; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; font-weight: 700; }
.nav button svg { width: 20px; height: 20px; }
.nav button.on { background: var(--pink); color: #fff; }

/* ---------- Quiz ---------- */
.quiz-head { display: flex; align-items: center; gap: 12px; }
.quiz-head .count { font-size: 13px; font-weight: 700; color: var(--muted); min-width: 40px; text-align: right; }
.quiz-title { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 14px; }
.quiz-title .h2 { font-size: 25px; }
.qcard { border-radius: var(--r-lg); padding: 20px 18px 16px; color: #fff; position: relative; overflow: hidden; }
.qcard.c0 { background: var(--pink); } .qcard.c1 { background: var(--green); }
.qcard.c2 { background: var(--yellow); color: #4b3500; } .qcard.c3 { background: var(--blue); }
.qcard::after { content: ""; position: absolute; width: 140px; height: 140px; border-radius: 50%; background: #ffffff1c; right: -40px; top: -50px; }
.qcard .ar { font-size: 27px; text-align: center; position: relative; z-index: 1; }
.qcard .ar.big { font-size: 46px; line-height: 1.6; }
.qcard .ref { text-align: center; font-size: 12.5px; font-weight: 700; opacity: .85; margin-top: 4px; position: relative; z-index: 1; }
.qcard .q { text-align: center; font-size: 19px; font-weight: 800; letter-spacing: -.02em; line-height: 1.3; position: relative; z-index: 1; padding: 6px 4px; }
.blank { display: inline-block; min-width: 70px; height: 1.25em; vertical-align: middle; border-radius: 10px; background: #ffffff55; border: 2px dashed #ffffffcc; margin: 0 4px; }
.blank.fill { background: #fff; color: var(--green); border: 0; padding: 0 10px; min-width: 0; height: auto; line-height: 1.6; }
.label { font-size: 15px; font-weight: 800; margin: 18px 2px 10px; letter-spacing: -.01em; }

.opts { display: grid; gap: 10px; }
.opts.grid { grid-template-columns: 1fr 1fr; }
.opt {
  border-radius: var(--r-md); border: 1.5px solid #CFE6CB; background: #fff; padding: 12px 16px; min-height: 64px;
  display: flex; align-items: center; justify-content: center; text-align: center; font-weight: 700; font-size: 15px;
  transition: background .2s, border-color .2s, transform .12s; position: relative;
}
.opt:active { transform: scale(.98); }
.opt .ar { font-size: 24px; line-height: 1.9; }
.opt.ok { background: var(--green); border-color: var(--green); color: #fff; animation: pop .35s ease; }
.opt.bad { background: var(--pink); border-color: var(--pink); color: #fff; animation: shake .35s ease; }
.opt.dim { opacity: .4; }
.opts.done .opt { pointer-events: none; }
@keyframes pop { 40% { transform: scale(1.04); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.order-list { display: grid; gap: 10px; }
.ord { display: flex; align-items: center; gap: 12px; border-radius: var(--r-md); border: 1.5px solid #CFE6CB; background: #fff; padding: 10px 14px; min-height: 60px; text-align: right; }
.ord .n { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--grey); color: var(--muted); font-weight: 800; font-size: 13px; }
.ord .ar { flex: 1; font-size: 21px; line-height: 1.9; }
.ord.on { border-color: var(--green); background: var(--green-l); }
.ord.on .n { background: var(--green); color: #fff; }
.ord.ok { background: var(--green); border-color: var(--green); color: #fff; }
.ord.ok .n { background: #fff; color: var(--green); }
.ord.bad { background: var(--pink-l); border-color: var(--pink); }
.ord.bad .n { background: var(--pink); color: #fff; }

.build { min-height: 78px; border-radius: var(--r-md); border: 2px dashed var(--line); background: #fff; padding: 10px; display: flex; flex-wrap: wrap; gap: 8px; direction: rtl; align-content: flex-start; }
.build.ok { border: 2px solid var(--green); background: var(--green-l); }
.build.bad { border: 2px solid var(--pink); background: var(--pink-l); }
.words { display: flex; flex-wrap: wrap; gap: 8px; direction: rtl; justify-content: center; margin-top: 14px; }
.word { font-family: var(--ar); font-size: 22px; padding: 2px 14px 6px; border-radius: 14px; background: #fff; border: 1.5px solid #CFE6CB; line-height: 1.9; transition: opacity .15s, transform .12s; }
.word:active { transform: scale(.95); }
.word.used { opacity: .2; pointer-events: none; }
.build .word { background: var(--green); color: #fff; border-color: var(--green); }

.match { display: grid; grid-template-columns: 1.25fr 1fr; gap: 10px; }
.match .col { display: grid; gap: 10px; align-content: start; }
.mi { border-radius: 18px; border: 1.5px solid #CFE6CB; background: #fff; padding: 8px 10px; min-height: 68px; display: grid; place-items: center; text-align: center; font-weight: 700; font-size: 13.5px; transition: all .2s; }
.mi .ar { font-size: 18px; line-height: 1.8; }
.mi.sel { border-color: var(--blue); background: var(--blue-l); }
.mi.done { background: var(--green); border-color: var(--green); color: #fff; pointer-events: none; }
.mi.bad { background: var(--pink); border-color: var(--pink); color: #fff; animation: shake .35s ease; }

.feedback { margin-top: 14px; border-radius: var(--r-md); padding: 12px 14px; display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 14px; animation: up .25s ease both; }
.feedback.ok { background: var(--green-l); color: var(--green-d); }
.feedback.bad { background: var(--pink-l); color: #A3338A; }
.feedback .e { font-size: 26px; }
.feedback .grow { flex: 1; line-height: 1.35; }
.feedback small { display: block; font-weight: 600; opacity: .85; font-size: 12px; }
.feedback .icon-btn { width: 38px; height: 38px; }

/* ---------- Result ---------- */
.score-big { font-size: 64px; font-weight: 800; letter-spacing: -.05em; line-height: 1; }
.earned { display: flex; align-items: center; gap: 14px; background: var(--pink); color: #fff; border-radius: var(--r-md); padding: 14px 16px; margin-top: 18px; }
.earned .e { font-size: 42px; }
.earned b { display: block; font-size: 17px; }
.earned span { font-size: 12.5px; opacity: .9; font-weight: 500; }
.earned.miss { background: var(--grey); color: var(--ink); }
.list-card { background: #fff; border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 6px 14px; margin-top: 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; font-weight: 600; }
.row:last-child { border-bottom: 0; }
.row .r { color: var(--muted); font-weight: 700; }
.row .ar { font-size: 18px; line-height: 1.6; }

/* ---------- Hafalan list ---------- */
.juz-h { display: flex; align-items: center; gap: 10px; margin: 18px 2px 10px; }
.juz-h .tag { padding: 6px 12px; border-radius: 999px; color: #fff; font-weight: 800; font-size: 13px; }
.juz-h span { font-size: 12px; color: var(--muted); font-weight: 600; }
.unit { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: #fff; border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 8px; }
.unit .no { width: 38px; height: 38px; border-radius: 12px; background: var(--grey); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.unit .info { flex: 1; min-width: 0; }
.unit b { display: block; font-size: 15px; }
.unit span { font-size: 12px; color: var(--muted); font-weight: 600; }
.unit .ar { font-size: 20px; line-height: 1.5; color: var(--green-d); }
.unit .bar { height: 5px; background: var(--grey); border-radius: 5px; margin-top: 6px; overflow: hidden; }
.unit .bar i { display: block; height: 100%; background: var(--green); border-radius: 5px; }
.unit.full { border-color: #CFE6CB; background: #F5FBF4; }
.unit.full .no { background: var(--green); color: #fff; }

/* ---------- Hafalan detail ---------- */
.hf-head { position: sticky; top: 0; z-index: 10; background: var(--cream); margin: -18px -20px 0; padding: 18px 20px 10px; }
.hf-title { display: flex; align-items: center; gap: 10px; }
.hf-title .t { flex: 1; min-width: 0; }
.hf-title b { display: block; font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.hf-title span { font-size: 12px; color: var(--muted); font-weight: 600; }
.rec { width: 42px; height: 42px; border-radius: 50%; background: #fff; border: 1.5px solid var(--line); display: grid; place-items: center; }
.rec i { width: 16px; height: 16px; border-radius: 50%; background: #E5484D; transition: border-radius .2s; }
.rec.on { border-color: #E5484D; animation: pulse 1.2s infinite; }
.rec.on i { border-radius: 4px; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px #e5484d22; } }
.bism { text-align: center; font-size: 26px; margin: 6px 0 4px; color: var(--green-d); }
.ayahs { display: grid; gap: 10px; padding-bottom: 150px; }
.ayah { display: flex; align-items: center; gap: 12px; background: #fff; border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 12px 12px 12px 14px; text-align: right; min-height: 70px; transition: border-color .2s, background .2s; }
.ayah .n { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; background: #EEE7FB; color: #6A4FC8; font-weight: 800; font-size: 12px; }
.ayah .body { flex: 1; min-width: 0; }
.ayah .ar { font-size: 25px; line-height: 2.1; }
.ayah.open { border-color: #9CCD95; }
.ayah.focus { border-color: var(--orange); box-shadow: 0 0 0 3px #f29a3b22; }
.ayah.playing { background: #FFF8EC; }
.bars { display: flex; flex-wrap: wrap; gap: 10px 8px; direction: rtl; padding: 8px 0; }
.bars i { height: 12px; border-radius: 4px; background: #D6E3D2; }
.leaf { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 12px; }
.leaf svg { width: 26px; height: 26px; }
.leaf.s0 svg { fill: #DCE3EE; } .leaf.s1 svg { fill: var(--green); } .leaf.s2 svg { fill: var(--orange); }
.hf-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: min(440px, 100%); padding: 10px 16px calc(14px + var(--safe-b)); background: linear-gradient(#eff6ff00, var(--cream) 26%); z-index: 15; }
.hf-bar .status { text-align: center; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 8px; min-height: 18px; }
.hf-bar .btns { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 8px; }
.hf-bar .btn { height: 52px; font-size: 14px; }
.legend { display: flex; gap: 14px; justify-content: center; font-size: 11.5px; font-weight: 600; color: var(--muted); margin: 6px 0 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.recplay { display: flex; align-items: center; gap: 10px; background: var(--pink-l); border-radius: 16px; padding: 8px 12px; margin: 8px 0 0; font-size: 13px; font-weight: 700; color: #A3338A; }
.recplay audio { flex: 1; height: 34px; min-width: 0; }

/* ---------- Rapor ---------- */
.report { background: #fff; border-radius: var(--r-lg); overflow: hidden; border: 1.5px solid var(--line); margin-top: 14px; }
.report .top { background: linear-gradient(135deg, #4A1B7E 0%, #2B2370 45%, #0D1B4C 100%); color: #fff; padding: 20px; position: relative; overflow: hidden; }
.report .top::after { content: ""; position: absolute; width: 160px; height: 160px; border-radius: 50%; background: #ffffff1c; right: -50px; top: -60px; }
.report .top small { font-weight: 700; font-size: 11px; letter-spacing: .12em; opacity: .85; }
.report .top .h2 { margin-top: 6px; }
.report .top span { font-size: 12.5px; opacity: .9; font-weight: 600; }
.garden { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 16px 12px 6px; text-align: center; }
.garden .f { font-size: 30px; line-height: 1.2; }
.garden b { display: block; font-size: 15px; }
.garden span { font-size: 10px; color: var(--muted); font-weight: 600; }
.garden .f.zero { filter: grayscale(1); opacity: .35; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--muted); font-size: 11px; font-weight: 700; padding: 10px 6px 8px; border-bottom: 1.5px solid var(--line); }
.tbl td { padding: 9px 6px; border-bottom: 1px solid var(--line); font-weight: 600; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.report .sec { padding: 4px 16px 16px; }
.report .sec h4 { font-size: 13px; font-weight: 800; margin: 14px 0 6px; color: var(--green-d); }
.kv { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; padding: 0 16px; margin-top: 14px; }
.kv div { background: var(--cream); border-radius: 14px; padding: 10px; text-align: center; }
.kv b { display: block; font-size: 19px; font-weight: 800; }
.kv span { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.ulang { display: flex; flex-wrap: wrap; gap: 6px; }
.ulang span { background: var(--pink-l); color: #A3338A; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.empty { color: var(--muted); font-size: 13px; font-weight: 500; }

/* ---------- Settings ---------- */
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px; background: #fff; border-radius: var(--r-md); border: 1.5px solid var(--line); margin-bottom: 10px; }
.setting b { font-size: 15px; display: block; }
.setting span { font-size: 12px; color: var(--muted); font-weight: 500; }
.switch { width: 52px; height: 30px; border-radius: 99px; background: var(--grey); position: relative; transition: background .2s; flex: none; }
.switch::after { content: ""; position: absolute; width: 24px; height: 24px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: left .2s; box-shadow: 0 2px 4px #0002; }
.switch.on { background: var(--green); }
.switch.on::after { left: 25px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: var(--grey); border-radius: 999px; padding: 4px; }
.seg button { height: 36px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--dark); color: #fff; }

.danger-zone { margin-top: 22px; padding: 16px; border-radius: var(--r-md); border: 1.5px dashed #F2A7B8; background: #FFF5F7; display: grid; gap: 12px; }
.danger-zone b { display: block; font-size: 15px; color: #B4233F; }
.danger-zone span { display: block; font-size: 12px; color: var(--muted); font-weight: 500; line-height: 1.45; margin-top: 2px; }
.btn.danger { background: #E5484D; }

/* ---------- Confirm sheet ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 100; background: #0D1B4C00; display: flex; align-items: flex-end; justify-content: center; transition: background .2s; }
.sheet-wrap.show { background: #0D1B4C80; }
.sheet { width: min(440px, 100%); background: #fff; border-radius: 28px 28px 0 0; padding: 24px 22px calc(22px + var(--safe-b)); text-align: center; transform: translateY(100%); transition: transform .25s cubic-bezier(.2,.9,.3,1); }
.sheet-wrap.show .sheet { transform: none; }
.sheet-ic { font-size: 40px; margin-bottom: 6px; }
.sheet .sub { font-size: 14px; margin: 8px 0 18px; }
.sheet-btns { display: grid; gap: 10px; }
@media (min-width: 640px) {
  .sheet-wrap { align-items: center; }
  .sheet { border-radius: 28px; transform: translateY(20px) scale(.96); opacity: 0; transition: transform .2s, opacity .2s; }
  .sheet-wrap.show .sheet { transform: none; opacity: 1; }
}

/* ---------- Language switcher ---------- */
.lang-sw { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 999px; background: #fff; border: 1.5px solid var(--line); flex: none; }
.lang-sw button { height: 30px; min-width: 40px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 800; letter-spacing: .04em; color: var(--muted); transition: background .2s, color .2s; }
.lang-sw button.on { background: linear-gradient(135deg, #4A1B7E, #0D1B4C); color: #fff; }
.lang-sw.glass { background: #ffffff22; border-color: #ffffff40; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.lang-sw.glass button { color: #ffffffcc; }
.lang-sw.glass button.on { background: #fff; color: #4A1B7E; }
.lang-float { position: absolute; top: calc(16px + env(safe-area-inset-top, 0px)); right: 16px; z-index: 5; }
.hello-r { display: flex; align-items: flex-start; gap: 10px; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
@media (hover: hover) { .lang-sw button:not(.on):hover { color: var(--ink); } .lang-sw.glass button:not(.on):hover { color: #fff; } }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 100px; transform: translate(-50%, 20px); background: var(--dark); color: #fff; padding: 12px 18px; border-radius: 999px; font-size: 13.5px; font-weight: 600; opacity: 0; pointer-events: none; transition: all .25s; z-index: 99; max-width: 90%; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 3px; animation: fall 1.8s ease-in forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* =====================================================
   Responsive: tablet (≥640px) & desktop (≥1024px)
   ===================================================== */
@media (hover: hover) {
  .mode, .unit, .opt, .plan, .resume, .bubble, .ord, .mi, .word { transition: transform .15s ease, box-shadow .15s ease, background .2s, border-color .2s; }
  .mode:hover { transform: translateY(-3px); box-shadow: 0 14px 26px -14px #0006; }
  .unit:hover, .resume:hover, .plan:not(.on):hover { border-color: #9CCD95; }
  .opts:not(.done) .opt:hover, .ord:hover, .mi:not(.done):hover, .word:hover { border-color: var(--green); }
  .bubble:hover { transform: scale(1.06); }
  .btn:hover { filter: brightness(1.08); }
  .icon-btn:hover { border-color: #cfc8bb; }
  .nav button:not(.on):hover { color: #fff; }
}

@media (min-width: 640px) {
  body { background: var(--cream); }
  .app { max-width: none; box-shadow: none; }
  .screen { width: 100%; max-width: 760px; margin: 0 auto; padding: 28px 32px calc(32px + var(--safe-b)); }
  .screen.pink, .screen.splash { max-width: none; }
  .loading .h2 { font-size: 34px; }
  .h2 { font-size: 32px; }
  .hero { margin: -28px -32px 0; height: 42dvh; }
  .hf-head { margin: -28px -32px 0; padding: 28px 32px 10px; }
  .hf-bar { width: min(760px, 100%); padding-left: 32px; padding-right: 32px; }
  .hf-bar .btns { max-width: 560px; margin: 0 auto; }

  .dash { grid-template-columns: 1fr 1fr 2fr; }
  .dash .mode { grid-column: auto; height: 100%; }
  .modes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .modes .mode { margin: 0; }
  .units { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .units .unit { margin: 0; }

  .qcard { padding: 28px 28px 22px; }
  .qcard .ar { font-size: 34px; }
  .qcard .ar.big { font-size: 56px; }
  .opt .ar { font-size: 28px; }
  .ord .ar { font-size: 24px; }
  .mi .ar { font-size: 21px; }
  .ayah .ar { font-size: 30px; }
  .bism { font-size: 32px; }
  .plans { grid-template-columns: repeat(3, 1fr); }
  .plan { flex-direction: column; text-align: center; padding: 24px 18px; }
  .presets { justify-content: center; }
  .bubbles { gap: 12px 10px; }
  .bottom { max-width: 480px; width: 100%; margin-left: auto; margin-right: auto; }
    .garden { grid-template-columns: repeat(9, 1fr); }
  .kv b { font-size: 24px; }
}

@media (min-width: 1024px) {
  /* Sidebar navigation */
  .nav {
    left: 0; top: 0; bottom: 0; transform: none; width: 248px; height: auto;
    border-radius: 0; display: flex; flex-direction: column; gap: 6px; padding: 32px 18px;
    box-shadow: none; background: linear-gradient(180deg, #4A1B7E 0%, #2B2370 45%, #0D1B4C 100%);
  }
  .nav-brand { display: block; color: #fff; padding: 0 14px 28px; }
  .nav-brand b { display: block; font-size: 40px; font-weight: 800; letter-spacing: -.06em; line-height: 1; }
  .nav-brand small { display: block; font-size: 13px; font-weight: 600; color: #ffffff99; margin-top: 6px; }
  .nav button { height: 52px; justify-content: flex-start; padding: 0 18px; font-size: 15px; gap: 12px; flex: none; }

  .screen.has-nav { max-width: none; margin-left: 248px; width: auto; padding: 40px 56px 56px; }
  .screen.has-nav > * { max-width: 1120px; }
  .hello .h2 { font-size: 36px; }
  .materi-pill { width: auto; justify-content: flex-start; }
  .dash { grid-template-columns: 220px 220px 1fr; gap: 16px; }
  .ring { width: 108px; height: 108px; }
  .stat h4 { font-size: 15px; }
  .resume { max-width: 520px; }
  .rapor-wrap { max-width: 760px; }

  .screen:not(.has-nav):not(.pink):not(.splash) { max-width: 720px; }
}

@media (min-width: 1280px) {
  .modes { grid-template-columns: repeat(3, 1fr); }
  .units { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Mission complete art (result screen) ---------- */
.mission { position: relative; height: 230px; border-radius: var(--r-lg); overflow: hidden; margin: 8px 0 16px;
  background: linear-gradient(165deg, #1B0838 0%, #3D1170 32%, #7A1F9E 62%, #C93CA8 86%, #FF6FB8 100%); }
.mission-bg .planet, .mission-bg .moon, .mission-bg .rocket { display: none; }
.mission .ma { position: absolute; inset: auto 0 0 0; width: 100%; height: 100%; }
.ma-orbit { animation: maOrbit 12s linear infinite; }
@keyframes maOrbit { from { transform: translate(160px, 120px) rotate(0deg) translate(130px, 0) rotate(0deg) scale(.9); } to { transform: translate(160px, 120px) rotate(-360deg) translate(130px, 0) rotate(360deg) scale(.9); } }
.ma-cloth { transform-box: fill-box; transform-origin: 0% 50%; animation: wave 1.6s ease-in-out infinite; }
@keyframes wave { 0%, 100% { transform: skewY(0deg) scaleX(1); } 50% { transform: skewY(-5deg) scaleX(.94); } }
.ma-blink { animation: blink 1.4s steps(1) infinite; }
@keyframes blink { 50% { opacity: .15; } }
.ma-landed { animation: settle 4s ease-in-out infinite; }
@keyframes settle { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
.ma-shake { transform-box: fill-box; transform-origin: 50% 100%; animation: shake2 .5s ease-in-out infinite; }
@keyframes shake2 { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-1.2px) rotate(-.6deg); } 75% { transform: translateX(1.2px) rotate(.6deg); } }
.ma-fire { transform-box: fill-box; transform-origin: 50% 0; animation: flick .18s ease-in-out infinite alternate; }
@keyframes flick { from { transform: scaleY(.75); opacity: .85; } to { transform: scaleY(1.15); opacity: 1; } }
.ma-smoke circle { fill: #F3E8FF; opacity: 0; transform-box: fill-box; transform-origin: center; animation: puff 2.4s ease-out infinite; }
.ma-smoke circle:nth-child(2) { animation-delay: .8s; } .ma-smoke circle:nth-child(3) { animation-delay: 1.6s; }
@keyframes puff { 0% { opacity: 0; transform: scale(.4); } 20% { opacity: .8; } 100% { opacity: 0; transform: scale(1.8) translateY(-6px); } }
.ma-badge { position: absolute; left: 50%; top: 20px; width: 92px; height: 92px; margin-left: -46px; display: grid; place-items: center; animation: floaty 3s ease-in-out infinite; }
.ma-badge .emo { font-size: 50px; filter: drop-shadow(0 0 16px #FFD6F2); position: relative; }
.ma-badge .ring { position: absolute; inset: 0; border-radius: 50%; border: 3px dashed #FFE6F7aa; background: radial-gradient(circle, #FF8AD055, #FF8AD000 70%); animation: spin 10s linear infinite; }
.mission.retry .ma-badge { display: none; }
.mission-tag { display: inline-block; padding: 6px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 800; background: #EEE7FB; color: #5B2A9E; margin-bottom: 8px; }
.mission-tag.ok { background: linear-gradient(135deg, #4A1B7E, #0D1B4C); color: #fff; }
@media (min-width: 640px) { .mission { height: 280px; } .ma-badge { top: 30px; } }
@media (prefers-reduced-motion: reduce) { .mission * { animation: none !important; } }
