:root {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-elevated: #f8fafc;
  --border-color: #e2e8f0;
  --border-highlight: rgba(79, 70, 229, 0.4);
  
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-glow: rgba(79, 70, 229, 0.15);
  
  --green: #059669;
  --green-glow: rgba(5, 150, 105, 0.15);
  --green-bg: #ecfdf5;
  --green-border: #a7f3d0;
  
  --red: #dc2626;
  --red-glow: rgba(220, 38, 38, 0.15);
  --red-bg: #fef2f2;
  --red-border: #fecaca;

  --amber: #d97706;
  --cyan: #0284c7;

  --text-main: #0f172a;
  --text-sub: #475569;
  --text-muted: #94a3b8;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --font: 'Vazirmatn', system-ui, -apple-system, sans-serif;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font);
  background-color: var(--bg-main);
  color: var(--text-main);
  direction: rtl;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  line-height: 1.6;
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(79, 70, 229, 0.04) 0%, transparent 45%),
    radial-gradient(circle at 100% 100%, rgba(5, 150, 105, 0.03) 0%, transparent 40%);
  background-attachment: fixed;
}

.app-container {
  width: 100%;
  max-width: 580px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0 12px 32px;
  position: relative;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px;
  border-bottom: 1px solid #e2e8f0;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 60;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}

.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #4f46e5;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.brand-text h1 {
  font-size: 0.92rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.2px;
  line-height: 1.2;
}

.brand-text .subtitle {
  font-size: 0.65rem;
  color: #64748b;
  display: block;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* AI Button in Header */
.ai-advisor-header-btn {
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  color: #6d28d9;
  height: 30px;
  padding: 0 9px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ai-advisor-header-btn:hover {
  background: #ede9fe;
  border-color: #c4b5fd;
}

.ai-sparkle {
  font-size: 0.8rem;
}

.ai-soon-tag {
  background: #7c3aed;
  color: #ffffff;
  font-size: 0.55rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: var(--radius-full);
}

/* VIP Header Button */
.vip-header-btn {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #047857;
  height: 30px;
  padding: 0 9px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.vip-header-btn:hover {
  background: #d1fae5;
  border-color: #6ee7b7;
}

.vip-svg-icon {
  stroke: #059669;
}

.header-action-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-sub);
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.header-action-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--border-highlight);
}

.icon-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-sub);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.icon-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--border-highlight);
}

.icon-btn.active {
  color: var(--primary);
  border-color: rgba(79, 70, 229, 0.4);
}

/* Breadcrumbs */
.breadcrumb-bar {
  padding: 8px 2px;
  font-size: 0.78rem;
  color: var(--text-sub);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 10px;
}

.breadcrumb-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.bc-item {
  color: var(--text-sub);
  cursor: pointer;
  transition: color 0.15s ease;
}

.bc-item:hover {
  color: var(--primary);
}

.bc-separator {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.bc-current {
  color: var(--text-main);
  font-weight: 700;
  cursor: default;
}

/* =========================================
   COMPACT MODERN HOME VIEW (LEVEL 1)
   ========================================= */
.home-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 2px 10px;
  margin-bottom: 4px;
}

.home-toolbar-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
}

.home-toolbar-title h2 {
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.2px;
}

.home-stats-tag {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748b;
}

.books-compact-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.book-item-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  user-select: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.book-item-card:hover {
  background: #ffffff;
  border-color: #cbd5e1;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.book-item-card.locked {
  opacity: 0.72;
  background: #fafafa;
}

.book-item-lead {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1;
}

.book-item-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid transparent;
}

.book-item-icon svg {
  display: block;
}

.tag-emerald { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.tag-indigo { background: #eef2ff; color: #4338ca; border-color: #c7d2fe; }
.tag-amber { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.tag-rose { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.tag-cyan { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }

.book-item-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 4px;
}

.book-item-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.book-item-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: #64748b;
  font-weight: 500;
}

.book-status-tag.completed {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 6px;
}

.access-tag.vip {
  background: #f8fafc;
  color: #94a3b8;
  border: 1px solid #e2e8f0;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 6px;
}

.book-item-arrow {
  color: #94a3b8;
  display: flex;
  align-items: center;
  margin-right: 8px;
  transition: transform 0.15s ease, color 0.15s ease;
}

.book-item-card:hover .book-item-arrow {
  color: #0f172a;
  transform: translateX(-3px);
}

.book-status-tag.completed {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.book-status-tag.ongoing {
  background: #eef2ff;
  color: var(--primary);
  border: 1px solid #c7d2fe;
}

.book-item-arrow {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  transition: transform 0.2s;
  flex-shrink: 0;
  padding-left: 2px;
}

.book-item-card:hover .book-item-arrow {
  color: var(--text-main);
  transform: translateX(-3px);
}

/* =========================================
   COMPACT VIEWS & NAVIGATION HEADERS
   ========================================= */
.selection-compact-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.view-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 2px 12px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
}

.active-badge-tag {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-sub);
}

.lessons-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 2px 12px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
}

