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

:root {
  --primary: #0E8C7F;
  --primary-dark: #0A6B62;
  --primary-light: #3BB5A7;
  --accent: #FF6B35;
  --accent-light: #FF8A5C;
  --bg: #EFF7F6;
  --bg-dark: #0A2A2A;
  --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; }
html { overflow-x: hidden; }
img { max-width: 100%; height: auto; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}
/* Allow selection in editable fields */
input, textarea, select, [contenteditable] { -webkit-user-select: text; -moz-user-select: text; user-select: text; }
/* Fix mobile tap delay on all interactive elements */
button, a, .btn, [onclick] { touch-action: manipulation; }

.page { flex: 1; }

/* ─── 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-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }
.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='%230E8C7F' 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;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  white-space: nowrap;
}
.navbar-logo { width: 32px; height: 32px; object-fit: contain; }
.brand-text { color: var(--primary); }
.brand-text span { color: var(--accent); }

.hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  padding: 6px;
  color: var(--text);
  line-height: 1;
}
.navbar-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  flex-wrap: wrap;
}
.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);
}

/* ─── USER AVATAR DROPDOWN ─── */
.nav-user-container { position: relative; }
.nav-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 2px solid transparent;
  border-radius: 50px;
  padding: 4px 12px 4px 4px;
  cursor: pointer;
  transition: all 0.2s;
}
.nav-user-btn:hover { background: rgba(14,140,127,0.06); border-color: rgba(14,140,127,0.12); }
.nav-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.nav-user-name { font-weight: 600; color: var(--text); font-size: 0.9rem; }

.nav-user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  border: 1px solid var(--border);
  min-width: 240px;
  z-index: 300;
  overflow: hidden;
  animation: dropdownFade 0.15s ease;
}
.nav-user-dropdown.show { display: block; }
@keyframes dropdownFade { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

.nav-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
}
.nav-user-avatar-lg {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.nav-user-display { font-weight: 700; color: var(--text); font-size: 0.95rem; }
.nav-user-email { font-size: 0.8rem; color: var(--text-light); margin-top: 2px; }
.nav-user-divider { height: 1px; background: var(--border); }
.nav-user-item {
  display: block;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s;
}
.nav-user-item:hover { background: rgba(14,140,127,0.06); }
.nav-user-danger { color: var(--error); }
.nav-user-danger:hover { background: rgba(231,76,60,0.06); }

/* ─── PAGES ─── */
.page {
  display: none;
}
.page.active { display: flex; flex-direction: column; }
.page-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  /* Fix responsive : empêche l'élargissement au-delà du viewport
     (min-width:auto des enfants flex + tableaux admin larges) */
  width: 100%;
  min-width: 0;
}

