/* Neonatology Academy Style Sheet */

/* Import Google Fonts - Inter & Outfit */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

/* CSS custom variables */
:root {
  --primary-color: #0f172a;        /* Deep Slate Blue */
  --primary-dark: #020617;
  --primary-light: #f1f5f9;
  
  --brand-color: #1e40af;          /* Clinical Royal Blue */
  --brand-light: #eff6ff;
  --brand-hover: #1d4ed8;
  
  --secondary-color: #0284c7;      /* Clean Cyan */
  --secondary-light: #e0f2fe;
  
  --accent-color: #3b82f6;
  
  --text-main: #0f172a;
  --text-muted: #334155;
  --text-white: #ffffff;
  
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  
  --correct-color: #10b981;        /* Medical Green */
  --correct-light: #ecfdf5;
  --correct-border: #a7f3d0;
  
  --incorrect-color: #ef4444;      /* Alert Red */
  --incorrect-light: #fef2f2;
  --incorrect-border: #fca5a5;
  
  --warning-color: #f59e0b;
  --warning-light: #fef3c7;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  
  --font-body: 'Inter', sans-serif;
  --font-display: 'Outfit', sans-serif;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  background-color: #ffffff;
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--primary-color);
}

a {
  color: var(--brand-color);
  text-decoration: none;
  transition: var(--transition-fast);
}

a:hover {
  color: var(--brand-hover);
}

button, .btn {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all var(--transition-normal);
}

/* Button variants */
.btn-primary {
  background-color: var(--brand-color);
  color: var(--text-white);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background-color: var(--brand-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background-color: var(--bg-card);
  color: var(--brand-color);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--primary-light);
  border-color: var(--brand-color);
}

.btn-success {
  background-color: var(--correct-color);
  color: var(--text-white);
}

.btn-success:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-danger {
  background-color: var(--incorrect-color);
  color: var(--text-white);
}

.btn-danger:hover {
  opacity: 0.9;
}

.btn-icon {
  padding: 0.5rem;
  border-radius: 50%;
  aspect-ratio: 1;
}

/* Header & Navigation */
header {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--brand-color);
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--brand-color), var(--secondary-color));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.1rem;
  font-weight: bold;
}

nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-link {
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-link:hover, .nav-link.active {
  color: var(--brand-color);
  background-color: var(--brand-light);
}

to { opacity: 1; transform: translateY(0); }
}

/* Main Layout Grid */
.container {
  width: 100%;
  max-width: 1680px;
  margin: 1.5rem auto;
  padding: 0 clamp(1rem, 3vw, 3rem);
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
  color: white;
  border-radius: var(--radius-md);
  padding: 4rem 3rem;
  margin-bottom: 3rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.hero::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 40%;
  height: 100%;
  background: radial-gradient(circle, rgba(2,132,199,0.15) 0%, transparent 70%);
  pointer-events: none;
}

.hero-content {
  max-width: 800px;
  position: relative;
  z-index: 2;
}

.hero-tag {
  display: inline-block;
  background-color: var(--secondary-color);
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  margin-bottom: 1.25rem;
}

.hero h1 {
  font-size: 3rem;
  color: white;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.2rem;
  color: #475569;
  margin-bottom: 2rem;
  font-weight: 300;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Section Titles */
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.section-title h2 {
  font-size: 1.75rem;
  position: relative;
  padding-bottom: 0.5rem;
}

.section-title h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 50px;
  height: 3px;
  background-color: var(--brand-color);
  border-radius: 2px;
}

/* Specialty Cards Grid */
.specialty-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.specialty-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.specialty-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background-color: var(--border-color);
  transition: background-color var(--transition-normal);
}

.specialty-card:hover::before {
  background-color: var(--brand-color);
}

.specialty-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(30, 64, 175, 0.2);
}

.specialty-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: var(--brand-light);
  color: var(--brand-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 1.25rem;
}

.specialty-card h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.specialty-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
  flex-grow: 1;
}

.specialty-progress-bar {
  height: 6px;
  width: 100%;
  background-color: var(--primary-light);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.specialty-progress-fill {
  height: 100%;
  background-color: var(--brand-color);
  width: 0%;
  transition: width var(--transition-normal);
}

.specialty-progress-text {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

/* Forum Page / Dashboard View */
.forum-container {
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 2rem;
}

.forum-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.forum-post-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-normal);
}

.forum-post-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--brand-light);
}

.forum-post-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.forum-post-tag {
  background-color: var(--brand-light);
  color: var(--brand-color);
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
}

.forum-post-card h3 {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}

.forum-post-card p {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.forum-post-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
  font-size: 0.85rem;
}

.forum-post-author {
  font-weight: 500;
}

.forum-post-replies {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--brand-color);
}

.forum-sidebar {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  height: fit-content;
}

.forum-categories-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  list-style: none;
  margin-top: 1rem;
}

.forum-category-item {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
}

.forum-category-item:hover, .forum-category-item.active {
  background-color: var(--brand-light);
  color: var(--brand-color);
  font-weight: 500;
}

/* Research Hub Section */
.research-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.research-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
}

.research-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-light);
}

.research-card-category {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--secondary-color);
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.research-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.research-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  flex-grow: 1;
}

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

.research-links {
  display: flex;
  gap: 0.75rem;
}

.research-link-btn {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  background-color: var(--brand-light);
  color: var(--brand-color);
  font-weight: 600;
}

.research-link-btn:hover {
  background-color: var(--brand-color);
  color: white;
}

.research-bookmark-btn {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1rem;
  transition: var(--transition-fast);
}

.research-bookmark-btn.bookmarked {
  color: #e11d48; /* Red heart or filled state */
}

/* Search bar utilities */
.search-filter-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  background-color: var(--bg-card);
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  align-items: center;
  flex-wrap: wrap;
}

.search-input-wrapper {
  position: relative;
  flex-grow: 1;
  min-width: 250px;
}

