/* ============================================================
   LokLöwen TF14 - Eisenbahn-Quizplattform Design System
   Modernes Bahn-Cockpit, Glassmorphism, Signal-Farben & Dark Mode
   ============================================================ */

:root {
  --bg-main: #0a0d14;
  --bg-gradient: radial-gradient(circle at 50% 0%, #151d2e 0%, #0a0d14 70%);
  --surface-card: rgba(17, 24, 39, 0.82);
  --surface-elevated: rgba(26, 36, 56, 0.9);
  --surface-active: rgba(38, 52, 78, 0.95);
  
  --brand-gold: #f59e0b;
  --brand-gold-glow: rgba(245, 158, 11, 0.45);
  --brand-gold-light: #fbbf24;
  --brand-yellow: #facc15;
  --brand-orange: #ea580c;
  
  --rail-blue: #38bdf8;
  --rail-blue-glow: rgba(56, 189, 248, 0.35);
  --signal-green: #10b981;
  --signal-green-glow: rgba(16, 185, 129, 0.35);
  --signal-red: #ef4444;
  --signal-red-glow: rgba(239, 68, 68, 0.35);
  --signal-amber: #f59e0b;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.16);
  --border-brand: rgba(245, 158, 11, 0.4);
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;
  
  --shadow-card: 0 16px 36px -10px rgba(0, 0, 0, 0.65), 0 0 0 1px var(--border-subtle);
  --shadow-glow: 0 0 25px var(--brand-gold-glow);
  --shadow-signal: 0 0 20px var(--signal-green-glow);
  
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --transition-fast: 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-smooth: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100vh;
  background-color: var(--bg-main);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Background Railway Ambient Track Lines */
.bg-ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.15;
  background-size: 60px 60px;
  background-image: 
    linear-gradient(to right, rgba(255,255,255,0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.05) 1px, transparent 1px);
}

.bg-track-glow {
  position: fixed;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 500px;
  background: radial-gradient(ellipse at center, rgba(245, 158, 11, 0.12) 0%, rgba(56, 189, 248, 0.05) 50%, transparent 75%);
  pointer-events: none;
  z-index: 0;
  filter: blur(60px);
}

/* Application Container */
.app-wrapper {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.25rem 3rem;
}

/* Header & Top Bar */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: var(--surface-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
  box-shadow: var(--shadow-card);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.brand-icon-box {
  width: 46px;
  height: 46px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, #fbbf24);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-text h1 span.tf-tag {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid var(--brand-gold);
  border-radius: var(--radius-full);
  -webkit-text-fill-color: var(--brand-gold-light);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.brand-text p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.header-user-status {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.9rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.88rem;
}

.user-avatar {
  width: 26px;
  height: 26px;
  background: linear-gradient(135deg, var(--rail-blue), #2563eb);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

/* Signal Indicator Lights Widget */
.signal-lights-bar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #05070a;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid #1e293b;
}

.signal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  opacity: 0.25;
  transition: var(--transition-fast);
}

.signal-dot.red { background-color: var(--signal-red); }
.signal-dot.amber { background-color: var(--signal-amber); }
.signal-dot.green { background-color: var(--signal-green); }

.signal-dot.active.green {
  opacity: 1;
  box-shadow: 0 0 10px var(--signal-green);
}
.signal-dot.active.red {
  opacity: 1;
  box-shadow: 0 0 10px var(--signal-red);
}
.signal-dot.active.amber {
  opacity: 1;
  box-shadow: 0 0 10px var(--signal-amber);
}

/* Screens / Views Manager */
.screen {
  display: none;
  animation: fadeIn 0.35s ease forwards;
}

.screen.active {
  display: block;
}

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

/* ============================================================
   SCREEN 1: WELCOME & GATEKEEPER / LOGIN
   ============================================================ */
.welcome-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 65vh;
}

.login-card {
  width: 100%;
  max-width: 520px;
  background: var(--surface-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2.25rem;
  box-shadow: var(--shadow-card), 0 0 40px rgba(0,0,0,0.5);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #f59e0b, #e11d48, #38bdf8);
}

.hero-emblem {
  text-align: center;
  margin-bottom: 1.5rem;
}

.hero-emblem-icon {
  width: 76px;
  height: 76px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.05));
  border: 2px solid var(--brand-gold);
  border-radius: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  box-shadow: var(--shadow-glow);
  animation: pulseEmblem 3s infinite alternate;
}

@keyframes pulseEmblem {
  from { box-shadow: 0 0 20px rgba(245, 158, 11, 0.2); }
  to { box-shadow: 0 0 35px rgba(245, 158, 11, 0.5); }
}

.welcome-title {
  font-size: 1.75rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.welcome-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
  line-height: 1.5;
}

/* Security Notice Box */
.admin-notice-box {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}

.notice-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  line-height: 1;
}

