/* =====================================================
   ABCsuite Design System
   Premium Dark Mode + Birkenbihl-inspired aesthetics
   ===================================================== */

/* --- CSS Custom Properties --- */
:root {
  /* Colors: Deep Space + Electric Accents */
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: #1a1f35;
  --bg-card-hover: #222845;
  --bg-input: #0d1224;
  --bg-glass: rgba(26, 31, 53, 0.85);

  --text-primary: #e8ecf4;
  --text-secondary: #8b95b0;
  --text-muted: #5a6380;
  --text-accent: #60a5fa;

  --accent-primary: #3b82f6;
  --accent-secondary: #8b5cf6;
  --accent-success: #22c55e;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;
  --accent-glow: rgba(59, 130, 246, 0.15);

  /* Timer gradient */
  --timer-start: #3b82f6;
  --timer-end: #8b5cf6;

  /* Letter states */
  --letter-empty: #2a3050;
  --letter-filled: #22c55e;
  --letter-active: #3b82f6;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 50%;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.2);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset + Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* --- App Shell --- */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* --- Header --- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: var(--space-sm) var(--space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.header-logo svg {
  width: 28px;
  height: 28px;
  color: var(--accent-primary);
}

.header-title {
  font-size: 1.1rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* --- Main Content --- */
.main {
  flex: 1;
  padding: var(--space-md);
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

/* --- Bottom Navigation --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: space-around;
  padding: var(--space-xs) 0;
  padding-bottom: max(var(--space-xs), env(safe-area-inset-bottom));
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-xs) var(--space-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.65rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
  cursor: pointer;
  border: none;
  background: none;
}

.nav-item svg {
  width: 22px;
  height: 22px;
}

.nav-item.active {
  color: var(--accent-primary);
}

.nav-item:hover {
  color: var(--text-primary);
}

/* --- ABC Grid: 2-column layout --- */
.abc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.abc-column {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.abc-row {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: 36px;
}

.abc-letter {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--letter-empty);
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.abc-letter.filled {
  background: var(--letter-filled);
  color: var(--bg-primary);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.3);
}

.abc-letter.active {
  background: var(--letter-active);
  color: white;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
  transform: scale(1.1);
}

/* --- Slots per letter --- */
.abc-slots {
  display: flex;
  gap: 4px;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
}

.abc-slot {
  flex: 1;
  min-width: 60px;
  max-width: 120px;
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  padding: 4px 8px;
  outline: none;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  height: 30px;
  text-align: center;
}

.abc-slot:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-glow);
  background: rgba(59, 130, 246, 0.05);
}

.abc-slot::placeholder {
  color: var(--text-muted);
  opacity: 0.3;
}

.abc-slot.filled-slot {
  background: rgba(59, 130, 246, 0.12);
  color: var(--text-accent);
  font-weight: 600;
  border-color: rgba(59, 130, 246, 0.25);
}

.abc-slot.filled-slot:read-only {
  cursor: default;
}

.abc-slot.post-timer-entry {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.3);
  font-style: italic;
}

/* Mobile: stack to 1 column */
@media (max-width: 600px) {
  .abc-grid {
    grid-template-columns: 1fr;
  }

  .abc-slot {
    min-width: 50px;
  }
}

/* --- Timer Bar --- */
.timer-bar-container {
  position: relative;
  height: 6px;
  background: var(--bg-card);
  border-radius: 3px;
  overflow: hidden;
}

.timer-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--timer-start), var(--timer-end));
  border-radius: 3px;
  transition: width 1s linear;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

.timer-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* --- Timer Presets --- */
.timer-presets {
  display: flex;
  gap: var(--space-xs);
  margin-top: var(--space-sm);
  justify-content: center;
}

.timer-preset {
  padding: var(--space-xs) var(--space-md);
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: 20px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.timer-preset:hover {
  background: var(--bg-card-hover);
}

.timer-preset.active {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.1);
}

/* --- Play Top Bar (during active game) --- */
.play-top-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  margin-bottom: var(--space-xs);
}

