/* Mini-jeux : thème « arcade de poche ». Aucune police externe (bloquée en Chine) : polices système arrondies. */

:root {
  --bg: #161034;
  --bg-glow-1: #3b1f7a;
  --bg-glow-2: #0f4c6b;
  --surface: #251c57;
  --surface-2: #31267a;
  --surface-edge: #120c2e;
  --line: rgba(255, 255, 255, 0.08);
  --text: #fbf8ff;
  --muted: #a99fd6;
  --yellow: #ffd43b;
  --orange: #ff922b;
  --orange-edge: #c2410c;
  --green: #51cf66;
  --green-edge: #2b8a3e;
  --red: #ff6b6b;
  --pink: #f783ac;
  --cyan: #3bc9db;
  --radius: 18px;
  --press: 5px;
  --tw: 48px;
  --font:
    ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN", "PingFang SC", "Microsoft YaHei", system-ui,
    -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  margin: 0;
  min-height: 100%;
}
body {
  background:
    radial-gradient(60% 40% at 10% 0%, var(--bg-glow-1), transparent 70%),
    radial-gradient(60% 45% at 100% 100%, var(--bg-glow-2), transparent 70%),
    radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px) 0 0 / 22px 22px,
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  touch-action: manipulation;
  overflow-x: hidden;
}
#app {
  max-width: 520px;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 18px;
}

h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 42px;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1;
  background: linear-gradient(180deg, #fff 30%, var(--yellow));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.35));
}
h2 {
  font-size: 22px;
  font-weight: 900;
}
strong {
  font-weight: 800;
}
small {
  font-size: 13px;
}

/* ---------- Boutons ---------- */

button {
  font: inherit;
  color: inherit;
  border: 0;
  cursor: pointer;
  background: none;
  padding: 0;
  text-align: inherit;
}
button:disabled {
  cursor: default;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 52px;
  padding: 12px 20px;
  border-radius: 16px;
  font-size: 17px;
  font-weight: 800;
  background: var(--surface-2);
  box-shadow:
    0 var(--press) 0 var(--surface-edge),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition:
    transform 0.08s,
    box-shadow 0.08s;
  white-space: nowrap;
}
.btn.primary {
  color: #3b1d00;
  background: linear-gradient(180deg, var(--yellow), var(--orange));
  box-shadow:
    0 var(--press) 0 var(--orange-edge),
    inset 0 2px 0 rgba(255, 255, 255, 0.45);
}
.btn.small {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 14px;
  border-radius: 12px;
  --press: 3px;
}
.btn:active:not(:disabled),
.round:active:not(:disabled) {
  transform: translateY(var(--press));
  box-shadow: 0 0 0 transparent;
}
.btn:disabled {
  opacity: 0.4;
}
.round {
  --press: 4px;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  background: var(--surface-2);
  box-shadow:
    0 var(--press) 0 var(--surface-edge),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.round.small {
  width: 38px;
  height: 38px;
  font-size: 17px;
}
.round:disabled {
  opacity: 0.35;
}
.round-spacer {
  width: 44px;
  flex: none;
}
.link {
  color: var(--muted);
  font-weight: 700;
  padding: 8px;
  text-align: center;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Formulaires ---------- */

input[type="text"],
input[type="password"] {
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-edge);
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 14px 16px;
  width: 100%;
  outline: none;
}
input::placeholder {
  color: var(--muted);
  font-weight: 500;
}
input:focus {
  border-color: var(--yellow);
}
input[type="range"] {
  width: 100%;
  accent-color: var(--yellow);
}
.error {
  color: var(--red);
  font-weight: 700;
  min-height: 1.2em;
  font-size: 14px;
  text-align: center;
}

/* ---------- Mise en page ---------- */

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.grow {
  flex: 1 1 auto;
  min-width: 0;
}
.muted {
  color: var(--muted);
}
.center {
  text-align: center;
}
.panel {
  background: var(--surface);
  border-radius: 24px;
  padding: 20px;
  box-shadow:
    0 8px 0 var(--surface-edge),
    inset 0 1px 0 var(--line);
}
.section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.section-title {
  font-size: 13px;
  font-weight: 900;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: 0;
}
.empty-line {
  padding: 4px 2px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.1);
  white-space: nowrap;
}
.chip.good {
  background: rgba(81, 207, 102, 0.2);
  color: #8ce99a;
}
.chip.bad {
  background: rgba(255, 107, 107, 0.18);
  color: #ffa8a8;
}

