*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --bg: #f8f7ff;
  --surface: #f0eeff;
  --surface-alt: #e8e4ff;
  --text: #0f0d1a;
  --muted: #3b3580;
  --border: #c7c2e8;
  --primary: #2563eb;
  --primary-contrast: #ffffff;
  --accent-red: #dc2626;
  --success: #22c55e;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
  --radius: 16px;
  
  /* Spacing Scale (8px base unit) */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  
  /* Typography Scale */
  --font-xs: 0.75rem;    /* 12px */
  --font-sm: 0.875rem;   /* 14px */
  --font-base: 1rem;     /* 16px */
  --font-lg: 1.25rem;    /* 20px */
  --font-xl: 1.5rem;     /* 24px */
  --font-2xl: 2rem;      /* 32px */
  --font-3xl: 2.5rem;    /* 40px */
  
  /* Line Heights */
  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.6;
  --leading-loose: 2;
  
  /* Component Spacing */
  --card-padding: var(--space-lg);
  --card-gap: var(--space-md);
  --section-gap: var(--space-2xl);
  --page-gap: var(--space-3xl);
}

body.theme-dark {
  color-scheme: dark;
  --bg: #0a0a14;
  --surface: #12101f;
  --surface-alt: #1a162e;
  --text: #f0eefc;
  --muted: #a5a0c8;
  --border: #2d2860;
  --primary: #3b82f6;
  --primary-contrast: #ffffff;
  --accent-red: #ef4444;
  --success: #4ade80;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    135deg,
    rgba(37, 99, 235, 0.12) 0%,
    rgba(248, 247, 255, 0.95) 25%,
    rgba(220, 38, 38, 0.08) 50%,
    rgba(248, 247, 255, 0.92) 75%,
    rgba(37, 99, 235, 0.1) 100%
  );
  background-size: cover;
  background-position: center;
}

body.page-dialogues::before {
  background: linear-gradient(
    135deg,
    rgba(220, 38, 38, 0.1) 0%,
    rgba(248, 247, 255, 0.92) 30%,
    rgba(37, 99, 235, 0.12) 70%,
    rgba(248, 247, 255, 0.9) 100%
  );
}

body.page-image-descriptions::before {
  background: linear-gradient(
    135deg,
    rgba(37, 99, 235, 0.14) 0%,
    rgba(248, 247, 255, 0.9) 40%,
    rgba(220, 38, 38, 0.1) 60%,
    rgba(248, 247, 255, 0.92) 100%
  );
}

body.page-gallery::before {
  background: linear-gradient(
    135deg,
    rgba(220, 38, 38, 0.08) 0%,
    rgba(37, 99, 235, 0.1) 50%,
    rgba(220, 38, 38, 0.06) 100%
  );
}

body.theme-dark::before {
  background: linear-gradient(
    135deg,
    rgba(37, 99, 235, 0.2) 0%,
    rgba(10, 10, 20, 0.95) 25%,
    rgba(220, 38, 38, 0.15) 50%,
    rgba(10, 10, 20, 0.93) 75%,
    rgba(37, 99, 235, 0.18) 100%
  );
}

body.theme-dark.page-dialogues::before {
  background: linear-gradient(
    135deg,
    rgba(220, 38, 38, 0.18) 0%,
    rgba(10, 10, 20, 0.94) 30%,
    rgba(37, 99, 235, 0.2) 70%,
    rgba(10, 10, 20, 0.92) 100%
  );
}

body.theme-dark.page-image-descriptions::before {
  background: linear-gradient(
    135deg,
    rgba(37, 99, 235, 0.22) 0%,
    rgba(10, 10, 20, 0.92) 40%,
    rgba(220, 38, 38, 0.16) 60%,
    rgba(10, 10, 20, 0.94) 100%
  );
}

body.theme-dark.page-gallery::before {
  background: linear-gradient(
    135deg,
    rgba(220, 38, 38, 0.15) 0%,
    rgba(37, 99, 235, 0.2) 50%,
    rgba(220, 38, 38, 0.12) 100%
  );
}

body.page-documents::before {
  background: linear-gradient(
    135deg,
    rgba(37, 99, 235, 0.1) 0%,
    rgba(248, 247, 255, 0.92) 40%,
    rgba(220, 38, 38, 0.08) 60%,
    rgba(248, 247, 255, 0.9) 100%
  );
}

