﻿:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1f232c;
  --border: #2a2f3a;
  --text: #e9ebf0;
  --text-dim: #9aa1ad;
  --accent: #5b8cff;
  --accent-dim: #3a4a7a;
  --green: #3ecf8e;
  --red: #ff6b6b;
  --gold: #f5c542;
  --felt-1: #1f7a42;
  --felt-2: #0e3d22;
}

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

html { -webkit-text-size-adjust: 100%; }

html, body {
  overflow-x: hidden;
  width: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }

/* Join screen */
.screen.join-screen, #join-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
  background: var(--bg);
}

.hero-wrap {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  aspect-ratio: 1037 / 1517;
}

.hero-wrap.admin-mode {
  aspect-ratio: 1086 / 1448;
}

.hero-img {
  width: 100%;
  display: block;
}

/* Real controls positioned in exact proportion to where they are drawn in the artwork */
#join-screen .overlay {
  position: absolute;
  margin: 0;
  box-sizing: border-box;
  width: auto;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

/* Les boutons Rejoindre/Choisir/Admin ou Joueur sont deja dessines dans bg-accueil.jpeg :
   on ne garde que des zones cliquables invisibles, positionnees via les blocs CALIBRATE
   ci-dessous (genere par calibrate.html). Le champ pseudo, lui, garde un fond opaque :
   l'image contient un nom d'exemple ("Drealy"/"Laura") qui doit etre entierement cache
   quand le champ est vide, pour ne pas laisser croire que c'est deja rempli. */
#join-screen .overlay-pseudo {
  background: linear-gradient(180deg, #1c1305 0%, #241a08 55%, #1a1204 100%);
  border-radius: 999px;
  color: #f6e7bb;
  font-weight: 600;
  font-size: 16px;
  padding: 0 5%;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

#join-screen .overlay-pseudo::placeholder { color: #cbb98a; }
#join-screen .overlay-pseudo:focus { outline: none; border-color: transparent; }

#join-screen .overlay.img-btn {
  color: transparent;
  text-indent: -9999px;
  font-size: 0;
  padding: 0;
  min-height: 0;
  cursor: pointer;
  background-color: transparent;
  background-image: none;
  -webkit-appearance: none;
  appearance: none;
}

#join-screen .overlay.img-btn:hover { filter: brightness(1.1); }

/* CALIBRATE:PLAYER:START - genere par calibrate.html, ne pas editer les valeurs a la main ici */
#join-screen .overlay-pseudo {
  top: 44.5%;
  left: 31.6%;
  width: 48.0%;
  height: 7.6%;
}

#join-screen .overlay-join {
  top: 56.0%;
  left: 15.9%;
  width: 32.5%;
  height: 22.2%;
}

#join-screen .overlay-choose {
  top: 56.5%;
  left: 51.4%;
  width: 32.3%;
  height: 21.3%;
}

#join-screen .overlay-admin-toggle {
  top: 79.5%;
  left: 33.7%;
  width: 32.7%;
  height: 4.2%;
}

/* CALIBRATE:PLAYER:END */

/* Repositionnement des boutons pour le visuel admin (bg-admin.jpeg), qui a une
   mise en page differente de bg-accueil.jpeg (champ et boutons plus bas, plus larges) */
/* CALIBRATE:START - genere par calibrate.html, ne pas editer les valeurs a la main ici */
#join-screen .hero-wrap.admin-mode .overlay-pseudo {
  top: 46.3%;
  left: 31.3%;
  width: 47.8%;
  height: 8.4%;
}

#join-screen .hero-wrap.admin-mode .overlay-join {
  top: 58.0%;
  left: 17.9%;
  width: 29.4%;
  height: 20.0%;
}

#join-screen .hero-wrap.admin-mode .overlay-choose {
  top: 57.8%;
  left: 52.1%;
  width: 30.9%;
  height: 20.2%;
}

#join-screen .overlay-admin-create-room {
  top: 81.2%;
  left: 25.5%;
  width: 48.5%;
  height: 7.2%;
  cursor: pointer;
}

