/* ==========================================================================
   Gambia FLP - Modern Interactive Teacher Guide Design System
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-primary: #091a24;
  --bg-secondary: #0f2b38;
  --bg-surface: #153849;
  --bg-surface-elevated: #1d475c;
  --bg-card: rgba(21, 56, 73, 0.85);
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  
  --accent-gold: #f59e0b;
  --accent-gold-glow: rgba(245, 158, 11, 0.25);
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.25);
  --accent-cyan: #06b6d4;
  --accent-rose: #f43f5e;
  
  --border-subtle: rgba(255, 255, 255, 0.1);
  --border-focus: rgba(245, 158, 11, 0.6);
  
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 9999px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.45);
}

/* Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  padding-bottom: 40px;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 10% 10%, rgba(6, 182, 212, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(245, 158, 11, 0.07) 0%, transparent 40%);
  background-attachment: fixed;
}

/* ==========================================================================
   Header Section
   ========================================================================== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(9, 26, 36, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 10px 16px 8px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

/* Brand block is a single-height row: title and subtitle each stay on one
   line and truncate rather than wrapping the header taller on small phones. */
.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.flag-icon {
  position: relative;
  display: flex;
  flex-shrink: 0;
  line-height: 0;
}

/* Offline-ready indicator: a green dot on the flag's corner instead of a
   full-width "Cached Offline" badge row. */
.flag-icon .status-dot {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--bg-primary);
  box-shadow: 0 0 6px var(--accent-emerald);
}

.flag-icon svg {
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-subtitle {
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.icon-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: var(--bg-surface-elevated);
  transform: translateY(-1px);
}

/* Coach lives as a floating bubble bottom-left, mirroring the timer dock,
   so the header row is left to the brand alone. */
.coach-fab {
  position: fixed;
  left: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 16px 0 12px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.28), rgba(244, 63, 94, 0.28)), rgba(9, 26, 36, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: var(--text-primary);
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

.coach-fab:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.ai-sparkle {
  font-size: 14px;
  animation: pulse-glow 2s infinite ease-in-out;
}

/* Selector Row */
.selector-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.language-dropdown-wrapper {
  flex: 1;
  min-width: 140px;
}

.grade-dropdown-wrapper {
  min-width: 124px;
}

.selector-row .icon-btn {
  flex-shrink: 0;
}

.custom-select {
  width: 100%;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.custom-select:focus {
  border-color: var(--border-focus);
}

.grade-tag {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
}

/* Install-as-app button: shown only while the browser can install */
.install-btn {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.18), rgba(16, 185, 129, 0.18));
  border-color: rgba(6, 182, 212, 0.45);
  color: var(--accent-cyan);
}

.online-status-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-emerald);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
}

/* Week Scroller */
.week-nav {
  margin-bottom: 8px;
}

.week-scroll-container {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.week-scroll-container::-webkit-scrollbar {
  display: none;
}

.week-pill {
  flex-shrink: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.week-pill.active {
  background: var(--accent-gold);
  color: #091a24;
  border-color: var(--accent-gold);
  font-weight: 700;
  box-shadow: 0 0 12px var(--accent-gold-glow);
}

/* Day Selector */
.day-nav {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.day-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.day-btn .day-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.day-btn .day-sub {
  font-size: 10px;
  color: var(--text-muted);
}

.day-btn.active {
  background: var(--bg-surface-elevated);
  border-color: var(--accent-gold);
  box-shadow: inset 0 0 0 1px var(--accent-gold);
}
.day-btn.active .day-label {
  color: var(--accent-gold);
}

/* Session A / B toggle (Grade 1 national languages: two 30-min sessions a day).
   Hidden for single-session lessons, so ECD layouts are unchanged. */
.session-nav {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-top: 6px;
}

.session-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 7px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 0;
}

.session-btn .session-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.session-btn .session-sub {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.session-btn.active {
  background: var(--bg-surface-elevated);
  border-color: var(--accent-cyan);
  box-shadow: inset 0 0 0 1px var(--accent-cyan);
}
.session-btn.active .session-label {
  color: var(--accent-cyan);
}

/* ==========================================================================
   Main Content
   ========================================================================== */

.main-content {
  padding: 16px 16px 104px;
  max-width: 680px;
  margin: 0 auto;
}

/* Hero Lesson Card */
.lesson-hero-card {
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-secondary) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.lesson-hero-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-gold), var(--accent-cyan));
}