/* ---------- En-tête ---------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar .title {
  flex: 1;
  text-align: center;
  font-size: 19px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-extra {
  min-width: 44px;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

/* ---------- Avatars ---------- */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #1b1533;
  font-weight: 900;
  flex: none;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18);
}
.avatar.xs {
  width: 20px;
  height: 20px;
  font-size: 11px;
  box-shadow: 0 0 0 2px var(--bg);
}
.avatar.sm {
  width: 34px;
  height: 34px;
  font-size: 15px;
}
.avatar.md {
  width: 44px;
  height: 44px;
  font-size: 19px;
}
.avatar.lg {
  width: 84px;
  height: 84px;
  font-size: 38px;
  box-shadow:
    inset 0 -6px 0 rgba(0, 0, 0, 0.18),
    0 0 0 5px rgba(255, 255, 255, 0.12);
}

/* ---------- Connexion et accueil ---------- */

.login-top {
  display: flex;
  justify-content: flex-end;
}
.brand {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.brand p {
  color: var(--muted);
  font-weight: 700;
}
.brand.big {
  margin: 24px 0 8px;
}
.brand.big h1 {
  font-size: 52px;
}
.brand-icons {
  font-size: 44px;
  letter-spacing: 6px;
  filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.3));
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  50% {
    transform: translateY(-6px);
  }
}
.account {
  display: flex;
  align-items: center;
  gap: 8px;
}
.account-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.account-text small {
  color: var(--muted);
  font-weight: 700;
}
.account-text strong {
  font-size: 19px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Cartes de jeu ---------- */

.game-card,
.game-hero {
  --theme-a: #845ef7;
  --theme-b: #5c7cfa;
  --theme-edge: #3b2a99;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 18px;
  border-radius: 24px;
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(255, 255, 255, 0.25), transparent 50%),
    linear-gradient(135deg, var(--theme-a), var(--theme-b));
  box-shadow:
    0 7px 0 var(--theme-edge),
    inset 0 2px 0 rgba(255, 255, 255, 0.3);
  color: #fff;
  text-align: left;
}
.game-card {
  --press: 7px;
  transition: transform 0.08s;
}
.game-card:active {
  transform: translateY(5px);
  box-shadow: 0 2px 0 var(--theme-edge);
}
.theme-fioles {
  --theme-a: #20c997;
  --theme-b: #1c7ed6;
  --theme-edge: #0b4f7a;
}
.game-icon {
  width: 64px;
  height: 64px;
  flex: none;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.18);
}
.game-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.game-text strong {
  font-size: 24px;
  font-weight: 900;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}
.game-text small {
  font-weight: 700;
  opacity: 0.92;
}
.game-text .chip {
  background: rgba(0, 0, 0, 0.2);
}
.game-go {
  font-size: 34px;
  font-weight: 900;
  opacity: 0.8;
}

/* ---------- Joueurs en ligne ---------- */

.online-list {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scrollbar-width: none;
}
.online-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 8px;
  border-radius: 99px;
  background: var(--surface);
  box-shadow: 0 4px 0 var(--surface-edge);
  flex: none;
}
.online-chip:disabled {
  opacity: 0.75;
}
.online-avatar {
  position: relative;
  display: flex;
}
.dot {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--surface);
}
.online-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.online-text small {
  color: var(--muted);
  font-weight: 700;
}

/* ---------- Grille des niveaux ---------- */

