/* Import Modern Typography */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* CSS Variables for Premium Design Tokens */
:root {
  --primary-color: #0c4a8a;      /* Slate Blue from logo */
  --primary-light: #e0f2fe;     /* Very soft blue */
  --primary-dark: #032a54;      /* Deep navy */
  --accent-color: #f59e0b;       /* Golden Yellow from buttons */
  --accent-hover: #d97706;       /* Darker gold */
  --success-color: #10b981;      /* Emerald Green for correct feedback */
  --success-bg: #ecfdf5;         /* Soft green background */
  --danger-color: #ef4444;       /* Ruby Red for error/wrong answer */
  --text-primary: #1e293b;       /* Dark slate for text */
  --text-secondary: #64748b;     /* Slate gray for subtitles */
  --bg-main: #f8fafc;            /* Clean light gray background */
  --bg-card: #ffffff;            /* White for card surfaces */
  --border-color: #e2e8f0;       /* Light border */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Navigation */
header {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-logo {
  height: 38px;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  cursor: pointer;
}

.nav-link:hover, .nav-link.active {
  color: var(--primary-color);
  background-color: var(--primary-light);
}

/* Controls (Role Switcher) */
.controls-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.role-switcher {
  display: flex;
  background-color: #f1f5f9;
  padding: 0.25rem;
  border-radius: 30px;
  border: 1px solid var(--border-color);
}

.role-btn {
  border: none;
  background: none;
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 20px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
}

.role-btn.active {
  background-color: var(--primary-color);
  color: white;
  box-shadow: var(--shadow-sm);
}

/* Mobile Hamburger Menu */
.hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-primary);
}

/* Main Layout */
main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Views & Pages */
.view-section {
  display: none;
}

.view-section.active {
  display: block;
  animation: fadeIn 0.4s ease-out;
}

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

/* Common Layout Components */
.hero-card {
  background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.hero-content {
  max-width: 60%;
  z-index: 1;
}

.hero-title {
  color: var(--primary-dark);
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
}

.hero-subtitle {
  color: #0369a1;
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
}

.hero-illustration {
  max-width: 250px;
  height: auto;
  z-index: 1;
}

/* Buttons */
.btn-primary {
  background-color: var(--accent-color);
  color: var(--primary-dark);
  border: none;
  padding: 0.875rem 2rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 30px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 6px -1px rgba(245, 158, 11, 0.3);
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px -1px rgba(245, 158, 11, 0.4);
}

.btn-outline {
  border: 2px solid var(--primary-color);
  background: transparent;
  color: var(--primary-color);
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 20px;
  cursor: pointer;
  transition: var(--transition);
}

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

/* Dashboard Grid Layouts */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.75rem;
  margin-bottom: 2rem;
}

.dashboard-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Progress bar styles */
.progress-bar-wrapper {
  margin: 1rem 0;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.progress-outer {
  background-color: #f1f5f9;
  border-radius: 10px;
  height: 12px;
  overflow: hidden;
}

.progress-inner {
  background: linear-gradient(90deg, var(--primary-color) 0%, #06b6d4 100%);
  height: 100%;
  border-radius: 10px;
  transition: width 0.8s ease-out;
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.custom-table th {
  background-color: #f8fafc;
  color: var(--text-secondary);
  font-weight: 600;
  padding: 0.875rem 1rem;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-color);
}

.custom-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.95rem;
  color: var(--text-primary);
}

.custom-table tr:last-child td {
  border-bottom: none;
}

.status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-block;
}

.status-badge.selesai {
  background-color: #d1fae5;
  color: #065f46;
}

.status-badge.proses {
  background-color: #fef3c7;
  color: #92400e;
}

/* Leaderboard Widget (Top 5 / Top 10) */
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-sm);
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.leaderboard-item:hover {
  transform: translateX(4px);
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
}

.leaderboard-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.rank-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: #cbd5e1;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rank-badge.rank-1 {
  background-color: #fef08a; /* Gold light */
  color: #854d0e;
  border: 2px solid #facc15;
}

.rank-badge.rank-2 {
  background-color: #e2e8f0; /* Silver light */
  color: #334155;
  border: 2px solid #cbd5e1;
}

.rank-badge.rank-3 {
  background-color: #ffedd5; /* Bronze light */
  color: #9a3412;
  border: 2px solid #fdba74;
}

