/* ═══════════════════════════════════════
   DÉBÉTISEUR - Main Stylesheet
   ═══════════════════════════════════════ */

:root {
  --primary: #6C3FC5;
  --primary-dark: #5231A0;
  --primary-light: #8B6CD4;
  --accent: #FF6B35;
  --accent-light: #FF8A5C;
  --bg: #f0ecf7;
  --bg-dark: #1a0a2e;
  --surface: #ffffff;
  --surface-2: #f8f6fc;
  --text: #1a1a2e;
  --text-light: #6b6b8d;
  --text-inverse: #ffffff;
  --success: #2ecc71;
  --error: #e74c3c;
  --warning: #f39c12;

  --bg-body: #f5f2fa;
  --bg-card: #ffffff;
  --border: #e2daf0;

  /* Answer colors (Kahoot! style) */
  --answer-red: #e21b3c;
  --answer-blue: #1368ce;
  --answer-yellow: #d89e00;
  --answer-green: #26890c;
  --answer-orange: #e65100;
  --answer-purple: #7b1fa2;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(108, 63, 197, 0.12);
  --shadow-lg: 0 8px 40px rgba(108, 63, 197, 0.18);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── UTILITIES ─── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 16px rgba(108, 63, 197, 0.4);
}
.btn-primary:hover { box-shadow: 0 6px 24px rgba(108, 63, 197, 0.5); }