.levels {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.pager-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 18px;
  font-weight: 900;
}
.pager-label small {
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
}
.level-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}
.level {
  --press: 5px;
  aspect-ratio: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow:
    0 var(--press) 0 var(--surface-edge),
    inset 0 1px 0 var(--line);
  transition: transform 0.08s;
}
.level-number {
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}
.level-best {
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}
.level.done {
  background: linear-gradient(180deg, #69db7c, var(--green));
  box-shadow:
    0 var(--press) 0 var(--green-edge),
    inset 0 2px 0 rgba(255, 255, 255, 0.35);
  color: #0b3d17;
}
.level.open {
  background: linear-gradient(180deg, var(--yellow), var(--orange));
  box-shadow:
    0 var(--press) 0 var(--orange-edge),
    inset 0 2px 0 rgba(255, 255, 255, 0.45);
  color: #3b1d00;
  animation: pulse 1.6s ease-in-out infinite;
}
.level.join {
  background: linear-gradient(180deg, var(--cyan), #1c7ed6);
  box-shadow:
    0 var(--press) 0 #0b4f7a,
    inset 0 2px 0 rgba(255, 255, 255, 0.4);
  color: #fff;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  50% {
    filter: brightness(1.12);
    transform: scale(1.04);
  }
}
/* Seul le contenu de la case est atténué : les avatars des joueurs posés dessus restent nets. */
.level.locked {
  background: rgba(37, 28, 87, 0.6);
}
.level.locked .level-number {
  font-size: 16px;
  filter: grayscale(1);
  opacity: 0.55;
}
.level:active:not(:disabled) {
  transform: translateY(var(--press));
  box-shadow: none;
}
.level-live {
  position: absolute;
  top: -7px;
  right: -7px;
  display: flex;
}
.level-live .avatar.live {
  box-shadow:
    0 0 0 2px var(--bg),
    0 0 0 4px var(--green);
}
.avatar.more {
  background: var(--surface-2);
  color: var(--text);
  font-size: 9px;
}
.positions {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 6px;
  scrollbar-width: none;
}
.position {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 6px 12px 6px 6px;
  border-radius: 99px;
  background: var(--surface);
  box-shadow: 0 3px 0 var(--surface-edge);
}
.position.live {
  box-shadow:
    0 3px 0 var(--surface-edge),
    inset 0 0 0 2px var(--green);
}
.position-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  text-align: left;
}
.position-text small {
  color: var(--yellow);
  font-weight: 800;
  font-size: 12px;
}
.level-live .avatar + .avatar {
  margin-left: -7px;
}

/* ---------- Classement et listes ---------- */

.rank-list,
.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rank-row,
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow:
    0 4px 0 var(--surface-edge),
    inset 0 1px 0 var(--line);
  text-align: left;
}
.rank-row.me {
  box-shadow:
    0 4px 0 var(--surface-edge),
    inset 0 0 0 2px var(--yellow);
}
.rank {
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.1);
}
.rank-1 {
  background: var(--yellow);
  color: #5c3c00;
}
.rank-2 {
  background: #dee2e6;
  color: #343a40;
}
.rank-3 {
  background: #e8a87c;
  color: #4a2511;
}
.rank-text,
.list-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.rank-text small,
.list-text small {
  color: var(--muted);
  font-weight: 600;
}
.rank-score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1;
}
.rank-score strong {
  font-size: 24px;
  color: var(--yellow);
}
.rank-score small {
  color: var(--muted);
  font-weight: 700;
  font-size: 11px;
}

/* ---------- Fiche joueur ---------- */

.game-hero .game-icon {
  width: 56px;
  height: 56px;
  font-size: 32px;
}
.profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 14px 6px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 4px 0 var(--surface-edge);
}
.stat strong {
  font-size: 22px;
  color: var(--yellow);
}
.stat small {
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
  text-align: center;
}
.run-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.run-head .chips {
  justify-content: center;
}

/* ---------- Partie ---------- */