/* ─── HOME PAGE ─── */
.hero {
  text-align: center;
  padding: 4rem 1.5rem;
  background: linear-gradient(135deg, var(--bg-dark) 0%, #0D3D3D 100%);
  color: white;
  flex: 1;
  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-badge {
  display: inline-block;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 30px;
  padding: 8px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  opacity: 0.9;
  letter-spacing: 0.3px;
}
.hero-desc {
  font-size: 1.2rem;
  opacity: 0.85;
  max-width: 650px;
  margin-bottom: 2rem;
  line-height: 1.6;
}
.hero-features {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 600px;
  width: 100%;
  margin-bottom: 2.5rem;
  text-align: left;
}
.hero-feature {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 0.95rem;
  line-height: 1.5;
  opacity: 0.9;
}
.hero-feature-icon { font-size: 1.4rem; flex-shrink: 0; margin-top: 2px; }
.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: #0E8C7F; }

/* ─── AUTH PAGES ─── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  background: linear-gradient(135deg, var(--bg-dark) 0%, #0D3D3D 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(14,140,127,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(14,140,127,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: #E8F6F4; }
.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;
}

.question-limit-info { text-align: center; padding: 6px 0; }

.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: #E8F6F4; 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: #E8F6F4;
  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: flex-start;
  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-textarea {
  flex: 1;
  background: rgba(255,255,255,0.2);
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  color: white;
  font-size: 0.95rem;
  font-weight: 500;
  font-family: inherit;
  resize: vertical;
  min-height: 40px;
  line-height: 1.4;
}
.answer-textarea::placeholder { color: rgba(255,255,255,0.6); }
.answer-textarea: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.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 80px;
  word-break: break-word;
  line-height: 1.3;
}
.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.1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  min-height: 80px;
  padding: 12px;
  word-break: break-word;
  line-height: 1.3;
  text-align: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(255,255,255,0.2);
}
.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;
  display: block;
  overflow-x: auto;
}
.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 ─── */

/* Tablet */
@media (max-width: 900px) {
  .navbar { padding: 0 1rem; }
  .navbar-nav { gap: 0.15rem; }
  .nav-link { padding: 6px 10px; font-size: 0.85rem; }
  .page-content { padding: 1.5rem 1rem; }
  .hero h1 { font-size: 2.5rem; }
  .hero-desc { font-size: 1.05rem; }
  .quiz-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
  .library-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
  .admin-stats-grid { grid-template-columns: 1fr 1fr; }
  .admin-panels { grid-template-columns: 1fr; }
}

/* Mobile */
@media (max-width: 640px) {
  /* Navbar - hamburger */
  .navbar { padding: 0 0.75rem; height: 56px; }
  .navbar-brand { font-size: 1.2rem; gap: 6px; }
  .navbar-logo { width: 26px; height: 26px; }
  .hamburger { display: block; }
  .navbar-nav {
    display: none;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
    gap: 0;
    z-index: 200;
    overflow-y: auto;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  }
  .navbar-nav.open { display: flex; }
  .navbar-nav li { border-bottom: 1px solid var(--border); }
  .navbar-nav li:last-child { border-bottom: none; }
  .navbar-nav .nav-link { display: block; padding: 14px 12px; font-size: 1rem; }
  .navbar-nav .nav-text { display: inline !important; }
  .navbar-nav .btn { margin: 8px 0; width: 100%; text-align: center; display: block; }

  /* User dropdown: inline in mobile menu */
  .nav-user-container { border-bottom: none !important; margin-top: auto; padding-top: 0.5rem; border-top: 2px solid var(--border); }
  .nav-user-btn { width: 100%; padding: 12px; border-radius: 10px; background: rgba(14,140,127,0.04); }
  .nav-user-name { display: inline !important; }
  .nav-user-dropdown { position: static; box-shadow: none; border: none; border-radius: 0; min-width: 0; animation: none; }
  .nav-user-dropdown.show { display: block; }
  .nav-user-info { display: none; }
  .nav-user-divider { display: none; }
  .nav-user-item { padding: 12px; border-radius: 8px; }

  /* Global */
  .page-content { padding: 1rem 0.75rem; }
  .btn-lg { padding: 12px 20px; font-size: 0.95rem; }

  /* Hero */
  .hero { padding: 2rem 1rem; }
  .hero h1 { font-size: 1.8rem; }
  .hero-badge { font-size: 0.82rem; padding: 6px 14px; margin-bottom: 1rem; }
  .hero-desc { font-size: 0.95rem; margin-bottom: 1.5rem; }
  .hero-features { gap: 0.75rem; margin-bottom: 1.5rem; }
  .hero-feature { padding: 10px 14px; font-size: 0.88rem; }
  .hero-feature-icon { font-size: 1.2rem; }
  .hero-actions { gap: 0.5rem; }
  .hero-actions .btn { padding: 10px 16px; font-size: 0.9rem; }
  .join-box { padding: 1.25rem; margin-top: 1.5rem; max-width: 100%; }
  .pin-input { font-size: 1.5rem; letter-spacing: 6px; padding: 12px; }

  /* Auth - no white gap */
  .auth-page { padding: 1.5rem 1rem; align-items: flex-start; padding-top: 3rem; }
  .auth-card { padding: 1.5rem; max-width: 100%; }
  .form-row { flex-direction: column; gap: 0; }

  /* Dashboard */
  .dashboard-header { margin-bottom: 1rem; }
  .dashboard-header h1 { font-size: 1.3rem; }
  .pricing-banner { padding: 0.75rem 1rem; }
  .pricing-banner p { font-size: 0.88rem; }
  .quiz-grid { grid-template-columns: 1fr; gap: 1rem; }
  .quiz-card .quiz-card-cover { height: 90px; }

  /* Editor */
  .editor-header { padding: 0.75rem; flex-direction: column; align-items: stretch; gap: 0.5rem; }
  .editor-header .flex { flex-wrap: wrap; gap: 0.4rem; }
  .editor-title-input { font-size: 1rem; min-width: 0; width: 100%; }
  .editor-visibility-select { font-size: 0.8rem; padding: 5px 8px; }
  .editor-body { flex-direction: column; padding: 0.75rem; gap: 0.75rem; }
  .editor-sidebar { width: 100%; }
  .question-list { flex-direction: row; overflow-x: auto; padding-bottom: 0.5rem; }
  .question-list-item { min-width: 130px; }
  .answers-grid { grid-template-columns: 1fr; }

  /* Game */
  .game-answers-grid { grid-template-columns: 1fr; gap: 8px; }
  .game-question-text { font-size: 1.1rem; padding: 0.75rem; }
  .game-top-bar { padding: 0.5rem 0.75rem; }
  .game-pin-display { font-size: 2.5rem; letter-spacing: 6px; }
  .podium-bar { width: 80px; }
  .lobby-join-info { flex-direction: column !important; gap: 1rem; }
  .lobby-qr { margin-top: 0.5rem; }

  /* Library */
  .library-header { flex-direction: column; align-items: stretch; }
  .library-header h1 { font-size: 1.3rem; }
  .library-search .form-input { width: 100%; }
  .library-grid { grid-template-columns: 1fr; }
  .library-categories { gap: 4px; }
  .cat-pill { padding: 5px 10px; font-size: 0.78rem; }
  .library-card-actions { flex-wrap: wrap; }

  /* Reports */
  .report-table { font-size: 0.82rem; }
  .report-table th, .report-table td { padding: 6px 8px; }

  /* Purchases */
  .purchase-card { flex-wrap: wrap; gap: 0.75rem; padding: 0.75rem; }
  .purchase-icon { font-size: 1.5rem; }
  .purchase-info h3 { font-size: 0.9rem; }

  /* Admin */
  .admin-stats-grid { grid-template-columns: 1fr; }
  .admin-stat-card { padding: 0.75rem; }
  .admin-toolbar { flex-direction: column; }
  /* Spécificité renforcée : les règles de base .admin-tabs (flex-wrap:wrap)
     et .admin-table (overflow:hidden) sont définies PLUS BAS dans ce fichier
     et écrasaient ces règles mobiles à spécificité égale */
  #admin-tabs.admin-tabs { overflow-x: auto; flex-wrap: nowrap; max-width: 100%; }
  .admin-tab { font-size: 0.78rem; padding: 7px 10px; white-space: nowrap; }
  #admin-content .admin-table { font-size: 0.78rem; display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .admin-table thead th, .admin-table tbody td { padding: 5px 6px; }

  /* Modal */
  .modal { padding: 1.25rem; margin: 0.5rem; max-height: 90vh; overflow-y: auto; }
  .modal-actions { flex-direction: column; }
  .modal-actions .btn { width: 100%; }

  /* Share */
  .share-buttons { gap: 6px; }
  .share-btn { padding: 8px 12px; font-size: 0.8rem; }

  /* Legal */
  .legal-page { padding: 1.5rem 0.75rem; }
  .legal-page h1 { font-size: 1.4rem; }

  /* Footer */
  .site-footer { padding: 1.5rem 0.75rem 1rem; }
  .footer-links { gap: 6px 14px; }
  .footer-links a { font-size: 0.82rem; }

  /* Preview */
  .preview-modal { margin: 0.5rem; }
  .preview-nav { flex-wrap: wrap; gap: 4px; justify-content: center; }

  /* Settings */
  .settings-grid { gap: 0.5rem; }
  .setting-row { flex-direction: column; gap: 4px; }
  .setting-row .form-input { max-width: 100%; }
}

/* Very small phones */
@media (max-width: 380px) {
  .navbar-brand { font-size: 1rem; }
  .navbar-logo { width: 22px; height: 22px; }
  .hero h1 { font-size: 1.5rem; }
  .btn { padding: 8px 12px; font-size: 0.85rem; }
  .auth-card { padding: 1.25rem; }
  .form-group label { font-size: 0.88rem; }
  .form-input { padding: 10px 12px; font-size: 0.9rem; }
}

/* ─── AVATAR PICKER ─── */
.avatar-picker { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 8px 0; }
.avatar-option { width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; border: 3px solid transparent; transition: all 0.2s ease; background: rgba(14,140,127,0.06); }
.avatar-option:hover { transform: scale(1.15); border-color: var(--primary-light); }
.avatar-option.selected { border-color: var(--primary); background: rgba(14,140,127,0.15); transform: scale(1.15); box-shadow: 0 0 0 3px rgba(14,140,127,0.25); }
.avatar-emoji { font-size: 2.4rem; }
.player-avatar-big { width: 120px; height: 120px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 4.5rem; 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: 2rem; margin-right: 6px; }
.lb-avatar { font-size: 2.2rem; margin-right: 8px; }
.podium-avatar { font-size: 4.5rem; 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(14,140,127,0.08); color: var(--text); }
.admin-tab.active { background: var(--primary); color: white; box-shadow: 0 2px 8px rgba(14,140,127,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(14,140,127,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(14,140,127,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-paid { background: rgba(255,107,53,0.12); color: var(--accent); }
.badge-solo { background: rgba(14,140,127,0.12); color: var(--primary); }
.badge-unlisted { background: rgba(52,152,219,0.12); color: #3498db; }
.badge-approved { background: rgba(46,204,113,0.12); color: var(--success); }

/* ─── DASHBOARD SEARCH ─── */
.dashboard-search { margin-bottom: 1rem; }
.dashboard-search .form-input { width: 100%; max-width: 400px; }

/* ─── PRICING BANNER ─── */
.pricing-banner {
  background: linear-gradient(135deg, rgba(14,140,127,0.06), rgba(255,107,53,0.06));
  border: 1px solid rgba(14,140,127,0.15);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}
.pricing-banner p { margin: 0; font-size: 0.95rem; color: var(--text); }
.pricing-banner p + p { margin-top: 4px; }
.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; }

/* Admin responsive handled above */

/* ═══════════════════════════════════════
   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 .footer-tagline { 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); }

/* ─── CATEGORY PILLS ─── */
.library-categories { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 1rem; }
.cat-pill { display: inline-flex; align-items: center; gap: 4px; padding: 6px 14px; border-radius: 20px; font-size: 0.85rem; font-weight: 600; cursor: pointer; border: 2px solid var(--border); background: var(--bg-card); color: var(--text); transition: all 0.15s; }
.cat-pill:hover { border-color: var(--primary-light); background: rgba(14,140,127,0.05); }
.cat-pill.active { border-color: var(--primary); background: var(--primary); color: white; }
.cat-badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 700; background: rgba(14,140,127,0.1); color: var(--primary); margin-bottom: 4px; }

/* ─── GAME BRAND ─── */
.game-brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 1rem; opacity: 0.9; }
.game-brand-logo { width: 42px; height: 42px; object-fit: contain; }
.game-brand span { font-size: 1.5rem; font-weight: 800; color: white; }
.game-brand-accent { color: var(--accent); }
.player-waiting .game-brand, .player-feedback .game-brand { margin-bottom: 0.5rem; }
.solo-game-header .game-brand { margin-bottom: 0; justify-content: flex-start; }
.solo-game-header .game-brand span { font-size: 1.1rem; }
.solo-game-header .game-brand-logo { width: 28px; height: 28px; }

/* ─── FULLSCREEN BUTTON ─── */
.fullscreen-btn { position: absolute; top: 12px; right: 12px; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2); color: white; width: 40px; height: 40px; border-radius: 10px; cursor: pointer; font-size: 1.3rem; display: flex; align-items: center; justify-content: center; transition: all 0.2s; z-index: 10; }
.fullscreen-btn:hover { background: rgba(255,255,255,0.25); }
.game-lobby, .game-question-screen, .solo-game-screen, .solo-results-screen { position: relative; }

@media (max-width: 640px) {
  .game-brand span { font-size: 1.2rem; }
  .game-brand-logo { width: 32px; height: 32px; }
  .fullscreen-btn { width: 34px; height: 34px; font-size: 1.1rem; top: 8px; right: 8px; }
  .solo-game-header .game-brand span { font-size: 0.95rem; }
  .solo-game-header .game-brand-logo { width: 24px; height: 24px; }
  .avatar-option { width: 58px; height: 58px; }
  .avatar-emoji { font-size: 1.9rem; }
  .podium-avatar { font-size: 3.5rem; }
  .lb-avatar { font-size: 1.8rem; }
  .chip-avatar { font-size: 1.6rem; }
}

/* ─── HOST STATS PANEL (end of game) ─── */
.host-stats-panel { margin-top: 2rem; padding: 1.5rem; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12); border-radius: 14px; text-align: left; }
.host-stats-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; margin-bottom: 1rem; }
.host-stat-box { background: rgba(255,255,255,0.1); border-radius: 10px; padding: 1rem; text-align: center; }
.host-stat-val { font-size: 1.5rem; font-weight: 900; color: var(--accent); }
.host-stat-lbl { font-size: 0.8rem; opacity: 0.7; margin-top: 4px; }
.host-stats-table { width: 100%; border-collapse: collapse; background: rgba(255,255,255,0.06); border-radius: 10px; overflow: hidden; }
.host-stats-table th { padding: 10px 12px; text-align: left; font-size: 0.82rem; opacity: 0.6; border-bottom: 1px solid rgba(255,255,255,0.1); }
.host-stats-table td { padding: 8px 12px; border-bottom: 1px solid rgba(255,255,255,0.06); font-size: 0.9rem; }
.host-stats-question { background: rgba(255,255,255,0.06); border-radius: 10px; padding: 12px; margin-bottom: 8px; }
.host-stats-actions { display: flex; gap: 1rem; justify-content: center; margin-top: 1.5rem; flex-wrap: wrap; }

@media (max-width: 640px) {
  .host-stats-summary { grid-template-columns: 1fr 1fr; }
  .host-stat-val { font-size: 1.2rem; }
  .host-stats-table { font-size: 0.8rem; display: block; overflow-x: auto; }
  .host-stats-panel { padding: 1rem; }
}

/* ─── SOLO INTRO ─── */
.solo-intro { color: var(--text-light); font-size: 1.05rem; margin-bottom: 1.5rem; text-align: center; }

/* ─── SOLO GAME ─── */
.solo-game-screen { min-height: 100vh; background: linear-gradient(135deg, var(--bg-dark) 0%, #0D3D3D 100%); color: white; display: flex; flex-direction: column; padding: 0; }
.solo-game-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 56px 14px 20px; background: rgba(0,0,0,0.3); }
.solo-game-counter { font-weight: 700; font-size: 0.95rem; opacity: 0.8; }
.solo-game-score { font-weight: 800; font-size: 1.1rem; color: var(--accent); }
.solo-game-timer { width: 48px; height: 48px; border-radius: 50%; background: rgba(255,255,255,0.15); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; font-weight: 900; }
.solo-game-progress { height: 4px; background: rgba(255,255,255,0.1); }
.solo-game-progress-fill { height: 100%; background: var(--accent); transition: width 0.3s; border-radius: 2px; }
.solo-game-question { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1.5rem 1rem; text-align: center; }
.solo-game-question h2 { font-size: 1.5rem; line-height: 1.4; max-width: 700px; margin-bottom: 1rem; }
.solo-game-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 1.5rem 2rem; max-width: 800px; width: 100%; margin: 0 auto; }
.solo-answer-btn { border: none; border-radius: 12px; color: white; padding: 18px 16px; cursor: pointer; display: flex; align-items: center; gap: 12px; font-size: 1rem; font-weight: 600; transition: all 0.2s; text-align: left; word-break: break-word; line-height: 1.3; min-height: 60px; touch-action: manipulation; -webkit-tap-highlight-color: rgba(255,255,255,0.2); }
.solo-answer-btn:hover { transform: scale(1.02); }
.solo-answer-btn:active { transform: scale(0.98); }
.solo-answer-label { width: 32px; height: 32px; border-radius: 8px; background: rgba(255,255,255,0.25); display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 0.9rem; flex-shrink: 0; }
.solo-answer-text { flex: 1; }
.solo-feedback { text-align: center; padding: 16px; font-size: 1.2rem; font-weight: 800; animation: feedbackPop 0.3s ease; }
.solo-feedback.correct { color: var(--success); }
.solo-feedback.wrong { color: var(--error); }
@keyframes feedbackPop { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ─── SOLO RESULTS ─── */
.solo-results-screen { min-height: 100vh; background: linear-gradient(135deg, var(--bg-dark) 0%, #0D3D3D 100%); color: white; padding: 2rem 1.5rem; text-align: center; }
.solo-results-screen h1 { font-size: 2.5rem; margin-bottom: 0.5rem; }
.solo-results-screen h2 { font-size: 1.2rem; opacity: 0.7; margin-bottom: 2rem; font-weight: 500; }
.solo-results-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; max-width: 500px; margin: 0 auto 2rem; }
.solo-result-box { background: rgba(255,255,255,0.1); border-radius: 12px; padding: 1.25rem; }
.solo-result-val { font-size: 1.5rem; font-weight: 900; color: var(--accent); }
.solo-result-lbl { font-size: 0.82rem; opacity: 0.6; margin-top: 4px; }
.solo-results-detail { max-width: 600px; margin: 0 auto 2rem; text-align: left; }
.solo-result-question { background: rgba(255,255,255,0.06); border-radius: 10px; padding: 12px 16px; margin-bottom: 8px; border-left: 4px solid var(--error); }
.solo-result-question.correct { border-left-color: var(--success); }
.solo-rq-header { display: flex; align-items: flex-start; gap: 10px; }
.solo-rq-num { width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,0.15); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.85rem; flex-shrink: 0; }
.solo-rq-badge { margin-left: auto; flex-shrink: 0; font-size: 1.1rem; }
.solo-rq-correct { font-size: 0.85rem; color: var(--success); margin-top: 6px; padding-left: 38px; }
.solo-results-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

@media (max-width: 640px) {
  .solo-game-header { padding: 10px 48px 10px 12px; }
  .solo-game-timer { width: 40px; height: 40px; font-size: 1.1rem; }
  .solo-game-question { padding: 1.5rem 1rem 0.75rem; }
  .solo-game-question h2 { font-size: 1.15rem; }
  .solo-game-answers { grid-template-columns: 1fr; padding: 0 1rem 1.5rem; }
  .solo-answer-btn { padding: 14px 12px; font-size: 0.92rem; min-height: 50px; }
  .solo-results-screen { padding: 1.5rem 1rem; }
  .solo-results-screen h1 { font-size: 1.8rem; }
  .solo-results-summary { grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
  .solo-result-val { font-size: 1.2rem; }
  .solo-result-box { padding: 0.75rem; }
}