.search-input-wrapper input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.search-input-wrapper input:focus {
  border-color: var(--brand-color);
}

.search-input-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.filter-select {
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: white;
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
  min-width: 150px;
}

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

/* Specialty/Quiz Page Styles (specialty.html) */
.quiz-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: calc(100vh - 65px); /* Subtract header height */
  overflow: hidden;
}

.quiz-sidebar {
  border-right: 1px solid var(--border-color);
  background-color: var(--bg-card);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

.quiz-sidebar-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.quiz-sidebar-header h2 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.quiz-stats-mini {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.question-nav-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  padding: 1.25rem;
}

.question-nav-btn {
  aspect-ratio: 1;
  border-radius: 4px;
  background-color: var(--primary-light);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.question-nav-btn:hover {
  background-color: var(--border-color);
}

.question-nav-btn.active {
  background-color: var(--brand-color);
  color: white;
  border-color: var(--brand-color);
}

.question-nav-btn.correct {
  background-color: var(--correct-color);
  color: white;
  border-color: var(--correct-color);
}

.question-nav-btn.incorrect {
  background-color: var(--incorrect-color);
  color: white;
  border-color: var(--incorrect-color);
}

.question-nav-btn.flagged {
  border: 2px solid var(--warning-color);
}

.quiz-main {
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: var(--bg-main);
  overflow-y: auto;
}

.quiz-toolbar {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}

.quiz-mode-indicators {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.quiz-timer {
  font-family: monospace;
  font-size: 1.2rem;
  font-weight: bold;
  background-color: var(--primary-light);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-tutor {
  background-color: var(--secondary-light);
  color: var(--secondary-color);
  border: 1px solid var(--secondary-color);
}

.badge-timed {
  background-color: var(--warning-light);
  color: var(--warning-color);
  border: 1px solid var(--warning-color);
}


.quiz-body {
  flex-grow: 1;
  padding: 2rem;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.question-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.question-meta-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.question-stem {
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--primary-color);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.choices-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.choice-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  background-color: white;
}

.choice-item:hover {
  background-color: var(--brand-light);
  border-color: var(--brand-color);
}

.choice-letter {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.choice-item:hover .choice-letter {
  border-color: var(--brand-color);
  color: var(--brand-color);
}

.choice-text {
  font-size: 0.95rem;
  color: var(--text-main);
}

/* Option feedback states */
.choice-item.selected {
  background-color: var(--brand-light);
  border-color: var(--brand-color);
}

.choice-item.selected .choice-letter {
  background-color: var(--brand-color);
  color: white;
  border-color: var(--brand-color);
}

.choice-item.correct-reveal {
  background-color: var(--correct-light);
  border-color: var(--correct-border);
}

.choice-item.correct-reveal .choice-letter {
  background-color: var(--correct-color);
  color: white;
  border-color: var(--correct-color);
}

.choice-item.incorrect-reveal {
  background-color: var(--incorrect-light);
  border-color: var(--incorrect-border);
}

.choice-item.incorrect-reveal .choice-letter {
  background-color: var(--incorrect-color);
  color: white;
  border-color: var(--incorrect-color);
}

/* Explanation Drawer/Section */
.explanation-section {
  display: none; /* Controlled via JS toggles */
  border-top: 2px solid var(--border-color);
  padding-top: 1.5rem;
  margin-top: 1.5rem;
  animation: slideIn 0.3s ease-out;
}

.explanation-section.visible {
  display: block;
}

.explanation-title {
  color: var(--correct-color);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.explanation-body {
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 1.5rem;
}

.wrong-explanations {
  margin-top: 1rem;
  border-left: 3px solid var(--border-color);
  padding-left: 1rem;
  margin-bottom: 1.5rem;
}

.wrong-explanation-item {
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

.wrong-explanation-item strong {
  color: var(--incorrect-color);
}

.key-learning-points {
  background-color: var(--brand-light);
  border-left: 4px solid var(--brand-color);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 1.5rem;
}

.key-learning-points h4 {
  font-size: 1rem;
  color: var(--brand-color);
  margin-bottom: 0.5rem;
}

.key-learning-points ul {
  padding-left: 1.25rem;
  font-size: 0.9rem;
}

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

.references-box h4 {
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.references-box ul {
  padding-left: 1.25rem;
}

/* Bottom Nav bar */
.quiz-footer {
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  bottom: 0;
}

.quiz-footer-left, .quiz-footer-right {
  display: flex;
  gap: 1rem;
}

/* Progress Section (progress.html or in index.html) */
.progress-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 3rem;
}

@media (max-width: 900px) {
  .progress-grid {
    grid-template-columns: 1fr;
  }
}

.progress-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

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

.stat-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-box {
  background-color: var(--primary-light);
  padding: 1.25rem;
  border-radius: var(--radius-sm);
  text-align: center;
}

.stat-box-value {
  font-size: 1.75rem;
  font-weight: 800;
  font-family: var(--font-display);
  color: var(--brand-color);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-box-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.rank-badge-large {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  border-radius: var(--radius-md);
  text-align: center;
  border: 2px dashed var(--brand-color);
  background-color: var(--brand-light);
}

.rank-badge-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--brand-color);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.rank-badge-name {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--brand-color);
}

.rank-badge-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Custom Chart Area */
.chart-container {
  position: relative;
  width: 100%;
  height: 250px;
}

.category-stats-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.category-stat-row {
  display: flex;
  flex-direction: column;
}

.category-stat-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.category-stat-bar-outer {
  height: 8px;
  background-color: var(--primary-light);
  border-radius: 4px;
  overflow: hidden;
}

.category-stat-bar-inner {
  height: 100%;
  background-color: var(--brand-color);
  border-radius: 4px;
  width: 0%;
  transition: width 0.5s ease-out;
}

/* Admin Dashboard Styles (admin.html) */
.admin-lock-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
}

.admin-lock-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.admin-lock-card h2 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.admin-lock-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.admin-input-group {
  margin-bottom: 1.25rem;
  text-align: left;
}

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

.admin-input-group input, .admin-input-group textarea, .admin-input-group select {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
  font-family: var(--font-body);
  font-size: 0.9rem;
}

.admin-input-group input:focus, .admin-input-group textarea:focus, .admin-input-group select:focus {
  border-color: var(--brand-color);
}

.admin-panel {
  display: none; /* Control via JS after auth */
}

.admin-panel.visible {
  display: block;
}

.admin-dashboard-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

@media (max-width: 992px) {
  .admin-dashboard-layout {
    grid-template-columns: 1fr;
  }
}

.admin-questions-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-card);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.admin-table th, .admin-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.admin-table th {
  background-color: var(--primary-light);
  font-weight: 600;
}

.admin-table tr:hover {
  background-color: #fafafa;
}

.admin-action-links {
  display: flex;
  gap: 0.5rem;
}

.admin-action-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 4px;
}

.admin-form-container {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
}

.admin-choice-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  align-items: center;
}

.admin-choice-letter {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.admin-choice-row input[type="text"] {
  flex-grow: 1;
}

.admin-import-export-row {
  display: flex;
  gap: 1rem;
  background-color: var(--brand-light);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Animations */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: slideIn 0.3s ease-out;
}

/* Tab contents styling for sub-navigation */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: slideIn 0.25s ease-out;
}

/* Footer Section */
footer.global-footer {
  background-color: var(--primary-color);
  color: #cbd5e1;
  padding: 3rem 2rem;
  margin-top: 4rem;
  border-top: 1px solid var(--border-color);
}

.footer-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer-logo {
  font-family: var(--font-display);
  color: white;
  font-size: 1.25rem;
  font-weight: 700;
}

.footer-copyright {
  font-size: 0.85rem;
}

.footer-links {
  display: flex;
  /* Six links plus 1.5rem gaps measured 522px inside a 312px parent on a
     375px-wide phone, which pushed the whole document into horizontal
     scroll. Wrapping is the fix; centring keeps the wrapped rows tidy. */
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  font-size: 0.85rem;
}

.footer-links a {
  color: #cbd5e1;
}

.footer-links a:hover {
  color: white;
}

/* Banner warnings */
.alert-banner {
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-left: 4px solid transparent;
}

.alert-info {
  background-color: var(--brand-light);
  color: var(--brand-color);
  border-left-color: var(--brand-color);
}

.alert-warning {
  background-color: var(--warning-light);
  color: var(--warning-color);
  border-left-color: var(--warning-color);
}

/* Home practice section with configurator */
.home-practice-section {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 2rem;
  align-items: start;
  margin-bottom: 3rem;
}

@media (max-width: 992px) {
  .home-practice-section {
    grid-template-columns: 1fr;
  }
}

.quiz-config-panel {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.quiz-config-panel h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.quiz-config-panel p {
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
  color: var(--text-muted);
}

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

.config-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.config-select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

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

/* Custom dropdown styles */
.custom-select-box {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-main);
  color: var(--text-main);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all var(--transition-fast);
}

.custom-select-box:hover {
  border-color: var(--brand-color);
}

.custom-select-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  max-height: 250px;
  overflow-y: auto;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  margin-top: 4px;
}

.custom-select-item {
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color var(--transition-fast);
  border-bottom: 1px solid var(--border-color);
}

.custom-select-item:last-child {
  border-bottom: none;
}

.custom-select-item:hover {
  background-color: var(--brand-light);
  color: var(--brand-color);
}

.custom-select-item.active {
  background-color: var(--brand-light);
  color: var(--brand-color);
  font-weight: 600;
}

/* Practice mode selector option box */
.mode-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.mode-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background-color: var(--bg-main);
  transition: all var(--transition-fast);
}