.record {
  display: flex;
  justify-content: flex-end;
}
.record-badge {
  padding: 3px 8px 3px 6px;
  color: var(--yellow);
}
.play-host {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Réactions de course : palette dans une fenêtre, puis bulles éphémères au-dessus du plateau. */
.reaction-button {
  font-size: 19px;
}
.reaction-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.reaction-option {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 8px 4px;
  border-radius: 14px;
  background: var(--surface-2);
  box-shadow: 0 3px 0 var(--surface-edge);
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
}
.reaction-option.emoji {
  font-size: 24px;
}
.reaction-option.text {
  font-size: 13px;
}
.reaction-option:active {
  transform: translateY(2px);
  box-shadow: none;
}
.reaction-bubbles {
  position: fixed;
  top: max(64px, env(safe-area-inset-top) + 56px);
  left: 50%;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transform: translateX(-50%);
  pointer-events: none;
}
.reaction-bubble {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100vw - 32px);
  padding: 5px 12px 5px 6px;
  border-radius: 99px;
  background: var(--surface);
  box-shadow:
    0 4px 0 var(--surface-edge),
    inset 0 1px 0 var(--line);
  font-weight: 800;
  animation: reaction-pop 0.2s ease-out;
  transition:
    opacity 0.3s,
    transform 0.3s;
}
.reaction-bubble.me {
  box-shadow:
    0 4px 0 var(--surface-edge),
    inset 0 0 0 2px var(--yellow);
}
.reaction-bubble.out {
  opacity: 0;
  transform: translateY(-4px);
}
.reaction-emoji {
  font-size: 22px;
  line-height: 1;
}
.reaction-text {
  font-size: 14px;
  white-space: nowrap;
}
@keyframes reaction-pop {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.9);
  }
}
.counter-row {
  display: flex;
  justify-content: center;
}
.counter {
  padding: 6px 18px;
  border-radius: 99px;
  background: var(--surface-edge);
  font-size: 18px;
  font-weight: 900;
  color: var(--yellow);
}
.table {
  position: relative;
  border-radius: 28px;
  padding: 8px 6px;
  background: radial-gradient(100% 80% at 50% 0%, rgba(255, 255, 255, 0.07), transparent 70%), var(--surface);
  box-shadow:
    0 8px 0 var(--surface-edge),
    inset 0 1px 0 var(--line);
}
.controls {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.controls .btn {
  flex: 1;
  max-width: 180px;
}
/* Compteur en pastille à cheval sur le bord haut du plateau. */
.table > .counter {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 1;
  transform: translate(-50%, -50%);
  padding: 4px 14px;
  font-size: 15px;
  white-space: nowrap;
}
/* Deux aperçus au plus, côte à côte, sans défilement. */
.live-boards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.live-board {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 5px 8px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 4px 0 var(--surface-edge);
}
.live-board-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.live-board-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.live-board-head small {
  margin-left: auto;
  color: var(--yellow);
  font-weight: 800;
  white-space: nowrap;
}
.live-status {
  align-self: flex-start;
  padding: 1px 7px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.5;
  white-space: nowrap;
}
.live-status::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 4px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: 1px;
}
.live-status.start {
  color: #74c0fc;
  background: rgba(116, 192, 252, 0.16);
}
.live-status.far {
  color: #ffd43b;
  background: rgba(255, 212, 59, 0.16);
}
.live-status.close {
  color: #69db7c;
  background: rgba(105, 219, 124, 0.18);
}
.live-status.stuck {
  color: #ff8787;
  background: rgba(255, 135, 135, 0.18);
}

/* ---------- Plateau (fioles) ---------- */

