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

:root {
  /* New FLB Brand Colors */
  --flb-cyan: #0086cb;
  /* RGB 0, 134, 203 */
  --flb-blue: #00255e;
  /* RGB 0, 40, 94 */

  /* Semantic Variables - Default (Dark Mode) */
  --bg-color: var(--flb-blue);
  --text-main: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.7);
  --primary: var(--flb-cyan);
  --secondary: #10b981;
  /* Keeping green for success/correct/secondary actions */
  --quiz-accent: #f59e0b;
  --card-bg: rgba(255, 255, 255, 0.1);
  --card-border: rgba(255, 255, 255, 0.2);
  --glass-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
}

/* Light Mode Overrides */
body.light-mode {
  --bg-color: #ffffff;
  --text-main: var(--flb-blue);
  --text-muted: rgba(0, 37, 94, 0.75);
  --card-bg: rgba(0, 134, 203, 0.05);
  /* Very light cyan tint */
  --card-border: rgba(0, 40, 94, 0.15);
  --glass-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.05);
}

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

body {
  font-family: 'Calibri', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden; /* No body scroll */
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* App Header */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  z-index: 1001;
  /* Above sidebar */
  backdrop-filter: blur(10px);
}

.header-toggle-btn {
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 1.5rem;
  cursor: pointer;
  margin-right: 1rem;
  padding: 0.5rem;
  border-radius: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.header-title {
  font-size: 1.25rem;
  margin: 0;
  font-weight: 700;
}

/* Sidebar (Mobile Header) */
.sidebar {
  width: 280px;
  background: var(--card-bg);
  border-right: 1px solid var(--card-border);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  flex-shrink: 0;
  height: calc(100vh - 60px);
  /* Full height minus header */
  position: fixed;
  top: 60px;
  /* Starts below header */
  left: -280px;
  /* Hidden by default on mobile */
  z-index: 1000;
  transition: transform 0.3s ease-in-out, left 0.3s ease-in-out;
  backdrop-filter: blur(10px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sidebar.open {
  left: 0;
}

/* Desktop Sidebar Behavior (Collapsible) */
@media (min-width: 769px) {
  .sidebar {
    left: 0;
    /* Always visible by default on desktop */
    padding-top: 80px;
    transform: translateX(0);
  }

  body.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
  }

  .main-content {
    margin-left: 280px; /* Precise sidebar width */
    width: calc(100% - 280px); /* Fill remaining space */
    transition: margin-left 0.3s ease-in-out, width 0.3s ease-in-out;
  }

  body.sidebar-collapsed .main-content {
    margin-left: 0;
    width: 100%;
  }

  /* Hide specific Mobile-Only header elements in sidebar if any */
  .sidebar-header-mobile {
    display: none;
  }
}

.sidebar-header-mobile {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.close-sidebar-btn {
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 2rem;
  cursor: pointer;
}



.logo-area h1 {
  font-size: 1.5rem;
  color: var(--primary);
  margin-bottom: 0.2rem;
}

.control-group label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

/* Slider Customization */
input[type=range] {
  width: 100%;
  accent-color: var(--primary);
  margin-bottom: 0.5rem;
  height: 24px;
  /* Touchable height */
}

.level-indicator {
  font-size: 0.9rem;
  color: var(--primary);
  font-weight: bold;
  text-align: center;
}

/* Unified Menu Buttons */
.nav-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-btn {
  width: 100%;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  padding: 0.8rem;
  cursor: pointer;
  border-radius: 0.25rem;
  transition: all 0.2s ease;
  font-weight: 600;
  font-size: 1rem;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.nav-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

/* Light Mode for Nav Buttons */
body.light-mode .nav-btn {
  background: #f1f5f9;
  color: var(--flb-blue);
  border: 1px solid #e2e8f0;
}

body.light-mode .nav-btn.active {
  background: var(--flb-cyan);
  color: white;
  border-color: var(--flb-cyan);
}

body.light-mode .nav-btn:hover:not(.active) {
  background: #e2e8f0;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: clamp(0.5rem, 2vmin, 1.5rem);
  padding-top: 70px; /* Slimmer header space */
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Lock viewport */
}

.main-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 10% 20%, rgba(59, 130, 246, 0.15) 0%, transparent 20%),
    radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.15) 0%, transparent 20%);
  pointer-events: none;
  z-index: -1;
}

.section {
  display: none;
  max-width: 100%;
  width: 100%;
  height: 100%;
  margin: 0 auto;
  animation: fadeIn 0.5s ease-out;
  flex-direction: column;
}

.section.active {
  display: flex;
}

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

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

/* Learning Cards */
.scenario-box {
  background: linear-gradient(135deg, rgba(0, 134, 203, 0.1), rgba(0, 134, 203, 0.05));
  /* FLB-Cyan */
  border: 1px solid rgba(0, 134, 203, 0.2);
  padding: 1.25rem;
  border-radius: 1rem;
  margin-bottom: 2rem;
  border-left: 4px solid var(--primary);
}

.layer-card {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--card-border);
  border-radius: 1rem;
  margin-bottom: 1.5rem;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: var(--glass-shadow);
}

/* Disabled hover on touch devices usually, keeping for consistency */
.layer-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.layer-header {
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--card-border);
  flex-wrap: wrap;
  /* Allow wrapping on very small screens */
  gap: 0.5rem;
  cursor: pointer;
  /* Clickable */
  user-select: none;
}