body.theme-dark.page-documents::before {
  background: linear-gradient(
    135deg,
    rgba(37, 99, 235, 0.18) 0%,
    rgba(10, 10, 20, 0.94) 40%,
    rgba(220, 38, 38, 0.14) 60%,
    rgba(10, 10, 20, 0.92) 100%
  );
}

/* Documents */
.documents-list {
  display: grid;
  gap: var(--space-xl);
}

.document-group {
  padding: var(--space-lg);
}

.document-group-title {
  margin: 0 0 var(--space-md);
  font-size: var(--font-lg);
  color: var(--primary);
  border-bottom: 2px solid var(--border);
  padding-bottom: var(--space-sm);
}

.document-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-sm);
}

.document-links li {
  margin: 0;
}

.document-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius);
  background: var(--surface-alt);
  transition: background 0.2s ease, transform 0.15s ease;
}

.document-link:hover {
  background: var(--border);
  transform: translateX(4px);
}

.document-icon {
  font-size: 1.2rem;
}

.document-name {
  flex: 1;
  font-weight: 500;
}

.document-download {
  opacity: 0.6;
  font-size: 0.9rem;
}

/* Gallery */
/* Gallery */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-xl);
  padding: var(--space-md) 0;
}

.gallery-item {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  border: 1px solid var(--border);
}

.gallery-item:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 24px 48px rgba(37, 99, 235, 0.12), 0 8px 24px rgba(220, 38, 38, 0.06);
  border-color: var(--primary);
}

.gallery-link {
  display: block;
  aspect-ratio: 4/3;
  overflow: hidden;
  position: relative;
}

.gallery-link::after {
  content: "🔍";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.5), transparent 40%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: var(--space-md);
  font-size: 1.5rem;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.gallery-item:hover .gallery-link::after {
  opacity: 1;
}

.gallery-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.gallery-item:hover .gallery-img {
  transform: scale(1.08);
}

.page-gallery .view-header {
  text-align: center;
  margin-bottom: var(--space-2xl);
  padding: var(--space-xl);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.06), rgba(220, 38, 38, 0.04));
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.page-gallery .view-title {
  margin: 0 0 var(--space-sm);
  color: var(--primary);
  background: linear-gradient(135deg, var(--primary), var(--accent-red));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-gallery .view-description {
  margin: 0;
  color: var(--muted);
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  animation: lightboxFadeIn 0.2s ease;
}

@keyframes lightboxFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  width: 48px;
  height: 48px;
  font-size: 2rem;
  line-height: 1;
  color: #fff;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.4), rgba(220, 38, 38, 0.3));
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.lightbox-close:hover {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.6), rgba(220, 38, 38, 0.5));
  transform: scale(1.05);
}

.lightbox-img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--space-sm);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  animation: lightboxImgZoom 0.25s ease;
}

@keyframes lightboxImgZoom {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

input,
select,
textarea {
  font: inherit;
  color: inherit;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: min(1180px, 92%);
  margin: 0 auto;
  padding-left: var(--space-md);
  padding-right: var(--space-md);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.08), rgba(220, 38, 38, 0.06));
  backdrop-filter: blur(12px);
  border-bottom: 3px solid transparent;
}

.app-header::after {
  content: "";
  position: absolute;
  bottom: -3px;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent-red));
}

body.theme-dark .app-header {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.15), rgba(220, 38, 38, 0.1));
}

body.theme-dark .app-header::after {
  background: linear-gradient(90deg, var(--primary), var(--accent-red));
}

.app-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.1rem;
}

.brand-logo-link {
  display: flex;
  align-items: center;
}

.brand-logo-img {
  height: 40px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
}

.brand-badge {
  background: linear-gradient(135deg, var(--primary), var(--accent-red));
  color: var(--primary-contrast);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
}

.nav-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-button {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--muted);
  transition: all 0.2s ease;
}

