/* =========================================================
   Resto Match — direction "bistrot editorial"
   Papier creme chaud · accents persimmon/safran · Fraunces + Hanken Grotesk
   ========================================================= */

:root {
  /* Thème CLAIR — "repas en terrasse" : crème ensoleillée, soleil doré + corail chaud. */
  --paper: #fdf1e0;        /* crème pêche ensoleillée */
  --paper-card: #fffaf1;   /* blanc chaud */
  --ink: #2a1d10;          /* brun chaud profond */
  --ink-soft: #8a735c;
  --line: #efddc4;
  --line-strong: #e0c6a2;

  --primary: #e4502a; /* persimmon — couleur dominante */
  --primary-deep: #c23c1b;
  --amber: #f4a51f; /* accent franc, doré */
  --yes: #1fa85a;
  --yes-deep: #178a49;
  --no: #3a322b;

  --radius: 18px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 0 rgba(70, 40, 12, 0.05), 0 2px 8px -4px rgba(70, 40, 12, 0.25);
  --shadow: 0 2px 0 rgba(70, 40, 12, 0.04), 0 24px 44px -22px rgba(80, 40, 12, 0.45);
  --shadow-pop: 0 30px 60px -24px rgba(80, 35, 10, 0.55);

  --font-display: "Fraunces", "Times New Roman", serif;
  --font-body: "Hanken Grotesk", system-ui, sans-serif;

  /* Halos d'ambiance du fond (soleil doré + corail chaud ; paramétrables par thème). */
  --glow-a: rgba(248, 186, 64, 0.30);
  --glow-b: rgba(231, 104, 52, 0.18);
}

/* =========================================================
   Thème NUIT — "bleu nuit" : ciel profond bleuté + guirlande chaude (déco).
   Activé via [data-theme="dark"] (bouton, ou OS résolu par /theme-init.js).
   ========================================================= */
:root[data-theme="dark"] {
  --paper: #0c1326;        /* bleu nuit profond */
  --paper-card: #16213f;   /* bleu nuit plus clair (cartes) */
  --ink: #e9eefb;          /* blanc légèrement bleuté */
  --ink-soft: #9fb0d4;     /* bleu-gris atténué */
  --line: #273455;
  --line-strong: #3a4c7e;

  --primary: #ff6a43;      /* persimmon avivé : ressort sur le bleu */
  --primary-deep: #e0512c;
  --amber: #f6c14e;
  --yes: #36c574;
  --yes-deep: #27a85e;
  --no: #1b2440;

  --shadow-sm: 0 1px 0 rgba(0, 0, 0, 0.4), 0 2px 8px -4px rgba(0, 0, 0, 0.65);
  --shadow: 0 2px 0 rgba(0, 0, 0, 0.3), 0 24px 44px -22px rgba(0, 2, 12, 0.8);
  --shadow-pop: 0 30px 60px -24px rgba(0, 2, 12, 0.85);

  /* Halos d'ambiance : bleu froid en haut, pointe chaude discrète en bas. */
  --glow-a: rgba(120, 150, 255, 0.10);
  --glow-b: rgba(255, 120, 70, 0.07);
}

/* Guirlande lumineuse — DÉCO seule (mode nuit) : ampoules chaudes alternées
   suspendues à un fil discret, scintillement léger. pointer-events désactivés. */
:root[data-theme="dark"] body { padding-top: 20px; }
:root[data-theme="dark"] body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 20px;
  pointer-events: none;
  z-index: 35;
  background:
    radial-gradient(circle 3px at 13px 12px, #ffd27a 58%, transparent 62%) 0 0 / 50px 20px repeat-x,
    radial-gradient(circle 3px at 38px 15px, #ff8a4c 58%, transparent 62%) 0 0 / 50px 20px repeat-x,
    linear-gradient(rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.1)) 0 4px / 100% 1px repeat-x;
  filter: drop-shadow(0 1px 3px rgba(255, 160, 70, 0.55));
  animation: garland-twinkle 4.5s ease-in-out infinite;
}
@keyframes garland-twinkle { 0%, 100% { opacity: 0.92; } 50% { opacity: 0.62; } }

