/* Bzzz ! : une seule feuille, pensée pour un téléphone tenu d'une main, la nuit. */
@font-face {
  font-family: 'Bricolage Grotesque';
  src: url(/fonts/bricolage-grotesque-axes.woff2) format('woff2');
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #15121b;
  --bg-2: #1c1825;
  --card: #241f30;
  --card-2: #2f2840;
  --line: #3b3350;
  --ink: #f7f2e8;
  --ink-2: #b9b0c9;
  --ink-3: #857c97;
  --buzz: #ffd23f;
  --buzz-ink: #1b1500;
  --good: #3ddc97;
  --bad: #ff6b6b;
  --hot: #ff8a3d;
  --team: var(--buzz);
  --radius: 22px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    'Bricolage Grotesque',
    system-ui,
    -apple-system,
    'Segoe UI',
    sans-serif;
  font-size: 17px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

body {
  min-height: 100dvh;
  background: radial-gradient(120% 60% at 50% -10%, #3a2a5c55, transparent 70%), var(--bg);
}

h1,
h2,
h3,
p {
  margin: 0;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
  touch-action: manipulation;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  padding: calc(18px + var(--safe-top)) 18px calc(40px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100dvh;
}

/* ——— Le mot « Bzzz ! » ——— */
.logo {
  font-weight: 800;
  font-stretch: 85%;
  letter-spacing: -0.03em;
  color: var(--buzz);
  line-height: 0.9;
  display: inline-flex;
  align-items: baseline;
}
.logo.big {
  font-size: clamp(72px, 26vw, 128px);
}
.logo.small {
  font-size: 26px;
}
.logo span {
  display: inline-block;
}
.logo.big span {
  animation: jitter 2.6s infinite;
}
.logo.big span:nth-child(2) {
  animation-delay: 0.06s;
}
.logo.big span:nth-child(3) {
  animation-delay: 0.12s;
}
.logo.big span:nth-child(4) {
  animation-delay: 0.18s;
}
@keyframes jitter {
  0%,
  82%,
  100% {
    transform: none;
  }
  84% {
    transform: translate(-2px, 1px) rotate(-3deg);
  }
  88% {
    transform: translate(2px, -1px) rotate(3deg);
  }
  92% {
    transform: translate(-2px, 0) rotate(-2deg);
  }
  96% {
    transform: translate(1px, 1px) rotate(1deg);
  }
}

/* ——— Briques ——— */
.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.row.wrap {
  flex-wrap: wrap;
}
.grow {
  flex: 1;
  min-width: 0;
}
.center {
  text-align: center;
  align-items: center;
}
.muted {
  color: var(--ink-2);
}
.small {
  font-size: 14px;
}
.tiny {
  font-size: 12.5px;
  letter-spacing: 0.02em;
}
.spacer {
  flex: 1;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card h2,
.section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 56px;
  padding: 12px 20px;
  border-radius: 18px;
  font-weight: 700;
  font-size: 18px;
  background: var(--card-2);
  color: var(--ink);
  transition:
    transform 0.08s,
    filter 0.15s;
  text-align: center;
}
.btn:active {
  transform: scale(0.97);
}
.btn.primary {
  background: var(--buzz);
  color: var(--buzz-ink);
}
.btn.good {
  background: var(--good);
  color: #04261a;
}
.btn.bad {
  background: #4a2530;
  color: #ffc9c9;
}
.btn.ghost {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--line);
}
.btn.slim {
  min-height: 44px;
  font-size: 15px;
  padding: 8px 14px;
  border-radius: 14px;
  width: auto;
}
.btn[disabled] {
  opacity: 0.4;
  pointer-events: none;
}
.link {
  color: var(--ink-2);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 15px;
  padding: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field label {
  font-size: 14px;
  color: var(--ink-2);
  font-weight: 600;
}
.input {
  width: 100%;
  min-height: 56px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: var(--bg-2);
  padding: 10px 16px;
  font-size: 19px;
  font-weight: 600;
  outline: none;
}
.input:focus {
  border-color: var(--buzz);
}
.input.code {
  text-transform: uppercase;
  letter-spacing: 0.4em;
  text-align: center;
  font-size: 30px;
  font-weight: 800;
}

.error {
  background: #4a2530;
  color: #ffd6d6;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 15px;
}
.note {
  background: #2b2540;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14.5px;
  color: var(--ink-2);
}

/* Choix à cartes (ambiance, rythme) */
.choices {
  display: grid;
  gap: 10px;
}
.choices.three {
  grid-template-columns: repeat(3, 1fr);
}
.choice {
  background: var(--bg-2);
  border-radius: 16px;
  padding: 14px;
  text-align: left;
  box-shadow: inset 0 0 0 2px var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.choice b {
  font-size: 17px;
}
.choice span {
  font-size: 13.5px;
  color: var(--ink-2);
}
.choice[aria-pressed='true'] {
  box-shadow: inset 0 0 0 3px var(--buzz);
  background: #2e2a1a;
}
.choices.three .choice {
  text-align: center;
  align-items: center;
  padding: 12px 6px;
}
.choice .emoji {
  font-size: 26px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  width: 100%;
  padding: 6px 0;
}
.toggle .knob {
  flex: none;
  width: 52px;
  height: 32px;
  border-radius: 99px;
  background: var(--line);
  position: relative;
  transition: background 0.15s;
}
.toggle .knob::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 0.15s;
}
.toggle[aria-pressed='true'] .knob {
  background: var(--buzz);
}
.toggle[aria-pressed='true'] .knob::after {
  transform: translateX(20px);
  background: var(--buzz-ink);
}
.toggle b {
  display: block;
  font-size: 16px;
}
.toggle small {
  color: var(--ink-2);
  font-size: 13.5px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  padding: 9px 13px;
  border-radius: 99px;
  background: var(--bg-2);
  box-shadow: inset 0 0 0 2px var(--line);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.chip[aria-pressed='true'] {
  background: #2e2a1a;
  box-shadow: inset 0 0 0 2px var(--buzz);
  color: var(--ink);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--card-2);
  color: var(--ink-2);
  white-space: nowrap;
}
.pill.accent {
  background: var(--buzz);
  color: var(--buzz-ink);
}
.pill.hot {
  background: #47250f;
  color: #ffbe8c;
}
.pill.team {
  background: color-mix(in srgb, var(--team) 22%, var(--card));
  color: color-mix(in srgb, var(--team) 70%, white);
}

/* ——— Accueil ——— */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: 6vh 0 2vh;
}
.hero p {
  font-size: 21px;
  font-weight: 600;
  max-width: 17em;
}
.steps {
  display: grid;
  gap: 10px;
  counter-reset: step;
  padding: 0;
  margin: 0;
  list-style: none;
}
.steps li {
  counter-increment: step;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 15.5px;
  color: var(--ink-2);
}
.steps li::before {
  content: counter(step);
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--card-2);
  color: var(--buzz);
  font-weight: 800;
  font-size: 14px;
  display: grid;
  place-items: center;
}

/* ——— Barre du haut ——— */
.top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.top .code {
  font-weight: 800;
  letter-spacing: 0.18em;
  font-size: 15px;
  color: var(--ink-2);
  background: var(--card);
  padding: 6px 10px 6px 12px;
  border-radius: 10px;
}
.icon-btn {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--card);
  display: grid;
  place-items: center;
  font-size: 20px;
}
.back {
  color: var(--ink-2);
  font-weight: 600;
  padding: 8px 4px;
  align-self: flex-start;
}

