/* ============================================================
   La Grosse Soirée — QCM live
   Thème sombre festif. Recolorez tout depuis les variables ci-dessous.
   ============================================================ */
:root {
  /* Palette de marque */
  --bg:        #0d0b1a;
  --bg-2:      #140f26;
  --surface:   #1c1638;
  --surface-2: #271d4d;
  --border:    #36295e;
  --text:      #f4eefe;
  --muted:     #b0a4d4;

  --orange:  #ff7a18;
  --magenta: #ff2e88;
  --violet:  #8a2be2;
  --cyan:    #1fe0c8;
  --lime:    #b6ff3d;
  --yellow:  #ffd23d;

  --primary: var(--magenta);
  --good:    #2ecc71;
  --bad:     #ff4d6d;

  /* Couleurs des 4 boutons de réponse (façon QCM) */
  --ans-0: #ff5a5f;
  --ans-1: #2d9cff;
  --ans-2: #ffb02e;
  --ans-3: #21c97a;

  --radius: 16px;
  --shadow: 0 10px 30px rgba(0,0,0,.45);
  --font: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Fredoka', 'Poppins', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-text-size-adjust: 100%;
}
body {
  min-height: 100dvh;
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(138,43,226,.25), transparent 60%),
    radial-gradient(1000px 500px at -10% 110%, rgba(255,46,136,.20), transparent 55%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
}

h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.1; margin: 0 0 .4em; }
a { color: var(--cyan); }

.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 18px; }
.center-screen {
  min-height: 100dvh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 18px; gap: 18px;
}

/* Marque / logo */
.brand { text-align: center; }
.brand .logo {
  font-family: var(--display);
  font-size: clamp(28px, 7vw, 44px);
  letter-spacing: .5px;
  background: linear-gradient(90deg, var(--orange), var(--magenta), var(--violet));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 24px rgba(255,46,136,.35);
}
.brand .tagline { color: var(--muted); margin-top: -4px; font-size: 14px; }
.banner { width: 100%; max-width: 520px; border-radius: var(--radius); box-shadow: var(--shadow); display: block; margin-left: auto; margin-right: auto; }

/* Cartes */
.card {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card + .card { margin-top: 16px; }

/* Champs */
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 6px; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 14px 16px; font-size: 16px; color: var(--text);
  background: rgba(0,0,0,.25); border: 1px solid var(--border); border-radius: 12px;
  font-family: inherit; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--magenta); box-shadow: 0 0 0 3px rgba(255,46,136,.2); }
textarea { resize: vertical; min-height: 70px; }

.code-input {
  text-align: center; letter-spacing: 8px; font-weight: 700;
  font-size: 30px; text-transform: uppercase; font-family: var(--display);
}

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 15px 22px; font-size: 17px; font-weight: 600; font-family: var(--font);
  border: none; border-radius: 14px; cursor: pointer; color: #fff;
  background: linear-gradient(180deg, var(--magenta), #d61e72);
  box-shadow: 0 8px 20px rgba(255,46,136,.35); transition: transform .08s ease, filter .15s ease;
  width: 100%; text-decoration: none;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn.secondary { background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--border); box-shadow: none; }
