/* ═══════════════════════════════════════════════
   QUIZ NIGHT — Feuille de style principale
   ═══════════════════════════════════════════════ */

/* ── Variables ── */
:root {
  --bg:    #0f0f13;
  --surf:  #1a1a22;
  --surf2: #22222e;
  --bord:  rgba(255,255,255,.1);
  --txt:   #f0f0f5;
  --mut:   rgba(240,240,245,.45);
  --acc:   #7c5cfc;
  --acc2:  #fc5c7d;
  --gold:  #ffd166;
  --grn:   #06d6a0;
  --red:   #ef476f;
  --fft:   'Sora', 'Nunito', system-ui, sans-serif;
  --ffb:   system-ui, -apple-system, sans-serif;
}

/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--txt);
  font-family: var(--ffb);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

input, textarea, select, button {
  font-family: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

button { cursor: pointer; }

/* ── Layout principal ── */
#app {
  max-width: 560px;
  margin: 0 auto;
  padding: 1.5rem 1rem 6rem;
  min-height: 100vh;
}

/* ── Écrans ── */
.screen { display: none; }
.screen.active { display: block; }

/* ── Logo ── */
.logo {
  font-family: var(--fft);
  font-size: 2.4rem;
  font-weight: 900;
  text-align: center;
  letter-spacing: .05em;
  background: linear-gradient(135deg, var(--acc), var(--acc2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1.5rem;
}

.tagline {
  text-align: center;
  color: var(--mut);
  font-size: .88rem;
  margin-top: -.75rem;
  margin-bottom: 1.5rem;
}

/* ── Carte ── */
.card {
  background: var(--surf);
  border: 1px solid var(--bord);
  border-radius: 16px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.slbl {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--acc);
  font-weight: 700;
  margin-bottom: .75rem;
}

/* ── Notif toast ── */
.notif {
  position: fixed;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  background: var(--surf);
  border: 1px solid var(--bord);
  border-radius: 12px;
  padding: .65rem 1.25rem;
  font-size: .88rem;
  font-weight: 600;
  z-index: 500;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1);
  white-space: nowrap;
  max-width: 90vw;
}
.notif.show  { transform: translateX(-50%) translateY(0); }
.notif.bad   { border-color: var(--red);  color: var(--red); }
.notif.ok    { border-color: var(--grn);  color: var(--grn); }

/* ── Boutons ── */
.btn-primary {
  display: block;
  width: 100%;
  padding: .9rem;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--acc), var(--acc2));
  color: #fff;
  font-family: var(--fft);
  font-size: 1rem;
  font-weight: 800;
  text-align: center;
  border: none;
  cursor: pointer;
  margin-top: .5rem;
  transition: opacity .15s, transform .15s;
}
.btn-primary:hover { opacity: .88; transform: translateY(-1px); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .65rem 1.1rem;
  border-radius: 10px;
  font-size: .88rem;
  font-weight: 700;
  font-family: var(--fft);
  cursor: pointer;
  transition: all .15s;
  border: 1px solid var(--bord);
}
.btn-success { background: rgba(6,214,160,.12);  border-color: rgba(6,214,160,.3);  color: var(--grn); }
.btn-danger  { background: rgba(239,71,111,.1);  border-color: rgba(239,71,111,.3); color: var(--red); }
.btn-ghost   { background: var(--surf2); color: var(--mut); }
.btn-ghost:hover { color: var(--txt); }
.btn-success:hover { background: rgba(6,214,160,.22); }
.btn-danger:hover  { background: rgba(239,71,111,.2); }

.btn-add {
  width: 100%;
  padding: .6rem;
  border-radius: 10px;
  border: 1px dashed var(--bord);
  color: var(--mut);
  font-size: .85rem;
  margin-top: .5rem;
  transition: all .15s;
}
.btn-add:hover { border-color: var(--acc); color: var(--acc); }

.btn-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--bord);
  background: var(--surf2);
  color: var(--mut);
  font-size: 1rem;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.btn-icon:hover { color: var(--txt); }

.action-row {
  display: flex;
  gap: .6rem;
  margin-top: 1rem;
}

/* ── Joueurs setup ── */
.player-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--bord);
}
.player-row:last-child { border-bottom: none; }
.player-row input[type="text"] {
  flex: 1;
  background: var(--surf2);
  border: 1px solid var(--bord);
  border-radius: 8px;
  padding: .45rem .75rem;
  font-size: .9rem;
}
.player-row input:focus { border-color: var(--acc); }
.player-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.profile-badge {
  font-size: .68rem;
  padding: .2rem .55rem;
  border-radius: 20px;
  background: rgba(124,92,252,.15);
  color: var(--acc);
  font-weight: 600;
  white-space: nowrap;
}

