/* ============================================================
   SCIENCE QUIZ — استایل آزمون‌های تستی
   ============================================================ */

/* ===== Subject Cards ===== */
.subject-card {
  cursor: pointer;
  padding: 28px 24px;
  position: relative;
  overflow: hidden;
}
.subject-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right,
    color-mix(in srgb, var(--subject-color, #00d4ff) 15%, transparent),
    transparent 60%);
  pointer-events: none;
  opacity: 0;
  transition: opacity .4s;
}
.subject-card:hover::after { opacity: 1; }

.subject-icon {
  font-size: 42px;
  margin-bottom: 14px;
  display: block;
  filter: drop-shadow(0 0 12px color-mix(in srgb, var(--subject-color, #00d4ff) 50%, transparent));
}
.subject-card h3 {
  font-size: 20px;
  margin-bottom: 10px;
  color: var(--text);
}
.subject-meta {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--dim);
  margin-bottom: 16px;
}
.subject-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.subject-progress-bar {
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,.08);
  overflow: hidden;
}
.subject-progress-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--subject-color, #00d4ff), color-mix(in srgb, var(--subject-color, #00d4ff) 60%, #fff));
  border-radius: 3px;
  transition: width .6s cubic-bezier(.2,.7,.2,1);
}
.subject-progress small {
  font-size: 11px;
  color: var(--dim);
}

/* ===== Lesson Cards ===== */
.lesson-card {
  cursor: pointer;
  padding: 24px 22px;
  border-left: 3px solid var(--subject-color, #00d4ff);
}
.lesson-icon {
  font-size: 28px;
  margin-bottom: 10px;
}
.lesson-card h3 {
  font-size: 16px;
  margin-bottom: 6px;
  color: var(--text);
}
.lesson-meta {
  font-size: 12px;
  color: var(--dim);
  margin-bottom: 10px;
}
.lesson-status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--glass-bg);
  border: 1px solid var(--glass-bd);
  color: var(--subject-color, #00d4ff);
}

.science-back {
  margin-bottom: 20px;
}

/* ===== Quiz Modal ===== */
.quiz-box {
  width: min(640px, 100%);
}
.quiz-box h2 {
  font-size: 18px;
  margin-bottom: 16px;
  color: var(--text);
}

.quiz-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.quiz-progress-bar {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: rgba(255,255,255,.08);
  overflow: hidden;
}
.quiz-progress-bar span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00d4ff, #8b5cf6);
  border-radius: 3px;
  transition: width .4s cubic-bezier(.2,.7,.2,1);
}
.quiz-progress-text {
  font-size: 12px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  min-width: 40px;
  text-align: center;
}

.quiz-question h3.quiz-q-text {
  font-size: 17px;
  line-height: 1.7;
  margin-bottom: 20px;
  color: var(--text);
  font-weight: 600;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quiz-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-bd);
  color: var(--text);
  font-size: 14px;
  text-align: left;
  cursor: none;
  transition: all .25s cubic-bezier(.2,.7,.2,1);
  font-family: inherit;
}
html[dir="rtl"] .quiz-option { text-align: right; }

.quiz-option:not(:disabled):hover {
  background: rgba(255,255,255,.1);
  border-color: rgba(0, 212, 255, 0.4);
  transform: translateX(4px);
}
html[dir="rtl"] .quiz-option:not(:disabled):hover {
  transform: translateX(-4px);
}

.quiz-option:disabled { cursor: none; }

.quiz-option.correct {
  background: linear-gradient(135deg, rgba(74,222,128,.15), rgba(34,211,238,.1));
  border-color: rgba(74,222,128,.5);
  box-shadow: 0 0 20px rgba(74,222,128,.2);
}
.quiz-option.wrong {
  background: linear-gradient(135deg, rgba(255,77,77,.15), rgba(255,140,66,.1));
  border-color: rgba(255,77,77,.5);
  box-shadow: 0 0 20px rgba(255,77,77,.2);
}

.quiz-opt-letter {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid rgba(0, 212, 255, 0.3);
  color: #00d4ff;
  flex-shrink: 0;
}
.quiz-option.correct .quiz-opt-letter {
  background: rgba(74,222,128,.2);
  border-color: rgba(74,222,128,.5);
  color: #4ade80;
}
.quiz-option.wrong .quiz-opt-letter {
  background: rgba(255,77,77,.2);
  border-color: rgba(255,77,77,.5);
  color: #ff4d4d;
}

.quiz-opt-text { flex: 1; }

.quiz-next {
  margin-top: 18px;
  align-self: flex-end;
}