.mode-option:hover {
  border-color: var(--brand-color);
}

.mode-option.active {
  border-color: var(--brand-color);
  background-color: var(--brand-light);
  color: var(--brand-color);
}

.mode-option input {
  margin-top: 0.2rem;
}

.mode-details {
  display: flex;
  flex-direction: column;
}

.mode-details strong {
  font-size: 0.85rem;
  color: var(--text-main);
}

.mode-option.active .mode-details strong {
  color: var(--brand-color);
}

.mode-details span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Research banner on home page */
.research-banner {
  background: linear-gradient(135deg, var(--brand-color), var(--secondary-color));
  color: white;
  border-radius: var(--radius-md);
  padding: 1.5rem 2rem;
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.research-banner:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.research-banner-content {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.research-banner-icon {
  background-color: rgba(255, 255, 255, 0.2);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: white;
}

.research-banner-text h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: white;
  margin-bottom: 0.25rem;
}

.research-banner-text p {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
}

.research-banner-action .btn {
  background-color: white;
  color: var(--brand-color);
  border: none;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.research-banner-action .btn:hover {
  background-color: var(--brand-light);
  color: var(--brand-hover);
}

@media (max-width: 768px) {
  .research-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
    padding: 1.5rem;
  }
  .research-banner-content {
    gap: 1rem;
  }
  .research-banner-action {
    width: 100%;
    text-align: right;
  }
}

/* ----------------------------------------------------
   FLASHCARDS LAYOUT AND INTERACTIVE STYLES
   ---------------------------------------------------- */
.flashcards-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 2rem;
  margin-top: 1.5rem;
  align-items: start;
}

.flashcard-controls-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.flashcard-workspace {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem 0;
  width: 100%;
}

/* 3D Flip Card Styles */
.flashcard-perspective {
  perspective: 1000px;
  width: 100%;
  max-width: 580px;
  margin-bottom: 2rem;
}

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

.flashcard-inner.flipped {
  transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 2.5rem 2rem;
  text-align: center;
  overflow-y: auto;
  transition: box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.flashcard-inner:hover .flashcard-front, 
.flashcard-inner:hover .flashcard-back {
  box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.12), 0 8px 16px -5px rgba(0, 0, 0, 0.06);
  border-color: rgba(30, 64, 175, 0.3);
}

