/* GCSE Revision Hub - Subject Viewer Styles */
/* Specific styles for the universal subject viewer page */

/* ==============================================
   Unified Header Overrides (Subject Viewer)
   ============================================== */

body {
  --unit-accent: rgba(59, 130, 246, 0.18);
  --unit-accent-strong: rgba(59, 130, 246, 0.35);
  --topic-accent: rgba(59, 130, 246, 0.12);
  --topic-accent-strong: rgba(59, 130, 246, 0.28);
  --topic-learn-color: var(--accent);
  --topic-flashcard-color: #8b5cf6;
  --topic-quiz-color: var(--warning);
}

body:has(#theme-toggle:checked) {
  --unit-accent: rgba(59, 130, 246, 0.08);
  --unit-accent-strong: rgba(59, 130, 246, 0.22);
  --topic-accent: rgba(59, 130, 246, 0.06);
  --topic-accent-strong: rgba(59, 130, 246, 0.18);
}

/* ==============================================
   Subject Toolbar
   ============================================== */

.subject-toolbar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin: var(--space-lg) 0 var(--space-md);
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-md);
  padding-right: var(--space-md);
}

.subject-toolbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-sm);
  width: 100%;
}

.subject-toolbar-search {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  flex: 1;
  min-width: 0;
}

.subject-toolbar-search input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: var(--font-sm);
  outline: none;
}

.subject-toolbar-search input::placeholder {
  color: var(--text-muted);
}

.subject-toolbar .topic-menu-btn {
  color: var(--text-secondary);
}

.subject-toolbar .topic-menu-btn:hover:not(:disabled) {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.subject-toolbar .topic-menu-btn svg {
  stroke: currentColor;
}

/* ==============================================
   Topic Selector Panel (Sidebar)
   ============================================== */

.topic-panel.sidebar {
  position: fixed;
  top: 96px;
  left: 0;
  width: 320px;
  max-height: calc(100vh - 96px);
  background: var(--bg-primary);
  border-right: 1px solid var(--border);
  border-radius: 0 16px 16px 0;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  z-index: 200;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-100%);
  transition: transform var(--transition-normal), opacity var(--transition-normal), visibility var(--transition-normal);
}

#sidebar-toggle:checked ~ .page-wrapper .topic-panel.sidebar {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

.sidebar-overlay {
  top: 96px;
}

.topic-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-md) var(--space-sm);
  border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
}

.topic-panel-title {
  font-size: var(--font-base);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.2px;
}

.topic-panel-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.topic-panel-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.topic-panel-close svg {
  width: 18px;
  height: 18px;
}

.topic-panel-meta {
  padding: 0 var(--space-md) var(--space-md);
  border-bottom: 1px solid var(--border);
}

.topic-panel-subject {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.topic-panel-spec {
  font-size: var(--font-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

.topic-panel-search {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}

.topic-panel-search-icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.topic-panel-search input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: var(--font-sm);
  outline: none;
}

.topic-panel-search input::placeholder {
  color: var(--text-muted);
}

.topic-panel-nav {
  overflow-y: auto;
  padding: var(--space-sm) 0 var(--space-md);
}

.topic-panel .sidebar-section-title {
  color: var(--text-primary);
  font-size: var(--font-sm);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
}

.topic-panel details.sidebar-section > summary {
  padding: 10px var(--space-md);
}

.topic-panel .sidebar-chevron svg {
  width: 16px;
  height: 16px;
  transition: transform var(--transition-fast);
}

.topic-panel details.sidebar-section[open] .sidebar-chevron svg {
  transform: rotate(180deg);
}

.topic-panel .sidebar-links {
  padding: 0 var(--space-md) var(--space-sm);
}

.topic-panel .sidebar-link {
  display: flex;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: var(--font-sm);
}

.topic-panel .sidebar-link:hover,
.topic-panel .sidebar-link.active {
  background: var(--bg-hover);
  color: var(--text-primary);
}

@media (max-width: 900px) {
  .topic-panel.sidebar {
    width: min(320px, 92vw);
  }
}

/* ==============================================
   Content Width Constraint (for readability)
   ============================================== */

/* Constrain main content area to 800px for better readability */
.main-header,
.main-content .container {
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-md);
  padding-right: var(--space-md);
}

/* Breadcrumb also constrained for alignment */
.main-content .breadcrumb {
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-md);
  padding-right: var(--space-md);
}