.nav-button.active {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.nav-button {
  text-decoration: none;
  display: inline-block;
}

.nav-links a.nav-button {
  color: var(--muted);
  transition: all 0.2s ease;
}

.nav-links a.nav-button:hover {
  color: var(--text);
}

.nav-links a.nav-button.active {
  color: var(--primary);
  background: rgba(22, 163, 74, 0.1);
  border-color: var(--primary);
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.button {
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.button--primary {
  background: linear-gradient(135deg, var(--primary), #1d4ed8);
  color: var(--primary-contrast);
  box-shadow: 0 12px 20px rgba(37, 99, 235, 0.35);
}

.button--primary:hover {
  transform: translateY(-1px);
}

.button--outline {
  border-color: var(--border);
  background: transparent;
  color: var(--text);
}

.button--ghost {
  color: var(--muted);
  border: 1px solid transparent;
}

.button--ghost:hover {
  color: var(--text);
  border-color: var(--border);
}

/* Interactive states: focus (keyboard) and click feedback */
.button:focus-visible,
.nav-button:focus-visible,
.modal-close:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.button:active,
.nav-button:active {
  transform: scale(0.98);
}

@media (prefers-reduced-motion: reduce) {
  .button:hover,
  .button:active,
  .nav-button:active,
  .card:hover {
    transform: none;
  }
}

.main {
  flex: 1;
  padding: var(--space-xl) 0 var(--space-3xl);
}

/* Page Sections with Proper Spacing */
.page-section {
  margin-bottom: var(--page-gap);
}

.page-section:last-child {
  margin-bottom: 0;
}

.section-header {
  margin-bottom: var(--section-gap);
  text-align: center;
}

.section-header h2 {
  margin: 0 0 var(--space-md);
  font-size: var(--font-2xl);
  font-weight: 700;
  color: var(--text);
}

.section-header p {
  margin: 0;
  font-size: var(--font-lg);
  color: var(--muted);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(220, 38, 38, 0.08), transparent);
  border: 2px solid var(--primary);
  box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.3);
  border-radius: var(--radius);
  padding: var(--space-xl);
  display: grid;
  gap: var(--space-lg);
  box-shadow: var(--shadow);
  margin-bottom: var(--section-gap);
}

.hero h1 {
  margin: 0;
  font-size: var(--font-3xl);
  font-weight: 700;
  line-height: var(--leading-tight);
}

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: var(--font-lg);
  line-height: var(--leading-relaxed);
}

/* Grid System with Better Spacing */
.grid {
  display: grid;
  gap: var(--card-gap);
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* Card Component with Enhanced Spacing */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--card-padding);
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
}

.card-header {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.card-title {
  margin: 0 0 var(--space-sm);
  font-size: var(--font-lg);
  font-weight: 600;
  color: var(--text);
}

.card-subtitle {
  margin: 0;
  font-size: var(--font-sm);
  color: var(--muted);
}

.card-body {
  flex: 1;
  margin-bottom: var(--space-md);
}

.card-footer {
  margin-top: auto;
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  flex-wrap: wrap;
}

/* Card Variants */
.card-compact {
  padding: var(--space-md);
}

.card-spacious {
  padding: var(--space-xl);
}

.card-interactive {
  cursor: pointer;
}

.card-interactive:hover {
  border-color: var(--primary);
}

/* Verb Card Specific Styles */
.verb-card {
  position: relative;
}

.verb-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.verb-infinitive {
  font-size: var(--font-xl);
  font-weight: 700;
  color: var(--primary);
  margin: 0;
}

.verb-english {
  font-size: var(--font-sm);
  color: var(--muted);
  font-style: italic;
  margin: var(--space-xs) 0 0;
}

.verb-preview {
  font-size: var(--font-sm);
  color: var(--muted);
  margin-top: var(--space-sm);
  font-family: 'Courier New', monospace;
}

.verb-stats {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

/* Grammar Card Styles */
.grammar-card {
  position: relative;
}

.grammar-level-badge {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
}

.grammar-category {
  font-size: var(--font-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: var(--space-sm);
}

.grammar-preview {
  color: var(--muted);
  font-size: var(--font-sm);
  line-height: var(--leading-relaxed);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Exam Card Styles */
.exam-card {
  position: relative;
}

.exam-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-md);
}

.exam-points {
  font-size: var(--font-lg);
  font-weight: 700;
  color: var(--primary);
}

.exam-type {
  font-size: var(--font-xs);
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--space-xs);
}

.exam-instructions {
  color: var(--muted);
  font-size: var(--font-sm);
  line-height: var(--leading-relaxed);
  margin-top: var(--space-sm);
}

.muted {
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

.badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge.success {
  background: rgba(34, 197, 94, 0.2);
  color: #16a34a;
  border: 1px solid rgba(34, 197, 94, 0.4);
}

.badge.warning {
  background: rgba(245, 158, 11, 0.2);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge.danger {
  background: rgba(220, 38, 38, 0.2);
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.4);
}

/* Filter Bar Component */
.filter-bar {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--section-gap);
  padding: var(--space-md);
  background: var(--surface-alt);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.filter-group {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  flex-wrap: wrap;
}

.filter-label {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--muted);
  margin-right: var(--space-xs);
}

.filter-button {
  padding: var(--space-sm) var(--space-md);
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: var(--font-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-button:hover {
  background: var(--surface-alt);
  border-color: var(--primary);
}

.filter-button.active {
  background: var(--primary);
  color: var(--primary-contrast);
  border-color: var(--primary);
}

/* Search Component */
.search-container {
  position: relative;
  margin-bottom: var(--section-gap);
}

.search-input {
  width: 100%;
  padding: var(--space-md) var(--space-md) var(--space-md) 44px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--surface);
  font-size: var(--font-base);
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

/* Progress Components */
.progress-section {
  margin-bottom: var(--section-gap);
}

.progress-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--card-gap);
  margin-bottom: var(--section-gap);
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--card-padding);
  text-align: center;
}