.flashcard-back {
  transform: rotateY(180deg);
  background: linear-gradient(145deg, var(--bg-card) 0%, var(--brand-light) 100%);
  border-color: rgba(30, 64, 175, 0.2);
}

.flashcard-badge {
  display: inline-block;
  background-color: var(--brand-light);
  color: var(--brand-color);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.3rem 0.85rem;
  border-radius: 50px;
  border: 1px solid rgba(30, 64, 175, 0.1);
}

.flashcard-back .flashcard-badge {
  background-color: var(--secondary-light);
  color: var(--secondary-color);
  border: 1px solid rgba(2, 132, 199, 0.1);
}

.flashcard-text {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-color);
  line-height: 1.5;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-height: 220px;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.flashcard-back .flashcard-text {
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--text-main);
  line-height: 1.6;
}

.flashcard-tip {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
  background-color: var(--primary-light);
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  transition: all var(--transition-fast);
}

.flashcard-inner:hover .flashcard-tip {
  color: var(--brand-color);
  background-color: var(--brand-light);
}

.flashcard-actions {
  display: flex;
  gap: 1rem;
  width: 100%;
  justify-content: center;
  align-items: center;
  min-height: 60px;
  margin-bottom: 1.5rem;
}

.flashcard-nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 580px;
  margin-top: 1rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1.5rem;
}

@media (max-width: 992px) {
  .flashcards-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .flashcard-inner {
    height: 320px;
  }
}

/* Spaced Repetition Grading Buttons & Badges */
.btn-again {
  background-color: var(--incorrect-color);
  color: var(--text-white);
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.btn-again:hover {
  background-color: #dc2626;
  box-shadow: 0 4px 6px -1px rgba(220, 38, 38, 0.3);
}

.btn-hard {
  background-color: var(--warning-color);
  color: var(--text-white);
  border: 1px solid rgba(245, 158, 11, 0.2);
}
.btn-hard:hover {
  background-color: #d97706;
  box-shadow: 0 4px 6px -1px rgba(217, 119, 6, 0.3);
}

.btn-good {
  background-color: var(--secondary-color);
  color: var(--text-white);
  border: 1px solid rgba(2, 132, 199, 0.2);
}
.btn-good:hover {
  background-color: #0369a1;
  box-shadow: 0 4px 6px -1px rgba(3, 105, 161, 0.3);
}

.btn-easy {
  background-color: var(--correct-color);
  color: var(--text-white);
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.btn-easy:hover {
  background-color: #059669;
  box-shadow: 0 4px 6px -1px rgba(5, 150, 105, 0.3);
}

.interval-label {
  font-size: 0.72rem;
  font-weight: 400;
  opacity: 0.85;
}

.flashcard-status-badge {
  display: inline-block;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.3rem 0.85rem;
  border-radius: 50px;
  border: 1px solid transparent;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.flashcard-status-badge.new {
  background-color: var(--primary-light);
  color: var(--text-muted);
  border-color: var(--border-color);
}

.flashcard-status-badge.learning {
  background-color: var(--warning-light);
  color: var(--warning-color);
  border-color: rgba(245, 158, 11, 0.2);
}

.flashcard-status-badge.review {
  background-color: var(--correct-light);
  color: var(--correct-color);
  border-color: var(--correct-border);
}

.flashcard-status-badge.relearning {
  background-color: #fef3c7; /* light amber */
  color: #d97706; /* dark amber */
  border-color: rgba(217, 119, 6, 0.2);
}

.flashcard-status-badge.leech {
  background-color: var(--incorrect-light);
  color: var(--incorrect-color);
  border-color: var(--incorrect-border);
  animation: pulse-leech 2s infinite;
}

@keyframes pulse-leech {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* SRS Table Styling in Flashcard Answer */
.srs-table-container {
  width: 100%;
  overflow-x: auto;
  margin-top: 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  background-color: var(--bg-card);
}

.srs-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.srs-data-table th, .srs-data-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.srs-data-table th {
  background-color: var(--brand-light);
  color: var(--brand-color);
  font-weight: 700;
  font-family: var(--font-display);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}

.srs-data-table tr:last-child td {
  border-bottom: none;
}

.srs-data-table tr:nth-child(even) {
  background-color: var(--primary-light);
}

.srs-data-table td {
  color: var(--text-main);
  line-height: 1.4;
}

/* ==========================================================================
   NICU CALCULATORS SUITE STYLING
   ========================================================================== */

/* Responsive Navbar Styling for many tabs */
header {
  padding: 0.5rem 0; /* slightly tighter header padding */
}
.header-container {
  padding: 0.5rem 1.5rem;
}
#main-nav {
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  justify-content: flex-end;
}
.nav-link {
  font-size: 0.85rem;
  padding: 0.4rem 0.6rem;
  gap: 0.3rem;
}
@media (max-width: 1200px) {
  /* Hide text, show only icons for calculator tabs to save space */
  .nav-link[data-tab^="calc-"] {
    font-size: 0 !important;
  }
  .nav-link[data-tab^="calc-"] i {
    font-size: 1.15rem;
    margin: 0;
  }
  .nav-link[data-tab^="calc-"] {
    padding: 0.5rem;
    aspect-ratio: 1;
    border-radius: 50%;
    justify-content: center;
  }
}

/* Unified Patient Profile Card */
.calculator-profile-card {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: white;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
  border: 1px solid #334155;
}
.calculator-profile-card h3 {
  color: #38bdf8; /* light blue accent */
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
}
.calculator-profile-card .text-muted {
  color: #475569 !important;
}
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}
.profile-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.profile-group label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #475569;
}
.profile-input {
  background-color: #1e293b;
  border: 1px solid #475569;
  border-radius: var(--radius-sm);
  color: white;
  padding: 0.45rem 0.6rem;
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--transition-fast);
}
.profile-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.15);
}
.ga-inputs {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.ga-input {
  width: 50px;
  text-align: center;
}
.ga-inputs span {
  font-size: 0.8rem;
  color: #475569;
  font-weight: 600;
}

/* Calculator Workspace & Grids */
.calc-container-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 900px) {
  .calc-container-grid {
    grid-template-columns: 1fr;
  }
}
.calc-panel {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}
.calc-panel .section-title {
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}
.calc-panel h3 {
  font-size: 1.2rem;
  color: var(--brand-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.calc-sub-card {
  background-color: var(--bg-main);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  border: 1px solid var(--border-color);
}
.calc-sub-card h4 {
  font-size: 0.95rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.4rem;
}

/* Age Results Grid */
.age-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}
.age-result-card {
  background-color: var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  border: 1px solid var(--border-color);
  text-align: center;
}
.age-result-card h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 0.05em;
}