.layer-header::after {
  content: '▼';
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: transform 0.3s ease;
  margin-left: auto;
}

.layer-card.collapsed .layer-header::after {
  transform: rotate(-90deg);
}

.layer-card.collapsed .layer-header {
  border-bottom: none;
  /* Remove border when collapsed */
}

.layer-num {
  font-weight: 700;
  color: var(--primary);
  font-size: 1.1rem;
  margin-right: 0.5rem;
}

.layer-content {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  /* Stacked content on mobile */
  gap: 1.5rem;
  transition: all 0.3s ease-in-out;
  max-height: 2000px;
  /* Limit for animation */
  overflow: hidden;
  opacity: 1;
}

.layer-card.collapsed .layer-content {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  pointer-events: none;
}

.layer-info h3 {
  font-size: 0.9rem;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  margin-top: 1rem;
}

.layer-info h3:first-child {
  margin-top: 0;
}

.example-box {
  background: rgba(16, 185, 129, 0.1);
  padding: 1rem;
  border-radius: 0.5rem;
  border-left: 3px solid var(--secondary);
  font-size: 0.95rem;
}

code {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.2rem 0.4rem;
  border-radius: 0.3rem;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
  color: #fbbf24;
  word-break: break-word;
  /* Handle long codes on mobile */
}

body.light-mode code {
  background: rgba(0, 134, 203, 0.1);
  color: #b45309;
}

/* Quiz Styles */
.quiz-header {
  display: flex;
  flex-direction: column;
  /* Stacked header on mobile */
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.score-badge {
  background: var(--quiz-accent);
  color: black;
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  font-weight: bold;
  align-self: flex-start;
}

.question-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  padding: 1.5rem;
  border-radius: 1rem;
}

.question-text {
  font-size: 1.15rem;
  margin-bottom: 1.5rem;
  font-weight: 600;
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.option-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  padding: 1rem;
  /* Good touch target */
  border-radius: 0.5rem;
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
}

.option-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary);
}

.option-btn.selected {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.2);
}

.option-btn.correct {
  border-color: var(--secondary);
  background: rgba(16, 185, 129, 0.2);
}

.option-btn.wrong {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.2);
}

.feedback-area {
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: 0.5rem;
  animation: fadeIn 0.3s;
}

.feedback-correct {
  background: rgba(16, 185, 129, 0.1);
  color: var(--secondary);
  border: 1px solid var(--secondary);
}

.feedback-wrong {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid #ef4444;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 1rem 1.5rem;
  /* Larger touch area */
  border-radius: 0.5rem;
  cursor: pointer;
  font-weight: 600;
  margin-top: 1.5rem;
  width: 100%;
}

.btn-primary:active {
  transform: scale(0.98);
}

/* Utils */
.hidden {
  display: none !important;
}

/* Interactive Elements */
.interactive-item {
  cursor: pointer;
  border-bottom: 1px dashed var(--text-muted);
  transition: all 0.2s;
  margin-right: 0.5rem;
  display: inline-block;
  padding: 2px 0;
  /* Slight padding for touch */
}

.interactive-item:hover {
  color: var(--primary);
  border-bottom: 1px solid var(--primary);
}

.match-item.status-correct {
  border: 2px solid var(--secondary) !important;
  background: rgba(16, 185, 129, 0.2) !important;
}

.match-item.status-wrong {
  border: 2px solid #ef4444 !important;
  background: rgba(239, 68, 68, 0.2) !important;
}

/* Detail Views */
.detail-container {
  padding: 0 1.25rem 1.25rem 1.25rem;
  animation: slideDown 0.3s ease-out;
}

.detail-box {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--card-border);
  border-radius: 0.5rem;
  padding: 1rem;
  margin-top: 0.5rem;
  position: relative;
  box-shadow: var(--glass-shadow);
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 2rem;
  /* Easy to tap */
  cursor: pointer;
  line-height: 1;
  padding: 0 0.5rem;
}

.close-btn:hover {
  color: white;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

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

/* Glossary & Tooltips */
.glossary-term {
  border-bottom: 1px dotted var(--text-muted);
  cursor: help;
  position: relative;
  color: #a5f3fc;
  font-weight: 500;
}

body.light-mode .glossary-term {
  color: var(--flb-blue);
  border-bottom-color: var(--flb-blue);
}

.glossary-term::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #e2e8f0;
  padding: 0.5rem 0.8rem;
  border-radius: 6px;
  font-size: 0.85rem;
  white-space: normal;
  width: max-content;
  max-width: 200px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--card-border);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 100;
  margin-bottom: 5px;
  font-weight: normal;
  text-align: center;
}

.glossary-term:hover::after {
  opacity: 1;
}

/* Quiz Badges & Progress */
.quiz-progress {
  display: flex;
  flex-wrap: wrap;
  /* Wrap on mobile */
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  gap: 0.5rem;
}

.badge {
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: bold;
  color: #1e293b;
}

.badge-easy {
  background-color: #86efac;
}

.badge-medium {
  background-color: #fca5a5;
}

.badge-hard {
  background-color: #f87171;
  color: white;
  border: 1px solid #ef4444;
}