.rank-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.rank-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.rank-score {
  font-weight: 700;
  color: var(--primary-color);
  font-size: 0.95rem;
}

.rank-trend {
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 2px;
  font-weight: 700;
}

.rank-trend.up { color: var(--success-color); }
.rank-trend.down { color: var(--danger-color); }
.rank-trend.flat { color: var(--text-secondary); }

/* Polya Step Wizard */
.polya-wizard {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 2rem;
  margin-top: 1.5rem;
}

.wizard-steps {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  margin-bottom: 2.5rem;
}

.wizard-steps::before {
  content: '';
  position: absolute;
  top: 18px;
  left: 20px;
  right: 20px;
  height: 4px;
  background-color: #e2e8f0;
  z-index: 1;
}

.wizard-progress-line {
  position: absolute;
  top: 18px;
  left: 20px;
  height: 4px;
  background-color: var(--primary-color);
  z-index: 2;
  width: 0%;
  transition: width 0.4s ease;
}

.step-node {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: #ffffff;
  border: 3px solid #cbd5e1;
  color: var(--text-secondary);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.step-node.active .step-circle {
  border-color: var(--primary-color);
  background-color: var(--primary-color);
  color: white;
  box-shadow: 0 0 0 4px var(--primary-light);
}

.step-node.completed .step-circle {
  border-color: var(--success-color);
  background-color: var(--success-color);
  color: white;
}

.step-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
}

.step-node.active .step-label {
  color: var(--primary-color);
  font-weight: 700;
}

.step-node.completed .step-label {
  color: var(--success-color);
}

.wizard-content {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2rem;
  margin-bottom: 2rem;
  min-height: 250px;
  background-color: #fafbfc;
}

.wizard-content-pane {
  display: none;
}

.wizard-content-pane.active {
  display: block;
  animation: fadeIn 0.3s ease-out;
}

.wizard-actions {
  display: flex;
  justify-content: space-between;
}

/* Polya Step Elements */
.problem-card {
  background-color: var(--primary-light);
  border-left: 5px solid var(--primary-color);
  padding: 1.25rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 1.5rem;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--primary-dark);
}

.polya-checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.polya-checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.polya-checkbox-item:hover {
  border-color: var(--primary-color);
  background-color: #f8fafc;
}

.polya-checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  accent-color: var(--primary-color);
}

.formula-card {
  background-color: #fefaf0;
  border: 1px solid #fef3c7;
  padding: 1.5rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  text-align: center;
}

.math-display {
  font-family: 'Cambria Math', 'Times New Roman', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 0.75rem 0;
}

.polya-feedback {
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  display: none;
}