.btn-accent {
  background: linear-gradient(135deg, var(--accent), #e85d26);
  color: white;
  box-shadow: 0 4px 16px rgba(255, 107, 53, 0.4);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: white; }

.btn-ghost {
  background: rgba(108, 63, 197, 0.08);
  color: var(--primary);
}
.btn-ghost:hover { background: rgba(108, 63, 197, 0.15); }

.btn-danger { background: var(--error); color: white; }
.btn-success { background: var(--success); color: white; }

.btn-sm { padding: 8px 16px; font-size: 0.875rem; border-radius: var(--radius-sm); }
.btn-lg { padding: 16px 40px; font-size: 1.2rem; }
.btn-icon { padding: 10px; border-radius: 50%; width: 44px; height: 44px; }

/* ─── FORMS ─── */
.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}
.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e2daf0;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  transition: var(--transition);
  background: white;
  color: var(--text);
}
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 63, 197, 0.15);
}
.form-input::placeholder { color: #b0a3c7; }

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236C3FC5' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea.form-input { resize: vertical; min-height: 80px; }

.form-error {
  color: var(--error);
  font-size: 0.85rem;
  margin-top: 4px;
}

/* ─── CARDS ─── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-lg); }
.card-header { margin-bottom: 1rem; }
.card-title { font-size: 1.25rem; font-weight: 700; }

/* ─── NAVIGATION ─── */
.navbar {
  background: white;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-brand {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  text-decoration: none;
  letter-spacing: -0.5px;
}
.navbar-brand span { color: var(--accent); }
.navbar-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
}
.nav-link {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
}
.nav-link:hover, .nav-link.active {
  background: rgba(108, 63, 197, 0.08);
  color: var(--primary);
}

/* ─── PAGES ─── */
.page {
  display: none;
  min-height: calc(100vh - 64px);
}
.page.active { display: block; }
.page-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ─── HOME PAGE ─── */
.hero {
  text-align: center;
  padding: 4rem 1.5rem;
  background: linear-gradient(135deg, var(--bg-dark) 0%, #2d1654 100%);
  color: white;
  min-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.hero h1 {
  font-size: 3.5rem;
  font-weight: 900;
  margin-bottom: 1rem;
  line-height: 1.1;
}
.hero h1 span { color: var(--accent); }
.hero p {
  font-size: 1.25rem;
  opacity: 0.85;
  max-width: 600px;
  margin-bottom: 2.5rem;
}
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }

.join-box {
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius);
  padding: 2rem;
  margin-top: 3rem;
  width: 100%;
  max-width: 400px;
}
.join-box h3 { margin-bottom: 1rem; font-size: 1.2rem; }
.pin-input {
  font-size: 2rem;
  text-align: center;
  letter-spacing: 8px;
  font-weight: 700;
  padding: 16px;
  background: rgba(255,255,255,0.12);
  border: 2px solid rgba(255,255,255,0.25);
  color: white;
  border-radius: var(--radius-sm);
  width: 100%;
}
.pin-input::placeholder { color: rgba(255,255,255,0.4); letter-spacing: 4px; font-size: 1.2rem; }
.pin-input:focus { border-color: var(--accent); outline: none; }

/* PIN on join page (white bg) */
.auth-card .pin-input { background: #f5f2fa; border: 2px solid #e2daf0; color: #1a1a2e; font-size: 1.5rem; }
.auth-card .pin-input::placeholder { color: #6b6b8d; opacity: 0.5; }
.auth-card .pin-input:focus { border-color: #6C3FC5; }

/* ─── AUTH PAGES ─── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 64px);
  background: linear-gradient(135deg, var(--bg-dark) 0%, #2d1654 100%);
}
.auth-card {
  background: white;
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
}
.auth-card h2 { text-align: center; margin-bottom: 1.5rem; }
.auth-switch { text-align: center; margin-top: 1rem; color: var(--text-light); }
.auth-switch a { color: var(--primary); font-weight: 600; text-decoration: none; cursor: pointer; }

/* ─── DASHBOARD ─── */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.dashboard-header h1 { font-size: 1.75rem; }

.quiz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}
.quiz-card {
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.quiz-card .quiz-card-cover {
  height: 120px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius) var(--radius) 0 0;
  margin: -1.5rem -1.5rem 1rem -1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}
.quiz-card h3 { font-size: 1.1rem; margin-bottom: 0.25rem; }
.quiz-card .quiz-meta {
  font-size: 0.85rem;
  color: var(--text-light);
  display: flex;
  gap: 1rem;
}
.quiz-card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-light);
}
.empty-state .icon { font-size: 4rem; margin-bottom: 1rem; }
.empty-state h3 { color: var(--text); margin-bottom: 0.5rem; }

/* ─── QUIZ EDITOR ─── */
.editor-header {
  background: white;
  padding: 1rem 1.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.editor-title-input {
  font-size: 1.25rem;
  font-weight: 700;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 4px 0;
  background: none;
  color: var(--text);
  min-width: 200px;
  transition: var(--transition);
}
.editor-title-input:focus {
  outline: none;
  border-bottom-color: var(--primary);
}

.editor-visibility-select {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
}

/* ─── PREVIEW MODAL ─── */
.preview-modal { max-width: 600px; }
.preview-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.preview-header h3 { margin: 0; }
.preview-counter { font-size: 0.9rem; font-weight: 700; color: var(--primary); background: rgba(108,63,197,0.1); padding: 4px 12px; border-radius: 20px; }
.preview-question-card { background: var(--bg-body); border-radius: 12px; padding: 1.2rem; border: 1px solid var(--border); }
.preview-q-type { font-size: 0.8rem; color: var(--text-light); margin-bottom: 0.5rem; }
.preview-q-text { font-size: 1.15rem; font-weight: 700; margin-bottom: 1rem; line-height: 1.4; }
.preview-media { margin-bottom: 1rem; text-align: center; }
.preview-answers { display: flex; flex-direction: column; gap: 6px; }
.preview-answer { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; background: var(--bg-card); border: 2px solid var(--border); font-weight: 600; }
.preview-answer.correct { border-color: var(--success); background: rgba(46,204,113,0.08); }
.preview-label { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 0.9rem; background: rgba(108,63,197,0.12); color: var(--primary); flex-shrink: 0; }
.preview-answer.correct .preview-label { background: var(--success); color: white; }
.preview-check { margin-left: auto; color: var(--success); font-weight: 900; font-size: 1.1rem; }
.preview-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }

.editor-body {
  display: flex;
  gap: 1.5rem;
  padding: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}
.editor-sidebar {
  width: 220px;
  flex-shrink: 0;
}
.question-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.question-list-item {
  padding: 10px 14px;
  background: white;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  border: 2px solid transparent;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}
.question-list-item:hover { border-color: var(--primary-light); }
.question-list-item.active { border-color: var(--primary); background: #f3eeff; }
.question-list-item .q-num {
  background: var(--primary);
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.question-list-item .q-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.add-question-btn {
  width: 100%;
  padding: 12px;
  border: 2px dashed #d0c4e6;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 0.5rem;
}
.add-question-btn:hover { background: #f3eeff; border-color: var(--primary); }

.editor-main { flex: 1; }

.question-editor-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.question-type-selector {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.type-btn {
  padding: 8px 16px;
  border: 2px solid #e2daf0;
  border-radius: var(--radius-sm);
  background: white;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: var(--transition);
}
.type-btn.active, .type-btn:hover {
  border-color: var(--primary);
  background: #f3eeff;
  color: var(--primary);
}

.question-text-input {
  width: 100%;
  min-height: 100px;
  padding: 1rem;
  border: 2px solid #e2daf0;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  resize: vertical;
  transition: var(--transition);
}
.question-text-input:focus { border-color: var(--primary); outline: none; }

.answers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
}
.answer-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-sm);
  color: white;
  font-weight: 600;
}
.answer-card:nth-child(1) { background: var(--answer-red); }
.answer-card:nth-child(2) { background: var(--answer-blue); }
.answer-card:nth-child(3) { background: var(--answer-yellow); }
.answer-card:nth-child(4) { background: var(--answer-green); }
.answer-card:nth-child(5) { background: var(--answer-orange); }
.answer-card:nth-child(6) { background: var(--answer-purple); }

.answer-card input[type="text"] {
  flex: 1;
  background: rgba(255,255,255,0.2);
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  color: white;
  font-size: 1rem;
  font-weight: 500;
}
.answer-card input[type="text"]::placeholder { color: rgba(255,255,255,0.6); }
.answer-card input[type="text"]:focus { outline: none; background: rgba(255,255,255,0.3); }

.answer-correct-toggle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.15);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  color: transparent;
  font-size: 1rem;
}
.answer-correct-toggle.active {
  background: white;
  border-color: white;
  color: var(--success);
}
.answer-remove {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 4px;
}
.answer-remove:hover { color: white; }

