/* ═══════════════════════════════════════════════════════════
   دیکته — تم شیشه‌ای (glassmorphism) هماهنگ با برند سبز
   RTL فارسی + ناحیهٔ تایپ LTR انگلیسی — بدون هیچ CDN خارجی
   فونت‌ها لوکال باندل شده‌اند (Vazirmatn فارسی + Nunito انگلیسی)
   ═══════════════════════════════════════════════════════════ */

/* ── فونت‌های لوکال ── */
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 500 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-ExtraBold.woff2') format('woff2');
  font-weight: 800 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('../fonts/Nunito-Bold.woff2') format('woff2');
  font-weight: 500 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('../fonts/Nunito-ExtraBold.woff2') format('woff2');
  font-weight: 800 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --fa: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
  --en: 'Nunito', 'Vazirmatn', 'Segoe UI', sans-serif;
  --brand: #0d6e50;
  --brand-d: #0a5a41;
  --brand-t: rgba(13, 110, 80, .10);
  --ink: #1c2b33;
  --muted: #5d6b76;
  --line: rgba(28, 43, 51, .13);
  --ok: #12a150;
  --ok-t: #e9f9f0;
  --bad: #e5484d;
  --bad-t: #feecec;
  --gold: #f0a921;
  --glass: rgba(255, 255, 255, .58);
  --glass-hi: rgba(255, 255, 255, .72);
  --r: 22px;
  --shadow: 0 18px 50px rgba(13, 110, 80, .12);
}

* { box-sizing: border-box; }
/* SVGها اتریبوت hidden را نادیده می‌گیرند — قاعدهٔ صریح */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100svh;
  font-family: var(--fa);
  color: var(--ink);
  background: linear-gradient(135deg, #edf6f0 0%, #e9f1ed 45%, #eaf0f7 100%);
  overflow-x: hidden;
}
/* حباب‌های رنگی پس‌زمینه */
body::before, body::after, body::marker {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(72px);
  z-index: -1;
  pointer-events: none;
}
body::before { width: 46vw; height: 46vw; background: rgba(13, 110, 80, .16); top: -14vw; right: -12vw; }
body::after  { width: 38vw; height: 38vw; background: rgba(31, 122, 194, .12); bottom: -12vw; left: -10vw; }

/* ── شیشه ── */
.glass {
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid rgba(255, 255, 255, .68);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}

/* ── هدر ── */
.topbar {
  position: sticky;
  top: 12px;
  z-index: 5;
  max-width: 680px;
  margin: 12px auto 0;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 13px;
}
.logo {
  width: 46px; height: 46px; flex: none;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--brand), #14a878);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 8px 22px rgba(13, 110, 80, .32);
}
.logo svg { width: 24px; height: 24px; }
.brand b { font-size: 19px; display: block; line-height: 1.3; }
.brand small { color: var(--muted); font-size: 11.5px; }
.iconbtn {
  margin-inline-start: auto;
  width: 42px; height: 42px; flex: none;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .7);
  color: var(--brand);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: .15s;
}
.iconbtn:hover { border-color: var(--brand); }
.iconbtn svg { width: 20px; height: 20px; }

/* ── صحنه ── */
.stage { max-width: 680px; margin: 0 auto; padding: 18px 16px 70px; }
.view[hidden] { display: none; }

/* ── مقدمه ── */
.intro { padding: 22px; margin-bottom: 16px; }
.intro h2 { margin: 0 0 8px; font-size: 20px; }
.intro p { margin: 0; color: var(--muted); font-size: 14px; line-height: 2; }