.play-topic-label {
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-accent);
}

/* --- Fullscreen Play Mode --- */
#app.app-playing .header {
  display: none !important;
}

#app.app-playing .bottom-nav {
  display: none !important;
}

#app.app-playing .mode-selector {
  display: none !important;
}

#app.app-playing .topic-section {
  display: none !important;
}



#app.app-playing .view#viewPlay {
  padding-top: env(safe-area-inset-top, 8px);
  padding-bottom: var(--space-sm);
}

#app.app-playing .abc-grid {
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Warning button for Fertig */
.btn-warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

/* --- Mode Selector --- */
.mode-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.mode-card {
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  padding: var(--space-md);
  cursor: pointer;
  transition: all var(--transition-normal);
  text-align: center;
}

.mode-card:hover {
  background: var(--bg-card-hover);
}

.mode-card.selected {
  border-color: var(--accent-primary);
  border-width: 3px;
  background: rgba(59, 130, 246, 0.15);
  box-shadow: var(--shadow-glow), 0 0 20px rgba(59, 130, 246, 0.2);
  transform: scale(1.02);
  position: relative;
}

.mode-card.selected .mode-card-title {
  color: var(--accent-primary);
}

.mode-card.selected::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.15);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mode-card-icon {
  font-size: 1.5rem;
  margin-bottom: var(--space-xs);
}

.mode-card-title {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 2px;
}

.mode-card-desc {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* --- Topic Input --- */
.topic-section {
  margin-bottom: var(--space-lg);
}

.topic-input {
  width: 100%;
  background: var(--bg-card);
  border: 2px solid var(--bg-card);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1.15rem;
  font-weight: 600;
  padding: var(--space-md) var(--space-lg);
  outline: none;
  transition: border-color var(--transition-fast);
  text-align: center;
}

.topic-input:focus {
  border-color: var(--accent-primary);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
}

.btn-lg {
  padding: var(--space-md) var(--space-xl);
  font-size: 1.1rem;
  border-radius: var(--radius-lg);
}

.btn-full {
  width: 100%;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-full);
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-normal);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
}

/* --- Stats Row --- */
.stats-row {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  margin: var(--space-lg) 0;
}

.stat {
  text-align: center;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  min-width: 80px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent-primary);
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* --- Streak Fire --- */
.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.82rem;
  color: white;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.streak-badge:hover {
  transform: scale(1.08);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}


/* --- Dashboard --- */
.dash-greeting {
  margin-bottom: 20px;
}

.dash-greeting h2 {
  font-size: 1.3rem;
  margin: 0;
}

.dash-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 24px;
}

.dash-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  text-align: center;
  transition: transform 0.15s ease;
}

.dash-stat-card:hover {
  transform: translateY(-2px);
}

.dash-stat-streak {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(239, 68, 68, 0.12));
  border-color: rgba(245, 158, 11, 0.25);
}

.dash-stat-icon {
  font-size: 1.3rem;
  margin-bottom: 4px;
}

.dash-stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.dash-stat-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.dash-section {
  margin-bottom: 20px;
}

.dash-section h3 {
  font-size: 0.95rem;
  margin: 0 0 12px 0;
  color: var(--text-primary);
}

.dash-quickstart {
  display: flex;
  gap: 8px;
  align-items: center;
}

.dash-recent-topic {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

/* Changelog */
.dash-changelog summary {
  list-style: none;
  user-select: none;
}

.dash-changelog summary::-webkit-details-marker {
  display: none;
}

.dash-changelog summary::before {
  content: '▶ ';
  font-size: 0.7rem;
  transition: transform 0.15s;
}

.dash-changelog[open] summary::before {
  content: '▼ ';
}

.changelog-entry {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-primary);
}

.changelog-entry:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.changelog-version {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-accent);
  margin-bottom: 6px;
}

.changelog-date {
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-left: 6px;
}