/* ── Timer ring ── */
.timer-ring-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  margin: 1.5rem 0;
}
.timer-ring-inner { position: relative; }
.timer-svg { transform: rotate(-90deg); }
.timer-track {
  fill: none;
  stroke: var(--surf2);
  stroke-width: 8;
}
.timer-arc {
  fill: none;
  stroke: var(--acc);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke .3s, stroke-dashoffset .9s linear;
}
.timer-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .2rem;
}
.timer-label {
  font-family: var(--fft);
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1;
}
.timer-status {
  font-size: .72rem;
  color: var(--mut);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.timer-sub {
  font-size: .82rem;
  color: var(--mut);
  min-height: 1.2em;
  text-align: center;
}
.timer-controls {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  justify-content: center;
}
.timer-btn {
  padding: .5rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--bord);
  background: var(--surf2);
  color: var(--txt);
  font-family: var(--fft);
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
  display: flex; align-items: center; gap: .35rem;
}
.timer-btn:hover { border-color: rgba(255,255,255,.25); }
.timer-btn.green { border-color: rgba(6,214,160,.4);  color: var(--grn);  background: rgba(6,214,160,.08); }
.timer-btn.amber { border-color: rgba(255,209,102,.4); color: var(--gold); background: rgba(255,209,102,.08); }
.timer-btn.red   { border-color: rgba(239,71,111,.4);  color: var(--red);  background: rgba(239,71,111,.08); }

/* ── Mini scores ── */
.mini-scores {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: .75rem;
}
.mini-card {
  background: var(--surf2);
  border: 1px solid var(--bord);
  border-radius: 10px;
  padding: .4rem .75rem;
  display: flex; align-items: center; gap: .4rem;
  font-size: .8rem;
}
.mini-card.active { border-color: var(--acc); background: rgba(124,92,252,.1); }
.mdot { width: 7px; height: 7px; border-radius: 50%; }

/* ── Question ── */
.q-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: .5rem;
}
.player-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--fft); font-size: 1.2rem; font-weight: 800;
}
.chain-pill {
  display: none;
  align-items: center; gap: .35rem;
  background: rgba(255,209,102,.1);
  border: 1px solid rgba(255,209,102,.3);
  border-radius: 20px;
  padding: .3rem .85rem;
  font-size: .8rem; font-weight: 700; color: var(--gold);
  font-family: var(--fft);
}
.theme-lbl {
  text-align: center;
  font-size: .75rem;
  color: var(--mut);
  margin-bottom: .75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.diff-badge {
  display: inline-block;
  font-size: .72rem; font-weight: 700;
  padding: .2rem .65rem;
  border-radius: 20px;
  margin-bottom: .6rem;
}
.diff-easy   { background: rgba(6,214,160,.12);  color: var(--grn); }
.diff-medium { background: rgba(255,209,102,.12); color: var(--gold); }
.diff-hard   { background: rgba(239,71,111,.1);   color: var(--red); }

.q-box {
  background: var(--surf);
  border: 1px solid var(--bord);
  border-radius: 16px;
  padding: 1.5rem 1.25rem;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 1rem;
}
.ans-box {
  background: var(--surf2);
  border: 1px solid var(--bord);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: .75rem;
}
.ans-lbl {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--mut);
  margin-bottom: .35rem;
}
.ans-txt {
  font-family: var(--fft);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--grn);
}

/* ── Blindtest ── */
.blind-wrap {
  background: var(--surf);
  border: 1px solid rgba(124,92,252,.2);
  border-radius: 16px;
  padding: 2rem 1.5rem;
  text-align: center;
  margin-bottom: 1rem;
}
.blind-icon  { font-size: 2.5rem; margin-bottom: .75rem; }
.blind-title { font-family: var(--fft); font-size: 1.1rem; font-weight: 800; margin-bottom: .4rem; }
.blind-hint  { font-size: .85rem; color: var(--mut); margin-bottom: 1.25rem; }
.blind-play-btn {
  padding: .7rem 1.6rem;
  border-radius: 10px;
  border: 1px solid rgba(124,92,252,.35);
  background: rgba(124,92,252,.1);
  color: var(--acc);
  font-family: var(--fft); font-size: .9rem; font-weight: 700;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: .5rem;
  transition: all .15s;
  margin-bottom: 1.25rem;
}
.blind-play-btn:hover { background: rgba(124,92,252,.2); }
.blind-answer { text-align: left; }