.notice-content h4 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--brand-gold-light);
  margin-bottom: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.notice-content p {
  font-size: 0.82rem;
  color: #e2e8f0;
  line-height: 1.45;
}

/* Privacy & Disclaimer Notice Box */
.disclaimer-notice-box {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  background: rgba(56, 189, 248, 0.07);
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  margin-bottom: 1.75rem;
}

.disclaimer-notice-box .notice-content h4 {
  color: #38bdf8;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.4rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
  letter-spacing: 0.02em;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-dim);
  font-size: 1.1rem;
  pointer-events: none;
}

.form-input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.8rem;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 1rem;
  transition: var(--transition-fast);
}

.form-input.mono {
  font-family: var(--font-mono);
  letter-spacing: 0.15em;
  font-size: 1.1rem;
}

.form-input:focus {
  outline: none;
  border-color: var(--brand-gold);
  background: rgba(15, 23, 42, 0.95);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.form-input::placeholder {
  color: var(--text-dim);
  letter-spacing: normal;
  font-family: var(--font-main);
}

.btn-toggle-pin {
  position: absolute;
  right: 0.85rem;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.3rem;
  font-size: 1.05rem;
  transition: var(--transition-fast);
}

.btn-toggle-pin:hover {
  color: var(--text-main);
}

.form-error-msg {
  display: none;
  color: var(--signal-red);
  font-size: 0.82rem;
  margin-top: 0.4rem;
  font-weight: 500;
}

.form-error-msg.visible {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* Primary Button */
.btn-primary {
  width: 100%;
  padding: 0.95rem 1.5rem;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  color: #0b0f17;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  box-shadow: 0 4px 18px rgba(245, 158, 11, 0.35);
  transition: var(--transition-fast);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  box-shadow: 0 6px 25px rgba(245, 158, 11, 0.5);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0);
}

/* ============================================================
   SCREEN 2: DASHBOARD & QUIZ BUILDER
   ============================================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.75rem;
}

/* Welcome Cockpit Banner */
.cockpit-banner {
  background: var(--surface-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
  box-shadow: var(--shadow-card);
}

.banner-title-area h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 0.3rem;
}

.banner-title-area p {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.stats-ribbon {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.stat-pill {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.6rem 1rem;
  text-align: center;
  min-width: 90px;
}

.stat-pill .stat-num {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--brand-gold-light);
  font-family: var(--font-mono);
}

.stat-pill .stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
  letter-spacing: 0.05em;
}

/* Navigation Tabs (Quiz erstellen vs. Lernkarten Bibliothek) */
.nav-tabs-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition-fast);
}

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

.tab-btn.active {
  color: #0b0f17;
  background: var(--brand-gold);
  box-shadow: 0 2px 12px rgba(245, 158, 11, 0.35);
}