.stat-value {
  font-size: var(--font-3xl);
  font-weight: 700;
  color: var(--primary);
  margin: 0;
  line-height: var(--leading-tight);
}

.stat-label {
  font-size: var(--font-sm);
  color: var(--muted);
  margin-top: var(--space-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.progress-group {
  margin-bottom: var(--space-xl);
}

.progress-group-title {
  font-size: var(--font-lg);
  font-weight: 600;
  margin-bottom: var(--space-md);
  color: var(--text);
}

.progress-item {
  margin-bottom: var(--space-md);
}

.progress-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
}

.progress-item-label {
  font-size: var(--font-base);
  font-weight: 500;
  color: var(--text);
}

.progress-item-value {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--muted);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* Content Grouping */
.content-group {
  margin-bottom: var(--section-gap);
}

.content-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 2px solid var(--border);
}

.content-group-title {
  font-size: var(--font-xl);
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.content-group-subtitle {
  font-size: var(--font-sm);
  color: var(--muted);
  margin: var(--space-xs) 0 0;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
  color: var(--muted);
}

.empty-state-title {
  font-size: var(--font-xl);
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--text);
}

.empty-state-text {
  font-size: var(--font-base);
  max-width: 400px;
  margin: 0 auto;
}

/* View Container */
.view-container {
  animation: fadeIn 0.3s ease-in;
}

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

.view-header {
  margin-bottom: var(--section-gap);
}

.view-title {
  font-size: var(--font-3xl);
  font-weight: 700;
  margin: 0 0 var(--space-md);
  color: var(--text);
}

.view-description {
  font-size: var(--font-lg);
  color: var(--muted);
  margin: 0;
  max-width: 700px;
}

/* Dialogue Styles */
.dialogue-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin: var(--space-lg) 0;
}

.dialogue-line {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-md);
  border-radius: var(--radius);
  max-width: 85%;
  animation: fadeIn 0.3s ease-in;
  transition: all 0.2s ease;
  cursor: pointer;
}

.dialogue-line:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.dialogue-line-left {
  align-self: flex-start;
  background: var(--surface-alt);
  border-left: 3px solid var(--primary);
}

.dialogue-line-right {
  align-self: flex-end;
  background: rgba(22, 163, 74, 0.1);
  border-right: 3px solid var(--success);
}

.dialogue-speaker {
  font-size: var(--font-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin-bottom: var(--space-xs);
}

.dialogue-text {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.dialogue-ro {
  font-size: var(--font-base);
  font-weight: 500;
  color: var(--text);
  line-height: var(--leading-relaxed);
}

.dialogue-en {
  font-size: var(--font-sm);
  color: var(--muted);
  font-style: italic;
  line-height: var(--leading-relaxed);
}

.dialogue-vocabulary {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
}

.vocabulary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-sm);
}

