/* =========================================================
   Teach Mode — Stylesheet
   Whiteboard + camera + recording overlay for self-teaching.

   Design language: floating glass panels, purple accent,
   smooth spring easing, camera-app-grade recording chrome.

   IMPORTANT: This file must work on pages that do NOT load
   micro.css (e.g. policy-gradients.html with custom styles).
   All var() calls include fallback values for standalone use.
   ========================================================= */

/* ── Token Fallbacks (for pages without micro.css) ─────── */
/* Reads from :root if micro.css defined them; otherwise uses hardcoded fallbacks. */
.teach-overlay,
.teach-entry-pill,
.teach-toast {
  --t-bg: var(--bg, #0b0d14);
  --t-bg2: var(--bg2, #10131c);
  --t-bg3: var(--bg3, #1c2130);
  --t-surface: var(--surface, #161a26);
  --t-text: var(--text, #e2ddd5);
  --t-text2: var(--text2, #a9a196);
  --t-text3: var(--text3, #6b6560);
  --t-text4: var(--text4, #4a453f);
  --t-border: var(--border, #232939);
  --t-border2: var(--border2, #2d3548);
  --t-warm: var(--warm, #e8a87c);
  --t-teal: var(--teal, #5cc9b5);
  --t-purple: var(--purple, #b07aff);
  --t-blue: var(--blue, #6b9eff);
  --t-green: var(--green, #5ce88e);
  --t-red: var(--red, #e86a6a);
  --t-yellow: var(--yellow, #e8d06a);
  --t-pink: var(--pink, #e87aaa);
}

/* ── Overlay ──────────────────────────────────────────────── */
.teach-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--t-bg);
  display: none;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.teach-overlay.open { display: flex; }
.teach-overlay.visible { opacity: 1; }

/* Hide everything else when teach overlay is open */
body.teach-active > *:not(.teach-overlay):not(.teach-toast) {
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Entrance animation for children */
.teach-overlay.visible .teach-topbar,
.teach-overlay.visible .teach-bottombar {
  animation: teach-slide-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.teach-overlay.visible .teach-workspace {
  animation: teach-fade-scale 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}

@keyframes teach-slide-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes teach-fade-scale {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

/* ── Top Bar ──────────────────────────────────────────────── */
.teach-topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.55rem 1.2rem;
  background: linear-gradient(180deg, var(--t-bg2), transparent);
  border-bottom: 1px solid var(--t-border);
  min-height: 50px;
  flex-shrink: 0;
  position: relative;
  z-index: 15;
}
.teach-topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}
.teach-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* Question badge — pill with subtle glow */
.teach-q-badge {
  font-family: var(--font-mono, 'IBM Plex Mono', monospace);
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--t-purple);
  background: rgba(176, 122, 255, 0.1);
  border: 1px solid rgba(176, 122, 255, 0.2);
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.3s;
}

/* Question title in topbar */
.teach-q-text {
  font-family: var(--font-display, 'Fraunces', serif);
  font-style: italic;
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--t-text);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s;
}
.teach-q-text:hover { color: var(--t-purple); }

/* Expand chevron — toggles question panel */
.teach-q-expand {
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  color: var(--t-text3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  flex-shrink: 0;
  padding: 0;
  border-radius: 4px;
}
.teach-q-expand:hover { color: var(--t-purple); background: rgba(176, 122, 255, 0.08); }
.teach-q-expand svg { width: 14px; height: 14px; transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1); }
.teach-q-expand.rotated svg { transform: rotate(180deg); }

/* Progress dots */
.teach-progress {
  display: flex;
  gap: 5px;
  align-items: center;
  flex-shrink: 0;
}
.teach-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--t-bg3);
  border: 1.5px solid var(--t-border2);
  transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.teach-dot.done {
  background: var(--t-green);
  border-color: var(--t-green);
  box-shadow: 0 0 6px rgba(92, 232, 142, 0.3);
}
.teach-dot.active {
  background: var(--t-purple);
  border-color: var(--t-purple);
  transform: scale(1.45);
  box-shadow: 0 0 8px rgba(176, 122, 255, 0.4);
}
.teach-dot.skipped {
  background: var(--t-text4);
  border-color: var(--t-text4);
  opacity: 0.6;
}

/* Close button */
.teach-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--t-border);
  background: var(--t-surface);
  color: var(--t-text3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  line-height: 1;
  transition: all 0.2s;
  flex-shrink: 0;
}
.teach-close:hover {
  border-color: var(--t-red);
  color: var(--t-red);
  background: rgba(232, 106, 106, 0.08);
  transform: scale(1.08);
}

/* ── Workspace ────────────────────────────────────────────── */
.teach-workspace {
  flex: 1;
  display: grid;
  overflow: hidden;
  position: relative;
  transition: grid-template-columns 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.teach-workspace[data-layout="half"] {
  grid-template-columns: 1fr 1fr;
  gap: 1px;
}
.teach-workspace[data-layout="pip"],
.teach-workspace[data-layout="canvas-only"],
.teach-workspace[data-layout="camera-only"] {
  grid-template-columns: 1fr;
}

/* Whiteboard wrap */
.teach-canvas-wrap {
  position: relative;
  background: var(--t-bg);
  overflow: hidden;
  min-height: 0;
}
.teach-workspace[data-layout="camera-only"] .teach-canvas-wrap { display: none; }

/* Whiteboard canvas */
.teach-whiteboard {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

/* Subtle grid overlay on the whiteboard for spatial reference */
.teach-canvas-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: 1;
}
[data-theme="light"] .teach-canvas-wrap::after {
  background-image:
    linear-gradient(rgba(0,0,0,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,0.03) 1px, transparent 1px);
}

/* Camera container */
.teach-camera {
  position: relative;
  background: var(--t-bg2);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.teach-camera video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scaleX(-1);
  transition: filter 0.3s;
}
.teach-camera.blur-self video {
  filter: blur(14px) saturate(0.7);
}
.teach-workspace[data-layout="canvas-only"] .teach-camera { display: none; }

/* Half layout camera gets a subtle left border */
.teach-workspace[data-layout="half"] .teach-camera {
  border-left: 1px solid var(--t-border);
}

/* PiP camera — floating glass bubble */
.teach-workspace[data-layout="pip"] .teach-camera {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 200px;
  height: 150px;
  border-radius: 16px;
  border: 2px solid rgba(255,255,255,0.08);
  box-shadow:
    0 8px 32px rgba(0,0,0,0.5),
    0 0 0 1px rgba(255,255,255,0.04) inset;
  z-index: 5;
  cursor: grab;
  backdrop-filter: blur(2px);
  /* Exclude position from transitions so drag isn't animated */
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
}
.teach-workspace[data-layout="pip"] .teach-camera:hover {
  box-shadow:
    0 12px 44px rgba(0,0,0,0.6),
    0 0 0 1px rgba(255,255,255,0.06) inset;
  border-color: rgba(176, 122, 255, 0.25);
}
.teach-workspace[data-layout="pip"] .teach-camera.dragging {
  cursor: grabbing;
  box-shadow:
    0 20px 56px rgba(0,0,0,0.7),
    0 0 0 1px rgba(176, 122, 255, 0.15) inset;
  transform: scale(1.02);
}
.teach-workspace[data-layout="pip"] .teach-camera video {
  border-radius: 14px;
}

/* Camera off placeholder */
.teach-camera-off {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  color: var(--t-text4);
  font-family: var(--font-mono, 'IBM Plex Mono', monospace);
  font-size: 0.7rem;
  text-align: center;
  padding: 1rem;
  letter-spacing: 0.04em;
}
.teach-camera-off svg { opacity: 0.2; width: 28px; height: 28px; }

/* ── Toolbar (floating glass pill) ────────────────────────── */
.teach-toolbar {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px 10px;
  background: rgba(16, 19, 28, 0.85);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  box-shadow:
    0 4px 24px rgba(0,0,0,0.4),
    0 0 0 1px rgba(255,255,255,0.03) inset;
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
}
[data-theme="light"] .teach-toolbar {
  background: rgba(245, 240, 232, 0.88);
  border-color: rgba(0,0,0,0.08);
  box-shadow: 0 4px 24px rgba(0,0,0,0.1), 0 0 0 1px rgba(0,0,0,0.04) inset;
}

.teach-toolbar-sep {
  width: 1px;
  height: 18px;
  background: rgba(255,255,255,0.08);
  margin: 0 4px;
  flex-shrink: 0;
}
[data-theme="light"] .teach-toolbar-sep { background: rgba(0,0,0,0.08); }

/* Tool button */
.teach-tool {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1.5px solid transparent;
  background: transparent;
  color: var(--t-text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s cubic-bezier(0.22, 1, 0.36, 1);
  padding: 0;
  flex-shrink: 0;
}
.teach-tool:hover {
  background: rgba(255,255,255,0.06);
  color: var(--t-text);
  transform: translateY(-1px);
}
[data-theme="light"] .teach-tool:hover { background: rgba(0,0,0,0.05); }
.teach-tool.active {
  background: rgba(176, 122, 255, 0.15);
  border-color: rgba(176, 122, 255, 0.5);
  color: var(--t-purple);
  box-shadow: 0 0 8px rgba(176, 122, 255, 0.15);
}
.teach-tool svg { width: 15px; height: 15px; }

/* Color swatches */
.teach-colors {
  display: flex;
  gap: 3px;
  align-items: center;
}
.teach-color-swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  padding: 0;
  outline: none;
  flex-shrink: 0;
}
.teach-color-swatch:hover { transform: scale(1.25); }
.teach-color-swatch.active {
  border-color: var(--t-text);
  transform: scale(1.25);
  box-shadow: 0 0 6px rgba(255,255,255,0.15);
}

/* Brush size slider */
.teach-size-slider {
  width: 52px;
  height: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  outline: none;
  flex-shrink: 0;
}
[data-theme="light"] .teach-size-slider { background: rgba(0,0,0,0.1); }
.teach-size-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--t-purple);
  cursor: pointer;
  box-shadow: 0 0 4px rgba(176, 122, 255, 0.4);
}
.teach-size-slider::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--t-purple);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 4px rgba(176, 122, 255, 0.4);
}

/* ── Bottom Bar ───────────────────────────────────────────── */
.teach-bottombar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1.2rem;
  background: linear-gradient(0deg, var(--t-bg2), transparent);
  border-top: 1px solid var(--t-border);
  flex-shrink: 0;
  position: relative;
  z-index: 15;
}
.teach-bottombar-left,
.teach-bottombar-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
}
.teach-bottombar-right { justify-content: flex-end; }
.teach-bottombar-center {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* ── Record Button — camera-app grade ─────────────────────── */
.teach-rec-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3px solid var(--t-red);
  background: transparent;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  flex-shrink: 0;
}
.teach-rec-btn::after {
  content: '';
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--t-red);
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.teach-rec-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 0 20px rgba(232, 106, 106, 0.2);
}
.teach-rec-btn:active { transform: scale(0.95); }

/* Recording state — circle morphs to rounded square */
.teach-rec-btn.recording {
  border-color: rgba(232, 106, 106, 0.6);
  animation: teach-pulse 2s ease-in-out infinite;
}
.teach-rec-btn.recording::after {
  border-radius: 5px;
  width: 18px;
  height: 18px;
}
.teach-rec-btn.recording:hover {
  box-shadow: 0 0 24px rgba(232, 106, 106, 0.3);
}

@keyframes teach-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 106, 106, 0.35); }
  50% { box-shadow: 0 0 0 12px rgba(232, 106, 106, 0); }
}

/* Timer */
.teach-timer {
  font-family: var(--font-mono, 'IBM Plex Mono', monospace);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--t-text3);
  min-width: 48px;
  text-align: center;
  letter-spacing: 0.06em;
  transition: color 0.3s;
  user-select: none;
}
.teach-timer.recording {
  color: var(--t-red);
  animation: teach-timer-blink 1s ease-in-out infinite;
}
@keyframes teach-timer-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Layout switcher — segmented control */
.teach-layout-btns {
  display: flex;
  gap: 1px;
  background: var(--t-bg3);
  border-radius: 8px;
  padding: 3px;
  border: 1px solid var(--t-border);
}
.teach-layout-btn {
  width: 28px;
  height: 26px;
  border-radius: 5px;
  border: none;
  background: transparent;
  color: var(--t-text4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  padding: 0;
}
.teach-layout-btn:hover { color: var(--t-text2); }
.teach-layout-btn.active {
  background: var(--t-surface);
  color: var(--t-purple);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.teach-layout-btn svg { width: 13px; height: 13px; }

/* Small UI buttons (camera, blur, skip, hint) */
.teach-cam-toggle,
.teach-blur-btn,
.teach-skip-btn,
.teach-hint-btn {
  font-family: var(--font-mono, 'IBM Plex Mono', monospace);
  font-weight: 500;
  padding: 0.28rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--t-border);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  line-height: 1;
}

.teach-cam-toggle {
  font-size: 0.68rem;
  color: var(--t-text3);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.teach-cam-toggle svg { width: 12px; height: 12px; }
.teach-cam-toggle:hover { border-color: var(--t-teal); color: var(--t-teal); }
.teach-cam-toggle.active {
  background: var(--t-teal);
  color: #fff;
  border-color: var(--t-teal);
  box-shadow: 0 0 10px rgba(92, 201, 181, 0.2);
}

.teach-blur-btn {
  font-size: 0.6rem;
  color: var(--t-text4);
  letter-spacing: 0.04em;
}
.teach-blur-btn:hover { border-color: var(--t-text3); color: var(--t-text3); }
.teach-blur-btn.active {
  background: rgba(92, 201, 181, 0.12);
  border-color: var(--t-teal);
  color: var(--t-teal);
}

.teach-skip-btn {
  font-size: 0.68rem;
  color: var(--t-text3);
}
.teach-skip-btn:hover { border-color: var(--t-text2); color: var(--t-text2); }

.teach-export-btn {
  font-family: var(--font-mono, 'IBM Plex Mono', monospace);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.28rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--t-purple);
  background: rgba(176, 122, 255, 0.1);
  color: var(--t-purple);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.teach-export-btn:hover {
  background: var(--t-purple);
  color: #fff;
  box-shadow: 0 0 10px rgba(176, 122, 255, 0.2);
}

.teach-hint-btn {
  font-size: 0.68rem;
  color: var(--t-text4);
}
.teach-hint-btn:hover { border-color: var(--t-yellow); color: var(--t-yellow); }
.teach-hint-btn.active {
  background: rgba(232, 208, 106, 0.12);
  border-color: var(--t-yellow);
  color: var(--t-yellow);
}

/* ── Question Expanded Panel (drops down from topbar) ─────── */
.teach-q-panel {
  position: absolute;
  top: 50px;
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--t-bg2);
  border-bottom: 1px solid var(--t-border);
  padding: 1.75rem 2.5rem;
  transform: translateY(-110%);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}
.teach-q-panel.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.teach-q-panel-title {
  font-family: var(--font-heading, 'Outfit', sans-serif);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--t-purple);
  margin-bottom: 0.65rem;
}
.teach-q-panel-prompt {
  font-family: var(--font-display, 'Fraunces', serif);
  font-style: italic;
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--t-text);
  line-height: 1.65;
  max-width: 640px;
}
.teach-q-panel-hint {
  margin-top: 0.9rem;
  font-family: var(--font-body, 'Crimson Pro', serif);
  font-size: 0.88rem;
  color: var(--t-text3);
  font-style: italic;
  line-height: 1.5;
}
.teach-q-panel-hint::before {
  content: '💡 ';
  font-style: normal;
}

/* ── Review Panel ─────────────────────────────────────────── */
.teach-review {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: var(--t-bg);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.75rem;
  padding: 2.5rem;
}
.teach-review.open {
  display: flex;
  animation: teach-fade-scale 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.teach-review-label {
  font-family: var(--font-mono, 'IBM Plex Mono', monospace);
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--t-text3);
}

.teach-review video {
  max-width: 100%;
  max-height: 55vh;
  border-radius: 16px;
  border: 1px solid var(--t-border);
  background: #000;
  box-shadow: 0 12px 48px rgba(0,0,0,0.4);
}
.teach-review-actions {
  display: flex;
  gap: 0.65rem;
  align-items: center;
}

/* Shared button style for review + export */
.teach-review-btn {
  font-family: var(--font-mono, 'IBM Plex Mono', monospace);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.55rem 1.3rem;
  border-radius: 9px;
  border: 1px solid var(--t-border);
  background: var(--t-surface);
  color: var(--t-text2);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  letter-spacing: 0.02em;
}
.teach-review-btn:hover {
  border-color: var(--t-text3);
  color: var(--t-text);
  transform: translateY(-1px);
}
.teach-review-btn:active { transform: translateY(0); }
.teach-review-btn.primary {
  background: linear-gradient(135deg, var(--t-purple), #9362e0);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 16px rgba(176, 122, 255, 0.25);
}
.teach-review-btn.primary:hover {
  box-shadow: 0 6px 24px rgba(176, 122, 255, 0.35);
  transform: translateY(-2px);
}
.teach-review-btn.danger { color: var(--t-red); }
.teach-review-btn.danger:hover { border-color: var(--t-red); color: var(--t-red); }

/* ── Export Panel ─────────────────────────────────────────── */
.teach-export {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: var(--t-bg);
  display: none;
  flex-direction: column;
  padding: 2.5rem 2rem;
  overflow-y: auto;
}
.teach-export.open {
  display: flex;
  animation: teach-fade-scale 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.teach-export-header {
  text-align: center;
  margin-bottom: 2rem;
}
.teach-export-title {
  font-family: var(--font-display, 'Fraunces', serif);
  font-style: italic;
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--t-text);
  margin-bottom: 0.4rem;
}
.teach-export-sub {
  font-family: var(--font-body, 'Crimson Pro', serif);
  font-size: 0.92rem;
  color: var(--t-text2);
}

.teach-export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  max-width: 880px;
  margin: 0 auto 2rem;
  width: 100%;
}

.teach-export-card {
  background: var(--t-surface);
  border: 1.5px solid var(--t-border);
  border-radius: 14px;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
}
.teach-export-card:hover {
  border-color: var(--t-border2);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.teach-export-card.selected {
  border-color: var(--t-purple);
  box-shadow: 0 0 0 1px var(--t-purple), 0 8px 24px rgba(176, 122, 255, 0.15);
}

.teach-export-card-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  background: var(--t-bg);
  cursor: pointer;
}
.teach-export-card-body { padding: 0.7rem 0.85rem; }
.teach-export-card-q {
  font-family: var(--font-mono, 'IBM Plex Mono', monospace);
  font-size: 0.58rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--t-purple);
  margin-bottom: 0.2rem;
}
.teach-export-card-title {
  font-family: var(--font-body, 'Crimson Pro', serif);
  font-size: 0.82rem;
  color: var(--t-text2);
  line-height: 1.35;
}

/* Checkmark circle */
.teach-export-card-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  color: transparent;
  backdrop-filter: blur(4px);
}
.teach-export-card-check svg { width: 12px; height: 12px; }
.teach-export-card.selected .teach-export-card-check {
  background: var(--t-purple);
  border-color: var(--t-purple);
  color: #fff;
  box-shadow: 0 2px 8px rgba(176, 122, 255, 0.4);
  transform: scale(1.05);
}

/* Duration tag */
.teach-export-card-duration {
  position: absolute;
  bottom: calc(0.7rem + 2.5em + 8px); /* above body */
  right: 8px;
  font-family: var(--font-mono, 'IBM Plex Mono', monospace);
  font-size: 0.55rem;
  font-weight: 600;
  background: rgba(0,0,0,0.65);
  color: rgba(255,255,255,0.9);
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.05em;
  backdrop-filter: blur(4px);
}

/* Download mini-button */
.teach-export-card-dl {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.35);
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  padding: 0;
  backdrop-filter: blur(4px);
}
.teach-export-card-dl svg { width: 11px; height: 11px; }
.teach-export-card-dl:hover { background: var(--t-purple); color: #fff; transform: scale(1.1); }

/* Re-record button on export card */
.teach-export-card-rerecord {
  position: absolute;
  top: 8px;
  left: 36px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.35);
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  padding: 0;
  backdrop-filter: blur(4px);
}
.teach-export-card-rerecord svg { width: 11px; height: 11px; }
.teach-export-card-rerecord:hover { background: var(--t-warm); color: #fff; transform: scale(1.1); }

.teach-export-actions {
  display: flex;
  gap: 0.65rem;
  justify-content: center;
  align-items: center;
  margin-top: auto;
  padding-top: 1.5rem;
}

/* Combine progress */
.teach-combine-progress {
  width: 100%;
  max-width: 360px;
  margin: 1rem auto;
  text-align: center;
}
.teach-combine-bar {
  width: 100%;
  height: 3px;
  background: var(--t-bg3);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.teach-combine-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--t-purple), var(--t-blue));
  border-radius: 2px;
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  width: 0%;
}
.teach-combine-label {
  font-family: var(--font-mono, 'IBM Plex Mono', monospace);
  font-size: 0.65rem;
  color: var(--t-text4);
  letter-spacing: 0.04em;
}

