/* ==========================================================
   4th Grade Science Explorer — Styles
   ========================================================== */

:root {
  --primary-blue: #4A90E2;
  --primary-purple: #8E44AD;
  --accent-yellow: #F1C40F;
  --accent-green: #2ECC71;
  --accent-red: #E74C3C;
  --accent-orange: #E67E22;
  --bg-color: #F4F7FC;
  --card-bg: #FFFFFF;
  --text-dark: #2C3E50;
  --text-muted: #7F8C8D;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Comic Sans MS', 'Chalkboard SE', 'Segoe UI', sans-serif;
}

body {
  background: var(--bg-color);
  color: var(--text-dark);
  padding: 20px;
  line-height: 1.6;
  padding-bottom: 100px;
}

/* ---------- HEADER ---------- */
header {
  text-align: center;
  margin-bottom: 20px;
  padding: 20px;
  background: linear-gradient(135deg, var(--primary-blue), var(--primary-purple));
  color: white;
  border-radius: 20px;
  box-shadow: 0 8px 15px rgba(0,0,0,0.1);
}
header h1 {
  font-size: 2.2em;
  margin-bottom: 5px;
  text-shadow: 2px 2px 0px rgba(0,0,0,0.2);
}
header p {
  font-size: 1.1em;
  opacity: 0.9;
}

/* ---------- NAV ---------- */
.nav-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 15px;
}
.nav-tabs:last-of-type {
  margin-bottom: 25px;
}
.nav-btn {
  background: white;
  border: 3px solid var(--primary-blue);
  color: var(--primary-blue);
  padding: 10px 20px;
  border-radius: 50px;
  font-size: 0.95em;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
  font-family: inherit;
}
.nav-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.1);
}
.nav-btn.active {
  background: var(--primary-blue);
  color: white;
}
.nav-btn.subject-tab {
  border-color: var(--primary-purple);
  color: var(--primary-purple);
  font-size: 1.05em;
  padding: 12px 26px;
}
.nav-btn.subject-tab.active {
  background: var(--primary-purple);
  color: white;
}
.nav-btn.parent {
  border-color: var(--primary-purple);
  color: var(--primary-purple);
}
.nav-btn.parent:hover {
  background: #F3E5F5;
}

/* ---------- CARDS ---------- */
.card {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 25px;
  margin-bottom: 25px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.05);
  border-left: 8px solid var(--primary-purple);
}
.card h2 {
  color: var(--primary-purple);
  margin-bottom: 15px;
  font-size: 1.7em;
}
.card h3 {
  color: var(--primary-blue);
  margin-top: 20px;
  margin-bottom: 10px;
  font-size: 1.25em;
}
.card p, .card li {
  font-size: 1.05em;
  color: #444;
  margin-bottom: 10px;
}
.card ul { padding-left: 25px; }

/* ---------- STUDY GUIDE ---------- */
.study-guide {
  background: #FAFBFF;
  border: 3px solid #D6E4FF;
  border-radius: 18px;
  padding: 20px;
  margin: 18px 0;
  position: relative;
}
.study-guide::before {
  content: "📘 STUDY GUIDE";
  position: absolute;
  top: -14px;
  left: 20px;
  background: var(--primary-blue);
  color: white;
  font-size: 0.8em;
  font-weight: bold;
  padding: 4px 14px;
  border-radius: 20px;
  letter-spacing: 1px;
}
.sg-row { margin: 14px 0; }
.sg-label {
  font-weight: bold;
  color: var(--primary-purple);
  font-size: 1em;
  margin-bottom: 6px;
  display: block;
}
.sg-def {
  background: #FFF9C4;
  padding: 12px 16px;
  border-radius: 12px;
  border-left: 5px solid var(--accent-yellow);
}
.sg-examples {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 6px;
}
@media (max-width: 600px) {
  .sg-examples { grid-template-columns: 1fr; }
}
.sg-ex, .sg-nonex {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.95em;
}
.sg-ex {
  background: #E8F8F5;
  border-left: 5px solid var(--accent-green);
}
.sg-nonex {
  background: #FCE8E8;
  border-left: 5px solid var(--accent-red);
}
.sg-ex strong, .sg-nonex strong {
  display: block;
  margin-bottom: 5px;
  font-size: 0.9em;
  color: var(--text-dark);
}

/* ---------- HIGHLIGHT / FUN FACT ---------- */
.fun-fact {
  background: #FFF9C4;
  border: 2px dashed #F1C40F;
  padding: 15px;
  border-radius: 15px;
  margin: 15px 0;
  display: flex;
  align-items: center;
  gap: 15px;
}
.fun-fact span { font-size: 2em; }
.highlight {
  background: #E8F8F5;
  padding: 15px;
  border-radius: 15px;
  border-left: 5px solid var(--accent-green);
  margin: 15px 0;
}

/* ---------- DIAGRAM BOX ---------- */
.diagram-box { background: #F8F9FA; border-radius: 15px; padding: 20px; margin: 15px 0; text-align: center; }
.diagram-box svg { max-width: 100%; height: auto; display: block; margin: 0 auto; }
.diagram-box.medium svg { max-width: 460px; }
.diagram-box.narrow svg { max-width: 260px; }
.diagram-caption {
  font-size: 0.9em;
  color: #666;
  margin-top: 8px;
  font-style: italic;
}

/* ---------- TABLE ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  background: white;
  border-radius: 10px;
  overflow: hidden;
}
th, td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #EEE;
}
th {
  background: var(--primary-blue);
  color: white;
}
tr:nth-child(even) { background: #F8F9FA; }

/* ---------- QUIZ (shared for mini / chapter / final) ---------- */
.quiz-wrapper {
  background: #FFF8E1;
  border: 3px solid var(--accent-orange);
  border-radius: 18px;
  padding: 22px;
  margin-top: 20px;
  position: relative;
}
.quiz-wrapper.mini::before {
  content: "🤔 QUICK CHECK (5)";
  position: absolute;
  top: -14px;
  left: 20px;
  background: var(--accent-orange);
  color: white;
  font-size: 0.8em;
  font-weight: bold;
  padding: 4px 14px;
  border-radius: 20px;
  letter-spacing: 1px;
}
.quiz-wrapper.chapter::before {
  content: "📝 CHAPTER QUIZ (15)";
  position: absolute;
  top: -14px;
  left: 20px;
  background: var(--primary-blue);
  color: white;
  font-size: 0.8em;
  font-weight: bold;
  padding: 4px 14px;
  border-radius: 20px;
  letter-spacing: 1px;
}
.quiz-wrapper.final {
  background: #E8F8F5;
  border-color: var(--accent-green);
}
.quiz-wrapper.final::before {
  content: "🎯 FINAL EXAM (20)";
  position: absolute;
  top: -14px;
  left: 20px;
  background: var(--accent-green);
  color: white;
  font-size: 0.8em;
  font-weight: bold;
  padding: 4px 14px;
  border-radius: 20px;
  letter-spacing: 1px;
}

.quiz-progress-bar {
  height: 10px;
  background: #E9ECEF;
  border-radius: 10px;
  margin-bottom: 20px;
  overflow: hidden;
}
.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-blue), var(--primary-purple));
  transition: width 0.3s;
}
.quiz-progress-text {
  font-size: 0.9em;
  color: #666;
  margin-bottom: 8px;
  font-weight: bold;
}