.hero-top-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.lesson-badge {
  background: var(--accent-gold);
  color: #091a24;
  font-weight: 800;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.lesson-type-badge {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}

.timing-badge {
  font-size: 11px;
  color: var(--accent-emerald);
  font-weight: 600;
  margin-left: auto;
}

.lesson-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.3;
}

.lesson-theme {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.lesson-theme strong {
  color: var(--accent-cyan);
}

/* Quick Specs Grid */
.quick-specs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.spec-card {
  background: rgba(9, 26, 36, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
}

.spec-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.spec-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.highlight-letter {
  font-family: var(--font-heading);
  font-size: 18px;
  color: var(--accent-gold);
  font-weight: 800;
}

/* Audio Companion Bar */
.audio-companion-bar {
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

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

.audio-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.audio-icon {
  font-size: 22px;
}

.audio-meta {
  display: flex;
  flex-direction: column;
}

.audio-meta strong {
  font-size: 13px;
  color: var(--text-primary);
}

.audio-meta span {
  font-size: 11px;
  color: var(--text-secondary);
}

.play-audio-btn {
  background: var(--accent-cyan);
  color: #091a24;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.play-audio-btn:hover {
  filter: brightness(1.1);
  transform: scale(1.03);
}

.play-audio-btn.is-playing {
  background: var(--accent-gold);
  color: #091a24;
  animation: pulse-glow 1.5s infinite ease-in-out;
}

/* Audio Track Selector Chips */
.audio-tracks-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.audio-tracks-row::-webkit-scrollbar {
  display: none;
}

.track-chip {
  flex-shrink: 0;
  background: rgba(9, 26, 36, 0.6);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.track-chip:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
}

.track-chip.active {
  background: var(--accent-cyan);
  color: #091a24;
  border-color: var(--accent-cyan);
  font-weight: 700;
}

/* Audio Seeker / Progress */
.audio-progress-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.audio-seeker-bar {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  cursor: pointer;
}

.audio-seeker-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-cyan);
  border-radius: 2px;
  transition: width 0.1s linear;
}

/* Floating Classroom Timer Dock
   Lives in the bottom-right corner over the content instead of inside the
   sticky header, so the header no longer spends ~70px of every screen on it. */
.timer-fab {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 12px;
  background: rgba(9, 26, 36, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(0, 0, 0, 0.3);
}

.timer-display {
  display: flex;
  align-items: center;
  gap: 8px;
}

.timer-icon {
  font-size: 16px;
}

.timer-readout {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.timer-clock {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 800;
  color: var(--accent-emerald);
  letter-spacing: 0.05em;
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
  font-variant-numeric: tabular-nums;
}

.timer-clock.timer-running {
  color: var(--accent-gold);
  text-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

.timer-clock.timer-warning {
  color: var(--accent-rose);
  animation: pulse-glow 1s infinite ease-in-out;
}

.timer-status {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.timer-buttons {
  display: flex;
  gap: 6px;
}

.btn-timer {
  background: var(--accent-emerald);
  color: #091a24;
  border: none;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-timer:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-timer-subtle {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  width: 32px;
  padding: 7px 0;
  font-size: 14px;
  line-height: 1;
}

.btn-timer-subtle:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

/* Lesson progress hairline pinned to the header's bottom edge (zero height in flow) */
.timer-progress-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.timer-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-emerald), var(--accent-gold));
  transition: width 0.5s ease;
}

/* Inline Step Audio Play Button */
.step-audio-btn {
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: var(--accent-cyan);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  transition: all 0.2s ease;
}

.step-audio-btn:hover {
  background: var(--accent-cyan);
  color: #091a24;
}

/* ==========================================================================
   Accordion / Outcomes & Materials
   ========================================================================== */

.meta-drawer-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  overflow: hidden;
}

.accordion-summary {
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
}

.accordion-summary::-webkit-details-marker {
  display: none;
}

.summary-arrow {
  font-size: 11px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.accordion-details[open] .summary-arrow {
  transform: rotate(180deg);
}

.drawer-content {
  padding: 0 16px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.outcomes-block, .materials-block {
  margin-top: 12px;
}

.drawer-content h3 {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--accent-gold);
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.styled-list {
  padding-left: 18px;
  color: var(--text-secondary);
  font-size: 13px;
}

.styled-list li {
  margin-bottom: 4px;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-item {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  color: var(--text-secondary);
}

/* ==========================================================================
   Step-by-Step Lesson Guidance
   ========================================================================== */

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.badge-total-time {
  font-size: 11px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-gold);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.steps-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.step-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: all 0.2s ease;
  position: relative;
}

.step-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.step-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

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

.step-num-badge {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-cyan);
  color: #091a24;
  font-weight: 800;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.step-duration {
  font-size: 11px;
  color: var(--accent-gold);
  font-weight: 600;
  background: rgba(245, 158, 11, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

.step-body {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.step-bullet-list {
  padding-left: 0;
  list-style: none;
  margin: 6px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bullet-item {
  position: relative;
  padding-left: 18px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.bullet-item::before {
  content: "•";
  position: absolute;
  left: 4px;
  color: var(--accent-cyan);
  font-weight: 800;
  font-size: 14px;
}

.step-subheading {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-gold);
  margin: 12px 0 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.step-paragraph {
  margin-bottom: 8px;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Teacher Script Formatting inside Step Body */
.teacher-dialogue {
  background: rgba(245, 158, 11, 0.1);
  border-left: 3px solid var(--accent-gold);
  padding: 8px 12px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 6px 0;
  color: #fef08a;
  font-size: 13.5px;
  line-height: 1.5;
}

.teacher-dialogue strong {
  color: var(--accent-gold);
}

.words-highlight-box {
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.3);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--accent-cyan);
  margin: 6px 0;
  font-size: 13px;
}

/* ==========================================================================
   Homework & Action Buttons
   ========================================================================== */

.homework-card {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 16px 0;
}

.hw-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.hw-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-emerald);
}

.hw-content {
  font-size: 13px;
  color: var(--text-secondary);
}

.action-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
}

.action-btn {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.share-tg-btn {
  background: #229ed9;
  color: white;
}

.print-card-btn {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

/* ==========================================================================
   Modals & Overlays (AI Coach & Search)
   ========================================================================== */

.hidden {
  display: none !important;
}

.search-overlay, .coach-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: flex-end;
  animation: fadeIn 0.2s ease;
}

.search-box, .coach-modal-card {
  width: 100%;
  max-width: 600px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border: 1px solid var(--border-subtle);
  border-bottom: none;
  padding: 20px 16px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.search-input-wrap, .coach-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  margin-bottom: 12px;
}

.search-input-wrap input, .coach-input-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}

.search-close-btn, .modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
}

.search-results {
  overflow-y: auto;
  max-height: 60vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-result-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
}
.search-result-item:hover {
  border-color: var(--accent-gold);
}

/* Coach Modal */
.coach-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.coach-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.coach-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-rose));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.coach-title-wrap h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.coach-title-wrap span {
  font-size: 11px;
  color: var(--text-muted);
}

.coach-messages {
  flex: 1;
  overflow-y: auto;
  max-height: 45vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
  padding-right: 4px;
}

.coach-msg {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.5;
}

.msg-ai {
  background: var(--bg-surface);
  border-left: 3px solid var(--accent-gold);
  align-self: flex-start;
  color: var(--text-primary);
}

.msg-user {
  background: var(--accent-cyan);
  color: #091a24;
  font-weight: 500;
  align-self: flex-end;
  border-bottom-right-radius: 2px;
}

.coach-prompts {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 8px;
}

.prompt-chip {
  flex-shrink: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
}

.coach-send-btn {
  background: var(--accent-gold);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #091a24;
  cursor: pointer;
}

/* Toast */
.toast-notification {
  position: fixed;
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  z-index: 600;
  max-width: calc(100% - 32px);
  text-align: center;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 43, 56, 0.95);
  border: 1px solid var(--accent-cyan);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  z-index: 2000;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translate(-50%, 20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

@keyframes pulse-glow {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(245, 158, 11, 0.4)); }
  50% { transform: scale(1.15); filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.8)); }
}