/* ── Barres audio ── */
.audio-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 40px;
  justify-content: center;
  margin: .75rem auto;
}
.audio-bar {
  width: 5px;
  border-radius: 3px;
  background: var(--acc);
  opacity: .3;
  transition: opacity .2s;
}
.audio-bar.playing {
  opacity: 1;
  animation: barBounce var(--d, .4s) ease-in-out infinite alternate;
}
@keyframes barBounce {
  from { transform: scaleY(.3); }
  to   { transform: scaleY(1); }
}

/* ── Scoreboard ── */
.sb-header { margin-bottom: 1.25rem; }
.sb-manche {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--acc);
  font-weight: 700;
  margin-bottom: .25rem;
}
.sb-header h2 { font-family: var(--fft); font-size: 1.9rem; font-weight: 800; }

.score-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--bord);
}
.score-row:last-child { border-bottom: none; }
.score-row.last { background: rgba(239,71,111,.05); border-radius: 8px; padding: .7rem .5rem; }
.rank { width: 28px; font-family: var(--fft); font-size: .88rem; font-weight: 700; text-align: center; }
.rank.gold { color: var(--gold); }
.score-av {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--fft); font-size: 1rem; font-weight: 800;
  flex-shrink: 0;
}
.score-name { flex: 1; font-weight: 600; }
.score-pts  { font-family: var(--fft); font-size: 1.1rem; font-weight: 800; }
.elim-tag {
  font-size: .68rem; font-weight: 700;
  padding: .2rem .6rem; border-radius: 20px;
  background: rgba(239,71,111,.12); color: var(--red);
}
.bonus-tag {
  font-size: .68rem; font-weight: 700;
  padding: .2rem .55rem; border-radius: 20px;
  background: rgba(255,209,102,.12); color: var(--gold);
}

/* ── Buzz ── */
.buzz-header { margin-bottom: 1.5rem; }
.buzz-header .pre {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--acc); margin-bottom: .25rem;
}
.buzz-header h2 { font-family: var(--fft); font-size: 1.9rem; font-weight: 800; }
.buzz-q {
  font-size: 1.1rem; font-weight: 600;
  background: var(--surf); border: 1px solid var(--bord);
  border-radius: 14px; padding: 1.25rem; margin-bottom: 1.25rem;
  line-height: 1.5;
}
.buzz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .6rem;
  margin-bottom: 1rem;
}
.btn-buzz {
  padding: 1rem .75rem;
  border-radius: 14px;
  border: 1px solid var(--bord);
  background: var(--surf2);
  display: flex; flex-direction: column; align-items: center; gap: .4rem;
  font-family: var(--fft); font-size: .88rem; font-weight: 700;
  cursor: pointer; transition: all .15s;
}
.btn-buzz:hover { border-color: var(--acc); background: rgba(124,92,252,.08); }
.buzz-av {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--fft); font-size: 1.2rem; font-weight: 800;
}

/* ── Thèmes bonus ── */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .75rem;
}
.btn-theme {
  padding: 1rem .75rem;
  border-radius: 14px;
  border: 1px solid var(--bord);
  background: var(--surf2);
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  font-family: var(--fft); font-size: .9rem; font-weight: 700;
  cursor: pointer; transition: all .15s;
  text-align: center;
}
.btn-theme:hover { border-color: var(--acc); background: rgba(124,92,252,.08); transform: translateY(-2px); }
.theme-icon { font-size: 1.6rem; }

/* ── Éditeur ── */
.editor-tabs { display: flex; gap: .4rem; margin-bottom: 1rem; }
.tab-btn {
  flex: 1; padding: .5rem; border-radius: 10px;
  border: 1px solid var(--bord); background: var(--surf2);
  color: var(--mut); font-size: .82rem; font-weight: 700;
  font-family: var(--fft); cursor: pointer; transition: all .15s;
}
.tab-btn.active { background: rgba(124,92,252,.15); border-color: var(--acc); color: var(--acc); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.add-form { display: flex; flex-direction: column; gap: .75rem; }
.form-row { display: flex; flex-direction: column; gap: .35rem; }
.form-row.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.field-lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--mut); font-weight: 700; }
.add-form input[type="text"],
.add-form textarea,
.add-form select,
.add-form input[type="range"] {
  width: 100%; background: var(--surf2); border: 1px solid var(--bord);
  border-radius: 10px; padding: .6rem .9rem;
  color: var(--txt); font-size: .9rem;
}
.add-form input:focus, .add-form textarea:focus, .add-form select:focus { border-color: var(--acc); }

