:root {
  --bg: #14102a;
  --bg2: #1f1840;
  --card: #251d4d;
  --card2: #2f2660;
  --line: #3b3175;
  --text: #f4f1ff;
  --muted: #a9a1d6;
  --accent: #ff5fa2;
  --accent2: #7c5cff;
  --good: #3ddc84;
  --bad: #ff5c6c;
  --warn: #ffc93d;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font: 'Fredoka', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-height: 100%;
}
body {
  font-family: var(--font);
  color: var(--text);
  background: radial-gradient(1200px 600px at 10% -10%, #3a1f6e 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 10%, #5a1f55 0%, transparent 60%), var(--bg);
  background-attachment: fixed;
  font-size: 16px;
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3,
h4 {
  margin: 0 0 0.6em;
  font-weight: 600;
}
h3 {
  font-size: 1.05rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.85rem;
}
kbd {
  background: var(--card2);
  border: 1px solid var(--line);
  border-bottom-width: 3px;
  border-radius: 6px;
  padding: 0 6px;
}

/* ─── Boutons & champs ─── */
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
}
.btn {
  border: 0;
  border-radius: 12px;
  padding: 0.65em 1.2em;
  background: var(--card2);
  font-weight: 600;
  transition: transform 0.1s, filter 0.15s, background 0.15s;
}
.btn:hover:not(:disabled) {
  filter: brightness(1.15);
}
.btn:active:not(:disabled) {
  transform: translateY(2px);
}
.btn:disabled {
  opacity: 0.5;
}
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 6px 18px rgba(255, 95, 162, 0.3);
}
.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
}
.btn.small {
  padding: 0.4em 0.8em;
  font-size: 0.9rem;
}
.btn.big {
  padding: 0.85em 1.6em;
  font-size: 1.1rem;
}
.btn.wide {
  width: 100%;
}
.chip {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 0.35em 0.9em;
}
.chip b {
  letter-spacing: 0.15em;
  color: var(--warn);
}
input,
select {
  font: inherit;
  color: var(--text);
  background: var(--bg2);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 0.6em 0.8em;
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}
input:focus,
select:focus {
  border-color: var(--accent2);
}
input:disabled,
select:disabled {
  opacity: 0.7;
}
input:hover:not(:disabled):not(:focus),
select:hover:not(:disabled):not(:focus) {
  border-color: #554a9c;
}
/* Menu déroulant : flèche maison, options sombres. */
select {
  appearance: none;
  cursor: pointer;
  padding-right: 2.4em;
  background: var(--bg2)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23ff5fa2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    no-repeat right 0.9em center / 0.75em;
}
select:disabled {
  cursor: default;
}
option,
optgroup {
  background: var(--bg2);
  color: var(--text);
}
optgroup {
  color: var(--muted);
}

