/* ==========================================================================
   BIOMASTERY 30L - DESIGN SYSTEM & STYLESHEET
   Aesthetics: Modern Bio-Tech Glassmorphism, Vibrant Dark/Light Mode,
   Fluid Typography, Micro-Animations, and High-Affordance Interactive States
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Color Palette - Dark Mode (Default) */
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(31, 41, 55, 0.85);
  --bg-elevated: #1f2937;
  --bg-glass: rgba(17, 24, 39, 0.65);
  
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  /* Domain Theme Colors */
  --bio-emerald: #10b981;
  --bio-emerald-light: #34d399;
  --bio-glow: rgba(16, 185, 129, 0.25);
  
  --biochem-indigo: #6366f1;
  --biochem-indigo-light: #818cf8;
  --biochem-purple: #8b5cf6;
  --biochem-glow: rgba(99, 102, 241, 0.25);
  
  --teacher-gold: #f59e0b;
  --teacher-gold-light: #fbbf24;
  --teacher-glow: rgba(245, 158, 11, 0.22);
  
  --accent-cyan: #06b6d4;
  --danger-coral: #ef4444;
  --success-green: #10b981;
  
  /* Borders & Shadows */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(255, 255, 255, 0.15);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.5);
  --shadow-glow-bio: 0 0 25px rgba(16, 185, 129, 0.35);
  --shadow-glow-biochem: 0 0 25px rgba(99, 102, 241, 0.35);
  
  /* Typography & Radius */
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Mode Overrides */
[data-theme="light"] {
  --bg-primary: #f4f6fb;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(243, 244, 246, 0.95);
  --bg-elevated: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.8);
  
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #9ca3af;
  
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-glow: rgba(0, 0, 0, 0.12);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.12);
}

/* Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color var(--transition-smooth), color var(--transition-smooth);
}

/* Background Atmosphere Glows */
body::before {
  content: '';
  position: fixed;
  top: -150px;
  left: 10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--bio-glow) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  bottom: -150px;
  right: 10%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--biochem-glow) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Layout Container */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

/* ==========================================================================
   HEADER & NAVBAR
   ========================================================================== */
.site-header {
  position: sticky;
  top: 1rem;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.brand-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--bio-emerald), var(--biochem-indigo));
  border-radius: var(--radius-md);
  font-size: 1.4rem;
  box-shadow: var(--shadow-glow-bio);
  animation: pulse-glow 3s infinite alternate;
}

@keyframes pulse-glow {
  0% { transform: scale(1); filter: drop-shadow(0 0 4px var(--bio-emerald)); }
  100% { transform: scale(1.04); filter: drop-shadow(0 0 12px var(--biochem-purple)); }
}

.brand-title {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, #fff 0%, var(--bio-emerald-light) 60%, var(--biochem-indigo-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .brand-title {
  background: linear-gradient(90deg, #111827 0%, #059669 60%, #4f46e5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  background: linear-gradient(135deg, var(--teacher-gold), #ea580c);
  color: #fff;
  border-radius: var(--radius-full);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

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

/* Global Progress Widget */
.progress-widget {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
}

.progress-bar-mini {
  width: 80px;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill-mini {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--bio-emerald), var(--biochem-indigo));
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.progress-text {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--bio-emerald-light);
  font-family: var(--font-mono);
}

/* Pomodoro Button */
.btn-pomodoro {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(245, 158, 11, 0.15);
  color: var(--teacher-gold-light);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-pomodoro:hover {
  background: rgba(245, 158, 11, 0.25);
  transform: translateY(-1px);
}

/* Theme Toggle Button */
.btn-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 1.1rem;
  transition: var(--transition-fast);
}

.btn-theme-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: rotate(15deg);
}

/* ==========================================================================
   HERO / BANNER MOTIVAZIONALE
   ========================================================================== */
.hero-banner {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(99, 102, 241, 0.14) 50%, rgba(245, 158, 11, 0.1) 100%);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 2.2rem 2.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.hero-banner::after {
  content: '30L';
  position: absolute;
  right: -15px;
  bottom: -25px;
  font-size: 9rem;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.03);
  pointer-events: none;
  font-family: var(--font-mono);
}