/* Result Highlighting styles */
.result-highlight-box {
  background-color: var(--secondary-light);
  color: var(--secondary-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  border: 1px solid rgba(2, 132, 199, 0.15);
  margin-top: 0.5rem;
}
.result-box-sub {
  background-color: var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  text-align: center;
  font-size: 0.95rem;
}

/* Ballard Score Table/Grid */
.ballard-score-sheet {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.ballard-section {
  background-color: var(--bg-main);
  border-radius: var(--radius-sm);
  padding: 1rem;
  border: 1px solid var(--border-color);
}
.ballard-section h4 {
  font-size: 0.9rem;
  color: var(--brand-color);
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.25rem;
}
.ballard-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px dashed var(--border-color);
}
.ballard-group:last-child {
  border-bottom: none;
}
.ballard-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  flex: 1;
}
.ballard-options {
  display: flex;
  gap: 0.35rem;
  flex: 2;
  justify-content: flex-end;
}
.ballard-options label {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  transition: all var(--transition-fast);
  user-select: none;
  font-weight: 500;
}
.ballard-options label:hover {
  background-color: var(--primary-light);
  border-color: var(--text-muted);
}
.ballard-options input[type="radio"]:checked + label,
.ballard-options label:has(input[type="radio"]:checked) {
  background-color: var(--brand-color) !important;
  color: white !important;
  border-color: var(--brand-color) !important;
}
.ballard-options input[type="radio"] {
  display: none;
}
.ballard-summary-card {
  background-color: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
}

/* Respiratory Input Groups */
.resp-inputs-grid .admin-input-group label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Clinical score groups */
.score-group-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
}
.score-group-row label {
  font-weight: 600;
  color: var(--text-main);
}
.score-group-row select {
  max-width: 220px;
}
.score-result-box {
  background-color: var(--primary-light);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 1.05rem;
  border: 1px solid var(--border-color);
}

/* Bilirubin alert styles */
.converter-box input {
  text-align: center;
  font-weight: bold;
}

/* General disclaimers */
.disclaimer-text {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 0.75rem;
  border-top: 1px solid var(--border-color);
  padding-top: 0.5rem;
}

/* Consolidated sub-navigation styling */
.calc-sub-nav {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  overflow-x: auto;
  scrollbar-width: none; /* Hide standard scrollbar for clean aesthetic */
}
.calc-sub-nav::-webkit-scrollbar {
  display: none; /* Hide Chrome/Safari scrollbar */
}
.calc-sub-btn {
  background: none;
  color: var(--text-muted);
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  font-weight: 500;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.95rem;
  box-shadow: none;
  transition: all var(--transition-fast);
}
.calc-sub-btn:hover {
  color: var(--brand-color);
  background-color: var(--brand-light);
}
.calc-sub-btn.active {
  color: var(--brand-color) !important;
  border-bottom: 3px solid var(--brand-color) !important;
  background: none !important;
  font-weight: 700 !important;
}




/* Book Summary & Accordion Layout Improvements */
.summary-details-content {
  background-color: var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-top: 1rem;
  border-top: 1px dashed var(--border-color);
  animation: slideDownFade 0.3s ease-out;
}