/* Print Styles */
@media print {
  body {
    background: white;
    color: black;
  }
  .app-header, .timer-fab, .coach-fab, .install-btn, .toast-notification, .action-footer, .coach-modal-overlay, .search-overlay {
    display: none !important;
  }
  .lesson-hero-card, .step-card, .meta-drawer-card, .homework-card {
    background: white !important;
    border: 1px solid #ccc !important;
    color: black !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }
}

/* Audio companion when the active language has no studio recordings yet.
   Muted rather than hidden, so teachers can see the feature exists and is
   simply not ready for their language. */
.audio-companion-bar.audio-unavailable {
  opacity: 0.72;
}

.audio-companion-bar.audio-unavailable .audio-icon {
  filter: grayscale(1);
}

.play-audio-btn:disabled,
.play-audio-btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.8);
}

.play-audio-btn:disabled:hover,
.play-audio-btn[aria-disabled="true"]:hover {
  transform: none;
}

/* Fields the extraction did not capture from the source Teacher Guide.
   Shown muted and italic so filler is never mistaken for curriculum. */
.not-extracted {
  opacity: 0.6;
  font-style: italic;
}

/* ==========================================================================
   Facilitator Guide page (facilitator.html) - training agenda for trainers.
   Reuses the header, pills, hero and step cards above; these are the parts
   that have no counterpart in the lesson pages.
   ========================================================================== */