.vocabulary-item {
  padding: var(--space-sm);
  background: var(--surface-alt);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.vocabulary-item:hover {
  background: var(--surface);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

@media (max-width: 640px) {
  .dialogue-line {
    max-width: 95%;
  }
  
  .vocabulary-grid {
    grid-template-columns: 1fr;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }

  .page-gallery .view-header {
    padding: var(--space-md);
  }
}

/* Image Description Styles */
.description-container {
  margin: var(--space-lg) 0;
}

.description-intro {
  margin-bottom: var(--space-lg);
  padding: var(--space-md);
  background: var(--surface-alt);
  border-radius: var(--radius);
  border-left: 3px solid var(--primary);
}

.description-examples {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.description-item {
  padding: var(--space-md);
  background: var(--surface-alt);
  border-radius: var(--radius);
  border-left: 3px solid var(--primary);
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
}

.description-item:hover {
  background: var(--surface);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.15);
  border-left-color: var(--success);
}

.description-item.active {
  background: rgba(34, 197, 94, 0.15);
  border-left-color: var(--success);
}

.description-number {
  font-size: var(--font-xs);
  font-weight: 600;
  color: var(--primary);
  margin-bottom: var(--space-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.description-ro {
  font-size: var(--font-base);
  font-weight: 500;
  color: var(--text);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-xs);
}

.description-en {
  font-size: var(--font-sm);
  color: var(--muted);
  font-style: italic;
  line-height: var(--leading-relaxed);
}

.image-description-card {
  max-width: 100%;
}

/* Detailed Description Styles */
.description-detailed-ro {
  font-size: var(--font-base);
  line-height: var(--leading-relaxed);
  color: var(--text);
  margin-bottom: var(--space-md);
  cursor: pointer;
  transition: all 0.2s ease;
  padding: var(--space-md);
  border-radius: var(--radius);
  background: rgba(22, 163, 74, 0.03);
  border: 1px solid rgba(22, 163, 74, 0.1);
  position: relative;
}

.description-detailed-ro:hover {
  background: rgba(22, 163, 74, 0.08);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.1);
}

.description-detailed-en {
  font-size: var(--font-sm);
  line-height: var(--leading-relaxed);
  color: var(--muted);
  font-style: italic;
  padding: var(--space-md);
  background: var(--surface-alt);
  border-radius: var(--radius);
  border-left: 3px solid var(--primary);
}

.detailed-description-card {
  transition: all 0.2s ease;
}

.detailed-description-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.content-group-header {
  margin-bottom: var(--space-lg);
}

.content-group-subtitle {
  font-size: var(--font-sm);
  color: var(--muted);
  margin-top: var(--space-xs);
}

.conjugation-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.conjugation-table th,
.conjugation-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.conjugation-table th {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.audio-button {
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--text);
}

.example {
  color: var(--muted);
  font-size: 0.9rem;
}

.progress-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--surface-alt);
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  background: var(--primary);
}

.stat-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stat {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.stat h4 {
  margin: 6px 0 0;
  font-size: 1.5rem;
}

.stat span {
  color: var(--muted);
  font-size: 0.85rem;
}

.question-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  background: var(--surface);
  display: grid;
  gap: 12px;
}

.options {
  display: grid;
  gap: 12px;
}

.option {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  text-align: left;
}

.option.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.3);
}

.feedback {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 0.95rem;
}

.feedback.correct {
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}

.feedback.incorrect {
  border-color: rgba(220, 38, 38, 0.5);
  background: rgba(220, 38, 38, 0.15);
  color: #dc2626;
}

.input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.verb-list {
  max-height: 420px;
  overflow: auto;
  display: grid;
  gap: 8px;
}

.verb-list button {
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.verb-list button.active {
  border-color: var(--primary);
  background: rgba(22, 163, 74, 0.15);
}

.auth-panel {
  display: grid;
  gap: 16px;
}

.tab-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab-row button {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.tab-row button.active {
  background: var(--primary);
  color: var(--primary-contrast);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.modal-content {
  width: min(480px, 100%);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.footer-note {
  margin-top: 40px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Exam Guide (B1 cheat sheet) */
.page-exam-guide .main {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  padding-top: var(--space-xl);
  padding-bottom: var(--space-2xl);
}

.exam-guide-header {
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-lg);
  border-bottom: 2px solid var(--border);
}

.exam-guide-title {
  font-size: var(--font-2xl);
  font-weight: 700;
  margin: 0 0 var(--space-sm);
  color: var(--text);
}

.exam-guide-subtitle {
  font-size: var(--font-base);
  color: var(--muted);
  margin: 0;
  line-height: var(--leading-relaxed);
}

.guide-section {
  margin-bottom: var(--space-xl);
}

.guide-section h2 {
  font-size: var(--font-lg);
  font-weight: 600;
  margin: 0 0 var(--space-md);
  color: var(--primary);
}

.guide-h3 {
  font-size: var(--font-base);
  font-weight: 600;
  margin: var(--space-md) 0 var(--space-sm);
  color: var(--text);
}

.guide-intro {
  font-size: var(--font-sm);
  color: var(--muted);
  margin: 0 0 var(--space-md);
  line-height: var(--leading-relaxed);
}

.guide-formula {
  background: var(--surface-alt);
  border-left: 4px solid var(--primary);
  padding: var(--space-md) var(--space-lg);
  margin: 0 0 var(--space-md);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: var(--font-sm);
  line-height: var(--leading-relaxed);
}

.guide-formula strong {
  color: var(--text);
}

.guide-checklist {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-md);
}

.guide-checklist li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: var(--space-sm);
  font-size: var(--font-sm);
  line-height: var(--leading-relaxed);
}

.guide-checklist li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--success);
  font-weight: 700;
}