/* ——— Salle d'attente ——— */
.bigcode {
  font-size: clamp(56px, 22vw, 96px);
  font-weight: 800;
  letter-spacing: 0.14em;
  margin-right: -0.14em;
  line-height: 1;
  color: var(--buzz);
}
.qr {
  width: 190px;
  height: 190px;
  border-radius: 18px;
  background: #fff;
  padding: 8px;
}
.qr img {
  width: 100%;
  height: 100%;
  display: block;
}
.people {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.person {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  min-height: 48px;
}
.person[disabled] {
  pointer-events: none;
}
button.person {
  width: 100%;
}
.person + .person {
  border-top: 1px solid #ffffff10;
}
.avatar {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--team) 30%, var(--card-2));
  color: color-mix(in srgb, var(--team) 60%, white);
  font-weight: 800;
  display: grid;
  place-items: center;
  font-size: 15px;
}
.person .name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.person.gone {
  opacity: 0.45;
}

/* ——— La soirée ——— */
.idle {
  align-items: center;
  text-align: center;
  padding: 30px 18px;
  gap: 10px;
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--line);
}
.idle .radar {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 38px;
  position: relative;
}
.idle .radar::before,
.idle .radar::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--buzz);
  opacity: 0;
  animation: ping 3.2s infinite;
}
.idle .radar::after {
  animation-delay: 1.6s;
}
@keyframes ping {
  0% {
    transform: scale(0.6);
    opacity: 0.6;
  }
  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}