.fac-audience-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.fac-audience-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.fac-guide-version {
  font-size: 11px;
  color: var(--text-muted);
}

/* Header switch between the two guides. A labelled pill, not a bare icon:
   the facilitator guide is a different audience and was easy to miss. */
.switch-guide-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 12px 0 9px;
  border-radius: var(--radius-pill);
  text-decoration: none;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.55);
  color: var(--text-primary);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.18);
  transition: all 0.2s ease;
  white-space: nowrap;
}
.switch-guide-btn:hover {
  background: rgba(16, 185, 129, 0.24);
  transform: translateY(-1px);
}
.switch-guide-hub {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.5);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.15);
}
.switch-guide-hub:hover { background: rgba(245, 158, 11, 0.22); }
.switch-guide-icon { font-size: 17px; line-height: 1; }
.switch-guide-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.switch-guide-kicker {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-emerald);
  font-weight: 700;
}
.switch-guide-hub .switch-guide-kicker { color: var(--accent-gold); }
.switch-guide-label {
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 700;
}
/* Callout strip above the lesson: names the Facilitator Guide in words */
.fac-callout {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-primary);
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.18), rgba(6, 182, 212, 0.10));
  border: 1px solid rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.15);
  transition: all 0.2s ease;
}
.fac-callout:hover { border-color: var(--accent-emerald); transform: translateY(-1px); }
.fac-callout-icon { font-size: 24px; line-height: 1; flex-shrink: 0; }
.fac-callout-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fac-callout-text strong {
  font-family: var(--font-heading);
  font-size: 14px;
  color: var(--accent-emerald);
}
.fac-callout-text span { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }
.fac-callout-arrow { margin-left: auto; font-size: 20px; color: var(--accent-emerald); flex-shrink: 0; }
@media print { .fac-callout { display: none !important; } }