.guide-list-compact {
  margin: 0 0 var(--space-md);
  padding-left: 1.25rem;
  font-size: var(--font-sm);
  line-height: 1.6;
}

.guide-list-compact li {
  margin-bottom: var(--space-xs);
}

.guide-example {
  font-size: var(--font-sm);
  color: var(--muted);
  font-style: italic;
  margin: 0 0 var(--space-md);
}

.guide-section-highlight {
  background: var(--surface);
  padding: var(--space-lg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.guide-encourage {
  font-size: var(--font-base);
  color: var(--text);
  margin: var(--space-md) 0 0;
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
  font-weight: 500;
}

/* Exam guide & global: prevent horizontal overflow */
.page-exam-guide .main,
.main.container {
  overflow-x: hidden;
}

/* Template Components */
.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  transition: opacity 0.2s ease;
}

.brand-link:hover {
  opacity: 0.8;
}

.brand-logo {
  height: 40px;
  width: auto;
  object-fit: contain;
}

.brand-text {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
}

.navbar {
  display: flex;
  align-items: center;
}

.navbar-list {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.navbar-link {
  padding: 8px 16px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  transition: all 0.2s ease;
  font-weight: 500;
}

.navbar-link:hover {
  color: var(--text);
  background: var(--surface-alt);
}

.navbar-link.active {
  color: var(--primary);
  background: rgba(22, 163, 74, 0.1);
  font-weight: 600;
}

.nav-toggle-btn {
  display: none;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.nav-toggle-icon {
  font-size: 1.5rem;
  color: var(--text);
  line-height: 1;
}

.nav-toggle-icon.close {
  display: none;
}

.nav-toggle-btn[aria-expanded="true"] .nav-toggle-icon.open {
  display: none;
}

.nav-toggle-btn[aria-expanded="true"] .nav-toggle-icon.close {
  display: block;
}

.main-content {
  min-height: calc(100vh - 200px);
  padding-top: 20px;
}

/* Footer Styles */
.app-footer {
  margin-top: 60px;
  padding: 40px 0 20px;
  background: var(--surface);
  border-top: 2px solid var(--border);
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 32px;
  margin-bottom: 32px;
}

.footer-section h3,
.footer-section h4 {
  margin: 0 0 16px;
  color: var(--text);
}

.footer-title {
  font-size: 1.5rem;
  color: var(--primary);
}

.footer-subtitle {
  font-size: 1rem;
  font-weight: 600;
}

.footer-text {
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--primary);
}

.footer-contact {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-contact li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.footer-contact ion-icon {
  font-size: 1.2rem;
  color: var(--primary);
}

.footer-contact a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-contact a:hover {
  color: var(--primary);
}

.footer-social {
  display: flex;
  gap: 12px;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface-alt);
  color: var(--text);
  text-decoration: none;
  transition: all 0.2s ease;
}

.social-link:hover {
  background: var(--primary);
  color: var(--primary-contrast);
  transform: translateY(-2px);
}

.social-link ion-icon {
  font-size: 1.2rem;
}

.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.copyright {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.copyright-link {
  color: var(--primary);
  text-decoration: none;
}

.copyright-link:hover {
  text-decoration: underline;
}

/* Back to Top Button */
.back-top-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: var(--primary-contrast);
  border-radius: 50%;
  box-shadow: var(--shadow);
  text-decoration: none;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 100;
}

.back-top-btn.visible {
  opacity: 1;
  visibility: visible;
}

.back-top-btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(22, 163, 74, 0.4);
}

.back-top-btn ion-icon {
  font-size: 1.5rem;
}

/* Section Styles */
.section {
  padding: 60px 0;
}

.section-title {
  margin: 0 0 16px;
  color: var(--text);
}

.section-text {
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 32px;
}

.h1 {
  font-size: 2.5rem;
  font-weight: 700;
}

.h2 {
  font-size: 2rem;
  font-weight: 600;
}

.h3 {
  font-size: 1.5rem;
  font-weight: 600;
}

/* Form Styles */
.contact-form {
  max-width: 600px;
  margin: 0 auto;
}

.input-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.input-field {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  transition: all 0.2s ease;
}

.input-field:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

.input-field::placeholder {
  color: var(--muted);
}

textarea.input-field {
  min-height: 120px;
  resize: vertical;
  font-family: inherit;
}

.btn {
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  font-size: 1rem;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-contrast);
  box-shadow: 0 12px 20px rgba(22, 163, 74, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 24px rgba(22, 163, 74, 0.4);
}

/* Contact Cards */
.contact-list {
  list-style: none;
  margin: 32px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.contact-card {
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
}

.contact-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.card-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(22, 163, 74, 0.1);
  margin-bottom: 16px;
}

.card-icon ion-icon {
  font-size: 1.8rem;
  color: var(--primary);
}

.card-title {
  margin: 0 0 12px;
  color: var(--text);
}

.card-link {
  display: block;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 8px;
  transition: color 0.2s ease;
}

.card-link:hover {
  color: var(--primary);
}

.card-address {
  color: var(--muted);
  font-style: normal;
  line-height: 1.6;
  margin: 0;
}

/* Screen-reader only (accessibility) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ========== Interactive UI: Modal, Toast, Expandable, View State ========== */

/* Modal overlay and dialog */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay--open {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.modal-overlay--open .modal-dialog {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.modal-title {
  margin: 0;
  font-size: var(--font-lg);
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.modal-close:hover {
  color: var(--text);
  background: var(--surface-alt);
}

.modal-body {
  padding: var(--space-lg);
}

.modal-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border);
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
}

/* Toast container and toasts */
.toast-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  max-width: 360px;
  pointer-events: none;
}

.toast {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: var(--font-sm);
  color: var(--text);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast--visible {
  opacity: 1;
  transform: translateY(0);
}

.toast--success {
  border-left: 4px solid var(--success);
}

.toast--error {
  border-left: 4px solid var(--danger);
}

.toast--info {
  border-left: 4px solid var(--primary);
}

/* Expandable sections */
[data-expandable] {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.expandable-trigger,
[data-expandable-trigger] {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  background: var(--surface-alt);
  border: none;
  font-size: var(--font-base);
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 0.2s ease;
}

.expandable-trigger:hover,
[data-expandable-trigger]:hover {
  background: var(--border);
}

.expandable-trigger::after,
[data-expandable-trigger]::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--muted);
  transition: transform 0.2s ease;
}

.expandable-trigger--open::after,
[data-expandable][aria-expanded="true"] [data-expandable-trigger]::after {
  transform: rotate(180deg);
}

[data-expandable-content] {
  padding: var(--space-lg);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* View state: loading and error */
.view-state-active .view-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  min-height: 200px;
  padding: var(--space-xl);
  text-align: center;
}

.view-state--loading .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.view-state-message {
  margin: 0;
  color: var(--muted);
  font-size: var(--font-base);
}

.view-state--error .view-state-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(220, 38, 38, 0.1);
  color: var(--danger);
  border-radius: 50%;
  font-weight: 700;
  font-size: var(--font-xl);
}

