/* تم پیش‌فرض: تیره */
:root,
[data-theme="dark"] {
  --bg: #0f172a;
  --nav-bg: #162032;
  --surface: #1e293b;
  --surface-hover: #263349;
  --surface-subtle: #162032;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --border: #334155;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --green: #4ade80;
  --green-bg: rgba(34, 197, 94, 0.16);
  --red: #f87171;
  --red-bg: rgba(239, 68, 68, 0.16);
  --red-border: rgba(248, 113, 113, 0.45);
  --warn-bg: rgba(245, 158, 11, 0.14);
  --warn-border: rgba(245, 158, 11, 0.4);
  --warn-text: #fbbf24;
  --badge-blue-bg: rgba(59, 130, 246, 0.18);
  --badge-blue-text: #93c5fd;
  --badge-teal-bg: rgba(20, 184, 166, 0.18);
  --badge-teal-text: #5eead4;
  --ghost-hover: #334155;
  --toast-bg: #334155;
  --toast-text: #f8fafc;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  --radius: 14px;
  --base-font-size: 16px;
  --font-scale: 1;
  /* رنگ‌بندی اختصاصی منوها (متفاوت از دکمه‌های آبی عملیات) */
  --nav-accent: #2dd4bf;
  --nav-active-bg: rgba(45, 212, 191, 0.12);
  --submenu-accent: #8b5cf6;
  --submenu-accent-deep: #6d28d9;
  --submenu-soft-bg: rgba(139, 92, 246, 0.11);
  --submenu-soft-border: rgba(167, 139, 250, 0.45);
  --submenu-soft-text: #ddd6fe;
  --submenu-halo-soft: rgba(139, 92, 246, 0.22);
  --submenu-halo-strong: rgba(124, 58, 237, 0.48);
  --submenu-ring: rgba(196, 181, 253, 0.35);
  /* پس‌زمینه کادر عنوان پشتیبان‌گیری و بازیابی */
  --backup-head-bg: rgba(20, 184, 166, 0.14);
  --backup-head-border: rgba(45, 212, 191, 0.35);
  --backup-head-accent: #2dd4bf;
  --restore-head-bg: rgba(139, 92, 246, 0.15);
  --restore-head-border: rgba(167, 139, 250, 0.38);
  --restore-head-accent: #a78bfa;
}

/* تم روشن */
[data-theme="light"] {
  --bg: #f4f6f9;
  --nav-bg: #ffffff;
  --surface: #ffffff;
  --surface-hover: #eff6ff;
  --surface-subtle: #f1f5f9;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --green: #15803d;
  --green-bg: #dcfce7;
  --red: #b91c1c;
  --red-bg: #fee2e2;
  --red-border: #fca5a5;
  --warn-bg: #fffbeb;
  --warn-border: #fde68a;
  --warn-text: #92400e;
  --badge-blue-bg: #dbeafe;
  --badge-blue-text: #1e40af;
  --badge-teal-bg: #ccfbf1;
  --badge-teal-text: #115e59;
  --ghost-hover: #e2e8f0;
  --toast-bg: #1e293b;
  --toast-text: #ffffff;
  --shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
  /* رنگ‌بندی اختصاصی منوها در تم روشن */
  --nav-accent: #0f766e;
  --nav-active-bg: rgba(15, 118, 110, 0.1);
  --submenu-accent: #7c3aed;
  --submenu-accent-deep: #5b21b6;
  --submenu-soft-bg: rgba(124, 58, 237, 0.07);
  --submenu-soft-border: rgba(124, 58, 237, 0.32);
  --submenu-soft-text: #5b21b6;
  --submenu-halo-soft: rgba(124, 58, 237, 0.14);
  --submenu-halo-strong: rgba(109, 40, 217, 0.34);
  --submenu-ring: rgba(124, 58, 237, 0.24);
  /* پس‌زمینه کادر عنوان پشتیبان‌گیری و بازیابی در تم روشن */
  --backup-head-bg: #f0fdfa;
  --backup-head-border: #99f6e4;
  --backup-head-accent: #0d9488;
  --restore-head-bg: #f5f3ff;
  --restore-head-border: #ddd6fe;
  --restore-head-accent: #7c3aed;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: calc(var(--base-font-size) * var(--font-scale));
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: "Vazirmatn", "IRANSans", "Segoe UI", Tahoma, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.85;
  min-height: 100vh;
  padding-bottom: calc(48px + env(safe-area-inset-bottom));
  overflow-x: hidden;
  transition: background-color 0.2s, color 0.2s;
}

.hidden {
  display: none !important;
}