@keyframes slideDownFade {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Custom transitions and states for sub tabs */
.qbank-sub-nav .sub-tab-btn, .sub-tab-nav .sub-tab-btn {
  transition: all var(--transition-fast) ease-in-out;
}
.qbank-sub-nav .sub-tab-btn:hover, .sub-tab-nav .sub-tab-btn:hover {
  color: var(--brand-color) !important;
  background-color: rgba(var(--brand-rgb, 59, 130, 246), 0.05) !important;
}


/* Navigation Hover Dropdown Menu Interactions */
.nav-item-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.dropdown-menu-list {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: var(--card-bg, #ffffff);
  min-width: 220px;
  max-height: 400px;
  overflow-y: auto;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm, 6px);
  z-index: 2000;
  padding: 0.5rem 0;
  margin-top: 0.25rem;
}

/* Add an invisible bridge area so hovering remains continuous between tab and dropdown */
.dropdown-menu-list::before {
  content: "";
  position: absolute;
  top: -12px;
  left: 0;
  width: 100%;
  height: 12px;
  background: transparent;
}

.dropdown-menu-list a {
  color: var(--text-color, #1e293b);
  padding: 0.6rem 1.2rem;
  text-decoration: none;
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
  box-sizing: border-box;
}

.dropdown-menu-list a:hover {
  background-color: var(--brand-light, #f0fdfa);
  color: var(--brand-color, #0f766e) !important;
  border-left: 3px solid var(--brand-color, #0f766e);
}

.nav-item-dropdown:hover .dropdown-menu-list {
  display: block;
  animation: slideDownFadeDropdown 0.2s ease-out;
}

.nav-item-dropdown:hover .nav-arrow {
  transform: rotate(180deg);
}

.nav-arrow {
  margin-left: 0.35rem;
  font-size: 0.75rem;
  opacity: 0.8;
  transition: transform 0.2s ease;
}

@keyframes slideDownFadeDropdown {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Region Pill Hover and Transition Styles */
.region-pill {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}
.region-pill:hover {
  background-color: var(--brand-light-hover, #dcfce7) !important;
  color: var(--brand-color, #15803d) !important;
  transform: translateY(-1px);
}
.region-pill.active:hover {
  background-color: var(--brand-color, #15803d) !important;
  color: white !important;
  transform: none;
}

/* Neo Summary Specialties Layout & Sidebar Styles */
.neo-summary-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  align-items: start;
  margin-top: 1.5rem;
}

.neo-summary-sidebar {
  background-color: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md, 8px);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.05));
}

.neo-summary-sidebar-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  border-radius: var(--radius-sm, 6px);
  color: var(--text-color, #1e293b);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.neo-summary-sidebar-btn i {
  font-size: 1rem;
  width: 1.25rem;
  text-align: center;
  color: var(--text-muted, #64748b);
  transition: color 0.15s ease;
}

.neo-summary-sidebar-btn:hover {
  background-color: var(--primary-light, #f0fdfa);
  color: var(--brand-color, #0f766e);
}

.neo-summary-sidebar-btn:hover i {
  color: var(--brand-color, #0f766e);
}

.neo-summary-sidebar-btn.active {
  background-color: var(--brand-color, #0f766e);
  color: white;
}

.neo-summary-sidebar-btn.active i {
  color: white;
}

.neo-summary-content-pane {
  background-color: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md, 8px);
  padding: 1.5rem;
  min-height: 450px;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.05));
  box-sizing: border-box;
}

.neo-summary-pane {
  animation: fadeInPane 0.25s ease-out;
}

/* Book-style two-page reading spread for each Neo Summary chapter.
   Narrative material is split into two balanced sides while dense clinical
   tables remain full-width below it for legibility. */
.nst-reading-spread {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
  background: linear-gradient(90deg, #f0f6ff 0 50%, #f8fafc 50% 100%);
  border-bottom: 1px solid var(--border-color);
}

.nst-reading-spread > .nst-reading-column {
  min-width: 0;
  border-bottom: 0 !important;
  padding: 1.15rem 1.35rem !important;
}

.nst-reading-key-points {
  border-right: 1px solid var(--border-color);
}

.nst-reading-overview {
  border-left: 0 !important;
  text-align: justify;
  hyphens: auto;
}

.nst-reading-key-points li,
.nst-reading-overview {
  break-inside: avoid;
}

@keyframes fadeInPane {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .neo-summary-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .nst-reading-spread {
    grid-template-columns: 1fr;
    background: #f8fafc;
  }

  .nst-reading-key-points {
    border-right: 0;
    border-bottom: 1px solid var(--border-color) !important;
  }

  .nst-reading-overview {
    text-align: left;
  }
}

/* Cross-link interactive styling */
.cross-link {
  color: #10b981 !important; /* Green brand color */
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline; /* inline is safer for text flows than inline-block */
}
.cross-link:hover {
  color: #059669 !important; /* Darker green */
  text-shadow: 0 0 1px rgba(16, 185, 129, 0.2);
}

/* ── Neo Summary term links (question explanations only) ──────────────────────
   Green, slightly bold, underline on HOVER only — deliberately quieter than
   .cross-link above so a paragraph of explanation does not turn into a wall of
   underlines. #047857 (emerald-700) is used rather than #10b981 because it clears
   WCAG AA contrast on the white explanation background. */
.neo-term-link {
  color: #047857;
  font-weight: 600;
  /* Persistent underline so the link is perceivable without relying on colour
     alone (WCAG 1.4.1 Use of Color). Dotted + offset keeps it distinct from
     real underlined links and unobtrusive in body text. */
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-color: rgba(4, 120, 87, 0.55);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  cursor: pointer;
  display: inline;
  border-radius: 3px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}
.neo-term-link:hover {
  color: #065f46;
  text-decoration-style: solid;
  text-decoration-color: #065f46;
  text-underline-offset: 3px;
}
.neo-term-link:focus-visible {
  outline: 2px solid #10b981;
  outline-offset: 2px;
  text-decoration: underline;
}
/* Touch devices get a slightly larger hit area without altering the text flow. */
@media (pointer: coarse) {
  .neo-term-link { padding: 0.1em 0; }
}

/* Connected Resources Modal Styles */
#connected-resources-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  z-index: 11000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
#connected-resources-modal.active {
  opacity: 1;
  pointer-events: auto;
}
.connected-modal-card {
  background: var(--card-bg, #ffffff);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.08);
  width: 90%;
  max-width: 500px;
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
#connected-resources-modal.active .connected-modal-card {
  transform: scale(1);
}
.connected-modal-header {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  padding: 1.25rem 1.5rem;
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.connected-modal-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.connected-modal-close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.connected-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}
.connected-modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.connected-resource-item {
  background: var(--primary-light, #f8fafc);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.2s ease;
  cursor: pointer;
}
.connected-resource-item:hover {
  border-color: #10b981;
  background-color: rgba(16, 185, 129, 0.04);
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}
.connected-item-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.connected-item-content {
  flex-grow: 1;
}
.connected-item-title {
  font-weight: 600;
  color: var(--text-main, #1e293b);
  font-size: 0.95rem;
  margin-bottom: 2px;
}
.connected-item-desc {
  font-size: 0.8rem;
  color: var(--text-muted, #64748b);
}
.connected-item-arrow {
  color: var(--text-muted);
  transition: transform 0.2s ease;
}
.connected-resource-item:hover .connected-item-arrow {
  transform: translateX(4px);
  color: #10b981;
}

/* Make tables clickable/interactive feedback */
.neo-summary-table-container table,
#card-answer-text table.srs-data-table {
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.neo-summary-table-container table:hover,
#card-answer-text table.srs-data-table:hover {
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}




/* ── Neo Summary teaching figures ────────────────────────────────────────
   Responsive figure strip inside a chapter body, with click-to-expand so
   detailed images (algorithms, tracings, radiographs) can be read full size. */
/* Figures render full-width and inline within the chapter body: every image is
   shown immediately at the full content width — no grid of thumbnails, no
   click-to-expand, no lightbox. Images (including image-based tables) are large
   enough to read directly, keep their aspect ratio, stay sharp, and never
   overflow the page on desktop, tablet or mobile. */
.nst-figures {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  padding: 1.25rem 1.1rem;
  background: #fbfdff;
  border-bottom: 1px solid var(--border-color);
}
.nst-figure {
  margin: 0;
  width: 100%;
}
.nst-figure-img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;               /* preserve aspect ratio — no crop/stretch */
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
}
.nst-figure figcaption {
  font-size: .9rem;
  line-height: 1.55;
  color: var(--text-color);
  margin-top: .7rem;
  padding: 0 .1rem;
}
.neo-fig-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 4000;
  background: rgba(15,23,42,.9);
  padding: 3vh 3vw;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.neo-fig-overlay.open { display: flex; }
.neo-fig-full {
  max-width: 96vw;
  max-height: 82vh;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
}
.neo-fig-cap {
  color: #f1f5f9;
  font-size: .9rem;
  line-height: 1.55;
  max-width: 800px;
  margin-top: .9rem;
  text-align: center;
}
.neo-fig-close {
  position: absolute;
  top: 1rem; right: 1.25rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.4rem;
  line-height: 1;
  cursor: pointer;
}
@media (max-width: 600px) {
  .nst-figures { gap: 1.1rem; padding: .85rem .6rem; }
  .nst-figure figcaption { font-size: .82rem; }
}

/* ══════════════════════════════════════════════════════════════════════════
   NEO DESIGN SYSTEM  (global standardization — 2026-09-08)
   One place that defines readable type, proportional images, legible tables,
   consistent spacing/radii, comfortable line length, keyboard focus, and
   responsive behaviour for the whole site. Loaded on every page via styles.css.
   ══════════════════════════════════════════════════════════════════════════ */
:root {
  --ns-maxw-figure: 760px;   /* images support content, never span the whole page */
  --ns-maxw-prose: 74ch;     /* comfortable reading line length */
  --ns-radius: 10px;
  --ns-fs-table: 0.95rem;    /* ~15px table cells (was ~13px) */
  --ns-fs-body: 1rem;
  --ns-fs-caption: 0.9rem;
}

/* Images: never overflow, never upscale (no pixelation), aspect ratio kept. */
img { max-width: 100%; height: auto; }

/* Neo Summary figures — proportional, centred, capped so they don't dominate. */
.nst-figures { align-items: center; }
.nst-figure { max-width: var(--ns-maxw-figure); margin-left: auto; margin-right: auto; }
.nst-figure-img {
  width: auto;                 /* display at natural size, capped below — no stretch/upscale */
  max-width: 100%;
  max-height: 80vh;            /* very tall diagrams never exceed one screen */
  height: auto;
  margin: 0 auto;
}
.nst-figure figcaption {
  font-size: var(--ns-fs-caption);
  max-width: var(--ns-maxw-figure);
  margin-left: auto; margin-right: auto;
  text-align: center;
}

/* Reuse line under a licensed third-party figure. Quieter than the caption —
   it is provenance, not teaching — but it must be legible, because printing the
   credit is what the CC BY / CC BY-SA licences actually require of us. */
.nst-fig-credit {
  font-size: calc(var(--ns-fs-caption) * 0.88);
  line-height: 1.45;
  max-width: var(--ns-maxw-figure);
  margin: .3rem auto 0;
  text-align: center;
  color: #6b7a86;
}
.nst-fig-credit b { color: #2f6b4f; font-weight: 600; }
.nst-fig-credit a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.nst-fig-credit a:hover { color: #2f6b4f; }

/* Neo Summary tables — readable, padded, horizontal-scroll on small screens.
   These win over the render's inline sizing because that inline sizing was
   removed from th/td (see app.js); structural inline (width/colour) remains. */
.nst-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.nst-table { width: 100%; border-collapse: collapse; min-width: min(560px, 100%); }
.nst-table th {
  font-size: 0.82rem; padding: 0.7rem 0.85rem; text-align: left;
  text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; line-height: 1.35;
}
.nst-table td {
  font-size: var(--ns-fs-table); padding: 0.65rem 0.85rem;
  line-height: 1.5; vertical-align: top; color: var(--text-color);
}
.nst-table td:first-child { font-weight: 600; }
.nst-table tbody tr { border-bottom: 1px solid var(--border-color); }

/* Comfortable reading blocks (override the small legacy inline sizes). */
.nst-reading-overview { font-size: 1rem !important; line-height: 1.75 !important; max-width: var(--ns-maxw-prose); }
.nst-reading-key-points strong { font-size: 0.9rem !important; }
.nst-reading-key-points ul { font-size: 0.94rem !important; line-height: 1.7 !important; }
.nst-chapter-refs ol { font-size: 0.85rem !important; line-height: 1.65 !important; }

/* Accessibility — a clear, consistent keyboard-focus ring everywhere. */
a:focus-visible, button:focus-visible, [role="link"]:focus-visible,
[tabindex]:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
.neo-term-link:focus-visible, .nst-header:focus-visible {
  outline: 2px solid var(--brand-color, #0f766e);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Responsive — tablets and phones. Wide tables scroll instead of breaking; the
   section-index grid and reading spread collapse to one column. */
@media (max-width: 900px) {
  .nst-reading-spread { grid-template-columns: 1fr !important; }
}
@media (max-width: 768px) {
  .nst-table th { font-size: 0.78rem; padding: 0.55rem 0.6rem; }
  .nst-table td { font-size: 0.9rem; padding: 0.55rem 0.6rem; }
  .ns-group-index > div:last-child { grid-template-columns: 1fr !important; }
  .nst-figure-img { max-height: 70vh; }
}

/* ══════════════════════════════════════════════════════════════════════════
   GUIDELINE PAGES (gl-*) — design-system alignment (2026-09-08)
   ~130 guideline pages carry gl-* styles inline per page (legacy) or via
   guideline.css. They all load /styles.css, so these rules — with !important to
   beat the pages' own *normal* gl-* declarations — standardize typography and
   image sizing across every guideline page from one place.
   ══════════════════════════════════════════════════════════════════════════ */
.gl-prose { font-size: 1rem !important; line-height: 1.75 !important; max-width: var(--ns-maxw-prose, 74ch) !important; }
.gl-table { font-size: 0.94rem !important; }
.gl-table th { font-size: 0.82rem !important; padding: 0.7rem 0.9rem !important; }
.gl-table td { font-size: 0.94rem !important; padding: 0.65rem 0.9rem !important; line-height: 1.55 !important; }
.gl-box li { font-size: 0.92rem !important; line-height: 1.7 !important; }
.gl-ref-list li { font-size: 0.88rem !important; line-height: 1.65 !important; }
.gl-algo-action { font-size: 0.92rem !important; line-height: 1.55 !important; }
.gl-algo-decision { font-size: 0.88rem !important; }
.gl-bedside li, .gl-summary li { font-size: 0.92rem !important; }
.gl-family li { font-size: 0.9rem !important; }
.gl-section-title { font-size: 1.22rem !important; }
.gl-header h1 { font-size: 1.85rem !important; }
/* Images: proportional, centred, never upscaled or page-dominating. */
.gl-body img, .gl-section img {
  display: block; max-width: min(100%, var(--ns-maxw-figure, 760px)) !important;
  width: auto !important; height: auto !important; max-height: 80vh !important;
  margin: 0.6rem auto 1.1rem !important; border-radius: 8px;
}
.gl-body figure { max-width: var(--ns-maxw-figure, 760px); margin: 1rem auto; }
.gl-body figcaption { font-size: var(--ns-fs-caption, 0.9rem); text-align: center; color: var(--text-muted, #64748b); }
@media (max-width: 768px) {
  .gl-table th, .gl-table td { padding: 0.55rem 0.6rem !important; }
  .gl-body img, .gl-section img { max-height: 70vh !important; }
}

/* ══════════════════════════════════════════════════════════════════════════
   QUESTION BANK — explanation design-system alignment (2026-09-08)
   Explanations render into class/id containers; the 48 embedded comparison
   tables carry class="clinical-table" with an inline 10pt size. These rules
   standardize readable sizing, padding and line length. app.js wraps each
   explanation table in .qb-table-wrap so wide tables scroll on small screens.
   ══════════════════════════════════════════════════════════════════════════ */
.clinical-table { font-size: 0.92rem !important; line-height: 1.5 !important; }
.clinical-table th { font-size: 0.84rem !important; padding: 0.6rem 0.8rem !important; vertical-align: top; }
.clinical-table td { font-size: 0.92rem !important; padding: 0.55rem 0.8rem !important; line-height: 1.5 !important; vertical-align: top; }
.qb-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 1rem 0; }
.qb-table-wrap .clinical-table { margin: 0 !important; min-width: 520px; }

/* Readable explanation prose + comfortable line length. */
#explanation-text-display { font-size: 1rem; line-height: 1.75; }
#explanation-text-display p, .explanation-body p { max-width: var(--ns-maxw-prose, 74ch); }
#explanation-drawer .qb-wrong-item { font-size: 0.94rem !important; line-height: 1.6 !important; }
#key-points-list li { font-size: 0.95rem; line-height: 1.7; }
#references-list li { font-size: 0.88rem; line-height: 1.6; word-break: break-word; }

@media (max-width: 768px) {
  .clinical-table th, .clinical-table td { padding: 0.5rem 0.6rem !important; }
}

/* ══════════════════════════════════════════════════════════════════════════
   FLASHCARDS + HOMEPAGE — design-system alignment (2026-09-08)
   Flashcards already use large, class-based text; these are the responsive
   fit-and-finish touches so nothing overflows on phones.
   ══════════════════════════════════════════════════════════════════════════ */
.flashcard-actions { flex-wrap: wrap; }        /* Again/Hard/Good/Easy wrap instead of overflowing */
.flashcard-tip { font-size: 0.85rem; }
@media (max-width: 600px) {
  .flashcard-actions .btn { flex: 1 1 44%; min-width: 130px; }
  .flashcard-text { font-size: 1.2rem; }        /* still comfortably large on phones */
  .flashcard-back .flashcard-text { font-size: 1.05rem; }
}
/* Homepage hero: keep the feature-card labels legible and never let a card
   push the layout wider than the screen. */
.hero-feature-grid a > div:last-child { font-size: 0.75rem; }
.home-quick-grid, .home-path-grid, .home-trust { min-width: 0; }
.hq-card, .path-step, .trust-item { min-width: 0; }

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE FIX (2026-09-08, from the desktop/tablet/mobile inspection pass)
   The Neo Summary layout is a CSS grid; a `1fr` track grows to its content's
   min-content, so a wide chapter table pushed the whole page wider than the
   screen on phones/tablets. minmax(0,1fr) + min-width:0 lets the track shrink
   so the table scrolls inside its own .nst-table-wrap instead.
   ══════════════════════════════════════════════════════════════════════════ */
.neo-summary-layout { grid-template-columns: 280px minmax(0, 1fr); }
.neo-summary-content-pane, .neo-summary-pane, .specialty-tables-mount,
.neo-summary-table-container, .ns-table-block, .nst-body { min-width: 0; }
@media (max-width: 768px) {
  .neo-summary-layout { grid-template-columns: minmax(0, 1fr); }
}