/* End Screen Summary */
.summary-list {
  margin: 2rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.summary-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  padding: 1rem;
  border-radius: 0.5rem;
  font-size: 0.95rem;
}

.summary-item.summary-correct {
  border-left: 3px solid var(--secondary);
}

.summary-item.summary-wrong {
  border-left: 3px solid #ef4444;
}

.text-green {
  color: var(--secondary);
  font-weight: bold;
}

.text-red {
  color: #ef4444;
  font-weight: bold;
}

/* ------------------------------------------------------------------ */
/* DESKTOP OVERRIDES                                                  */
/* ------------------------------------------------------------------ */

@media (min-width: 768px) {
  body {
    flex-direction: row;
    /* Side-by-side */
    height: 100vh;
    overflow: hidden;
    /* Scroll in containers */
  }

  /* Sidebar Fixed Width */
  .sidebar {
    width: 300px;
    height: calc(100% - 60px);
    /* Full height minus header */
    position: fixed;
    /* Fixed on desktop too to stay under header */
    top: 60px;
    left: 0;
    border-right: 1px solid var(--card-border);
    border-bottom: none;
    padding: 2rem;
    gap: 2rem;
    overflow-y: auto;
  }

  /* Hide specific Mobile-Only header elements in sidebar if any */
  .sidebar-header-mobile {
    display: none;
  }

  /* Main Content Area */
  .main-content {
    overflow-y: auto;
    padding: 2rem;
    padding-top: 80px;
    /* Keep space for header content-wise */
    margin-left: 300px;
    /* Ensure content starts after fixed sidebar */
  }

  .section {
    max-width: 1000px;
    /* Limit width for reading comfort */
  }
  
  #inventur-section {
    max-width: 1500px; /* Wider on large monitors */
  }

  .layer-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  }

  .layer-header {
    padding: 1rem 1.5rem;
  }

  .layer-content {
    display: flex;
    flex-direction: column;
    /* Use full width for cards */
    gap: 2rem;
    padding: 1.5rem;
  }

  .quiz-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .score-badge {
    align-self: center;
  }

  .question-card {
    padding: 2rem;
  }

  .question-text {
    font-size: 1.25rem;
  }

  .detail-container {
    padding: 0 1.5rem 1.5rem 1.5rem;
  }

  .close-btn {
    font-size: 1.5rem;
  }

  .glossary-term::after {
    max-width: 250px;
  }
}

/* Impressum Link */
.impressum-link {
  display: inline-block;
  margin-top: 0.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-decoration: none;
  border-bottom: 1px dotted var(--text-muted);
  transition: color 0.2s, border-bottom 0.2s;
}

.impressum-link:hover {
  color: var(--primary);
  border-bottom: 1px solid var(--primary);
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  padding: 1.5rem;
  border-radius: 1rem;
  box-shadow: var(--glass-shadow);
}

/* --- Stationen-Lernen Styles --- */

#stations-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.station-overview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.station-score-display {
  background: var(--card-bg);
  border: 1px solid var(--primary);
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  font-weight: bold;
  font-size: 1.1rem;
}

.score-highlight {
  color: var(--secondary);
  font-size: 1.2rem;
}

.station-intro {
  margin-bottom: 2rem;
  color: var(--text-muted);
}

.station-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.station-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  padding: 1.5rem;
  border-radius: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 200px;
}

.station-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: var(--glass-shadow);
}

.station-card.completed {
  border-color: var(--secondary);
  background: rgba(16, 185, 129, 0.05);
}

.station-card-header h3 {
  margin-bottom: 0.5rem;
  color: var(--primary);
}

.status-icon {
  display: inline-block;
  background: var(--secondary);
  color: white;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.station-progress {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: bold;
}

/* Station Detail View */
.station-detail-view {
  animation: fadeIn 0.3s ease-out;
}

.btn-back {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  margin-bottom: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
}

.btn-back:hover {
  color: var(--primary);
}

.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-top: 2rem;
}

.task-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 1rem;
  padding: 1.5rem;
  position: relative;
}

.task-card.mandatory {
  border-left: 4px solid var(--primary);
}

.task-card.bonus {
  border-left: 4px solid var(--quiz-accent);
}

.task-card.correct {
  border-color: var(--secondary);
  background: rgba(16, 185, 129, 0.05);
}

/* Red border for wrong answer card */
.task-card.wrong {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
}


.task-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.task-badge {
  font-size: 0.8rem;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: bold;
}

.task-badge.mandatory {
  background: rgba(0, 134, 203, 0.2);
  color: #a5f3fc;
}

.task-badge.bonus {
  background: rgba(245, 158, 11, 0.2);
  color: #fde68a;
}

body.light-mode .task-badge.bonus {
  background: rgba(245, 158, 11, 0.3);
  color: #92400e;
  /* Darker amber for readability */
  border: 1px solid rgba(245, 158, 11, 0.4);
}

body.light-mode .task-badge.mandatory {
  background: rgba(0, 134, 203, 0.15);
  color: #0369a1;
  border: 1px solid rgba(0, 134, 203, 0.3);
}