/* Curseur : piste remplie en dégradé jusqu'au pouce (--p, posé par le JS). */
input[type='range'] {
  --p: 50%;
  --fill: linear-gradient(90deg, var(--accent), var(--accent2));
  appearance: none;
  height: 1.6rem;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
input[type='range']::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: var(--fill) 0 0 / var(--p) 100% no-repeat, var(--card2);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}
input[type='range']::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: var(--card2);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}
input[type='range']::-moz-range-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--fill);
}
input[type='range']::-webkit-slider-thumb {
  appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -7px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--accent);
  box-shadow: 0 2px 10px rgba(255, 95, 162, 0.55);
  transition: transform 0.12s, box-shadow 0.12s;
}
input[type='range']::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--accent);
  box-shadow: 0 2px 10px rgba(255, 95, 162, 0.55);
  transition: transform 0.12s, box-shadow 0.12s;
}
input[type='range']:hover:not(:disabled)::-webkit-slider-thumb,
input[type='range']:focus-visible::-webkit-slider-thumb {
  transform: scale(1.15);
  box-shadow: 0 0 0 6px rgba(255, 95, 162, 0.2), 0 2px 10px rgba(255, 95, 162, 0.55);
}
input[type='range']:hover:not(:disabled)::-moz-range-thumb,
input[type='range']:focus-visible::-moz-range-thumb {
  transform: scale(1.15);
  box-shadow: 0 0 0 6px rgba(255, 95, 162, 0.2), 0 2px 10px rgba(255, 95, 162, 0.55);
}
input[type='range']:disabled {
  cursor: default;
}
input[type='range']:disabled::-webkit-slider-thumb {
  border-color: var(--muted);
  box-shadow: none;
}
input[type='range']:disabled::-moz-range-thumb {
  border-color: var(--muted);
  box-shadow: none;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35em;
}
.field > span {
  color: var(--muted);
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.field output {
  color: var(--text);
  font-weight: 600;
}

.card {
  background: linear-gradient(180deg, var(--card), var(--bg2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem;
  box-shadow: var(--shadow);
}

/* ─── Barre du haut ─── */
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 1.2rem;
  border-bottom: 1px solid var(--line);
  background: rgba(20, 16, 42, 0.8);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  font-weight: 700;
  font-size: 1.25rem;
}
.topbar-mid {
  flex: 1;
  text-align: center;
}
.now-playing {
  font-weight: 600;
}
.topbar-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.screen {
  padding: 1.5rem;
  max-width: 1300px;
  margin: 0 auto;
}

/* ─── Accueil ─── */
.home {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 2rem;
  justify-items: center;
}
.hero {
  text-align: center;
}
.hero h1 {
  font-size: clamp(2.6rem, 8vw, 4.5rem);
  margin: 0;
  background: linear-gradient(135deg, #fff, var(--accent) 60%, var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tagline {
  color: var(--muted);
  font-size: 1.15rem;
}
.hero-games {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}
.hero-games span {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35em 1em;
}
.home-card {
  width: min(420px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.sep {
  text-align: center;
  color: var(--muted);
  position: relative;
  font-size: 0.9rem;
}
.sep::before {
  content: '';
  position: absolute;
  inset: 50% 0 auto;
  border-top: 1px solid var(--line);
}
.sep span {
  position: relative;
  background: var(--card);
  padding: 0 0.8em;
}
.join-row {
  display: flex;
  gap: 0.6rem;
}
.code-input {
  text-transform: uppercase;
  letter-spacing: 0.4em;
  text-align: center;
  font-weight: 700;
}
.error {
  color: var(--bad);
  min-height: 1.2em;
  margin: 0;
  text-align: center;
}

/* ─── Salon ─── */
.lobby {
  display: grid;
  grid-template-columns: 260px 1fr 300px;
  gap: 1.2rem;
  align-items: start;
}
.player-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.player-list li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.5rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}
.player-list li.off,
.scoreboard li.off {
  opacity: 0.45;
}
.pname {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.count {
  background: var(--card2);
  border-radius: 999px;
  padding: 0 0.6em;
  color: var(--text);
}
.avatar {
  --c: #888;
  width: 2rem;
  height: 2rem;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #1b1236;
  background: var(--c);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2);
}
.avatar.sm {
  width: 1.5rem;
  height: 1.5rem;
  font-size: 0.8rem;
}
.team-dot {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: var(--c);
}

.game-pick {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.8rem;
  margin-bottom: 1rem;
}
.game-card {
  border: 2px solid var(--line);
  background: var(--bg2);
  border-radius: 16px;
  padding: 1rem 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  text-align: center;
  transition: border-color 0.15s, transform 0.15s;
}
.game-card:hover:not(:disabled) {
  transform: translateY(-3px);
}
.game-card .emoji {
  font-size: 2.4rem;
}
.game-card small {
  color: var(--muted);
}
.game-card.active {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(255, 95, 162, 0.15), var(--bg2));
}
.game-pick.readonly .game-card:not(.active) {
  opacity: 0.45;
}
.game-card:disabled {
  cursor: default;
}
.variant-pick {
  display: inline-flex;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}
.seg {
  border: 0;
  background: none;
  padding: 0.5em 1.3em;
  border-radius: 9px;
  font-weight: 600;
  color: var(--muted);
  transition: color 0.15s, background 0.15s;
}
.seg:hover:not(:disabled):not(.active) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}
.seg.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  box-shadow: 0 4px 14px rgba(255, 95, 162, 0.3);
}
.seg:disabled:not(.active) {
  cursor: default;
}
.variant-desc {
  color: var(--muted);
  margin: 0.7rem 0 1rem;
}
.settings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1.2rem;
}
/* Chaque réglage est une petite tuile, valeur mise en avant dans une pastille. */
.settings .field {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.75rem 0.9rem 0.6rem;
  gap: 0.5em;
  transition: border-color 0.15s;
}
.settings .field:hover:not(:has(:disabled)) {
  border-color: #554a9c;
}
/* Libellé en haut, contrôle calé en bas : les curseurs d'une même rangée restent alignés. */
.settings .field > span:first-child {
  flex: 1;
  align-items: flex-start;
  gap: 0.5em;
  font-weight: 500;
  color: var(--text);
}
.settings .field output {
  min-width: 2.4em;
  text-align: center;
  padding: 0.05em 0.6em;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-size: 0.85rem;
  box-shadow: 0 3px 10px rgba(255, 95, 162, 0.3);
}
.settings .field select,
.settings .field input[type='text'] {
  padding-top: 0.5em;
  padding-bottom: 0.5em;
}
.range-ends {
  display: flex;
  justify-content: space-between;
  margin-top: -0.4em;
  color: var(--muted);
  font-size: 0.75rem;
  opacity: 0.7;
}

