/* ==========================================================================
   mathwithcye • KSSM Additional Mathematics Form 5
   Chapter 1: Circular Measure (Sukatan Membulat)
   Lesson 1.1: Radian (Sukatan Radian)
   Responsive Design System, Touchscreen Ready, Teacher Teaching Tool & Remote
   ========================================================================== */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --secondary: #0ea5e9;
  --secondary-light: #f0f9ff;
  --accent: #8b5cf6;
  --accent-light: #f5f3ff;
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --dark: #0f172a;
  --card-bg: #ffffff;
  --bg-page: #f8fafc;
  --border: #e2e8f0;
  --border-focus: #3b82f6;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 9999px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-math: "Cambria Math", "Times New Roman", Times, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ==========================================================================
   MATHEMATICAL FRACTION & TYPOGRAPHY STANDARDS (GEMINI.md STRICT COMPLIANCE)
   ========================================================================== */
.math-var {
  font-family: var(--font-math);
  font-style: italic;
  font-weight: 600;
  padding: 0 1px;
}

.math-sym {
  font-family: var(--font-math);
  font-style: normal;
  padding: 0 2px;
}

.math-frac {
  display: inline-flex !important;
  flex-direction: column !important;
  vertical-align: middle !important;
  text-align: center !important;
  padding: 0 4px !important;
  font-size: 0.9em !important;
  line-height: 1 !important;
}

.math-num {
  border-bottom: 1.5px solid currentColor !important;
  padding-bottom: 2px !important;
  margin-bottom: 2px !important;
  display: block !important;
  line-height: 1 !important;
  text-align: center !important;
}

.math-den {
  padding-top: 2px !important;
  display: block !important;
  line-height: 1 !important;
  text-align: center !important;
}

.katex {
  font-size: 1.06em !important;
}

/* ==========================================================================
   LAYOUT CONTAINERS & APP HEADER
   ========================================================================== */
.app-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 16px 20px 80px 20px;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 24px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.brand-zone {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.logo-badge {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
  background: var(--primary-light);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  letter-spacing: -0.5px;
}

.header-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.curriculum-tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.lesson-title-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge-chap {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e40af;
  background: #dbeafe;
  padding: 2px 10px;
  border-radius: var(--radius-sm);
}

.badge-subtopic {
  font-size: 0.85rem;
  font-weight: 700;
  color: #0369a1;
  background: #e0f2fe;
  padding: 2px 10px;
  border-radius: var(--radius-sm);
}

.badge-tb {
  font-size: 0.85rem;
  font-weight: 700;
  color: #854d0e;
  background: #fef9c3;
  padding: 2px 10px;
  border-radius: var(--radius-sm);
}

.user-session-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.student-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-page);
  padding: 6px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.student-avatar {
  font-size: 1.1rem;
}

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

.student-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

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

.btn-icon-xs {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  font-size: 0.85rem;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.btn-icon-xs:hover {
  opacity: 1;
}

.session-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-page);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
}

.points-pill {
  background: #fef3c7;
  border-color: #fde68a;
  color: #92400e;
}

/* ==========================================================================
   PROGRESS TRACKER & NAVIGATION TABS
   ========================================================================== */
