
:root {
  --primary: #4A90D9;
  --primary-dark: #2C5F9E;
  --accent: #FF8C42;
  --bg: #FAFBFC;
  --card-bg: #FFFFFF;
  --text: #2D3748;
  --text-light: #718096;
  --radius: 16px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 20px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 24px;
}

/* Header */
header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  padding: 32px 24px;
  text-align: center;
  border-radius: 0 0 24px 24px;
}
header h1 { font-size: 28px; font-weight: 700; margin-bottom: 4px; }
header p { font-size: 18px; opacity: 0.9; }

/* Breadcrumb */
.breadcrumb {
  padding: 16px 0;
  font-size: 16px;
  color: var(--text-light);
}
.breadcrumb a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}
.breadcrumb a:active { opacity: 0.7; }

/* Cards grid */
.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 20px;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: transform 0.15s, box-shadow 0.15s;
  border-left: 6px solid var(--primary);
  min-height: 80px;
}
.card:active { transform: scale(0.98); box-shadow: 0 1px 4px rgba(0,0,0,0.12); }
.card h2 { font-size: 22px; font-weight: 600; margin-bottom: 6px; }
.card .count { font-size: 16px; color: var(--text-light); }
.card .topics { font-size: 14px; color: var(--text-light); margin-top: 8px; }

/* Activity cards */
.activity-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  display: block;
  min-height: 60px;
}
.activity-card:active { transform: scale(0.98); }
.activity-card h3 { font-size: 20px; font-weight: 600; margin-bottom: 4px; }

/* Badge */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
}

.topic-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 13px;
  background: #EDF2F7;
  color: #4A5568;
  margin: 2px 4px 2px 0;
}

/* Activity content page */
.activity-content {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
  margin-top: 16px;
  font-size: 20px;
  line-height: 1.7;
}
.activity-content h1, .activity-content h2, .activity-content h3 {
  margin: 24px 0 12px 0;
  color: var(--primary-dark);
}
.activity-content h1 { font-size: 26px; }
.activity-content h2 { font-size: 22px; }
.activity-content h3 { font-size: 20px; }
.activity-content p { margin-bottom: 16px; }
.activity-content img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin: 16px 0;
}
.activity-content ul, .activity-content ol {
  margin: 12px 0 12px 24px;
}
.activity-content li { margin-bottom: 8px; }
.activity-content a {
  color: var(--primary);
  word-break: break-word;
}

/* Resource link */
.resource-link {
  display: block;
  background: #FFF8E1;
  border: 2px solid #FFD54F;
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  color: #F57F17;
  text-decoration: none;
  margin-top: 12px;
}
.resource-link:active { opacity: 0.8; }

/* PDF card */
.pdf-card {
  background: linear-gradient(135deg, #FF8C42, #E65100);
  color: white;
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  text-decoration: none;
  display: block;
  margin-top: 24px;
  font-size: 20px;
  font-weight: 600;
}
.pdf-card:active { opacity: 0.85; }
.pdf-card .subtitle { font-size: 16px; font-weight: 400; opacity: 0.9; margin-top: 4px; }

/* Section headers */
.section-header {
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-light);
  margin: 28px 0 12px 0;
  font-weight: 600;
}

/* Back button */
.back-btn {
  display: inline-block;
  background: var(--primary);
  color: white;
  padding: 12px 24px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  font-size: 18px;
  margin-top: 24px;
}
.back-btn:active { opacity: 0.8; }

/* Footer */
footer {
  text-align: center;
  padding: 32px 0;
  font-size: 14px;
  color: var(--text-light);
}
footer a { color: var(--primary); }

@media (min-width: 600px) {
  .cards { grid-template-columns: 1fr 1fr; }
}

/* ═══ Interactive Components ═══ */

/* Header stats */
.header-stats {
  margin-top: 12px;
}
.header-dashboard-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,0.15);
  padding: 8px 16px;
  border-radius: 20px;
  color: white;
  text-decoration: none;
  font-size: 16px;
}
.header-dashboard-link:active { opacity: 0.8; }
.header-streak, .header-points { font-weight: 600; }
.header-level { opacity: 0.85; font-size: 14px; }