body.light-mode .task-badge.interactive {
  background: rgba(16, 185, 129, 0.15);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.task-badge.interactive {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
}

.task-question {
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
  font-weight: 500;
}

.task-options {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.task-feedback {
  margin-top: 1.5rem;
  animation: slideDown 0.3s ease-out;
}

.feedback-box {
  padding: 1rem;
  border-radius: 0.5rem;
  font-weight: 500;
}

.feedback-box.success {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

/* Light mode override for success text */
body.light-mode .feedback-box.success {
  color: #047857;
}

.feedback-box.error {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

body.light-mode .feedback-box.error {
  color: #b91c1c;
}

/* --- Matching Task Styles --- */
.matching-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.matching-pool-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.matching-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 50px;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 0.5rem;
  border: 1px dashed var(--card-border);
}

.match-item {
  background: var(--card-bg);
  border: 1px solid var(--primary);
  padding: 0.5rem 0.8rem;
  border-radius: 0.4rem;
  font-size: 0.9rem;
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition: transform 0.1s;
  background: rgba(0, 134, 203, 0.2);
}

.match-item.interactive:hover {
  background: var(--primary);
  color: white;
}

/* Reset Button Styles */
.btn-reset {
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--card-border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  width: 100%;
  transition: all 0.2s;
}


.btn-reset:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border-color: #ef4444;
}

/* Attempts & Hints */
.attempts-badge {
  font-size: 0.8rem;
  color: #ef4444;
  font-weight: bold;
  margin-left: 0.5rem;
  background: rgba(239, 68, 68, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

.hint-star {
  cursor: pointer;
  font-size: 1.2rem;
  margin-right: 0.5rem;
  color: #fbbf24;
  transition: transform 0.2s;
  user-select: none;
}

.hint-star:hover {
  transform: scale(1.2) rotate(15deg);
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
}

/* Overview Stats */
.station-stats {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  font-weight: bold;
}

.stat-correct {
  color: #34d399;
}

.stat-wrong {
  color: #f87171;
}

/* OSI Table Styles */
.osi-table-container {
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.osi-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 400px;
}

.osi-table th,
.osi-table td {
  border: 1px solid var(--card-border);
  padding: 0.5rem;
  text-align: center;
}

.osi-table th {
  background: rgba(255, 255, 255, 0.05);
  color: var(--primary);
}

/* ===================== */
/* SQL Sandbox Styles    */
/* ===================== */

#sql-input {
  tab-size: 4;
}

#sql-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0, 134, 203, 0.3);
}

.example-query-btn {
  background: rgba(0, 134, 203, 0.15);
  border: 1px solid rgba(0, 134, 203, 0.3);
  color: var(--primary);
  padding: 0.4rem 0.8rem;
  border-radius: 2rem;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s;
}

.example-query-btn:hover {
  background: var(--primary);
  color: white;
}

body.light-mode .example-query-btn {
  background: rgba(0, 134, 203, 0.1);
  border-color: rgba(0, 134, 203, 0.3);
}

.result-table-container {
  overflow-x: auto;
  margin-top: 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--card-border);
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  min-width: 400px;
}

.result-table th {
  background: rgba(0, 134, 203, 0.2);
  color: var(--primary);
  padding: 0.7rem 1rem;
  text-align: left;
  font-weight: 700;
  border-bottom: 2px solid var(--primary);
  white-space: nowrap;
}

.result-table td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--card-border);
  white-space: nowrap;
}

.result-table tr:hover td {
  background: rgba(255, 255, 255, 0.05);
}

body.light-mode .result-table tr:hover td {
  background: rgba(0, 134, 203, 0.05);
}

.result-count {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-style: italic;
}

.result-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid #ef4444;
  border-radius: 0.5rem;
  padding: 1rem;
  color: #f87171;
  font-family: 'Courier New', monospace;
  margin-top: 1rem;
}

body.light-mode .result-error {
  color: #b91c1c;
}

.result-success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid var(--secondary);
  border-radius: 0.5rem;
  padding: 1rem;
  color: var(--secondary);
  margin-top: 1rem;
}

/* Schema display */
.schema-table-card {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--card-border);
  border-radius: 0.5rem;
  overflow: hidden;
}

.schema-table-name {
  background: rgba(0, 134, 203, 0.2);
  padding: 0.6rem 1rem;
  font-weight: bold;
  color: var(--primary);
  font-family: 'Courier New', monospace;
  border-bottom: 1px solid var(--card-border);
}

.schema-columns {
  padding: 0.5rem;
}

.schema-col {
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
  font-family: 'Courier New', monospace;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.schema-col:not(:last-child) {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.schema-col-name {
  color: var(--text-main);
}

.schema-col-type {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.schema-col-pk {
  color: var(--quiz-accent);
  font-weight: bold;
}

/* SQL Code Block in Theory */
.sql-code-block {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--card-border);
  border-radius: 0.5rem;
  padding: 1rem;
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  line-height: 1.6;
  overflow-x: auto;
  color: #e2e8f0;
  margin: 1rem 0;
}

body.light-mode .sql-code-block {
  background: rgba(0, 37, 94, 0.05);
  border-color: rgba(0, 37, 94, 0.15);
  color: var(--flb-blue);
}

.sql-keyword {
  color: #60a5fa;
  font-weight: bold;
}

body.light-mode .sql-keyword {
  color: #0086cb;
}

.sql-string {
  color: #34d399;
}

body.light-mode .sql-string {
  color: #047857;
}

.sql-comment {
  color: #6b7280;
  font-style: italic;
}

.sql-operator {
  color: #f59e0b;
}

body.light-mode .sql-operator {
  color: #b45309;
}

/* Station SQL Input */
.station-sql-input {
  width: 100%;
  padding: 0.8rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--card-border);
  border-radius: 0.5rem;
  color: #fbbf24;
  font-family: 'Courier New', monospace;
  font-size: 0.95rem;
  outline: none;
  resize: vertical;
  min-height: 60px;
  transition: border-color 0.2s;
  line-height: 1.5;
}

.station-sql-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0, 134, 203, 0.3);
}