.board {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 18px 0 12px;
}
.board-row {
  display: flex;
  justify-content: center;
  gap: calc(var(--tw) * 0.28);
}
.tube {
  width: var(--tw);
  padding-top: 16px;
  position: relative;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.3, 1.6, 0.6, 1);
}
.glass {
  height: calc(var(--tw) * 3.1);
  border: 3px solid rgba(255, 255, 255, 0.45);
  border-top-width: 2px;
  border-radius: 8px 8px calc(var(--tw) / 2) calc(var(--tw) / 2);
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.14),
    rgba(255, 255, 255, 0.04) 40%,
    rgba(255, 255, 255, 0.1)
  );
  overflow: hidden;
  display: flex;
  flex-direction: column-reverse;
  padding: 0 3px 3px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.25);
}
.ball {
  height: 25%;
  flex: none;
  position: relative;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.15);
}
.ball:first-child {
  border-radius: 0 0 calc(var(--tw) / 2 - 4px) calc(var(--tw) / 2 - 4px);
}
.ball::after {
  content: "";
  position: absolute;
  left: 14%;
  top: 10%;
  width: 16%;
  height: 65%;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 6px;
}
.ball.fill {
  animation: fill 0.3s cubic-bezier(0.3, 1.4, 0.6, 1);
  transform-origin: bottom;
}
@keyframes fill {
  from {
    transform: scaleY(0);
  }
}
.tube.selected {
  transform: translateY(-20px);
}
.tube.selected .glass {
  border-color: var(--yellow);
  box-shadow:
    0 0 0 4px rgba(255, 212, 59, 0.3),
    0 12px 0 rgba(0, 0, 0, 0.2);
}
.tube.done::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 16%;
  width: 68%;
  height: 16px;
  background: linear-gradient(#d9a066, #8a5a2b);
  border-radius: 5px 5px 3px 3px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}
.tube.sealed::before {
  animation: cork 0.35s cubic-bezier(0.3, 1.6, 0.6, 1);
}
@keyframes cork {
  from {
    transform: translateY(-14px);
    opacity: 0;
  }
}
.tube.done .glass {
  border-color: rgba(255, 255, 255, 0.75);
}
.tube.shake {
  animation: shake 0.3s;
}
@keyframes shake {
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}
.mini {
  display: flex;
  justify-content: center;
}
.mini .board {
  gap: 4px;
  padding: 2px 0;
}
.mini .tube {
  padding-top: 0;
  cursor: default;
}
.mini .tube .glass {
  border-width: 1px;
  padding: 0 1px 1px;
  box-shadow: none;
}
.mini .tube.done::before {
  display: none;
}

/* ---------- États ---------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 56px 16px;
  text-align: center;
}
.empty-icon {
  font-size: 64px;
}
.loading {
  display: flex;
  justify-content: center;
  padding: 80px 0;
}
.spinner {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 5px solid var(--surface-2);
  border-top-color: var(--yellow);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Fenêtre de résultat ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(10, 6, 30, 0.72);
  backdrop-filter: blur(4px);
  animation: fade 0.2s;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.modal-box {
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px 20px 20px;
  border-radius: 28px;
  text-align: center;
  background: var(--surface);
  box-shadow:
    0 10px 0 var(--surface-edge),
    inset 0 2px 0 var(--line);
  animation: pop 0.35s cubic-bezier(0.3, 1.5, 0.6, 1);
}
@keyframes pop {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
}
.modal-emoji {
  font-size: 64px;
  line-height: 1;
}
.modal-value {
  font-size: 28px;
  font-weight: 900;
  color: var(--yellow);
}
.modal-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}
.scores {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.scores li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 14px;
  background: var(--surface-edge);
  text-align: left;
  font-weight: 700;
}
.scores li.me {
  box-shadow: inset 0 0 0 2px var(--yellow);
}

/* ---------- Notification ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(28px, env(safe-area-inset-bottom));
  z-index: 20;
  max-width: calc(100% - 32px);
  padding: 12px 20px;
  border-radius: 99px;
  background: #fff;
  color: var(--bg);
  font-weight: 800;
  text-align: center;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateX(-50%) translateY(20px);
  transition: 0.25s;
  pointer-events: none;
}
.toast.on {
  opacity: 1;
  transform: translateX(-50%);
}

@media (prefers-reduced-motion: reduce) {
  .brand-icons,
  .level.open,
  .level.join,
  .ball.fill,
  .tube.sealed::before,
  .modal,
  .modal-box,
  .reaction-bubble {
    animation: none;
  }
}