* { box-sizing: border-box; }

/* L'attribut hidden doit toujours l'emporter (sinon .overlay{display:flex} le masque). */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: flex;
  flex-direction: column;
  background-color: var(--paper);
  background-image:
    radial-gradient(1100px 600px at 84% -12%, var(--glow-a), transparent 60%),
    radial-gradient(900px 680px at -12% 112%, var(--glow-b), transparent 60%);
  background-attachment: fixed;
}

/* Grain atmospherique (SVG fractal noise) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.screen {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px;
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
}

/* ---- Typographie ---- */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 900;
  font-optical-sizing: auto;
  letter-spacing: -0.02em;
  line-height: 1.02;
  margin: 0 0 8px;
}
.logo {
  font-size: clamp(2.6rem, 9vw, 3.8rem);
  text-align: center;
  font-weight: 900;
}
.tagline {
  text-align: center;
  color: var(--ink-soft);
  font-size: 1.05rem;
  margin: 0 0 6px;
}
.tagline em, .accent-ital {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  color: var(--primary);
}
.foot-note { text-align: center; color: var(--ink-soft); font-size: 0.85rem; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.85rem; }

/* ---- Panneaux ---- */
.card-panel {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow);
}
.center-panel { display: flex; flex-direction: column; gap: 14px; }
.home-screen { justify-content: center; }
.btn-back {
  align-self: flex-start;
  padding: 8px 16px;
  font-family: var(--font-body);
}

.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.row .input { flex: 1; }

/* ---- Champs ---- */
.input, textarea.input {
  width: 100%;
  background: #fff;
  border: 1.5px solid var(--line-strong);
  color: var(--ink);
  border-radius: 14px;
  padding: 13px 15px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: #b6a48c; }
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(228, 80, 42, 0.14);
}
textarea.input { resize: vertical; }
.label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin: 12px 0 6px;
}

/* ---- Boutons ---- */
.btn {
  border: none;
  border-radius: 14px;
  padding: 13px 20px;
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font-body);
  cursor: pointer;
  color: var(--ink);
  transition: transform 0.06s ease, box-shadow 0.18s, background 0.18s, filter 0.18s;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-lg { padding: 16px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 12px 24px -12px rgba(228, 80, 42, 0.8);
}
.btn-primary:hover { background: var(--primary-deep); }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--ink);
  color: var(--ink);
}
.btn-outline:hover { background: var(--ink); color: var(--paper-card); }
.btn-ghost {
  background: rgba(35, 25, 15, 0.06);
  color: var(--ink);
}
.btn-ghost:hover { background: rgba(35, 25, 15, 0.12); }

.divider { display: flex; align-items: center; gap: 12px; color: var(--ink-soft); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }

/* ---- Topbar ---- */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.room-code {
  font-family: var(--font-display);
  font-weight: 900;
  letter-spacing: 3px;
  font-size: 1.3rem;
  color: var(--primary);
}