#join-screen .overlay-admin-logout {
  top: 95.2%;
  left: 0.5%;
  width: 19.0%;
  height: 4.0%;
  cursor: pointer;
}

/* CALIBRATE:END */

/* En mode admin, les boutons Rejoindre/Choisir sont deja dessines dans bg-admin.jpeg :
   on ne garde qu'une zone cliquable invisible, sans redessiner l'image du bouton par-dessus. */
#join-screen .hero-wrap.admin-mode .overlay-join,
#join-screen .hero-wrap.admin-mode .overlay-choose {
  background-image: none;
}

.admin-badge {
  position: fixed;
  bottom: 10px;
  left: 10px;
  z-index: 40;
  background: linear-gradient(180deg, #3a2a10, #1c1206);
  border: 1.5px solid var(--gold);
  color: var(--gold);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.05em;
  padding: 5px 12px;
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.btn-kick {
  background: linear-gradient(180deg, #ff6b6b, #a83a3a);
  color: white;
}

.manage-player-close-btn { margin-top: 10px; }

.avatar.manageable { cursor: pointer; }
.avatar.manageable .avatar-circle:hover { outline: 2px solid var(--gold); }

#create-room-modal .pill-field {
  background: rgba(15, 9, 2, 0.82);
  border: 2px solid var(--gold);
  border-radius: 999px;
  color: #f6e7bb;
  font-weight: 600;
  padding: 14px 18px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

#create-room-modal .pill-field::placeholder { color: #cbb98a; }

#create-room-modal .pill-field:focus {
  outline: none;
  border-color: #f5d569;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
}

input[type="text"], input[type="number"], input[type="password"], input[type="datetime-local"], select {
  width: 100%;
  padding: 13px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
  margin-bottom: 10px;
  color-scheme: dark;
}

input[type="text"]:focus, input[type="number"]:focus, input[type="password"]:focus, input[type="datetime-local"]:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

button {
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  background: var(--accent);
  color: white;
  width: 100%;
  min-height: 44px;
}

button:hover { filter: brightness(1.1); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.ghost-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.gold-btn {
  background: var(--gold);
  color: #241d05;
}

.option-pick-btn {
  background: var(--surface-2);
  border: 2px solid var(--gold);
  color: var(--text);
  text-align: left;
  margin-bottom: 6px;
}
.option-pick-btn:hover {
  background: var(--gold);
  color: #241d05;
}

/* Game screen */
#game-screen {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 50% 0%, var(--felt-1) 0%, var(--felt-2) 55%, #061309 100%);
}

.game-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top));
  background: linear-gradient(180deg, #1a1206, #0c0805);
  border-bottom: 2px solid var(--gold);
  position: sticky;
  top: 0;
  z-index: 5;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-quit-btn {
  width: auto;
  min-height: 0;
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.35);
  border: 1.5px solid var(--gold);
  color: #f6e7bb;
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 13px;
  font-weight: 700;
}

.header-admin-btn {
  width: auto;
  min-height: 0;
  background: rgba(0, 0, 0, 0.35);
  border: 1.5px solid var(--gold);
  color: #f6e7bb;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 14px;
}

.admin-tools-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0;
}

