/*
 * TouchType Mac - Stylesheet
 * Cheerful, warm, ADHD-friendly design with Apple Magic Keyboard aesthetics.
 */

:root {
  --bg-primary: #FAF7F2;
  --bg-secondary: #F3ECE2;
  --bg-card: #FFFFFF;
  --bg-card-glass: rgba(255, 255, 255, 0.85);
  
  --text-main: #1E293B;
  --text-muted: #64748B;
  --text-subtle: #94A3B8;
  
  --amber-primary: #D97706;
  --amber-hover: #B45309;
  --amber-light: #FEF3C7;
  --amber-border: #FCD34D;
  
  --teal-accent: #0D9488;
  --teal-light: #CCFBF1;
  
  --mint-success: #059669;
  --mint-light: #D1FAE5;
  
  --coral-error: #E11D48;
  --coral-light: #FFE4E6;
  
  --indigo-accent: #4F46E5;
  --indigo-light: #EEF2FF;
  
  /* Finger zone palette (soft, cheerful, high legibility) */
  --finger-lp: #E0E7FF; /* Left pinky - Lavender */
  --finger-lr: #CFFAFE; /* Left ring - Soft Cyan */
  --finger-lm: #CCFBF1; /* Left middle - Mint */
  --finger-li: #D1FAE5; /* Left index - Pale Emerald */
  --finger-th: #FEF3C7; /* Thumbs - Soft Honey */
  --finger-ri: #FFEDD5; /* Right index - Soft Peach */
  --finger-rm: #FCE7F3; /* Right middle - Soft Rose */
  --finger-rr: #F3E8FF; /* Right ring - Soft Purple */
  --finger-rp: #FEE2E2; /* Right pinky - Soft Coral */

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 9999px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-key: 0 2px 0 #CBD5E1, 0 3px 6px rgba(0, 0, 0, 0.08);

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", Menlo, Monaco, Consolas, "Courier New", monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  user-select: none;
}

/* App Header */
.app-header {
  background: var(--bg-card-glass);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  padding: 12px 28px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #F59E0B, #D97706);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-weight: 700;
  font-size: 20px;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.3);
}

.brand-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-main);
}

.brand-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

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