body.light-mode .station-sql-input {
  background: rgba(0, 37, 94, 0.05);
  color: #b45309;
}

body.light-mode #sql-input {
  background: rgba(0, 37, 94, 0.05);
  color: #b45309;
}

/* ===================== */
/* Schema FK & ER Styles */
/* ===================== */

/* FK column styling */
.schema-col-fk {
  color: #a78bfa;
}

body.light-mode .schema-col-fk {
  color: #7c3aed;
}

/* Schema Info Button (ℹ️ in stations) */
.schema-info-btn {
  background: rgba(0, 134, 203, 0.15);
  border: 1px solid rgba(0, 134, 203, 0.3);
  color: var(--primary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  padding: 0;
  line-height: 1;
}

.schema-info-btn:hover {
  background: var(--primary);
  color: white;
  transform: scale(1.1);
}

/* ---- Schema Popup Overlay ---- */
.schema-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.15s ease-out;
}

.schema-info-popup {
  background: var(--bg-color);
  border: 1px solid var(--primary);
  border-radius: 1rem;
  padding: 1.25rem;
  width: 100%;
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.2s ease-out;
}

body.light-mode .schema-info-popup {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.schema-info-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--card-border);
  font-size: 1.1rem;
}

.schema-info-popup-body {
  font-size: 0.9rem;
}

.schema-popup-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

/* ---- ER Diagram ---- */
.er-diagram {
  margin-top: 1.25rem;
  background: rgba(0, 0, 0, 0.1);
  border: 1px solid var(--card-border);
  border-radius: 0.75rem;
  padding: 1rem;
}

body.light-mode .er-diagram {
  background: rgba(0, 134, 203, 0.04);
}

.er-diagram-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: bold;
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  color: var(--primary);
}

.er-relation {
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.er-relation:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

body.light-mode .er-relation {
  border-bottom-color: rgba(0, 37, 94, 0.08);
}

.er-relation-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: nowrap;
  overflow: hidden;
}

.er-table-badge {
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  font-weight: bold;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  max-width: 35%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.er-badge-pk {
  background: rgba(0, 134, 203, 0.2);
  color: var(--primary);
  border: 1px solid rgba(0, 134, 203, 0.35);
}

.er-badge-fk {
  background: rgba(167, 139, 250, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(167, 139, 250, 0.3);
}

body.light-mode .er-badge-fk {
  color: #7c3aed;
  background: rgba(124, 58, 237, 0.1);
  border-color: rgba(124, 58, 237, 0.25);
}

/* Cardinality badges */
.er-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: bold;
  flex-shrink: 0;
}

.er-card-one {
  background: rgba(0, 134, 203, 0.25);
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

.er-card-many {
  background: rgba(245, 158, 11, 0.2);
  color: var(--quiz-accent);
  border: 1.5px solid var(--quiz-accent);
}

/* Connection line */
.er-line {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
}

.er-line-bar {
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), #a78bfa);
  min-width: 8px;
}

.er-line-label {
  font-family: 'Courier New', monospace;
  font-size: 0.6rem;
  color: var(--text-muted);
  white-space: nowrap;
  padding: 0 0.2rem;
  flex-shrink: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.er-relation-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  padding-left: 0.25rem;
  font-style: italic;
}

/* ER Legend */
.er-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.2rem;
  font-size: 0.8rem;
  padding: 0.75rem;
  background: rgba(16, 185, 129, 0.08);
  border-left: 3px solid var(--secondary);
  border-radius: 4px;
  margin-top: 1rem;
  color: var(--text-muted);
}

/* Theory Schema Section */
.theory-schema-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

/* ---- Desktop ER Diagram ---- */
@media (min-width: 768px) {
  .schema-popup-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .er-table-badge {
    max-width: none;
    font-size: 0.8rem;
  }

  .er-line-label {
    font-size: 0.7rem;
    padding: 0 0.5rem;
    flex-shrink: 0;
  }
}

/* ================================================================ */
/* MOBILE RESPONSIVE FIXES (≤ 430px — iPhone 13 Mini = 375px)      */
/* ================================================================ */

