/* ==========================================================================
   mathwithcye — Form 5 Chapter 1: 1.2 Inverse Variation (Ubahan Songsang)
   Complete Design System, Responsive Layout & Print Stylesheet
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS CUSTOM PROPERTIES / DESIGN SYSTEM TOKENS
   -------------------------------------------------------------------------- */
:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;

  /* Color Palette - Vibrant Indigo / Cyan / Emerald Educational Theme */
  --color-primary: #4f46e5;
  --color-primary-light: #6366f1;
  --color-primary-dark: #3730a3;
  --color-primary-surface: #eef2ff;

  --color-secondary: #0284c7;
  --color-secondary-light: #38bdf8;
  --color-secondary-surface: #f0f9ff;

  --color-accent: #f59e0b;
  --color-accent-light: #fbbf24;
  --color-accent-surface: #fffbeb;

  --color-success: #10b981;
  --color-success-surface: #ecfdf5;
  --color-error: #ef4444;
  --color-error-surface: #fef2f2;

  --color-bg-base: #f8fafc;
  --color-bg-card: #ffffff;
  --color-surface-sunken: #f1f5f9;

  --color-text-main: #0f172a;
  --color-text-muted: #64748b;
  --color-text-inverse: #ffffff;

  --color-border-subtle: #e2e8f0;
  --color-border-heavy: #cbd5e1;

  --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 -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* Dark Theme Overrides */
[data-theme="dark"] {
  --color-bg-base: #0b0f19;
  --color-bg-card: #151c2e;
  --color-surface-sunken: #0d1322;

  --color-text-main: #f1f5f9;
  --color-text-muted: #94a3b8;

  --color-border-subtle: #1e293b;
  --color-border-heavy: #334155;

  --color-primary-surface: rgba(79, 70, 229, 0.15);
  --color-secondary-surface: rgba(2, 132, 199, 0.15);
  --color-accent-surface: rgba(245, 158, 11, 0.15);
  --color-success-surface: rgba(16, 185, 129, 0.15);
  --color-error-surface: rgba(239, 68, 68, 0.15);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* --------------------------------------------------------------------------
   2. GLOBAL RESET & BASE STYLING
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

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

/* --------------------------------------------------------------------------
   3. APP CONTAINER & HEADER
   -------------------------------------------------------------------------- */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.25rem 4rem;
}

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

.brand-zone {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.logo-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--color-primary);
}

.logo-icon {
  font-size: 1.4rem;
}

.syllabus-crumb {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.kssm-tag {
  background-color: var(--color-primary-surface);
  color: var(--color-primary);
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.04em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.student-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  background-color: var(--color-surface-sunken);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition-fast);
}

.student-badge:hover {
  border-color: var(--color-primary);
  background-color: var(--color-primary-surface);
}

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

.student-info-display strong {
  font-size: 0.85rem;
  color: var(--color-text-main);
}

.student-info-display small {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.btn-theme-toggle {
  background: var(--color-surface-sunken);
  border: 1px solid var(--color-border-subtle);
  font-size: 1.1rem;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-theme-toggle:hover {
  background-color: var(--color-border-subtle);
}

/* --------------------------------------------------------------------------
   4. STAGE NAVIGATION TRACK
   -------------------------------------------------------------------------- */
.stage-nav {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: 0.6rem 1rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.nav-track {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
}

.stage-step-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 0.4rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.825rem;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}

.stage-step-btn .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  background-color: var(--color-surface-sunken);
  font-size: 0.75rem;
}

.stage-step-btn:hover {
  background-color: var(--color-surface-sunken);
  color: var(--color-text-main);
}

.stage-step-btn.active {
  background-color: var(--color-primary-surface);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.stage-step-btn.active .step-num {
  background-color: var(--color-primary);
  color: #ffffff;
}

.progress-bar-container {
  height: 4px;
  background-color: var(--color-surface-sunken);
  border-radius: var(--radius-full);
  margin-top: 0.6rem;
  overflow: hidden;
}

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

/* --------------------------------------------------------------------------
   5. COMMON STAGE CARD ARCHITECTURE
   -------------------------------------------------------------------------- */
.stage-card {
  display: none;
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem 2.25rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
  animation: fadeIn 0.3s ease-in-out;
}

.stage-card.active {
  display: block;
}

@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;
  border-bottom: 2px solid var(--color-surface-sunken);
  padding-bottom: 1.25rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.stage-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.badge-stage {
  background-color: var(--color-primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.stage-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text-main);
}

.stage-time {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  font-weight: 600;
  background: var(--color-surface-sunken);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
}

.lead-text {
  font-size: 1.05rem;
  color: var(--color-text-muted);
  margin-bottom: 1.75rem;
}

.stage-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 2px solid var(--color-surface-sunken);
  padding-top: 1.5rem;
  margin-top: 2.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

/* --------------------------------------------------------------------------
   6. STAGE A: MISSION BRIEF STYLES
   -------------------------------------------------------------------------- */
.mission-banner {
  margin-bottom: 2rem;
}

.dilemma-card {
  background: linear-gradient(135deg, var(--color-secondary-surface) 0%, var(--color-primary-surface) 100%);
  border: 1px solid var(--color-secondary-light);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  position: relative;
}

.dilemma-badge {
  display: inline-block;
  background-color: var(--color-secondary);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}

.dilemma-card h3 {
  font-size: 1.35rem;
  color: var(--color-text-main);
  margin-bottom: 0.65rem;
}

.dilemma-comparison {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin: 1.25rem 0;
  flex-wrap: wrap;
}

.dilemma-box {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.5rem;
  text-align: center;
  min-width: 180px;
  box-shadow: var(--shadow-sm);
}

.dilemma-box.highlight {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15);
}

.dilemma-stat {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-primary);
}