.progress-bar-wrapper {
  margin-bottom: 20px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 18px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.progress-track {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.4s ease;
}

.stage-nav-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.stage-tab-btn {
  flex: 1;
  min-width: 140px;
  padding: 12px 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  font-family: inherit;
}

.stage-tab-btn:hover {
  border-color: #93c5fd;
  background: #f8fafc;
}

.stage-tab-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.tab-stage-id {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.75;
}

.stage-tab-btn.active .tab-stage-id {
  opacity: 0.9;
}

.tab-stage-name {
  font-size: 0.88rem;
  font-weight: 700;
}

/* ==========================================================================
   STAGE CARDS & CONTENT ARCHITECTURE
   ========================================================================== */
.stage-card {
  display: none;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.stage-card.active {
  display: block;
  animation: fadeIn 0.3s ease-out;
}

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

.stage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 24px;
}

.stage-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.badge-stage {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  background: var(--primary-light);
  color: var(--primary);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.stage-header h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.stage-time {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.lead-text {
  font-size: 1.02rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

/* Profile Registration Card in Stage A */
.profile-input-card {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 24px;
}

.profile-input-card h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: #166534;
  margin-bottom: 6px;
}

.profile-hint {
  font-size: 0.88rem;
  color: #15803d;
  margin-bottom: 16px;
}

.profile-inputs-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.input-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 200px;
}

.input-field-group label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #166534;
}

.input-field-group input {
  padding: 10px 14px;
  border: 1px solid #86efac;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
}

.input-field-group input:focus {
  border-color: var(--success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* Dilemma Card */
.dilemma-card {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 5px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
}

.dilemma-badge {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 8px;
  display: inline-block;
  letter-spacing: 0.5px;
}

.dilemma-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #1e3a8a;
  margin-bottom: 10px;
}

.dilemma-body {
  font-size: 0.96rem;
  color: #1e40af;
  line-height: 1.6;
}

/* Generic Content Box */
.content-box {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
}

/* Symbol Decoder Card */
.symbol-decoder-card {
  background: #faf5ff;
  border: 1px solid #e9d5ff;
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
}

.symbol-decoder-card h4 {
  font-size: 1.05rem;
  font-weight: 800;
  color: #6b21a8;
  margin-bottom: 16px;
}

.symbol-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.symbol-pill {
  background: #ffffff;
  border: 1px solid #d8b4fe;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.symbol-glyph {
  font-size: 1.05rem;
  font-weight: 800;
  color: #581c87;
}

.symbol-desc {
  font-size: 0.84rem;
  color: #4c1d95;
  line-height: 1.4;
}

/* ==========================================================================
   STAGE B: DISCOVERY LAB - THE RADIAN ARC-WRAP STUDIO
   ========================================================================== */
.lab-container {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
  align-items: start;
  margin-bottom: 24px;
}

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

.lab-panel {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.lab-panel-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}

.lab-panel-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.svg-canvas-card {
  position: relative;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.svg-canvas-card svg {
  width: 100%;
  max-width: 290px !important;
  height: auto;
  aspect-ratio: 1 / 1;
  display: block;
  margin: 0 auto;
  overflow: hidden;
}

/* Lab Controls */
.lab-controls-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.control-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  font-weight: 700;
}

.slider-styled {
  width: 100%;
  accent-color: var(--primary);
  height: 6px;
  cursor: pointer;
}

.preset-btn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.btn-preset {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.btn-preset:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.btn-preset.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* Lab Metric Cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.metric-card {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}

.metric-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.metric-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary);
}

.verdict-box {
  background: #f8fafc;
  border-left: 4px solid var(--primary);
  padding: 14px 18px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text-main);
}

/* ==========================================================================
   STAGE C: WORKED EXAMPLES
   ========================================================================== */
.example-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.example-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.example-tag {
  font-size: 0.8rem;
  font-weight: 800;
  background: #dbeafe;
  color: #1e40af;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
}

.example-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
}

.example-sub-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-top: 14px;
}

.step-card {
  background: #ffffff;
  border-left: 4px solid var(--secondary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 18px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.step-label {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--secondary);
  margin-bottom: 4px;
}

.step-content {
  font-size: 0.94rem;
  color: var(--text-main);
  line-height: 1.5;
}

/* ==========================================================================
   STAGE D & E: PRACTICE QUESTIONS & DIAGRAMS
   ========================================================================== */
.questions-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.question-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s;
}

.question-card:hover {
  border-color: #cbd5e1;
}

.q-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.q-badge {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

.q-badge.foundation {
  background: #dcfce7;
  color: #166534;
}

.q-badge.intermediate {
  background: #dbeafe;
  color: #1e40af;
}

.q-badge.advanced {
  background: #fef3c7;
  color: #92400e;
}

.q-source {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.q-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 16px;
  line-height: 1.6;
}

.question-diagram-wrapper {
  margin: 12px auto 16px auto;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.textbook-diagram-svg {
  display: block;
  margin: 0 auto;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  width: 100%;
  max-width: 220px !important;
  height: auto;
}

/* Options */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.option-btn {
  background: var(--bg-page);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
  font-family: inherit;
}

.option-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.option-btn.selected {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.option-btn.correct {
  background: var(--success-light) !important;
  border-color: var(--success) !important;
  color: #065f46 !important;
}

.option-btn.wrong {
  background: var(--danger-light) !important;
  border-color: var(--danger) !important;
  color: #991b1b !important;
}

.opt-radio {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: inline-block;
  flex-shrink: 0;
}

.option-btn.selected .opt-radio {
  border-color: var(--primary);
  background: var(--primary);
}

.option-btn.correct .opt-radio {
  border-color: var(--success);
  background: var(--success);
}

.option-btn.wrong .opt-radio {
  border-color: var(--danger);
  background: var(--danger);
}

/* Strict Hidden-by-Default Hint Accordion */
.hint-toggle-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

.hint-toggle-btn:hover {
  background: var(--primary-light);
}

.hint-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 4px solid var(--warning);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 18px;
  margin-bottom: 14px;
  font-size: 0.88rem;
  color: #92400e;
  line-height: 1.5;
}

.solution-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-left: 4px solid var(--success);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 16px 20px;
  margin-top: 14px;
  font-size: 0.92rem;
  line-height: 1.6;
}

/* ==========================================================================
   INTEGRATED MILESTONES (GEMINI.md DIRECTIVE)
   ========================================================================== */

/* Milestone 1: SPM Misconception Buster */
.misconception-card {
  background: #ffffff;
  border: 2px solid #fecaca;
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 28px;
  margin-bottom: 20px;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.08);
}