/* Studio Builder Card */
.builder-card {
  background: var(--surface-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-card);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.section-head h3 {
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.btn-select-all {
  background: transparent;
  border: 1px solid var(--border-medium);
  color: var(--rail-blue);
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-select-all:hover {
  background: rgba(56, 189, 248, 0.1);
  border-color: var(--rail-blue);
}

/* Category Selection Grid */
.category-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.cat-checkbox-card {
  position: relative;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  cursor: pointer;
  transition: var(--transition-fast);
  user-select: none;
}

.cat-checkbox-card:hover {
  background: rgba(26, 36, 56, 0.7);
  border-color: var(--border-medium);
}

.cat-checkbox-card.checked {
  background: rgba(245, 158, 11, 0.08);
  border-color: var(--brand-gold);
}

.cat-icon-badge {
  font-size: 1.4rem;
  line-height: 1;
  padding: 0.4rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.cat-info {
  flex: 1;
}

.cat-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}

.cat-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.cat-badge-code {
  background: rgba(255, 255, 255, 0.06);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-weight: 600;
}

.custom-checkbox {
  width: 20px;
  height: 20px;
  border: 2px solid var(--text-dim);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.cat-checkbox-card.checked .custom-checkbox {
  background: var(--brand-gold);
  border-color: var(--brand-gold);
  color: #0b0f17;
}

/* Question Count Selector & Modes */
.config-subgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.75rem;
  margin-bottom: 2.25rem;
}

.config-box {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.config-box h4 {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.pills-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pill-choice {
  flex: 1 1 calc(33.333% - 0.5rem);
  min-width: 60px;
  text-align: center;
  padding: 0.55rem 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
  user-select: none;
}

.pill-choice:hover {
  background: rgba(255, 255, 255, 0.08);
}

.pill-choice.active {
  background: var(--rail-blue);
  border-color: var(--rail-blue);
  color: #0b0f17;
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.3);
}

.modes-select-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.mode-option {
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: var(--transition-fast);
  user-select: none;
}

.mode-option:hover {
  background: rgba(255, 255, 255, 0.08);
}

.mode-option.active {
  background: rgba(245, 158, 11, 0.12);
  border-color: var(--brand-gold);
}

.mode-option .mode-icon {
  font-size: 1.3rem;
}

.mode-text h5 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
}

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

/* Switch for Shuffle */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.25rem 0;
}

.toggle-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #334155;
  transition: .3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--brand-gold);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

/* Start Quiz CTA */
.btn-launch-quiz {
  width: 100%;
  padding: 1.15rem;
  font-size: 1.15rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

/* ============================================================
   LERNKARTEN BIBLIOTHEK (KARTEN-EXPLORER)
   ============================================================ */
.library-card {
  background: var(--surface-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-card);
}

.library-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.lib-search-wrapper {
  flex: 2;
  min-width: 260px;
}

.lib-filter-select {
  flex: 1;
  min-width: 200px;
  padding: 0.85rem 1rem;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.92rem;
  outline: none;
}

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

.library-cards-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
  max-height: 65vh;
  overflow-y: auto;
  padding-right: 0.5rem;
}

/* Custom Scrollbar */
.library-cards-list::-webkit-scrollbar,
.review-list::-webkit-scrollbar {
  width: 6px;
}

.library-cards-list::-webkit-scrollbar-thumb,
.review-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}

.lib-flashcard-item {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition-fast);
}

.lib-flashcard-item:hover {
  border-color: var(--border-brand);
  background: rgba(20, 29, 47, 0.8);
}

.lib-card-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  font-size: 0.75rem;
}

.badge-tag {
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  font-weight: 600;
}

.badge-tag.brand {
  background: rgba(245, 158, 11, 0.15);
  color: var(--brand-gold-light);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.lib-card-question {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.lib-card-answer {
  font-size: 0.85rem;
  color: #cbd5e1;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--brand-gold);
  line-height: 1.5;
  white-space: pre-line;
}

/* ============================================================
   SCREEN 3: ACTIVE QUIZ PLAYER
   ============================================================ */
.quiz-header-bar {
  background: var(--surface-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.quiz-progress-section {
  flex: 1;
  min-width: 220px;
}

.progress-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.progress-label-row .q-counter {
  color: var(--brand-gold-light);
  font-family: var(--font-mono);
}

.progress-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #f59e0b, #38bdf8);
  border-radius: 99px;
  transition: width 0.35s ease;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.5);
}

.live-score-pill {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(15, 23, 42, 0.8);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  font-weight: 700;
}

.live-score-pill .score-val {
  color: var(--signal-green);
  font-family: var(--font-mono);
}

.btn-quit-quiz {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-quit-quiz:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--signal-red);
  color: #fca5a5;
}

/* The Main Question Card */
.quiz-play-card {
  background: var(--surface-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  padding: 2.25rem;
  box-shadow: var(--shadow-card);
  margin-bottom: 1.5rem;
  position: relative;
}

.question-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.q-category-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-full);
  color: var(--brand-gold-light);
  font-size: 0.82rem;
  font-weight: 700;
}