.view-state-retry {
  margin-top: var(--space-sm);
}

/* Status badges */
.badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  border-radius: 999px;
  font-size: var(--font-xs);
  font-weight: 600;
}

.badge--success,
.status-badge--success {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.badge--warning,
.status-badge--warning {
  background: rgba(217, 119, 6, 0.15);
  color: var(--warning);
}

.badge--error,
.status-badge--error {
  background: rgba(220, 38, 38, 0.15);
  color: var(--danger);
}

.badge--info,
.status-badge--info {
  background: rgba(37, 99, 235, 0.15);
  color: var(--primary);
}

/* Progress bar (linear) */
.progress-bar {
  height: 8px;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent-red));
  border-radius: 999px;
  transition: width 0.3s ease;
}

@media (prefers-reduced-motion: reduce) {
  .modal-dialog,
  .toast,
  .progress-bar__fill,
  .spinner {
    transition: none;
  }
  .toast--visible {
    opacity: 1;
    transform: none;
  }
  @keyframes spin {
    to {
      transform: rotate(360deg);
    }
  }
}

/* Auth modal (page modal) - ensure it uses overlay pattern */
#auth-modal.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

#auth-modal .modal-content {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 400px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Responsive Design */
@media (max-width: 900px) {
  .grid-2,
  .grid-3,
  .form-grid.two {
    grid-template-columns: 1fr;
  }

  .nav-links {
    width: 100%;
    justify-content: flex-start;
  }

  .app-header .container {
    flex-wrap: wrap;
  }

  .navbar {
    order: 3;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .navbar.active {
    max-height: 500px;
    margin-top: 16px;
  }

  .navbar-list {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }

  .nav-toggle-btn {
    display: flex;
  }

  .header-actions {
    margin-left: auto;
  }

  .footer-content {
    grid-template-columns: 1fr;
  }

  .h1 {
    font-size: 2rem;
  }

  .h2 {
    font-size: 1.75rem;
  }

  .input-wrapper {
    grid-template-columns: 1fr;
  }

  .contact-list {
    grid-template-columns: 1fr;
  }
}

/* Header & nav: tablet and below */
@media (max-width: 768px) {
  .app-header .container {
    padding-top: var(--space-md);
    padding-bottom: var(--space-md);
    gap: var(--space-sm);
  }

  .brand {
    font-size: 1rem;
    order: 1;
  }

  .brand-badge {
    padding: 4px 10px;
    font-size: 0.75rem;
  }

  .brand-logo-img {
    height: 36px;
    max-width: 120px;
  }

  .app-header .header-actions {
    order: 2;
    margin-left: auto;
  }

  .nav-links {
    gap: 6px;
    order: 3;
    width: 100%;
    margin-top: 2px;
  }

  .nav-button {
    padding: 6px 10px;
    font-size: var(--font-xs);
  }

  .header-actions .button,
  .header-actions .pill {
    font-size: var(--font-xs);
    padding: 6px 10px;
  }

  /* Exam guide: tablet */
  .page-exam-guide .main {
    padding-top: var(--space-lg);
    padding-bottom: var(--space-xl);
  }

  .exam-guide-title {
    font-size: var(--font-xl);
  }

  .exam-guide-header {
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-md);
  }

  .guide-section h2 {
    font-size: var(--font-base);
  }

  .guide-formula {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-xs);
  }

  .guide-section-highlight {
    padding: var(--space-md);
  }
}