.quiz-question {
  font-size: 1.15em;
  font-weight: bold;
  margin-bottom: 15px;
  color: var(--text-dark);
}
.quiz-options {
  display: grid;
  gap: 10px;
}
.option-btn {
  background: white;
  border: 2px solid #E9ECEF;
  padding: 13px 18px;
  border-radius: 12px;
  font-size: 1.02em;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-dark);
  font-family: inherit;
}
.option-btn:hover:not(:disabled) {
  background: #FFF3E0;
  border-color: var(--accent-orange);
  transform: translateX(4px);
}
.option-btn:disabled { cursor: default; }
.option-btn.correct {
  background: #D4EDDA;
  border-color: #28A745;
  color: #155724;
  font-weight: bold;
}
.option-btn.incorrect {
  background: #F8D7DA;
  border-color: #DC3545;
  color: #721C24;
}

.quiz-feedback {
  margin-top: 15px;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 1em;
  line-height: 1.5;
  display: none;
}
.quiz-feedback.show { display: block; }
.quiz-feedback.correct {
  background: #D4EDDA;
  border-left: 5px solid #28A745;
  color: #155724;
}
.quiz-feedback.incorrect {
  background: #F8D7DA;
  border-left: 5px solid #DC3545;
  color: #721C24;
}
.quiz-feedback strong { display: block; margin-bottom: 5px; }

.quiz-next {
  margin-top: 15px;
  background: var(--accent-orange);
  color: white;
  border: none;
  padding: 12px 28px;
  border-radius: 25px;
  font-size: 1.02em;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 8px rgba(230,126,34,0.3);
}
.quiz-next:hover {
  background: #D35400;
  transform: translateY(-2px);
}

.quiz-summary { text-align: center; padding: 20px 10px; }
.quiz-summary-emoji { font-size: 3.5em; }
.quiz-summary-text {
  font-size: 1.3em;
  font-weight: bold;
  margin: 10px 0;
}
.quiz-summary-sub { font-size: 1em; color: #666; }
.quiz-restart {
  margin-top: 15px;
  background: var(--accent-orange);
  color: white;
  border: none;
  padding: 10px 22px;
  border-radius: 25px;
  font-size: 0.98em;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
}
.quiz-restart:hover { background: #D35400; }

/* ---------- MISSED QUESTIONS ---------- */
.missed-list {
  background: #FFF8F8;
  border-left: 5px solid var(--accent-red);
  border-radius: 12px;
  padding: 16px;
  margin: 15px 0;
  text-align: left;
}
.missed-list h4 {
  color: var(--accent-red);
  margin-bottom: 10px;
}
.missed-item {
  padding: 10px 0;
  border-bottom: 1px solid #F5D5D5;
}
.missed-item:last-child { border-bottom: none; }
.missed-q {
  font-weight: bold;
  color: #333;
  margin-bottom: 4px;
}
.missed-a {
  font-size: 0.92em;
  color: #666;
}
.missed-a .correct-ans {
  color: #28A745;
  font-weight: bold;
}

/* ---------- PARENT DASHBOARD ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 15px;
  margin: 20px 0;
}
.stat-box {
  background: linear-gradient(135deg, #E3F2FD, #F3E5F5);
  border-radius: 15px;
  padding: 18px;
  text-align: center;
}
.stat-box .stat-value {
  font-size: 2em;
  font-weight: bold;
  color: var(--primary-purple);
}
.stat-box .stat-label {
  font-size: 0.9em;
  color: #555;
  margin-top: 5px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
  background: white;
  border-radius: 10px;
  overflow: hidden;
  font-size: 0.92em;
}
.data-table th {
  background: var(--primary-purple);
  color: white;
  padding: 10px;
  text-align: left;
}
.data-table td {
  padding: 10px;
  border-bottom: 1px solid #EEE;
}
.data-table tr:hover { background: #F8F9FA; }

.score-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: bold;
  font-size: 0.88em;
}
.score-pill.good { background: #D4EDDA; color: #155724; }
.score-pill.mid { background: #FFF3CD; color: #856404; }
.score-pill.bad { background: #F8D7DA; color: #721C24; }

.topic-bar {
  height: 24px;
  background: #E9ECEF;
  border-radius: 12px;
  overflow: hidden;
  margin: 6px 0;
}
.topic-bar-fill {
  height: 100%;
  border-radius: 12px;
  transition: width 0.4s;
  display: flex;
  align-items: center;
  padding-left: 10px;
  color: white;
  font-size: 0.82em;
  font-weight: bold;
}
.topic-row { margin: 14px 0; }
.topic-row .topic-name {
  font-weight: bold;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 15px 0;
}
.btn-primary {
  background: var(--primary-blue);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 25px;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 8px rgba(74,144,226,0.3);
}
.btn-primary:hover {
  background: #357ABD;
  transform: translateY(-2px);
}
.btn-danger {
  background: var(--accent-red);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 25px;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
}
.btn-danger:hover { background: #C0392B; }
.btn-secondary {
  background: white;
  color: var(--primary-blue);
  border: 2px solid var(--primary-blue);
  padding: 10px 22px;
  border-radius: 25px;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
}
.btn-secondary:hover { background: #E3F2FD; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #888;
  font-style: italic;
}

/* ---------- BADGES ---------- */
.badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.88em;
  font-weight: bold;
  color: white;
  margin-right: 5px;
}
.badge-blue { background: var(--primary-blue); }
.badge-green { background: var(--accent-green); }
.badge-purple { background: var(--primary-purple); }

/* ---------- PENDULUM ANIMATION ---------- */
.pendulum-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 200px;
  margin: 20px 0;
  background: #2C3E50;
  border-radius: 15px;
  position: relative;
  overflow: hidden;
}
.pendulum {
  position: relative;
  width: 6px;
  height: 150px;
  background: #BDC3C7;
  transform-origin: top center;
  animation: swing 2s infinite ease-in-out;
}
.pendulum-ball {
  position: absolute;
  bottom: -20px;
  left: -17px;
  width: 40px;
  height: 40px;
  background: var(--accent-yellow);
  border-radius: 50%;
  box-shadow: 0 0 15px var(--accent-yellow);
}
@keyframes swing {
  0%   { transform: rotate(25deg); }
  50%  { transform: rotate(-25deg); }
  100% { transform: rotate(25deg); }
}