/* ─── Thèmes à cocher (réglages « multi ») ─── */
.settings .field.multi {
  grid-column: 1 / -1;
  gap: 0.7rem;
}
.multi-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.8rem;
}
.multi-label {
  font-weight: 500;
}
.settings .field.multi output.none {
  background: var(--card2);
  box-shadow: none;
  color: var(--muted);
}
.multi-actions {
  display: flex;
  gap: 0.4rem;
  margin-left: auto;
}
.multi .link-btn {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.25em 0.7em;
  border-radius: 999px;
  border: 1px solid var(--line);
  transition: color 0.15s, border-color 0.15s;
}
.multi .link-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}
.multi-mode {
  align-self: flex-start;
}
.multi-mode {
  max-width: 100%;
}
.multi-mode .seg {
  white-space: nowrap;
}
@media (max-width: 760px) {
  .multi-mode {
    display: flex;
    align-self: stretch;
  }
  .multi-mode .seg {
    flex: 1;
    padding-inline: 0.6em;
  }
  .theme-chip {
    font-size: 0.85rem;
    padding: 0.32em 0.7em 0.32em 0.5em;
  }
}
.multi-group + .multi-group {
  margin-top: 0.3rem;
}
.multi-group-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.multi-group-head b {
  color: var(--text);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.78rem;
}
.multi-group-head .link-btn {
  padding: 0.05em 0.6em;
  font-size: 0.75rem;
}
.theme-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.theme-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.38em 0.8em 0.38em 0.6em;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--bg2);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.2;
  transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.1s;
}
/* Case à cocher dessinée : rond vide, puis coche blanche sur dégradé. */
.theme-chip::before {
  content: '';
  flex: none;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  opacity: 0.6;
}
.theme-chip small {
  font-size: 0.75em;
  opacity: 0.7;
}
button.theme-chip:hover {
  color: var(--text);
  border-color: #554a9c;
}
button.theme-chip:active {
  transform: scale(0.96);
}
.theme-chip.on {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, rgba(255, 95, 162, 0.85), rgba(124, 92, 255, 0.85));
  box-shadow: 0 3px 10px rgba(255, 95, 162, 0.22);
}
.theme-chip.on::before {
  opacity: 1;
  border: 0;
  background: #fff
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-4.9' fill='none' stroke='%23c04fd0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    center / 75% no-repeat;
}
.multi.readonly .theme-chip {
  cursor: default;
}
.teams-pick {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}
.team-col {
  border: 2px solid var(--c);
  border-radius: 14px;
  padding: 0.8rem;
  background: color-mix(in srgb, var(--c) 10%, transparent);
}
.team-col h4 {
  color: var(--c);
}
.team-col ul {
  list-style: none;
  padding: 0;
  margin: 0 0 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-height: 2rem;
}
.team-col li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.start-row {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.chat-card {
  display: flex;
  flex-direction: column;
  height: min(520px, 70vh);
}
.msgs {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-right: 0.3rem;
  margin-bottom: 0.6rem;
  font-size: 0.95rem;
  min-height: 0;
}
.msg {
  padding: 0.2rem 0.45rem;
  border-radius: 8px;
  word-break: break-word;
}
.msg.system {
  color: var(--muted);
  font-style: italic;
}
.msg.good {
  background: rgba(61, 220, 132, 0.15);
  color: var(--good);
  font-weight: 600;
}
.msg.close {
  background: rgba(255, 201, 61, 0.15);
  color: var(--warn);
}
.msg.guessed {
  color: var(--good);
}

/* ─── Jeux : structure commune ─── */
.game-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.2rem;
  align-items: start;
}
.game-main {
  min-height: 460px;
}
.q-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}
.pill {
  background: var(--accent2);
  border-radius: 999px;
  padding: 0.25em 0.9em;
  font-weight: 600;
  font-size: 0.9rem;
}
.pill.soft {
  background: var(--card2);
  color: var(--muted);
}
.timer {
  margin-left: auto;
  font-weight: 700;
  font-size: 1.4rem;
  min-width: 2.4rem;
  height: 2.4rem;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--card2);
  border: 2px solid var(--line);
}
.timer.low {
  color: var(--bad);
  border-color: var(--bad);
  animation: pulse 1s infinite;
}
.bar {
  height: 6px;
  background: var(--bg2);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 1rem;
}
.bar > div {
  height: 100%;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
  transition: width 0.1s linear;
}
.bar > div.low {
  background: var(--bad);
}
.scoreboard {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.scoreboard li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}
.scoreboard li.me {
  outline: 2px solid var(--accent2);
}
.scoreboard .rank {
  width: 1.2rem;
  color: var(--muted);
  text-align: center;
}
.ok {
  color: var(--good);
  font-weight: 700;
}
.verdict {
  font-size: 1.3rem;
  font-weight: 600;
  text-align: center;
}
.verdict.good {
  color: var(--good);
}
.verdict.bad {
  color: var(--bad);
}
.verdict.neutral {
  color: var(--muted);
}
.center-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 0;
  text-align: center;
}
.big-count {
  font-size: 5rem;
}
.big-count .timer {
  font-size: 4rem;
  width: 8rem;
  height: 8rem;
  margin: 0;
}