.polya-feedback.correct {
  display: block;
  background-color: var(--success-bg);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.polya-feedback.wrong {
  display: block;
  background-color: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

/* Simulation / Forex P&L Calculator */
.calc-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
}

.form-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.calc-result-box {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.calc-result-title {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 1rem;
}

.calc-result-value {
  font-size: 3rem;
  font-weight: 800;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.calc-result-rp {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  background-color: #ffffff;
  padding: 0.5rem 1.5rem;
  border-radius: 30px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

/* Quiz Balloon Game Styles */
.game-card {
  background: linear-gradient(180deg, #bae6fd 0%, #e0f2fe 100%);
  border-radius: var(--radius-lg);
  padding: 2rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  min-height: 480px;
  display: flex;
  flex-direction: column;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  background-color: rgba(255, 255, 255, 0.7);
  padding: 0.75rem 1.25rem;
  border-radius: 30px;
  backdrop-filter: blur(4px);
  margin-bottom: 1.5rem;
}

.game-stat {
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.game-timer-badge {
  background-color: var(--accent-color);
  color: var(--primary-dark);
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
}

.game-question-area {
  text-align: center;
  margin: 1rem 0;
  z-index: 10;
}

.game-question-text {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 0.5rem;
}

.game-hint {
  font-size: 0.9rem;
  color: #0369a1;
}

/* Balloon Playground */
.game-playground {
  flex: 1;
  position: relative;
  width: 100%;
  min-height: 280px;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.2);
  border: 1px dashed rgba(3, 105, 161, 0.2);
}

/* Floating Balloons */
.balloon {
  position: absolute;
  bottom: -120px;
  width: 85px;
  height: 102px;
  border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.4rem;
  color: white;
  cursor: pointer;
  box-shadow: inset -6px -10px 15px rgba(0, 0, 0, 0.2), 0 6px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.1s ease;
  user-select: none;
}

.balloon::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 38px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 8px solid currentColor;
  filter: brightness(0.8);
}

.balloon-thread {
  position: absolute;
  bottom: -32px;
  left: 41px;
  width: 2px;
  height: 24px;
  background-color: rgba(0, 0, 0, 0.15);
}

/* Balloon Colors matching DOCX */
.balloon.color-red { background-color: #ef4444; color: white; }
.balloon.color-blue { background-color: #3b82f6; color: white; }
.balloon.color-green { background-color: #10b981; color: white; }
.balloon.color-yellow { background-color: #fbbf24; color: #78350f; }
.balloon.color-purple { background-color: #a855f7; color: white; }

.balloon:hover {
  transform: scale(1.05);
}

/* Pop Animation */
.balloon.pop {
  animation: balloonPopAnimation 0.25s forwards ease-out;
}

@keyframes balloonPopAnimation {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.5; filter: brightness(1.2); }
  100% { transform: scale(0); opacity: 0; }
}

.balloon-pop-points {
  position: absolute;
  color: var(--success-color);
  font-size: 1.5rem;
  font-weight: 800;
  animation: pointsFloatUp 0.8s forwards ease-out;
  pointer-events: none;
  z-index: 100;
}

@keyframes pointsFloatUp {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-40px); opacity: 0; }
}

/* Start Overlay for Quiz */
.game-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(12, 74, 138, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
  color: white;
  text-align: center;
  padding: 2rem;
}

.game-overlay h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.game-overlay p {
  font-size: 1.1rem;
  margin-bottom: 2rem;
  max-width: 400px;
  opacity: 0.9;
}

/* Mobile Bottom Navigation Bar (Fidelity to Image 2/3) */
.mobile-nav-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.05);
  z-index: 99;
}

.mobile-nav-container {
  display: flex;
  justify-content: space-around;
  padding: 0.5rem 0;
}

 .mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  background: none;
  border: none;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  padding: 0.25rem 0.75rem;
  opacity: 0.65; /* Muted but colors are visible */
}

/* Unique branding colors for each mobile nav item (Matches Mockup) */
.mobile-nav-item[data-target="dashboard"] {
  color: #0c4a8a; /* Blue */
}

.mobile-nav-item[data-target="materi"] {
  color: #0284c7; /* Cyan */
}

.mobile-nav-item[data-target="latihan"] {
  color: #f59e0b; /* Orange */
}

.mobile-nav-item[data-target="evaluasi"] {
  color: #10b981; /* Green */
}

.mobile-nav-item:hover, .mobile-nav-item.active {
  opacity: 1; /* Highlighted when active */
  font-weight: 700;
}

.mobile-nav-item svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  margin-bottom: 2px;
}

/* Footer styling */
footer {
  text-align: center;
  padding: 2rem 0;
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-card);
}

/* Responsive Styles */
@media (max-width: 992px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  .calc-container {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  header {
    position: static;
  }
  
  .nav-menu {
    display: none; /* Hide top nav, use bottom nav for mobile style */
  }
  
  .hamburger {
    display: block;
  }
  
  .mobile-nav-bar {
    display: block;
  }
  
  body {
    padding-bottom: 70px; /* Space for bottom nav */
  }
  
  main {
    padding: 1rem 1rem 2rem 1rem;
  }
  
  .hero-card {
    flex-direction: column;
    padding: 1.5rem;
    text-align: center;
  }
  
  .hero-content {
    max-width: 100%;
  }
  
  .hero-illustration {
    max-width: 180px;
    order: -1;
  }
}

/* ==========================================================================
   DESMOS FEATURES STYLES: FINANCIAL GRAPHER, TEACHER CONTROLS & SCRATCHPAD
   ========================================================================== */

/* 1. Financial Grapher Layout */
.grapher-container {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 1.5rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.grapher-controls {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  background: #f8fafc;
  padding: 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.slider-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.slider-val-badge {
  background-color: var(--primary-light);
  color: var(--primary-color);
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.82rem;
}

.custom-slider {
  width: 100%;
  accent-color: var(--primary-color);
  cursor: pointer;
  height: 6px;
  background: #e2e8f0;
  border-radius: 5px;
  outline: none;
}

.slider-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.grapher-formula-box {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.formula-legend-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.82rem;
}

.legend-color-box {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  margin-top: 2px;
  flex-shrink: 0;
}

.legend-color-box.linear-color { background-color: #0284c7; }
.legend-color-box.compound-color { background-color: #10b981; }

.formula-text {
  font-family: 'Cambria Math', 'Times New Roman', serif;
  font-size: 0.95rem;
  color: var(--primary-dark);
  font-weight: 600;
}

.grapher-summary-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.85rem;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.summary-row.diff-highlight {
  border-top: 1px dashed var(--border-color);
  padding-top: 0.4rem;
  margin-top: 0.2rem;
  color: #15803d;
}

.grapher-canvas-wrapper {
  display: flex;
  flex-direction: column;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
  position: relative;
}

.canvas-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 600;
}

#finance-chart-canvas {
  width: 100%;
  height: 380px;
  border: 1px solid #f1f5f9;
  border-radius: 4px;
  background-color: #ffffff;
  cursor: crosshair;
}

.chart-tooltip {
  position: absolute;
  display: none;
  background: rgba(15, 23, 42, 0.9);
  color: white;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  pointer-events: none;
  z-index: 20;
  box-shadow: var(--shadow-md);
  white-space: nowrap;
}

.btn-tool-sm {
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: var(--transition);
}

.btn-tool-sm:hover {
  background: var(--primary-light);
  color: var(--primary-color);
}

/* 2. Desmos Classroom Teacher Control Bar */
.teacher-control-bar {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-left: 5px solid #10b981;
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.control-bar-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
}

.control-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
  display: inline-block;
}

.control-status-dot.paused {
  background-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.control-bar-buttons {
  display: flex;
  gap: 0.6rem;
}

.btn-control-toggle {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 0.45rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition);
}

.btn-control-toggle:hover {
  background: var(--primary-light);
  color: var(--primary-color);
  border-color: #bfdbfe;
}

.btn-control-toggle.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.btn-control-toggle.paused-active {
  background: #ef4444;
  color: white;
  border-color: #dc2626;
}

/* 3. Live Matrix Styles */
.matrix-pill {
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  font-weight: 700;
  display: inline-block;
}

.matrix-pill.completed {
  background-color: #d1fae5;
  color: #065f46;
}

.matrix-pill.active-step {
  background-color: #fef3c7;
  color: #92400e;
  animation: pulseLight 1.5s infinite;
}

.matrix-pill.pending {
  color: #94a3b8;
}

.matrix-score-pill {
  background: var(--primary-light);
  color: var(--primary-color);
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
}

@keyframes pulseLight {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* 4. Classroom Pause Overlay */
.classroom-pause-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.3s ease;
}

.pause-overlay-card {
  background: white;
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  max-width: 480px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.pause-icon-anim {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  animation: bounceSoft 2s infinite;
}

@keyframes bounceSoft {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.pause-overlay-card h2 {
  color: var(--primary-dark);
  font-size: 1.6rem;
  margin-bottom: 0.75rem;
}

.pause-overlay-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.pause-hint-badge {
  background: #fee2e2;
  color: #991b1b;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  display: inline-block;
}

/* 5. Desmos Mini Scratchpad / Calculator in Polya */
.polya-mini-calc {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}

.mini-calc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-dark);
}

.btn-text-sm {
  background: none;
  border: none;
  color: var(--primary-color);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
}

.btn-text-sm:hover {
  text-decoration: underline;
}

.mini-calc-body {
  margin-top: 0.85rem;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.calc-screen-wrapper {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.6rem;
  text-align: right;
}

.calc-screen {
  width: 100%;
  border: none;
  background: transparent;
  font-family: 'Cambria Math', monospace;
  font-size: 1.1rem;
  text-align: right;
  color: var(--text-primary);
  outline: none;
}

.calc-screen-sub {
  font-size: 0.95rem;
  color: var(--primary-color);
  font-weight: 700;
  font-family: monospace;
}

.mini-calc-keypad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
}

.btn-calc-key {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.5rem 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
}

.btn-calc-key:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.btn-calc-key.op {
  background: #f8fafc;
  color: var(--primary-color);
  font-weight: 700;
}

.btn-calc-key.equal {
  background: var(--accent-color);
  color: var(--primary-dark);
  font-weight: 800;
}

.btn-calc-key.equal:hover {
  background: var(--accent-hover);
}

@media (max-width: 900px) {
  .grapher-container {
    grid-template-columns: 1fr;
  }
}