.dilemma-desc {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.dilemma-arrow {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--color-secondary);
}

.dilemma-takeaway {
  background-color: var(--color-bg-card);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  border-left: 4px solid var(--color-primary);
}

.standards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.standard-item {
  background-color: var(--color-surface-sunken);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.std-badge {
  display: inline-block;
  background-color: var(--color-primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.725rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}

.standard-item h4 {
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
  color: var(--color-text-main);
}

.standard-item p {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

/* Decoder Card */
.decoder-card {
  background-color: var(--color-surface-sunken);
  border: 1px solid var(--color-border-heavy);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.decoder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.decoder-header h3 {
  font-size: 1.2rem;
  color: var(--color-text-main);
}

.decoder-tag {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.decoder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.decoder-col {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.symbol-token {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
  text-align: center;
}

.decoder-col p {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* --------------------------------------------------------------------------
   7. STAGE B: DISCOVERY LAB (BOYLE'S LAW & DUAL GRAPHS)
   -------------------------------------------------------------------------- */
.lab-workspace {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

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

.sim-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sim-header h4 {
  font-size: 1.15rem;
  color: var(--color-text-main);
}

.sim-status {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-secondary);
  background-color: var(--color-secondary-surface);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
}

.piston-chamber-wrapper {
  background-color: var(--color-surface-sunken);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.piston-svg {
  width: 100%;
  height: auto;
  display: block;
}

.control-panel {
  background-color: var(--color-surface-sunken);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.slider-row label {
  font-weight: 600;
  font-size: 0.95rem;
  min-width: 160px;
}

.slider-row input[type="range"] {
  flex: 1;
  min-width: 160px;
  cursor: pointer;
}

.value-badge {
  background-color: var(--color-primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.875rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  min-width: 75px;
  text-align: center;
}

.quick-preset-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.btn-preset {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition-fast);
}

.btn-preset:hover {
  background-color: var(--color-primary-surface);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.telemetry-card {
  background-color: var(--color-surface-sunken);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  text-align: center;
}

.telemetry-card.highlight-green {
  background-color: var(--color-success-surface);
  border-color: var(--color-success);
}

.telemetry-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 0.25rem;
}

.telemetry-val {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--color-text-main);
  font-family: var(--font-mono);
}

.highlight-blue {
  color: var(--color-secondary);
}

/* Dual Graphs */
.graphs-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.graph-box {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border-heavy);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.graph-box.highlight-box {
  border-color: var(--color-success);
}

.graph-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.graph-title-bar h5 {
  font-size: 0.95rem;
  color: var(--color-text-main);
}

.graph-tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  background-color: var(--color-surface-sunken);
  color: var(--color-text-muted);
}

.graph-box.highlight-box .graph-tag {
  background-color: var(--color-success-surface);
  color: var(--color-success);
}

.mini-graph-svg {
  width: 100%;
  height: 140px;
  display: block;
}

.graph-caption {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 0.4rem;
  text-align: center;
}

/* Discovery Check Card */
.discovery-check-card {
  background-color: var(--color-accent-surface);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.discovery-check-card h4 {
  font-size: 1.15rem;
  color: var(--color-text-main);
  margin-bottom: 1rem;
}

.check-question p {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.65rem;
}

.check-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.btn-check-opt {
  text-align: left;
  padding: 0.65rem 1rem;
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border-heavy);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-check-opt:hover {
  border-color: var(--color-primary);
  background-color: var(--color-primary-surface);
}

.btn-check-opt.selected-correct {
  background-color: var(--color-success-surface);
  border-color: var(--color-success);
  color: var(--color-success);
  font-weight: 700;
}

.btn-check-opt.selected-wrong {
  background-color: var(--color-error-surface);
  border-color: var(--color-error);
  color: var(--color-error);
}

.check-feedback {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
}

/* --------------------------------------------------------------------------
   8. STAGE C: WORKED EXAMPLES
   -------------------------------------------------------------------------- */
.example-container {
  background-color: var(--color-surface-sunken);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.75rem;
}

.example-title-strip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.ex-badge {
  background-color: var(--color-primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
}

.example-title-strip h3 {
  font-size: 1.25rem;
  color: var(--color-text-main);
}

.example-prompt {
  font-size: 1rem;
  margin-bottom: 1.25rem;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
  margin: 1rem 0;
}

.math-data-table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--color-bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  font-size: 0.9rem;
}

.math-data-table th, .math-data-table td {
  padding: 0.75rem 1rem;
  text-align: center;
  border: 1px solid var(--color-border-subtle);
}

.math-data-table th {
  background-color: var(--color-surface-sunken);
  font-weight: 700;
}

.highlight-row {
  background-color: var(--color-success-surface);
  font-weight: 700;
  color: var(--color-success);
}

/* Step Interactive Box */
.step-interactive-box {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border-heavy);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1rem;
}

.step-prompt {
  font-size: 0.95rem;
  margin-bottom: 0.85rem;
}

.step-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.btn-step-opt {
  text-align: left;
  padding: 0.65rem 1rem;
  background-color: var(--color-surface-sunken);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-step-opt:hover {
  background-color: var(--color-primary-surface);
  border-color: var(--color-primary);
}

.inline-calc-form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.input-inline-calc {
  width: 100px;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--color-border-heavy);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  text-align: center;
  font-family: var(--font-mono);
}

.step-explanation {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: var(--radius-md);
  background-color: var(--color-success-surface);
  border-left: 4px solid var(--color-success);
}

/* Method Toggle */
.method-toggle-container {
  margin-top: 1rem;
}

.method-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.btn-method-tab {
  padding: 0.5rem 1rem;
  background-color: var(--color-surface-sunken);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-method-tab.active {
  background-color: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

.method-card {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border-heavy);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.method-card.highlight-method {
  border-color: var(--color-secondary);
  background-color: var(--color-secondary-surface);
}

.method-list {
  padding-left: 1.5rem;
  margin: 0.75rem 0;
  font-size: 0.95rem;
}

.proportion-equation {
  font-size: 1.15rem;
  margin: 1rem 0;
  text-align: center;
}

/* Polya Steps */
.solution-walkthrough {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.polya-step {
  background-color: var(--color-bg-card);
  border-left: 4px solid var(--color-primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 1rem 1.25rem;
}

.polya-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-primary);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

/* --------------------------------------------------------------------------
   9. STAGE D & E: PRACTICE & CHALLENGE QUESTIONS
   -------------------------------------------------------------------------- */
.guided-list, .challenge-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.question-card {
  background-color: var(--color-surface-sunken);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: var(--transition-normal);
}

.question-card:hover {
  border-color: var(--color-border-heavy);
  box-shadow: var(--shadow-sm);
}

.q-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.q-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.q-ref-badge {
  background-color: var(--color-primary-surface);
  color: var(--color-primary);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

.q-diff-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

.diff-foundation {
  background-color: var(--color-success-surface);
  color: var(--color-success);
}

.diff-intermediate {
  background-color: var(--color-accent-surface);
  color: var(--color-accent);
}

.diff-advanced {
  background-color: var(--color-error-surface);
  color: var(--color-error);
}

.q-prompt {
  font-size: 1.05rem;
  margin-bottom: 1.25rem;
  color: var(--color-text-main);
}

.options-container {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.btn-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border-heavy);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  cursor: pointer;
  text-align: left;
  transition: var(--transition-fast);
}

.btn-option:hover {
  border-color: var(--color-primary);
  background-color: var(--color-primary-surface);
}

.btn-option.selected {
  border-color: var(--color-primary);
  background-color: var(--color-primary-surface);
  font-weight: 600;
}

.btn-option.correct {
  background-color: var(--color-success-surface);
  border-color: var(--color-success);
  color: var(--color-success);
  font-weight: 700;
}

.btn-option.incorrect {
  background-color: var(--color-error-surface);
  border-color: var(--color-error);
  color: var(--color-error);
}

.opt-prefix {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  background-color: var(--color-surface-sunken);
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

/* Hints System */
.hints-container {
  margin-top: 1rem;
}

.btn-hint-toggle {
  background: transparent;
  border: 1px dashed var(--color-primary);
  color: var(--color-primary);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

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

.hint-box {
  background-color: var(--color-accent-surface);
  border-left: 4px solid var(--color-accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 0.85rem 1.15rem;
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

.solution-box {
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border-heavy);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1rem;
}

/* Tier Filter Bar */
.tier-nav-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.tier-nav-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.btn-tier {
  background-color: var(--color-surface-sunken);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-full);
  padding: 0.4rem 0.85rem;
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-tier.active {
  background-color: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* --------------------------------------------------------------------------
   10. STAGE F: EXIT TICKET & LEARNING CERTIFICATE
   -------------------------------------------------------------------------- */
.exit-quiz-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.exit-submit-zone {
  text-align: center;
  margin: 2rem 0;
}

.btn-lg {
  padding: 0.85rem 2rem;
  font-size: 1.1rem;
}

/* Certificate */
.certificate-wrap {
  margin-top: 2rem;
  animation: fadeIn 0.4s ease-out;
}

.certificate-card {
  background-color: #ffffff;
  color: #1e293b;
  border: 12px double #312e81;
  border-radius: var(--radius-md);
  padding: 2.5rem;
  box-shadow: var(--shadow-xl);
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

.cert-border {
  position: relative;
}

.cert-header {
  text-align: center;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 1.25rem;
  margin-bottom: 1.75rem;
}

.cert-logo {
  font-size: 1.6rem;
  font-weight: 800;
  color: #312e81;
  letter-spacing: -0.02em;
}

.cert-kssm {
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  margin-top: 0.25rem;
}

.cert-body {
  text-align: center;
  margin-bottom: 2rem;
}

.cert-presented {
  font-size: 1rem;
  font-style: italic;
  color: #64748b;
}

.cert-student-name {
  font-size: 2.25rem;
  font-weight: 800;
  color: #1e1b4b;
  margin: 0.5rem 0;
  text-decoration: underline;
  text-decoration-color: #6366f1;
}

.cert-class {
  font-size: 1.1rem;
  font-weight: 600;
  color: #4338ca;
  margin-bottom: 1.25rem;
}

.cert-achievement {
  font-size: 1rem;
  color: #334155;
  margin-bottom: 0.4rem;
}

.cert-topic-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #312e81;
  margin-bottom: 1.75rem;
}

.cert-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}

.cert-metric-box {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 1rem;
}

.metric-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 0.35rem;
}

.metric-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
}

.cert-standards-covered {
  background-color: #f8fafc;
  border-radius: var(--radius-md);
  padding: 1rem 1.5rem;
  text-align: left;
  font-size: 0.85rem;
  color: #334155;
  margin-top: 1.25rem;
}

.cert-standards-covered ul {
  list-style: none;
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.cert-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 2px solid #e2e8f0;
  padding-top: 1.5rem;
  margin-top: 1.5rem;
}

.seal-circle {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 3px dashed #4338ca;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 800;
  font-size: 0.75rem;
  color: #4338ca;
  background-color: #eef2ff;
  line-height: 1.3;
}

.cert-signatures {
  display: flex;
  gap: 2rem;
}

.sig-line {
  display: flex;
  flex-direction: column;
  align-items: center;
  border-top: 1px solid #64748b;
  padding-top: 0.5rem;
  min-width: 160px;
}

.sig-text {
  font-weight: 700;
  font-size: 0.85rem;
  color: #1e293b;
}

.sig-line small {
  font-size: 0.7rem;
  color: #64748b;
}

.cert-action-bar {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   11. BUTTONS & GENERAL CONTROLS
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition-fast);
}

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

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

.btn-secondary {
  background-color: var(--color-surface-sunken);
  color: var(--color-text-main);
  border-color: var(--color-border-heavy);
}

.btn-secondary:hover {
  background-color: var(--color-border-subtle);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.hidden {
  display: none !important;
}

/* --------------------------------------------------------------------------
   12. STUDENT REGISTRATION MODAL
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 1rem;
}

.modal-card {
  background-color: var(--color-bg-card);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--color-border-subtle);
}

.modal-header h3 {
  font-size: 1.35rem;
  margin-bottom: 0.5rem;
  color: var(--color-text-main);
}

.modal-header p {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: 1.25rem;
}

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

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--color-text-main);
}

.form-group input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--color-border-heavy);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  background-color: var(--color-surface-sunken);
  color: var(--color-text-main);
}

.form-group input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* --------------------------------------------------------------------------
   13. CLASSROOM PRESENTER TOOLBAR (ENGLISH)
   -------------------------------------------------------------------------- */
.teaching-toolbar {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9995; /* Top-most floating toolbar */
  background-color: #1e1b4b;
  color: #ffffff;
  border: 1px solid #4338ca;
  border-radius: var(--radius-lg, 16px);
  padding: 0.6rem 0.85rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(99, 102, 241, 0.2);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  user-select: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.teaching-toolbar.collapsed .toolbar-tools {
  display: none;
}

.toolbar-drag-handle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: grab;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.toolbar-drag-dots {
  color: #818cf8;
  font-size: 0.9rem;
}

.toolbar-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #c7d2fe;
}

.btn-toolbar-minimize {
  background: transparent;
  border: none;
  color: #c7d2fe;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm, 6px);
}

.btn-toolbar-minimize:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

.toolbar-tools {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.tool-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md, 10px);
  color: #ffffff;
  cursor: pointer;
  transition: var(--transition-fast, 0.15s ease);
  padding: 0.2rem;
}

.tool-btn:hover {
  background-color: rgba(99, 102, 241, 0.35);
  border-color: #818cf8;
}

.tool-btn.active {
  background-color: #4f46e5;
  border-color: #a5b4fc;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.6);
}

.tool-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.tool-name {
  font-size: 0.65rem;
  font-weight: 600;
  margin-top: 0.2rem;
  color: #e0e7ff;
}

.tool-btn-action:hover, .btn-danger-action:hover {
  background-color: rgba(239, 68, 68, 0.4);
  border-color: #ef4444;
}

/* Pen Wrapper & Palette */
.tool-pen-wrapper {
  position: relative;
}

.color-palette-bar {
  display: none;
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #1e1b4b;
  border: 1px solid #4338ca;
  border-radius: var(--radius-full, 9999px);
  padding: 0.35rem 0.65rem;
  box-shadow: var(--shadow-lg, 0 10px 15px -3px rgba(0,0,0,0.2));
  align-items: center;
  gap: 0.4rem;
  z-index: 9998;
}

.tool-pen-wrapper:hover .color-palette-bar,
.tool-btn#btnToolPen.active ~ .color-palette-bar {
  display: flex;
}

.color-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.color-dot:hover {
  transform: scale(1.2);
}

.color-dot.active {
  border-color: #ffffff;
  box-shadow: 0 0 6px #ffffff;
}

.palette-divider, .toolbar-divider {
  width: 1px;
  height: 16px;
  background-color: rgba(255, 255, 255, 0.2);
}

.stroke-btn, .pen-size-toggle {
  background-color: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: var(--radius-sm, 6px);
  padding: 0.15rem 0.4rem;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   14. TEACHING CANVAS LAYER (ON TOP OF ZOOM MODAL FOR ACTIVE TEACHING)
   -------------------------------------------------------------------------- */
.teaching-layer {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9980; /* Sits ON TOP of .zoom-modal (9960) so drawing works in zoom view! */
  pointer-events: none;
}

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

#drawingCanvas {
  z-index: 9981;
}

#laserCanvas {
  z-index: 9982;
  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.mode-magnify {
  pointer-events: none;
}

body.tool-active-magnify {
  cursor: zoom-in !important;
}

body.tool-active-magnify .stage-card,
body.tool-active-magnify .example-container,
body.tool-active-magnify .question-card,
body.tool-active-magnify .graph-box,
body.tool-active-magnify .simulation-box,
body.tool-active-magnify .dilemma-card {
  outline: 2px dashed #4f46e5;
  outline-offset: 4px;
  cursor: zoom-in !important;
  transition: transform 0.15s ease, outline-color 0.15s ease;
}

body.tool-active-magnify .stage-card:hover,
body.tool-active-magnify .example-container:hover,
body.tool-active-magnify .question-card:hover,
body.tool-active-magnify .graph-box:hover,
body.tool-active-magnify .simulation-box:hover,
body.tool-active-magnify .dilemma-card:hover {
  outline-color: #ef4444;
  outline-width: 3px;
  transform: scale(1.008);
}

/* --------------------------------------------------------------------------
   15. ADVANCED ZOOM SPOTLIGHT (PROPORTIONAL SCALING, DRAG-TO-PAN & TOOLBAR)
   -------------------------------------------------------------------------- */
.zoom-modal {
  position: fixed;
  inset: 0;
  z-index: 9960; /* Lower than teaching-layer (9980) and toolbar (9995) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.zoom-modal.hidden {
  display: none !important;
}

.zoom-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.zoom-dialog {
  position: relative;
  z-index: 9965;
  background-color: var(--color-bg-card, #ffffff);
  border: 2px solid var(--color-primary, #4f46e5);
  border-radius: var(--radius-lg, 16px);
  max-width: 96vw;
  width: 1060px;
  height: 86vh;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(99, 102, 241, 0.3);
  overflow: hidden;
  animation: zoomPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes zoomPop {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.zoom-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 1.25rem;
  background-color: #1e1b4b;
  color: #ffffff;
  border-bottom: 1px solid #4338ca;
  flex-wrap: wrap;
  gap: 0.65rem;
  z-index: 10;
}

.zoom-header-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.zoom-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #e0e7ff;
}

.zoom-hint-badge {
  font-size: 0.72rem;
  font-weight: 600;
  background-color: rgba(99, 102, 241, 0.3);
  color: #c7d2fe;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  border: 1px solid rgba(129, 140, 248, 0.35);
  letter-spacing: 0.02em;
}

/* Modal Mini Teaching Tools */
.modal-teaching-tools {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background-color: rgba(255, 255, 255, 0.08);
  padding: 0.2rem 0.4rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.modal-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.55rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #e0e7ff;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.modal-tool-btn:hover {
  background-color: rgba(99, 102, 241, 0.35);
}

.modal-tool-btn.active {
  background-color: #4f46e5;
  border-color: #818cf8;
  color: #ffffff;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.6);
}

.modal-tool-btn.btn-clear-ink:hover {
  background-color: rgba(239, 68, 68, 0.4);
}

/* Zoom Controls */
.zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.btn-zoom-ctrl {
  background-color: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn-zoom-ctrl:hover {
  background-color: #4f46e5;
}

#zoomLevelDisplay {
  font-size: 0.85rem;
  font-weight: 800;
  min-width: 50px;
  text-align: center;
  color: #a5b4fc;
}

.btn-zoom-close {
  background-color: #ef4444;
  border: none;
  color: #fff;
  border-radius: 6px;
  padding: 0.25rem 0.65rem;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  margin-left: 0.4rem;
  transition: background-color 0.15s ease;
}

.btn-zoom-close:hover {
  background-color: #dc2626;
}

/* Zoom Dialog Body with Drag-to-Pan */
.zoom-dialog-body {
  position: relative;
  flex: 1;
  padding: 2.5rem;
  overflow: hidden;
  background-color: var(--color-bg-base, #f8fafc);
  cursor: grab;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.zoom-dialog-body.is-panning {
  cursor: grabbing !important;
  user-select: none;
}

/* Proportional Vector Zoom Container */
.zoom-target-container {
  transform-origin: 0 0;
  width: 100%;
  transition: transform 0.04s ease-out;
  will-change: transform;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

.zoom-target-container svg {
  shape-rendering: geometricPrecision;
}

.zoom-target-container .katex {
  text-rendering: geometricPrecision;
}

.zoom-dialog-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1.25rem;
  background-color: var(--color-surface-sunken, #f1f5f9);
  border-top: 1px solid var(--color-border-subtle, #e2e8f0);
  font-size: 0.8rem;
  color: var(--color-text-muted, #64748b);
  z-index: 10;
}

.zoom-footer-right kbd {
  background-color: rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  font-size: 0.75rem;
  font-family: inherit;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   16. PRINT STYLESHEET (@media print)
   -------------------------------------------------------------------------- */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 12pt;
  }

  .app-header,
  .stage-nav,
  .stage-footer,
  .teaching-toolbar,
  .teaching-layer,
  .zoom-modal,
  .tool-toast,
  .cert-action-bar,
  .exit-quiz-container,
  .exit-submit-zone,
  .btn,
  #stageA, #stageB, #stageC, #stageD, #stageE {
    display: none !important;
  }

  .app-container {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .stage-card {
    display: block !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .certificate-wrap {
    margin: 0 !important;
    display: block !important;
  }

  .certificate-card {
    border: 8px double #1e1b4b !important;
    box-shadow: none !important;
    page-break-inside: avoid;
    padding: 1.5rem !important;
    margin: 0 auto !important;
  }
}

/* --------------------------------------------------------------------------
   17. RESPONSIVE BREAKPOINTS
   -------------------------------------------------------------------------- */
@media (max-width: 992px) {
  .lab-workspace {
    grid-template-columns: 1fr;
  }
  .telemetry-grid {
    grid-template-columns: 1fr;
  }
  .cert-metrics-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .nav-track {
    grid-template-columns: repeat(3, 1fr);
  }
  .app-container {
    padding: 0.75rem;
  }
  .stage-card {
    padding: 1.25rem 1rem;
  }
  .dilemma-comparison {
    flex-direction: column;
  }
}

/* ========================================================================== */
/* WIRELESS REMOTE CONTROLLER & WEBRTC SYNC ENGINE STYLES (METHOD 3)          */
/* ========================================================================== */

/* Toolbar Remote Button & Connected Badge */
.btn-remote-ctrl {
  position: relative;
}

.remote-badge-dot {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
  transition: all 0.3s ease;
}

.remote-badge-dot.connected {
  background: #10b981;
  box-shadow: 0 0 8px #10b981, 0 0 14px rgba(16, 185, 129, 0.6);
  animation: remotePulse 2s infinite ease-in-out;
}

@keyframes remotePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

/* Remote Pairing Modal (Host Screen) */
.remote-pair-modal {
  position: fixed;
  inset: 0;
  z-index: 10010;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  pointer-events: auto !important;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.remote-pair-modal.hidden {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.remote-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(8px);
  z-index: 1;
  pointer-events: auto !important;
  cursor: pointer;
}

.remote-modal-card {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 580px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 20px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
  color: #f8fafc;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  pointer-events: auto !important;
}

.remote-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: #0f172a;
  border-bottom: 1px solid #334155;
}

.remote-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.remote-header-icon {
  font-size: 1.8rem;
  background: #1e293b;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid #334155;
}

.remote-modal-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 750;
  color: #ffffff;
}

.remote-modal-desc {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: #94a3b8;
}

.btn-remote-close {
  position: relative;
  z-index: 10;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f8fafc;
  font-size: 1.4rem;
  cursor: pointer !important;
  pointer-events: auto !important;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.btn-remote-close:hover,
.btn-remote-close:active {
  background: #dc2626 !important;
  border-color: #ef4444 !important;
  color: #ffffff !important;
  transform: scale(1.08);
}

.btn-modal-done {
  background: #2563eb;
  color: #ffffff;
  border: 1px solid #60a5fa;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer !important;
  pointer-events: auto !important;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-modal-done:hover,
.btn-modal-done:active {
  background: #1d4ed8;
  transform: scale(1.03);
}

.remote-modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.remote-qr-section {
  display: flex;
  gap: 24px;
  align-items: center;
  background: #0f172a;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid #334155;
}

@media (max-width: 600px) {
  .remote-qr-section {
    flex-direction: column;
    text-align: center;
  }
}

.qrcode-wrapper {
  background: #ffffff;
  padding: 12px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  min-width: 170px;
  min-height: 170px;
}

.qrcode-wrapper img,
.qrcode-wrapper canvas {
  display: block;
  max-width: 100%;
}

.remote-qr-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.qr-step-chip {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #2563eb;
  color: #ffffff;
  padding: 3px 10px;
  border-radius: 999px;
}

.qr-instruction-text {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #cbd5e1;
}

.room-code-tag {
  font-size: 0.95rem;
  color: #94a3b8;
  background: #1e293b;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #334155;
  display: inline-block;
}

.room-code-tag strong {
  color: #38bdf8;
  font-size: 1.15rem;
  letter-spacing: 0.06em;
  font-family: monospace;
}

.remote-url-copy-box {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.remote-url-copy-box input {
  flex: 1;
  min-width: 120px;
  background: #1e293b;
  border: 1px solid #334155;
  color: #94a3b8;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.76rem;
  font-family: monospace;
}

.btn-copy-remote-url,
.btn-test-remote-tab {
  background: #334155;
  color: #f8fafc;
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-copy-remote-url:hover,
.btn-test-remote-tab:hover {
  background: #2563eb;
  color: #ffffff;
}

.remote-status-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #0f172a;
  padding: 12px 18px;
  border-radius: 12px;
  border: 1px solid #334155;
}

.remote-status-pulse {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.remote-status-pulse.waiting {
  background: #f59e0b;
  box-shadow: 0 0 10px #f59e0b;
  animation: remotePulse 1.6s infinite ease-in-out;
}

.remote-status-pulse.connected {
  background: #10b981;
  box-shadow: 0 0 12px #10b981;
  animation: remotePulse 2s infinite ease-in-out;
}

.remote-status-msg {
  font-size: 0.88rem;
  font-weight: 600;
  color: #e2e8f0;
}

.remote-modal-footer {
  padding: 14px 24px;
  background: #0f172a;
  border-top: 1px solid #334155;
}

.footer-tip {
  font-size: 0.78rem;
  color: #94a3b8;
  line-height: 1.4;
}

/* ========================================================================== */
/* DEDICATED TEACHER MOBILE REMOTE CONTROLLER UI (TABLET VIEW)                */
/* ========================================================================== */
.teacher-remote-view {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: #090d16;
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.teacher-remote-view.hidden {
  display: none !important;
}

.remote-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
  height: 54px;
  flex-shrink: 0;
}

.remote-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.remote-brand-icon {
  font-size: 1.4rem;
}

.remote-brand-name {
  font-size: 0.95rem;
  font-weight: 750;
  color: #ffffff;
  display: block;
}

.remote-stage-pill {
  font-size: 0.72rem;
  color: #38bdf8;
  font-weight: 600;
}

.remote-conn-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1e293b;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid #334155;
}

.remote-conn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
}

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

.remote-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 8px;
  gap: 8px;
}

/* Tool Selection Strip */
.remote-tool-strip {
  display: flex;
  gap: 6px;
  background: #0f172a;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid #1e293b;
  overflow-x: auto;
  flex-shrink: 0;
}

.remote-tool-btn {
  flex: 1;
  min-width: 52px;
  min-height: 48px;
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.remote-tool-btn:active {
  transform: scale(0.96);
}

.remote-tool-btn.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #60a5fa;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.5);
}

.remote-tool-btn.btn-danger-remote:active {
  background: #dc2626;
  color: #ffffff;
}

.remote-tool-btn.btn-zoom-remote.active {
  background: #7c3aed;
  border-color: #a78bfa;
}

.r-icon {
  font-size: 1.15rem;
}

.r-label {
  font-size: 0.68rem;
  font-weight: 700;
}

/* Pen Palette Bar */
.remote-pen-palette {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0f172a;
  padding: 6px 14px;
  border-radius: 12px;
  border: 1px solid #1e293b;
  flex-shrink: 0;
}

.remote-pen-palette.hidden {
  display: none;
}

.remote-colors {
  display: flex;
  gap: 12px;
  align-items: center;
}

.r-color-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: all 0.15s ease;
}

.r-color-dot.active {
  transform: scale(1.22);
  border-color: #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
}

.remote-width-toggle {
  display: flex;
  gap: 6px;
}

.r-width-btn {
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

.r-width-btn.active {
  background: #2563eb;
  color: #ffffff;
  border-color: #3b82f6;
}

/* Interactive Touch / Stylus Pad */
.remote-pad-container {
  flex: 1;
  position: relative;
  background: #0d131f;
  border: 2px solid #1e293b;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.6);
}

.remote-pad-badge {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 5;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.remote-pad-canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* Stage Navigation Strip */
.remote-stage-switcher {
  background: #0f172a;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid #1e293b;
  flex-shrink: 0;
}

.remote-stage-title {
  font-size: 0.68rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.remote-stage-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}

@media (max-width: 600px) {
  .remote-stage-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.r-stage-btn {
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 8px 4px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.r-stage-btn:active {
  transform: scale(0.96);
}

.r-stage-btn.active {
  background: #059669;
  color: #ffffff;
  border-color: #34d399;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

/* Remote Zoom Bar */
.remote-zoom-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0f172a;
  padding: 6px 12px;
  border-radius: 12px;
  border: 1px solid #1e293b;
  flex-shrink: 0;
}

.r-zoom-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
  margin-right: auto;
}

.r-zoom-btn {
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

.r-zoom-btn:active {
  transform: scale(0.95);
}

.r-zoom-btn.btn-danger-sm {
  background: #7f1d1d;
  border-color: #dc2626;
  color: #fecaca;
}