/* Narrow phones: keep the label, let the brand subtitle give way */
@media (max-width: 400px) {
  .switch-guide-btn { padding: 0 10px 0 8px; gap: 5px; }
  .switch-guide-label { font-size: 11px; }
}

.fac-session-nav {
  margin-bottom: 4px;
}

.fac-session-chip {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 96px;
  max-width: 170px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.fac-session-chip .fac-chip-num {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-primary);
}

.fac-session-chip .fac-chip-title {
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.fac-session-chip.active {
  background: var(--bg-surface-elevated);
  border-color: var(--accent-gold);
  box-shadow: inset 0 0 0 1px var(--accent-gold);
}
.fac-session-chip.active .fac-chip-num {
  color: var(--accent-gold);
}

.fac-mode-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.3);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  margin: 2px 4px 2px 0;
  white-space: nowrap;
}

/* The modes card spans the grid so its chips wrap instead of widening it */
.facilitator-page .quick-specs-grid {
  grid-template-columns: 1fr 1fr;
}
.facilitator-page .spec-card { min-width: 0; }
.facilitator-page .spec-card:first-child {
  grid-column: 1 / -1;
}
.facilitator-page .spec-card:first-child .spec-val {
  white-space: normal;
  overflow: visible;
}
.spec-card .fac-mode-chip {
  font-size: 10px;
  padding: 1px 6px;
  white-space: normal;
}

.fac-mode-row {
  display: flex;
  flex-wrap: wrap;
  margin: -4px 0 8px;
}

/* Cue groups: the coloured left border says who is doing what */
.fac-cue {
  border-left: 3px solid var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 8px 12px;
  margin: 8px 0;
}

.fac-cue-head {
  margin-bottom: 4px;
  line-height: 1.5;
}

.fac-cue-label {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.fac-cue-text {
  color: var(--text-primary);
}

.fac-cue .step-bullet-list { margin: 4px 0; }
.fac-cue .step-paragraph { margin-bottom: 6px; }
.fac-cue .step-paragraph:last-child { margin-bottom: 0; }

.fac-cue-say {
  border-left-color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.08);
}
.fac-cue-say .fac-cue-label { color: var(--accent-gold); }
.fac-cue-say .fac-cue-text,
.fac-cue-say .bullet-item,
.fac-cue-say .step-paragraph { color: #fef3c7; }

.fac-cue-do {
  border-left-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.07);
}
.fac-cue-do .fac-cue-label { color: var(--accent-cyan); }

.fac-cue-ask {
  border-left-color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.08);
}
.fac-cue-ask .fac-cue-label { color: var(--accent-emerald); }
.fac-cue-ask .fac-cue-text { font-style: italic; }

