/* ===================================================
   Vote en direct — design "signal de scène"
   Palette : fond encre, accent ambre (projecteur),
   bleu-ardoise pour les options non majoritaires.
   =================================================== */

:root {
  --bg: #0b0e14;
  --bg-elevated: #131826;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f5f3ee;
  --text-dim: #8b93a7;
  --accent: #ffb020;
  --accent-soft: rgba(255, 176, 32, 0.16);
  --barre-fond: #1c2333;
  --barre-neutre: #3a4256;

  --police-titre: 'Space Grotesk', sans-serif;
  --police-corps: 'Inter', sans-serif;
  --police-chiffres: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--police-corps);
  -webkit-font-smoothing: antialiased;
}

.scene {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px 48px;
  max-width: 640px;
  margin: 0 auto;
}

/* --- Étiquette "En direct" avec pastille pulsante --- */
.live-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--police-chiffres);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(255, 176, 32, 0.35);
  border-radius: 999px;
  padding: 6px 14px;
  margin-bottom: 28px;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(255, 176, 32, 0.6);
  animation: pulse 1.8s ease-out infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 176, 32, 0.55); }
  70%  { box-shadow: 0 0 0 10px rgba(255, 176, 32, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 176, 32, 0); }
}

/* --- Question --- */
.question {
  font-family: var(--police-titre);
  font-weight: 700;
  font-size: clamp(24px, 5vw, 36px);
  line-height: 1.15;
  text-align: center;
  margin: 0 0 8px;
  max-width: 22ch;
}

.sous-titre {
  color: var(--text-dim);
  font-size: 14px;
  text-align: center;
  margin: 0 0 32px;
}

/* --- Options / boutons de vote --- */
.options {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option-carte {
  position: relative;
  width: 100%;
  text-align: left;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  color: var(--text);
  font-family: var(--police-corps);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.option-carte:hover:not(:disabled) {
  border-color: rgba(255, 176, 32, 0.4);
  transform: translateY(-1px);
}

.option-carte:active:not(:disabled) {
  transform: translateY(0);
}

.option-carte:disabled {
  cursor: default;
}

.option-carte:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.option-libelle {
  position: relative;
  z-index: 1;
  display: block;
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 10px;
}

.option-barre {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--barre-fond);
  overflow: hidden;
}

.option-barre-remplie {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--barre-neutre);
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.option-carte.en-tete .option-barre-remplie {
  background: var(--accent);
}

.option-pourcentage {
  position: relative;
  z-index: 1;
  display: inline-block;
  margin-top: 8px;
  font-family: var(--police-chiffres);
  font-size: 13px;
  color: var(--text-dim);
}

.option-carte.option-choisie {
  border-color: var(--accent);
}

.option-carte.option-choisie::after {
  content: '✓ votre choix';
  position: absolute;
  top: 14px;
  right: 16px;
  font-family: var(--police-chiffres);
  font-size: 11px;
  color: var(--accent);
}

.statut {
  min-height: 20px;
  margin-top: 20px;
  font-size: 14px;
  color: var(--accent);
  text-align: center;
}

/* ===================================================
   Mode grand écran (résultats + QR code)
   =================================================== */

.mode-ecran, .mode-ecran body {
  background: var(--bg);
}

.scene-ecran {
  max-width: 1100px;
  justify-content: flex-start;
  padding-top: 48px;
}

.ecran-grille {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 48px;
  align-items: start;
}

.ecran-resultats .question {
  text-align: left;
  max-width: none;
  font-size: clamp(28px, 3.4vw, 44px);
}

.options-ecran .option-carte {
  padding: 20px 22px;
  cursor: default;
}

.options-ecran .option-libelle {
  font-size: 19px;
}

.options-ecran .option-barre {
  height: 10px;
}

.total-votes {
  margin-top: 20px;
  color: var(--text-dim);
  font-family: var(--police-chiffres);
  font-size: 14px;
}

#total-votes {
  color: var(--text);
  font-size: 16px;
}

.ecran-qr {
  position: sticky;
  top: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
}

.ecran-qr img {
  border-radius: 8px;
}

.qr-legende {
  margin: 0;
  font-size: 13px;
  color: var(--text-dim);
}

@media (max-width: 780px) {
  .ecran-grille {
    grid-template-columns: 1fr;
  }
  .ecran-qr {
    position: static;
  }
}

/* ===================================================
   Espace admin + historique
   =================================================== */

.scene-etroite {
  max-width: 380px;
}

.scene-large {
  max-width: 720px;
  align-items: stretch;
  justify-content: flex-start;
  padding-top: 40px;
}

.live-tag-eteint {
  color: var(--text-dim);
  background: transparent;
  border-color: var(--border);
}

.entete-admin {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.lien-discret {
  color: var(--text-dim);
  font-size: 13px;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.lien-discret:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.carte-section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-top: 20px;
}

.titre-section {
  font-family: var(--police-titre);
  font-size: 18px;
  margin: 0 0 14px;
}

.question-active {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 16px;
}

.actions-ligne {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* --- Formulaires --- */
.formulaire {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.formulaire label {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 10px;
}

.formulaire input[type="text"],
.formulaire input[type="password"] {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-family: var(--police-corps);
  font-size: 15px;
}

.formulaire input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.liste-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* --- Boutons --- */
.bouton-principal,
.bouton-secondaire,
.bouton-danger,
.bouton-discret {
  font-family: var(--police-corps);
  font-weight: 600;
  font-size: 14px;
  border-radius: 10px;
  padding: 11px 18px;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.bouton-principal {
  background: var(--accent);
  color: #1a1300;
  margin-top: 16px;
  align-self: flex-start;
}

.bouton-secondaire {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.bouton-danger {
  background: transparent;
  border-color: rgba(255, 90, 90, 0.4);
  color: #ff8a8a;
}

.bouton-discret {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 6px 0;
  text-align: left;
  font-weight: 500;
}

.bouton-discret:hover {
  color: var(--accent);
}

.statut-erreur { color: #ff8a8a; }
.statut-succes { color: var(--accent); }

/* --- Historique --- */
.liste-historique {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.liste-historique li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.liste-historique a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}

.liste-historique a:hover {
  color: var(--accent);
}

.date-historique {
  color: var(--text-dim);
  font-family: var(--police-chiffres);
  font-size: 12px;
  white-space: nowrap;
}

.liste-historique-publique {
  margin-bottom: 20px;
}

@media (prefers-reduced-motion: reduce) {
  .live-dot {
    animation: none;
  }
  .option-barre-remplie {
    transition: none;
  }
}