/* ---- Lobby ---- */
.lobby-grid { display: grid; gap: 16px; }
.participants { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.participant {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 13px;
}
.participant .pp-name { font-weight: 700; }
.participant.offline { opacity: 0.5; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); margin-top: 7px; flex: none; }
.dot.on { background: var(--yes); box-shadow: 0 0 0 3px rgba(31, 168, 90, 0.18); }
.badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(35, 25, 15, 0.06);
  border: 1px solid var(--line);
  margin-left: 6px;
  vertical-align: middle;
}
.badge.ready { background: rgba(31, 168, 90, 0.14); border-color: rgba(31, 168, 90, 0.4); color: var(--yes-deep); }
.badge.open { background: rgba(31, 168, 90, 0.15); border-color: rgba(31, 168, 90, 0.45); color: var(--yes-deep); }
.badge.closed { background: rgba(228, 80, 42, 0.12); border-color: rgba(228, 80, 42, 0.4); color: var(--primary-deep); }
.hours-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; }
.badge.rate { background: rgba(242, 165, 22, 0.16); border-color: rgba(242, 165, 22, 0.5); color: #a86b04; }

/* Turnstile */
.turnstile-box { display: flex; justify-content: center; margin: 4px 0; min-height: 0; }

/* Roue (égalité) */
.wheel-section { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.wheel-wrap { position: relative; width: min(78vw, 320px); height: min(78vw, 320px); }
.wheel-disc {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 6px solid var(--paper-card);
  box-shadow: var(--shadow-pop);
  transform: rotate(0deg);
}
.wheel-pointer {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-top: 24px solid var(--ink);
  z-index: 2;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35));
}
/* Étiquette : barre du centre vers l'extérieur, texte radial centré dans le secteur. */
.wheel-label {
  position: absolute;
  left: 50%;
  bottom: 50%;
  height: 46%;
  width: 110px;
  margin-left: -55px;
  transform-origin: bottom center;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.wheel-label > span {
  display: inline-block;
  transform: rotate(-90deg); /* texte le long du rayon (centre -> extérieur) */
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.wheel-section .btn { margin-top: 6px; }
.top-progress { font-weight: 700; color: var(--primary); font-size: 0.85rem; }

/* Bouton mute flottant */
.mute-btn {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 1300;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper-card);
  box-shadow: var(--shadow-sm);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
}
.mute-btn:hover { opacity: 1; }

/* Podium */
.podium { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 10px; }
.podium-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}
.podium-1 { border-color: var(--amber); box-shadow: 0 0 0 2px rgba(242, 165, 22, 0.35), var(--shadow); }
.medal { font-size: 1.7rem; flex: none; }
.podium-link { text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 2px; }
.podium-name { font-family: var(--font-display); font-weight: 900; font-size: 1.1rem; }
.podium-meta { color: var(--ink-soft); font-size: 0.82rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rank-details { margin-bottom: 14px; }
.rank-details summary { cursor: pointer; color: var(--ink-soft); font-size: 0.9rem; margin-bottom: 8px; }
.note { color: var(--ink-soft); font-size: 0.85rem; margin: 4px 0 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 15px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.slider { width: 100%; accent-color: var(--primary); }
.radius-controls { display: flex; align-items: center; gap: 12px; }
.radius-controls .slider { flex: 1; }
.radius-input { width: 104px; flex: none; text-align: center; font-weight: 600; padding: 11px 10px; }
.warn-banner {
  background: rgba(242, 165, 22, 0.14);
  border: 1px solid rgba(242, 165, 22, 0.5);
  border-radius: 14px;
  padding: 12px 15px;
  font-size: 0.85rem;
  color: #8a5a06;
}

/* ---- Carte (Leaflet + Google Maps Embed) ---- */
.map { width: 100%; height: 210px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); z-index: 1; }
/* Carte Google Maps Embed (iframe) : remplit le conteneur, hérite de son arrondi. */
.map > iframe.gmap-embed, .map-preview iframe.gmap-embed { width: 100%; height: 100%; border: 0; display: block; }
.map-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: 0.8rem; color: var(--ink-soft); }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.rm-pin span {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(45deg);
  background: var(--c, var(--ink));
  border: 2px solid #fff;
  box-shadow: 0 3px 7px rgba(60, 25, 5, 0.5);
}
.rm-pin.big span { width: 24px; height: 24px; }

/* Panneau carte plein ecran dans le swipe */
.map-panel { display: flex; flex-direction: column; gap: 12px; flex: 1; }
.map-panel .map { height: 60vh; min-height: 320px; }
.icon-btn {
  border: 1.5px solid var(--line-strong);
  background: #fff;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 1rem;
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--ink); }