/* ── کارت‌های سطح ── */
.levels { display: grid; gap: 13px; }
.lvcard {
  display: flex; align-items: center; gap: 14px;
  padding: 17px 18px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  position: relative;
  overflow: hidden;
}
.lvcard:hover { transform: translateY(-2px); box-shadow: 0 22px 55px rgba(13, 110, 80, .16); }
.lvcard.locked { opacity: .55; cursor: not-allowed; filter: saturate(.4); }
.lvcard.locked:hover { transform: none; box-shadow: var(--shadow); }
.lvb {
  width: 52px; height: 52px; flex: none;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 20px; font-weight: 800;
  background: var(--c, var(--brand));
  box-shadow: 0 8px 20px rgba(28, 43, 51, .18);
}
.lvb.lock svg { width: 22px; height: 22px; }
.lvinfo { flex: 1; min-width: 0; }
.lvinfo b { display: block; font-size: 15.5px; margin-bottom: 6px; }
.lvbar { height: 7px; border-radius: 99px; background: rgba(28, 43, 51, .10); overflow: hidden; }
.lvbar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--c, var(--brand)), #14a878); transition: width .5s ease; }
.lvmeta { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.lvmeta small { color: var(--muted); font-size: 11.5px; }
.lvstars { color: var(--gold); font-size: 12.5px; font-weight: 700; letter-spacing: .5px; }
.lvarrow { flex: none; color: var(--muted); }
.lvarrow svg { width: 20px; height: 20px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 26px; }

/* ── کارت بازی ── */
.gamewrap { display: grid; gap: 12px; }
.gamecard { padding: 22px 20px 18px; }
.gtop { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.lvname { color: var(--muted); font-size: 12.5px; font-weight: 700; }
.dots { display: flex; gap: 6px; flex-wrap: wrap; }
.dots i {
  width: 9px; height: 9px; border-radius: 99px;
  background: rgba(28, 43, 51, .16);
  transition: .2s;
}
.dots i.done { background: var(--ok); }
.dots i.cur { background: var(--brand); box-shadow: 0 0 0 3.5px var(--brand-t); }

.qhead { display: flex; gap: 8px; justify-content: center; margin: 16px 0 6px; }
.chip {
  font-size: 11.5px; font-weight: 700;
  padding: 4px 12px; border-radius: 99px;
  background: var(--brand-t); color: var(--brand);
}
.chip.live { background: rgba(240, 169, 33, .16); color: #b3661f; }

/* دکمهٔ پخش بزرگ */
.play {
  width: 86px; height: 86px;
  margin: 10px auto 6px;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), #14a878);
  box-shadow: 0 14px 34px rgba(13, 110, 80, .38);
  transition: transform .15s, box-shadow .15s;
  position: relative;
}
.play:hover { transform: scale(1.05); }
.play:active { transform: scale(.97); }
.play svg { width: 34px; height: 34px; }
.play.playing::after {
  content: '';
  position: absolute; inset: -9px;
  border-radius: 50%;
  border: 2.5px solid rgba(13, 110, 80, .35);
  animation: pulse 1.15s ease-out infinite;
}
@keyframes pulse {
  0%   { transform: scale(.92); opacity: 1; }
  100% { transform: scale(1.22); opacity: 0; }
}

.playrow { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 8px 0 4px; }
.ghostbtn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .7);
  color: var(--ink);
  border-radius: 12px;
  padding: 9px 15px;
  font-family: inherit; font-size: 13px; font-weight: 700;
  cursor: pointer;
  transition: .15s;
  display: inline-flex; align-items: center; gap: 7px;
}
.ghostbtn:hover { border-color: var(--brand); color: var(--brand); }
.ghostbtn small { color: var(--muted); font-weight: 500; font-size: 10.5px; }
.ghostbtn.accent { border-color: rgba(13, 110, 80, .4); color: var(--brand); }
.ghostbtn.glow { animation: glow 1.4s ease-in-out infinite; }
@keyframes glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(13, 110, 80, .0); }
  50%      { box-shadow: 0 0 0 6px rgba(13, 110, 80, .14); }
}

/* ── خانه‌های حروف ── */
.slots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: flex-start;
  gap: 8px;
  direction: ltr;
  min-height: 76px;
  padding: 16px 10px;
  margin: 10px 0 4px;
  border-radius: 16px;
  outline: none;
  cursor: text;
}
.slots:focus-visible { box-shadow: 0 0 0 3px var(--brand-t); }
.slot {
  width: 44px; height: 56px;
  border-radius: 12px;
  border: 1.8px dashed rgba(28, 43, 51, .28);
  background: rgba(255, 255, 255, .5);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--en);
  font-size: 24px; font-weight: 800;
  color: var(--ink);
  text-transform: lowercase;
  transition: border-color .15s, background .15s;
  user-select: none;
}
.slot.cur { border-color: var(--brand); background: #fff; animation: caret 1.1s ease-in-out infinite; }
@keyframes caret { 0%, 100% { box-shadow: 0 0 0 0 rgba(13, 110, 80, .0); } 50% { box-shadow: 0 0 0 4px rgba(13, 110, 80, .15); } }
.slot.ok {
  border: 1.8px solid var(--ok);
  background: var(--ok-t);
  color: var(--ok);
  animation: flip .35s ease;
}
.slot.bad {
  border: 1.8px solid var(--bad);
  background: var(--bad-t);
  color: var(--bad);
  animation: flip .35s ease;
}
.slot.fixed {
  width: 26px;
  border: 1.8px dashed rgba(28, 43, 51, .18);
  background: transparent;
  color: var(--muted);
  font-size: 17px;
}
.gap { width: 16px; flex: none; }
@keyframes flip { 0% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }

#hideInput {
  position: fixed;
  top: -12px;
  right: 0;
  width: 2px; height: 2px;
  opacity: 0;
  border: 0;
  padding: 0;
  pointer-events: none;
}