.q-source-tag {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.question-text-title {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.45;
  color: var(--text-main);
  margin-bottom: 2rem;
  letter-spacing: -0.01em;
}

/* Multiple Choice Options Grid */
.options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.mc-option-btn {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  color: var(--text-main);
  text-align: left;
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.mc-option-btn:hover:not(:disabled) {
  background: rgba(26, 36, 56, 0.85);
  border-color: var(--border-medium);
  transform: translateX(4px);
}

.mc-option-btn .opt-badge {
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 800;
  font-family: var(--font-mono);
  flex-shrink: 0;
  margin-top: 1px;
}

.mc-option-btn .opt-text {
  flex: 1;
  line-height: 1.45;
}

/* Feedback states */
.mc-option-btn.selected-correct,
.mc-option-btn.correct-highlight {
  background: rgba(16, 185, 129, 0.15) !important;
  border-color: var(--signal-green) !important;
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.3) !important;
}

.mc-option-btn.selected-correct .opt-badge,
.mc-option-btn.correct-highlight .opt-badge {
  background: var(--signal-green);
  border-color: var(--signal-green);
  color: #05160e;
}

.mc-option-btn.selected-wrong {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: var(--signal-red) !important;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.3) !important;
}

.mc-option-btn.selected-wrong .opt-badge {
  background: var(--signal-red);
  border-color: var(--signal-red);
  color: #fff;
}

.mc-option-btn:disabled {
  cursor: default;
}

/* Flashcard Self-Test Mode View */
.flashcard-view-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.flashcard-reveal-btn {
  padding: 1rem 2rem;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid var(--rail-blue);
  color: var(--rail-blue);
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: var(--transition-fast);
}

.flashcard-reveal-btn:hover {
  background: var(--rail-blue);
  color: #0b0f17;
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.4);
}

.flashcard-answer-revealed {
  display: none;
  width: 100%;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  border-left: 4px solid var(--brand-gold);
}

.flashcard-answer-revealed.visible {
  display: block;
  animation: fadeIn 0.3s ease;
}

.flashcard-answer-revealed h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--brand-gold-light);
  margin-bottom: 0.5rem;
  letter-spacing: 0.04em;
}

.flashcard-answer-revealed p {
  font-size: 1rem;
  line-height: 1.6;
  white-space: pre-line;
  color: #f1f5f9;
}

.flashcard-grade-buttons {
  display: none;
  gap: 1rem;
  width: 100%;
}

.flashcard-grade-buttons.visible {
  display: flex;
}

.btn-grade {
  flex: 1;
  padding: 0.9rem;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition-fast);
}

.btn-grade.know {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid var(--signal-green);
  color: #6ee7b7;
}

.btn-grade.know:hover {
  background: var(--signal-green);
  color: #05160e;
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.4);
}

.btn-grade.dontknow {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--signal-red);
  color: #fca5a5;
}

.btn-grade.dontknow:hover {
  background: var(--signal-red);
  color: #fff;
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.4);
}

/* Post-Answer Feedback Banner (Multiple Choice) */
.answer-explanation-box {
  display: none;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1.25rem;
  animation: fadeIn 0.25s ease;
}

.answer-explanation-box.visible {
  display: block;
}

.exp-status-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
}

.exp-status-row.correct { color: var(--signal-green); }
.exp-status-row.wrong { color: var(--signal-red); }

.exp-body {
  font-size: 0.88rem;
  color: #cbd5e1;
  line-height: 1.5;
  white-space: pre-line;
}

.exp-source {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* Footer Action Toolbar */
.quiz-actions-bar {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

.btn-next-question {
  padding: 0.9rem 2rem;
  font-size: 1rem;
}

/* ============================================================
   SCREEN 4: RESULTS & SCORE EVALUATION
   ============================================================ */
.results-card {
  background: var(--surface-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  box-shadow: var(--shadow-card);
  text-align: center;
}

.result-badge-container {
  margin-bottom: 1.5rem;
}

.result-badge-icon {
  width: 90px;
  height: 90px;
  border-radius: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  box-shadow: 0 0 40px rgba(0,0,0,0.5);
}

.result-badge-icon.pass {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.05));
  border: 2px solid var(--signal-green);
  box-shadow: 0 0 35px var(--signal-green-glow);
}

.result-badge-icon.fail {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.05));
  border: 2px solid var(--signal-red);
  box-shadow: 0 0 35px var(--signal-red-glow);
}