/* ── Entry Points ─────────────────────────────────────────── */
/* Nav tab */
.nav button[data-t="teach"] { color: var(--t-purple); }
.nav button[data-t="teach"] .n { background: var(--t-purple); }
.nav button[data-t="teach"].on { color: var(--t-purple); border-color: var(--t-purple); }

/* Footer pill — gradient glass with glow */
.teach-entry-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.6rem;
  margin: 2.5rem auto 1rem;
  font-family: var(--font-heading, 'Outfit', sans-serif);
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--t-purple) 0%, #8b5cf6 50%, var(--t-blue) 100%);
  background-size: 200% 200%;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow:
    0 4px 20px rgba(176, 122, 255, 0.25),
    0 0 0 1px rgba(255,255,255,0.1) inset;
  letter-spacing: 0.02em;
  animation: teach-pill-shimmer 3s ease infinite;
}
@keyframes teach-pill-shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.teach-entry-pill:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    0 8px 32px rgba(176, 122, 255, 0.35),
    0 0 0 1px rgba(255,255,255,0.15) inset;
}
.teach-entry-pill:active { transform: translateY(0) scale(0.98); }
.teach-entry-pill svg { width: 17px; height: 17px; }

/* ── Unsupported Browser ──────────────────────────────────── */
.teach-unsupported {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 3rem;
  text-align: center;
  flex: 1;
}
.teach-unsupported-icon { font-size: 2rem; opacity: 0.3; }
.teach-unsupported-text {
  font-family: var(--font-body, 'Crimson Pro', serif);
  font-size: 0.95rem;
  color: var(--t-text2);
  max-width: 380px;
  line-height: 1.7;
}