/* ---------- FOOTER ---------- */
.app-footer {
  text-align: center;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 2px dashed #DDD;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
  header h1 { font-size: 1.6em; }
  .nav-btn { font-size: 0.85em; padding: 9px 14px; }
  .nav-btn.subject-tab { font-size: 0.95em; padding: 10px 18px; }
  .card { padding: 15px; }
  .stat-box .stat-value { font-size: 1.6em; }
}

/* ==========================================================
   DAILY HOMEWORK (Kumon-style sheets)
   ========================================================== */

.dh-sheet {
  background: #FFFFFF;
  border-radius: 16px;
  padding: 24px;
  margin: 20px 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  border-left: 6px solid var(--primary-blue);
}

.dh-header {
  text-align: center;
  padding-bottom: 16px;
  border-bottom: 2px dashed #E9ECEF;
  margin-bottom: 20px;
}

.dh-day {
  font-size: 0.85em;
  font-weight: bold;
  color: var(--primary-blue);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.dh-title {
  font-size: 1.4em;
  font-weight: bold;
  color: var(--text-dark);
}

/* ---- Remember box ---- */
.dh-remember {
  background: #FFF9C4;
  border-left: 4px solid var(--accent-yellow);
  border-radius: 10px;
  padding: 14px 18px;
  margin: 16px 0;
}
.dh-remember-title {
  font-weight: bold;
  color: #856404;
  margin-bottom: 6px;
  font-size: 1em;
}
.dh-remember-body {
  font-size: 0.98em;
  color: #444;
  line-height: 1.5;
}

/* ---- Worked example ---- */
.dh-example {
  background: #E3F2FD;
  border-left: 4px solid var(--primary-blue);
  border-radius: 10px;
  padding: 14px 18px;
  margin: 16px 0;
}
.dh-example-title {
  font-weight: bold;
  color: #1565C0;
  margin-bottom: 6px;
  font-size: 1em;
}
.dh-example-body {
  font-size: 1em;
  color: #333;
  font-family: 'Courier New', monospace;
  line-height: 1.6;
  white-space: pre-wrap;
}

.dh-problems {
  margin: 20px 0;
  max-width: 720px;   /* keep the problem list narrow */
}
.dh-problems-title {
  font-size: 1.1em;
  font-weight: bold;
  color: var(--primary-purple);
  margin-bottom: 12px;
}
.dh-problem-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: dh-prob;
}
.dh-problem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #F1F3F5;
}
.dh-problem:last-child { border-bottom: none; }
.dh-problem::before {
  content: counter(dh-prob) ".";
  counter-increment: dh-prob;
  font-weight: bold;
  color: var(--text-muted);
  min-width: 26px;
  text-align: right;
  flex-shrink: 0;
}
.dh-q-text {
  font-size: 1em;
  color: var(--text-dark);
  /* Let the question take as much space as it needs,
     but not push the input all the way to the right */
  flex: 0 1 auto;
  margin-right: 4px;
}
.dh-input {
  width: 120px;
  padding: 8px 12px;
  border: 2px solid #D6E4FF;
  border-radius: 8px;
  font-size: 1em;
  font-family: 'Courier New', monospace;
  background: #FAFBFF;
  color: var(--text-dark);
  transition: all 0.15s;
  flex-shrink: 0;
  /* Push the input to the immediate right of the question text */
  margin-left: auto;
}
.dh-input:focus {
  outline: none;
  border-color: var(--primary-blue);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.15);
}
.dh-input:disabled { background: #F8F9FA; cursor: default; }
.dh-input.dh-correct {
  background: #D4EDDA;
  border-color: #28A745;
  color: #155724;
  font-weight: bold;
}
.dh-input.dh-incorrect {
  background: #F8D7DA;
  border-color: #DC3545;
  color: #721C24;
}


/* Mobile: stack text + input */
@media (max-width: 600px) {
  .dh-problem {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .dh-input {
    width: 100%;
  }
  .dh-problem::before {
    text-align: left;
  }
}

/* ---- Actions ---- */
.dh-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 24px 0;
}

.dh-check-btn {
  background: var(--primary-blue);
  color: white;
  border: none;
  padding: 14px 32px;
  border-radius: 28px;
  font-size: 1.05em;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 10px rgba(74, 144, 226, 0.3);
  transition: all 0.2s;
}
.dh-check-btn:hover {
  background: #357ABD;
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(74, 144, 226, 0.4);
}

.dh-retry-btn {
  background: var(--accent-orange);
  color: white;
  border: none;
  padding: 14px 32px;
  border-radius: 28px;
  font-size: 1.05em;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 10px rgba(230, 126, 34, 0.3);
  transition: all 0.2s;
}
.dh-retry-btn:hover {
  background: #D35400;
  transform: translateY(-2px);
}

/* ---- Results ---- */
.dh-results {
  margin-top: 24px;
}

.dh-score {
  text-align: center;
  padding: 20px;
  border-radius: 14px;
  margin-bottom: 20px;
}
.dh-score.dh-pass {
  background: #D4EDDA;
  border: 2px solid #28A745;
}
.dh-score.dh-fail {
  background: #FFF3CD;
  border: 2px solid #FFC107;
}

.dh-score-emoji {
  font-size: 3em;
  margin-bottom: 6px;
}
.dh-score-text {
  font-size: 1.3em;
  font-weight: bold;
  color: var(--text-dark);
}
.dh-score-sub {
  font-size: 1em;
  color: #555;
  margin-top: 8px;
}

/* ---- Missed problems review ---- */
.dh-missed {
  background: #FFF8F8;
  border-left: 5px solid var(--accent-red);
  border-radius: 12px;
  padding: 18px;
  margin-top: 16px;
}
.dh-missed h4 {
  color: var(--accent-red);
  margin-bottom: 12px;
  font-size: 1.1em;
}
.dh-missed-item {
  padding: 12px 0;
  border-bottom: 1px solid #F5D5D5;
}
.dh-missed-item:last-child { border-bottom: none; }
.dh-missed-q {
  font-weight: bold;
  color: #333;
  margin-bottom: 6px;
}
.dh-missed-a {
  font-size: 0.95em;
  color: #666;
  margin-top: 3px;
}
.dh-missed-a .dh-user-ans {
  color: var(--accent-red);
  font-weight: bold;
  text-decoration: line-through;
}
.dh-missed-a .dh-correct-ans {
  color: #28A745;
  font-weight: bold;
}
.dh-missed-explain {
  font-size: 0.92em;
  color: #555;
  font-style: italic;
  margin-top: 6px;
  padding: 8px 12px;
  background: #FFFFFF;
  border-radius: 6px;
}

/* ==========================================================
   DAILY HOMEWORK DAY PICKER (boxes at the top of a chapter)
   ========================================================== */

.dh-picker {
  background: #FAFBFF;
  border: 2px solid #D6E4FF;
  border-radius: 14px;
  padding: 16px 20px;
  margin: 16px 0 24px 0;
}

.dh-picker-title {
  font-size: 1em;
  font-weight: bold;
  color: var(--primary-purple);
  margin-bottom: 12px;
}

.dh-day-boxes {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.dh-day-box {
  flex: 0 0 auto;
  min-width: 80px;
  padding: 10px 12px;
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  border: 2px solid #E9ECEF;
  background: #FFFFFF;
  font-family: inherit;
  font-size: 0.95em;
  transition: all 0.2s;
  color: var(--text-dark);
}
.dh-day-box:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.08);
}
.dh-day-box .dh-day-label {
  font-weight: bold;
  font-size: 0.85em;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}