.idle h3 {
  font-size: 21px;
}

.banner {
  border-radius: 16px;
  padding: 12px 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.banner.pause {
  background: #2b2540;
}
.banner.x {
  background: linear-gradient(90deg, #ff8a3d, #ffd23f);
  color: var(--buzz-ink);
}

/* La carte d'un défi */
.pop {
  background: linear-gradient(170deg, #332a49, var(--card) 60%);
  box-shadow: inset 0 0 0 2px #ffffff14;
  gap: 14px;
}
.pop.fresh {
  box-shadow: inset 0 0 0 3px var(--buzz);
}
.pop.mission {
  background: linear-gradient(170deg, #1d3a3a, var(--card) 65%);
}
.pop h3 {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.pop .who {
  font-size: 19px;
  font-weight: 700;
}
.pop .who .vs {
  color: var(--buzz);
  font-weight: 800;
  padding: 0 4px;
}
.pop .rules {
  font-size: 17px;
  color: #e6dff0;
}
.pop .drink {
  font-size: 15px;
  color: #ffcf9e;
  font-weight: 600;
}
.pop .timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--ink-2);
  font-size: 14.5px;
}
.pop .ask {
  font-weight: 700;
  font-size: 16px;
  margin-top: 2px;
}
.winners {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}
.winners .btn {
  min-height: 60px;
}
.claimline {
  background: #00000030;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 16px;
}

/* Équipes et scores */
.teamcard {
  border-left: 6px solid var(--team);
}
.scores {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.score {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  align-items: baseline;
}
.score .name {
  font-weight: 700;
  color: color-mix(in srgb, var(--team) 65%, white);
}
.score .pts {
  font-weight: 800;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}
.score .bar {
  grid-column: 1 / -1;
  height: 10px;
  border-radius: 99px;
  background: var(--bg-2);
  overflow: hidden;
}
.score .bar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--team);
  min-width: 6px;
  transition: width 0.6s cubic-bezier(0.2, 0.9, 0.2, 1);
}
.feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.feed .item {
  font-size: 15px;
  color: var(--ink-2);
  display: flex;
  gap: 10px;
  align-items: baseline;
}
.feed .item b {
  color: var(--ink);
}
.feed .item .plus {
  flex: none;
  font-weight: 800;
  color: color-mix(in srgb, var(--team) 70%, white);
  min-width: 2.2em;
}

/* ——— Feuilles (réglages, hôte) et plein écran ——— */
#layer:empty {
  display: none;
}
.sheet-back {
  position: fixed;
  inset: 0;
  background: #000a;
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade 0.15s;
}
.sheet {
  width: 100%;
  max-width: 520px;
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--bg-2);
  border-radius: 26px 26px 0 0;
  padding: 18px 18px calc(26px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: rise 0.22s cubic-bezier(0.2, 0.9, 0.2, 1);
}
.sheet h2 {
  font-size: 22px;
  font-weight: 800;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
@keyframes rise {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
}

/* Le bzzz : plein écran */
.buzz {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: var(--buzz);
  color: var(--buzz-ink);
  display: flex;
  flex-direction: column;
  padding: calc(22px + var(--safe-top)) 22px calc(22px + var(--safe-bottom));
  gap: 14px;
  overflow-y: auto;
  animation: flash 0.5s;
}
.buzz.mission {
  background: #7af0d0;
}
.buzz .shout {
  font-size: clamp(64px, 24vw, 110px);
  font-weight: 800;
  font-stretch: 80%;
  letter-spacing: -0.03em;
  line-height: 0.9;
  animation: shake 0.5s 3;
}
.buzz h3 {
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
}
.buzz .who {
  font-size: 22px;
  font-weight: 700;
}
.buzz .rules {
  font-size: 19px;
  font-weight: 500;
}
.buzz .pill {
  background: #0000001f;
  color: var(--buzz-ink);
}
.buzz .btn.primary {
  background: var(--buzz-ink);
  color: var(--buzz);
}
.buzz .drink {
  font-weight: 700;
}
@keyframes flash {
  0% {
    filter: brightness(2.2);
  }
}
@keyframes shake {
  0%,
  100% {
    transform: none;
  }
  20% {
    transform: translateX(-9px) rotate(-3deg);
  }
  40% {
    transform: translateX(9px) rotate(3deg);
  }
  60% {
    transform: translateX(-6px) rotate(-2deg);
  }
  80% {
    transform: translateX(6px) rotate(2deg);
  }
}

/* ——— Les duels sur l'écran ——— */
.arena {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.arena .half {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  text-align: center;
  background: var(--card);
  transition: background 0.08s;
  width: 100%;
}
.arena .half.top {
  transform: rotate(180deg);
}
.arena .half .pname {
  font-size: 30px;
  font-weight: 800;
}
.arena .half .big {
  font-size: 64px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.arena .half .hint {
  color: var(--ink-2);
  font-size: 17px;
  font-weight: 600;
}
.arena .mid {
  flex: none;
  min-height: 12px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 6px 12px;
}
.arena .mid:empty {
  padding: 0;
}
.arena.go .half {
  background: var(--good);
  color: #04261a;
}
.arena.go .half .hint {
  color: #04261a;
}
.arena.wait .half {
  background: #4a2530;
}
.arena .half.won {
  background: var(--buzz);
  color: var(--buzz-ink);
}
.arena .half.won .hint {
  color: var(--buzz-ink);
}
.arena .half.lost {
  background: var(--bg-2);
  color: var(--ink-3);
}
.arena .dots {
  display: flex;
  gap: 6px;
}
.arena .dots i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff25;
}
.arena .dots i.on {
  background: var(--buzz);
}
.arena .solo {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 26px;
  text-align: center;
  touch-action: manipulation;
}
.arena .solo .big {
  font-size: 84px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* ——— Fin de soirée ——— */
.podium {
  text-align: center;
  align-items: center;
  background: linear-gradient(
    170deg,
    color-mix(in srgb, var(--team) 35%, var(--card)),
    var(--card)
  );
  padding: 28px 18px;
}
.podium .trophy {
  font-size: 64px;
  line-height: 1;
}
.podium h3 {
  font-size: 34px;
  font-weight: 800;
  color: color-mix(in srgb, var(--team) 60%, white);
  line-height: 1.05;
}
.award {
  display: flex;
  gap: 12px;
  align-items: center;
}
.award .emoji {
  font-size: 30px;
  flex: none;
}
.award b {
  display: block;
}
.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 15;
  overflow: hidden;
}
.confetti i {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 16px;
  border-radius: 3px;
  animation: fall linear forwards;
}
@keyframes fall {
  to {
    transform: translateY(110vh) rotate(720deg);
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 50;
  background: var(--ink);
  color: var(--bg);
  padding: 12px 18px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 15px;
  max-width: calc(100vw - 36px);
  text-align: center;
  animation: rise 0.2s;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