.verdict {
  min-height: 22px;
  text-align: center;
  font-size: 13px; font-weight: 700;
  color: var(--muted);
}
.verdict.bad { color: var(--bad); }
.verdict.ok { color: var(--ok); }

.actions { display: flex; justify-content: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.actions.center { margin-top: 22px; }
.btn {
  border: 0; cursor: pointer;
  border-radius: 14px;
  padding: 13px 30px;
  font-family: inherit; font-size: 15px; font-weight: 800;
  background: linear-gradient(135deg, var(--brand), #14a878);
  color: #fff;
  box-shadow: 0 10px 26px rgba(13, 110, 80, .32);
  transition: .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary[disabled] { opacity: .5; pointer-events: none; }

.hintbox {
  text-align: center;
  margin-top: 12px;
  padding: 11px 16px;
  border-radius: 14px;
  background: rgba(240, 169, 33, .12);
  border: 1px dashed rgba(179, 102, 31, .35);
  color: #8a5a17;
  font-size: 14px; font-weight: 700;
}

.starline { display: flex; justify-content: center; gap: 6px; margin-top: 14px; min-height: 24px; }
.starline svg { width: 24px; height: 24px; color: rgba(28, 43, 51, .18); }
.starline svg.on { color: var(--gold); filter: drop-shadow(0 3px 6px rgba(240, 169, 33, .4)); animation: star .4s ease; }
@keyframes star { 0% { transform: scale(.3) rotate(-30deg); } 70% { transform: scale(1.25); } 100% { transform: scale(1); } }

.tip { text-align: center; color: var(--muted); font-size: 11.5px; margin: 0; }

/* لرزش در پاسخ غلط */
.shake { animation: shake .4s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); } 40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); } 80% { transform: translateX(3px); }
}

/* ── نتیجه ── */
.resultcard { max-width: 520px; margin: 20px auto 0; padding: 30px 24px; text-align: center; }
.rstar svg { width: 44px; height: 44px; color: rgba(28, 43, 51, .16); }
.rstar svg.on { color: var(--gold); filter: drop-shadow(0 4px 8px rgba(240, 169, 33, .45)); animation: star .5s ease backwards; }
.resultcard h2 { margin: 10px 0 6px; font-size: 22px; }
.rmsg { color: var(--muted); font-size: 13.5px; margin: 0 0 14px; line-height: 2; }
.rstats { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.stat {
  min-width: 108px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .65);
  border: 1px solid rgba(255, 255, 255, .8);
}
.stat b { display: block; font-size: 20px; }
.stat span { font-size: 11px; color: var(--muted); }
.rlist { text-align: right; margin: 8px 0 4px; }
.rlist h4 { font-size: 13.5px; margin: 10px 4px; color: var(--muted); }
.rlist .ri {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 9px 13px; margin-bottom: 7px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .55);
  border: 1px solid var(--line);
  font-size: 13.5px;
}
.rlist .ri b { direction: ltr; font-family: var(--en); font-size: 14px; }
.rlist .ri span { color: var(--muted); font-size: 12.5px; }

/* ── توست ── */
.toast {
  position: fixed;
  bottom: 22px; right: 50%;
  transform: translateX(50%) translateY(14px);
  background: var(--ink); color: #fff;
  padding: 11px 22px;
  border-radius: 13px;
  font-size: 13px; font-weight: 700;
  opacity: 0; pointer-events: none;
  transition: .25s;
  z-index: 50;
  max-width: 88vw;
  text-align: center;
}
.toast.on { opacity: .96; transform: translateX(50%) translateY(0); }

/* ── جشن کاغذ‌پاره‌ای (CSS فقط) ── */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.confetti i {
  position: absolute;
  top: -14px;
  width: 9px; height: 14px;
  border-radius: 3px;
  animation: drop linear forwards;
}
@keyframes drop {
  to { transform: translateY(110vh) rotate(660deg); opacity: .2; }
}

/* ── ریسپانسیو ── */
@media (max-width: 560px) {
  .stage { padding: 14px 12px 60px; }
  .topbar { top: 8px; margin-top: 8px; padding: 10px 14px; }
  .slot { width: 36px; height: 50px; font-size: 20px; }
  .slots { gap: 6px; padding: 13px 6px; }
  .gap { width: 10px; }
  .play { width: 78px; height: 78px; }
  .btn { padding: 12px 24px; }
}
@media (max-width: 375px) {
  .slot { width: 30px; height: 46px; font-size: 18px; border-radius: 10px; }
  .brand small { font-size: 10px; }
}