.dh-day-box .dh-day-name {
  font-size: 0.9em;
  color: var(--text-dark);
}

/* States */
.dh-day-box.dh-day-passed {
  background: #D4EDDA;
  border-color: #28A745;
}
.dh-day-box.dh-day-passed .dh-day-label {
  color: #155724;
}

.dh-day-box.dh-day-failed {
  background: #FFF3CD;
  border-color: #FFC107;
}

.dh-day-box.dh-day-today {
  border-color: var(--primary-blue);
  border-width: 3px;
  background: #E3F2FD;
}

.dh-day-box.dh-day-active {
  border-color: var(--primary-purple);
  border-width: 3px;
  background: #F3E5F5;
}

@media (max-width: 600px) {
  .dh-day-box {
    min-width: 68px;
    padding: 8px 10px;
  }
  .dh-day-box .dh-day-name {
    font-size: 0.8em;
  }
}

/* ==========================================================
   DROPDOWN NAVIGATION (for Math chapters)
   ========================================================== */

.nav-dropdown {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.nav-dropdown label {
  font-weight: bold;
  color: var(--primary-purple);
  font-size: 1em;
}

.nav-dropdown select {
  padding: 10px 16px;
  border-radius: 25px;
  border: 3px solid var(--primary-purple);
  background: white;
  color: var(--primary-purple);
  font-size: 1em;
  font-weight: bold;
  font-family: inherit;
  cursor: pointer;
  min-width: 260px;
  max-width: 100%;
}
.nav-dropdown select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(142, 68, 173, 0.2);
}

@media (max-width: 600px) {
  .nav-dropdown {
    flex-direction: column;
    align-items: stretch;
  }
  .nav-dropdown select {
    width: 100%;
    min-width: 0;
  }
}


/* ==========================================================
   HOME PAGE
   ========================================================== */

.view {
  animation: fadeIn 0.3s ease;
}

.home-header {
  text-align: center;
  margin-bottom: 30px;
  padding: 25px 20px;
  background: linear-gradient(135deg, var(--primary-blue), var(--primary-purple));
  color: white;
  border-radius: 20px;
  box-shadow: 0 8px 15px rgba(0,0,0,0.1);
}
.home-header h1 {
  font-size: 2.5em;
  margin-bottom: 6px;
  text-shadow: 2px 2px 0px rgba(0,0,0,0.2);
}
.home-header p {
  font-size: 1.15em;
  opacity: 0.95;
}

.subject-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: 900px;
  margin: 0 auto;
}
@media (max-width: 700px) {
  .subject-cards {
    grid-template-columns: 1fr;
  }
}

.subject-card {
  background: white;
  border-radius: 22px;
  padding: 28px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
  border: 3px solid transparent;
  position: relative;
  overflow: hidden;
}
.subject-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 14px 28px rgba(0,0,0,0.14);
  border-color: var(--primary-blue);
}
.subject-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--primary-blue), var(--primary-purple));
}
.subject-card[data-subject="science"]::before {
  background: linear-gradient(90deg, #2ECC71, #27AE60);
}
.subject-card[data-subject="science"]:hover {
  border-color: var(--accent-green);
}

.subject-card-icon {
  font-size: 3.5em;
  margin-bottom: 10px;
}
.subject-card-title {
  font-size: 1.7em;
  font-weight: bold;
  color: var(--text-dark);
  margin-bottom: 16px;
}

.subject-card-skill {
  background: #F8F9FA;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 14px;
}
.skill-label {
  font-weight: bold;
  font-size: 1em;
  color: var(--primary-purple);
  margin-bottom: 4px;
}
.skill-chapter {
  font-size: 0.85em;
  color: #777;
}

.subject-card-stars {
  margin: 10px 0;
}
.stars {
  font-size: 1.7em;
  letter-spacing: 3px;
}
.star {
  color: #DDD;
}
.star.filled {
  color: #F1C40F;
  text-shadow: 0 0 6px rgba(241, 196, 15, 0.5);
}
.star.empty {
  color: #DDD;
}

.subject-card-progress {
  font-size: 0.95em;
  color: #555;
  margin-bottom: 12px;
}

.subject-card-recent {
  border-top: 1px dashed #E9ECEF;
  padding-top: 12px;
  margin-top: 8px;
}
.recent-label {
  font-size: 0.8em;
  color: #888;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.recent-scores {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.score-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: bold;
  font-size: 0.85em;
}
.score-pill.good { background: #D4EDDA; color: #155724; }
.score-pill.mid  { background: #FFF3CD; color: #856404; }
.score-pill.bad  { background: #F8D7DA; color: #721C24; }
.no-scores {
  font-size: 0.85em;
  color: #BBB;
  font-style: italic;
}

/* ==========================================================
   SUBJECT VIEW
   ========================================================== */

.subject-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--primary-blue), var(--primary-purple));
  color: white;
  border-radius: 18px;
  box-shadow: 0 6px 14px rgba(0,0,0,0.1);
}
.subject-header h1 {
  font-size: 1.6em;
  margin: 0;
  flex: 1;
}
.back-home-btn {
  background: rgba(255,255,255,0.2);
  color: white;
  border: 2px solid rgba(255,255,255,0.4);
  padding: 8px 16px;
  border-radius: 22px;
  font-size: 0.95em;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.back-home-btn:hover {
  background: rgba(255,255,255,0.35);
}

.subject-toolbar {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 14px 20px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.chapter-select-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 260px;
}
.chapter-select-wrap label {
  font-weight: bold;
  color: var(--primary-purple);
  white-space: nowrap;
}
.chapter-select-wrap select {
  flex: 1;
  padding: 10px 16px;
  border-radius: 22px;
  border: 2px solid var(--primary-purple);
  background: white;
  color: var(--text-dark);
  font-size: 1em;
  font-weight: bold;
  font-family: inherit;
  cursor: pointer;
  min-width: 200px;
}
.chapter-select-wrap select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(142, 68, 173, 0.15);
}

.homework-btn {
  background: linear-gradient(135deg, var(--accent-orange), #D35400);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 22px;
  font-size: 1.02em;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 10px rgba(230, 126, 34, 0.35);
  transition: all 0.2s;
  white-space: nowrap;
}
.homework-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(230, 126, 34, 0.45);
}

/* ==========================================================
   SECTION PROGRESS STRIP
   ========================================================== */

.section-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 8px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.section-step {
  flex: 1;
  min-width: 130px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 2px solid #E9ECEF;
  background: #F8F9FA;
  color: var(--text-dark);
  font-size: 0.92em;
  font-weight: bold;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.section-step:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.08);
}
.section-step.current {
  background: linear-gradient(135deg, var(--primary-blue), var(--primary-purple));
  color: white;
  border-color: transparent;
  box-shadow: 0 6px 12px rgba(74, 144, 226, 0.3);
}
.section-step.done {
  background: #E8F8F5;
  border-color: var(--accent-green);
  color: #155724;
}
.section-step.done::after {
  content: " ✓";
  color: var(--accent-green);
  font-weight: bold;
}