/* ─── Quiz ─── */
.q-text {
  font-size: clamp(1.4rem, 3vw, 2rem);
  text-align: center;
  margin: 1.2rem 0 1.6rem;
}
.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}
.choice {
  --c: var(--accent2);
  border: 0;
  border-radius: 14px;
  padding: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: var(--c);
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.25);
  transition: transform 0.1s, opacity 0.2s, filter 0.15s;
}
.choice.c0 {
  --c: #e8457a;
}
.choice.c1 {
  --c: #3b82f6;
}
.choice.c2 {
  --c: #e8a317;
}
.choice.c3 {
  --c: #22a861;
}
button.choice:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.1);
}
button.choice:disabled:not(.picked) {
  opacity: 0.45;
}
.choice.picked {
  outline: 4px solid #fff;
}
.choice .letter {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  flex: none;
}
.choice.correct {
  outline: 4px solid var(--good);
  animation: pop 0.4s;
}
.choice.wrong {
  outline: 4px solid var(--bad);
  opacity: 0.7;
}
.choice.dim {
  opacity: 0.35;
}
.cache-form {
  display: flex;
  gap: 0.6rem;
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}
.cache-form input {
  font-size: 1.2rem;
}
.q-hint,
.q-status {
  text-align: center;
}
.answer-reveal {
  text-align: center;
  font-size: 1.4rem;
  padding: 1rem;
  border-radius: 14px;
  background: rgba(61, 220, 132, 0.12);
  border: 2px solid var(--good);
}
.answer-reveal b {
  color: var(--good);
}
.results {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.4rem;
}
.results li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border-left: 4px solid var(--bad);
}
.results li.good {
  border-left-color: var(--good);
}
.results .given {
  color: var(--muted);
  font-style: italic;
  max-width: 40%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Blindtest ─── */
.volume {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  width: 140px;
}
.disc {
  font-size: 3.5rem;
  width: 8rem;
  height: 8rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle, var(--card2) 18%, #111 20%, #222 45%, #111 46%, #2a2a2a 70%, #111 72%);
  box-shadow: 0 0 0 4px var(--line), var(--shadow);
}
.disc.spinning {
  animation: spin 3s linear infinite;
}
.buzz {
  width: 12rem;
  height: 12rem;
  border-radius: 50%;
  border: 0;
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  background: radial-gradient(circle at 35% 30%, #ff8fb8, var(--accent) 45%, #b8165a);
  box-shadow: 0 12px 0 #7d0e3c, 0 20px 40px rgba(255, 95, 162, 0.4);
  transition: transform 0.08s, box-shadow 0.08s;
}
.buzz:active:not(:disabled) {
  transform: translateY(10px);
  box-shadow: 0 2px 0 #7d0e3c, 0 8px 20px rgba(255, 95, 162, 0.4);
}
.buzz:disabled {
  filter: grayscale(1);
  opacity: 0.5;
  font-size: 1.1rem;
}
.buzz-race {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
}
.buzz-race li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: var(--card2);
  border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.buzz-race li:first-child {
  border-color: var(--warn);
}
.buzz-race li.me {
  outline: 2px solid var(--accent2);
}
.buzz-race .pos {
  color: var(--muted);
  font-size: 0.85rem;
}
.buzz-race b {
  color: var(--warn);
}
.buzzed-title {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--warn);
}
.wrong-note {
  color: var(--bad);
}
.reveal h2 {
  font-size: 2rem;
  margin: 0;
}
.aka {
  color: var(--muted);
  font-style: italic;
}
.work {
  color: var(--warn);
  font-weight: 600;
}
.reveal .work {
  font-size: 1.1rem;
}
.reveal .aka {
  font-size: 1rem;
  margin-top: -0.4rem;
}
.reveal .artist {
  color: var(--muted);
  font-size: 1.2rem;
  margin: 0;
}
.cover {
  width: 200px;
  height: 200px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  animation: pop 0.4s;
}

/* ─── Guess the Movie ─── */
.mv-frame {
  position: relative;
  width: min(100%, 720px);
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg2);
  box-shadow: var(--shadow);
}
.mv-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  animation: pop 0.4s;
}
.mv-frame.paused img {
  filter: brightness(0.45) grayscale(0.4);
  animation: none;
}
.mv-pause {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 3.5rem;
}
.mv-thumbs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}
.mv-thumbs img,
.mv-thumbs .locked {
  width: 110px;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  object-fit: cover;
  border: 2px solid var(--line);
}
.mv-thumbs img.on {
  border-color: var(--accent);
}
.mv-thumbs .locked {
  display: grid;
  place-items: center;
  background: var(--bg2);
  color: var(--muted);
}
.mv-thumbs.all img {
  width: 180px;
}
.mv .buzz {
  width: 8.5rem;
  height: 8.5rem;
  font-size: 1.6rem;
}
.mv-reveal-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  text-align: left;
}
.mv-poster {
  width: 150px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  animation: pop 0.4s;
}
.tmdb-credit {
  margin-top: 1rem;
  font-size: 0.75rem;
}
@media (max-width: 760px) {
  .mv-thumbs img,
  .mv-thumbs .locked,
  .mv-thumbs.all img {
    width: 30%;
  }
  .mv-reveal-row {
    flex-direction: column;
    text-align: center;
  }
}
.unlock {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
}
.chrono {
  font-size: 1.3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.penalty {
  color: var(--warn) !important;
}
.feedback {
  min-height: 1.3em;
  margin: 0;
}
.feedback.bad {
  color: var(--bad);
}
.final-time {
  font-size: 3.5rem;
  font-weight: 700;
  margin: 0;
  color: var(--warn);
}
.rush-results {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
  text-align: left;
}
.rush-results li {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.35rem 0.6rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border-left: 4px solid var(--good);
}
.rush-results li.skipped {
  border-left-color: var(--warn);
}
.rush-results img {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 6px;
}
.rush-results span {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.rush-results small {
  color: var(--muted);
}
.rush-results em {
  font-style: normal;
  font-weight: 700;
}
.rush-results .found em {
  color: var(--good);
}
.rush-results .skipped em {
  color: var(--warn);
}
.rush-board {
  list-style: none;
  padding: 0;
  margin: 0 0 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.rush-board li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 0.5rem;
  align-items: center;
}
.rush-board .mini-bar {
  grid-column: 2 / 4;
  height: 6px;
  background: var(--bg2);
  border-radius: 99px;
  overflow: hidden;
}
.rush-board .mini-bar span {
  display: block;
  height: 100%;
  background: var(--good);
  transition: width 0.3s;
}
.rush-board li.me .pname {
  color: var(--accent);
}

/* ─── Pictionary ─── */
.pic {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.pic-top {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.8rem 1.2rem;
}
.pic-top .bar {
  flex-basis: 100%;
  margin: 0;
}
.pic-top .word {
  flex: 1;
  text-align: center;
  font-size: 1.5rem;
}
.word.mask {
  letter-spacing: 0.35em;
  font-weight: 700;
  font-family: ui-monospace, monospace;
}
.word.mask small {
  font-family: var(--font);
  letter-spacing: 0;
  font-size: 0.8rem;
  color: var(--muted);
  margin-left: 0.6rem;
  font-weight: 400;
}
.top-right {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}
.team-scores {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.team-chip {
  border: 2px solid var(--c);
  color: var(--c);
  border-radius: 999px;
  padding: 0.2em 0.8em;
  font-weight: 600;
}
.team-chip.mine {
  background: color-mix(in srgb, var(--c) 20%, transparent);
}
.team-chip b {
  color: var(--text);
}
.pic-body {
  display: grid;
  grid-template-columns: 230px 1fr 280px;
  gap: 1rem;
  align-items: start;
}
.pic-center {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.board {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 3px solid var(--line);
  background: #fff;
}
.board canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  touch-action: none;
}
.board canvas.can-draw {
  cursor: crosshair;
}
.board-overlay {
  position: absolute;
  inset: 0;
  background: rgba(20, 16, 42, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  text-align: center;
  padding: 1rem;
}
.board-overlay .timer {
  margin: 0;
}
.word-choices {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  justify-content: center;
}
.big-word,
.hl {
  color: var(--warn);
  font-weight: 700;
}
.big-word {
  font-size: 2.4rem;
  margin: 0;
}
.turn-results {
  list-style: none;
  padding: 0;
  margin: 0;
  min-width: 240px;
}
.turn-results li {
  display: flex;
  justify-content: space-between;
  padding: 0.2rem 0;
}
.turn-results .good {
  color: var(--good);
}
.board canvas.can-draw[data-tool='fill'],
.board canvas.can-draw[data-tool='picker'] {
  cursor: cell;
}
.brush-cursor {
  position: absolute;
  pointer-events: none;
  border: 1.5px solid #000;
  outline: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.tools {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
}
.tool-row {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  flex-wrap: wrap;
}
.tool-pick,
.sizes,
.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.tool-actions {
  margin-left: auto;
}
.tool,
.size {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: var(--bg2);
  color: var(--text);
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  padding: 0;
  cursor: pointer;
}
.size span {
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  background: var(--cur, #1b1b1f);
  box-shadow: 0 0 0 1.5px #fff;
}
.tool.active,
.size.active {
  border-color: var(--accent);
  background: var(--card2);
}
.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.swatch {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: var(--c);
  padding: 0;
  cursor: pointer;
}
.swatch.active {
  outline: 3px solid #fff;
  transform: scale(1.1);
}
.swatch.custom {
  position: relative;
  overflow: hidden;
  background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red);
}
.swatch.custom input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}
.pic-chat {
  display: flex;
  flex-direction: column;
  height: min(560px, 65vh);
}
.team-block {
  border-left: 4px solid var(--c);
  padding: 0.3rem 0.6rem;
  margin-bottom: 0.8rem;
  border-radius: 6px;
}
.team-block.mine {
  background: color-mix(in srgb, var(--c) 12%, transparent);
}
.team-block h4 {
  color: var(--c);
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.3rem;
}
.team-block h4 b {
  color: var(--text);
}
.team-block ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.team-block li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.team-block li.off {
  opacity: 0.45;
}

/* ─── Fin de partie ─── */
.end {
  max-width: 640px;
  margin: 1rem auto;
  text-align: center;
}
.end h2 {
  font-size: 2.2rem;
}
.ranking {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.ranking li {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.7rem 1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  text-align: left;
  animation: slide-in 0.4s backwards;
  animation-delay: calc(var(--i) * 0.08s);
}
.ranking li:first-child {
  background: linear-gradient(90deg, rgba(255, 201, 61, 0.25), transparent);
  font-size: 1.15rem;
}
.ranking li.me {
  outline: 2px solid var(--accent2);
}
.medal {
  font-size: 1.6rem;
  width: 2rem;
  text-align: center;
}
.rname {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.rname small {
  color: var(--muted);
}

/* ─── Galerie du Pictionary (fin de partie) ─── */
.gallery {
  max-width: 1100px;
  margin: 1rem auto;
}
.gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.gallery-head h3 {
  margin: 0;
}
.gallery-head h3 small {
  background: var(--card2);
  border-radius: 999px;
  padding: 0.1em 0.6em;
  margin-left: 0.3em;
  color: var(--text);
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.gal-item {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.6rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  animation: slide-in 0.4s backwards;
  animation-delay: calc(min(var(--i), 12) * 0.05s);
}
.gal-thumb {
  position: relative;
  padding: 0;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
}
.gal-thumb canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
}
.gal-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 2rem;
  color: #fff;
  background: rgba(20, 16, 42, 0.45);
  opacity: 0;
  transition: opacity 0.15s;
}
.gal-thumb:hover .gal-play,
.gal-thumb:focus-visible .gal-play {
  opacity: 1;
}
.gal-item figcaption {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  flex: 1;
}
.gal-word {
  font-weight: 600;
  font-size: 1.1rem;
}
.gal-miss {
  color: var(--bad);
}
.gal-item small {
  color: var(--muted);
}
.gal-item .team-chip,
.gal-info .team-chip {
  font-size: 0.8rem;
  padding: 0.05em 0.6em;
}
.gal-viewer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(10, 8, 24, 0.85);
}
.gal-box {
  width: min(820px, 100%);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  animation: pop 0.25s;
}
.gal-box .board canvas {
  touch-action: auto;
  cursor: pointer;
}
.gal-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.8rem;
}
.gal-info .gal-word {
  font-size: 1.4rem;
}
.gal-info small {
  margin-left: auto;
}
.gal-nav {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.gal-nav [data-nav] {
  font-size: 1.3rem;
  line-height: 1;
  min-width: 2.6rem;
}
@media (max-width: 760px) {
  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
  }
  .gal-item {
    padding: 0.45rem;
  }
  .gal-word {
    font-size: 1rem;
  }
  .gal-viewer {
    padding: 0.5rem;
  }
}

/* ─── Page « Soutenir » ─── */
a.brand,
a.btn {
  color: inherit;
  text-decoration: none;
}
.support-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}
.support-link:hover {
  color: var(--accent);
}
.home-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1.4rem;
  margin: 0;
}
.link-btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

/* ─── Signaler un problème ─── */
.report-dialog {
  width: min(460px, calc(100vw - 2rem));
  color: var(--text);
  padding: 1.4rem;
}
.report-dialog::backdrop {
  background: rgba(10, 6, 30, 0.7);
}
.report-dialog h3 {
  margin: 0 0 0.4rem;
}
.report-dialog textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem;
}
.report-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.donate {
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}
.donate-hero {
  text-align: center;
  padding-top: 1rem;
}
.donate-hero h1 {
  font-size: clamp(2rem, 6vw, 3rem);
  margin: 0;
}
.donate-why ul {
  padding-left: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0 0 0.8rem;
}
.donate-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.8rem;
}
.donate-link {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  color: inherit;
  text-decoration: none;
  padding: 1rem 1.1rem;
  transition: transform 0.15s, border-color 0.15s;
}
.donate-link:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}
.donate-link .emoji {
  font-size: 2rem;
}
.donate-text {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.donate-text small {
  color: var(--muted);
}
.donate-go {
  color: var(--accent);
  font-weight: 700;
}
.donate-soon {
  grid-column: 1 / -1;
  text-align: center;
}
.donate-note {
  text-align: center;
}

/* ─── Notifications ─── */
.toasts {
  position: fixed;
  top: 4.5rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 50;
}
.toast {
  background: var(--card2);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent2);
  padding: 0.7rem 1rem;
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-width: 320px;
  animation: slide-in 0.3s;
  transition: opacity 0.4s;
}
.toast.error {
  border-left-color: var(--bad);
}
.toast.success {
  border-left-color: var(--good);
}
.toast.announce {
  border-left-color: var(--warn);
  font-weight: 600;
  max-width: 380px;
}
.toast.out {
  opacity: 0;
}