.question-settings {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
  flex-wrap: wrap;
}
.setting-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
}
.setting-group label { font-weight: 500; color: var(--text-light); }
.setting-group select, .setting-group input[type="number"] {
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
}

/* ─── GAME HOST SCREEN ─── */
.game-screen {
  min-height: 100vh;
  background: var(--bg-dark);
  color: white;
}
.game-lobby {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  text-align: center;
}
.game-pin-display {
  font-size: 5rem;
  font-weight: 900;
  letter-spacing: 12px;
  margin: 1.5rem 0;
  background: linear-gradient(135deg, var(--accent), #FF8A5C);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.game-lobby h2 { font-size: 1.5rem; opacity: 0.8; }
.game-lobby .url { opacity: 0.5; font-size: 1rem; margin-bottom: 0.5rem; }

.players-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin: 2rem 0;
  max-width: 800px;
}
.player-chip {
  background: rgba(255,255,255,0.1);
  padding: 10px 20px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 1rem;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
  animation: popIn 0.3s ease;
}

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

/* ─── GAME: Question Display (Host) ─── */
.game-question-screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 1.5rem;
}
.game-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.question-counter { font-size: 1.1rem; opacity: 0.7; }
.timer-display {
  font-size: 2.5rem;
  font-weight: 900;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.1);
  border: 3px solid var(--accent);
}
.timer-display.warning { border-color: var(--error); color: var(--error); animation: pulse 0.5s infinite; }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.game-question-text {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  margin: 2rem 0;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.response-counter {
  text-align: center;
  font-size: 1.2rem;
  opacity: 0.7;
  margin-bottom: 1rem;
}

.game-answers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}
.game-answer-card {
  padding: 1.25rem;
  border-radius: var(--radius);
  font-size: 1.3rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 80px;
}
.game-answer-card:nth-child(1) { background: var(--answer-red); }
.game-answer-card:nth-child(2) { background: var(--answer-blue); }
.game-answer-card:nth-child(3) { background: var(--answer-yellow); }
.game-answer-card:nth-child(4) { background: var(--answer-green); }
.game-answer-card:nth-child(5) { background: var(--answer-orange); }
.game-answer-card:nth-child(6) { background: var(--answer-purple); }