/* ==========================================================
   SECTION NAVIGATION BUTTONS
   ========================================================== */

.section-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 24px 0;
}

.section-next-btn {
  background: linear-gradient(135deg, var(--primary-blue), var(--primary-purple));
  color: white;
  border: none;
  padding: 14px 32px;
  border-radius: 28px;
  font-size: 1.05em;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 6px 14px rgba(74, 144, 226, 0.35);
  transition: all 0.2s;
}
.section-next-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(74, 144, 226, 0.45);
}

.section-back-btn {
  background: white;
  color: var(--primary-purple);
  border: 2px solid var(--primary-purple);
  padding: 12px 26px;
  border-radius: 28px;
  font-size: 1.02em;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.section-back-btn:hover {
  background: #F3E5F5;
  transform: translateY(-2px);
}

.section-home-btn {
  background: white;
  color: var(--text-dark);
  border: 2px solid #DDD;
  padding: 12px 26px;
  border-radius: 28px;
  font-size: 1.02em;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.section-home-btn:hover {
  background: #F8F9FA;
  transform: translateY(-2px);
}

/* ==========================================================
   HOMEWORK VIEW
   ========================================================== */

.dh-sheet {
  background: #FFFFFF;
  border-radius: 16px;
  padding: 24px;
  margin: 20px 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  border-left: 6px solid var(--primary-blue);
}

.dh-header {
  text-align: center;
  padding-bottom: 16px;
  border-bottom: 2px dashed #E9ECEF;
  margin-bottom: 20px;
}
.dh-day {
  font-size: 0.85em;
  font-weight: bold;
  color: var(--primary-blue);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 6px;
}
.dh-title {
  font-size: 1.35em;
  font-weight: bold;
  color: var(--text-dark);
}
.dh-header-sub {
  font-size: 0.9em;
  color: #777;
  margin-top: 6px;
  font-style: italic;
}

.dh-remember {
  background: #FFF9C4;
  border-left: 4px solid var(--accent-yellow);
  border-radius: 10px;
  padding: 14px 18px;
  margin: 16px 0;
}
.dh-remember-title {
  font-weight: bold;
  color: #856404;
  margin-bottom: 6px;
}
.dh-remember-body {
  font-size: 0.98em;
  color: #444;
  line-height: 1.5;
}

.dh-example {
  background: #E3F2FD;
  border-left: 4px solid var(--primary-blue);
  border-radius: 10px;
  padding: 14px 18px;
  margin: 16px 0;
}
.dh-example-title {
  font-weight: bold;
  color: #1565C0;
  margin-bottom: 6px;
}
.dh-example-body {
  font-size: 1em;
  color: #333;
  font-family: 'Courier New', monospace;
  line-height: 1.6;
  white-space: pre-wrap;
}

.dh-progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #FAFBFF;
  border-radius: 12px;
  padding: 12px 16px;
  margin: 16px 0;
  flex-wrap: wrap;
}
.dh-progress-label {
  font-weight: bold;
  color: var(--primary-purple);
  font-size: 0.98em;
}
.dh-progress-stars {
  font-size: 1.2em;
  letter-spacing: 2px;
}

.dh-problems { margin: 20px 0; }
.dh-problems-title {
  font-size: 1.1em;
  font-weight: bold;
  color: var(--primary-purple);
  margin-bottom: 12px;
}
.dh-problem-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: dh-prob;
}
.dh-problem {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #F1F3F5;
}
.dh-problem:last-child { border-bottom: none; }
.dh-problem::before {
  content: counter(dh-prob) ".";
  counter-increment: dh-prob;
  font-weight: bold;
  color: var(--text-muted);
  min-width: 28px;
  text-align: right;
}
.dh-q-text {
  flex: 1;
  font-size: 1em;
  color: var(--text-dark);
}
.dh-input {
  width: 140px;
  padding: 8px 12px;
  border: 2px solid #D6E4FF;
  border-radius: 8px;
  font-size: 1em;
  font-family: 'Courier New', monospace;
  background: #FAFBFF;
  color: var(--text-dark);
  transition: all 0.15s;
}
.dh-input:focus {
  outline: none;
  border-color: var(--primary-blue);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.15);
}
.dh-input:disabled { background: #F8F9FA; cursor: default; }
.dh-input.dh-correct {
  background: #D4EDDA;
  border-color: #28A745;
  color: #155724;
  font-weight: bold;
}
.dh-input.dh-incorrect {
  background: #F8D7DA;
  border-color: #DC3545;
  color: #721C24;
}
@media (max-width: 600px) {
  .dh-problem {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .dh-input { width: 100%; }
  .dh-problem::before { text-align: left; }
}

.dh-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 24px 0;
}
.dh-check-btn {
  background: var(--primary-blue);
  color: white;
  border: none;
  padding: 14px 32px;
  border-radius: 28px;
  font-size: 1.05em;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 10px rgba(74, 144, 226, 0.3);
  transition: all 0.2s;
}
.dh-check-btn:hover {
  background: #357ABD;
  transform: translateY(-2px);
}
.dh-retry-btn,
.dh-secondary-btn {
  background: var(--accent-orange);
  color: white;
  border: none;
  padding: 14px 32px;
  border-radius: 28px;
  font-size: 1.05em;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 10px rgba(230, 126, 34, 0.3);
  transition: all 0.2s;
}
.dh-retry-btn:hover,
.dh-secondary-btn:hover {
  background: #D35400;
  transform: translateY(-2px);
}

.dh-results { margin-top: 24px; }
.dh-score {
  text-align: center;
  padding: 20px;
  border-radius: 14px;
  margin-bottom: 20px;
}
.dh-score.dh-pass { background: #D4EDDA; border: 2px solid #28A745; }
.dh-score.dh-fail { background: #FFF3CD; border: 2px solid #FFC107; }
.dh-score-emoji { font-size: 3em; margin-bottom: 6px; }
.dh-score-text {
  font-size: 1.25em;
  font-weight: bold;
  color: var(--text-dark);
}
.dh-score-sub {
  font-size: 1em;
  color: #555;
  margin-top: 8px;
}
.dh-missed {
  background: #FFF8F8;
  border-left: 5px solid var(--accent-red);
  border-radius: 12px;
  padding: 18px;
  margin-top: 16px;
}
.dh-missed h4 {
  color: var(--accent-red);
  margin-bottom: 12px;
  font-size: 1.05em;
}
.dh-missed-item {
  padding: 12px 0;
  border-bottom: 1px solid #F5D5D5;
}
.dh-missed-item:last-child { border-bottom: none; }
.dh-missed-q {
  font-weight: bold;
  color: #333;
  margin-bottom: 6px;
}
.dh-missed-a {
  font-size: 0.95em;
  color: #666;
  margin-top: 3px;
}
.dh-missed-a .dh-user-ans {
  color: var(--accent-red);
  font-weight: bold;
  text-decoration: line-through;
}
.dh-missed-a .dh-correct-ans {
  color: #28A745;
  font-weight: bold;
}
.dh-missed-explain {
  font-size: 0.92em;
  color: #555;
  font-style: italic;
  margin-top: 6px;
  padding: 8px 12px;
  background: #FFFFFF;
  border-radius: 6px;
}

/* ==========================================================
   FOOTER
   ========================================================== */

.app-footer {
  text-align: center;
  margin-top: 40px;
  padding-top: 20px;
  border-top: 2px dashed #DDD;
}
.app-footer .nav-btn {
  font-size: 0.95em;
}

/* ==========================================================
   RESPONSIVE
   ========================================================== */

@media (max-width: 700px) {
  .home-header h1 { font-size: 1.8em; }
  .subject-card-icon { font-size: 2.8em; }
  .subject-card-title { font-size: 1.4em; }
  .subject-header h1 { font-size: 1.2em; }
  .subject-toolbar { padding: 12px; }
  .chapter-select-wrap { min-width: 0; }
  .section-step { font-size: 0.85em; padding: 10px 12px; min-width: 100px; }
}

.set-current-btn {
  background: #E3F2FD;
  color: var(--primary-blue);
  border: 1px solid #90CAF9;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.78em;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.set-current-btn:hover {
  background: var(--primary-blue);
  color: white;
}

/* ==========================================================
   LOGIN SCREEN
   ========================================================== */

.login-screen {
  min-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 24px;
  padding: 40px 30px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 12px 40px rgba(74, 144, 226, 0.15);
  border: 3px solid #E3F2FD;
}

.login-logo {
  font-size: 4em;
  margin-bottom: 12px;
}

.login-title {
  font-size: 1.8em;
  color: var(--primary-purple);
  margin-bottom: 6px;
}

.login-sub {
  color: #666;
  margin-bottom: 24px;
  font-size: 1em;
}

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

.login-input {
  padding: 16px 20px;
  border-radius: 14px;
  border: 2px solid #D6E4FF;
  font-size: 1.15em;
  font-family: inherit;
  text-align: center;
  background: #FAFBFF;
  color: var(--text-dark);
  letter-spacing: 1px;
}
.login-input:focus {
  outline: none;
  border-color: var(--primary-blue);
  background: white;
  box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.15);
}

.login-btn {
  padding: 16px 24px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, var(--primary-blue), var(--primary-purple));
  color: white;
  font-size: 1.1em;
  font-weight: bold;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(74, 144, 226, 0.35);
  transition: all 0.2s;
}
.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(74, 144, 226, 0.45);
}