.results-headline {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.results-subline {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto 2rem;
}

/* Large Score Stats Grid */
.score-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.25rem;
  max-width: 700px;
  margin: 0 auto 2.5rem;
}

.score-box {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.score-box .num {
  font-size: 2.2rem;
  font-weight: 900;
  font-family: var(--font-mono);
  color: var(--brand-gold-light);
  line-height: 1.2;
}

.score-box .label {
  font-size: 0.8rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  margin-top: 0.4rem;
}

/* Action Buttons Grid */
.results-actions-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 3rem;
}

.btn-secondary {
  padding: 0.9rem 1.5rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition-fast);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn-retry-errors {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.btn-retry-errors:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: var(--signal-red);
}

/* Detailed Review Accordion Section */
.review-section {
  text-align: left;
  border-top: 1px solid var(--border-subtle);
  padding-top: 2rem;
}

.review-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.review-section-header h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

.review-filters {
  display: flex;
  gap: 0.5rem;
}

.btn-filter-tag {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-filter-tag.active {
  background: var(--rail-blue);
  color: #0b0f17;
  border-color: var(--rail-blue);
}

.review-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 55vh;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.review-card {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  position: relative;
}

.review-card.correct { border-left: 4px solid var(--signal-green); }
.review-card.wrong { border-left: 4px solid var(--signal-red); }

.review-q-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
}

.review-answers-grid {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.85rem;
}

.review-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.review-row .tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  flex-shrink: 0;
}

.review-row.user-wrong .tag { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.review-row.user-correct .tag { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.review-row.correct-solution .tag { background: rgba(56, 189, 248, 0.2); color: #7dd3fc; }

.review-source-info {
  margin-top: 0.6rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* ============================================================
   SIGNAL & DIAGRAM IMAGE STYLES
   ============================================================ */
.quiz-card-image-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at 50% 50%, rgba(30, 41, 59, 0.75) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin: 0.75rem 0 1.5rem;
  box-shadow: 0 10px 28px -6px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(0, 0, 0, 0.5);
  max-height: 290px;
  overflow: hidden;
}

.quiz-card-img {
  max-height: 240px;
  max-width: 100%;
  width: auto;
  object-fit: contain;
  border-radius: var(--radius-sm);
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.5));
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.quiz-card-img:hover {
  transform: scale(1.03);
}

/* Library Card Image Thumbnail */
.lib-card-img-thumb {
  width: 100%;
  height: 130px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(10, 14, 23, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  overflow: hidden;
  padding: 0.35rem;
}

.lib-card-img-thumb img {
  max-height: 115px;
  max-width: 95%;
  object-fit: contain;
}

/* Review List Card Image Thumbnail */
.review-card-with-img {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.review-card-img-thumb {
  width: 120px;
  height: 95px;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(10, 14, 23, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.3rem;
  overflow: hidden;
}

.review-card-img-thumb img {
  max-height: 85px;
  max-width: 100%;
  object-fit: contain;
}

.review-card-content {
  flex: 1;
}

/* Footer */
.site-footer {
  margin-top: auto;
  padding-top: 2.5rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.footer-rail-deco {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--brand-gold);
  opacity: 0.6;
}

.footer-copyright {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* Responsive Breakpoints */
@media (max-width: 768px) {
  .app-wrapper {
    padding: 1rem 0.75rem 2.5rem;
  }
  
  .site-header {
    padding: 0.85rem 1rem;
    margin-bottom: 1.25rem;
  }

  .login-card {
    padding: 1.75rem 1.25rem;
  }

  .cockpit-banner {
    padding: 1.25rem;
  }

  .builder-card,
  .library-card,
  .quiz-play-card,
  .results-card {
    padding: 1.5rem 1.25rem;
  }

  .question-text-title {
    font-size: 1.2rem;
  }

  .mc-option-btn {
    padding: 0.85rem 1rem;
    font-size: 0.92rem;
  }

  .results-headline {
    font-size: 1.5rem;
  }
}