.btn-icon-toggle {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.btn-icon-toggle:hover {
  background: #F8FAFC;
  border-color: #CBD5E1;
  transform: translateY(-1px);
}

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

/* Main Layout */
.main-content {
  flex: 1;
  max-width: 1060px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Home / Banner Card */
.lesson-banner {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px 32px;
  border: 1px solid #E2E8F0;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.lesson-info {
  flex: 1;
}

.badge-rec {
  display: inline-block;
  background: var(--amber-light);
  color: var(--amber-primary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  margin-bottom: 8px;
  border: 1px solid var(--amber-border);
}

.lesson-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.lesson-desc {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 600px;
}

.lesson-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.btn-hero-start {
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: #FFFFFF;
  border: none;
  padding: 14px 32px;
  border-radius: var(--radius-pill);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.35);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.btn-hero-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(217, 119, 6, 0.45);
}

.btn-hero-start:active {
  transform: translateY(1px);
}

.btn-secondary-link {
  background: none;
  border: none;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: underline;
  padding: 4px;
}

.btn-secondary-link:hover {
  color: var(--amber-primary);
}

/* Typing Arena */
.arena-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  border: 1px solid #E2E8F0;
  box-shadow: var(--shadow-lg);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Arena Header & Floating Stats */
.arena-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #F1F5F9;
  padding-bottom: 14px;
}

.arena-title-area {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.arena-stage-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
}

.arena-stage-counter {
  font-size: 13px;
  color: var(--text-subtle);
  font-weight: 600;
}

.stats-bar {
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-pill {
  background: var(--bg-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

.stat-val {
  font-weight: 700;
  color: var(--amber-primary);
  font-family: var(--font-mono);
}

.stat-val-acc {
  color: var(--mint-success);
}

.timer-pill {
  background: #FEF3C7;
  color: #92400E;
}

.timer-val {
  font-family: var(--font-mono);
  font-weight: 700;
}

.arena-controls {
  display: flex;
  gap: 6px;
}

.btn-pill-action {
  background: #F1F5F9;
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-pill-action:hover {
  background: #E2E8F0;
  color: var(--text-main);
}

/* Typing Display Area */
.typing-box {
  background: #FAFAFA;
  border: 2px solid #E2E8F0;
  border-radius: var(--radius-md);
  padding: 28px 32px;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  font-family: var(--font-mono);
  font-size: 26px;
  letter-spacing: 1px;
  line-height: 1.7;
  word-break: break-word;
  position: relative;
  outline: none;
  cursor: text;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.typing-box:focus {
  border-color: var(--amber-primary);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.15);
  background: #FFFFFF;
}

.char-correct {
  color: #10B981;
}

.char-current {
  background: #FEF3C7;
  color: #1E293B;
  border-bottom: 3px solid var(--amber-primary);
  border-radius: 3px 3px 0 0;
  animation: pulse-cursor 1s infinite alternate;
}

@keyframes pulse-cursor {
  0% { background: #FEF3C7; border-bottom-color: var(--amber-primary); }
  100% { background: #FDE68A; border-bottom-color: #B45309; }
}

.char-upcoming {
  color: #64748B;
}

.char-error {
  background: var(--coral-light);
  color: var(--coral-error);
  border-bottom: 3px solid var(--coral-error);
}

/* Pause Overlay */
.pause-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(6px);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 30;
}

.pause-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
}

.pause-sub {
  font-size: 14px;
  color: var(--text-muted);
}

.btn-resume {
  background: var(--amber-primary);
  color: #FFFFFF;
  border: none;
  padding: 12px 28px;
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform 0.15s ease;
}

.btn-resume:hover {
  background: var(--amber-hover);
  transform: translateY(-1px);
}

/* Encouragement & Homing Guidance Bar */
.guidance-bar {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-md);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 13.5px;
  color: var(--text-main);
}

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

.homing-pill {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  color: #1D4ED8;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

/* Keychron Q6 Max Mechanical Keyboard Section */
.keyboard-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid #E2E8F0;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  overflow-x: auto;
}

.keyboard-card.hidden {
  display: none;
}

.keyboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 0 4px;
  flex-wrap: wrap;
  gap: 12px;
}

.kb-title-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.kb-title {
  font-size: 14.5px;
  font-weight: 800;
  color: #1E293B;
  letter-spacing: 0.3px;
}

.kb-model-tag {
  background: #1E2129;
  color: #F8FAFC;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  border: 1px solid #333945;
}

.keyboard-toggles {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-kb-mode {
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-kb-mode:hover {
  background: #E2E8F0;
}

.btn-kb-mode.active {
  background: #FEF3C7;
  border-color: #F59E0B;
  color: #92400E;
}

.finger-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.legend-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.legend-lp { background: var(--finger-lp); color: #3730A3; }
.legend-lr { background: var(--finger-lr); color: #155E75; }
.legend-lm { background: var(--finger-lm); color: #115E59; }
.legend-li { background: var(--finger-li); color: #065F46; }
.legend-th { background: var(--finger-th); color: #854D0E; }
.legend-ri { background: var(--finger-ri); color: #9A3412; }
.legend-rm { background: var(--finger-rm); color: #9D174D; }
.legend-rr { background: var(--finger-rr); color: #6B21A8; }
.legend-rp { background: var(--finger-rp); color: #991B1B; }

/* 
 * The Keychron Q6 Max Aluminum CNC Chassis
 */
.keychron-chassis {
  background: linear-gradient(180deg, #242831 0%, #1A1D24 100%);
  border-radius: 14px;
  padding: 12px 14px 14px;
  box-shadow: 
    0 1px 0 rgba(255, 255, 255, 0.12) inset,
    0 0 0 1px #0F1115,
    0 8px 24px rgba(0, 0, 0, 0.35),
    0 2px 6px rgba(0, 0, 0, 0.2);
  position: relative;
  min-width: 960px;
}

/* CNC Corner Hex Screws */
.chassis-screw {
  width: 7px;
  height: 7px;
  background: #88909D;
  border-radius: 50%;
  box-shadow: inset 0 1px 1px #2B2F38, 0 1px 0 rgba(255, 255, 255, 0.2);
  position: absolute;
}
.screw-tl { top: 7px; left: 10px; }
.screw-tr { top: 7px; right: 10px; }
.screw-bl { bottom: 7px; left: 10px; }
.screw-br { bottom: 7px; right: 10px; }

/* Top Bezel Branding & Status */
.keychron-top-bezel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 18px 8px;
  position: relative;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 8px;
}

.keychron-brand-badge {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #CBD5E1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.keychron-sub-badge {
  font-size: 9.5px;
  color: #64748B;
  font-weight: 700;
  letter-spacing: 1px;
  margin-left: 8px;
}

.bezel-switches {
  display: flex;
  align-items: center;
  gap: 14px;
}

.switch-badge {
  background: #111317;
  border: 1px solid #333945;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 9px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

.switch-opt {
  color: #64748B;
}

.switch-opt.active {
  color: #38BDF8;
  font-weight: 800;
}

.switch-slider {
  width: 10px;
  height: 6px;
  background: #38BDF8;
  border-radius: 3px;
  box-shadow: 0 0 5px rgba(56, 189, 248, 0.5);
}

.conn-badge {
  font-size: 9.5px;
  color: #94A3B8;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.conn-dot {
  width: 6px;
  height: 6px;
  background: #10B981;
  border-radius: 50%;
  box-shadow: 0 0 6px #10B981;
}

/* Interior Recessed Switch Plate */
.keychron-interior {
  background: #121418;
  border-radius: 8px;
  padding: 8px;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.7);
  display: flex;
  gap: 10px;
}

.kb-cluster {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.cluster-main {
  flex: 15;
}

.cluster-nav {
  flex: 3;
}

.cluster-numpad {
  flex: 4.4;
}

.cluster-divider {
  width: 1px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: -1px 0 0 rgba(0, 0, 0, 0.6);
}

.kb-row {
  display: flex;
  gap: 5px;
}

.kb-spacer {
  pointer-events: none;
}

/* 
 * Keychron OSA Double-Shot PBT Keycaps 
 */
.kb-key {
  height: 44px;
  background: #1C1F26;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  user-select: none;
  cursor: pointer;
  box-shadow: 
    0 3.5px 0 #0E1013,
    0 4px 6px rgba(0, 0, 0, 0.4);
  transition: transform 0.05s ease, box-shadow 0.05s ease;
  padding: 1px;
}

/* Sunk dish top inside mechanical keycap */
.keycap-dish {
  width: 100%;
  height: 100%;
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.25);
  padding: 2px 4px;
}

/* Alphanumeric keys (Vintage Chalk / Warm Light Gray) */
.key-type-alpha .keycap-dish {
  background: linear-gradient(180deg, #E2E5EB 0%, #CCD0D8 100%);
  color: #17191E;
}

/* Modifier keys (Deep Carbon Graphite) */
.key-type-mod .keycap-dish {
  background: linear-gradient(180deg, #323742 0%, #242730 100%);
  color: #E2E8F0;
}

/* Keychron Signature Red Accents (Esc, Return) */
.key-type-accent .keycap-dish {
  background: linear-gradient(180deg, #EF4444 0%, #DC2626 100%);
  color: #FFFFFF;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

.kb-key-special {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.kb-main {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.1;
}

.kb-sub {
  font-size: 9.5px;
  opacity: 0.75;
  line-height: 1;
  margin-bottom: 2px;
}

/* Keychron Tactile Raised Homing Bars on F, J, and Numpad 5 */
.kb-bump {
  width: 13px;
  height: 3px;
  background: #475569;
  border-radius: 2px;
  position: absolute;
  bottom: 4px;
  box-shadow: 0 1px 1px rgba(255, 255, 255, 0.4);
}

.key-type-mod .kb-bump {
  background: #CBD5E1;
}

/* 
 * Finger Zone Mode (When enabled, dishes show soft pastel hues)
 */
.show-finger-zones .kb-key.finger-lp .keycap-dish { background: var(--finger-lp); color: #1E1B4B; }
.show-finger-zones .kb-key.finger-lr .keycap-dish { background: var(--finger-lr); color: #083344; }
.show-finger-zones .kb-key.finger-lm .keycap-dish { background: var(--finger-lm); color: #042F2E; }
.show-finger-zones .kb-key.finger-li .keycap-dish { background: var(--finger-li); color: #064E3B; }
.show-finger-zones .kb-key.finger-th .keycap-dish { background: var(--finger-th); color: #713F12; }
.show-finger-zones .kb-key.finger-ri .keycap-dish { background: var(--finger-ri); color: #7C2D12; }
.show-finger-zones .kb-key.finger-rm .keycap-dish { background: var(--finger-rm); color: #831843; }
.show-finger-zones .kb-key.finger-rr .keycap-dish { background: var(--finger-rr); color: #581C87; }
.show-finger-zones .kb-key.finger-rp .keycap-dish { background: var(--finger-rp); color: #881337; }

/* 
 * Keychron South-Facing RGB Glow for Expected Key
 */
.kb-key.key-expected {
  background: #D97706 !important;
  transform: translateY(-2px);
  box-shadow: 
    0 0 14px rgba(245, 158, 11, 0.8),
    0 4px 0 #B45309,
    0 6px 12px rgba(245, 158, 11, 0.4) !important;
  z-index: 10;
}

.kb-key.key-expected .keycap-dish {
  background: linear-gradient(180deg, #F59E0B 0%, #D97706 100%) !important;
  color: #FFFFFF !important;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.6);
}

.kb-key.key-expected .kb-sub,
.kb-key.key-expected .kb-bump {
  background: #FEF3C7 !important;
  color: #FEF3C7 !important;
}

/* Opposite Shift Key Highlight */
.kb-key.key-expected-shift {
  background: #4F46E5 !important;
  box-shadow: 
    0 0 14px rgba(99, 102, 241, 0.8),
    0 4px 0 #3730A3,
    0 6px 12px rgba(99, 102, 241, 0.4) !important;
  z-index: 10;
}

.kb-key.key-expected-shift .keycap-dish {
  background: linear-gradient(180deg, #6366F1 0%, #4F46E5 100%) !important;
  color: #FFFFFF !important;
}

/* Mechanical Key Bottom-Out Hit Feedback */
.kb-key.key-hit-correct {
  transform: translateY(3px) !important;
  box-shadow: 0 0.5px 0 #0E1013 !important;
}

.kb-key.key-hit-correct .keycap-dish {
  background: #10B981 !important;
  color: #FFFFFF !important;
}

.kb-key.key-hit-error {
  transform: translateY(3px) !important;
  box-shadow: 0 0.5px 0 #0E1013 !important;
}

.kb-key.key-hit-error .keycap-dish {
  background: #F43F5E !important;
  color: #FFFFFF !important;
}

/* 
 * Keychron Metal Knurled Rotary Encoder Knob 
 */
.keychron-rotary-knob {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  padding: 0 2px;
}

.knob-dial {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #4B5563 0%, #1F242C 70%, #111418 100%);
  border: 2px solid #2B303A;
  box-shadow: 
    0 3px 0 #0E1013,
    0 4px 8px rgba(0, 0, 0, 0.6),
    inset 0 1px 1px rgba(255, 255, 255, 0.35);
  position: relative;
  transition: transform 0.1s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.1s ease;
}

.knob-dial:hover {
  border-color: #F59E0B;
}

.knob-dial.knob-click {
  transform: scale(0.92) translateY(2px);
  box-shadow: 0 1px 0 #0E1013;
}

/* Red indicator line on the knob */
.knob-indicator {
  width: 3px;
  height: 10px;
  background: #EF4444;
  border-radius: 2px;
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 0 3px rgba(239, 68, 68, 0.8);
}

.knob-label {
  font-size: 8px;
  font-weight: 700;
  color: #64748B;
  letter-spacing: 0.5px;
  margin-top: 3px;
  text-transform: uppercase;
}
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-sheet {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.08);
  border: 1px solid #E2E8F0;
  animation: modal-pop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-pop {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 20px 28px;
  border-bottom: 1px solid #F1F5F9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
}

.btn-close-modal {
  background: #F1F5F9;
  border: none;
  font-size: 16px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.btn-close-modal:hover {
  background: #E2E8F0;
  color: var(--text-main);
}

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

.modal-footer {
  padding: 16px 28px;
  background: #F8FAFC;
  border-top: 1px solid #F1F5F9;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Lifetime Stats Grid */
.stats-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.summary-card {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  text-align: center;
}

.summary-val {
  font-size: 24px;
  font-weight: 800;
  color: var(--amber-primary);
  font-family: var(--font-mono);
}

.summary-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 4px;
}

/* Problem Keys Section in Modal */
.problem-keys-box {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: var(--radius-md);
  padding: 16px 20px;
}

.problem-keys-title {
  font-size: 14px;
  font-weight: 700;
  color: #92400E;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.problem-keys-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.key-chip {
  background: #FFFFFF;
  border: 1px solid #FCD34D;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  color: #78350F;
}

/* Celebration Modal Specifics */
.celebrate-card {
  text-align: center;
  padding: 10px 0;
}

.celebrate-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.celebrate-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 8px;
}

.celebrate-observation {
  font-size: 15px;
  color: var(--text-main);
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin: 16px 0;
  line-height: 1.6;
}

.celebrate-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin: 16px 0;
}

.celebrate-stat-num {
  font-size: 32px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--amber-primary);
}

.celebrate-stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

/* Curriculum Stage List */
.curriculum-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.curriculum-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid #E2E8F0;
  background: #FFFFFF;
  cursor: pointer;
  transition: all 0.15s ease;
}

.curriculum-item:hover {
  background: #F8FAFC;
  border-color: var(--amber-border);
  transform: translateX(4px);
}

.curriculum-item.active {
  background: var(--amber-light);
  border-color: var(--amber-border);
}

.curriculum-item.completed {
  border-left: 4px solid var(--mint-success);
}

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

.curriculum-name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-main);
}

.curriculum-keys {
  font-size: 12px;
  color: var(--text-muted);
}

/* Settings Form Controls */
.settings-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid #F1F5F9;
}

.setting-label {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-main);
}

.setting-desc {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* Toast Notifications */
.toast-msg {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1E293B;
  color: #FFFFFF;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  animation: toast-in 0.2s ease;
}

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

/* Chart Legend */
.chart-legend {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.chart-empty-state {
  text-align: center;
  color: var(--text-subtle);
  font-size: 13px;
  padding: 30px;
  font-style: italic;
}

/* Responsive */
@media (max-width: 820px) {
  .header-container { flex-direction: column; gap: 12px; }
  .lesson-banner { flex-direction: column; align-items: stretch; text-align: center; }
  .lesson-actions { align-items: center; }
  .apple-keyboard { display: none; } /* Hide on tiny mobile screens */
  .stats-summary-grid { grid-template-columns: repeat(2, 1fr); }
}