/* Small phones and narrow viewports */
@media (max-width: 480px) {
  .container {
    width: 100%;
    padding-left: var(--space-sm);
    padding-right: var(--space-sm);
  }

  .app-header .container {
    padding-left: var(--space-sm);
    padding-right: var(--space-sm);
  }

  .brand a:not(.brand-logo-link) {
    display: none;
  }

  .nav-links {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    margin-top: 4px;
    gap: 4px;
  }

  .nav-links .nav-button {
    flex-shrink: 0;
    white-space: nowrap;
  }

  .header-actions {
    gap: 6px;
  }

  .header-actions .button:not(.button--primary):not(.button--outline) {
    padding: 6px 8px;
    font-size: 0.7rem;
  }

  /* Exam guide: mobile */
  .page-exam-guide .main {
    padding-top: var(--space-md);
    padding-bottom: var(--space-lg);
  }

  .exam-guide-title {
    font-size: var(--font-lg);
  }

  .exam-guide-subtitle {
    font-size: var(--font-sm);
  }

  .guide-section {
    margin-bottom: var(--space-lg);
  }

  .guide-formula {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius);
    border-left-width: 3px;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .guide-checklist li,
  .guide-list-compact li {
    font-size: var(--font-xs);
    padding-left: 1.25rem;
  }

  .guide-section-highlight {
    padding: var(--space-md);
  }

  .guide-encourage {
    font-size: var(--font-sm);
  }

  .footer-note {
    font-size: 0.8rem;
    padding: 0 var(--space-sm);
    margin-top: var(--space-xl);
  }
}

/* Very small screens: minimal overflow safety */
@media (max-width: 360px) {
  .container {
    padding-left: var(--space-xs);
    padding-right: var(--space-xs);
  }

  .exam-guide-title {
    font-size: var(--font-base);
  }

  .guide-formula {
    padding: var(--space-xs) var(--space-sm);
  }
}

/* Large screens: comfortable reading width for exam guide */
@media (min-width: 1200px) {
  .page-exam-guide .main {
    max-width: 760px;
  }
}