.header-logo {
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}
.header-logo-crown { font-size: 17px; }
.header-logo-text {
  font-family: 'Luckiest Guy', cursive, sans-serif;
  font-size: 20px;
  letter-spacing: 0.03em;
  background: linear-gradient(180deg, #fff3c4, #f5c542 45%, #b9821f);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}

.room-code-display {
  justify-self: end;
  font-size: 11px;
  color: #cbb98a;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(245, 197, 66, 0.5);
  border-radius: 999px;
  padding: 4px 10px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.new-bet-btn {
  background: linear-gradient(180deg, #4d7dff, #2452d9);
  box-shadow: 0 4px 14px rgba(36, 82, 217, 0.4);
  font-size: 16px;
  padding: 14px;
  border-radius: 14px;
  animation: new-bet-pulse 1.6s ease-in-out infinite;
}

@keyframes new-bet-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.debt-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: #3a1f1f;
  border-bottom: 1px solid var(--red);
  color: #ffd6d6;
  font-size: 13px;
}
.debt-banner strong { color: var(--red); font-variant-numeric: tabular-nums; }
.debt-banner input {
  width: 110px;
  margin-bottom: 0;
  padding: 8px 10px;
}
.debt-banner button {
  width: auto;
  padding: 8px 14px;
  font-size: 13px;
  background: var(--red);
}

.debt-star { margin-left: 2px; }

.game-body {
  max-width: 640px;
  margin: 0 auto;
  padding: 18px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (max-width: 480px) {
  .card { padding: 20px; }
  .game-body { padding: 14px 14px 32px; gap: 16px; }
  .bet-actions { flex-wrap: wrap; }
  .bet-actions button { flex: 1; min-width: 120px; }
}

h2 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin: 0 0 12px;
}

.section-title {
  font-family: 'Luckiest Guy', cursive, sans-serif;
  font-size: 24px;
  text-align: center;
  letter-spacing: 0.03em;
  margin: 0;
  background: linear-gradient(180deg, #fff3c4, #f5c542 45%, #b9821f);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.bets-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sort-toggle-btn {
  position: absolute;
  right: 0;
  width: auto;
  min-height: 0;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(245, 197, 66, 0.5);
  color: #cbb98a;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.sort-toggle-btn:hover { border-color: var(--gold); color: var(--gold); }

.bets-list { display: flex; flex-direction: column; gap: 14px; }

/* Player avatars */
.players-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  row-gap: 16px;
}

.avatar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 68px;
  text-align: center;
}

.avatar-circle {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: linear-gradient(180deg, #3a2a10, #1c1206);
  border: 2px solid #8a6a2a;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d9b972;
}
.avatar-circle svg { width: 58%; height: 58%; }

.avatar.you .avatar-circle {
  width: 68px;
  height: 68px;
  border: 3px solid var(--gold);
  background: linear-gradient(180deg, #5a4218, #2a1d08);
  color: var(--gold);
  box-shadow: 0 0 0 4px rgba(245, 197, 66, 0.15), 0 4px 14px rgba(245, 197, 66, 0.35);
}

.avatar.offline {
  filter: grayscale(1);
  opacity: 0.55;
}

.avatar.offline .avatar-circle {
  border-color: #444;
  color: #666;
  background: linear-gradient(180deg, #222, #0a0a0a);
}

.avatar.offline .avatar-name,
.avatar.offline .avatar-balance {
  color: #888;
}

.avatar-name {
  font-size: 12px;
  font-weight: 600;
  color: #f0e6cc;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.avatar.you .avatar-name { font-size: 13px; font-weight: 700; }

.avatar-balance {
  font-size: 11px;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.avatar-badge {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #241d05;
  background: var(--gold);
  border-radius: 999px;
  padding: 2px 9px;
  text-transform: uppercase;
}

.avatar-debt-star {
  position: absolute;
  top: -5px;
  right: -5px;
  font-size: 13px;
}

.avatar-crown {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%) rotate(0deg);
  font-size: 16px;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.5));
}

/* Bet cards */
.bet-card {
  background: linear-gradient(180deg, rgba(28, 92, 52, 0.92), rgba(13, 51, 29, 0.95));
  border: 2px solid var(--gold);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3), 0 0 16px rgba(245, 197, 66, 0.2);
}

.bet-card.open {
  animation: bet-card-glow 2.2s ease-in-out infinite;
}

@keyframes bet-card-glow {
  0%, 100% { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3), 0 0 14px rgba(245, 197, 66, 0.25); }
  50% { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3), 0 0 30px rgba(245, 197, 66, 0.6); }
}

.bet-card.resolved,
.bet-card.cancelled {
  border-color: #556155;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Pari ouvert sur lequel on a deja mise : en attente du resultat */
.bet-card.open.awaiting-result {
  border-color: #6fd6ff;
  animation: bet-card-glow-blue 2.2s ease-in-out infinite;
}

@keyframes bet-card-glow-blue {
  0%, 100% { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3), 0 0 14px rgba(111, 214, 255, 0.3); }
  50% { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3), 0 0 30px rgba(111, 214, 255, 0.65); }
}

/* Pari dont la date limite est depassee : remonte tout en haut, contour violet */
.bet-card.open.deadline-passed {
  border-color: #b57bff;
  animation: bet-card-glow-purple 1.8s ease-in-out infinite;
}

@keyframes bet-card-glow-purple {
  0%, 100% { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3), 0 0 16px rgba(181, 123, 255, 0.35); }
  50% { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3), 0 0 34px rgba(181, 123, 255, 0.75); }
}