@media (max-width: 430px) {

  /* General mobile spacing */
  .main-content {
    padding: 0.75rem;
    padding-top: 70px;
  }

  .section {
    padding: 0;
  }

  h2 {
    font-size: 1.2rem;
    line-height: 1.3;
  }

  /* Theory cards */
  .layer-header {
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
  }

  .layer-content {
    padding: 0.75rem !important;
    font-size: 0.95rem !important;
  }

  /* Schema cards in theory / sandbox / popup */
  .theory-schema-grid,
  .schema-popup-grid,
  #schema-display {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .schema-table-card {
    font-size: 0.75rem;
  }

  .schema-table-name {
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
  }

  .schema-col {
    padding: 0.2rem 0.4rem;
    font-size: 0.7rem;
    gap: 0.2rem;
  }

  .schema-col-type {
    font-size: 0.65rem;
  }

  /* ER diagram mobile – compact vertical layout */
  .er-diagram {
    padding: 0.6rem;
  }

  .er-diagram-title {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
  }

  .er-relation {
    padding: 0.4rem 0;
  }

  .er-relation-row {
    /* Stack: PK-badge (1) ——line—— (n) FK-badge */
    display: grid;
    grid-template-columns: auto auto 1fr auto auto;
    align-items: center;
    gap: 0.2rem;
  }

  .er-table-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.3rem;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .er-card {
    width: 16px;
    height: 16px;
    font-size: 0.55rem;
  }

  .er-line {
    min-width: 0;
  }

  .er-line-label {
    display: none;
  }

  .er-line-bar {
    min-width: 4px;
  }

  .er-relation-desc {
    font-size: 0.7rem;
  }

  .er-legend {
    font-size: 0.7rem;
    gap: 0.4rem 0.8rem;
    padding: 0.5rem;
  }


  /* Popup mobile */
  .schema-popup-overlay {
    padding: 0.5rem;
  }

  .schema-info-popup {
    padding: 1rem;
    border-radius: 0.75rem;
    max-height: 90vh;
  }

  .schema-info-popup-header {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
  }

  /* Station cards */
  .station-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .station-card {
    min-height: 160px;
    padding: 1rem;
  }

  .task-card {
    padding: 1rem;
  }

  .task-question {
    font-size: 0.95rem;
    margin-bottom: 1rem;
  }

  .option-btn {
    padding: 0.75rem;
    font-size: 0.9rem;
  }

  .task-badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
  }

  /* SQL input */
  .station-sql-input,
  #sql-input {
    font-size: 0.85rem;
    padding: 0.6rem;
    min-height: 50px;
  }

  /* Buttons */
  .btn-primary {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }

  /* Quiz */
  .quiz-header {
    gap: 0.5rem;
  }

  .score-badge {
    font-size: 0.85rem;
    padding: 0.3rem 0.7rem;
  }

  .question-text {
    font-size: 1rem;
    margin-bottom: 1rem;
  }

  /* Result tables */
  .result-table {
    font-size: 0.8rem;
    min-width: 300px;
  }

  .result-table th,
  .result-table td {
    padding: 0.4rem 0.6rem;
  }

  /* Sandbox buttons */
  .sandbox-btn-row {
    flex-direction: column;
  }

  /* Example query buttons */
  .example-query-btn {
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
  }

  /* Scenario box */
  .scenario-box {
    padding: 1rem;
  }

  /* SQL code blocks */
  .sql-code-block {
    font-size: 0.8rem;
    padding: 0.75rem;
    line-height: 1.5;
  }

  /* Info button alignment */
  .schema-info-btn {
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
  }
}

/* Extra-small screens (iPhone SE, very compact) */
@media (max-width: 350px) {
  .theory-schema-grid,
  .schema-popup-grid,
  #schema-display {
    grid-template-columns: 1fr;
  }

  .er-relation-row {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem;
  }

  .er-line {
    order: 3;
    width: 100%;
    margin-top: 0.2rem;
  }

  .er-table-badge {
    max-width: none;
  }
}

/* ------------------------------------------------------------------ */
/* INVENTUR SPLIT-SCREEN & WAREHOUSE CSS                              */
/* ------------------------------------------------------------------ */

.split-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  flex: 1;
  min-height: 0;
}

@media (min-width: 768px) {
  .split-layout {
    flex-direction: row;
    align-items: stretch;
    gap: 1.5rem;
  }
}