.game-answer-card .shape {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  opacity: 0.6;
}

/* Results */
.results-bar {
  height: 200px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
}
.results-bar-item {
  width: 100%;
  border-radius: 6px 6px 0 0;
  transition: height 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  min-height: 20px;
}
.results-bar-item .bar-count {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  font-weight: 700;
  font-size: 1.1rem;
}

/* ─── LEADERBOARD ─── */
.leaderboard { max-width: 600px; margin: 0 auto; }
.leaderboard-item {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  transition: var(--transition);
  animation: slideInRight 0.4s ease forwards;
  opacity: 0;
}
.leaderboard-item:nth-child(1) { background: rgba(255, 215, 0, 0.15); animation-delay: 0.1s; }
.leaderboard-item:nth-child(2) { background: rgba(192, 192, 192, 0.1); animation-delay: 0.2s; }
.leaderboard-item:nth-child(3) { background: rgba(205, 127, 50, 0.1); animation-delay: 0.3s; }

@keyframes slideInRight {
  from { transform: translateX(40px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.leaderboard-rank {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  margin-right: 14px;
  flex-shrink: 0;
}
.leaderboard-name { flex: 1; font-weight: 600; font-size: 1.1rem; }
.leaderboard-score { font-weight: 800; font-size: 1.2rem; color: var(--accent); }

/* ─── PODIUM ─── */
.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 1rem;
  margin: 3rem 0;
  min-height: 300px;
}
.podium-place {
  text-align: center;
  animation: riseUp 0.8s ease forwards;
  opacity: 0;
}
.podium-place:nth-child(1) { animation-delay: 0.6s; }
.podium-place:nth-child(2) { animation-delay: 0.2s; }
.podium-place:nth-child(3) { animation-delay: 1s; }

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

.podium-name { font-weight: 700; font-size: 1.25rem; margin-bottom: 0.5rem; }
.podium-score { font-size: 1rem; opacity: 0.7; margin-bottom: 0.75rem; }
.podium-bar {
  width: 140px;
  border-radius: var(--radius) var(--radius) 0 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 1rem;
  font-size: 2.5rem;
  font-weight: 900;
}
.podium-place:nth-child(2) .podium-bar { height: 200px; background: linear-gradient(180deg, #FFD700, #FFA500); color: rgba(0,0,0,0.3); }
.podium-place:nth-child(1) .podium-bar { height: 150px; background: linear-gradient(180deg, #C0C0C0, #A0A0A0); color: rgba(0,0,0,0.2); }
.podium-place:nth-child(3) .podium-bar { height: 110px; background: linear-gradient(180deg, #CD7F32, #A0522D); color: rgba(0,0,0,0.2); }

/* ─── PLAYER SCREEN ─── */
.player-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.player-waiting {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  background: var(--bg-dark);
  color: white;
}
.player-waiting .spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1.5rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

.player-answers {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px;
  background: var(--bg-dark);
}
.player-answer-btn {
  border: none;
  border-radius: var(--radius);
  color: white;
  font-size: 1.5rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  min-height: 120px;
}
.player-answer-btn:nth-child(1) { background: var(--answer-red); }
.player-answer-btn:nth-child(2) { background: var(--answer-blue); }
.player-answer-btn:nth-child(3) { background: var(--answer-yellow); }
.player-answer-btn:nth-child(4) { background: var(--answer-green); }
.player-answer-btn:nth-child(5) { background: var(--answer-orange); }
.player-answer-btn:nth-child(6) { background: var(--answer-purple); }
.player-answer-btn:active { transform: scale(0.95); }
.player-answer-btn.selected { opacity: 0.6; transform: scale(0.95); }

.player-feedback {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  color: white;
}
.player-feedback.correct { background: var(--success); }
.player-feedback.incorrect { background: var(--error); }
.player-feedback .icon { font-size: 5rem; margin-bottom: 1rem; }
.player-feedback .points { font-size: 2rem; font-weight: 800; }

/* ─── REPORTS ─── */
.report-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-value { font-size: 2rem; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 0.85rem; color: var(--text-light); margin-top: 4px; }

.report-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.report-table th {
  background: var(--primary);
  color: white;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
}
.report-table td { padding: 12px 16px; border-bottom: 1px solid #f0f0f0; }
.report-table tr:hover td { background: #f8f6fc; }
.report-table tr:last-child td { border-bottom: none; }

/* ─── TOAST NOTIFICATIONS ─── */
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  color: white;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  max-width: 350px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--error); }
.toast.info { background: var(--primary); }

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ─── MODAL ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: white;
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.3s ease;
}
@keyframes modalIn {
  from { transform: scale(0.9) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
.modal h3 { margin-bottom: 1rem; }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; }

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  .hero h1 { font-size: 2.2rem; }
  .game-pin-display { font-size: 3rem; letter-spacing: 8px; }
  .editor-body { flex-direction: column; }
  .editor-sidebar { width: 100%; }
  .question-list { flex-direction: row; overflow-x: auto; padding-bottom: 0.5rem; }
  .question-list-item { min-width: 140px; }
  .answers-grid { grid-template-columns: 1fr; }
  .game-answers-grid { grid-template-columns: 1fr; }
  .game-question-text { font-size: 1.3rem; }
  .podium-bar { width: 100px; }
  .navbar-nav .nav-text { display: none; }
  .lobby-join-info { flex-direction: column !important; }
  .lobby-qr { margin-top: 1rem; }
}

/* ─── AVATAR PICKER ─── */
.avatar-picker { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 8px 0; }
.avatar-option { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; border: 3px solid transparent; transition: all 0.2s ease; background: rgba(108,63,197,0.06); }
.avatar-option:hover { transform: scale(1.15); border-color: var(--primary-light); }
.avatar-option.selected { border-color: var(--primary); background: rgba(108,63,197,0.15); transform: scale(1.15); box-shadow: 0 0 0 3px rgba(108,63,197,0.25); }
.avatar-emoji { font-size: 1.6rem; }
.player-avatar-big { width: 80px; height: 80px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 3rem; margin-bottom: 1rem; }

/* ─── QR CODE & LOBBY LAYOUT ─── */
.lobby-join-info { display: flex; align-items: center; justify-content: center; gap: 3rem; margin-bottom: 1rem; }
.lobby-join-left { text-align: center; }
.lobby-qr { text-align: center; }
.qr-container { background: white; border-radius: 12px; padding: 12px; display: inline-block; box-shadow: 0 4px 20px rgba(0,0,0,0.2); }
.qr-container svg { display: block; width: 140px; height: 140px; }

/* ─── AVATAR IN CHIPS & LEADERBOARD ─── */
.chip-avatar { font-size: 1.3rem; margin-right: 6px; }
.lb-avatar { font-size: 1.5rem; margin-right: 8px; }
.podium-avatar { font-size: 3rem; margin-bottom: 0.5rem; }

/* ─── ANSWER LABELS (A, B, C, D) ─── */
.game-answer-card .shape { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; background: rgba(255,255,255,0.2); font-weight: 900; font-size: 1.1rem; flex-shrink: 0; }

/* ─── PLAYER TIMER ─── */
.player-timer-bar { width: 100%; height: 8px; background: rgba(255,255,255,0.1); border-radius: 4px; overflow: hidden; margin-bottom: 0; }
.player-timer-fill { height: 100%; width: 100%; background: var(--accent); transition: width 0.2s linear, background 0.3s ease; border-radius: 4px; }
.player-timer-text { text-align: center; font-size: 2.5rem; font-weight: 900; color: white; padding: 8px 0; line-height: 1; }

/* ═══════════════════════════════════════
   ADMIN DASHBOARD
   ═══════════════════════════════════════ */

.admin-page { max-width: 1200px; }

.admin-header { margin-bottom: 1.5rem; }
.admin-header h1 { margin-bottom: 1rem; }

.admin-tabs { display: flex; gap: 4px; flex-wrap: wrap; background: var(--bg-card); border-radius: 12px; padding: 4px; border: 1px solid var(--border); }
.admin-tab { padding: 10px 16px; border: none; background: none; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 0.9rem; color: var(--text-light); transition: all 0.2s; white-space: nowrap; }
.admin-tab:hover { background: rgba(108,63,197,0.08); color: var(--text); }
.admin-tab.active { background: var(--primary); color: white; box-shadow: 0 2px 8px rgba(108,63,197,0.3); }

/* Stats grid */
.admin-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.admin-stat-card { display: flex; align-items: center; gap: 1rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 1.2rem; transition: transform 0.15s; }
.admin-stat-card:hover { transform: translateY(-2px); }
.admin-stat-icon { width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex-shrink: 0; color: white; }
.admin-stat-value { font-size: 1.8rem; font-weight: 900; line-height: 1; color: var(--text); }
.admin-stat-label { font-weight: 600; color: var(--text-light); font-size: 0.9rem; margin-top: 2px; }
.admin-stat-sub { font-size: 0.78rem; color: var(--text-light); opacity: 0.7; margin-top: 2px; }

/* Panels */
.admin-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.admin-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 1.2rem; }
.admin-panel h3 { margin-bottom: 1rem; font-size: 1rem; }

/* Plan bars */
.admin-plan-bars { display: flex; flex-direction: column; gap: 10px; }
.plan-bar-row { display: flex; align-items: center; gap: 10px; }
.plan-bar-label { width: 70px; font-weight: 600; font-size: 0.85rem; }
.plan-bar-track { flex: 1; height: 10px; background: var(--bg-body); border-radius: 5px; overflow: hidden; }
.plan-bar-fill { height: 100%; border-radius: 5px; transition: width 0.4s ease; min-width: 4px; }
.plan-bar-count { width: 70px; text-align: right; font-size: 0.82rem; color: var(--text-light); }

/* Top list */
.admin-top-list { display: flex; flex-direction: column; gap: 6px; }
.admin-top-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--bg-body); border-radius: 8px; }
.admin-top-rank { width: 28px; height: 28px; background: var(--primary); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 0.85rem; flex-shrink: 0; }
.admin-top-name { flex: 1; font-weight: 600; }
.admin-top-count { font-size: 0.85rem; color: var(--text-light); font-weight: 600; }

.admin-global-stats { display: flex; gap: 2rem; flex-wrap: wrap; padding: 0.5rem 0; }
.admin-global-stats div { font-size: 0.95rem; color: var(--text-light); }
.admin-global-stats strong { color: var(--text); }

/* Toolbar */
.admin-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 1rem; align-items: center; }
.admin-toolbar .form-input { padding: 8px 12px; font-size: 0.9rem; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-card); }

/* Table */
.admin-table { width: 100%; border-collapse: collapse; background: var(--bg-card); border-radius: 12px; overflow: hidden; border: 1px solid var(--border); font-size: 0.88rem; }
.admin-table thead th { background: var(--bg-body); padding: 10px 12px; text-align: left; font-weight: 700; color: var(--text-light); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; }
.admin-table tbody td { padding: 10px 12px; border-top: 1px solid var(--border); vertical-align: middle; }
.admin-table tbody tr:hover { background: rgba(108,63,197,0.03); }

/* Badges */
.admin-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.78rem; font-weight: 700; white-space: nowrap; }
.badge-admin { background: rgba(108,63,197,0.15); color: var(--primary); }
.badge-user { background: var(--bg-body); color: var(--text-light); }
.badge-public { background: rgba(46,204,113,0.12); color: var(--success); }
.badge-private { background: var(--bg-body); color: var(--text-light); }
.badge-unlisted { background: rgba(241,196,15,0.12); color: #d4a017; }
.badge-approved { background: rgba(46,204,113,0.12); color: var(--success); }
.badge-pending { background: rgba(243,156,18,0.12); color: #e67e22; }

/* Inline select */
.admin-inline-select { padding: 4px 8px; border-radius: 6px; border: 1px solid var(--border); font-size: 0.82rem; background: var(--bg-card); cursor: pointer; font-weight: 600; }
.admin-inline-select.status-suspended { color: var(--error); border-color: var(--error); }

/* Actions */
.admin-actions { display: flex; gap: 2px; }

/* Pagination */
.admin-pagination { display: flex; align-items: center; justify-content: center; gap: 1rem; padding: 1rem 0; color: var(--text-light); font-size: 0.9rem; }

/* Settings */
.admin-settings { display: flex; flex-direction: column; gap: 1rem; }
.settings-grid { display: flex; flex-direction: column; gap: 8px; }
.setting-row { display: flex; align-items: center; gap: 12px; }
.setting-row label { min-width: 120px; font-weight: 600; font-size: 0.9rem; }
.setting-row .form-input { max-width: 120px; padding: 8px 10px; }

@media (max-width: 768px) {
  .admin-panels { grid-template-columns: 1fr; }
  .admin-stats-grid { grid-template-columns: 1fr 1fr; }
  .admin-table { font-size: 0.8rem; }
  .admin-table thead th, .admin-table tbody td { padding: 6px 8px; }
  .admin-toolbar { flex-direction: column; }
  .admin-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .admin-tab { font-size: 0.82rem; padding: 8px 12px; }
}

/* ═══════════════════════════════════════
   PLAYER QUESTION HEADER
   ═══════════════════════════════════════ */

.player-question-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; background: rgba(0,0,0,0.3); color: white; }
.player-q-counter { font-weight: 700; font-size: 0.9rem; opacity: 0.8; }
.player-q-timer { font-size: 2rem; font-weight: 900; line-height: 1; }
.player-q-pts { font-weight: 700; font-size: 0.9rem; opacity: 0.8; }

/* ═══════════════════════════════════════
   MEDIA ZONES (Editor)
   ═══════════════════════════════════════ */

.question-media-zone { margin: 0.75rem 0; }
.media-preview { position: relative; display: inline-block; background: var(--bg-body); border-radius: 10px; padding: 8px; border: 2px solid var(--border); }
.media-remove-btn { position: absolute; top: -6px; right: -6px; width: 26px; height: 26px; border-radius: 50%; background: var(--error); color: white; border: 2px solid white; cursor: pointer; font-size: 0.8rem; display: flex; align-items: center; justify-content: center; line-height: 1; }
.media-remove-btn:hover { transform: scale(1.1); }
.media-upload-area { border: 2px dashed var(--border); border-radius: 10px; padding: 12px; text-align: center; transition: border-color 0.2s; }
.media-upload-area:hover { border-color: var(--primary-light); }
.media-upload-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.media-btn { display: inline-flex !important; align-items: center; gap: 4px; cursor: pointer; font-size: 0.85rem !important; }
.media-hint { display: block; margin-top: 6px; font-size: 0.8rem; color: var(--text-light); opacity: 0.6; }

/* Media in game screens */
.game-media { display: flex; justify-content: center; margin: 0.75rem 0; }
.game-media img, .game-media video { border-radius: 12px; max-height: 250px; }
.game-media audio { max-width: 400px; }
.player-media { display: flex; justify-content: center; padding: 8px 16px; }
.player-media img { max-height: 150px; border-radius: 8px; object-fit: contain; }
.player-media video { max-height: 150px; border-radius: 8px; }
.player-media audio { width: 100%; max-width: 350px; }

/* ═══════════════════════════════════════
   LIBRARY PAGE
   ═══════════════════════════════════════ */

.library-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 1rem; }
.library-header h1 { margin: 0; }
.library-search { display: flex; gap: 8px; flex-wrap: wrap; }
.library-search .form-input { padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-card); font-size: 0.9rem; }