.misconception-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.misconception-badge {
  background: var(--danger);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.misconception-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #991b1b;
}

.misconception-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

@media (max-width: 768px) {
  .misconception-grid {
    grid-template-columns: 1fr;
  }
}

.col-pitfall {
  background: var(--danger-light);
  border: 1px solid #fca5a5;
  border-radius: var(--radius-md);
  padding: 18px;
}

.col-pitfall h4 {
  color: #991b1b;
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.col-pitfall p {
  font-size: 0.88rem;
  color: #7f1d1d;
  line-height: 1.5;
  margin-bottom: 8px;
}

.col-solution {
  background: var(--success-light);
  border: 1px solid #86efac;
  border-radius: var(--radius-md);
  padding: 18px;
}

.col-solution h4 {
  color: #065f46;
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.col-solution p {
  font-size: 0.88rem;
  color: #064e3b;
  line-height: 1.5;
  margin-bottom: 8px;
}

.examiner-warning {
  margin-top: 14px;
  padding: 10px 14px;
  background: #fffbeb;
  border-left: 3px solid var(--warning);
  font-size: 0.84rem;
  color: #92400e;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Milestone 2: The Vault - Master Formula Matrix & The Golden Takeaway */
.summary-vault-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.vault-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.vault-badge {
  background: #4338ca;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.vault-header h3 {
  font-size: 1.2rem;
  font-weight: 800;
  color: #1e1b4b;
}

.formula-table-wrap {
  overflow-x: auto;
  margin-bottom: 20px;
}

.formula-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.formula-table th,
.formula-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.formula-table th {
  background: #f8fafc;
  font-weight: 800;
  color: var(--text-muted);
}

/* Prestigious Golden Takeaway Card */
.golden-takeaway-card {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 2px solid #f59e0b;
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 20px;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.15);
  position: relative;
  overflow: hidden;
}

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

.trophy-badge {
  background: #f59e0b;
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.takeaway-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #78350f;
}

.takeaway-rule-box {
  background: #ffffff;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 14px;
}

.takeaway-rule-box ul {
  list-style: none;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.takeaway-rule-box li {
  font-size: 0.95rem;
  font-weight: 700;
  color: #92400e;
  line-height: 1.5;
}

.takeaway-mnemonic {
  font-size: 0.88rem;
  font-style: italic;
  color: #b45309;
}

/* ==========================================================================
   STAGE F: EXIT TICKET & LEARNING REPORT / CERTIFICATE
   ========================================================================== */
.exit-ticket-container {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}

.certificate-card {
  background: #ffffff;
  border: 4px double #1e293b;
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  margin-top: 24px;
  box-shadow: var(--shadow-md);
}

.cert-header {
  margin-bottom: 20px;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 16px;
}

.cert-logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 4px;
}

.cert-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.cert-body {
  font-size: 1.05rem;
  color: var(--text-main);
  line-height: 1.8;
  margin-bottom: 24px;
}

.cert-student-name {
  font-size: 1.6rem;
  font-weight: 800;
  color: #1e3a8a;
  text-decoration: underline;
  text-decoration-color: var(--primary);
}

.cert-golden-takeaway {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin: 20px auto;
  max-width: 600px;
  font-size: 0.92rem;
  font-weight: 700;
  color: #92400e;
}

.cert-meta-row {
  display: flex;
  justify-content: space-around;
  margin-top: 24px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Common UI Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 0.92rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

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

.btn-success {
  background: var(--success);
  color: #ffffff;
}

.btn-success:hover {
  background: #059669;
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--bg-page);
  border-color: #cbd5e1;
}

.stage-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ==========================================================================
   CLASSROOM TEACHER TEACHING TOOLBAR & SCREEN ANNOTATION (GEMINI.md)
   ========================================================================== */
.teaching-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9998;
  pointer-events: none;
}

.teaching-layer.mode-cursor {
  pointer-events: none;
}

.teaching-layer.mode-laser {
  pointer-events: auto;
  cursor: crosshair;
}

.teaching-layer.mode-pen {
  pointer-events: auto;
  cursor: crosshair;
}

.teaching-layer.mode-eraser {
  pointer-events: auto;
  cursor: cell;
}

.teaching-layer canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.teaching-toolbar {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  background: #0f172a;
  color: #ffffff;
  border-radius: 40px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.1);
  border: 1px solid #334155;
  transition: all 0.25s ease;
  user-select: none;
}