.hero-content {
  max-width: 850px;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--teacher-gold-light);
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.8rem;
}

.hero-title {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 0.8rem;
  letter-spacing: -0.5px;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.hero-stat-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  font-size: 1.5rem;
}

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

.stat-value {
  font-weight: 800;
  font-size: 1.1rem;
  font-family: var(--font-mono);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==========================================================================
   PRIMARY NAVIGATION TABS
   ========================================================================== */
.main-nav {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.main-nav::-webkit-scrollbar {
  display: none;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--bio-emerald), var(--biochem-indigo));
  box-shadow: var(--shadow-sm);
}

.nav-tab.teacher-focus-tab.active {
  background: linear-gradient(135deg, var(--teacher-gold), #ea580c);
}

.tab-badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-full);
}

/* ==========================================================================
   SEARCH BAR & QUICK FILTERS
   ========================================================================== */
.controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.8rem;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 280px;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 0.8rem 1rem 0.8rem 2.8rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: var(--transition-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2);
}

.filter-pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.filter-btn:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.filter-btn.active {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  border-color: var(--border-glow);
}

/* ==========================================================================
   CHAPTER GRID & CARDS
   ========================================================================== */
.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 2rem 0 1.2rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.section-title.bio-title {
  color: var(--bio-emerald-light);
}

.section-title.biochem-title {
  color: var(--biochem-indigo-light);
}

.chapters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.chapter-card {
  position: relative;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: transform var(--transition-smooth), border-color var(--transition-smooth), box-shadow var(--transition-smooth);
}

.chapter-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-glow);
  box-shadow: var(--shadow-md);
}

.chapter-card.bio-card:hover {
  border-color: var(--bio-emerald);
  box-shadow: var(--shadow-glow-bio);
}

.chapter-card.biochem-card:hover {
  border-color: var(--biochem-indigo);
  box-shadow: var(--shadow-glow-biochem);
}

.chapter-card.has-teacher-focus {
  border-left: 4px solid var(--teacher-gold);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.8rem;
}

.card-badge-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chapter-num-badge {
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.teacher-alert-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(245, 158, 11, 0.15);
  color: var(--teacher-gold-light);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
}

.card-status-btn {
  background: transparent;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition-fast);
}

.card-status-btn.completed {
  color: var(--bio-emerald);
}

.chapter-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 0.6rem;
}

.chapter-card-summary {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 1.2rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.card-duration {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.card-action-hint {
  font-weight: 600;
  color: var(--accent-cyan);
}

/* ==========================================================================
   CHAPTER READER VIEW (MODAL / OVERLAY)
   ========================================================================== */
.reader-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 8, 18, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow: hidden;
  overscroll-behavior: contain;
  isolation: isolate;
  contain: strict;
}

.reader-modal.active {
  display: flex;
}

.reader-window {
  background: var(--bg-secondary);
  width: 100%;
  max-width: 950px;
  max-height: 85vh;
  height: 85vh;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-glow);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-pop 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  will-change: transform, opacity;
  contain: layout style;
}

@keyframes modal-pop {
  0% { transform: scale(0.96) translate3d(0, 0, 0); opacity: 0; }
  100% { transform: scale(1) translate3d(0, 0, 0); opacity: 1; }
}

.reader-header {
  padding: 1.2rem 1.8rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  flex-shrink: 0;
}

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

.btn-close-reader {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: var(--text-primary);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.btn-close-reader:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: scale(1.05);
}

.reader-body {
  padding: 2rem 2.5rem;
  overflow-y: auto;
  line-height: 1.7;
  flex: 1;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.reader-title-area {
  margin-bottom: 2rem;
}

.reader-module-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.6rem;
}

.reader-module-tag.bio {
  background: rgba(16, 185, 129, 0.15);
  color: var(--bio-emerald-light);
}