/* نوار منوی ثابت بالای همه صفحات */
.navbar {
  position: sticky;
  top: 0;
  padding-top: env(safe-area-inset-top);
  z-index: 50;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 22px;
}

.navbar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.navbar-top-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* برند در گوشه بالا و سمت راست: تصویر + سالار هم‌تراز با نوار ابزار */
.brand-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  padding: 2px 2px;
  text-align: right;
  flex-shrink: 0;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}

.brand-name {
  font-size: 1.32rem;
  font-weight: 800;
  line-height: 1.2;
}

.brand-tagline {
  margin: -2px 2px 0;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.4;
}

/* نوار ابزار کوچک (زوم، تمام‌نما، تم) در چپ‌ترین بخش ردیف اول */
.toolbar-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.zoom-group {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
  background: var(--surface);
}

.zoom-group .tool-btn {
  border: none;
  border-radius: 0;
  padding: 6px 10px;
}

.zoom-group .tool-btn + .tool-btn {
  border-right: 1px solid var(--border);
}

.tool-btn {
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 6px 11px;
  min-height: 36px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s;
}

.tool-btn:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--primary);
}

.tool-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.tool-btn-pct {
  min-width: 52px;
  color: var(--muted);
  font-size: clamp(12px, 0.8rem, 16px);
}

.mobile-menu-btn {
  display: none;
}

/* لینک‌های منو */
.nav-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* منوی اصلی با طرح خط زیرین فیروزه‌ای — کاملاً متمایز از دکمه‌های عملیات */
.nav-btn {
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 8px 15px 9px;
  min-height: 40px;
  border-radius: 10px 10px 4px 4px;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.nav-btn:hover {
  background: var(--nav-active-bg);
  color: var(--text);
  border-bottom-color: var(--border);
}

.nav-btn.active {
  background: var(--nav-active-bg);
  color: var(--nav-accent);
  border-bottom-color: var(--nav-accent);
  font-weight: 700;
}

/* بدنه اصلی */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}

.page-header h1 {
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.5;
}

.section-subtitle {
  color: var(--muted);
  margin-bottom: 14px;
  font-size: 0.96rem;
}

/* کارت‌ها */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.seo-intro-card {
  margin-top: 20px;
  background: var(--surface-subtle);
}

.seo-intro-card h2 {
  font-size: 1.08rem;
  margin-bottom: 8px;
}

.seo-intro-card p {
  font-size: 0.92rem;
  color: var(--muted);
}

.resume-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--warn-bg);
  border-color: var(--warn-border);
}

.resume-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.resume-header-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}

.resume-subtitle {
  font-size: 0.88rem;
  margin: 0;
}

.resume-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.resume-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--warn-border);
}

.resume-row-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.resume-row-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.resume-row-meta {
  font-size: 0.86rem;
  color: var(--muted);
}

.resume-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* شبکه انتخاب مقاطع (اول تا ششم) */
.grades-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.grade-card-btn {
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 20px 18px;
  min-height: 112px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  text-align: right;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, background-color 0.15s, transform 0.1s;
}

.grade-card-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--surface-hover);
  transform: translateY(-2px);
}

.grade-card-btn:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.grade-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.grade-meta {
  font-size: 0.88rem;
  color: var(--muted);
}

/* شبکه دکمه‌های درس‌ها */
.lessons-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.lesson-item {
  display: flex;
  align-items: stretch;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, background-color 0.15s;
}

.lesson-item:hover {
  border-color: var(--primary);
  background: var(--surface-hover);
}

.lesson-item-all {
  grid-column: 1 / -1;
}

.lesson-main-btn {
  flex: 1;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 15px 16px;
  min-height: 54px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  text-align: right;
}

.lesson-reset-btn {
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 0 14px;
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
}

.lesson-reset-btn:hover {
  background: var(--red-bg);
  color: var(--red);
}

.lesson-pill {
  font-size: 0.82rem;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--surface-subtle);
  color: var(--muted);
}

.lesson-pill.has-wrong {
  background: var(--red-bg);
  color: var(--red);
}

.lesson-pill.all-ok {
  background: var(--green-bg);
  color: var(--green);
}

/* کارت‌های املا و معنی */
.modes-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.mode-card {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.mode-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

.mode-header h2 {
  font-size: 1.12rem;
}

.stats-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.92rem;
  color: var(--muted);
  background: var(--surface-subtle);
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
}

.mode-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* صفحه نصب آفلاین و به‌روزرسانی */
.install-hero-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-color: var(--primary);
}

.install-hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.install-hero-text {
  flex: 1;
  min-width: 240px;
}