.back-pill-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.back-pill-btn:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: var(--primary);
}

.active-book-tag {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-sub);
}

.lessons-compact-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.lesson-item-row {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 11px 13px;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  user-select: none;
  box-shadow: var(--shadow-sm);
}

.lesson-item-row:hover {
  background: var(--bg-card-hover);
  border-color: #cbd5e1;
  transform: translateX(-2px);
  box-shadow: var(--shadow-md);
}

.lesson-item-row.locked {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.lesson-item-row.locked:hover {
  border-color: #fde68a;
  background: #fffbeb;
}

.lesson-num-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-sub);
  flex-shrink: 0;
}

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

.lesson-item-title {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.lesson-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.lesson-score-pill {
  color: var(--green);
  font-weight: 700;
}

.lesson-action-col {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.access-tag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
}

.access-tag.free {
  background: var(--green-bg);
  color: #047857;
  border: 1px solid var(--green-border);
}

.access-tag.unlocked {
  background: #eef2ff;
  color: var(--primary);
  border: 1px solid #c7d2fe;
}

.access-tag.vip {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.chevron-row {
  color: var(--text-muted);
}

/* =========================================
   STICKY STATS BAR (LEVEL 3)
   ========================================= */
.sticky-stats-bar {
  position: sticky;
  top: 52px;
  z-index: 50;
  background: rgba(248, 250, 252, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 12px 0 10px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.progress-info {
  margin-bottom: 10px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-sub);
  margin-bottom: 6px;
}

.progress-label strong {
  color: var(--text-main);
}

.progress-percent {
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #4f46e5, #059669);
  border-radius: var(--radius-full);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}

.stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.stat-correct .stat-dot { background: var(--green); }
.stat-wrong .stat-dot { background: var(--red); }
.stat-percent .stat-dot { background: var(--cyan); }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-title {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.stat-value {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stat-correct .stat-value { color: var(--green); }
.stat-wrong .stat-value { color: var(--red); }
.stat-percent .stat-value { color: var(--cyan); }

/* Views */
.view-section {
  display: none;
  animation: fadeIn 0.25s ease;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Question Card */
.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 18px;
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
}

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

.badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.lesson-badge {
  background: #eef2ff;
  color: var(--primary);
  border: 1px solid #c7d2fe;
  max-width: 75%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qnum-badge {
  background: #f1f5f9;
  color: var(--text-sub);
  border: 1px solid var(--border-color);
}

.question-text {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.85;
  color: var(--text-main);
  margin-bottom: 22px;
  white-space: pre-line;
}

/* Options */
.options-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: right;
  width: 100%;
  color: var(--text-main);
  font-family: var(--font);
  font-size: 0.95rem;
  line-height: 1.6;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.option-btn:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #cbd5e1;
  transform: translateX(-2px);
}

.option-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-sub);
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.option-text {
  flex: 1;
}

.option-icon {
  margin-right: auto;
  font-size: 1.2rem;
  display: none;
}

/* Option States */
.option-btn.correct {
  background: var(--green-bg) !important;
  border-color: var(--green-border) !important;
  color: #065f46 !important;
  box-shadow: 0 0 12px var(--green-glow);
}

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

.option-btn.correct .option-icon {
  display: inline-block;
  color: var(--green);
}

.option-btn.wrong {
  background: var(--red-bg) !important;
  border-color: var(--red-border) !important;
  color: #991b1b !important;
  box-shadow: 0 0 12px var(--red-glow);
  animation: shake 0.35s ease;
}

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

.option-btn.wrong .option-icon {
  display: inline-block;
  color: var(--red);
}

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

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(4px); }
  50% { transform: translateX(-4px); }
  75% { transform: translateX(2px); }
}

/* Explanation Box */
.explanation-box {
  display: none;
  margin-top: 18px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-right: 4px solid var(--green);
  animation: slideDown 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.explanation-box.active {
  display: block;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.explanation-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.exp-icon {
  font-size: 1.25rem;
}

.exp-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-size: 0.9rem;
  color: var(--text-main);
}

.key-badge {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #166534;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.explanation-body {
  font-size: 0.92rem;
  line-height: 1.85;
  color: #334155;
  text-align: justify;
}

/* Nav Bar */
.nav-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 22px;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  flex: 1;
}

.primary-btn {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  border: none;
  color: #fff;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.primary-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #4338ca, #3730a3);
  transform: translateY(-1px);
}

.secondary-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-sub);
  box-shadow: var(--shadow-sm);
}

