/* غراس الجنة — نموذج تجريبي. موبايل أولا. */
:root {
  --sky-1: #bfe9ff;
  --sky-2: #effaff;
  --grass: #5cb83f;
  --grass-deep: #3f9a2e;
  --leaf: #7ed957;
  --soil: #8a6a46;
  --sun: #ffd93b;
  --coral: #ff7a59;
  --ink: #12474f;
  --ink-soft: #3d6b72;
  --card: #ffffff;
  --line: #cfe9d4;
  --ok: #2fa84f;
  --ok-bg: #dff7e4;
}

* { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
body {
  margin: 0;
  font-family: 'Noto Naskh Arabic', 'Cairo', system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(var(--sky-1), var(--sky-2) 55%, #e4f7d6);
  min-height: 100dvh;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }

#app { max-width: 520px; margin: 0 auto; min-height: 100dvh; position: relative; }

/* ─── الشريط العلوي ─── */
.bar {
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 6px;
}
.bar h1, .bar h2 { margin: 0; font-size: 1.25rem; font-weight: 800; flex: 1; }
.round-btn {
  width: 48px; height: 48px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 0 var(--line), 0 4px 12px rgba(18, 71, 79, .12);
  display: grid; place-items: center; font-size: 1.35rem;
}
.round-btn:active { transform: translateY(2px); }

/* ─── البستان ─── */
.hero { position: relative; height: 128px; margin-bottom: 4px; overflow: hidden; }
.sun {
  position: absolute; top: 8px; inset-inline-start: 22px; width: 62px; height: 62px; border-radius: 50%;
  background: radial-gradient(circle, #fff7b8 0 35%, var(--sun) 36%);
  box-shadow: 0 0 0 10px rgba(255, 217, 59, .25), 0 0 0 22px rgba(255, 217, 59, .12);
  animation: pulse 5s ease-in-out infinite;
}
.cloud { position: absolute; fill: #fff; opacity: .95; animation: drift 38s linear infinite; }
.cloud.c2 { top: 56px; animation-duration: 55s; animation-delay: -20s; opacity: .8; }
@keyframes drift { from { transform: translateX(-120px); } to { transform: translateX(560px); } }
@keyframes pulse { 50% { transform: scale(1.06); } }

.hero-text { position: absolute; inset-inline: 16px; bottom: 6px; }
.hero-text h1 { margin: 0; font-size: 1.7rem; font-weight: 800; line-height: 1.2; }
.hero-text p { margin: 2px 0 0; color: var(--ink-soft); font-weight: 600; font-size: .95rem; }

.garden-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px 4px; }
.count {
  flex: 1; background: #fff; border-radius: 16px; padding: 6px 10px; font-weight: 700;
  box-shadow: 0 2px 0 var(--line); font-size: .95rem; text-align: center; white-space: nowrap;
}
.count b { color: var(--grass-deep); font-size: 1.15rem; }

.grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
  padding: 10px 14px calc(28px + env(safe-area-inset-bottom));
}
@media (min-width: 480px) { .grid { grid-template-columns: repeat(3, 1fr); } }

.plot {
  position: relative; background: var(--card); border-radius: 22px; padding: 8px 8px 12px;
  box-shadow: 0 3px 0 var(--line), 0 8px 18px rgba(18, 71, 79, .08);
  text-align: center; min-height: 168px;
  transition: transform .15s;
}
.plot:active { transform: scale(.97); }
.plot .pl { width: 100%; height: 100px; display: block; }
.plot .name { font-weight: 800; font-size: 1.05rem; margin-top: 2px; }
.bar-prog { height: 8px; border-radius: 6px; background: #e4f1e6; margin: 6px 12px 0; overflow: hidden; }
.bar-prog i { display: block; height: 100%; background: var(--leaf); border-radius: 6px; transition: width .5s; }
.plot.full { background: linear-gradient(#fffbe0, #fff); box-shadow: 0 3px 0 #f1dd7e, 0 8px 18px rgba(205, 170, 6, .18); }
.plot .ribbon {
  position: absolute; top: -8px; inset-inline-end: 10px; background: var(--coral); color: #fff;
  font-size: .8rem; font-weight: 800; padding: 3px 10px; border-radius: 10px;
}

/* ─── النبتة (SVG) ─── */
.pl .part {
  transform-box: view-box; transform-origin: 60px 110px;
  transform: scale(.2); opacity: 0; transition: transform .6s cubic-bezier(.3, 1.5, .5, 1), opacity .4s;
}
.pl .part.on { transform: scale(1); opacity: 1; }
.pl .part.canopy { transform-origin: 60px 62px; }
.pl .part.fruit { transform-origin: center; transform-box: fill-box; }
.pl .sway { transform-box: view-box; transform-origin: 60px 110px; animation: sway 5s ease-in-out infinite; }
@keyframes sway { 50% { transform: rotate(1.6deg); } 0%, 100% { transform: rotate(-1.6deg); } }
.pl .glow { opacity: 0; transition: opacity .8s; }
.pl .glow.on { opacity: 1; animation: pulse 3s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }

/* ─── الجولة ─── */
.auto-bar {
  height: 4px;
  background: rgba(92, 184, 63, .18);
  margin: 0 16px 8px;
  border-radius: 4px;
  overflow: hidden;
  opacity: 0;
  transition: opacity .2s;
}
.auto-bar.active {
  opacity: 1;
}
.auto-bar i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--grass);
  border-radius: 4px;
}
.auto-bar.active i {
  width: 100%;
  transition: width 1.4s linear;
}

.dots { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; padding: 0 16px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid var(--line); transition: all .3s; }
.dots i.done { background: var(--leaf); border-color: var(--grass-deep); }
.dots i.now { border-color: var(--coral); transform: scale(1.25); }

.round { display: flex; flex-direction: column; min-height: 100dvh; }
.stage-plant { height: clamp(170px, 30dvh, 250px); display: grid; place-items: center; }
.stage-plant .pl { height: 100%; width: 220px; }

.slots {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 6px 16px; min-height: 84px;
  align-content: center;
}
.slot {
  border: 2.5px dashed #9cc9a4; border-radius: 14px; padding: 4px 12px; min-height: 52px;
  display: grid; place-items: center; background: rgba(255, 255, 255, .55);
  font-family: 'Amiri', serif; font-size: 1.7rem; line-height: 1.7;
}
.slot span { visibility: hidden; }
.slot.filled { border-style: solid; border-color: var(--ok); background: var(--ok-bg); animation: pop .35s cubic-bezier(.3, 1.6, .5, 1); }
.slot.filled span { visibility: visible; }
.slots.finished .slot { background: #fff7c9; border-color: #e6c93a; }
@keyframes pop { from { transform: scale(.6); } to { transform: scale(1); } }

.num-badge {
  text-align: center; font-family: 'Amiri', serif; font-size: 1.5rem; color: var(--grass-deep);
  min-height: 34px; opacity: 0; transition: opacity .4s;
}
.num-badge.show { opacity: 1; }

.chips {
  margin-top: auto; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
  padding: 14px 14px 8px; background: linear-gradient(transparent, rgba(255, 255, 255, .7));
}
.chip {
  background: #fff; border-radius: 16px; padding: 4px 16px; min-height: 56px; min-width: 56px;
  font-family: 'Amiri', serif; font-size: 1.75rem; line-height: 1.8;
  box-shadow: 0 4px 0 #b9dcc0, 0 8px 14px rgba(18, 71, 79, .1);
  transition: transform .12s, opacity .25s;
}
.chip:active { transform: translateY(3px); box-shadow: 0 1px 0 #b9dcc0; }
.chip.used { opacity: 0; pointer-events: none; transform: scale(.5); }
.chip.shake { animation: shake .35s; background: #fff4ee; }
.chip.hint { animation: hint 0.7s ease-in-out 3; background: #fff7c9; }
@keyframes shake { 20%, 60% { transform: translateX(7px); } 40%, 80% { transform: translateX(-7px); } }
@keyframes hint { 50% { transform: scale(1.14); box-shadow: 0 0 0 6px rgba(255, 217, 59, .6); } }

.actions { display: flex; justify-content: center; gap: 10px; padding: 8px 14px calc(16px + env(safe-area-inset-bottom)); }
.btn {
  flex: 1; min-height: 56px; border-radius: 18px; font-weight: 800; font-size: 1.1rem;
  background: #fff; box-shadow: 0 4px 0 var(--line);
}
.btn.primary { background: var(--grass); color: #fff; box-shadow: 0 4px 0 var(--grass-deep); }
.btn.primary:active, .btn:active { transform: translateY(3px); box-shadow: none; }
.btn[hidden] { display: none; }
.btn.small { flex: 0 0 64px; font-size: 1.4rem; }

/* ─── احتفال إتمام السورة ─── */
.celebrate {
  position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px;
  background: rgba(190, 233, 255, .9); backdrop-filter: blur(4px);
  animation: fade .4s;
}
@keyframes fade { from { opacity: 0; } }
.celebrate .card {
  background: #fff; border-radius: 28px; padding: 22px 20px; width: min(92vw, 380px); text-align: center;
  box-shadow: 0 6px 0 #f1dd7e, 0 18px 40px rgba(18, 71, 79, .2);
}
.celebrate .pl { width: 190px; height: 190px; }
.celebrate h2 { margin: 4px 0; font-size: 1.5rem; }
.celebrate p { margin: 0 0 14px; color: var(--ink-soft); font-weight: 600; }
.petal {
  position: fixed; top: -20px; width: 12px; height: 18px; border-radius: 80% 0 80% 0; pointer-events: none;
  animation: fall linear forwards; z-index: 11;
}
@keyframes fall { to { transform: translate(var(--dx), 108vh) rotate(var(--rot)); } }

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

/* ─── اختيار الوضع ─── */
.modes { display: flex; gap: 6px; margin: 6px 14px 0; padding: 5px; background: rgba(255, 255, 255, .65); border-radius: 18px; }
.modes button { flex: 1; min-height: 46px; border-radius: 14px; font-weight: 800; color: var(--ink-soft); }
.modes button.on { background: var(--grass); color: #fff; box-shadow: 0 3px 0 var(--grass-deep); }
.slot.given { border: 2.5px solid #d9eadc; background: #fff; }
.slot.given span { visibility: visible; }

a.round-btn { text-decoration: none; color: inherit; }

/* ─── نافذة كيف تلعب؟ ─── */
.ht-stage .demo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.ht-stage .demo-plant {
  height: 76px;
  width: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ht-stage .demo-plant .pl {
  height: 76px;
  width: 100%;
}
.ht-stage .num-badge {
  min-height: 24px;
  font-size: 1.3rem;
  margin: 0;
}
.ht-stage .slots {
  padding: 2px 4px;
  min-height: 44px;
  gap: 6px;
}
.ht-stage .slot {
  min-height: 40px;
  padding: 2px 8px;
  font-size: 1.3rem;
  line-height: 1.4;
  border-radius: 10px;
}
.ht-stage .chips {
  padding: 4px;
  gap: 8px;
  margin-top: 2px;
  background: none;
}
.ht-stage .chip {
  min-height: 42px;
  min-width: 42px;
  padding: 2px 10px;
  font-size: 1.3rem;
  line-height: 1.4;
  border-radius: 12px;
  box-shadow: 0 3px 0 #b9dcc0, 0 4px 8px rgba(18, 71, 79, .08);
}