.install-hero-card .update-status-box {
  margin-bottom: 0;
}

.install-box.install-box-highlight {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--badge-blue-bg);
}

.install-hero-card h2 {
  font-size: 1.12rem;
  margin: 6px 0;
}

.install-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.install-box {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.install-box h3 {
  font-size: 1.02rem;
  margin-bottom: 10px;
  color: var(--badge-blue-text);
}

.install-steps {
  padding-right: 20px;
  font-size: 0.92rem;
}

.install-steps li {
  margin-bottom: 8px;
}

.update-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.update-status-box {
  margin-bottom: 14px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.94rem;
  font-weight: 600;
  border: 1px solid transparent;
  line-height: 1.7;
}

.update-status-box.ok {
  background: var(--green-bg);
  color: var(--green);
  border-color: var(--green);
}

.update-status-box.info {
  background: var(--badge-blue-bg);
  color: var(--badge-blue-text);
  border-color: var(--primary);
}

.update-status-box.warn {
  background: var(--warn-bg);
  color: var(--warn-text);
  border-color: var(--warn-border);
}

/* صفحات درباره و نام‌گذاری */
.info-card h2,
.naming-text h2 {
  font-size: 1.18rem;
  margin-bottom: 12px;
}

.info-card p,
.naming-text p {
  margin-bottom: 12px;
}

.info-list {
  padding-right: 20px;
  margin-bottom: 14px;
}

.info-list li {
  margin-bottom: 8px;
}

.naming-card {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 22px;
  align-items: start;
}

.naming-photo-wrap {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
}

.naming-photo {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

.about-subheading {
  font-size: 1.02rem;
  font-weight: 700;
  margin: 18px 0 8px;
  color: var(--nav-accent);
}

.developer-info {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 16px;
}

.developer-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary);
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

.developer-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.developer-info p {
  margin-bottom: 0;
}

.developer-info a {
  color: var(--badge-blue-text);
  font-weight: 700;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.developer-info a:hover {
  text-decoration: underline;
}

.naming-figure {
  margin: 0;
}

.naming-quote {
  margin: 14px 0;
  padding: 14px 16px;
  border-right: 4px solid var(--primary);
  border-radius: 10px;
  background: var(--surface-subtle);
  color: var(--text);
  line-height: 1.9;
}

code {
  background: var(--surface-subtle);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.88rem;
}

/* برچسب‌ها */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}

.badge-blue {
  background: var(--badge-blue-bg);
  color: var(--badge-blue-text);
}

.badge-teal {
  background: var(--badge-teal-bg);
  color: var(--badge-teal-text);
}

.badge-warn {
  background: var(--warn-bg);
  color: var(--warn-text);
  border: 1px solid var(--warn-border);
}

.badge-muted {
  background: var(--surface-subtle);
  color: var(--muted);
}

.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-muted { color: var(--muted); }

/* دکمه‌ها */
.btn {
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 600;
  padding: 11px 18px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-sm {
  font-size: 0.9rem;
  padding: 8px 14px;
  min-height: 40px;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-outline:hover {
  background: var(--surface-hover);
  border-color: var(--primary);
}

.btn-danger-outline {
  background: var(--surface);
  color: var(--red);
  border-color: var(--red-border);
}

.btn-danger-outline:hover {
  background: var(--red-bg);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  background: var(--ghost-hover);
}

/* نوار پایین صفحات */
.page-bottom-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
}

.bottom-bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* صفحه آزمون */
.quiz-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.quiz-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.progress-text {
  font-size: 0.94rem;
  color: var(--muted);
  font-weight: 600;
}

.progress-track {
  height: 9px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 16px;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.25s ease;
}

.lesson-tag {
  font-size: 0.86rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.question-prompt {
  font-size: 1.24rem;
  font-weight: 700;
  margin-bottom: 22px;
  line-height: 1.95;
}

.options-grid {
  display: grid;
  gap: 12px;
}

.options-grid.cols-1 { grid-template-columns: 1fr; }
.options-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.options-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

.option-btn {
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  padding: 16px 16px;
  min-height: 56px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text);
  cursor: pointer;
  text-align: center;
  line-height: 1.65;
  transition: border-color 0.15s, background-color 0.15s;
}

.options-grid.meaning-mode .option-btn {
  font-size: 1.05rem;
  font-weight: 600;
  text-align: right;
  padding: 15px 18px;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--surface-hover);
}

.option-btn:disabled {
  cursor: default;
}

.option-btn.correct {
  border-color: var(--green);
  background: var(--green-bg);
  color: var(--green);
}

.option-btn.wrong {
  border-color: var(--red);
  background: var(--red-bg);
  color: var(--red);
}

.feedback-box {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.98rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.feedback-main {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.feedback-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.feedback-action {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.feedback-action .btn {
  white-space: nowrap;
  min-width: 124px;
}

.feedback-box.ok {
  background: var(--green-bg);
  color: var(--green);
}

.feedback-box.err {
  background: var(--red-bg);
  color: var(--red);
}

/* صفحه نتیجه */
.result-card {
  text-align: center;
  padding: 28px 20px;
  margin-bottom: 0;
}

.result-summary {
  color: var(--muted);
  margin: 8px 0 20px;
}

.result-stats {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.res-box {
  min-width: 135px;
  padding: 14px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.res-box strong {
  font-size: 1.65rem;
}

.res-ok {
  background: var(--green-bg);
  color: var(--green);
}

.res-wrong {
  background: var(--red-bg);
  color: var(--red);
}

.result-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

/* پیام کوتاه */
.toast {
  position: fixed;
  bottom: calc(22px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--toast-bg);
  color: var(--toast-text);
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 0.95rem;
  max-width: 92vw;
  text-align: center;
  z-index: 100;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* بهینه‌سازی تبلت (تا 900 پیکسل) */
@media (max-width: 900px) {
  :root {
    --base-font-size: 17px;
  }

  .install-grid {
    grid-template-columns: 1fr;
  }

  .grades-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* بهینه‌سازی ویژه گوشی موبایل (تا 680 پیکسل) */
@media (max-width: 680px) {
  :root {
    --base-font-size: 17.5px;
  }

  .navbar {
    position: static;
    margin-bottom: 16px;
  }

  .navbar-inner {
    padding: 10px 12px;
    gap: 8px;
  }

  .navbar-top-row {
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    flex-wrap: nowrap;
  }

  .brand-btn {
    gap: 7px;
  }

  .brand-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }

  .brand-name {
    font-size: 1.15rem;
  }

  .brand-tagline {
    font-size: 0.76rem;
    margin-top: -1px;
  }

  .toolbar-controls {
    width: auto;
    justify-content: flex-end;
    gap: 4px;
    flex-wrap: wrap;
  }

  .zoom-group .tool-btn {
    padding: 5px 7px;
  }

  .tool-btn {
    min-height: 34px;
    padding: 5px 8px;
    font-size: 0.8rem;
  }

  /* تب‌های منوی اصلی در موبایل — رشد طبیعی فونت هم‌گام با زوم و شکستن تمیز زیر هم */
  .nav-links {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding-top: 8px;
  }

  .nav-btn {
    width: auto;
    max-width: 100%;
    text-align: center;
    font-size: clamp(13px, 0.85rem, 26px);
    line-height: 1.4;
    padding: 7px 12px;
    min-height: 36px;
    border-radius: 9px 9px 4px 4px;
    border: 1px solid var(--border);
    border-bottom: 2.5px solid transparent;
    background: var(--surface-subtle);
    white-space: normal;
    overflow-wrap: break-word;
  }

  .nav-btn.active {
    border-color: var(--nav-accent);
    border-bottom: 2.5px solid var(--nav-accent);
    background: var(--nav-active-bg);
    color: var(--nav-accent);
    font-weight: 700;
  }

  .container {
    padding: 0 12px;
  }

  .card {
    padding: 16px 14px;
  }

  .lessons-grid,
  .modes-grid,
  .naming-card {
    grid-template-columns: 1fr;
  }

  .options-grid.cols-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .question-prompt {
    font-size: 1.28rem;
  }

  .option-btn {
    font-size: 1.18rem;
    min-height: 58px;
    padding: 16px 14px;
  }

  .feedback-box {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .feedback-action,
  .feedback-action .btn {
    width: 100%;
  }

  .page-bottom-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .page-bottom-bar .btn,
  .bottom-bar-actions .btn {
    width: 100%;
  }
}

/* گوشی‌های باریک‌تر (تا 420 پیکسل) */
@media (max-width: 420px) {
  .grades-grid,
  .options-grid.cols-2,
  .options-grid.cols-3 {
    grid-template-columns: 1fr;
  }
}

/* استایل بخش طراحی سؤال کارتی و بارگیری/پشتیبان‌گیری (نسخه ۲.۳) */
.badge-custom {
  background: var(--warn-bg);
  color: var(--warn-text);
  border: 1px solid var(--warn-border);
}

.lesson-custom-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  margin-right: 6px;
  background: var(--badge-teal-bg);
  color: var(--badge-teal-text);
  vertical-align: middle;
}

.mode-custom-note {
  font-size: 0.82rem;
  color: var(--badge-teal-text);
  margin-bottom: 10px;
}

.empty-state-box {
  grid-column: 1 / -1;
  text-align: center;
  padding: 28px 18px;
  background: var(--surface);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
}

.empty-state-box p {
  margin-bottom: 14px;
}

/* دو زیرمنوی دکمه‌ای بالای «طراحی سؤال» (رنگ بنفش متمایز از دکمه‌های آبی عملیات و منوی فیروزه‌ای بالا) */
.builder-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
}

.builder-tab {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 10px 20px;
  min-height: 46px;
  border-radius: 999px;
  border: 1.5px solid var(--submenu-soft-border);
  background: var(--submenu-soft-bg);
  color: var(--submenu-soft-text);
  box-shadow: 0 0 0 3px var(--submenu-halo-soft);
  opacity: 0.84;
  cursor: pointer;
  transition: background-color 0.18s, color 0.18s, border-color 0.18s, box-shadow 0.18s, opacity 0.18s, transform 0.12s;
}

.builder-tab:hover:not(.active) {
  opacity: 1;
  border-color: var(--submenu-accent);
  box-shadow: 0 0 0 4px var(--submenu-halo-soft), 0 3px 10px rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
}

.builder-tab.active {
  opacity: 1;
  background: linear-gradient(135deg, var(--submenu-accent), var(--submenu-accent-deep));
  color: #ffffff;
  border-color: var(--submenu-accent);
  box-shadow: 0 4px 16px var(--submenu-halo-strong), 0 0 0 3px var(--submenu-ring);
}

.builder-total-pill {
  margin-right: auto;
}

/* نوار مسیر قابل کلیک (Breadcrumb) */
.breadcrumb-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  margin-bottom: 16px;
  border-radius: 12px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  font-size: 0.9rem;
}

.crumb-btn {
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
  border: none;
  background: var(--surface);
  color: var(--badge-blue-text);
  cursor: pointer;
  transition: background-color 0.15s;
}

.crumb-btn:hover {
  background: var(--badge-blue-bg);
}

.crumb-current {
  font-weight: 700;
  color: var(--text);
  padding: 4px 6px;
}

.crumb-sep {
  color: var(--muted);
  font-size: 0.85rem;
}

/* شبکه کارت‌های درس و زیربخش در طراحی سؤال */
.builder-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.builder-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  min-height: 124px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: right;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, background-color 0.15s, transform 0.1s;
}

.builder-card:hover {
  border-color: var(--primary);
  background: var(--surface-hover);
  transform: translateY(-2px);
}

.builder-card-custom {
  border-color: var(--warn-border);
}

.builder-card-add {
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 2px dashed var(--primary);
  background: var(--badge-blue-bg);
  color: var(--badge-blue-text);
  font-family: inherit;
}

.builder-card-add:hover {
  background: var(--surface-hover);
}

.builder-card-add-icon {
  font-size: 1.8rem;
  line-height: 1;
  font-weight: 800;
}

.builder-card-add-label {
  font-size: 0.98rem;
  font-weight: 700;
}

.builder-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.builder-card-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.builder-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-action-btn {
  font-family: inherit;
  font-size: 0.96rem;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

.icon-action-btn:hover {
  border-color: var(--primary);
  background: var(--surface);
}

.icon-action-btn.danger:hover {
  border-color: var(--red-border);
  background: var(--red-bg);
  color: var(--red);
}

.builder-card-name {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.5;
}

.builder-card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

/* پنل درون‌خطی ساخت درس یا زیربخش */
.inline-panel {
  border-color: var(--primary);
}

.inline-panel-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.inline-panel-row .form-control {
  flex: 1;
  min-width: 220px;
}

.inline-panel-divider {
  margin: 14px 0 8px;
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 600;
}

.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.preset-chip-btn {
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 8px 14px;
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}

.preset-chip-btn:hover {
  border-color: var(--primary);
  background: var(--badge-blue-bg);
  color: var(--badge-blue-text);
}

.preset-chip-btn.added {
  border-color: var(--green);
  background: var(--green-bg);
  color: var(--green);
}

/* نوار بالای مرحله ۴ (سؤال‌های زیربخش) */
.builder-q-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.builder-q-heading {
  font-size: 1.15rem;
  margin-bottom: 4px;
}

.builder-q-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.builder-intro-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.builder-intro-head h2 {
  font-size: 1.14rem;
  margin-bottom: 4px;
}

.builder-card-title {
  font-size: 1.02rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field label {
  font-size: 0.92rem;
  font-weight: 700;
}

.form-control {
  width: 100%;
  font-family: inherit;
  font-size: max(16px, 0.96rem);
  padding: 10px 12px;
  min-height: 44px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text);
  line-height: 1.6;
  transition: border-color 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
}

textarea.form-control {
  resize: vertical;
  min-height: 76px;
}

.input-correct {
  border-color: var(--green);
}

.field-help {
  font-size: 0.82rem;
  color: var(--muted);
}

.inline-create-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.builder-form-header,
.builder-list-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.builder-form-header .builder-card-title,
.builder-list-header .builder-card-title {
  margin-bottom: 0;
}

.question-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.wrong-options-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.form-submit-row {
  display: flex;
  justify-content: flex-end;
}

.builder-questions-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.custom-q-item {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.custom-q-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.custom-q-prompt {
  font-weight: 700;
  font-size: 0.98rem;
  flex: 1;
}

.custom-q-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.mini-btn {
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}

.mini-btn:hover {
  border-color: var(--primary);
  background: var(--surface-hover);
}

.mini-btn-danger {
  color: var(--red);
  border-color: var(--red-border);
}

.mini-btn-danger:hover {
  background: var(--red-bg);
}

.custom-q-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.opt-pill {
  font-size: 0.84rem;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
}

.opt-pill.opt-ok {
  background: var(--green-bg);
  color: var(--green);
  border-color: transparent;
  font-weight: 700;
}

.custom-q-hint {
  font-size: 0.84rem;
  color: var(--muted);
}

/* بخش بارگیری و پشتیبان‌گیری — چیدمان روی هم در همه دستگاه‌ها */
.backup-restore-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: start;
}

.backup-restore-grid > .card {
  margin-bottom: 0;
}

/* کادر عنوان واضح و پس‌زمینه‌دار برای پشتیبان‌گیری و بازیابی */
.panel-card-header {
  padding: 12px 16px;
  margin-bottom: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  border-right-width: 5px;
}

.panel-card-header h2 {
  font-size: 1.06rem;
  font-weight: 800;
  line-height: 1.5;
  margin: 0;
}

.panel-card-header-backup {
  background: var(--backup-head-bg);
  border-color: var(--backup-head-border);
  border-right-color: var(--backup-head-accent);
}

.panel-card-header-backup h2 {
  color: var(--backup-head-accent);
}

.panel-card-header-restore {
  background: var(--restore-head-bg);
  border-color: var(--restore-head-border);
  border-right-color: var(--restore-head-accent);
}

.panel-card-header-restore h2 {
  color: var(--restore-head-accent);
}

/* نوار آمار محتوای شخصی با ۳ کارتک رنگی مجزا (بدون نقطه جداکننده کنار صفر) */
.backup-stats-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: 12px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
}

.backup-stats-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  margin-left: 4px;
}

.backup-stat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.stat-chip strong {
  font-size: 0.98rem;
  font-weight: 800;
}

.stat-chip-blue {
  background: var(--badge-blue-bg);
  color: var(--badge-blue-text);
  border-color: rgba(59, 130, 246, 0.28);
}

.stat-chip-teal {
  background: var(--badge-teal-bg);
  color: var(--badge-teal-text);
  border-color: rgba(20, 184, 166, 0.3);
}

.stat-chip-purple {
  background: var(--submenu-soft-bg);
  color: var(--submenu-soft-text);
  border-color: var(--submenu-soft-border);
}

.backup-note {
  font-size: 0.9rem;
  margin-bottom: 14px;
}

.backup-scope-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.backup-lesson-picker {
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: 12px;
  background: var(--surface-subtle);
  border: 1px dashed var(--primary);
}

.selective-export-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
  align-items: center;
}

.backup-primary-action {
  margin-bottom: 12px;
}

.restore-card > p {
  font-size: 0.91rem;
  margin-bottom: 14px;
}

.restore-picker-row {
  margin-bottom: 14px;
}

.restore-preview-box {
  margin-top: 14px;
  padding: 14px;
  border-radius: 12px;
  background: var(--surface-subtle);
  border: 1.5px solid var(--submenu-accent);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.restore-preview-head p {
  margin-top: 4px;
  font-size: 0.88rem;
}

.restore-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.restore-mode-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}

.restore-mode-option input[type="radio"] {
  margin-top: 5px;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--primary);
}

.restore-mode-option.selected {
  border-color: var(--primary);
  background: var(--surface-hover);
}

.restore-mode-option.selected-danger {
  border-color: var(--red);
  background: var(--red-bg);
}

.restore-mode-title {
  font-weight: 700;
  font-size: 0.96rem;
  margin-bottom: 4px;
}

.restore-mode-desc {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.65;
}

.replace-danger-box {
  padding: 14px;
  border-radius: 10px;
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  color: var(--red);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 600;
}

.restore-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 900px) {
  .backup-restore-grid {
    grid-template-columns: 1fr;
  }
  .builder-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .backup-scope-grid,
  .selective-export-row,
  .restore-mode-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .builder-tabs {
    flex-direction: column;
    align-items: stretch;
  }
  .builder-total-pill {
    margin-right: 0;
    text-align: center;
  }
  .builder-cards-grid,
  .wrong-options-grid {
    grid-template-columns: 1fr;
  }
  .builder-q-toolbar-actions,
  .builder-q-toolbar-actions .btn,
  .form-submit-row .btn,
  .restore-confirm-actions .btn,
  .backup-primary-action .btn,
  .restore-picker-row .btn,
  .replace-danger-box .btn {
    width: 100%;
  }
  .developer-avatar {
    width: 62px;
    height: 62px;
  }
}