.teaching-toolbar.hidden {
  display: none !important;
}

.toolbar-drag-handle {
  cursor: grab;
  font-size: 1.15rem;
  color: #64748b;
  padding: 2px 8px 2px 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  border-right: 1px solid #334155;
  margin-right: 2px;
  line-height: 1;
}

.toolbar-drag-handle:active {
  cursor: grabbing;
}

.toolbar-tools,
.toolbar-btn-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-btn,
.toolbar-btn {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #cbd5e1 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 20px !important;
  padding: 6px 12px !important;
  font-size: 0.82rem !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  font-family: inherit !important;
  line-height: 1 !important;
  transition: all 0.18s ease !important;
  white-space: nowrap !important;
  outline: none !important;
  box-shadow: none !important;
}

.tool-btn:hover,
.toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.18) !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
  transform: translateY(-1px) !important;
}

.tool-btn.active,
.toolbar-btn.active {
  background: var(--primary, #2563eb) !important;
  color: #ffffff !important;
  border-color: #60a5fa !important;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.6) !important;
}

.tool-icon {
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.tool-label {
  font-size: 0.8rem;
  letter-spacing: 0.2px;
  line-height: 1;
}

.toolbar-remote-dot,
.remote-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  display: inline-block;
  margin-left: 2px;
  box-shadow: 0 0 4px rgba(239, 68, 68, 0.6);
  transition: all 0.3s ease;
}

.toolbar-remote-dot.connected,
.remote-dot.connected {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.btn-toolbar-minimize,
.toolbar-btn.btn-minimize {
  background: transparent !important;
  border: none !important;
  color: #64748b !important;
  cursor: pointer !important;
  padding: 4px 8px !important;
  font-size: 0.85rem !important;
  font-weight: 700 !important;
  border-radius: 50% !important;
  transition: all 0.15s ease !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
  outline: none !important;
  box-shadow: none !important;
}

.btn-toolbar-minimize:hover,
.toolbar-btn.btn-minimize:hover {
  color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.2) !important;
  transform: none !important;
  box-shadow: none !important;
}

.toolbar-expand-pill {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  background: #0f172a;
  color: #ffffff;
  border-radius: 9999px;
  padding: 8px 18px;
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid #334155;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.toolbar-expand-pill:hover {
  background: #1e293b;
  border-color: #64748b;
  transform: translateY(-2px);
}

.tool-toast-notification {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.95);
  color: #ffffff;
  padding: 8px 20px;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 700;
  z-index: 10000;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  border: 1px solid #334155;
  backdrop-filter: blur(6px);
  animation: fadeIn 0.2s ease;
  pointer-events: none;
}

/* Strict Utility Hidden Directive */
.hidden {
  display: none !important;
}

/* ==========================================================================
   PRINT STYLESHEET (Clean Single/Double-Page PDF Learning Certificate)
   ========================================================================== */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .app-header,
  .progress-bar-wrapper,
  .stage-nav-tabs,
  .stage-footer,
  .btn,
  .teaching-toolbar,
  .toolbar-expand-pill,
  .teaching-layer,
  .misconception-card,
  .summary-vault-card,
  .exit-ticket-container,
  #stageA, #stageB, #stageC, #stageD, #stageE {
    display: none !important;
  }
  #stageF {
    display: block !important;
    border: none !important;
    padding: 0 !important;
  }
  .certificate-card {
    display: block !important;
    box-shadow: none !important;
    border: 3px double #000000 !important;
    page-break-inside: avoid;
    margin: 0 !important;
    padding: 24px !important;
  }
  .cert-golden-takeaway {
    display: block !important;
  }
}