/* ==============================================
   Breadcrumb Navigation
   ============================================== */

.breadcrumb {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
  padding: 0.75rem 0;
  background: transparent;
  border-bottom: none;
}

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

.breadcrumb a:hover {
  color: var(--accent-primary);
}

.breadcrumb .separator {
  margin: 0 var(--space-xs);
  color: var(--text-muted);
  user-select: none;
}

.breadcrumb span:not(.separator) {
  color: var(--text-secondary);
}

/* ==============================================
   Loading State
   ============================================== */

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl) var(--space-md);
  min-height: 300px;
}

.loading-state p {
  margin-top: var(--space-md);
  color: var(--text-secondary);
  font-size: var(--font-base);
}

/* Spinner Animation */
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ==============================================
   Error State
   ============================================== */

.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl) var(--space-md);
  text-align: center;
  min-height: 300px;
}

.error-state.hidden {
  display: none;
}

.error-state h2 {
  color: var(--error);
  font-size: var(--font-xl);
  margin-bottom: var(--space-md);
}

.error-state p {
  color: var(--text-secondary);
  font-size: var(--font-base);
  margin-bottom: var(--space-lg);
  max-width: 500px;
}

/* ==============================================
   Mobile Responsiveness
   ============================================== */

@media (max-width: 768px) {
  /* Reduce padding on mobile for more content space */
  .main-header,
  .main-content .container,
  .main-content .breadcrumb {
    padding-left: var(--space-sm);
    padding-right: var(--space-sm);
  }

  .breadcrumb {
    font-size: 0.8125rem;
    padding: 0.5rem 0;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .breadcrumb .separator {
    margin: 0 0.25rem;
  }

  .loading-state,
  .error-state {
    padding: var(--space-xl) var(--space-md);
    min-height: 200px;
  }

  .spinner {
    width: 40px;
    height: 40px;
    border-width: 3px;
  }

  .error-state h2 {
    font-size: var(--font-lg);
  }
}

/* ==============================================
   Utility Classes
   ============================================== */

.hidden {
  display: none !important;
}

/* ==============================================
   Dynamic Content Fade-in
   ============================================== */

.content-loaded {
  animation: fadeIn 0.3s ease-in;
}

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

/* ==============================================
   Subject Overview (Stats & Actions)
   ============================================== */

.subject-overview {
  max-width: 800px;
  margin: 0 auto var(--space-lg) auto;
  padding: 0 var(--space-md);
}

.subject-stats {
  margin-bottom: var(--space-lg);
}

/* Subject progress cards (match home subject cards) */
.subject-card-stats--overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-md);
}