.fac-cue-display {
  border-left-color: #a78bfa;
  background: rgba(167, 139, 250, 0.08);
}
.fac-cue-display .fac-cue-label { color: #c4b5fd; }

.fac-cue-key {
  border-left-color: var(--accent-rose);
  background: rgba(244, 63, 94, 0.08);
}
.fac-cue-key .fac-cue-label { color: #fda4af; }

.fac-cue-response {
  border-left-color: var(--text-muted);
  background: rgba(148, 163, 184, 0.08);
}
.fac-cue-response .fac-cue-label { color: var(--text-secondary); }

.fac-cue-note,
.fac-note {
  font-style: italic;
  color: var(--text-muted);
}
.fac-cue-note .fac-cue-label { color: var(--text-muted); }

.fac-note {
  margin: 6px 0;
  font-size: 13px;
}

.fac-sub-list {
  margin: 4px 0 4px 14px !important;
}
.fac-sub-list .bullet-item::before {
  content: "◦";
}

.fac-table-wrap {
  overflow-x: auto;
  margin: 8px 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.fac-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12.5px;
  min-width: 320px;
}

.fac-table th,
.fac-table td {
  text-align: left;
  vertical-align: top;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}
.fac-table th:last-child,
.fac-table td:last-child { border-right: none; }
.fac-table tr:last-child td { border-bottom: none; }

.fac-table th {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font-weight: 700;
}

.fac-day-overview {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fac-overview-btn {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.fac-overview-btn:hover { background: rgba(255, 255, 255, 0.04); }
.fac-day-overview li.active .fac-overview-btn {
  border-color: var(--accent-gold);
  color: var(--text-primary);
}

.fac-overview-num {
  font-weight: 800;
  color: var(--accent-gold);
  flex-shrink: 0;
}

.fac-overview-mins {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.fac-pager {
  display: flex;
  gap: 10px;
  margin: 16px 0 4px;
}

.fac-pager-btn {
  flex: 1;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}
.fac-pager-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.fac-source-note {
  margin-top: 16px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
}

@media print {
  .fac-pager, .fac-session-nav { display: none !important; }
  .fac-cue { border-left-color: #999; background: #f6f6f6; }
  .fac-cue-say .fac-cue-text, .fac-cue-say .bullet-item, .fac-cue-say .step-paragraph,
  .fac-table th, .fac-table td, .fac-cue-text { color: black; }
}

/* ==========================================================================
   Grade 1 Numeracy (subject switch in the grade select)
   ========================================================================== */
.custom-select optgroup {
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-weight: 700;
}
.custom-select option {
  background: var(--bg-surface);
  color: var(--text-primary);
}
.custom-select option:disabled {
  color: var(--text-muted);
}

/* Activity code (G1T1U1N1) and curriculum outcome code (1.1.2.1) */
.num-code {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: 4px;
  padding: 1px 5px;
  vertical-align: 1px;
}

/* The activity title in the national language, under the English one */
.num-act-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 8px;
}
.num-nl-title {
  font-style: italic;
  color: var(--text-secondary);
  font-size: 13px;
}

.num-pb-ref {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--accent-emerald);
}

/* Mental Maths / Reinforcement pools: one collapsible item per activity */
.num-pool-item {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  margin: 6px 0;
}
.num-pool-item > summary {
  cursor: pointer;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.45;
  list-style-position: inside;
}
.num-pool-item > summary .num-nl-title {
  display: block;
  font-size: 12px;
  margin-top: 2px;
}
.num-pool-item[open] > summary {
  border-bottom: 1px solid var(--border-subtle);
}
.num-pool-body {
  padding: 6px 10px 8px;
}

.styled-list li.num-outcomes-head {
  list-style: none;
  margin: 12px 0 4px -18px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.styled-list li.num-unit-outcome {
  font-size: 12.5px;
  color: var(--text-secondary);
}

/* Unit codes ("1.10") are wider than a target letter */
.subject-numeracy #hero-target-letter {
  font-size: 20px;
}

/* Teacher Hub header: Literacy | Numeracy subject switch */
.subject-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.subject-switch {
  display: inline-flex;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  overflow: hidden;
  flex-shrink: 0;
}
.subject-btn {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 0;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  min-height: 30px;
}
.subject-btn + .subject-btn {
  border-left: 1px solid var(--border-subtle);
}
.subject-btn.active {
  background: rgba(245, 158, 11, 0.16);
  color: var(--accent-gold);
}
.subject-numeracy .subject-btn.active {
  background: rgba(6, 182, 212, 0.18);
  color: var(--accent-cyan);
}
.subject-hint {
  background: none;
  border: 0;
  padding: 0;
  font-family: inherit;
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  cursor: default;
}
.subject-hint.subject-hint-new {
  color: var(--accent-cyan);
  font-weight: 700;
  cursor: pointer;
}
@media print {
  .subject-switch-row { display: none !important; }
}

/* Facilitator page: Literacy | Numeracy guide switch */
.fac-guide-switch {
  display: inline-flex;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.fac-guide-btn {
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 0;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.fac-guide-btn + .fac-guide-btn {
  border-left: 1px solid var(--border-subtle);
}
.fac-guide-btn.active {
  background: rgba(6, 182, 212, 0.18);
  color: var(--accent-cyan);
}

@media print {
  .num-pool-item { border: 0; }
  .fac-guide-switch { display: none !important; }
}