.reader-module-tag.biochem {
  background: rgba(99, 102, 241, 0.15);
  color: var(--biochem-indigo-light);
}

.reader-title {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.3;
}

/* Callout Box: Teacher Special Focus */
.teacher-focus-callout {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(234, 88, 12, 0.1));
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
}

.callout-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  color: var(--teacher-gold-light);
  margin-bottom: 0.5rem;
}

.callout-content {
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.6;
}

/* Section Text Formatting */
.reader-section {
  margin-bottom: 2.2rem;
}

.reader-section h3 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
  color: #fff;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.4rem;
}

[data-theme="light"] .reader-section h3 {
  color: #111827;
}

.reader-section p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.reader-section ul, .reader-section ol {
  margin-left: 1.5rem;
  margin-bottom: 1.2rem;
  color: var(--text-secondary);
}

.reader-section li {
  margin-bottom: 0.5rem;
}

.reader-section strong {
  color: var(--text-primary);
}

/* Markdown Table inside reader */
.reader-section table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.reader-section th, .reader-section td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

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

/* Key Points Box */
/* Scientific Math Expressions & Chemical Formulas */
.math-inline-expr {
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.1);
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.math-inline-expr sub,
.math-inline-expr sup {
  font-size: 0.78em;
  font-weight: 700;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

.math-inline-expr sub {
  bottom: -0.25em;
}

.math-inline-expr sup {
  top: -0.5em;
}

.math-block-display {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  padding: 1.1rem 1.4rem;
  border-radius: var(--radius-md);
  margin: 1.5rem 0;
  overflow-x: auto;
  color: var(--accent-cyan);
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.chem-arrow {
  display: inline-flex;
  align-items: center;
  padding: 0 0.35rem;
  font-size: 0.88em;
  font-weight: 600;
  color: var(--accent-cyan);
  opacity: 0.95;
}


.key-points-box {
  background: rgba(16, 185, 129, 0.08);
  border-left: 4px solid var(--bio-emerald);
  padding: 1.2rem 1.5rem;
  border-radius: var(--radius-sm);
  margin: 2rem 0;
}

.key-points-box h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--bio-emerald-light);
  margin-bottom: 0.6rem;
}

.key-points-box ul {
  list-style-type: none;
  margin: 0;
}

.key-points-box li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.4rem;
  font-size: 0.92rem;
  color: var(--text-primary);
}

.key-points-box li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--bio-emerald);
  font-weight: 800;
}

/* Reader Footer / Controls */
.reader-footer {
  padding: 1.1rem 1.8rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  z-index: 10;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35);
}

.btn-complete-chapter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, var(--bio-emerald), var(--accent-cyan));
  color: #fff;
  border: none;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-complete-chapter:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow-bio);
}

/* ==========================================================================
   INTERACTIVE TOOLS VIEW: PUNNETT GENERATOR
   ========================================================================== */
.tool-view-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-md);
}

.tool-presets-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1rem 0 1.8rem;
}

.btn-preset {
  padding: 0.55rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-preset:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-glow);
}

.btn-preset.active {
  background: linear-gradient(135deg, var(--bio-emerald), var(--accent-cyan));
  color: #fff;
  border-color: transparent;
}

.punnett-display-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 1.5rem;
}

@media (max-width: 850px) {
  .punnett-display-container {
    grid-template-columns: 1fr;
  }
}

/* Punnett 2x2 Grid Styling */
.punnett-grid-wrapper {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.punnett-grid {
  display: grid;
  grid-template-columns: 80px 110px 110px;
  grid-template-rows: 60px 90px 90px;
  gap: 8px;
  margin: 1rem 0;
}

.punnett-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-weight: 700;
}

.punnett-cell.header-cell {
  background: rgba(255, 255, 255, 0.08);
  font-size: 1.1rem;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
}

.punnett-cell.empty-corner {
  background: transparent;
}

.punnett-cell.result-cell {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  padding: 0.5rem;
  transition: var(--transition-fast);
}

.punnett-cell.result-cell:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-sm);
}