/* ─── Animations ─── */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes pulse {
  50% {
    transform: scale(1.1);
  }
}
@keyframes pop {
  0% {
    transform: scale(0.85);
  }
  60% {
    transform: scale(1.05);
  }
}
@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}
@keyframes shake {
  20%,
  60% {
    transform: translateX(-8px);
  }
  40%,
  80% {
    transform: translateX(8px);
  }
}
.shake {
  animation: shake 0.35s;
}

/* ─── Responsive ─── */
@media (max-width: 1100px) {
  .lobby {
    grid-template-columns: 1fr 1fr;
  }
  .config-card {
    grid-column: 1 / -1;
    order: -1;
  }
  .pic-body {
    grid-template-columns: 1fr 260px;
  }
  .pic-side {
    grid-column: 1 / -1;
    order: 3;
  }
}
@media (max-width: 760px) {
  .screen {
    padding: 1rem;
  }
  .lobby,
  .game-layout,
  .pic-body {
    grid-template-columns: 1fr;
  }
  .game-pick {
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
  }
  .game-card small {
    display: none;
  }
  .choices {
    grid-template-columns: 1fr;
  }
  .topbar {
    flex-wrap: wrap;
    padding: 0.6rem 1rem;
  }
  .topbar-mid {
    order: 3;
    flex-basis: 100%;
  }
  .brand span {
    display: none;
  }
  .pic-chat,
  .chat-card {
    height: 320px;
  }
  .tools {
    padding: 0.6rem;
  }
  .tool-actions {
    margin-left: 0;
  }
  .tool,
  .size {
    width: 2.25rem;
    height: 2.25rem;
  }
  .buzz {
    width: 9rem;
    height: 9rem;
  }
}