/* ===== Quiz Result ===== */
.quiz-result {
  text-align: center;
  padding: 20px 0;
}
.quiz-result-emoji {
  font-size: 64px;
  margin-bottom: 14px;
  animation: resultPop .6s cubic-bezier(.2,.7,.2,1);
}
@keyframes resultPop {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}
.quiz-result h3 {
  font-size: 20px;
  margin-bottom: 20px;
  color: var(--text);
}
.quiz-result-score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
}
.score-num {
  font-size: 48px;
  font-weight: 700;
  background: linear-gradient(135deg, #00d4ff, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.score-sep, .score-total {
  font-size: 24px;
  color: var(--dim);
}
.quiz-result-percent {
  font-size: 16px;
  color: var(--dim);
  margin-bottom: 26px;
  font-variant-numeric: tabular-nums;
}
.quiz-result-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== Resources ===== */
.science-resources {
  margin-top: 50px;
}
.resources-title {
  font-size: 18px;
  margin-bottom: 20px;
  color: var(--text);
}
.resources-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}
.resource-group {
  padding: 20px;
  border-radius: 18px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-bd);
}
.resource-group h4 {
  font-size: 14px;
  margin-bottom: 12px;
}
.resource-group ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.resource-group li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.resource-group a {
  color: var(--text);
  transition: color .2s;
  text-decoration: none;
}
.resource-group a:hover { color: #00d4ff; }
.res-icon { font-size: 16px; }
.resources-empty {
  text-align: center;
  color: var(--dim);
  font-style: italic;
  padding: 30px 20px;
}

/* ===== Modal Select ===== */
.modal-select {
  padding: 13px 16px;
  border-radius: 12px;
  border: 1px solid var(--glass-bd);
  background: rgba(0,0,0,.25);
  color: var(--text);
  font-size: 14px;
  outline: none;
  cursor: none;
  font-family: inherit;
  transition: .2s;
  width: 100%;
}
html.light .modal-select { background: rgba(255,255,255,.6); }
.modal-select:focus {
  border-color: rgba(0, 140, 255, .6);
  box-shadow: 0 0 0 4px rgba(0, 140, 255, .12);
}
.modal-select option {
  background: #0a1230;
  color: #e0f0ff;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .quiz-option {
    padding: 12px 14px;
    font-size: 13px;
    gap: 10px;
  }
  .quiz-opt-letter {
    width: 26px;
    height: 26px;
    font-size: 12px;
  }
  .quiz-q-text { font-size: 15px !important; }
  .score-num { font-size: 38px; }
  .quiz-result-emoji { font-size: 50px; }
}
/* ============================================================
   SCIENCE — User, Leaderboard, Video Preview
   ============================================================ */

/* ===== User Button ===== */
.science-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-bd);
  transition: .25s;
  font-size: 13px;
  font-weight: 600;
}
.science-user-btn:hover { background: rgba(255,255,255,.1); }
.science-user-btn.logged-in { border-color: rgba(0,212,255,.5); }

.science-user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #00d4ff, #8b5cf6);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

/* ===== Profile Modal ===== */
.profile-header { text-align: center; margin-bottom: 24px; }
.profile-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  margin: 0 auto 14px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #00d4ff, #8b5cf6);
  color: #fff;
  font-size: 32px;
  font-weight: 700;
  box-shadow: 0 0 30px rgba(0,212,255,.4);
}
.profile-header h3 { font-size: 20px; margin-bottom: 4px; }
.profile-since { color: var(--dim); font-size: 12px; }

.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
}
.pstat {
  padding: 16px 10px;
  border-radius: 14px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-bd);
  text-align: center;
}
.pstat-num {
  display: block;
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, #00d4ff, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 4px;
}
.pstat-label { font-size: 11px; color: var(--dim); }

/* ===== Leaderboard ===== */
.leaderboard {
  margin-top: 50px;
}
.lb-header, .lb-row {
  display: grid;
  grid-template-columns: 44px 1fr 70px 60px 60px 60px;
  gap: 8px;
  align-items: center;
  padding: 12px 16px;
  font-size: 13px;
}
.lb-header {
  color: var(--dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--glass-bd);
  font-weight: 700;
}
.lb-row {
  border-radius: 12px;
  transition: background .2s;
}
.lb-row:nth-child(even) { background: rgba(255,255,255,.02); }
.lb-row:hover { background: rgba(0,212,255,.06); }
.lb-row.lb-me {
  background: linear-gradient(135deg, rgba(0,212,255,.1), rgba(139,92,246,.1));
  border: 1px solid rgba(0,212,255,.3);
}
.lb-rank { font-size: 16px; text-align: center; }
.lb-user {
  display: flex; align-items: center; gap: 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lb-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #00d4ff, #8b5cf6);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.lb-score {
  font-weight: 700;
  color: #00d4ff;
  text-align: center;
}
.lb-stat { color: var(--dim); text-align: center; font-size: 12px; }

@media (max-width: 600px) {
  .lb-header, .lb-row {
    grid-template-columns: 36px 1fr 50px 46px 46px 46px;
    padding: 10px 8px;
    font-size: 12px;
  }
  .lb-header span:nth-child(5),
  .lb-header span:nth-child(6),
  .lb-row .lb-stat:nth-child(5),
  .lb-row .lb-stat:nth-child(6) { display: none; }
  .lb-header, .lb-row { grid-template-columns: 36px 1fr 50px 46px; }
}

/* ===== Video Preview ===== */
.resource-video { margin-bottom: 12px; }
.video-card {
  display: block;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0,0,0,.3);
  border: 1px solid var(--glass-bd);
  transition: transform .3s, box-shadow .3s;
  text-decoration: none;
}
.video-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0,212,255,.2);
  border-color: rgba(0,212,255,.4);
}
.video-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-size: cover;
  background-position: center;
  background-color: #0a1230;
  display: grid;
  place-items: center;
}
.video-thumb::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,.8));
}
.video-play {
  position: relative;
  z-index: 2;
  width: 48px; height: 48px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255,255,255,.95);
  color: #000;
  font-size: 18px;
  padding-left: 3px;
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
  transition: transform .3s;
}
.video-card:hover .video-play { transform: scale(1.15); }
.video-title {
  display: block;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
}