/* Left Area: Warehouse (Liquid) */
.warehouse-view {
  flex: 1.2; /* Mobile priority */
  background: linear-gradient(180deg, #2C3E50 0%, #1a252f 100%);
  border: 1.5px solid var(--fly-blue, #4682B4);
  border-radius: 8px;
  padding: 0.35rem;
  overflow: hidden; /* Strictly no scroll */
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-height: 0;
}

@media (min-width: 768px) {
  .warehouse-view {
    flex: 5.5;
  }
}

/* Right Area: Inventory Table (Scrolled) */
.inventory-view {
  flex: 4.5;
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  border-radius: 8px;
  padding: 1rem;
  padding-top: 0.5rem; /* Reduced top padding for sticky header */
  overflow-y: auto; /* List can scroll internally */
  overflow-x: hidden; /* Hide horizontal scroll */
  display: flex;
  flex-direction: column;
  min-height: 150px;
}

/* Racks & Shelves */
.rack-container {
  display: grid;
  /* Konservativere Spaltenplanung, um Overlap zu vermeiden */
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.5rem;
  flex: 1;
  align-content: start; 
  align-items: start; /* Racks nehmen nur so viel Höhe wie nötig */
}

/* Auf mobilen/schmalen Screens Spalten begrenzen */
@media (max-width: 600px) {
  .rack-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Auf mittleren Screens (iPad Portrait) */
@media (min-width: 601px) and (max-width: 1024px) {
  .rack-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Erst bei sehr viel Platz (große Desktops) mehr Spalten */
@media (min-width: 1400px) {
  .rack-container {
    grid-template-columns: repeat(3, 1fr);
  }
}

.rack {
  background: #34495e;
  border-left: 3px solid var(--fly-orange, #F39C12);
  border-right: 3px solid var(--fly-orange, #F39C12);
  border-top: 3px solid var(--fly-orange, #F39C12);
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  border-radius: 4px 4px 0 0;
  position: relative;
  min-height: 0; /* Erlaubt das Verkleinern */
}

.rack-title {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--fly-orange, #F39C12);
  color: #1a252f;
  padding: 0 4px;
  font-size: clamp(0.5rem, 1.2vmin, 0.7rem);
  font-weight: bold;
  border-radius: 2px;
  white-space: nowrap;
  z-index: 5;
}

.shelf-row {
  display: flex;
  border-bottom: 3px solid var(--fly-orange, #F39C12);
  padding: 0.25rem;
  gap: 0.25rem;
  justify-content: space-evenly;
  flex: 1; /* Stretch to fill available rack height proportionally */
  min-height: 0;
}

.shelf-bin {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  text-align: center;
  padding: 1vmin;
  min-width: 0;
  overflow: hidden;
}

.shelf-bin:hover {
  background: rgba(70, 130, 180, 0.4);
  border-color: var(--fly-blue, #4682B4);
  transform: scale(1.02);
}

.shelf-bin.completed {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
}

.shelf-bin.completed::after {
  content: '✓';
  position: absolute;
  top: 2px;
  right: 2px;
  background: #10b981;
  color: white;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bin-icon {
  font-size: clamp(1rem, 4vmin, 2.5rem);
  margin-bottom: 2px;
}

.bin-label {
  font-size: clamp(0.5rem, 1.8vmin, 0.85rem);
  color: #bdc3c7;
  line-height: 1.0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* Office Area */
.office-desk {
  background: rgba(255,255,255,0.05);
  border-top: 2px solid #95a5a6;
  padding: 0.4rem;
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: auto;
  min-height: 0;
}

.desk-item {
  background: #2c3e50;
  border: 1px solid #7f8c8d;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.2s;
  min-width: 0;
}

.desk-item:hover {
  background: #34495e;
  border-color: var(--fly-blue, #4682B4);
  transform: translateY(-2px);
}

.desk-item.completed {
  border-color: #10b981;
}

/* Modals */
.inventur-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.8);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.inventur-modal {
  background: var(--bg-color);
  border: 2px solid var(--fly-orange, #F39C12);
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.5);
  overflow: hidden;
  animation: slideDown 0.3s ease-out;
}

.inventur-modal-header {
  background: var(--fly-blue, #4682B4);
  color: white;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
}

.inventur-modal-body {
  padding: 1.5rem;
  color: var(--text-main);
  text-align: center;
  font-size: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

/* Inventory List Inputs */
.osi-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto; /* Fluid columns */
}

.osi-table thead th {
  position: sticky;
  top: -0.5rem; /* Offset the container padding-top */
  background: var(--card-bg); /* Opaque background */
  z-index: 50;
  padding: 0.35rem 0.15rem;
  font-weight: bold;
  border-bottom: 2px solid var(--primary);
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

body.light-mode .osi-table thead th {
  background: #f8fafc; /* Professional light background */
}

.osi-table td {
  padding: 0.2rem 0.15rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.inv-input {
  width: 100%;
  min-width: 0; /* Allow shrinking */
  padding: 0.15rem;
  border: 1px solid var(--card-border);
  border-radius: 4px;
  background: rgba(0,0,0,0.2);
  color: var(--text-main);
  font-family: monospace;
  text-align: right;
  font-size: 0.8rem;
}

body.light-mode .inv-input {
  background: rgba(255,255,255,0.8);
  color: #000;
  border-color: #ccc;
}

.inv-input.valid {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

.inv-input.invalid {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

/* Scrollbars for warehouse & list */
.warehouse-view::-webkit-scrollbar,
.inventory-view::-webkit-scrollbar {
  width: 8px;
}
.warehouse-view::-webkit-scrollbar-thumb,
.inventory-view::-webkit-scrollbar-thumb {
  background-color: var(--fly-blue, #4682B4);
  border-radius: 4px;
}

/* ------------------------------------------------------------------ */
/* THEORIE MODUL CSS                                                  */
/* ------------------------------------------------------------------ */

.theory-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap; /* responsive */
}

.theory-tab-btn {
  background: var(--card-bg);
  color: var(--text-muted);
  border: 1px solid var(--card-border);
  padding: 0.75rem 1.25rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.2s;
}

.theory-tab-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.theory-tab-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

body.light-mode .theory-tab-btn {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

body.light-mode .theory-tab-btn.active {
  background: var(--flb-cyan);
  color: white;
}

.theory-box {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: var(--glass-shadow);
  line-height: 1.6;
}

.theory-box h3 {
  color: var(--primary);
  margin-bottom: 0.5rem;
}

/* Timeline Interactive */
.timeline-interactive {
  margin-top: 1.5rem;
  background: rgba(0,0,0,0.1);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  overflow: hidden;
}

body.light-mode .timeline-interactive {
  background: rgba(0,0,0,0.03);
}

.timeline-controls {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  flex-wrap: wrap;
}

body.light-mode .timeline-controls {
  background: rgba(0, 134, 203, 0.1);
}

.timeline-btn {
  flex: 1;
  background: none;
  border: none;
  padding: 0.75rem;
  color: var(--text-main);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  min-width: 120px;
}

.timeline-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.timeline-btn.active {
  border-bottom: 2px solid var(--fly-orange, #F39C12);
  color: var(--fly-orange, #F39C12);
  font-weight: bold;
}

.timeline-display {
  padding: 2rem 1.5rem;
  min-height: 250px;
}

/* Vis Timeline */
.vis-timeline {
  position: relative;
  height: 60px;
  margin: 3rem 0;
}

.vis-line {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 4px;
  background: #34495e;
  transform: translateY(-50%);
}

.vis-node {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #bdc3c7;
  transform: translate(-50%, -50%);
  z-index: 2;
}

.vis-node.node-major {
  width: 20px;
  height: 20px;
  background: var(--fly-orange, #F39C12);
}

.vis-node.node-danger {
  background: #e74c3c;
}

.vis-label {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 8px;
  font-size: 0.85rem;
  white-space: nowrap;
  color: var(--text-muted);
}

.vis-node.node-major .vis-label {
  color: var(--text-main);
}

.vis-highlight {
  position: absolute;
  top: 50%;
  height: 20px;
  transform: translateY(-50%);
  z-index: 1;
  border-radius: 10px;
}

.vis-mark {
  position: absolute;
  top: 50%;
  width: 8px;
  height: 20px;
  background: var(--fly-orange, #F39C12);
  transform: translate(-50%, -50%);
  z-index: 2;
  border-radius: 2px;
  animation: dropIn 0.5s ease backwards;
}

@keyframes dropIn {
  0% { transform: translate(-50%, -20px); opacity: 0; }
  100% { transform: translate(-50%, -50%); opacity: 1; }
}

.vis-caption {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 1rem;
}

.color-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
}

.vis-boxes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  margin: 2rem 0;
}

.vis-box {
  width: 24px;
  height: 24px;
  background: rgba(255,255,255,0.1);
  border: 1px solid var(--card-border);
  border-radius: 2px;
}

.vis-box.boxed-sample {
  background: var(--fly-blue, #4682B4);
  border-color: #5dade2;
  animation: popIn 0.3s ease backwards;
}

@keyframes popIn {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

/* Bilanz t-konto */
.bilanz-t-konto {
  display: flex;
  flex-direction: column;
  border: 2px solid var(--text-muted);
  margin-top: 1rem;
}

.t-konto-header {
  border-bottom: 2px solid var(--text-muted);
  text-align: center;
  font-weight: bold;
  padding: 0.5rem;
  letter-spacing: 2px;
}

.t-konto-sides {
  display: flex;
}

.t-konto-side {
  flex: 1;
  padding: 1rem;
}

.left-side {
  border-right: 2px solid var(--text-muted);
}

.side-title {
  text-align: center;
  font-weight: bold;
  margin-bottom: 1rem;
  color: var(--fly-orange, #F39C12);
}

.ledger-list {
  list-style: none;
  padding: 0;
}

.ledger-list li {
  margin-bottom: 0.2rem;
}

.ledger-list .sub-item {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-left: 1rem;
  margin-bottom: 0.8rem;
}

.t-konto-footer {
  display: flex;
  border-top: 2px double var(--text-muted);
}

.footer-sum {
  flex: 1;
  text-align: right;
  padding: 0.5rem 1rem;
}

.left-side .footer-sum {
  border-right: 2px solid var(--text-muted);
}

/* Inventar Schema */
.inventar-schema {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 768px) {
  .inventar-schema {
    flex-direction: row;
  }
  .schema-part {
    flex: 1;
  }
}

.schema-part {
  background: rgba(0,0,0,0.15);
  border: 1px solid var(--card-border);
  padding: 1rem;
  border-radius: 6px;
}

body.light-mode .schema-part {
  background: rgba(0,0,0,0.03);
}

.schema-part h4 {
  margin-bottom: 0.5rem;
  color: var(--fly-orange, #F39C12);
}

.schema-part ul {
  margin-left: 1.5rem;
  margin-top: 0.5rem;
}

.formula-box {
  background: var(--bg-color);
  padding: 1rem;
  margin-top: 1rem;
  border-radius: 4px;
  text-align: right;
  font-family: monospace;
  font-size: 1.1rem;
}

/* Bilanz Drag & Drop */
.bilanz-chip {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  color: #fff;
  font-weight: bold;
  font-size: 0.85rem;
  cursor: grab;
  user-select: none;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.bilanz-chip:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.bilanz-chip.dragging {
  opacity: 0.5;
  transform: scale(0.95);
}
.bilanz-chip-placed {
  display: inline-block;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  color: #fff;
  font-weight: bold;
  font-size: 0.8rem;
  white-space: nowrap;
}

.bilanz-slot {
  min-height: 48px;
  border: 2px dashed rgba(255,255,255,0.2);
  border-radius: 6px;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background 0.2s;
}
.bilanz-slot.empty {
  background: rgba(255,255,255,0.03);
}
.bilanz-slot.empty.drag-over {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.15);
  box-shadow: inset 0 0 10px rgba(59,130,246,0.2);
}
.bilanz-slot.filled {
  border-style: solid;
  background: rgba(255,255,255,0.05);
}