.secondary-btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: #cbd5e1;
}

.outline-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-sub);
}

.outline-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

.nav-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

/* Results Report Card */
.results-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  box-shadow: var(--shadow-lg);
  margin-top: 14px;
}

.result-badge-top {
  text-align: center;
  margin-bottom: 24px;
}

.trophy-icon {
  font-size: 2.8rem;
  display: block;
  margin-bottom: 8px;
  animation: bounce 1s infinite alternate;
}

@keyframes bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-4px); }
}

.result-badge-top h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}

.exam-sub {
  font-size: 0.85rem;
  color: var(--text-sub);
}

/* Score Circle */
.score-circle-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px;
}

.score-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: conic-gradient(var(--green) 0%, #e2e8f0 0%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  box-shadow: 0 4px 16px rgba(5, 150, 105, 0.15);
}

.score-circle-inner {
  width: 114px;
  height: 114px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.04);
}

.score-number {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.score-caption {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.performance-level {
  font-size: 0.88rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  background: #eef2ff;
  color: var(--primary);
  border: 1px solid #c7d2fe;
  text-align: center;
}

/* Breakdown Grid */
.results-breakdown {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.breakdown-item {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.bd-label {
  font-size: 0.75rem;
  color: var(--text-sub);
}

.bd-val {
  font-size: 1.1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

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

/* Results Actions */
.results-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

/* Review Section */
.review-section {
  display: none;
  margin-top: 24px;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
}

.review-section.active {
  display: block;
}

.review-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text-main);
}

.review-item {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 12px;
}

.review-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.85rem;
}

.review-qtext {
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 10px;
  color: var(--text-main);
}

.review-exp {
  font-size: 0.85rem;
  color: #334155;
  line-height: 1.7;
  padding: 10px 12px;
  background: #ffffff;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  border-right: 3px solid var(--primary);
}

/* Modals */
.modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  align-items: flex-end;
  justify-content: center;
}

.modal-backdrop.active,
#aiAdvisorModal.active,
#vipModal.active,
#paletteModal.active {
  display: flex !important;
}

.palette-drawer {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 580px;
  padding: 20px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.1);
  animation: slideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.palette-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.palette-header h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
}

.sub-palette-info {
  font-size: 0.75rem;
  color: var(--text-sub);
}

.palette-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 0.78rem;
  color: var(--text-sub);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-box {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-box.correct { background: var(--green); }
.legend-box.wrong { background: var(--red); }
.legend-box.unanswered { background: #f1f5f9; border: 1px solid var(--border-color); }
.legend-box.current { border: 2px solid var(--primary); background: transparent; }

.palette-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.pal-btn {
  aspect-ratio: 1;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pal-btn:hover {
  border-color: var(--primary);
  transform: scale(1.05);
}

.pal-btn.current {
  border: 2px solid var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
}

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

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

/* =========================================
   AI PERSONAL ADVISOR CHAT (مشاور هوشمند کنکور)
   ========================================= */
.ai-advisor-header-btn {
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  color: #6d28d9;
  height: 30px;
  padding: 0 9px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ai-advisor-header-btn:hover {
  background: #ede9fe;
  border-color: #c4b5fd;
}

.ai-sparkle {
  font-size: 0.8rem;
}

.ai-live-tag {
  background: #10b981;
  color: #ffffff;
  font-size: 0.55rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
}

/* Advisor Card in Field List */
.book-item-card.advisor-card {
  background: #fffdf5;
  border-color: #fde68a;
}

.book-item-card.advisor-card:hover {
  background: #fefce8;
  border-color: #f59e0b;
}

.ai-page-chat-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  height: calc(100vh - 130px);
  min-height: 520px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.ai-messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8fafc;
}

.ai-msg {
  display: flex;
  flex-direction: column;
  max-width: 86%;
  animation: fadeIn 0.2s ease;
}

.ai-msg.user {
  align-self: flex-start;
  align-items: flex-start;
}

.ai-msg.bot {
  align-self: flex-end;
  align-items: flex-end;
}

.ai-msg-bubble {
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 0.82rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.ai-msg.user .ai-msg-bubble {
  background: #4f46e5;
  color: #ffffff;
  border-bottom-left-radius: 3px;
}

.ai-msg.bot .ai-msg-bubble {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  border-bottom-right-radius: 3px;
}

.ai-msg-time {
  font-size: 0.6rem;
  color: #94a3b8;
  margin-top: 4px;
  padding: 0 4px;
}

.ai-quick-chips {
  padding: 8px 12px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  white-space: nowrap;
  background: #ffffff;
  border-top: 1px solid #f1f5f9;
  scrollbar-width: none;
}

.ai-quick-chips::-webkit-scrollbar {
  display: none;
}

.ai-chip {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #475569;
  font-family: var(--font);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.ai-chip:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.ai-chat-input-bar {
  padding: 10px 14px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
}

.ai-chat-input-bar input {
  flex: 1;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-full);
  padding: 10px 16px;
  font-family: var(--font);
  font-size: 0.82rem;
  color: #0f172a;
  outline: none;
  direction: rtl;
  transition: border-color 0.2s ease;
}

.ai-chat-input-bar input:focus {
  border-color: #6d28d9;
  background: #ffffff;
}

.ai-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #6d28d9;
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.ai-send-btn:hover {
  background: #5b21b6;
  transform: scale(1.05);
}

.ai-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Typing indicator */
.ai-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
}

.ai-typing-indicator span {
  width: 6px;
  height: 6px;
  background: #8b5cf6;
  border-radius: 50%;
  animation: typingBounce 1.2s infinite ease-in-out;
}

.ai-typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1.2); opacity: 1; }
}