@media (max-width: 480px) {
  .subject-card-stats--overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.subject-card-stats--overview .subject-card-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(15, 23, 42, 0.06);
  text-align: center;
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .subject-card-stats--overview .subject-card-stat {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

.subject-card-stats--overview .subject-card-stat-icon {
  display: inline-flex;
  width: 28px;
  height: 28px;
}

.subject-card-stats--overview .subject-card-stat-icon svg {
  width: 28px;
  height: 28px;
}

.subject-card-stats--overview .subject-card-stat-count {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.subject-card-stats--overview .subject-card-stat--learn .subject-card-stat-icon {
  color: #2563eb;
}

.subject-card-stats--overview .subject-card-stat--review .subject-card-stat-icon {
  color: #a855f7;
}

.subject-card-stats--overview .subject-card-stat--quiz .subject-card-stat-icon {
  color: #eab308;
}

.subject-card-stats--overview .subject-card-stat--mastery .subject-card-stat-icon {
  color: #10b981;
}

/* F-084: Dual mastery bars for KS3 students */
.dual-mastery-bars {
  margin-top: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .dual-mastery-bars {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

.dual-mastery-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dual-mastery-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.dual-mastery-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.dual-mastery-row--primary .dual-mastery-title {
  color: #2563eb;
}

.dual-mastery-row--secondary .dual-mastery-title {
  color: #10b981;
}

.dual-mastery-value {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.dual-mastery-bar {
  height: 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

[data-theme="dark"] .dual-mastery-bar {
  background: rgba(255, 255, 255, 0.1);
}

.dual-mastery-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
  min-width: 0;
}

.dual-mastery-fill--year {
  background: linear-gradient(90deg, #3b82f6, #2563eb);
}

.dual-mastery-fill--gcse {
  background: linear-gradient(90deg, #34d399, #10b981);
}

.dual-mastery-detail {
  font-size: 0.7rem;
  color: var(--text-tertiary, var(--text-secondary));
  opacity: 0.8;
}

.subject-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
}

.subject-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--font-base);
  font-weight: 600;
}

.subject-actions .btn svg {
  flex-shrink: 0;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
  .subject-overview {
    padding: 0 var(--space-sm);
  }

  .subject-stats {
    margin-bottom: var(--space-md);
  }

  .subject-card-stats--overview {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-sm);
  }

  .subject-card-stats--overview .subject-card-stat {
    padding: 12px 10px;
  }

  .subject-card-stats--overview .subject-card-stat-count {
    font-size: 1.05rem;
  }

  .subject-actions {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .subject-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ==============================================
   Unit Level Display
   ============================================== */

details.unit {
  background: var(--bg-subtle, var(--bg-secondary));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  border-top: 3px solid var(--unit-accent-strong);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

details.unit > summary.unit-summary {
  background: linear-gradient(90deg, var(--unit-accent), transparent 65%);
  border-bottom: 1px solid var(--border);
  display: grid;
  gap: var(--space-md);
  padding: var(--space-lg);
  list-style: none;
  align-items: start;
  justify-items: stretch;
}

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

.unit-header {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  align-items: start;
  gap: var(--space-lg);
  width: 100%;
}

.unit-header-left {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  min-width: 0;
  padding-right: var(--space-sm);
}

.unit-title-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
}

.unit-label {
  font-size: var(--font-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}

.unit-title {
  font-size: var(--font-lg);
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.unit-description {
  font-size: var(--font-sm);
  color: var(--text-muted);
  margin: 0;
}

.unit-header-actions {
  display: flex;
  justify-content: flex-end;
  width: 100%;
}

.unit-chevron {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: background var(--transition-fast), color var(--transition-fast);
  margin-left: var(--space-sm);
}

details.unit > summary.unit-summary:hover .unit-chevron {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.unit-chevron svg {
  width: 18px;
  height: 18px;
  transition: transform var(--transition-fast);
}

details.unit[open] .unit-chevron svg {
  transform: rotate(180deg);
}

/* Topic containers — clean flat list */
details.topic {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  margin: 0;
  box-shadow: none;
}

details.topic summary.topic-header {
  background: none;
  border-left: none;
  border-radius: 0;
  position: relative;
}

details.topic[open] summary.topic-header {
  border-left: none;
}

.unit-metrics {
  display: flex;
  gap: var(--space-sm);
  align-items: stretch;
  justify-content: flex-end;
  opacity: 0.7;
}

.unit-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  min-height: auto;
  width: 72px;
  text-align: center;
  cursor: default;
  pointer-events: none;
}

.unit-metric-icon {
  width: 20px;
  height: 20px;
  color: var(--text-tertiary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  filter: saturate(0.35);
}

.unit-metric-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
}

.unit-metric-icon svg * {
  stroke: currentColor;
}

.unit-metric-icon svg text {
  fill: currentColor;
}

.unit-metric--learn .unit-metric-icon {
  color: color-mix(in srgb, var(--color-primary) 35%, var(--text-tertiary));
}

.unit-metric--review .unit-metric-icon {
  color: color-mix(in srgb, var(--color-secondary) 35%, var(--text-tertiary));
}

.unit-metric--quiz .unit-metric-icon {
  color: color-mix(in srgb, var(--color-warning) 35%, var(--text-tertiary));
}

.unit-metric-value {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-tertiary);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

@media (max-width: 768px) {
  details.unit > summary.unit-summary {
    padding: var(--space-md);
  }

  .unit-header {
    grid-template-columns: 1fr;
    align-items: flex-start;
    gap: var(--space-md);
  }

  .unit-header-actions {
    width: 100%;
    justify-content: space-between;
    display: flex;
    align-items: flex-start;
  }

  .unit-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-sm);
    width: 100%;
  }

  .unit-metric {
    width: 100%;
  }

  .unit-chevron {
    margin-left: auto;
  }

  .subject-toolbar {
    margin: var(--space-md) 0;
  }

  .subject-toolbar-right {
    width: 100%;
  }

  .subject-toolbar-search {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .unit-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }
}

/* Ensure topic icon is visible in subject viewer */
.topic-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

/* ==============================================
   Topic Header Display
   ============================================== */

details.topic summary.topic-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 12px var(--space-md);
  position: relative;
  padding-right: 48px; /* space for chevron */
}

/* Title: fills remaining space, never disappears */
.topic-header-left {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 80px;
  overflow: hidden;
}

.topic-header .topic-info {
  min-width: 0;
}

.topic-header .topic-title {
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Actions: single row next to title */
.topic-header .topic-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Topic chevron — matches unit-chevron style, positioned top-right */
.topic-header .chevron {
  position: absolute;
  top: 12px;
  right: var(--space-md);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: transparent;
  font-size: 0.65rem;
  transition: background var(--transition-fast), color var(--transition-fast), transform 200ms ease;
  flex-shrink: 0;
  margin: 0;
}

details.topic > summary.topic-header:hover .chevron {
  background: var(--bg-hover);
  color: var(--text-primary);
}

details.topic[open] > summary.topic-header .chevron {
  transform: rotate(180deg);
  color: var(--text-primary);
}

.topic-header .topic-action-btn {
  background: color-mix(in srgb, var(--bg-hover) 65%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  padding: 6px;
  min-width: 0;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  box-shadow: none;
  transition: transform 150ms ease, color 150ms ease, background 150ms ease, border-color 150ms ease;
}

.topic-header .topic-action-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: var(--border);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
  transform: translateY(-1px);
  color: var(--text-primary);
}

.topic-header .topic-action-btn:disabled {
  opacity: 0.45;
}

.topic-header .topic-action-btn.is-complete .icon {
  color: var(--success);
}

@media (prefers-reduced-motion: reduce) {
  .topic-header .topic-action-btn {
    transition: none;
  }
}

.topic-header .topic-action-btn:hover:not(:disabled) .btn-count {
  color: var(--text-primary);
}

.topic-header .topic-action-btn .btn-label,
.topic-header .topic-action-btn .btn-count {
  display: none;
}

.topic-header .topic-action-btn .icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  transition: color 150ms ease;
}

.topic-header .topic-action-btn.is-complete .btn-count {
  color: var(--text-primary);
}

.topic-header .learn-btn .icon {
  color: var(--topic-learn-color);
}

.topic-header .flashcard-btn .icon {
  color: var(--topic-flashcard-color);
}

.topic-header .quiz-btn .icon {
  color: var(--topic-quiz-color);
}

.topic-mastery {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 52px;
  color: var(--text-muted);
}

.topic-mastery-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

.topic-mastery-text {
  font-size: var(--font-xs);
  font-weight: 600;
}

/* Topic completion footer */
.topic-complete-footer {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.topic-complete-status {
  font-size: var(--font-sm);
  color: var(--text-secondary);
}

.topic-complete-btn {
  min-width: 180px;
}

.topic-complete-btn.is-complete {
  background: var(--success);
  border-color: var(--success);
}

.topic-complete-btn:disabled {
  opacity: 0.7;
  cursor: default;
}

/* Understanding modal (confidence prompt) */
.understanding-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease-out;
}

.understanding-modal.show {
  display: flex;
}

.understanding-content {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 32px;
  text-align: center;
  max-width: 360px;
  width: 90%;
  animation: scaleIn 0.3s ease-out;
}

.understanding-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 8px 0;
}

.understanding-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 24px 0;
}

.understanding-buttons {
  display: flex;
  gap: 16px;
}

.understanding-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 16px;
  border: none;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.understanding-btn svg {
  width: 32px;
  height: 32px;
}

.understanding-btn.btn-red {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.understanding-btn.btn-red:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4);
}

.understanding-btn.btn-green {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
}

.understanding-btn.btn-green:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(34, 197, 94, 0.4);
}

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

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@media (max-width: 768px) {

  .topic-complete-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .topic-complete-btn {
    width: 100%;
  }
}