.login-error {
  margin-top: 16px;
  color: var(--accent-red);
  font-size: 0.95em;
  font-weight: bold;
  min-height: 22px;
  opacity: 0;
  transition: opacity 0.2s;
}
.login-error.show {
  opacity: 1;
}

/* ==========================================================
   ROLE INDICATOR
   ========================================================== */

.role-indicator-wrap,
.role-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.role-label {
  font-size: 0.9em;
  color: #888;
  font-weight: bold;
}

.logout-btn {
  background: transparent;
  border: 1px solid #DDD;
  color: #888;
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 0.8em;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.logout-btn:hover {
  background: #F8F9FA;
  color: var(--accent-red);
  border-color: var(--accent-red);
}

/* ==========================================================
   LOADING STATES
   ========================================================== */

.loading-state {
  text-align: center;
  padding: 60px 20px;
  color: #888;
  font-size: 1.1em;
  font-style: italic;
}

/* ==========================================================
   REWARDS BANNER (home page)
   ========================================================== */

.rewards-banner {
  background: linear-gradient(135deg, #FFF9C4, #FFE082);
  border-radius: 20px;
  padding: 20px 24px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  box-shadow: 0 6px 16px rgba(241, 196, 15, 0.25);
  border: 2px solid #F1C40F;
}

.rewards-left {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.rewards-balance {
  text-align: left;
}
.rewards-balance-value {
  font-size: 2em;
  font-weight: bold;
  color: #8B6914;
  line-height: 1;
}
.rewards-balance-unit {
  font-size: 0.5em;
  color: #B7950B;
}
.rewards-balance-label {
  font-size: 0.9em;
  color: #8B6914;
  margin-top: 4px;
}

.rewards-sub {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.streak-badge {
  background: linear-gradient(135deg, #FF6B35, #E74C3C);
  color: white;
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 0.9em;
  font-weight: bold;
  box-shadow: 0 3px 8px rgba(231, 76, 60, 0.3);
}
.streak-badge.streak-cold {
  background: #E9ECEF;
  color: #888;
  box-shadow: none;
}

.points-today {
  background: white;
  color: #27AE60;
  padding: 6px 14px;
  border-radius: 16px;
  font-size: 0.9em;
  font-weight: bold;
  border: 2px solid #2ECC71;
}

.rewards-right {
  text-align: right;
}

.payout-btn {
  background: linear-gradient(135deg, #2ECC71, #27AE60);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 1.05em;
  font-weight: bold;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(46, 204, 113, 0.35);
  transition: all 0.2s;
}
.payout-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(46, 204, 113, 0.5);
}

.payout-hint {
  font-size: 0.85em;
  color: #8B6914;
  margin-top: 6px;
  font-weight: bold;
}

@media (max-width: 700px) {
  .rewards-banner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .rewards-left, .rewards-sub { justify-content: center; }
  .rewards-right { text-align: center; }
}

/* ==========================================================
   SUBJECT CARD — points earned today pill
   ========================================================== */

.subject-points-today {
  background: #D4EDDA;
  color: #155724;
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 0.85em;
  font-weight: bold;
  display: inline-block;
  margin-bottom: 10px;
}

/* ==========================================================
   POINTS HISTORY CARD (home page)
   ========================================================== */

.points-history-card {
  background: white;
  border-radius: 18px;
  padding: 20px 24px;
  margin-top: 24px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.06);
  border-left: 6px solid var(--primary-blue);
}

.points-history-title {
  font-size: 1.15em;
  font-weight: bold;
  color: var(--primary-purple);
  margin-bottom: 14px;
}

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

.points-history-row {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #F1F3F5;
  font-size: 0.95em;
}
.points-history-row:last-child {
  border-bottom: none;
}

.points-history-when {
  color: #888;
  font-size: 0.9em;
}

.points-history-reason {
  color: #333;
}

.points-history-amount {
  font-weight: bold;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.95em;
}
.points-history-amount.points-positive {
  background: #D4EDDA;
  color: #155724;
}
.points-history-amount.points-negative {
  background: #F8D7DA;
  color: #721C24;
}

@media (max-width: 600px) {
  .points-history-row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 12px 0;
  }
  .points-history-when { font-size: 0.8em; }
}

/* ==========================================================
   POINTS BOX (homework results)
   ========================================================== */

.dh-points-box {
  background: linear-gradient(135deg, #FFF9C4, #FFECB3);
  border-radius: 14px;
  padding: 18px 22px;
  margin: 16px 0;
  border-left: 5px solid var(--accent-yellow);
}

.dh-points-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1em;
  color: #8B6914;
  margin-bottom: 10px;
}
.dh-points-emoji {
  font-size: 1.4em;
}
.dh-points-title strong {
  color: #D35400;
  font-size: 1.15em;
}

.dh-points-breakdown {
  font-size: 0.95em;
  color: #666;
  padding-left: 12px;
  margin-bottom: 10px;
}
.dh-points-breakdown div {
  padding: 2px 0;
}

.dh-points-streak {
  background: linear-gradient(135deg, #FF6B35, #E74C3C);
  color: white;
  padding: 8px 14px;
  border-radius: 12px;
  font-weight: bold;
  display: inline-block;
  margin: 8px 0;
  box-shadow: 0 3px 8px rgba(231, 76, 60, 0.25);
}

.dh-points-balance {
  font-size: 0.95em;
  color: #8B6914;
  padding-top: 10px;
  border-top: 1px dashed #D4C48A;
  margin-top: 10px;
}
.dh-points-balance strong {
  color: #D35400;
}

.dh-points-box.dh-points-none {
  background: #F8F9FA;
  border-left-color: #DDD;
}
.dh-points-text {
  color: #888;
  font-style: italic;
  font-size: 0.95em;
}

/* ==========================================================
   CELEBRATION SCREEN (skill mastered)
   ========================================================== */

.dh-celebration {
  position: relative;
  overflow: hidden;
  padding: 40px 20px;
  text-align: center;
}

.dh-confetti-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.confetti {
  position: absolute;
  top: -30px;
  font-size: 1.6em;
  animation: confetti-fall 3s linear infinite;
  opacity: 0.9;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(-30px) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(600px) rotate(360deg);
    opacity: 0;
  }
}

.dh-celebration-content {
  position: relative;
  z-index: 2;
  background: white;
  border-radius: 24px;
  padding: 32px 24px;
  max-width: 520px;
  margin: 0 auto;
  box-shadow: 0 12px 40px rgba(142, 68, 173, 0.2);
  border: 4px solid #F1C40F;
}

.dh-celebration-emoji {
  font-size: 5em;
  animation: bounce-in 0.6s ease-out;
  margin-bottom: 8px;
}

@keyframes bounce-in {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}

.dh-celebration-title {
  font-size: 1.8em;
  font-weight: bold;
  background: linear-gradient(135deg, var(--primary-blue), var(--primary-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
  letter-spacing: 2px;
}

.dh-celebration-skill {
  font-size: 1.25em;
  color: var(--text-dark);
  font-weight: bold;
  margin-bottom: 8px;
}

.dh-celebration-sub {
  font-size: 1.05em;
  color: #666;
  margin-bottom: 20px;
}

.dh-celebration-stats {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.dh-celebration-stat {
  background: #FAFBFF;
  border-radius: 12px;
  padding: 12px 20px;
  border: 2px solid #D6E4FF;
}
.dh-celebration-stat-value {
  font-size: 1.3em;
  font-weight: bold;
  color: var(--primary-purple);
}
.dh-celebration-stat-label {
  font-size: 0.85em;
  color: #666;
  margin-top: 4px;
}

.dh-celebration-actions {
  margin-top: 20px;
}

@media (max-width: 600px) {
  .dh-celebration-content {
    padding: 24px 16px;
  }
  .dh-celebration-title { font-size: 1.5em; }
  .dh-celebration-emoji { font-size: 4em; }
  .dh-celebration-skill { font-size: 1.1em; }
}

/* ==========================================================
   REDEMPTIONS (parent dashboard)
   ========================================================== */

.redemption-pending {
  background: linear-gradient(135deg, #FFF3E0, #FFE0B2);
  border-radius: 14px;
  padding: 16px 20px;
  margin: 10px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-left: 5px solid var(--accent-orange);
  box-shadow: 0 4px 12px rgba(230, 126, 34, 0.15);
}

.redemption-info {
  flex: 1;
  min-width: 180px;
}

.redemption-amount {
  font-size: 1.5em;
  font-weight: bold;
  color: #D35400;
  line-height: 1;
}
.redemption-detail {
  font-size: 0.9em;
  color: #8B6914;
  margin-top: 6px;
}

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

.redemption-approve {
  background: linear-gradient(135deg, #2ECC71, #27AE60);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 20px;
  font-family: inherit;
  font-size: 0.95em;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(46, 204, 113, 0.3);
  transition: all 0.15s;
}
.redemption-approve:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 12px rgba(46, 204, 113, 0.45);
}

.redemption-deny {
  background: white;
  color: var(--accent-red);
  border: 2px solid var(--accent-red);
  padding: 8px 18px;
  border-radius: 20px;
  font-family: inherit;
  font-size: 0.95em;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.15s;
}
.redemption-deny:hover {
  background: var(--accent-red);
  color: white;
}

.redemption-status-approved {
  background: #D4EDDA;
  color: #155724;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.85em;
  font-weight: bold;
  text-transform: uppercase;
}

.redemption-status-denied {
  background: #F8D7DA;
  color: #721C24;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.85em;
  font-weight: bold;
  text-transform: uppercase;
}

/* ==========================================================
   POINTS COLORING (parent dashboard tables)
   ========================================================== */

.points-positive {
  color: #27AE60;
}
.points-negative {
  color: #E74C3C;
}

/* ==========================================================
   QUIZ LOCKED MESSAGE (mini-check + chapter quiz)
   ========================================================== */

.quiz-locked-msg {
  margin-top: 20px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #FFF9C4, #FFECB3);
  border-left: 5px solid var(--accent-yellow);
  border-radius: 12px;
  color: #8B6914;
  font-size: 1em;
  font-weight: bold;
  text-align: center;
}

/* ==========================================================
   COMPLETED QUIZ REVIEW
   ========================================================== */

.quiz-review-list {
  margin-top: 24px;
  text-align: left;
}

.quiz-review-list h4 {
  font-size: 1.1em;
  color: var(--primary-purple);
  margin-bottom: 12px;
  text-align: center;
}

.review-item {
  padding: 14px 16px;
  margin: 10px 0;
  border-radius: 10px;
  border-left: 4px solid #DDD;
  background: #FAFBFF;
}

.review-item.review-correct {
  background: #F0FDF4;
  border-left-color: #2ECC71;
}

.review-item.review-incorrect {
  background: #FFF8F8;
  border-left-color: #E74C3C;
}

.review-q {
  font-weight: bold;
  color: var(--text-dark);
  margin-bottom: 8px;
  font-size: 0.98em;
}

.review-a {
  font-size: 0.95em;
  margin-top: 4px;
}

.review-ok {
  color: #27AE60;
  font-weight: bold;
}

.review-bad {
  color: #DC3545;
  font-weight: bold;
  text-decoration: line-through;
}

.review-correct-answer {
  color: #27AE60;
  font-weight: bold;
  margin-left: 12px;
}

.review-explain {
  margin-top: 8px;
  padding: 8px 12px;
  background: white;
  border-radius: 6px;
  font-size: 0.9em;
  color: #555;
  font-style: italic;
  border-left: 3px solid var(--primary-blue);
}

/* ==========================================================
   QUIZ SUMMARY — small tweaks
   ========================================================== */

.quiz-summary {
  text-align: center;
  padding: 20px 10px;
}

.quiz-summary-emoji {
  font-size: 3.5em;
  margin-bottom: 8px;
}

.quiz-summary-text {
  font-size: 1.3em;
  font-weight: bold;
  color: var(--text-dark);
  margin: 10px 0;
}

.quiz-summary-sub {
  font-size: 1em;
  color: #666;
  margin-bottom: 16px;
}

/* ==========================================================
   POINTS BOX — small tweaks
   ========================================================== */

.dh-points-box .dh-points-breakdown div {
  font-family: inherit;
}

/* ==========================================================
   RESPONSIVE
   ========================================================== */

@media (max-width: 600px) {
  .review-item {
    padding: 10px 12px;
  }
  .review-q {
    font-size: 0.92em;
  }
  .review-correct-answer {
    display: block;
    margin-left: 0;
    margin-top: 4px;
  }
}

/* ==========================================================
   PERFECT SCORE CELEBRATION (gold variant)
   Used when a chapter quiz or homework session hits 100%.
   Reuses .dh-celebration from the base celebration styles
   but applies a gold gradient instead of purple.
   ========================================================== */

.dh-celebration.dh-celebration-perfect {
  /* same positioning as base */
}

.dh-celebration-content-gold {
  border: 4px solid #F1C40F;
  box-shadow: 0 12px 40px rgba(241, 196, 15, 0.25);
}

.dh-celebration-title-gold {
  background: linear-gradient(135deg, #F1C40F, #D35400);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-size: 1.9em;
  letter-spacing: 2px;
}

/* The star emoji at the top of the perfect score celebration */
.dh-celebration.dh-celebration-perfect .dh-celebration-emoji {
  animation: perfect-bounce 1s ease-out;
}

@keyframes perfect-bounce {
  0% {
    transform: scale(0) rotate(-180deg);
    opacity: 0;
  }
  60% {
    transform: scale(1.3) rotate(10deg);
    opacity: 1;
  }
  80% {
    transform: scale(0.95) rotate(-5deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

/* Slightly warmer background for the perfect score content */
.dh-celebration-content-gold {
  background: linear-gradient(180deg, #FFFFFF, #FFFDF5);
}

/* Golden border accent on the celebration card */
.dh-celebration.dh-celebration-perfect .dh-celebration-actions .dh-check-btn {
  background: linear-gradient(135deg, #F1C40F, #D35400);
  box-shadow: 0 6px 16px rgba(241, 196, 15, 0.4);
}
.dh-celebration.dh-celebration-perfect .dh-celebration-actions .dh-check-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(241, 196, 15, 0.55);
}

/* Mobile tweaks */
@media (max-width: 600px) {
  .dh-celebration-title-gold {
    font-size: 1.55em;
    letter-spacing: 1px;
  }
}

/* ==========================================================
   LOCKED SECTION STEPS
   Used in the section strip when a section is gated
   (e.g., Chapter Quiz is locked until Quick Check passes).
   ========================================================== */

.section-step.locked {
  background: #F1F3F5;
  color: #AAA;
  border-color: #E9ECEF;
  cursor: not-allowed;
  opacity: 0.75;
  position: relative;
}

.section-step.locked:hover {
  transform: none;
  box-shadow: none;
}

/* Keep the "current" or "done" styles from showing through when locked */
.section-step.locked.done,
.section-step.locked.current {
  background: #F1F3F5;
  color: #AAA;
  border-color: #E9ECEF;
}

.section-step.locked.done::after {
  color: #AAA;
}

/* Disabled state — browser handles the cursor and click blocking */
.section-step:disabled {
  cursor: not-allowed;
  pointer-events: auto; /* still allow hover so tooltips work */
}

/* Small mobile tweak */
@media (max-width: 600px) {
  .section-step.locked {
    font-size: 0.8em;
  }
}