/* ===== CSS VARIABLES ===== */
:root {
  --bg: #0d1117;
  --card-bg: #161b22;
  --card-bg2: #1c2230;
  --primary: #1a73e8;
  --primary-hover: #1557b0;
  --gold: #f9a825;
  --gold-dark: #c67c00;
  --success: #34a853;
  --danger: #ea4335;
  --warning: #fbbc04;
  --text: #c9d1d9;
  --text-muted: #8b949e;
  --border: #30363d;
  --border-light: #21262d;
  --shadow: rgba(0,0,0,0.4);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s ease;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== SCREENS ===== */
.screen {
  display: none;
  min-height: 100vh;
  animation: fadeIn 0.3s ease;
}
.screen.active { display: flex; flex-direction: column; }

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

/* ===== BUTTONS ===== */
button, .btn-primary, .btn-secondary, .btn-danger, .btn-success {
  cursor: pointer;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-secondary { background: var(--card-bg2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.85; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: 0.85; }
.btn-large { padding: 14px 28px; font-size: 1.05rem; width: 100%; }
.btn-back { background: transparent; color: var(--text-muted); padding: 8px 0; font-size: 0.9rem; }
.btn-back:hover { color: var(--text); }
.btn-quit { background: transparent; color: var(--text-muted); font-size: 1.1rem; padding: 8px; }
.btn-quit:hover { color: var(--danger); }

/* ===== SCREEN HEADER ===== */
.screen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.screen-header h2 { font-size: 1.1rem; font-weight: 700; flex: 1; }
.section-title { font-size: 1rem; font-weight: 700; color: var(--text-muted); margin: 20px 0 12px; text-transform: uppercase; letter-spacing: 0.05em; }

/* ===== AUTH SCREEN ===== */
#screen-auth {
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(ellipse at top, #1a2a4a 0%, var(--bg) 70%);
  min-height: 100vh;
}
.auth-outer { max-width: 400px; width: 100%; text-align: center; }
.auth-logo  { font-size: 3.5rem; margin-bottom: 6px; animation: pulse 3s infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
.auth-title    { font-size: 2.2rem; font-weight: 800; color: #fff; letter-spacing: -0.02em; }
.auth-subtitle { color: var(--text-muted); font-size: 0.85rem; margin: 4px 0 20px; }
.auth-tabs { display: flex; gap: 4px; background: var(--card-bg2); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 20px; }
.auth-tab {
  flex: 1; padding: 9px; border-radius: 6px;
  background: transparent; color: var(--text-muted); font-weight: 600; font-size: 0.9rem;
  transition: all var(--transition);
}
.auth-tab.active { background: var(--primary); color: #fff; }
.auth-tab:hover:not(.active) { color: var(--text); background: var(--border); }
.auth-form { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.form-label { font-size: 0.82rem; color: var(--text-muted); font-weight: 600; }
.form-input {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color var(--transition);
  width: 100%;
}
.form-input:focus { border-color: var(--primary); }
.auth-error {
  margin-top: 10px;
  color: var(--danger);
  font-size: 0.85rem;
  min-height: 20px;
  text-align: center;
}
.auth-note { margin-top: 16px; font-size: 0.75rem; color: var(--text-muted); }

/* ===== LOADING SCREEN ===== */
#screen-loading { align-items: center; justify-content: center; }
.loading-container { text-align: center; color: var(--text-muted); }
.loading-spinner {
  width: 48px; height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== LOGOUT BUTTON ===== */
.btn-logout {
  background: transparent;
  color: var(--text-muted);
  font-size: 1.1rem;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.btn-logout:hover { color: var(--danger); background: rgba(234,67,53,0.1); }

/* ===== TOP NAV ===== */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.nav-player { display: flex; align-items: center; gap: 10px; flex: 1; }
.nav-avatar { font-size: 1.6rem; }
.nav-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nav-name { font-weight: 700; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-level { font-size: 0.75rem; color: var(--gold); font-weight: 700; }
.nav-xp-bar-wrap { width: 120px; height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; }
.nav-xp-bar { height: 100%; background: var(--gold); border-radius: 2px; transition: width 0.5s ease; width: 0%; }
.nav-stats { display: flex; gap: 16px; }
.nav-stat { display: flex; flex-direction: column; align-items: center; }
.nav-stat span { font-weight: 700; font-size: 1rem; color: var(--gold); }
.nav-stat small { font-size: 0.7rem; color: var(--text-muted); }

/* ===== HUB SCREEN ===== */
.hub-content { padding: 20px; flex: 1; max-width: 600px; width: 100%; margin: 0 auto; }
.hub-greeting { font-size: 1.3rem; font-weight: 700; margin-bottom: 20px; }
.hub-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px; }
.mode-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.mode-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 6px 20px var(--shadow); }
.mode-card.mode-wwm { border-color: var(--gold-dark); background: linear-gradient(135deg, #1a1500, #2a2000); }
.mode-card.mode-wwm:hover { border-color: var(--gold); }
.mode-icon { font-size: 1.8rem; margin-bottom: 6px; }
.mode-name { font-weight: 700; font-size: 0.95rem; margin-bottom: 4px; }
.mode-desc { font-size: 0.78rem; color: var(--text-muted); line-height: 1.3; }
.mode-highscore { font-size: 0.75rem; color: var(--gold); margin-top: 6px; font-weight: 600; }
.hub-overall { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.hub-overall-title { font-weight: 700; font-size: 0.9rem; margin-bottom: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.hub-topic-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.hub-topic-row .topic-icon { font-size: 1.1rem; width: 24px; text-align: center; }
.hub-topic-row .topic-name { font-size: 0.82rem; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-topic-bar-wrap { width: 80px; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.hub-topic-bar { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.hub-topic-pct { font-size: 0.75rem; color: var(--text-muted); width: 30px; text-align: right; }

/* ===== FILTER SCREEN ===== */
.filter-content { padding: 16px; max-width: 600px; width: 100%; margin: 0 auto; }
.filter-section { margin-bottom: 20px; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.filter-section-title { font-weight: 700; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 12px; }
.filter-section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.filter-section-header .filter-section-title { margin-bottom: 0; }
.filter-topic-actions { display: flex; gap: 6px; }
.btn-filter-action { background: var(--card-bg2); border: 1px solid var(--border); border-radius: 6px; padding: 4px 12px; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: all var(--transition); }
.btn-filter-action:hover { color: var(--text); border-color: var(--primary); }

/* Semester-Chips */
.filter-semester-row { display: flex; flex-wrap: wrap; gap: 8px; }
.sem-chip {
  padding: 8px 16px;
  border-radius: 20px;
  border: 2px solid var(--border);
  background: var(--card-bg2);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex; align-items: center; gap: 6px;
}
.sem-chip:hover { border-color: var(--primary); color: var(--text); }
.sem-chip.active { border-color: var(--primary); background: rgba(26,115,232,0.15); color: var(--text); }
.sem-chip.empty { opacity: 0.55; }
.sem-chip .chip-count { font-size: 0.75rem; color: var(--text-muted); }
.sem-chip.active .chip-count { color: var(--primary); }

/* Themen-Checkboxen */
.filter-topics-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.filter-topic-card {
  background: var(--card-bg2);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}
.filter-topic-card:hover { border-color: var(--primary); }
.filter-topic-card.active { border-color: var(--primary); background: rgba(26,115,232,0.08); }
.ftc-check {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
  transition: all var(--transition);
}
.filter-topic-card.active .ftc-check { border-color: var(--primary); background: var(--primary); color: #fff; }
.ftc-icon { font-size: 1.1rem; }
.ftc-info { flex: 1; min-width: 0; }
.ftc-name { font-size: 0.8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ftc-count { font-size: 0.7rem; color: var(--text-muted); }
.ftc-count.none { color: var(--danger); opacity: 0.7; }

/* Filter Footer / Start */
.filter-footer { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.filter-preview { text-align: center; font-size: 0.9rem; color: var(--text-muted); font-weight: 600; }
.filter-preview strong { color: var(--primary); }
.btn-wwm-start {
  background: linear-gradient(135deg, #2a1f00, #3a2800);
  border: 2px solid var(--gold-dark);
  color: var(--gold);
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.95rem;
}
.btn-wwm-start:hover:not(:disabled) { border-color: var(--gold); background: linear-gradient(135deg, #3a2800, #4a3800); }
.btn-wwm-start:disabled { opacity: 0.4; cursor: not-allowed; }

@media (min-width: 480px) {
  .filter-topics-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 560px) {
  .filter-footer { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .filter-preview { flex: 0 0 100%; }
  .filter-footer .btn-primary, .filter-footer .btn-wwm-start { flex: 1; }
}

/* ===== QUIZ SCREEN ===== */
.quiz-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.quiz-meta { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.quiz-topic-label { font-size: 0.8rem; color: var(--text-muted); }
.quiz-progress-label { font-size: 0.85rem; font-weight: 700; }
.quiz-xp-indicator { font-size: 0.8rem; color: var(--gold); font-weight: 700; background: rgba(249,168,37,0.1); padding: 4px 10px; border-radius: 20px; }
.quiz-progress-bar-wrap { height: 3px; background: var(--border); }
.quiz-progress-bar { height: 100%; background: var(--primary); transition: width 0.4s ease; }
.quiz-body { padding: 20px 16px; flex: 1; max-width: 600px; width: 100%; margin: 0 auto; }
.question-difficulty { margin-bottom: 8px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.diff-1 { color: var(--success); }
.diff-2 { color: var(--warning); }
.diff-3 { color: var(--danger); }
.question-text { font-size: 1.1rem; font-weight: 600; line-height: 1.5; margin-bottom: 20px; }

/* ===== OPTIONS ===== */
.options-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.option-btn {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  text-align: left;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.4;
}
.option-btn:hover:not(:disabled) { border-color: var(--primary); background: rgba(26,115,232,0.08); }
.option-btn.selected { border-color: var(--primary); background: rgba(26,115,232,0.15); }
.option-btn.correct { border-color: var(--success); background: rgba(52,168,83,0.15); color: var(--success); }
.option-btn.wrong { border-color: var(--danger); background: rgba(234,67,53,0.15); color: var(--danger); }
.option-btn:disabled { cursor: default; }
.option-letter {
  width: 28px; height: 28px;
  background: var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.8rem;
  flex-shrink: 0;
}
.option-btn.selected .option-letter { background: var(--primary); color: #fff; }
.option-btn.correct .option-letter { background: var(--success); color: #fff; }
.option-btn.wrong .option-letter { background: var(--danger); color: #fff; }

/* ===== DRAG & DROP ===== */
.dragdrop-area { margin-bottom: 20px; }
.dragdrop-items { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; padding: 12px; background: var(--card-bg2); border-radius: var(--radius-sm); min-height: 50px; }
.drag-item {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}
.drag-item:hover { border-color: var(--primary); }
.drag-item.selected { border-color: var(--gold); background: rgba(249,168,37,0.1); }
.drag-item.placed { opacity: 0.4; pointer-events: none; }
.dragdrop-targets { display: flex; flex-direction: column; gap: 10px; }
.drop-target {
  background: var(--card-bg);
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  transition: all var(--transition);
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.drop-target:hover { border-color: var(--primary); }
.drop-target.has-item { border-style: solid; border-color: var(--primary); background: rgba(26,115,232,0.08); }
.drop-target.correct { border-color: var(--success); background: rgba(52,168,83,0.1); }
.drop-target.wrong { border-color: var(--danger); background: rgba(234,67,53,0.1); }
.drop-target-label { font-size: 0.82rem; color: var(--text-muted); font-weight: 600; flex: 1; }
.drop-target-item { font-size: 0.85rem; color: var(--gold); font-weight: 500; }

/* ===== ORDER ===== */
.order-area { margin-bottom: 20px; }
.order-instruction { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 10px; }
.order-source { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; padding: 12px; background: var(--card-bg2); border-radius: var(--radius-sm); min-height: 50px; }
.order-chosen { display: flex; flex-direction: column; gap: 8px; padding: 12px; background: var(--card-bg); border: 2px dashed var(--border); border-radius: var(--radius-sm); min-height: 50px; }
.order-item {
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}
.order-item:hover { border-color: var(--primary); }
.order-item.chosen { background: rgba(26,115,232,0.1); border-color: var(--primary); display: flex; align-items: center; gap: 8px; }
.order-item.chosen .order-num { background: var(--primary); color: #fff; width: 20px; height: 20px; border-radius: 50%; font-size: 0.75rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.order-item.correct { border-color: var(--success); background: rgba(52,168,83,0.1); }
.order-item.wrong { border-color: var(--danger); background: rgba(234,67,53,0.1); }

/* ===== QUIZ ACTIONS & FEEDBACK ===== */
.quiz-actions { display: flex; gap: 10px; margin-bottom: 16px; }
.btn-hint { background: rgba(249,168,37,0.1); border: 1px solid rgba(249,168,37,0.3); color: var(--gold); padding: 10px 14px; font-size: 0.85rem; }
.btn-hint:hover { background: rgba(249,168,37,0.2); }
#btn-check, #btn-next { flex: 1; }
.feedback-panel {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  border-left: 4px solid var(--primary);
  animation: slideUp 0.3s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.feedback-panel.correct-feedback { border-color: var(--success); }
.feedback-panel.wrong-feedback { border-color: var(--danger); }
.feedback-result { font-weight: 700; font-size: 1.1rem; margin-bottom: 8px; }
.feedback-explanation { font-size: 0.88rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 12px; }
.feedback-xp { font-size: 0.85rem; color: var(--gold); font-weight: 600; margin-bottom: 12px; }

/* ===== RESULTS SCREEN ===== */
#screen-results { align-items: center; justify-content: center; padding: 24px; }
.results-container { max-width: 420px; width: 100%; text-align: center; }
.results-icon { font-size: 4rem; margin-bottom: 12px; }
.results-container h2 { font-size: 1.6rem; font-weight: 800; margin-bottom: 8px; }
.results-score { font-size: 2.5rem; font-weight: 800; color: var(--gold); margin: 8px 0; }
.results-xp-earned { color: var(--success); font-weight: 600; margin-bottom: 16px; }
.results-stats { background: var(--card-bg); border-radius: var(--radius); padding: 16px; margin-bottom: 20px; text-align: left; }
.results-stat-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border-light); font-size: 0.9rem; }
.results-stat-row:last-child { border-bottom: none; }
.results-actions { display: flex; gap: 10px; }
.results-actions button { flex: 1; }

/* ===== FLASHCARD SCREEN ===== */
#screen-flashcard .screen-header { justify-content: space-between; }
.flashcard-container { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; gap: 20px; }
.flashcard { width: 100%; max-width: 480px; height: 260px; perspective: 1000px; cursor: pointer; }
.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.5s ease;
}
.flashcard.flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-front, .flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow-y: auto;
}
.flashcard-back { transform: rotateY(180deg); background: var(--card-bg2); }
.fc-topic-label { font-size: 0.75rem; color: var(--primary); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; }
.fc-text { font-size: 0.95rem; line-height: 1.6; white-space: pre-line; }
.fc-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 12px; }
.flashcard-actions { display: flex; gap: 12px; width: 100%; max-width: 480px; }
.flashcard-actions button { flex: 1; }
.flashcard-hint-text { font-size: 0.82rem; color: var(--text-muted); }

/* ===== PROGRESS SCREEN ===== */
.progress-content { padding: 16px; max-width: 600px; width: 100%; margin: 0 auto; }
.progress-player-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.ppc-avatar { font-size: 2.4rem; }
.ppc-info { flex: 1; }
.ppc-name { font-weight: 800; font-size: 1.1rem; }
.ppc-level { font-size: 0.8rem; color: var(--gold); font-weight: 700; margin-bottom: 6px; }
.ppc-xp-bar-wrap { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; position: relative; }
.ppc-xp-bar { height: 100%; background: var(--gold); border-radius: 4px; transition: width 0.5s ease; }
.ppc-xp-label { font-size: 0.72rem; color: var(--text-muted); margin-top: 3px; }
.ppc-streak { text-align: center; }
.ppc-streak-num { font-size: 1.8rem; font-weight: 800; color: var(--gold); }
.ppc-streak-label { font-size: 0.72rem; color: var(--text-muted); }
.progress-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.progress-stat-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; text-align: center; }
.psc-num { font-size: 1.6rem; font-weight: 800; color: var(--primary); }
.psc-label { font-size: 0.75rem; color: var(--text-muted); }
.topics-progress { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.tp-row {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.tp-icon { font-size: 1.2rem; }
.tp-info { flex: 1; }
.tp-name { font-weight: 600; font-size: 0.88rem; margin-bottom: 4px; }
.tp-bar-wrap { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.tp-bar { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.tp-pct { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; width: 36px; text-align: right; }
.badges-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 8px; }
.badge-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 10px;
  text-align: center;
  transition: all var(--transition);
}
.badge-card.earned { border-color: var(--gold-dark); background: rgba(249,168,37,0.06); }
.badge-card.locked { opacity: 0.4; filter: grayscale(1); }
.badge-icon { font-size: 1.5rem; margin-bottom: 4px; }
.badge-name { font-size: 0.72rem; font-weight: 700; margin-bottom: 2px; }
.badge-desc { font-size: 0.65rem; color: var(--text-muted); line-height: 1.3; }
.progress-io { margin-top: 8px; }
.io-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.io-buttons label { cursor: pointer; }

/* ===== WWM SCREEN ===== */
.wwm-screen {
  background: radial-gradient(ellipse at center top, #1a1200 0%, #0a0800 60%, #000 100%);
  display: none;
  flex-direction: column;
  min-height: 100vh;
}
.wwm-screen.active { display: flex; }
.wwm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(249,168,37,0.2);
}
.wwm-quit { color: rgba(255,255,255,0.5); }
.wwm-quit:hover { color: var(--danger); }
.wwm-prize-display { text-align: right; }
.wwm-prize-label { font-size: 0.75rem; color: rgba(255,255,255,0.5); display: block; }
.wwm-safe-amount { font-size: 1.1rem; font-weight: 800; color: var(--gold); }
.wwm-body { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 20px 16px; max-width: 600px; width: 100%; margin: 0 auto; }
.wwm-question-num { font-size: 0.8rem; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 8px; }
.wwm-current-prize { font-size: 1.8rem; font-weight: 800; color: var(--gold); text-shadow: 0 0 20px rgba(249,168,37,0.5); margin-bottom: 24px; }
.wwm-question-text {
  background: rgba(249,168,37,0.08);
  border: 1px solid rgba(249,168,37,0.2);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.5;
  width: 100%;
  margin-bottom: 20px;
}
.wwm-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; margin-bottom: 20px; }
.wwm-option {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(249,168,37,0.3);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: #fff;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
}
.wwm-option:hover:not(:disabled) { background: rgba(249,168,37,0.12); border-color: var(--gold); }
.wwm-option.selected { background: rgba(249,168,37,0.15); border-color: var(--gold); }
.wwm-option.correct { background: rgba(52,168,83,0.2); border-color: var(--success); color: var(--success); }
.wwm-option.wrong { background: rgba(234,67,53,0.2); border-color: var(--danger); color: var(--danger); }
.wwm-option.eliminated { opacity: 0.2; pointer-events: none; }
.wwm-option:disabled { cursor: default; }
.wwm-opt-letter {
  width: 26px; height: 26px;
  border: 1px solid currentColor;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700;
  flex-shrink: 0;
  color: var(--gold);
}
.wwm-lifelines { display: flex; gap: 14px; margin-bottom: 12px; }
.wwm-lifeline {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  width: 54px; height: 54px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  color: #fff;
}
.wwm-lifeline:hover:not(:disabled) { border-color: var(--gold); background: rgba(249,168,37,0.15); }
.wwm-lifeline:disabled { opacity: 0.25; cursor: not-allowed; }
.ll-icon { font-size: 0.85rem; font-weight: 700; }
.wwm-prize-ladder {
  width: 100%;
  max-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px;
  border-top: 1px solid rgba(249,168,37,0.1);
}
.wwm-ladder-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.5);
}
.wwm-ladder-row.current { background: rgba(249,168,37,0.2); color: var(--gold); font-weight: 700; }
.wwm-ladder-row.safe { color: rgba(249,168,37,0.7); font-weight: 600; }
.wwm-ladder-row.passed { color: rgba(255,255,255,0.25); }

/* ===== MODALS ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 360px;
  width: 100%;
  display: none;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: scaleIn 0.25s ease;
}
@keyframes scaleIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
.modal.active { display: flex; }
.modal-header { font-size: 1.1rem; font-weight: 800; }
.modal-body { font-size: 0.9rem; color: var(--text-muted); line-height: 1.6; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions button { flex: 1; }
.levelup-body { text-align: center; padding: 10px 0; }
.levelup-number { font-size: 4rem; font-weight: 900; color: var(--gold); text-shadow: 0 0 30px rgba(249,168,37,0.5); }
.badge-body { text-align: center; padding: 10px 0; }
.badge-icon-big { font-size: 3rem; margin-bottom: 8px; }
.badge-name-big { font-size: 1.1rem; font-weight: 800; margin-bottom: 4px; }
.badge-desc-big { font-size: 0.85rem; color: var(--text-muted); }
.audience-bars { margin: 12px 0; display: flex; flex-direction: column; gap: 8px; }
.audience-bar-row { display: flex; align-items: center; gap: 10px; }
.audience-bar-label { width: 20px; font-weight: 700; font-size: 0.9rem; color: var(--gold); }
.audience-bar-wrap { flex: 1; height: 20px; background: var(--border); border-radius: 3px; overflow: hidden; }
.audience-bar-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width 0.5s ease; }
.audience-bar-pct { width: 36px; text-align: right; font-size: 0.82rem; color: var(--text-muted); }
.friend-quote { background: var(--card-bg2); border-radius: var(--radius-sm); padding: 14px; font-style: italic; line-height: 1.6; font-size: 0.9rem; margin-top: 4px; }
.wwm-gameover-header { color: var(--danger); }
.wwm-gameover-body { text-align: center; }
.wwm-go-prize { font-size: 2.5rem; font-weight: 900; color: var(--gold); margin: 8px 0; }
.wwm-go-correct { font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; margin-top: 8px; }
.wwm-modal-btns { display: flex; flex-direction: column; gap: 8px; }
.wwm-modal-btns button { width: 100%; }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 8px 24px var(--shadow);
  z-index: 200;
  transition: transform 0.3s ease;
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== RESPONSIVE ===== */
@media (max-width: 420px) {
  .hub-modes { grid-template-columns: 1fr; }
  .topics-grid { grid-template-columns: 1fr; }
  .wwm-options { grid-template-columns: 1fr; }
  .badges-grid { grid-template-columns: repeat(2, 1fr); }
  .progress-grid { grid-template-columns: 1fr 1fr; }
  .results-actions { flex-direction: column; }
}

@media (min-width: 600px) {
  .quiz-body, .hub-content, .progress-content { padding: 24px; }
  .wwm-body { padding: 24px; }
}