/* =========================================
   VIP MEMBERSHIP & SUBSCRIPTION STYLES
   ========================================= */
.vip-header-btn {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #b45309;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.vip-header-btn:hover {
  background: #fef3c7;
  border-color: #f59e0b;
  transform: translateY(-1px);
}

.vip-header-btn.is-active-vip {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}

.vip-icon {
  font-size: 0.9rem;
}

/* VIP Modal Drawer */
.vip-drawer {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 580px;
  padding: 24px 20px 32px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.1);
  animation: slideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.vip-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
}

.vip-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.vip-gem-icon {
  font-size: 2rem;
}

.vip-header-title h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
}

.vip-header-title p {
  font-size: 0.8rem;
  color: var(--text-sub);
}

.vip-status-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 20px;
}

.vip-status-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.vip-status-label {
  font-size: 0.82rem;
  color: var(--text-sub);
}

.vip-status-badge {
  font-size: 0.82rem;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: #e2e8f0;
  color: var(--text-main);
  font-weight: 700;
}

.vip-status-badge.active-pro {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.vip-status-desc {
  font-size: 0.78rem;
  color: var(--text-sub);
  line-height: 1.6;
}

/* Plans Grid */
.vip-plans-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.vip-plan-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  position: relative;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.vip-plan-card.featured {
  border-color: #f59e0b;
  background: #fffbeb;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.12);
}

.plan-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: #f1f5f9;
  color: var(--text-sub);
  margin-bottom: 6px;
}

.plan-tag.popular {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.plan-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}

.plan-price {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--text-main);
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

.plan-price span {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-sub);
}

.plan-save {
  font-size: 0.75rem;
  color: #059669;
  font-weight: 700;
  margin-bottom: 8px;
}

.plan-features {
  list-style: none;
  font-size: 0.8rem;
  color: #334155;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  line-height: 1.5;
}

.plan-select-btn {
  width: 100%;
  padding: 10px;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.plan-select-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.popular-btn {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: none;
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

.popular-btn:hover {
  background: linear-gradient(135deg, #d97706, #b45309);
}

/* Activation Code Box */
.vip-activation-box {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}

.vip-activation-box h4 {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.vip-activation-box p {
  font-size: 0.78rem;
  color: var(--text-sub);
  margin-bottom: 12px;
}

.activation-input-group {
  display: flex;
  gap: 8px;
}

.activation-input-group input {
  flex: 1;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-main);
  font-family: var(--font);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
  direction: ltr;
  text-align: center;
  letter-spacing: 1px;
}

.activation-input-group input:focus {
  border-color: var(--primary);
}

.activate-btn {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  border: none;
  color: #ffffff;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.activate-btn:hover {
  background: linear-gradient(135deg, #4338ca, #3730a3);
}

.activation-alert {
  margin-top: 10px;
  font-size: 0.8rem;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

.activation-alert.success {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.activation-alert.error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.vip-support-footer {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-sub);
}

.vip-support-footer strong {
  color: var(--primary);
}

/* Mobile Optimizations */
@media (max-width: 480px) {
  .app-container {
    padding: 0 10px 24px;
  }

  .question-card {
    padding: 16px 14px;
  }

  .question-text {
    font-size: 0.98rem;
    margin-bottom: 16px;
  }

  .option-btn {
    padding: 12px 14px;
    font-size: 0.9rem;
  }

  .palette-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}