.type-radio { display: flex; flex-wrap: wrap; gap: .4rem; }
.type-btn {
  padding: .35rem .75rem; border-radius: 8px;
  border: 1px solid var(--bord); background: var(--surf2);
  color: var(--mut); font-size: .78rem; font-weight: 700;
  cursor: pointer; transition: all .15s;
}
.type-btn:hover { border-color: var(--acc); color: var(--txt); }
.type-btn.sel { border-color: var(--acc); background: rgba(124,92,252,.15); color: var(--acc); }

.bulk-area {
  width: 100%; height: 160px;
  background: var(--surf2); border: 1px solid var(--bord);
  border-radius: 10px; padding: .75rem;
  color: var(--txt); font-size: .8rem; font-family: monospace;
  resize: vertical;
}

/* Pills */
.pill { display: inline-block; font-size: .68rem; font-weight: 700; padding: .15rem .5rem; border-radius: 10px; margin-right: .25rem; }
.pill-general  { background: rgba(124,92,252,.12); color: var(--acc); }
.pill-personal { background: rgba(252,92,125,.12); color: var(--acc2); }
.pill-bonus    { background: rgba(255,209,102,.12); color: var(--gold); }
.pill-blindtest{ background: rgba(76,201,240,.12);  color: #4cc9f0; }
.pill-easy     { background: rgba(6,214,160,.1);    color: var(--grn); }
.pill-medium   { background: rgba(255,209,102,.1);  color: var(--gold); }
.pill-hard     { background: rgba(239,71,111,.1);   color: var(--red); }

/* Liste questions éditeur */
.q-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: .65rem .25rem; border-bottom: 1px solid var(--bord); gap: .75rem;
}
.q-item:last-child { border-bottom: none; }
.q-item-info { flex: 1; min-width: 0; }
.q-item-q    { font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: .2rem; }
.q-item-meta { display: flex; flex-wrap: wrap; gap: .2rem; }

/* ── Boutons flottants ── */
#btn-fullscreen {
  position: fixed !important;
  bottom: 1.5rem !important;
  left: 1.25rem !important;
  background: var(--surf2);
  border: 1px solid var(--bord);
  border-radius: 10px;
  padding: .5rem .85rem;
  color: var(--mut);
  font-size: .78rem;
  cursor: pointer;
  z-index: 50;
  font-family: var(--ffb);
}
#btn-fullscreen:hover { color: var(--txt); border-color: rgba(255,255,255,.2); }

#btn-stats {
  position: fixed !important;
  bottom: 1.5rem !important;
  left: 8rem !important;
  background: var(--surf2);
  border: 1px solid var(--bord);
  border-radius: 10px;
  padding: .5rem .85rem;
  color: var(--mut);
  font-size: .78rem;
  cursor: pointer;
  z-index: 50;
  font-family: var(--ffb);
}
#btn-stats:hover { color: var(--txt); border-color: rgba(255,255,255,.2); }

#btn-options {
  position: fixed !important;
  bottom: 1.5rem !important;
  left: 14.5rem !important;
  background: var(--surf2);
  border: 1px solid var(--bord);
  border-radius: 10px;
  padding: .5rem .85rem;
  color: var(--mut);
  font-size: .78rem;
  cursor: pointer;
  z-index: 50;
  font-family: var(--ffb);
}
#btn-options:hover { color: var(--txt); border-color: rgba(255,255,255,.2); }

#btn-minijeux {
  position: fixed !important;
  bottom: 1.5rem !important;
  right: 1.25rem !important;
  background: linear-gradient(135deg, var(--acc), var(--acc2));
  border: none;
  border-radius: 12px;
  padding: .55rem 1.1rem;
  color: #fff;
  font-size: .82rem;
  font-weight: 700;
  font-family: var(--fft);
  cursor: pointer;
  z-index: 50;
  box-shadow: 0 4px 16px rgba(124,92,252,.35);
  transition: all .15s;
  display: flex; align-items: center; gap: .4rem;
}
#btn-minijeux:hover { opacity: .88; transform: translateY(-1px); }

#btn-jb-send {
  position: fixed !important;
  bottom: 5.5rem !important;
  right: 1.25rem !important;
  background: var(--acc);
  border: none;
  border-radius: 12px;
  padding: .55rem 1rem;
  color: #fff;
  font-size: .78rem;
  font-weight: 700;
  font-family: var(--fft);
  cursor: pointer;
  z-index: 50;
  display: none;
  box-shadow: 0 4px 16px rgba(124,92,252,.4);
  transition: all .15s;
}
#btn-jb-send:hover { opacity: .88; transform: translateY(-1px); }