/* ── Toast ────────────────────────────────────────────────── */
.teach-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  z-index: 10001;
  font-family: var(--font-mono, 'IBM Plex Mono', monospace);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.5rem 1.1rem;
  background: rgba(16, 19, 28, 0.9);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  color: var(--t-text2);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  opacity: 0;
  transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
[data-theme="light"] .teach-toast {
  background: rgba(245, 240, 232, 0.92);
  border-color: rgba(0,0,0,0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}
.teach-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Text Input ───────────────────────────────────────────── */
.teach-text-input {
  position: absolute;
  z-index: 15;
  font-family: var(--font-body, 'Crimson Pro', serif);
  font-size: 16px;
  color: var(--t-text);
  background: rgba(176, 122, 255, 0.06);
  border: 1.5px dashed rgba(176, 122, 255, 0.5);
  border-radius: 4px;
  padding: 3px 6px;
  outline: none;
  min-width: 60px;
  caret-color: var(--t-purple);
}

/* ── Mobile — Touch-native UX ─────────────────────────────── */
@media (max-width: 680px) {
  /* Topbar: compact */
  .teach-topbar {
    padding: 0.35rem 0.7rem;
    gap: 0.4rem;
    min-height: 42px;
  }
  .teach-q-badge { font-size: 0.5rem; padding: 0.15rem 0.5rem; }
  .teach-q-text { font-size: 0.82rem; }
  .teach-q-expand { width: 20px; height: 20px; }
  .teach-q-expand svg { width: 12px; height: 12px; }

  /* Toolbar: compact scrollable pill */
  .teach-toolbar {
    top: 6px;
    gap: 1px;
    padding: 3px 6px;
    border-radius: 9px;
    max-width: calc(100vw - 20px);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .teach-toolbar::-webkit-scrollbar { display: none; }
  .teach-tool { width: 26px; height: 26px; }
  .teach-tool svg { width: 12px; height: 12px; }
  .teach-color-swatch { width: 13px; height: 13px; }
  .teach-size-slider { width: 36px; }
  .teach-toolbar-sep { height: 14px; margin: 0 2px; }

  /* Workspace: stack on mobile, no side-by-side */
  .teach-workspace[data-layout="half"] {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 100px;
  }
  .teach-workspace[data-layout="half"] .teach-camera {
    height: 100px;
    border-left: none;
    border-top: 1px solid var(--t-border);
  }

  /* PiP: smaller floating circle */
  .teach-workspace[data-layout="pip"] .teach-camera {
    width: 100px;
    height: 100px;
    bottom: 10px;
    right: 10px;
    border-radius: 50%;
  }
  .teach-workspace[data-layout="pip"] .teach-camera video {
    border-radius: 50%;
  }

  /* Grid overlay: bigger cells on mobile */
  .teach-canvas-wrap::after { background-size: 30px 30px; }

  /* Bottom bar: centered record button, compact controls */
  .teach-bottombar {
    padding: 0.4rem 0.6rem;
    gap: 0.3rem;
    flex-wrap: wrap;
    justify-content: center;
  }
  .teach-bottombar-left,
  .teach-bottombar-right { flex: 0; }
  .teach-bottombar-center { order: -1; width: 100%; justify-content: center; padding-bottom: 0.3rem; }

  .teach-rec-btn { width: 46px; height: 46px; }
  .teach-cam-toggle { font-size: 0.6rem; padding: 0.22rem 0.5rem; }
  .teach-cam-toggle svg { width: 10px; height: 10px; }
  .teach-blur-btn { font-size: 0.55rem; padding: 0.2rem 0.4rem; }
  .teach-skip-btn, .teach-hint-btn { font-size: 0.6rem; padding: 0.22rem 0.5rem; }
  .teach-layout-btn { width: 24px; height: 22px; }
  .teach-layout-btn svg { width: 11px; height: 11px; }

  /* Export grid: single column */
  .teach-export { padding: 1.5rem 1rem; }
  .teach-export-title { font-size: 1.2rem; }
  .teach-export-grid { grid-template-columns: 1fr; gap: 0.75rem; }

  /* Question panel: tighter */
  .teach-q-panel { padding: 1rem 1.2rem; }
  .teach-q-panel-prompt { font-size: 1rem; }

  /* Review: tighter */
  .teach-review { padding: 1.5rem 1rem; gap: 1.25rem; }
  .teach-review video { max-height: 45vh; border-radius: 12px; }
  .teach-review-btn { font-size: 0.7rem; padding: 0.45rem 1rem; }

  /* Entry pill: full width on mobile */
  .teach-entry-pill {
    width: calc(100% - 2rem);
    justify-content: center;
    margin: 2rem 1rem 1rem;
  }
}

/* ── Extra small phones ───────────────────────────────────── */
@media (max-width: 380px) {
  .teach-toolbar { padding: 2px 4px; }
  .teach-colors { gap: 2px; }
  .teach-color-swatch { width: 11px; height: 11px; }
  .teach-blur-btn { display: none; } /* hide blur controls on tiny screens */
  .teach-bottombar-left { gap: 0.2rem; }
}

/* ── Light Mode Refinements ───────────────────────────────── */
[data-theme="light"] .teach-topbar {
  background: linear-gradient(180deg, var(--t-bg2), transparent);
}
[data-theme="light"] .teach-bottombar {
  background: linear-gradient(0deg, var(--t-bg2), transparent);
}
[data-theme="light"] .teach-workspace[data-layout="pip"] .teach-camera {
  border-color: rgba(0,0,0,0.1);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.04) inset;
}
[data-theme="light"] .teach-export-card-check {
  border-color: rgba(0,0,0,0.15);
  background: rgba(255,255,255,0.7);
}
[data-theme="light"] .teach-export-card-duration {
  background: rgba(0,0,0,0.55);
}
[data-theme="light"] .teach-q-panel {
  box-shadow: 0 12px 40px rgba(0,0,0,0.1);
}
[data-theme="light"] .teach-review video {
  box-shadow: 0 12px 48px rgba(0,0,0,0.15);
}