.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.library-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; transition: transform 0.15s, box-shadow 0.15s; cursor: pointer; }
.library-card:hover { transform: translateY(-3px); box-shadow: 0 8px 25px rgba(0,0,0,0.1); }
.library-card-cover { height: 80px; background: linear-gradient(135deg, var(--primary), var(--accent)); display: flex; align-items: center; justify-content: center; font-size: 2.5rem; }
.library-card-body { padding: 1rem; }
.library-card-body h3 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.library-card-meta { display: flex; gap: 0.8rem; font-size: 0.82rem; color: var(--text-light); flex-wrap: wrap; }
.library-card-actions { padding: 0.75rem 1rem; border-top: 1px solid var(--border); display: flex; gap: 6px; }

.library-empty { text-align: center; padding: 3rem; color: var(--text-light); }
.library-empty .icon { font-size: 3rem; margin-bottom: 1rem; }

.library-pagination { display: flex; align-items: center; justify-content: center; gap: 1rem; padding: 1.5rem 0; color: var(--text-light); font-size: 0.9rem; }

/* ─── LIBRARY PRICE BADGE ─── */
.library-card-price { display: inline-block; margin-top: 8px; padding: 4px 12px; border-radius: 20px; font-size: 0.85rem; font-weight: 800; background: rgba(243,156,18,0.12); color: #e67e22; }
.library-card-price.free { background: rgba(46,204,113,0.12); color: var(--success); }

/* ─── SHARE BUTTONS ─── */
.share-buttons { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 1rem; }
.share-btn { display: inline-flex; align-items: center; justify-content: center; padding: 10px 18px; border-radius: 10px; font-weight: 700; font-size: 0.9rem; text-decoration: none; cursor: pointer; border: none; transition: transform 0.15s, opacity 0.15s; color: white; }
.share-btn:hover { transform: scale(1.05); opacity: 0.9; }
.share-btn.whatsapp { background: #25D366; }
.share-btn.facebook { background: #1877F2; }
.share-btn.twitter { background: #1DA1F2; }
.share-btn.linkedin { background: #0A66C2; }
.share-btn.instagram { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }
.share-btn.native { background: var(--primary); }
.share-btn.copy { background: var(--bg-body); color: var(--text); border: 1px solid var(--border); }

/* Mini share (player result screen) */
.share-buttons-mini { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.share-btn-mini { display: inline-block; padding: 6px 14px; border-radius: 20px; font-size: 0.8rem; font-weight: 700; text-decoration: none; cursor: pointer; border: none; color: white; }
.share-btn-mini.whatsapp { background: #25D366; }
.share-btn-mini.instagram { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }
.share-btn-mini.twitter { background: #1DA1F2; }
.share-btn-mini.copy { background: rgba(255,255,255,0.15); color: white; border: 1px solid rgba(255,255,255,0.2); }

/* ─── PURCHASES ─── */
.purchases-list { display: flex; flex-direction: column; gap: 10px; }
.purchase-card { display: flex; align-items: center; gap: 1rem; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 1rem 1.2rem; }
.purchase-icon { font-size: 2rem; }
.purchase-info { flex: 1; }
.purchase-info h3 { margin: 0; font-size: 1rem; }
.purchase-type { font-size: 0.82rem; color: var(--text-light); display: block; }
.purchase-date { font-size: 0.8rem; color: var(--text-light); opacity: 0.6; display: block; }
.purchase-price { font-weight: 800; font-size: 1.1rem; color: var(--accent); white-space: nowrap; }

/* ─── FOOTER ─── */
.site-footer { background: var(--bg-dark); color: rgba(255,255,255,0.7); padding: 2.5rem 1rem 1.5rem; margin-top: auto; }
.footer-content { max-width: 900px; margin: 0 auto; text-align: center; }
.footer-brand { font-size: 1.2rem; margin-bottom: 1rem; }
.footer-brand span { display: block; font-size: 0.85rem; opacity: 0.5; margin-top: 2px; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; margin-bottom: 1rem; }
.footer-links a { color: rgba(255,255,255,0.6); text-decoration: none; font-size: 0.88rem; cursor: pointer; transition: color 0.2s; }
.footer-links a:hover { color: white; }
.footer-copy { font-size: 0.78rem; opacity: 0.4; }

/* ─── LEGAL PAGES ─── */
.legal-page { max-width: 800px; margin: 0 auto; padding: 2rem 1rem; }
.legal-page h1 { font-size: 1.8rem; margin-bottom: 1.5rem; color: var(--primary); }
.legal-content h2 { font-size: 1.15rem; color: var(--text); margin: 1.5rem 0 0.5rem; font-weight: 700; }
.legal-content p { line-height: 1.7; color: var(--text-light); margin-bottom: 0.8rem; }
.legal-content strong { color: var(--text); }
.legal-content a { color: var(--primary); text-decoration: none; }
.legal-content a:hover { text-decoration: underline; }
.legal-back { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