.punnett-cell .genotype {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  color: #fff;
}

.punnett-cell .phenotype {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Punnett Textual Ratios */
.punnett-explanation {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.ratio-row {
  margin-bottom: 1.2rem;
}

.ratio-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.ratio-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--bio-emerald-light);
  font-family: var(--font-mono);
}

.oral-script-box {
  background: rgba(245, 158, 11, 0.1);
  border-left: 3px solid var(--teacher-gold);
  padding: 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ==========================================================================
   SIMULATORE ORALE DOCENTE VIEW
   ========================================================================== */
.oral-questions-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.oral-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  transition: border-color var(--transition-smooth);
}

.oral-card:hover {
  border-color: var(--teacher-gold);
}

.oral-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.oral-source-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--teacher-gold-light);
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

.oral-question-text {
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.35;
  margin-bottom: 0.8rem;
}

[data-theme="light"] .oral-question-text {
  color: #111827;
}

.oral-strategy-box {
  background: rgba(99, 102, 241, 0.08);
  border-left: 4px solid var(--biochem-indigo);
  padding: 0.9rem 1.2rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.2rem;
  font-size: 0.92rem;
}

.oral-key-points {
  margin-bottom: 1.2rem;
}

.oral-key-points h5 {
  font-size: 0.9rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.oral-key-points ul {
  list-style: none;
}

.oral-key-points li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.4rem;
  font-size: 0.92rem;
  color: var(--text-primary);
}

.oral-key-points li::before {
  content: '🎯';
  position: absolute;
  left: 0;
}

.oral-pitfall-box {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1.1rem;
  margin-bottom: 0.8rem;
  font-size: 0.88rem;
  color: #fca5a5;
}

.oral-bridge-box {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1.1rem;
  font-size: 0.88rem;
  color: var(--bio-emerald-light);
}

/* ==========================================================================
   FLASHCARDS VIEW (3D FLIP CARDS)
   ========================================================================== */
.flashcards-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 650px;
  margin: 0 auto;
}

.fc-card-scene {
  width: 100%;
  height: 380px;
  perspective: 1200px;
  margin-bottom: 1.5rem;
  cursor: pointer;
}

.fc-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.fc-card-scene.is-flipped .fc-card-inner {
  transform: rotateY(180deg);
}

.fc-card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-glow);
}

.fc-card-front {
  background: linear-gradient(135deg, #111827 0%, #1f2937 100%);
  color: #fff;
}

.fc-card-back {
  background: linear-gradient(135deg, #1e1b4b 0%, #172554 100%);
  color: #fff;
  transform: rotateY(180deg);
}

[data-theme="light"] .fc-card-front {
  background: linear-gradient(135deg, #ffffff 0%, #f3f4f6 100%);
  color: #111827;
}

[data-theme="light"] .fc-card-back {
  background: linear-gradient(135deg, #eff6ff 0%, #e0e7ff 100%);
  color: #111827;
}

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

.fc-category {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-cyan);
}

.fc-flip-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.fc-main-text {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
  margin: auto 0;
}

.fc-card-back .fc-main-text {
  font-size: 1.05rem;
  font-weight: 500;
  text-align: left;
  line-height: 1.6;
}

.fc-controls-row {
  display: flex;
  gap: 1rem;
  width: 100%;
  justify-content: center;
}

.btn-fc-nav {
  padding: 0.75rem 1.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-fc-nav:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glow);
}

/* ==========================================================================
   QUIZ 30L VIEW
   ========================================================================== */
.quiz-container {
  max-width: 800px;
  margin: 0 auto;
}

.quiz-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2.2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
}

.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.quiz-question-number {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.quiz-question-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.8rem;
  line-height: 1.4;
}

.quiz-options-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.8rem;
}

.quiz-option-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: var(--transition-fast);
}

.quiz-option-btn:hover:not(:disabled) {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.08);
}

.quiz-option-btn.selected-correct {
  background: rgba(16, 185, 129, 0.15);
  border-color: var(--bio-emerald);
  color: var(--bio-emerald-light);
}