.changelog-entry ul {
  margin: 0;
  padding-left: 20px;
  font-size: 0.8rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.changelog-entry li {
  margin-bottom: 2px;
}


/* --- Hint Banner --- */
.hint-banner {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-accent);
  margin-bottom: var(--space-md);
  animation: hintPulse 3s ease-in-out infinite;
}

@keyframes hintPulse {

  0%,
  100% {
    opacity: 0.8;
  }

  50% {
    opacity: 1;
  }
}

/* --- Density Bar --- */
.density-bar {
  height: 8px;
  background: var(--bg-card);
  border-radius: 4px;
  overflow: hidden;
  margin-top: var(--space-sm);
}

.density-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-danger), var(--accent-warning), var(--accent-success));
  border-radius: 4px;
  transition: width var(--transition-slow);
}

/* --- View transitions --- */
.view {
  display: none;
}

.view.active {
  display: block;
  animation: viewFadeIn 300ms ease;
  padding-bottom: 120px;
}

@keyframes viewFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Lists --- */
.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.list-item:hover {
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateX(4px);
}

.list-item-density {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.list-item-info {
  flex: 1;
}

.list-item-topic {
  font-weight: 600;
  font-size: 0.95rem;
}

.list-item-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card);
  color: var(--text-primary);
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-lg);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  opacity: 0;
  transition: all var(--transition-normal);
  z-index: 200;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- Login/Auth --- */
.auth-container {
  max-width: 360px;
  margin: var(--space-2xl) auto;
}

.auth-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  padding: var(--space-md);
  outline: none;
  margin-bottom: var(--space-md);
  transition: border-color var(--transition-fast);
}

.auth-input:focus {
  border-color: var(--accent-primary);
}

/* --- Responsive --- */
@media (max-width: 480px) {
  .mode-selector {
    grid-template-columns: 1fr;
  }

  .stats-row {
    flex-wrap: wrap;
  }

  .main {
    padding: var(--space-sm);
  }

  .abc-letter {
    width: 30px;
    height: 30px;
    font-size: 0.82rem;
  }
}

@media (min-width: 768px) {
  .main {
    padding: var(--space-xl);
  }
}

/* --- Safe Area for bottom nav --- */
.main {
  padding-bottom: 80px;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-card);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* --- Modal Overlay --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  animation: modalFadeIn 200ms ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  max-width: 520px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.6);
  animation: modalSlideIn 250ms ease;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
}

.modal-close {
  font-size: 1.3rem;
  width: 32px;
  height: 32px;
}

/* --- Export Grid --- */
.export-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
}

.export-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-lg) var(--space-md);
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all var(--transition-fast);
}

.export-btn:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.export-btn-icon {
  font-size: 1.6rem;
}

.export-btn-label {
  font-size: 0.82rem;
  font-weight: 600;
}

.export-btn-wide {
  grid-column: 1 / -1;
}

.export-preview {
  margin-top: var(--space-md);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: var(--space-md);
}

/* --- Compare View --- */
.compare-select {
  flex: 1;
  min-width: 140px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  padding: var(--space-sm) var(--space-md);
  outline: none;
}

.compare-select:focus {
  border-color: var(--accent-primary);
}

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

@media (max-width: 600px) {
  .compare-grid {
    grid-template-columns: 1fr;
  }
}

.compare-col-header {
  font-weight: 700;
  font-size: 0.9rem;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-sm);
  text-align: center;
}

