@font-face {
  font-family: 'Baloo Bhaijaan 2';
  src: url('https://quamtex.ir/fonts/webfonts/baloo-bhaijaan-2-arabic-500-normal.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Baloo Bhaijaan 2';
  src: url('https://quamtex.ir/fonts/webfonts/baloo-bhaijaan-2-latin-500-normal.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  /* رنگ‌های اصلی از مرجع */
  --primary: #112548;
  --primary-hover: #1e3a6e;
  --accent: #2c4a85;
  --bg-body: #f1f5f9;
  --bg-container: #ffffff;
  --bg-input: #f8fafc;
  --border-light: #e2e8f0;
  --text-main: #112548;
  --key-bg: #e2e8f0;
  
  /* رنگ‌های وضعیت بازی */
  --correct: #60daa8;
  --present: #ffc048;
  --absent: #94a3b8;
  
  /* سایه‌ها */
  --shadow-soft: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-key: 0 4px 0px rgba(0,0,0,0.1);
}

* {
  box-sizing: border-box;
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

body {
  background-color: var(--bg-body);
  font-family: 'Baloo Bhaijaan 2', sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-container {
  display: flex;
  flex-direction: row;
}

.main-content {
  padding: clamp(1rem, 2vw, 2rem);
  margin: clamp(0.5rem, 1.5vw, 1.5rem);
  background-color: #ffffff;
  border-radius: 24px;
  font-size: clamp(0.938rem, 0.842rem + 0.426vw, 1.188rem);
  text-align: center;
  /* مدرن‌سازی سایه کانتینر اصلی */
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: var(--primary);
  width: 100%;
}

.description {
  background-color: #ffffff;
  padding: 25px;
  border-radius: 20px;
  margin-bottom: 16px;
  /* سایه نرم‌تر */
  text-align: right;
  font-size: clamp(0.875rem, 0.731rem + 0.638vw, 1.25rem);
  border: 2px solid var(--border-light);
}

.bmi {
  display: grid;
  margin: 20px 0;
  border-radius: 24px;
  /* حذف سایه سیاه و جایگزینی با افکت کارت مدرن */
  background: #ffffff;
  border: 2px solid var(--border-light);
  padding: clamp(0.8rem, 0.5vw, 1.6rem);
  width: 100%;
  box-sizing: border-box; /* جلوگیری از اسکرول افقی */
}

/* هدر بازی */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border-light);
  padding-bottom: 15px;
}

h2 {
  margin: 0;
  font-size: 2rem;
  color: var(--text-main);
}

/* دکمه تم */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  color: var(--text-main);
  padding: 5px;
  border-radius: 50%;
}
.theme-toggle:hover {
  background-color: var(--bg-input);
}

/* گرید بازی */
.main {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px auto;
  width: fit-content;
}

.inputs div {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

/* استایل خانه‌ها */
input {
  width: clamp(3rem, 12vw, 4rem);
  height: clamp(3rem, 12vw, 4rem);
  font-size: 1.8rem;
  text-align: center;
  border: 2px solid var(--border-light);
  background-color: var(--bg-input);
  border-radius: 12px; /* گردی مدرن */
  color: var(--text-main);
  font-family: "Baloo Bhaijaan 2", sans-serif;
  outline: none;
  font-weight: bold;
  padding: 0;
  margin: 0;
  caret-color: transparent; /* مخفی کردن نشانگر تایپ */
  cursor: default;
}

/* افکت فوکوس و پر شدن */
input:focus {
  border-color: var(--primary); /* رنگ مرجع */
  box-shadow: 0 0 0 4px rgba(17, 37, 72, 0.1);
  transform: scale(1.05);
}

/* انیمیشن پر شدن خانه */
input[value]:not([value=""]) {
  border-color: #64748b;
  animation: pop 0.1s linear;
}

@keyframes pop {
  50% { transform: scale(1.1); }
}

.keybord > div {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.keys, .last, .reset {
  background-color: var(--key-bg);
  color: var(--text-main);
  border-radius: 8px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 50px;
  min-width: 35px; /* کمی عریض‌تر */
  box-shadow: var(--shadow-key);
  transition: all 0.1s;
  border: none; /* حذف بوردر قدیمی */
}

.keys {
  flex: 1;
  max-width: 45px;
}

.keys:active, .last:active {
  transform: translateY(2px);
  box-shadow: none;
}

/* دکمه‌های خاص */
.enter {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: white;
  flex: 1.5;
  font-size: 0.9rem;
}

.delete {
  background-color: #ef4444;
  color: white;
  flex: 1.5;
  font-size: 0.9rem;
}

.reset {
  background-color: var(--bg-input);
  border: 2px solid var(--border-light);
  width: 100%;
  box-shadow: none;
}
.reset:hover {
  border-color: #cbd5e1;
}

/* رنگ‌های نتیجه (توسط JS اعمال می‌شود) */
.correct { background-color: var(--correct) !important; color: white; border-color: var(--correct); }
.present { background-color: var(--present) !important; color: white; border-color: var(--present); }
.absent  { background-color: var(--absent) !important; color: white; border-color: var(--absent); }

/* مودال پیام (Alert) مدرن */
#custom-alert {
  background-color: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}

.alert-box {
  background: var(--bg-container);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-soft);
  color: var(--text-main);
  border-radius: 20px;
}

.alert-box button {
  background: linear-gradient(135deg, var(--correct) 0%, #45b988 100%);
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(96, 218, 168, 0.4);
}

/* RTL Helper */
.rtl { direction: rtl; }
.hidden { display: none !important; }










/* کانتینر اصلی کیبورد */
.keybord {
  display: flex;
  flex-direction: column;
  gap: 8px; /* فاصله بین ردیف‌ها */
  width: 100%;
  max-width: 500px; /* جلوگیری از کشیدگی بیش از حد در دسکتاپ */
  margin-left: auto;
  margin-right: auto;
  user-select: none;
  padding: 10px;
}

.keybord > div {
  display: flex;
  justify-content: center;
  gap: 6px; /* فاصله بین دکمه‌ها */
}

/* استایل پایه برای تمام دکمه‌ها */
.keys, .last, .reset {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 52px; /* ارتفاع استاندارد */
  border-radius: 8px; /* گردی گوشه‌ها */
  font-family: 'Baloo Bhaijaan 2', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.1s ease-in-out; /* انیمیشن سریع برای کلیک */
  text-decoration: none;
  position: relative;
  border: none;
}

/* --- دکمه‌های حروف معمولی --- */
.keys {
  flex: 1;
  background-color: #e2e8f0; /* رنگ پس‌زمینه */
  color: var(--primary);
  /* سایه ضخیم پایین برای ایجاد حالت سه‌بعدی */
  box-shadow: 0 4px 0 #94a3b8; 
}

.keys:active {
  transform: translateY(4px); /* حرکت به پایین هنگام کلیک */
  box-shadow: none; /* حذف سایه برای حس فرو رفتن */
}

/* --- دکمه‌های ویژه (ثبت و حذف) --- */
.last {
  flex: 1.5;
  color: white;
  font-size: 1rem;
}

/* دکمه ثبت (رنگ مورد علاقه شما + استایل مدرن) */
.enter {
  /* گرادینت شما */
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  /* سایه تیره‌تر از رنگ اصلی برای بُعد */
  box-shadow: 0 4px 0 #0f1f3d; 
}

.enter:active {
  transform: translateY(4px);
  box-shadow: none;
}

/* دکمه حذف (مدرن شده) */
.delete {
  background-color: #ef4444; /* قرمز روشن‌تر و زنده‌تر */
  /* سایه زرشکی برای بُعد */
  box-shadow: 0 4px 0 #b91c1c; 
}

.delete:active {
  transform: translateY(4px);
  box-shadow: none;
}
/* اضافه کردن آیکون SVG به جای متن حذف (اختیاری - اگر مایل بودید متن بماند این بخش را نادیده بگیرید) */
/* اما اگر متن "حذف" را نگه می‌دارید، فونت آن در کلاس .last تنظیم شده است */


/* --- دکمه شروع مجدد --- */
.reset {
  width: 100%;
  background-color: transparent;
  color: var(--absent); /* رنگ خاکستری ملایم */
  border: 2px dashed var(--border-light); /* حاشیه خط‌چین */
  box-shadow: none;
  font-size: 1rem;
}

.reset:hover {
  background-color: #fff1f2; /* قرمز خیلی کمرنگ هنگام هاور */
  color: #ef4444;
  border-color: #ef4444;
  border-style: solid; /* تبدیل خط‌چین به خط صاف */
}

.reset:active {
  transform: scale(0.98);
}

/* --- ریسپانسیو برای موبایل --- */
@media (max-width: 480px) {
  .keybord {
    padding: 0px;
    gap: 6px;
  }
  
  .keys, .last {
    height: 48px; /* ارتفاع کمی کمتر در موبایل */
    font-size: 0.95rem;
    border-radius: 6px;
    box-shadow: 0 3px 0 #94a3b8; /* سایه کمی کوتاه‌تر */
  }
  
  .enter {
     box-shadow: 0 3px 0 #0f1f3d;
  }
  
  .delete {
     box-shadow: 0 3px 0 #b91c1c;
  }

  .keys:active, .last:active {
    transform: translateY(3px);
  }
}






/* تنظیم کلی ردیف‌ها */
.keybord > div {
  display: flex;
  justify-content: center;
  gap: 5px; /* فاصله مناسب بین کلیدها */
  margin-bottom: 8px;
  width: 100%;
}

/* استایل کلیدهای حروف */
.keys {
  flex: 1;
  max-width: 45px; /* جلوگیری از کشیده شدن در دسکتاپ */
  height: 50px;
  background-color: #e2e8f0;
  color: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  box-shadow: 0 4px 0 #cbd5e1;
  cursor: pointer;
  transition: all 0.1s;
}

.keys:active {
  transform: translateY(3px);
  box-shadow: none;
}

/* تنظیم دکمه‌های ثبت و حذف در ردیف آخر */
.row-4 .last {
  flex: 1.8; /* کمی بزرگتر از حروف معمولی */
  height: 50px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: bold;
  color: white;
}

.delete {
  background-color: #ef4444;
  box-shadow: 0 4px 0 #b91c1c;
}

.enter {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  box-shadow: 0 4px 0 #0f1f3d;
}












.keys {
  flex: 1; /* اجازه بدهید کلیدها فضای مساوی بگیرند */
  min-width: 0; /* اجازه به کلید برای کوچک شدن فراتر از محتوا */
  max-width: 45px; /* فقط در مانیتورهای بزرگ محدود شود */
  height: 48px;
  font-size: 1.1rem;
  /* بقیه استایل‌های ظاهری شما مثل رنگ و سایه */
}

/* تنظیم دکمه‌های بزرگتر در ردیف ۴ */
.row-4 .last {
  flex: 1.5; /* نسبت به دکمه‌های معمولی کمی بزرگتر باشد اما نه خیلی زیاد */
  min-width: 0;
  height: 48px;
}


















.toast-container {
  position: fixed;
  bottom: 24px;
  left: 24px; /* RTL-friendly */
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 99999;
}

.toast {
  min-width: 260px;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 14px;
  color: #fff;
  font-weight: bold;
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
  animation: toast-in 0.25s ease forwards;
  position: relative;
}

.toast.success { background: #16a34a; }
.toast.error   { background: #ef4444; }
.toast.warning { background: #f59e0b; }

.toast .close {
  position: absolute;
  top: 6px;
  left: 10px;
  cursor: pointer;
  font-size: 24px;
  opacity: 0.8;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(-10px) scale(0.95);
  }
}









.desc-header h3 {
    color: var(--primary);
    margin-top: 0;
    font-size: 1.5rem;
}

.guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.guide-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-input);
    padding: 12px;
    border-radius: 12px;
}

.status-circle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    flex-shrink: 0;
}

.desc-footer {
    border-top: 1px solid var(--border-light);
    padding-top: 15px;
    font-style: italic;
    color: var(--accent);
    text-align: center;
}

/* بهینه‌سازی عنوان اصلی برای سئو */
h1 {
    font-size: 2.2rem;
    color: var(--primary);
    margin-bottom: 10px;
}