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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f0f14;
  color: #f2f2f5;
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 480px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

h1 { font-size: 1.3rem; }

#score-bar {
  background: #1e1e2a;
  padding: 8px 14px;
  border-radius: 20px;
  font-weight: 600;
}

#quote-card {
  background: linear-gradient(135deg, #262636, #1a1a24);
  border-radius: 16px;
  padding: 28px 20px;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

#quote-text {
  font-size: 1.2rem;
  font-style: italic;
  line-height: 1.5;
}

#choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.choice-btn {
  background: #1e1e2a;
  color: #f2f2f5;
  border: 1px solid #33333f;
  border-radius: 12px;
  padding: 14px;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.choice-btn:active { background: #2c2c3a; }
.choice-btn.correct { background: #1f7a3d; border-color: #1f7a3d; }
.choice-btn.wrong { background: #7a1f2b; border-color: #7a1f2b; }
.choice-btn:disabled { opacity: 0.7; cursor: default; }

#feedback {
  text-align: center;
  min-height: 24px;
  font-weight: 600;
}

.screen {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  text-align: center;
}

.hidden { display: none !important; }

input {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #33333f;
  background: #1e1e2a;
  color: #f2f2f5;
  font-size: 1rem;
}

button#start-btn, button#restart-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: #4f7cff;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

#leaderboard {
  width: 100%;
  text-align: left;
  padding-left: 20px;
}

#leaderboard li { padding: 4px 0; }

#game { display: none; flex-direction: column; gap: 16px; }
#game.active { display: flex; }

/* --- Auth pages --- */
.auth-card {
  background: #1e1e2a;
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-card h1 { font-size: 1.3rem; text-align: center; margin-bottom: 4px; }

.auth-card label { font-size: 0.85rem; color: #b0b0bc; }

.btn-primary {
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: #4f7cff;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary {
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #33333f;
  background: #2a2a38;
  color: #f2f2f5;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #6a6a78;
  font-size: 0.8rem;
  margin: 4px 0;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #33333f;
}

.error-msg { color: #ff6b7a; font-size: 0.9rem; text-align: center; min-height: 20px; }
.success-msg { color: #4fd67c; font-size: 0.9rem; text-align: center; min-height: 20px; }

.auth-links {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
}
.auth-links a { color: #8ab4ff; text-decoration: none; }

#logout-btn {
  background: none;
  border: 1px solid #33333f;
  color: #b0b0bc;
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 0.8rem;
  cursor: pointer;
}

/* --- Barre de navigation fixe en bas d'écran --- */
body.has-bottom-nav #app {
  padding-bottom: 78px;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  background: #14141c;
  border-top: 1px solid #26262f;
  border-left: 1px solid #26262f;
  border-right: 1px solid #26262f;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav-lang {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border-bottom: 1px solid #21212b;
}
.lang-toggle-group { display: flex; gap: 6px; }

.bottom-nav-legal {
  font-size: 0.62rem;
  color: #5a5a68;
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40%;
  padding: 0 6px;
}
.bottom-nav-legal:hover { color: #8a8a98; }
.bottom-nav-lang .lang-btn {
  background: #1e1e2a;
  border: 1px solid #33333f;
  color: #b0b0bc;
  border-radius: 8px;
  padding: 3px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
}
.bottom-nav-lang .lang-btn.active {
  background: #4f7cff;
  border-color: #4f7cff;
  color: white;
}

.quick-actions-group { display: flex; gap: 4px; }
.quick-action-btn {
  background: none;
  border: none;
  color: #8a8a98;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}
.quick-action-btn:hover,
.quick-action-btn:active {
  background: #1e1e2a;
  color: #d0d0d8;
}
.quick-action-btn svg { width: 18px; height: 18px; }

.bottom-nav-icons {
  display: flex;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 10px 4px 8px;
  color: #7a7a88;
  text-decoration: none;
  font-size: 0.65rem;
  position: relative;
}

.bottom-nav-item svg {
  width: 22px;
  height: 22px;
}

.bottom-nav-item.active {
  color: #4f7cff;
}

.bottom-nav-item .tab-dot {
  position: absolute;
  top: 4px;
  right: calc(50% - 18px);
  width: 8px;
  height: 8px;
  background: #e0304a;
  border-radius: 50%;
}

/* --- Sous-onglets propres à une page (ex: page Classement) --- */
.page-tabs-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 16px;
}
.page-tabs-arrow {
  flex: 0 0 auto;
  background: #1e1e2a;
  border: 1px solid #33333f;
  color: #d0d0d8;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.page-tabs-arrow:hover { background: #2a2a38; }

.page-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  flex: 1;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.page-tabs::-webkit-scrollbar { display: none; }

.page-tab-btn {
  flex: 0 0 auto;
  background: #1e1e2a;
  border: 1px solid #33333f;
  color: #b0b0bc;
  padding: 9px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.page-tab-btn.active {
  background: #4f7cff;
  border-color: #4f7cff;
  color: white;
}
.page-tab-panel { display: none; }
.page-tab-panel.active { display: block; }

/* --- Modale de don --- */
.donate-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.donate-modal {
  background: #1e1e2a;
  border-radius: 16px;
  padding: 24px;
  max-width: 340px;
  width: 100%;
  text-align: center;
}
.donate-modal h3 { font-size: 1.1rem; margin-bottom: 8px; }
.donate-modal p { color: #b0b0bc; font-size: 0.9rem; margin-bottom: 16px; line-height: 1.5; }
.donate-modal a.btn-primary { display: block; text-align: center; text-decoration: none; padding: 12px; border-radius: 12px; margin-bottom: 10px; }
.donate-modal button.btn-small { width: 100%; }

/* --- Language switcher --- */
.lang-switch {
  display: flex;
  gap: 4px;
}
.lang-btn {
  background: #1e1e2a;
  border: 1px solid #33333f;
  color: #b0b0bc;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}
.lang-btn.active {
  background: #4f7cff;
  border-color: #4f7cff;
  color: white;
}

.top-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 4px;
}

/* --- Footer légal --- */
.site-footer {
  text-align: center;
  font-size: 0.75rem;
  color: #6a6a78;
  padding: 16px 0 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.site-footer a { color: #8ab4ff; text-decoration: none; }

/* --- Page légale --- */
.legal-content h2 { font-size: 1.05rem; margin: 16px 0 6px; }
.legal-content p { font-size: 0.9rem; line-height: 1.5; color: #d0d0d8; margin-bottom: 8px; }
.legal-content { background: #1e1e2a; border-radius: 16px; padding: 20px; }

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.85rem;
}
.checkbox-row input { width: auto; margin-top: 3px; }
.checkbox-row a { color: #8ab4ff; }

/* --- Factory (admin/modération) --- */
.factory-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.factory-nav a {
  background: #1e1e2a;
  border: 1px solid #33333f;
  color: #b0b0bc;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.85rem;
  text-decoration: none;
}
.factory-nav a.active {
  background: #4f7cff;
  border-color: #4f7cff;
  color: white;
}

.factory-card {
  background: #1e1e2a;
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}
.factory-card textarea {
  width: 100%;
  min-height: 70px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #33333f;
  background: #14141c;
  color: #f2f2f5;
  font-size: 0.95rem;
  resize: vertical;
}
.factory-meta {
  font-size: 0.8rem;
  color: #9a9aa8;
}
.factory-actions {
  display: flex;
  gap: 8px;
}
.factory-actions button {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
}
.btn-approve { background: #1f7a3d; color: white; }
.btn-delete { background: #7a1f2b; color: white; }
.btn-save { background: #33333f; color: white; }

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #33333f;
}
.user-row select {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #33333f;
  background: #14141c;
  color: #f2f2f5;
}