.compare-row {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 2px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.compare-letter {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.7rem;
  border-radius: 3px;
  background: var(--letter-empty);
  color: var(--text-muted);
  flex-shrink: 0;
}

.compare-letter.filled {
  background: var(--letter-filled);
  color: var(--bg-primary);
}

.compare-terms {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.compare-term {
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.compare-term.overlap {
  background: rgba(34, 197, 94, 0.15);
  color: var(--accent-success);
  font-weight: 600;
}

/* --- Glaubenssatz Module --- */
.gs-phases {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.gs-phase {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  background: var(--bg-card);
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.gs-phase.active {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent-primary);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.2);
}

.gs-phase-num {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--bg-card-hover);
  font-size: 0.7rem;
  font-weight: 700;
}

.gs-phase.active .gs-phase-num {
  background: var(--accent-primary);
  color: white;
}

.gs-phase-arrow {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.gs-crossmap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gs-crossmap-header {
  display: grid;
  grid-template-columns: 28px 1fr 1fr 1fr;
  gap: var(--space-sm);
  padding: var(--space-sm);
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-sm);
}

.gs-crossmap-col-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
}

.gs-crossmap-row {
  display: grid;
  grid-template-columns: 28px 1fr 1fr 1fr;
  gap: var(--space-sm);
  align-items: center;
  padding: var(--space-xs) 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.gs-crossmap-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  font-size: 0.78rem;
}

.gs-transfer-input {
  font-size: 0.78rem !important;
  padding: 4px 8px !important;
  min-height: 28px !important;
}

@media (max-width: 600px) {

  .gs-crossmap-header,
  .gs-crossmap-row {
    grid-template-columns: 24px 1fr 1fr;
  }

  .gs-crossmap-header> :nth-child(4),
  .gs-crossmap-row> :nth-child(4) {
    grid-column: 1 / -1;
  }

  .gs-phases {
    flex-wrap: wrap;
  }

  .gs-phase-arrow {
    display: none;
  }
}

/* --- Force Graph --- */
#graphContainer {
  position: relative;
  overflow: hidden;
}

.graph-tooltip {
  position: absolute;
  z-index: 50;
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  pointer-events: none;
  max-width: 220px;
  animation: tooltipFadeIn 150ms ease;
}

@keyframes tooltipFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.graph-stats-bar {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  padding: var(--space-sm) 0;
  margin-bottom: var(--space-sm);
}

.graph-node circle {
  transition: opacity 150ms ease, r 150ms ease;
}

.edges line {
  transition: stroke-opacity 150ms ease, stroke-width 150ms ease;
}

/* =====================================================
   Help Page
   ===================================================== */

.help-container {
  max-width: 640px;
  margin: 0 auto;
}

.help-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-sm);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.help-section[open] {
  border-color: rgba(59, 130, 246, 0.2);
}

.help-section-title {
  padding: var(--space-md) var(--space-lg);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
  transition: background 0.15s ease;
}

.help-section-title:hover {
  background: rgba(255, 255, 255, 0.03);
}

.help-section-title::after {
  content: '▸';
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.help-section[open]>.help-section-title::after {
  transform: rotate(90deg);
}

.help-section-title::-webkit-details-marker {
  display: none;
}

.help-section-body {
  padding: 0 var(--space-lg) var(--space-lg);
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.65;
}

.help-section-body p {
  margin-bottom: 8px;
}

.help-section-body ul,
.help-section-body ol {
  padding-left: 20px;
  margin-bottom: 12px;
}

.help-section-body li {
  margin-bottom: 6px;
}

.help-section-body strong {
  color: var(--text-primary);
}

.help-tip {
  background: rgba(59, 130, 246, 0.08);
  border-left: 3px solid var(--accent-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 10px 14px;
  margin-top: 12px;
  font-size: 0.88rem;
  color: var(--text-accent);
}

.help-steps {
  counter-reset: step;
  list-style: none;
  padding-left: 0;
}

.help-steps li {
  counter-increment: step;
  padding-left: 36px;
  position: relative;
  margin-bottom: 12px;
}

.help-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.help-mode {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.help-mode:last-child {
  border-bottom: none;
}

.help-mode-emoji {
  font-size: 28px;
  flex-shrink: 0;
  margin-top: 2px;
}

.help-mode p {
  margin-bottom: 0;
  margin-top: 4px;
}

.help-faq {
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.help-faq:last-child {
  border-bottom: none;
}

.help-faq strong {
  display: block;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.help-faq p {
  margin-bottom: 0;
  color: var(--text-secondary);
}