/* بهینه‌سازی لمسی اندروید و iOS (جلوگیری از زوم ناخواسته با ضربه سریع) */
button,
.builder-card,
.grade-card-btn,
.option-btn,
.restore-mode-option,
.preset-chip-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.backup-primary-action,
.restore-picker-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.paste-restore-box {
  margin-bottom: 14px;
  padding: 14px;
  border-radius: 12px;
  background: var(--surface-subtle);
  border: 1px dashed var(--primary);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.paste-restore-box label {
  font-size: 0.9rem;
  font-weight: 700;
}

@media (max-width: 680px) {
  .backup-primary-action .btn,
  .restore-picker-row .btn,
  .paste-restore-box .btn {
    width: 100%;
  }
}

/* حفظ خوانایی و جلوگیری از به‌هم‌ریختگی نوار بالا و متون در زوم ۱۵۰٪ تا ۲۰۰٪ */
.brand-name {
  font-size: clamp(19px, 1.3rem, 26px);
}

.brand-tagline {
  font-size: clamp(11px, 0.76rem, 15px);
}

.tool-btn {
  font-size: clamp(13px, 0.84rem, 17px);
}

.question-prompt,
.option-btn,
.lesson-main-btn,
.builder-card-name,
.custom-q-prompt,
.grade-title {
  overflow-wrap: break-word;
  word-break: break-word;
}

@media (max-width: 680px) {
  .brand-name {
    font-size: clamp(16px, 1.12rem, 21px);
  }

  .brand-tagline {
    font-size: clamp(11px, 0.74rem, 13.5px);
  }

  .tool-btn {
    min-height: 34px;
    padding: 5px 8px;
    font-size: clamp(11.5px, 0.78rem, 14px);
  }

  .zoom-group .tool-btn {
    padding: 5px 7px;
  }

  .tool-btn-pct {
    min-width: 38px;
    font-size: clamp(11px, 0.74rem, 13.5px);
  }
}

/* ==========================================================================
   نسخه ۲.۱۰: بنر سراسری و تصاویر گرافیکی «سالار» (سازگار با موبایل، ویندوز و تم تیره/روشن)
   ========================================================================== */

/* بنر سراسری بالای صفحات (زیر منوی ثابت، بدون اشغال فضا هنگام اسکرول در موبایل) */
.site-banner-wrap {
  width: 100%;
  max-width: 680px;
  margin: 0 auto 16px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.site-banner-img {
  display: block;
  width: 100%;
  height: auto;
}

/* قاب استاندارد تصاویر ۱۹۲ پیکسلی سالار (تمیز در تم روشن و تیره، بدون نمایش لبه‌های اضافی برش) */
.salar-sticker-frame {
  background: #ffffff;
  border: 1.5px solid var(--border);
  border-radius: 18px;
  padding: 3px;
  box-shadow: var(--shadow);
  overflow: hidden;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.salar-sticker-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 14px;
  clip-path: inset(0px 3px 2px 3px round 12px);
}

.salar-sticker-sm {
  width: 78px;
  height: 78px;
}

.salar-sticker-md {
  width: 92px;
  height: 92px;
}

.salar-sticker-lg {
  width: 136px;
  height: 136px;
  border-radius: 22px;
}

/* چیدمان تصویر در کارت آزمون نیمه‌کاره */
.resume-lead {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 220px;
}

/* تصویر نتیجه پایان تمرین */
.result-sticker-wrap {
  margin: 0 auto 14px;
  animation: salarStickerPop 0.35s cubic-bezier(0.22, 1.25, 0.36, 1);
}

@keyframes salarStickerPop {
  0% { opacity: 0; transform: scale(0.86); }
  100% { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .result-sticker-wrap {
    animation: none;
  }
}

/* بهینه‌سازی نمایش بنر و تصاویر در گوشی‌های موبایل (عمودی و افقی) */
@media (max-width: 680px) {
  .site-banner-wrap {
    max-width: 100%;
    margin-bottom: 12px;
    border-radius: 12px;
  }

  .salar-sticker-sm {
    width: 66px;
    height: 66px;
    border-radius: 14px;
  }

  .salar-sticker-md {
    width: 78px;
    height: 78px;
    border-radius: 16px;
  }

  .salar-sticker-lg {
    width: 118px;
    height: 118px;
    border-radius: 20px;
  }

  .resume-lead {
    width: 100%;
    min-width: 0;
  }

  .resume-actions {
    width: 100%;
  }

  .resume-actions .btn-primary {
    flex: 1;
  }
}

/* در گوشی‌های بسیار باریک یا زوم ۲۰۰٪، تصویر و متن راهنما عمودی و خواناتر چیده می‌شوند */
@media (max-width: 420px) {
  .feedback-main {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }
}

/* در حالت افقی گوشی (Landscape) بنر و کادر بازخورد جمع‌وجور و افقی می‌مانند تا فضای عمودی حفظ شود */
@media (max-height: 500px) and (orientation: landscape) {
  .site-banner-wrap {
    max-width: 420px;
    margin-bottom: 10px;
  }
  .feedback-box {
    flex-direction: row;
    align-items: center;
  }
  .feedback-action,
  .feedback-action .btn {
    width: auto;
  }
}

/* ==========================================================================
   نسخه ۲.۱۱: نمایش نیم‌ثانیه‌ای تصویر تشویقی روی کارت سؤال و فهرست آزمون‌های نیمه‌کاره
   ========================================================================== */
.question-card {
  position: relative;
}

.quiz-praise-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(1.5px);
  border-radius: var(--radius);
  pointer-events: none;
  animation: salarPraiseFade 0.18s ease-out;
}

.salar-sticker-praise {
  width: 132px;
  height: 132px;
  border-radius: 22px;
  border-color: var(--green);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.24);
  animation: salarStickerPop 0.2s cubic-bezier(0.22, 1.35, 0.36, 1);
}

@keyframes salarPraiseFade {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .quiz-praise-overlay,
  .salar-sticker-praise {
    animation: none;
  }
}

@media (max-width: 680px) {
  .resume-row {
    padding: 10px 12px;
  }
  .resume-row-info {
    width: 100%;
  }
  .salar-sticker-praise {
    width: 112px;
    height: 112px;
    border-radius: 18px;
  }
}

/* ==========================================================================
   نسخه ۲.۱۳: دکمه‌ی بازنشانی با تم قرمز ملایم و بهینه‌سازی نوار بالا
   ========================================================================== */
.btn-danger-soft {
  background: var(--red-bg);
  color: var(--red);
  border-color: var(--red-border);
}

.btn-danger-soft:hover:not(:disabled) {
  background: var(--red-bg);
  border-color: var(--red);
  filter: brightness(0.96);
}

.developer-link-row + .developer-link-row {
  margin-top: 6px;
}

@media (max-width: 680px) {
  .install-hero-top .btn {
    width: 100%;
  }
}

/* ==========================================================================
   نسخه ۲.۱۶: دکمه‌ی شناور بازگشت به منوها و تثبیت حاشیه اسکرول آزمون و طراحی سؤال
   ========================================================================== */
#quiz-view,
#builder-form-card {
  scroll-margin-top: 132px;
}

.scroll-top-btn {
  position: fixed;
  left: 18px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 60;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  background: var(--primary);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.28);
  transition: transform 0.18s ease, background-color 0.15s ease, opacity 0.18s ease;
}

.scroll-top-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
}

.scroll-top-btn:active {
  transform: scale(0.94);
}

.scroll-top-btn:focus-visible {
  outline: 3px solid var(--badge-blue-bg);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .scroll-top-btn {
    transition: none;
  }
}

@media (max-width: 680px) {
  #quiz-view,
  #builder-form-card {
    scroll-margin-top: 10px;
  }

  .scroll-top-btn {
    left: 14px;
    bottom: calc(18px + env(safe-area-inset-bottom));
    width: 42px;
    height: 42px;
  }
}