/* Dashboard card on home page */
.dashboard-card {
  background: linear-gradient(135deg, #667eea, #764ba2) !important;
  color: white !important;
  border-left: none !important;
  text-align: center;
}
.dashboard-card h2 { color: white; }
.dashboard-card p { color: rgba(255,255,255,0.9); font-size: 16px; }
.mini-progress-bar {
  height: 8px;
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
  margin: 8px 0;
  overflow: hidden;
}
.mini-progress-fill {
  height: 100%;
  background: #4CAF50;
  border-radius: 4px;
  transition: width 0.3s;
}
.card-cta { font-weight: 600; font-size: 16px; margin-top: 8px; }

/* Set completion indicators */
.set-completion {
  margin-top: 8px;
  font-size: 14px;
  color: var(--text-light);
}
.activity-completed {
  border-left: 4px solid #4CAF50 !important;
  position: relative;
}
.activity-started {
  border-left: 4px solid #FF9800 !important;
}
.completion-star {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 20px;
}
.started-dot {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 12px;
  color: #FF9800;
}

/* Question cards */
.interactive-section {
  margin-top: 24px;
}
.interactive-header {
  font-size: 22px;
  color: var(--primary-dark);
  margin-bottom: 16px;
}
.question-card {
  background: #F8FAFC;
  border: 2px solid #E2E8F0;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
}
.question-prompt {
  font-size: 20px;
  font-weight: 500;
  margin-bottom: 12px;
  line-height: 1.5;
}

/* Answer inputs */
.answer-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.answer-input {
  font-size: 20px;
  padding: 12px 16px;
  border: 2px solid #CBD5E0;
  border-radius: 12px;
  width: 160px;
  text-align: center;
  -webkit-appearance: none;
}
.answer-input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(74,144,217,0.2);
}
.input-correct {
  border-color: #4CAF50 !important;
  background: #E8F5E9 !important;
}
.input-shake {
  animation: shake 0.5s ease-in-out;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.unit-label {
  font-size: 16px;
  color: var(--text-light);
}
.check-btn {
  font-size: 18px;
  font-weight: 600;
  padding: 12px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  min-height: 48px;
}
.check-btn:active { opacity: 0.8; }
.check-btn:disabled { background: #A0AEC0; cursor: default; }

/* Feedback */
.feedback-area {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 500;
  display: none;
}
.feedback-correct { background: #E8F5E9; color: #2E7D32; }
.feedback-incorrect { background: #FFEBEE; color: #C62828; }
.feedback-empty { background: #FFF3E0; color: #E65100; }
.feedback-invalid { background: #FFF3E0; color: #E65100; }

/* Hints */
.hint-section {
  margin-top: 8px;
}
.hint {
  background: #FFFDE7;
  border-left: 3px solid #FDD835;
  padding: 8px 12px;
  margin: 6px 0;
  border-radius: 0 8px 8px 0;
  font-size: 16px;
}
.hint-btn {
  background: none;
  border: 2px solid #FDD835;
  color: #F57F17;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  margin-top: 8px;
}
.hint-btn:active { background: #FFFDE7; }

/* Explanation */
.explanation {
  background: #E3F2FD;
  border-radius: 10px;
  padding: 12px 16px;
  margin-top: 10px;
  font-size: 16px;
  line-height: 1.5;
}

/* Multiple choice */
.mc-choices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0;
}
.mc-option {
  font-size: 18px;
  padding: 14px 18px;
  background: white;
  border: 2px solid #E2E8F0;
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  min-height: 48px;
}
.mc-option:active { background: #F7FAFC; }
.mc-correct { border-color: #4CAF50 !important; background: #E8F5E9 !important; }
.mc-incorrect { border-color: #F44336 !important; background: #FFEBEE !important; }

/* WODB */
.wodb-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 12px 0;
}
.wodb-option {
  font-size: 18px;
  padding: 16px;
  background: white;
  border: 2px solid #E2E8F0;
  border-radius: 12px;
  cursor: pointer;
  min-height: 60px;
  text-align: center;
}
.wodb-option.selected { border-color: var(--primary); background: #E3F2FD; }
.wodb-option.dimmed { opacity: 0.5; }
.wodb-feedback {
  margin-top: 12px;
  padding: 16px;
  background: #E8F5E9;
  border-radius: 12px;
  font-size: 18px;
}

/* WYR */
.wyr-choices {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 12px 0;
}
.wyr-option {
  flex: 1;
  min-width: 140px;
  font-size: 18px;
  padding: 16px;
  background: white;
  border: 2px solid #E2E8F0;
  border-radius: 12px;
  cursor: pointer;
  min-height: 60px;
  text-align: center;
}
.wyr-option.selected { border-color: var(--primary); background: #E3F2FD; }
.wyr-option.dimmed { opacity: 0.5; }
.wyr-or {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}

/* Expression inputs (Today's Number) */
.expression-inputs {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.expression-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.expression-input {
  font-size: 20px;
  padding: 10px 14px;
  border: 2px solid #CBD5E0;
  border-radius: 12px;
  flex: 1;
  min-width: 150px;
}
.expression-input:focus {
  border-color: var(--primary);
  outline: none;
}
.expression-target {
  font-size: 16px;
  color: var(--text-light);
  margin-top: 8px;
}
.add-expression-btn {
  background: none;
  border: 2px dashed #CBD5E0;
  color: var(--text-light);
  padding: 10px;
  border-radius: 12px;
  font-size: 16px;
  cursor: pointer;
  margin-top: 8px;
}

/* Multi-input */
.multi-input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 8px 0;
}
.multi-field label {
  display: block;
  font-size: 16px;
  color: var(--text-light);
  margin-bottom: 4px;
}

/* Reflection */
.reflection-input {
  width: 100%;
  font-size: 18px;
  padding: 12px;
  border: 2px solid #CBD5E0;
  border-radius: 12px;
  font-family: inherit;
  resize: vertical;
  margin: 8px 0;
}

/* Completion banner */
.completion-banner {
  background: linear-gradient(135deg, #4CAF50, #2E7D32);
  color: white;
  padding: 16px;
  border-radius: 12px;
  font-size: 20px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 16px;
}

/* Points display */
.points-display {
  position: fixed;
  top: 12px;
  right: 12px;
  background: white;
  padding: 8px 14px;
  border-radius: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  font-size: 16px;
  font-weight: 600;
  z-index: 50;
}

/* Toast notifications */
.radmath-toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  color: white;
  padding: 14px 24px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 500;
  z-index: 1000;
  animation: toastIn 0.3s ease-out;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Motivation popup */
.motivation-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.motivation-card {
  background: white;
  border-radius: 20px;
  padding: 28px;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  animation: popIn 0.3s ease-out;
}
@keyframes popIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.motivation-card h3 { font-size: 22px; margin-bottom: 8px; }
.motivation-card p { font-size: 18px; color: var(--text-light); margin-bottom: 16px; }
.motivation-card button {
  background: var(--primary);
  color: white;
  border: none;
  padding: 12px 32px;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
}

/* Achievement popup */
.achievement-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 20px;
  padding: 32px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  z-index: 1001;
  animation: popIn 0.3s ease-out;
}
.achievement-popup .ach-icon { font-size: 48px; }
.achievement-popup h3 { font-size: 22px; margin: 8px 0 4px; }
.achievement-popup p { font-size: 16px; color: var(--text-light); }

/* Dashboard page */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 16px 0;
}
.stat-card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-icon { font-size: 32px; margin-bottom: 4px; }
.stat-value { font-size: 28px; font-weight: 700; }
.stat-label { font-size: 14px; color: var(--text-light); }
.stat-sub { font-size: 12px; color: var(--text-light); margin-top: 4px; }

.streak-card { border-top: 3px solid #FF9800; }
.points-card { border-top: 3px solid var(--primary); }
.done-card { border-top: 3px solid #4CAF50; }

/* Skill bars */
.skill-bars { margin: 8px 0; }
.skill-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}
.skill-name {
  min-width: 100px;
  font-size: 14px;
  font-weight: 500;
  text-transform: capitalize;
}
.skill-bar-track {
  flex: 1;
  height: 20px;
  background: #E0E0E0;
  border-radius: 10px;
  overflow: hidden;
}
.skill-bar-fill {
  height: 100%;
  border-radius: 10px;
  font-size: 11px;
  color: white;
  line-height: 20px;
  text-align: right;
  padding-right: 6px;
  transition: width 0.5s;
}
.skill-level {
  min-width: 80px;
  font-size: 12px;
  color: var(--text-light);
  text-align: right;
}

/* Set progress */
.set-progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  text-decoration: none;
  color: var(--text);
}
.set-name {
  min-width: 80px;
  font-size: 14px;
  font-weight: 500;
}
.set-count {
  min-width: 50px;
  font-size: 14px;
  text-align: right;
}

/* Recommendations */
.recommendation-card {
  display: block;
  background: white;
  border-radius: 12px;
  padding: 16px;
  margin: 8px 0;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  border-left: 4px solid var(--accent);
}
.recommendation-card:active { transform: scale(0.98); }
.rec-topic {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}
.recommendation-card h3 { font-size: 18px; margin: 4px 0; }
.rec-badge {
  font-size: 12px;
  background: #EDF2F7;
  padding: 2px 8px;
  border-radius: 8px;
}
.all-good { color: var(--text-light); font-style: italic; }

/* Achievement grid */
.achievement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.achievement-tile {
  background: white;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}
.achievement-tile.locked { opacity: 0.5; }
.achievement-tile.unlocked { border: 2px solid #FFD54F; }
.ach-icon { font-size: 32px; }
.ach-name { font-size: 14px; font-weight: 600; margin: 4px 0; }
.ach-desc { font-size: 12px; color: var(--text-light); }

@media (max-width: 600px) {
  .stat-cards { grid-template-columns: 1fr; }
  .wodb-choices { grid-template-columns: 1fr; }
  .multi-input-grid { grid-template-columns: 1fr; }
}