.quiz-option-btn.selected-wrong {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--danger-coral);
  color: #fca5a5;
}

.quiz-option-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}

.quiz-explanation-box {
  display: none;
  background: rgba(99, 102, 241, 0.1);
  border-left: 4px solid var(--biochem-indigo);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.quiz-explanation-box.visible {
  display: block;
}

.quiz-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ==========================================================================
   POMODORO MODAL
   ========================================================================== */
.pomodoro-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 8, 18, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow: hidden;
  overscroll-behavior: contain;
  isolation: isolate;
}

.pomodoro-modal.active {
  display: flex;
}

.pomodoro-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.timer-circle {
  font-family: var(--font-mono);
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--teacher-gold-light);
  margin: 1.5rem 0;
  letter-spacing: 2px;
}

.timer-modes {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.timer-mode-btn {
  padding: 0.4rem 0.8rem;
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  cursor: pointer;
}

.timer-mode-btn.active {
  background: var(--teacher-gold);
  color: #fff;
  border-color: var(--teacher-gold);
}

.timer-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.btn-timer-primary {
  padding: 0.75rem 2rem;
  background: var(--teacher-gold);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}

.btn-timer-reset {
  padding: 0.75rem 1.25rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer {
  text-align: center;
  padding: 3rem 1rem 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border-subtle);
  margin-top: 4rem;
}

.site-footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

/* Responsive Tweaks & Mobile Optimization */
@media (max-width: 768px) {
  .app-container {
    padding: 0 0.85rem 2rem;
  }
  .site-header {
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    gap: 0.75rem;
  }
  .header-actions {
    width: 100%;
    justify-content: space-between;
  }
  .hero-title {
    font-size: 1.5rem;
  }
  .hero-banner {
    padding: 1.4rem 1.2rem;
    margin-bottom: 1.5rem;
  }
  .hero-stats {
    gap: 0.75rem;
  }
  .hero-stat-card {
    flex: 1 1 calc(50% - 0.75rem);
    padding: 0.5rem 0.8rem;
  }
  .chapters-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .chapter-card {
    padding: 1.2rem;
  }
  .reader-modal {
    padding: 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }
  .reader-window {
    width: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    border: none;
  }
  .reader-body {
    padding: 1.2rem;
    flex: 1;
    overflow-y: auto;
  }
  .reader-footer {
    padding: 0.85rem 1.1rem;
    padding-bottom: max(1.1rem, calc(0.85rem + env(safe-area-inset-bottom, 0px)));
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-glow);
    flex-shrink: 0;
    z-index: 20;
    gap: 0.5rem;
  }
  .btn-complete-chapter {
    padding: 0.55rem 0.95rem;
    font-size: 0.85rem;
    white-space: nowrap;
  }
  .punnett-display-container {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .progress-widget {
    padding: 0.35rem 0.6rem;
  }
  .progress-bar-mini {
    width: 50px;
  }
  .btn-pomodoro {
    padding: 0.4rem 0.7rem;
    font-size: 0.8rem;
  }
  .hero-stat-card {
    flex: 1 1 100%;
  }
  .fc-card-scene {
    height: 420px;
  }
  .fc-card-face {
    padding: 1.5rem 1.2rem;
  }
  .fc-main-text {
    font-size: 1.15rem;
  }
  .tool-view-card {
    padding: 1.2rem 1rem;
  }
  .quiz-card {
    padding: 1.4rem 1.1rem;
  }
  .oral-card {
    padding: 1.2rem;
  }
  .oral-question-text {
    font-size: 1.15rem;
  }
  .reader-footer {
    padding: 0.75rem 0.85rem;
    padding-bottom: max(1.1rem, calc(0.75rem + env(safe-area-inset-bottom, 0px)));
  }
  .reader-footer span#reader-reading-time {
    font-size: 0.78rem !important;
  }
  .btn-complete-chapter {
    padding: 0.5rem 0.85rem;
    font-size: 0.82rem;
  }
}