.bet-deadline {
  font-size: 12px;
  color: #cbb98a;
  margin: 4px 0 0;
}
.bet-deadline.passed {
  color: #d9b8ff;
  font-weight: 700;
}

.deadline-label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin: 4px 0 6px;
}

.bet-card.resolved { opacity: 0.75; }
.bet-card.cancelled { opacity: 0.55; }

.bet-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.bet-delete-btn {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  min-height: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(245, 197, 66, 0.5);
  color: #cbb98a;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bet-delete-btn:hover {
  background: rgba(180, 40, 40, 0.45);
  border-color: var(--red);
  color: #ffd6d6;
}

.bet-question { flex: 1; font-size: 18px; font-weight: 800; color: #f7f2df; margin: 0 0 4px; }
.bet-meta { font-size: 12.5px; color: #a9c9b3; margin: 0 0 4px; }
.bet-dates { font-size: 11px; color: #7fa08c; margin: 0 0 14px; }

.bet-status-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
}
.bet-status-tag.open { background: #2050c7; color: #cfe0ff; }
.bet-status-tag.resolved { background: #1f6b3a; color: #d8ffe3; }
.bet-status-tag.cancelled { background: #6b1f1f; color: #ffd6d6; }

.option-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  margin-bottom: 8px;
}

.option-row.winner { outline: 2px solid var(--gold); }

.option-row.clickable {
  cursor: pointer;
  transition: background 0.15s, outline 0.15s;
}
.option-row.clickable:hover { background: rgba(0, 0, 0, 0.4); }
.option-row.selected {
  outline: 2px solid var(--accent);
  background: rgba(45, 80, 200, 0.35);
}

.option-label { flex: 1; font-size: 14px; color: #f0ead2; font-weight: 600; }
.option-total { font-size: 12px; color: #a9c9b3; font-variant-numeric: tabular-nums; }

.option-bar-wrap {
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 5px;
}
.option-bar { height: 100%; background: linear-gradient(90deg, #4d7dff, #2452d9); }

.stake-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.stake-row input { margin-bottom: 0; flex: 1; }
.stake-row button { width: auto; white-space: nowrap; }

.bet-card input[type="number"] {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(245, 197, 66, 0.5);
  color: #f0ead2;
}
.bet-card input[type="number"]::placeholder { color: #9db9a6; }

.bet-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.bet-actions button {
  width: auto;
  flex: 1;
  font-size: 14px;
  padding: 12px;
  border-radius: 12px;
  font-weight: 700;
}

.btn-terminate {
  background: linear-gradient(180deg, #c9822f, #8a4f16);
  color: #fff3df;
}
.btn-cancel-bet {
  background: linear-gradient(180deg, #4d7dff, #2452d9);
  color: white;
}

.option-pick-btn {
  background: rgba(0, 0, 0, 0.3);
}

.your-stake-note {
  font-size: 12px;
  color: var(--green);
  margin-top: 8px;
}

.blind-note {
  font-size: 12px;
  color: #cbb98a;
  margin: 0 0 12px;
  font-style: italic;
}

.stakes-reveal {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed rgba(245, 197, 66, 0.35);
}

.stakes-reveal-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #a9c9b3;
  margin: 0 0 8px;
}

.stake-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: #f0ead2;
  margin: 0 0 6px;
}

.stake-line-detail {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 20;
}
.modal-card { width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto; }

.question-field {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 6px 0 14px;
  margin-bottom: 10px;
}
.question-prefix {
  flex-shrink: 0;
  color: var(--gold);
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
}
.question-field input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  margin-bottom: 0;
  padding: 13px 8px 13px 0;
}
.question-field input:focus { outline: none; border: none; }
.options-container { display: flex; flex-direction: column; }
.modal-actions { display: flex; gap: 10px; margin-top: 10px; }

/* Join by code - crystal blue popup */
.crystal-card {
  width: 100%;
  max-width: 320px;
  text-align: center;
  background: linear-gradient(160deg, rgba(120, 210, 255, 0.24), rgba(30, 80, 140, 0.4));
  border: 1px solid rgba(170, 230, 255, 0.6);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset, 0 8px 30px rgba(20, 130, 200, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.crystal-card h2 { color: #eaf9ff; margin: 0 0 14px; }
#join-code-modal .crystal-field {
  width: 100%;
  background: rgba(210, 245, 255, 0.15);
  border: 1px solid rgba(180, 235, 255, 0.7);
  border-radius: 10px;
  color: #eaf9ff;
  text-align: center;
}
#join-code-modal .crystal-field::placeholder { color: rgba(230, 248, 255, 0.6); }
#join-code-modal .crystal-field:focus { outline: none; border-color: #bdf0ff; }
.crystal-btn {
  background: linear-gradient(180deg, #6fd6ff, #2f8fd6);
  color: #06222f;
  font-weight: 800;
}
.crystal-btn:hover { filter: brightness(1.1); }

/* Win celebration popup */
.win-card {
  width: 100%;
  max-width: 340px;
  text-align: center;
  background: linear-gradient(160deg, rgba(245, 197, 66, 0.18), rgba(20, 12, 2, 0.9));
  border: 2px solid var(--gold);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 0 40px rgba(245, 197, 66, 0.35), 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: win-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes win-pop {
  0% { transform: scale(0.7); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.win-image-wrap {
  position: relative;
  width: 65%;
  max-width: 220px;
  margin: 0 auto 12px;
}

.win-rays {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 190%;
  height: 190%;
  transform: translate(-50%, -50%);
  background: repeating-conic-gradient(
    from 0deg,
    rgba(255, 217, 90, 1) 0deg 7deg,
    rgba(255, 217, 90, 0) 7deg 30deg
  );
  border-radius: 50%;
  -webkit-mask-image: radial-gradient(circle, rgba(0, 0, 0, 1) 22%, rgba(0, 0, 0, 0) 95%);
  mask-image: radial-gradient(circle, rgba(0, 0, 0, 1) 22%, rgba(0, 0, 0, 0) 95%);
  mix-blend-mode: screen;
  animation: win-rays-spin 6s linear infinite;
  z-index: 0;
  pointer-events: none;
}

@keyframes win-rays-spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.win-image {
  position: relative;
  z-index: 1;
  width: 100%;
  display: block;
  border-radius: 14px;
}

.win-title {
  font-family: 'Luckiest Guy', cursive, sans-serif;
  font-size: 25px;
  letter-spacing: 0.02em;
  margin: 0 0 8px;
  background: linear-gradient(180deg, #fff3c4, #f5c542 45%, #b9821f);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
}

.win-subtitle {
  font-size: 14px;
  color: #f0ead2;
  margin: 0 0 18px;
}

.win-close-btn { margin-top: 2px; }

/* Lose popup - meme structure que le win, avec des aureoles noires */
.lose-card {
  width: 100%;
  max-width: 340px;
  text-align: center;
  background: linear-gradient(160deg, rgba(120, 120, 120, 0.2), rgba(12, 12, 12, 0.94));
  border: 2px solid #4a4a4a;
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.55), 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: win-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.lose-image-wrap {
  position: relative;
  width: 65%;
  max-width: 220px;
  margin: 0 auto 12px;
}

.lose-rays {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 190%;
  height: 190%;
  transform: translate(-50%, -50%);
  background: repeating-conic-gradient(
    from 0deg,
    rgba(10, 10, 10, 1) 0deg 7deg,
    rgba(10, 10, 10, 0) 7deg 30deg
  );
  border-radius: 50%;
  -webkit-mask-image: radial-gradient(circle, rgba(0, 0, 0, 1) 22%, rgba(0, 0, 0, 0) 95%);
  mask-image: radial-gradient(circle, rgba(0, 0, 0, 1) 22%, rgba(0, 0, 0, 0) 95%);
  animation: win-rays-spin 6s linear infinite;
  z-index: 0;
  pointer-events: none;
}

.lose-image {
  position: relative;
  z-index: 1;
  width: 100%;
  display: block;
  border-radius: 14px;
}

.lose-title {
  font-family: 'Luckiest Guy', cursive, sans-serif;
  font-size: 25px;
  letter-spacing: 0.02em;
  margin: 0 0 8px;
  background: linear-gradient(180deg, #eaeaea, #9a9a9a 45%, #3a3a3a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
}

.lose-subtitle {
  font-size: 14px;
  color: #d8d3d3;
  margin: 0 0 18px;
}

.lose-close-btn { margin-top: 2px; background: #4a4a4a; }

/* Draw popup - meme structure que le win, avec une aureole bleu cristal */
.draw-card {
  width: 100%;
  max-width: 340px;
  text-align: center;
  background: linear-gradient(160deg, rgba(111, 214, 255, 0.18), rgba(6, 20, 30, 0.92));
  border: 2px solid #6fd6ff;
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 0 40px rgba(111, 214, 255, 0.35), 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: win-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.draw-image-wrap {
  position: relative;
  width: 65%;
  max-width: 220px;
  margin: 0 auto 12px;
}

.draw-rays {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 190%;
  height: 190%;
  transform: translate(-50%, -50%);
  background: repeating-conic-gradient(
    from 0deg,
    rgba(111, 214, 255, 1) 0deg 7deg,
    rgba(111, 214, 255, 0) 7deg 30deg
  );
  border-radius: 50%;
  -webkit-mask-image: radial-gradient(circle, rgba(0, 0, 0, 1) 22%, rgba(0, 0, 0, 0) 95%);
  mask-image: radial-gradient(circle, rgba(0, 0, 0, 1) 22%, rgba(0, 0, 0, 0) 95%);
  mix-blend-mode: screen;
  animation: win-rays-spin 6s linear infinite;
  z-index: 0;
  pointer-events: none;
}

.draw-image {
  position: relative;
  z-index: 1;
  width: 100%;
  display: block;
  border-radius: 14px;
}

.draw-title {
  font-family: 'Luckiest Guy', cursive, sans-serif;
  font-size: 22px;
  letter-spacing: 0.02em;
  margin: 0 0 18px;
  background: linear-gradient(180deg, #eaf9ff, #6fd6ff 45%, #2f8fd6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
}

.draw-close-btn {
  margin-top: 2px;
  background: linear-gradient(180deg, #6fd6ff, #2f8fd6);
  color: #06222f;
}

/* Le popup de confirmation peut s'ouvrir par-dessus un autre modal (ex: outils admin) :
   il doit rester visible au-dessus, avec une carte plus petite pour bien montrer qu'il est superpose */
#confirm-modal {
  z-index: 30;
}
#confirm-modal .gold-card {
  max-width: 300px;
}

/* Confirmation popup - gold/orange */
.gold-card {
  width: 100%;
  max-width: 340px;
  text-align: center;
  background: linear-gradient(160deg, rgba(201, 130, 47, 0.28), rgba(35, 18, 4, 0.65));
  border: 1px solid rgba(245, 197, 66, 0.6);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06) inset, 0 8px 30px rgba(180, 100, 20, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.gold-card .confirm-icon { font-size: 32px; margin: 0 0 8px; }
.auth-hint {
  color: #d8c79a;
  font-size: 12px;
  line-height: 1.5;
  margin: -6px 0 12px;
  text-align: left;
}
.auth-error {
  color: #ff8a8a;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  text-align: left;
  margin: -4px 0 10px;
  white-space: pre-line;
}
.gold-card .confirm-message {
  color: #fdf3d0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 18px;
}

/* Rooms browser screen */
#rooms-screen {
  min-height: 100vh;
  width: 100%;
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at top, #fbedb8 0%, #f3da8f 45%, #e9c86e 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 70px 16px 40px;
}

.back-arrow {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 44px;
  height: 44px;
  min-height: 44px;
  border-radius: 50%;
  background: rgba(20, 14, 4, 0.55);
  color: #f6e7bb;
  font-size: 20px;
  font-weight: 700;
  z-index: 3;
}

.rooms-title {
  color: #4a3308;
  font-size: 20px;
  font-weight: 800;
  margin: 0 0 18px;
  z-index: 1;
}

.rooms-empty {
  color: #6b4e12;
  font-size: 14px;
  text-align: center;
  max-width: 280px;
  z-index: 1;
}

.rooms-grid {
  width: 100%;
  max-width: 480px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 14px;
  z-index: 1;
}

.room-card {
  position: relative;
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: linear-gradient(180deg, #1f6b3a, #123c22);
  border: 3px solid #e6c25a;
  border-radius: 16px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  min-height: 0;
  padding: 10px 10px 8px;
}

.room-card-join {
  flex: 1;
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  border: none;
  padding: 0;
}
.room-card-join:hover { filter: brightness(1.1); }
.room-card-icon { font-size: 26px; }
.room-card-name {
  color: #fdf3d0;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  overflow-wrap: anywhere;
}

.room-card-remove {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  min-height: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(245, 197, 66, 0.5);
  color: #cbb98a;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.room-card-remove:hover {
  background: rgba(180, 40, 40, 0.45);
  border-color: var(--red);
  color: #ffd6d6;
}

.bill-decor {
  position: absolute;
  font-size: 30px;
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
  animation: bill-float 7s ease-in-out infinite;
}
.bill-1 { top: 10%; left: 8%; animation-delay: 0s; }
.bill-2 { top: 22%; right: 10%; animation-delay: 1.2s; font-size: 24px; }
.bill-3 { top: 55%; left: 5%; animation-delay: 2.4s; font-size: 26px; }
.bill-4 { top: 68%; right: 8%; animation-delay: 0.6s; }
.bill-5 { top: 85%; left: 45%; animation-delay: 1.8s; font-size: 22px; }
.bill-6 { top: 5%; left: 45%; animation-delay: 0.3s; font-size: 26px; }
.bill-7 { top: 15%; left: 25%; animation-delay: 1.5s; font-size: 22px; }
.bill-8 { top: 30%; left: 15%; animation-delay: 2.1s; font-size: 24px; }
.bill-9 { top: 35%; right: 25%; animation-delay: 0.9s; font-size: 28px; }
.bill-10 { top: 45%; left: 35%; animation-delay: 1.7s; font-size: 20px; }
.bill-11 { top: 50%; right: 40%; animation-delay: 2.6s; font-size: 24px; }
.bill-12 { top: 62%; left: 20%; animation-delay: 0.5s; font-size: 22px; }
.bill-13 { top: 75%; right: 20%; animation-delay: 1.1s; font-size: 26px; }
.bill-14 { top: 90%; left: 15%; animation-delay: 2.3s; font-size: 24px; }
.bill-15 { top: 92%; right: 35%; animation-delay: 1.9s; font-size: 20px; }

@keyframes bill-float {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50% { transform: translateY(-16px) rotate(6deg); }
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--red);
  color: white;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 50;
}