/* ---- Deck / swipe ---- */
#screen-swipe { justify-content: space-between; }
.deck { position: relative; flex: 1; min-height: 300px; display: flex; align-items: stretch; }
.swipe-card {
  position: absolute;
  inset: 0;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  touch-action: pan-y;
  user-select: none;
  will-change: transform;
  animation: cardIn 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes cardIn { from { opacity: 0; transform: scale(0.96) translateY(10px); } to { opacity: 1; transform: none; } }
.card-photo {
  height: 46%;
  background: linear-gradient(135deg, #f3e7d3, #efd9bd) center/cover no-repeat;
  position: relative;
  flex: none;
}
.card-photo.placeholder { display: flex; align-items: center; justify-content: center; font-size: 3.2rem; opacity: 0.6; }
.card-body { padding: 18px; overflow-y: auto; flex: 1; }
.card-title { font-size: 1.7rem; line-height: 1.05; margin: 0; }
.card-sub { color: var(--ink-soft); margin: 6px 0 12px; font-size: 0.95rem; }
.rating { color: #c98a06; font-weight: 700; font-family: var(--font-display); }
.reviews { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.review { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; font-size: 0.86rem; }
.review .rv-meta { color: var(--ink-soft); font-size: 0.74rem; margin-top: 5px; }
.no-data { color: var(--ink-soft); font-style: italic; font-size: 0.85rem; }

/* ---- Layout swipe + panneau "menu / infos" ---- */
.swipe-layout { display: flex; flex-direction: column; gap: 16px; flex: 1; min-height: 0; }
.swipe-main { display: flex; flex-direction: column; gap: 16px; flex: 1; min-height: 0; }

.info-toggle {
  width: 100%;
  border: 1.5px solid var(--line-strong);
  background: #fff;
  border-radius: 14px;
  padding: 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
}
.info-panel {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  overflow-y: auto;
  flex-direction: column;
  gap: 14px;
}
.info-panel:empty { display: none; }
.ip-head { display: flex; flex-direction: column; gap: 4px; }
.ip-title { font-size: 1.3rem; margin: 0; line-height: 1.05; }
.ip-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: var(--ink-soft); font-size: 0.85rem; }
.ip-price { color: #2e7d32; font-weight: 700; }
.ip-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ip-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1.5px solid var(--line-strong); background: #fff;
  border-radius: 10px; padding: 8px 12px; font-size: 0.85rem; font-weight: 600;
  color: var(--ink); text-decoration: none;
}
.ip-btn.primary { background: var(--primary); color: #fff; border-color: transparent; }
.ip-summary { font-size: 0.9rem; margin: 0; }
.ip-section-title {
  font-family: var(--font-display); font-weight: 700; font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); margin: 4px 0 0;
}
.ip-attrs { display: flex; flex-wrap: wrap; gap: 6px; }
.ip-attr { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 0.78rem; }
.ip-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ip-gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.ip-empty { color: var(--ink-soft); font-style: italic; font-size: 0.85rem; margin: 0; }

@media (min-width: 900px) {
  #screen-swipe { max-width: 1080px; }
  .swipe-layout { flex-direction: row; align-items: stretch; }
  .swipe-main { flex: 1 1 58%; min-width: 0; }
  .info-panel { display: flex; flex: 0 0 360px; }
  .info-toggle { display: none !important; }
  .swipe-card .reviews { display: none; } /* évite la redite : avis affichés dans le panneau */
}
@media (max-width: 899px) {
  .info-panel { display: none; }
  .info-panel.open { display: flex; }
}

.stamp {
  position: absolute;
  top: 26px;
  padding: 6px 16px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.5rem;
  border: 4px solid;
  opacity: 0;
  transition: opacity 0.1s;
  background: rgba(255, 253, 248, 0.7);
  backdrop-filter: blur(2px);
}
.stamp.yes { left: 22px; color: var(--yes); border-color: var(--yes); transform: rotate(-13deg); }
.stamp.no { right: 22px; color: var(--primary); border-color: var(--primary); transform: rotate(13deg); }

.counter-pill {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(35, 25, 15, 0.82);
  color: #fff;
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 0.85rem;
  font-weight: 600;
}

.swipe-actions { display: flex; justify-content: center; align-items: center; gap: 28px; padding: 10px 0 4px; }
.fab {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 1.7rem;
  color: #fff;
  box-shadow: var(--shadow);
  transition: transform 0.08s, filter 0.15s;
}
.fab:hover { filter: brightness(1.05); }
.fab:active { transform: scale(0.9); }
.fab-no { background: var(--no); }
.fab-yes { background: var(--yes); }

.warn-chip { display: inline-block; font-size: 0.74rem; color: #8a5a06; margin-top: 10px; }

/* ---- Attente / match / classement ---- */
.waiting { text-align: center; color: var(--ink-soft); padding: 44px 0; }
.spinner {
  width: 42px; height: 42px;
  border: 4px solid var(--line-strong);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#screen-match { justify-content: center; text-align: center; }
.match-burst h1 { font-size: clamp(1.8rem, 6vw, 2.6rem); margin-bottom: 18px; animation: pop 0.5s cubic-bezier(0.2, 0.8, 0.2, 1.4) both; }
@keyframes pop { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: none; } }
.match-fiche {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-align: left;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.match-fiche .card-photo { height: 200px; }
.match-fiche .card-body a { color: var(--primary); font-weight: 700; }

.ranking { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.rank-item { background: var(--paper-card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow-sm); }
.rank-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.rank-head strong { font-family: var(--font-display); font-size: 1.15rem; }
.rank-pct { font-family: var(--font-display); font-weight: 900; font-size: 1.3rem; color: var(--primary); }
.bar { height: 9px; background: #efe2cd; border-radius: 999px; margin-top: 10px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--amber), var(--primary)); border-radius: inherit; }

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper-card);
  padding: 13px 20px;
  border-radius: 14px;
  box-shadow: var(--shadow-pop);
  z-index: 1200;
  max-width: 90%;
  font-weight: 500;
  animation: toastIn 0.25s ease both;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---- Reveal en cascade au chargement ---- */
@keyframes riseIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.home-screen .center-panel > *,
.lobby-grid > * {
  animation: riseIn 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.home-screen .center-panel > *:nth-child(1) { animation-delay: 0.04s; }
.home-screen .center-panel > *:nth-child(2) { animation-delay: 0.1s; }
.home-screen .center-panel > *:nth-child(3) { animation-delay: 0.16s; }
.home-screen .center-panel > *:nth-child(4) { animation-delay: 0.22s; }
.home-screen .center-panel > *:nth-child(5) { animation-delay: 0.28s; }
.lobby-grid > *:nth-child(1) { animation-delay: 0.04s; }
.lobby-grid > *:nth-child(2) { animation-delay: 0.12s; }
.lobby-grid > *:nth-child(3) { animation-delay: 0.2s; }
.lobby-grid > *:nth-child(4) { animation-delay: 0.28s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (min-width: 700px) {
  .lobby-grid { grid-template-columns: 1fr 1fr; }
  .lobby-grid .card-panel.full { grid-column: 1 / -1; }
}

/* =========================================================
   Multi-pages : aperçu carte (swipe) + overlays match / classement
   ========================================================= */

/* Aperçu carte façon "mini Google Maps" sous le swipe */
.map-preview {
  position: relative;
  height: 152px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  flex: none;
}
.map-preview .map { height: 100%; border: none; border-radius: 0; }
.map-preview.expanded {
  position: fixed;
  inset: 0;
  height: auto;
  z-index: 1000;
  border-radius: 0;
  border: none;
}
.map-expand, .map-collapse {
  position: absolute;
  z-index: 1001;
  border: none;
  cursor: pointer;
  font-weight: 700;
  font-family: var(--font-body);
}
.map-expand {
  top: 8px;
  right: 8px;
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 11px;
  font-size: 0.85rem;
}
.map-collapse {
  top: 12px;
  right: 12px;
  background: var(--primary);
  color: #fff;
  border-radius: 12px;
  padding: 10px 15px;
}

/* Overlays plein écran (sur la page swipe) */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: var(--paper);
  overflow-y: auto;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.overlay .screen-inner { max-width: 780px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }

/* Overlay de chargement (construction du deck) */
.loading-overlay {
  align-items: center;
  justify-content: center;
  text-align: center;
  background:
    radial-gradient(900px 520px at 50% -12%, rgba(242, 165, 22, 0.32), transparent 60%),
    radial-gradient(720px 520px at 50% 118%, rgba(228, 80, 42, 0.26), transparent 60%),
    var(--paper);
  animation: overlayIn 0.3s ease both;
}
.loading-box { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 340px; }
.loading-box h2 { font-size: clamp(1.4rem, 5vw, 1.9rem); margin: 4px 0 0; }
.plate-spinner {
  font-size: 3.6rem;
  line-height: 1;
  animation: plateSpin 1.5s ease-in-out infinite;
}
@keyframes plateSpin {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1); }
}
.load-bar {
  width: 240px;
  max-width: 72vw;
  height: 8px;
  margin-top: 10px;
  background: #efe2cd;
  border-radius: 999px;
  overflow: hidden;
}
.load-bar > span {
  display: block;
  height: 100%;
  width: 40%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--amber), var(--primary));
  animation: loadSlide 1.2s ease-in-out infinite;
}
@keyframes loadSlide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

/* Fiche du gagnant : cliquable vers le site du restaurant */
.match-fiche-link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 0.12s, box-shadow 0.18s;
}
.match-fiche-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-pop); }
.open-cta {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  text-align: center;
  padding: 12px;
  font-family: var(--font-body);
}

/* Match : ambiance festive + animation */
.match-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 22px;
  text-align: center;
  overflow: hidden;
  background:
    radial-gradient(900px 520px at 50% -12%, rgba(242, 165, 22, 0.4), transparent 60%),
    radial-gradient(720px 520px at 50% 118%, rgba(228, 80, 42, 0.34), transparent 60%),
    var(--paper);
  animation: overlayIn 0.35s ease both;
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.match-overlay .burst-title {
  font-size: clamp(1.7rem, 7vw, 2.8rem);
  margin-bottom: 14px;
  animation: pop 0.55s cubic-bezier(0.2, 0.8, 0.2, 1.5) both;
}
.match-overlay .match-fiche {
  width: 100%;
  max-width: 460px;
  animation: riseIn 0.5s 0.12s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.match-overlay #match-map {
  width: 100%;
  max-width: 460px;
  height: 190px;
  animation: riseIn 0.5s 0.22s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.match-overlay .replay { margin-top: 16px; animation: riseIn 0.5s 0.32s both; }

/* Confettis (générés en JS, CSS pur pour le mouvement) */
.confetti {
  position: absolute;
  top: -8vh;
  font-size: 1.4rem;
  pointer-events: none;
  will-change: transform;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  to { transform: translateY(118vh) rotate(720deg); opacity: 0.9; }
}

@media (prefers-reduced-motion: reduce) {
  .confetti { display: none; }
}

/* Ajustements mobile */
@media (max-width: 480px) {
  .screen { padding: 16px; gap: 14px; }
  .fab { width: 60px; height: 60px; font-size: 1.5rem; }
  .map-preview { height: 132px; }
  .card-title { font-size: 1.45rem; }
}

/* ---- Bouton bascule de thème (clair / nuit) ---- */
.theme-toggle {
  position: fixed;
  top: 12px;
  right: 12px;
  /* Au-dessus des overlays (match/podium/chargement, ~1000-1300) : accessible partout. */
  z-index: 1400;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  background: var(--paper-card);
  color: var(--ink);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.theme-toggle:hover { border-color: var(--primary); }
/* Évite que le contenu de la topbar (lobby/swipe) passe sous le bouton flottant. */
.topbar { padding-right: 50px; }

/* ---- Carte d'invitation + QR code ---- */
.invite-panel { text-align: center; }
.invite-qr {
  width: 168px;
  max-width: 100%;
  margin: 4px auto 10px;
  padding: 10px;
  background: #fff; /* fond blanc : QR scannable même en mode nuit */
  border-radius: 14px;
  border: 1px solid var(--line);
  line-height: 0;
}
.invite-qr svg { width: 100%; height: auto; display: block; }