.btn.ghost { background: transparent; border: 1px solid var(--border); box-shadow: none; }
.btn.violet { background: linear-gradient(180deg, var(--violet), #6a1fb0); box-shadow: 0 8px 20px rgba(138,43,226,.35); }
.btn.cyan { background: linear-gradient(180deg, var(--cyan), #12b39e); color: #04201c; box-shadow: 0 8px 20px rgba(31,224,200,.3); }
.btn.danger { background: linear-gradient(180deg, var(--bad), #d6334f); }
.btn.small { padding: 9px 14px; font-size: 14px; width: auto; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { width: auto; flex: 1; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.hidden { display: none !important; }
.pill { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.spacer { height: 14px; }

/* Code de partie en gros (animateur) */
.bigcode {
  font-family: var(--display); font-size: clamp(40px, 11vw, 84px); letter-spacing: 6px;
  color: var(--yellow); text-shadow: 0 0 30px rgba(255,210,61,.4); text-align: center;
}

/* Boutons de réponse type QCM */
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.answers.one-col { grid-template-columns: 1fr; }
.answer {
  position: relative; min-height: 84px; padding: 16px; border: none; border-radius: 14px;
  color: #fff; font-size: 17px; font-weight: 600; font-family: var(--font); cursor: pointer;
  display: flex; align-items: center; gap: 12px; text-align: left;
  box-shadow: var(--shadow); transition: transform .08s ease, filter .15s, opacity .2s;
}
.answer:active { transform: scale(.98); }
.answer .shape { font-size: 22px; flex: 0 0 auto; }
.answer[data-i="0"] { background: var(--ans-0); }
.answer[data-i="1"] { background: var(--ans-1); }
.answer[data-i="2"] { background: var(--ans-2); color:#2a1c00; }
.answer[data-i="3"] { background: var(--ans-3); }
.answer.dim { opacity: .35; filter: grayscale(.4); }
.answer.correct { outline: 4px solid #fff; box-shadow: 0 0 0 4px var(--good), var(--shadow); }
.answer.wrong { opacity: .4; }
.answer.selected { outline: 4px solid #fff; }
.answer .check { margin-left: auto; font-size: 22px; }

/* Timer / barre de progression */
.timerbar { height: 12px; border-radius: 999px; background: rgba(0,0,0,.35); overflow: hidden; border: 1px solid var(--border); }
.timerbar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--lime)); transition: width 1s linear; }
.timer-num { font-family: var(--display); font-size: 40px; text-align: center; color: var(--cyan); }

/* Classement */
.leaderboard { list-style: none; margin: 0; padding: 0; }
.leaderboard li {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.leaderboard .rank { font-family: var(--display); font-size: 20px; width: 34px; text-align: center; color: var(--muted); }
.leaderboard li:nth-child(1) .rank { color: var(--yellow); }
.leaderboard li:nth-child(2) .rank { color: #d8d8e8; }
.leaderboard li:nth-child(3) .rank { color: var(--orange); }
.leaderboard .name { font-weight: 600; flex: 1; }
.leaderboard .score { font-family: var(--display); color: var(--cyan); }

/* Liste lobby */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 14px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-weight: 600; }

/* Tableaux (admin) */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--muted); font-weight: 600; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Toasts */
#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 50;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); max-width: 90vw; opacity: 0; transition: opacity .2s, transform .2s; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
#toast.err { border-color: var(--bad); }

/* Topbar admin */
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.topbar .logo { font-family: var(--display); font-size: 22px; color: var(--magenta); }
.topbar .grow { flex: 1; }

/* QR */
.qr { background: #fff; padding: 14px; border-radius: 16px; display: inline-block; box-shadow: var(--shadow); }
.qr img { display: block; width: 240px; height: 240px; }

/* Question editor */
.q-item { border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 12px; background: var(--surface); }
.q-item .q-head { display: flex; align-items: center; gap: 10px; }
.q-item .q-head .q-pos { font-family: var(--display); color: var(--muted); }
.q-item .q-type { font-size: 12px; }
.choice-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.choice-row input[type=text] { flex: 1; }
.choice-row .mark { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }

/* Animation : secousse (mauvaise réponse) */
@keyframes fx-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(9px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(4px); }
}
.fx-shake { animation: fx-shake .5s ease; }

/* Animation : pop (apparition) */
@keyframes fx-pop { 0% { transform: scale(.85); opacity: .4; } 100% { transform: scale(1); opacity: 1; } }
.fx-pop { animation: fx-pop .25s ease; }

@media (max-width: 480px) {
  .answer { font-size: 16px; min-height: 76px; }
  .wrap { padding: 14px; }
}
@media (min-width: 720px) {
  .host-big .bigcode { font-size: 92px; }
}
