@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  touch-action: manipulation;
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

html, body {
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: #070d1a;
  color: white;
  position: relative;
}

/* ===== ANIMATED BACKGROUND ===== */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 15% 5%, rgba(37,99,235,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 88% 8%, rgba(234,88,12,0.18) 0%, transparent 55%),
    radial-gradient(ellipse 55% 45% at 90% 85%, rgba(220,70,10,0.13) 0%, transparent 55%),
    radial-gradient(ellipse 50% 40% at 10% 88%, rgba(29,78,216,0.12) 0%, transparent 55%),
    radial-gradient(ellipse 90% 90% at 50% 50%, rgba(15,23,42,0.9) 0%, transparent 100%),
    linear-gradient(160deg, #05091a 0%, #080f22 30%, #0d1525 55%, #111b2e 75%, #1a0d08 100%);
}

/* Grid overlay */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.022) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: radial-gradient(ellipse 80% 80% at center, black 30%, transparent 100%);
  opacity: 0.5;
}

/* Floating orbs */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(80px);
  animation: orbFloat 18s ease-in-out infinite;
}

.bg-orb-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(37,99,235,0.12) 0%, transparent 70%);
  top: -100px; left: -100px;
  animation-duration: 22s;
}

.bg-orb-2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(234,88,12,0.10) 0%, transparent 70%);
  bottom: -80px; right: -80px;
  animation-duration: 18s;
  animation-delay: -9s;
}

.bg-orb-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(99,102,241,0.08) 0%, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation-duration: 26s;
  animation-delay: -13s;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, -30px) scale(1.05); }
  66% { transform: translate(-25px, 20px) scale(0.97); }
}

.hidden { display: none !important; }

/* ===== INTRO OVERLAY ===== */
.intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #040810;
  padding: 2vw;
}

.intro-scene {
  width: min(80vw, 100%);
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.9s ease, transform 0.9s ease, filter 0.9s ease;
}

.intro-hidden {
  opacity: 0;
  transform: scale(0.96);
  filter: blur(12px);
}

.logo-scene {
  background:
    radial-gradient(ellipse 70% 50% at 20% 10%, rgba(37,99,235,0.22) 0%, transparent 55%),
    radial-gradient(ellipse 60% 45% at 85% 15%, rgba(234,88,12,0.20) 0%, transparent 50%),
    linear-gradient(145deg, #060d1e 0%, #0a1428 40%, #111925 65%, #1a0d07 100%);
  border-radius: 2vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6vh 4vw 5vh;
  position: relative;
  overflow: hidden;
  min-height: 65vh;
  border: 1px solid rgba(255,255,255,0.07);
  box-shadow: 0 30px 70px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.06);
}

.g1 {
  position: absolute;
  top: -80px; left: 50%;
  transform: translateX(-50%);
  width: 560px; height: 320px;
  background: radial-gradient(ellipse, rgba(20,50,160,0.32) 0%, transparent 70%);
  pointer-events: none;
  animation: glowPulse 4s ease-in-out infinite;
}

.g2 {
  position: absolute;
  bottom: -60px; left: 30%;
  width: 320px; height: 220px;
  background: radial-gradient(ellipse, rgba(200,85,10,0.24) 0%, transparent 70%);
  pointer-events: none;
  animation: glowPulse 4s ease-in-out 2s infinite;
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.7; transform: scale(1) translateX(0); }
  50% { opacity: 1; transform: scale(1.06) translateX(10px); }
}

.dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(80,120,220,0.12) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  animation: dotsDrift 30s linear infinite;
}

@keyframes dotsDrift {
  0% { background-position: 0 0; }
  100% { background-position: 28px 28px; }
}

.logo-mark {
  position: relative;
  z-index: 10;
  margin-bottom: 2.5vh;
  animation: logoIn 0.8s cubic-bezier(0.22,1,0.36,1) 0.3s both;
}

@keyframes logoIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.wordmark {
  position: relative;
  z-index: 10;
  text-align: center;
  font-family: 'Syne', sans-serif;
  font-size: 4.5vw;
  font-weight: 800;
  letter-spacing: 0.5vw;
  line-height: 1;
  text-transform: uppercase;
  animation: wordmarkIn 0.8s cubic-bezier(0.22,1,0.36,1) 0.5s both;
}

@keyframes wordmarkIn {
  from { opacity: 0; transform: translateY(16px); letter-spacing: 1.2vw; }
  to { opacity: 1; transform: translateY(0); letter-spacing: 0.5vw; }
}

.word-under { color: #4f8cff; text-shadow: 0 0 30px rgba(79,140,255,0.4); }
.word-cover { color: #e07a20; text-shadow: 0 0 30px rgba(224,122,32,0.4); }

.sep {
  position: relative;
  z-index: 10;
  width: 16vw; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(79,140,255,0.8), rgba(224,122,32,0.8), transparent);
  margin: 2vh auto 0;
  animation: sepIn 0.6s ease 0.9s both;
}

@keyframes sepIn {
  from { opacity: 0; width: 0; }
  to { opacity: 1; width: 16vw; }
}

.tagline {
  position: relative;
  z-index: 10;
  margin-top: 18px;
  font-size: 11px;
  letter-spacing: 5px;
  color: rgba(255,255,255,0.30);
  text-transform: uppercase;
  font-family: 'DM Sans', sans-serif;
  animation: fadeIn 0.6s ease 1.1s both;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulse-ring {
  0% { r: 38; opacity: 0.6; }
  100% { r: 56; opacity: 0; }
}

.pulse { animation: pulse-ring 2.4s ease-out infinite; }
.pulse2 { animation: pulse-ring 2.4s ease-out 1.2s infinite; }

/* Intro scene max size on small screens */
@media (max-width: 600px) {
  .logo-scene {
    min-height: 420px;
    padding: 40px 24px 32px;
  }
  .wordmark {
    font-size: 38px;
    letter-spacing: 4px;
  }
  .logo-mark svg {
    width: 100px;
    height: 100px;
  }
}

@keyframes scan {
  0%, 100% { transform: translateY(-14px); opacity: 0.7; }
  50% { transform: translateY(14px); opacity: 1; }
}

.scan-line { animation: scan 2.8s ease-in-out infinite; }

/* ===== APP SHELL ===== */
.app-shell {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

/* ===== TOPBAR ===== */
.topbar {
  position: relative;
  z-index: 20;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 4vw;
  margin-bottom: 0.5vw;
  width: 100%;
  padding: 1vw 2vw 0;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-self: center;
}

.brand-logo-svg {
  width: clamp(28px, 3vw, 56px);
  height: clamp(28px, 3vw, 56px);
  flex-shrink: 0;
}

.brand-logo {
  margin: 0;
  font-family: 'Syne', sans-serif;
  font-size: clamp(18px, 2.2vw, 40px);
  font-weight: 800;
  letter-spacing: 0.25vw;
  line-height: 1;
  text-transform: uppercase;
}

.brand-under { color: #4f8cff; text-shadow: 0 0 20px rgba(79,140,255,0.35); }
.brand-cover { color: #e07a20; text-shadow: 0 0 20px rgba(224,122,32,0.35); }

.topbar-side {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
}

.topbar-left { justify-content: flex-start; }
.topbar-right { justify-content: flex-end; }

.top-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 12px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.09);
  box-shadow: 0 4px 16px rgba(0,0,0,0.20);
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.90);
  font-family: 'DM Sans', sans-serif;
  backdrop-filter: blur(8px);
}

/* ── Room code : bouton cliquable pour copier ── */
.top-room-clickable {
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  transform: none !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.20) !important;
  background: rgba(255,255,255,0.07) !important;
  border: 1px solid rgba(255,255,255,0.09) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  letter-spacing: 0.5px;
}

.top-room-clickable::after { display: none !important; }

.top-room-clickable:hover {
  background: rgba(79,140,255,0.18) !important;
  border-color: rgba(79,140,255,0.40) !important;
  box-shadow: 0 0 20px rgba(79,140,255,0.15) !important;
  filter: none !important;
}

.top-room-clickable:active { transform: scale(0.97) !important; }

@keyframes copyFlash {
  0%   { background: rgba(34,197,94,0.30) !important; border-color: rgba(34,197,94,0.60) !important; box-shadow: 0 0 22px rgba(34,197,94,0.25) !important; }
  100% { background: rgba(255,255,255,0.07) !important; border-color: rgba(255,255,255,0.09) !important; box-shadow: 0 4px 16px rgba(0,0,0,0.20) !important; }
}

.top-room-clickable.copy-flash { animation: copyFlash 0.9s ease forwards; }

.copy-icon { opacity: 0.55; flex-shrink: 0; transition: opacity 0.15s ease; }
.top-room-clickable:hover .copy-icon { opacity: 0.90; }

.status-banner {
  position: absolute;
  right: 0;
  top: 62px;
  background: rgba(37,99,235,0.95);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.30);
  animation: fadeSlide 0.25s ease;
  backdrop-filter: blur(8px);
}

.status-banner.important {
  background: rgba(22,163,74,0.96);
}

.page-center {
  flex: 1 1 auto;
  position: relative;
  z-index: 10;
  width: 100%;
  padding: 2vh 2vw 3vh;
}

/* ===== LANDING / ACCUEIL ===== */
.start-screen {
  width: 100%;
  display: block;
  padding: 2vh 0;
}

.landing-stack {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2vh;
}

/* Logo caché partout */
.landing-header {
  display: none !important;
}

/* Mobile tabs */
.mobile-tabs {
  order: 3;
}

.logo-free {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
  width: 100%;
}

.logo-free::before {
  content: "";
  position: absolute;
  width: 380px; height: 380px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(59,130,246,0.18) 0%, rgba(59,130,246,0.07) 32%, transparent 70%),
    radial-gradient(circle at 65% 62%, rgba(249,115,22,0.14) 0%, transparent 55%);
  filter: blur(20px);
  pointer-events: none;
  animation: haloBreath 6s ease-in-out infinite;
}

@keyframes haloBreath {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.08); opacity: 1; }
}

.logo-free svg {
  position: relative;
  z-index: 1;
  display: block;
  width: 210px; height: 210px;
  filter: drop-shadow(0 20px 32px rgba(0,0,0,0.30));
  animation: logoFloat 7s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Cards */
.landing-cards {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(12px, 1.5vw, 28px);
  align-items: stretch;
}

.login-card,
.rules-card {
  min-height: 72vh;
  background: rgba(15,22,42,0.85);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 1.4vw;
  padding: 2.5vh 2.2vw;
  box-shadow:
    0 20px 50px rgba(0,0,0,0.38),
    inset 0 1px 0 rgba(255,255,255,0.06),
    0 0 0 1px rgba(255,255,255,0.03);
  display: flex;
  flex-direction: column;
  justify-content: center;
  backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
  animation: cardIn 0.6s cubic-bezier(0.22,1,0.36,1) both;
}

.login-card { animation-delay: 0.1s; }
.rules-card { animation-delay: 0.2s; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-card::before {
  content: "";
  position: absolute;
  top: -60px; left: -60px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(37,99,235,0.14) 0%, transparent 70%);
  pointer-events: none;
}

.rules-card::before {
  content: "";
  position: absolute;
  bottom: -60px; right: -60px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(234,88,12,0.13) 0%, transparent 70%);
  pointer-events: none;
}

.start-content-full { width: 100%; }

.start-content h2,
.rules-card h3 {
  margin-top: 0;
  text-align: center;
  font-family: 'Syne', sans-serif;
}

.start-content h2 {
  margin-bottom: 0.5vw;
  font-size: 2.2vw;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.start-subtitle {
  margin: 0 0 1.4vw;
  text-align: center;
  font-size: 1.1vw;
  opacity: 0.70;
}

.rules-card h3 {
  margin-bottom: 1vw;
  color: #fdba74;
  font-size: 1.7vw;
  font-weight: 700;
}

.rules-card ul {
  margin: 0;
  padding-left: 1.2vw;
  display: grid;
  gap: 0.7vw;
  font-size: 1.05vw;
  line-height: 1.55;
  opacity: 0.88;
}

.rules-card li {
  padding-left: 4px;
}

.rules-card li::marker {
  color: rgba(224,122,32,0.7);
}

.form-block { margin-bottom: 1.1vw; }

.form-block label {
  display: block;
  margin-bottom: 0.5vw;
  font-size: 1vw;
  opacity: 0.85;
  font-weight: 500;
}

.separator {
  text-align: center;
  margin: 1vw 0;
  opacity: 0.55;
  font-size: 1vw;
  position: relative;
}

.separator::before,
.separator::after {
  content: "";
  position: absolute;
  top: 50%;
  width: calc(50% - 24px);
  height: 1px;
  background: rgba(255,255,255,0.12);
}

.separator::before { left: 0; }
.separator::after { right: 0; }

.join-row {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 12px;
}

.mobile-tabs {
  display: none;
  width: 100%;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
  order: 3;
}

.mobile-tab-btn {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.11);
  color: rgba(255,255,255,0.60);
  padding: 10px 22px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.22s ease;
  font-family: 'DM Sans', sans-serif;
}

.mobile-tab-btn.active {
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  border-color: rgba(255,255,255,0.22);
  color: white;
  box-shadow: 0 4px 14px rgba(59,130,246,0.35);
}

.mobile-tab-btn:hover:not(.active) {
  background: rgba(255,255,255,0.11);
  color: rgba(255,255,255,0.85);
}

/* ===== MOBILE GAME TABS ===== */
.mobile-game-tabs {
  display: none;
  flex-shrink: 0;
  flex-direction: row;
  gap: 6px;
  padding: 6px 8px;
  background: rgba(5,9,20,0.80);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  overflow-x: auto;
  scrollbar-width: none;
}

.mobile-game-tabs::-webkit-scrollbar { display: none; }

.mobile-game-tab {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: none;
}

.mobile-game-tab::after { display: none; }

.mobile-game-tab.active {
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  border-color: rgba(255,255,255,0.20);
  color: white;
  box-shadow: 0 3px 10px rgba(59,130,246,0.30);
}

.mobile-game-tab:hover:not(.active) {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.85);
  filter: none;
  transform: none;
}

/* Onglet Vote : style alerte orange pulsant */
.mobile-game-tab.vote-tab {
  background: linear-gradient(180deg, rgba(249,115,22,0.22), rgba(194,65,12,0.18));
  border-color: rgba(249,115,22,0.42);
  color: #fdba74;
  animation: voteTabPulse 2s ease-in-out infinite;
}

.mobile-game-tab.vote-tab.active {
  background: linear-gradient(180deg, #f97316, #ea580c);
  border-color: rgba(255,255,255,0.22);
  color: white;
  box-shadow: 0 3px 16px rgba(249,115,22,0.45);
  animation: none;
}

@keyframes voteTabPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(249,115,22,0); }
  50% { box-shadow: 0 0 14px rgba(249,115,22,0.38); }
}

/* ===== SLIDERS ===== */
.duration-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.15);
  outline: none;
  padding: 0;
  margin: 10px 0;
  cursor: pointer;
  display: block;
  vertical-align: middle;
  box-sizing: border-box;
}

.duration-slider::-webkit-slider-container {
  height: 6px;
}

.duration-slider::-webkit-slider-runnable-track {
  -webkit-appearance: none;
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.15);
}

.duration-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(37,99,235,0.50);
  border: 2px solid rgba(255,255,255,0.25);
  margin-top: -9px;
}

.duration-slider::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.15);
  border: none;
}

.duration-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(37,99,235,0.50);
  border: 2px solid rgba(255,255,255,0.25);
}

.duration-slider::-ms-track {
  height: 6px;
  border-radius: 999px;
  background: transparent;
  border-color: transparent;
  color: transparent;
}

.duration-slider::-ms-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(180deg, #3b82f6, #2563eb);
}

/* ===== GAME LAYOUT ===== */
.game-layout {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 22vw 1fr;
  gap: 1.4vw;
  margin: 0 auto;
}

.panel { min-height: 0; }

.panel-left {
  display: flex;
  flex-direction: column;
  gap: 1vh;
  min-height: 0;
}

.panel-center { min-height: 0; }

/* ===== CARDS ===== */
.card {
  background: rgba(12,18,38,0.88);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 1.4vw;
  padding: 1.4vh 1.4vw;
  box-shadow:
    0 12px 28px rgba(0,0,0,0.28),
    inset 0 1px 0 rgba(255,255,255,0.05);
  animation: fadeUp 0.28s cubic-bezier(0.22,1,0.36,1);
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  pointer-events: none;
}

.compact-card h2 {
  margin-top: 0;
  margin-bottom: 14px;
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: 0.70;
}

.compact-card label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.compact-card label span {
  color: #4f8cff;
  font-weight: 700;
  min-width: 32px;
}

.room-card {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-top: 1.5vh;
  overflow: hidden;
}

.room-actions-bottom {
  margin-top: 1vh;
  display: flex;
  gap: 0.6vw;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.room-content {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 16px;
  overflow: hidden;
}

/* ===== VOTE CARD — STYLE DISTINCTIF URGENT ===== */
.vote-card-active {
  background:
    radial-gradient(ellipse 90% 55% at 50% 0%, rgba(249,115,22,0.24) 0%, transparent 65%),
    radial-gradient(ellipse 70% 40% at 50% 100%, rgba(194,65,12,0.16) 0%, transparent 60%),
    rgba(10,5,1,0.93) !important;
  border: 1px solid rgba(249,115,22,0.50) !important;
  box-shadow:
    0 0 0 1px rgba(249,115,22,0.14),
    0 12px 36px rgba(194,65,12,0.24),
    inset 0 1px 0 rgba(249,115,22,0.20) !important;
  animation: voteCardIn 0.35s cubic-bezier(0.22,1,0.36,1) both !important;
}

@keyframes voteCardIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Barre lumineuse animée en haut */
.vote-card-active::before {
  content: "" !important;
  position: absolute !important;
  top: 0; left: 0; right: 0 !important;
  height: 2px !important;
  background: linear-gradient(90deg, transparent, #f97316, #fbbf24, #f97316, transparent) !important;
  background-size: 200% 100% !important;
  animation: voteBarSweep 2.2s linear infinite !important;
  pointer-events: none !important;
}

@keyframes voteBarSweep {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Header avec dot pulsant */
.vote-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.vote-card-header h2 {
  margin: 0 !important;
  color: #fdba74 !important;
  text-shadow: 0 0 20px rgba(249,115,22,0.40);
  opacity: 1 !important;
  font-size: 15px !important;
}

.vote-pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f97316;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(249,115,22,0.60);
  animation: dotBlink 1.2s ease-in-out infinite;
}

@keyframes dotBlink {
  0%, 100% { opacity: 1; box-shadow: 0 0 10px rgba(249,115,22,0.60); }
  50%       { opacity: 0.30; box-shadow: 0 0 4px rgba(249,115,22,0.18); }
}

/* Players box */
.players-box,
.chat-box,
.end-box,
.waiting-box {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.players-box {
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 18px;
  padding: 14px;
  overflow: hidden;
}

.players-box h3 {
  margin: 0 0 12px;
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  opacity: 0.60;
}

.players-box ul {
  list-style: none;
  margin: 0; padding: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.players-box li {
  padding: 11px 14px;
  border-radius: 13px;
  background: rgba(8,14,30,0.65);
  border: 1px solid rgba(255,255,255,0.05);
  font-size: 14px;
  line-height: 1.35;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.players-box li.player-current {
  border: 1px solid rgba(249,115,22,0.50);
  background: linear-gradient(135deg, rgba(249,115,22,0.12), rgba(37,99,235,0.10));
  box-shadow: 0 0 20px rgba(249,115,22,0.08);
}

.players-box li .player-name {
  display: block;
  font-weight: 600;
}

.players-box li .player-sub {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  opacity: 0.65;
  font-weight: 500;
}

/* Chat + sub areas */
.chat-box,
.end-box,
.waiting-box {
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 18px;
  padding: 14px;
  overflow: hidden;
}

/* Waiting */
.waiting-box {
  justify-content: flex-start;
  background:
    radial-gradient(ellipse 80% 40% at 50% 0%, rgba(96,165,250,0.12) 0%, transparent 70%),
    rgba(8,14,30,0.92);
  border: 1px solid rgba(96,165,250,0.20);
}

.waiting-title {
  font-family: 'Syne', sans-serif;
  font-size: 26px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 3px;
  background: linear-gradient(135deg, #60a5fa, #93c5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.waiting-box p {
  text-align: center;
  font-size: 16px;
  margin-bottom: 18px;
  opacity: 0.75;
}

.waiting-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 10px;
}

.waiting-meta-item {
  padding: 13px 14px;
  border-radius: 14px;
  background: rgba(8,14,30,0.60);
  border: 1px solid rgba(255,255,255,0.06);
  text-align: center;
  transition: border-color 0.2s;
}

.waiting-meta-item:hover {
  border-color: rgba(96,165,250,0.25);
}

.waiting-meta-label {
  display: block;
  font-size: 11px;
  opacity: 0.60;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

/* End game */
.end-box {
  justify-content: center;
  background:
    radial-gradient(ellipse 70% 40% at 50% 100%, rgba(249,115,22,0.16) 0%, transparent 65%),
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(37,99,235,0.16) 0%, transparent 65%),
    rgba(8,14,30,0.92);
  border: 1px solid rgba(249,115,22,0.22);
}

.end-box h2 {
  font-family: 'Syne', sans-serif;
  font-size: 28px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 10px;
}

.end-box p {
  text-align: center;
  font-size: 16px;
  margin-bottom: 16px;
  opacity: 0.80;
}

.end-box ul {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  gap: 8px;
  overflow: auto;
}

/* Reveal items */
.reveal-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(8,14,30,0.65);
  border: 1px solid rgba(255,255,255,0.06);
  animation: revealIn 0.4s cubic-bezier(0.22,1,0.36,1) both;
}

@keyframes revealIn {
  from { opacity: 0; transform: translateX(-16px); }
  to { opacity: 1; transform: translateX(0); }
}

.reveal-role-badge {
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.reveal-role-badge.civil {
  background: rgba(96,165,250,0.18);
  color: #93c5fd;
  border: 1px solid rgba(96,165,250,0.25);
}

.reveal-role-badge.undercover {
  background: rgba(251,146,60,0.18);
  color: #fdba74;
  border: 1px solid rgba(251,146,60,0.25);
}

.reveal-role-badge.mrwhite {
  background: rgba(248,250,252,0.12);
  color: #f1f5f9;
  border: 1px solid rgba(248,250,252,0.20);
}

.reveal-main-text {
  font-size: 14px;
  font-weight: 500;
  opacity: 0.92;
}

/* Role dolls */
.role-dolls-wrap {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(8,14,30,0.55);
  border: 1px solid rgba(255,255,255,0.05);
}

.role-dolls-title {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.60;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.role-dolls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.role-doll {
  width: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  animation: dollIn 0.3s ease both;
}

@keyframes dollIn {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}

.role-doll-head {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}

.role-doll-body {
  width: 18px; height: 14px;
  border-radius: 9px 9px 6px 6px;
  background: currentColor;
  box-shadow: 0 0 12px rgba(255,255,255,0.06) inset;
}

.role-doll.civil { color: #60a5fa; }
.role-doll.undercover { color: #fb923c; }
.role-doll.mrwhite { color: #f8fafc; }

/* Messages */
.messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  background: rgba(5,10,24,0.85);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid rgba(255,255,255,0.04);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.10) transparent;
}

.message {
  padding: 9px 10px;
  border-radius: 10px;
  margin-bottom: 4px;
  font-size: 14px;
  line-height: 1.45;
  animation: msgIn 0.22s ease;
  transition: background 0.15s ease;
}

.message:hover {
  background: rgba(255,255,255,0.025);
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-name {
  display: inline-block;
  font-weight: 700;
  color: #93c5fd;
  margin-right: 8px;
  font-size: 13px;
}

.message-text { color: rgba(255,255,255,0.92); }

.message.system .message-name { color: #fdba74; }
.message.system .message-text { color: rgba(255,255,255,0.80); }

.chat-top-infos { margin-bottom: 10px; }

.phase-line, .speaker-line { margin: 0 0 5px; }

.phase-line {
  font-size: 14px;
  font-weight: 700;
  opacity: 0.90;
  font-family: 'Syne', sans-serif;
  letter-spacing: 0.5px;
}

.speaker-line {
  font-size: 14px;
  color: #fdba74;
  font-weight: 600;
  min-height: 20px;
}

/* ===== FORM ELEMENTS ===== */
input, button, select {
  border: none;
  border-radius: 0.9vw;
  padding: 0.9vh 1vw;
  font-size: 1vw;
  font-family: 'DM Sans', sans-serif;
}

input, select {
  width: 100%;
  background: rgba(255,255,255,0.90);
  color: #111827;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus {
  outline: none;
  background: rgba(255,255,255,0.96);
  box-shadow: 0 0 0 2px rgba(79,140,255,0.45);
}

input:disabled, select:disabled {
  background: rgba(148,163,184,0.22);
  color: rgba(255,255,255,0.55);
  cursor: not-allowed;
}

button {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.15s ease, filter 0.15s ease;
  box-shadow: 0 5px 0 rgba(0,0,0,0.28), 0 8px 16px rgba(37,99,235,0.25);
  font-weight: 600;
  position: relative;
  overflow: hidden;
}

button::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.12) 0%, transparent 60%);
  pointer-events: none;
  border-radius: inherit;
}

button:hover { filter: brightness(1.10); }

button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 rgba(0,0,0,0.28), 0 2px 8px rgba(37,99,235,0.20);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.big-btn {
  width: 100%;
  min-height: 52px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.leave-btn {
  background: linear-gradient(180deg, #4b5563, #374151);
  box-shadow: 0 5px 0 rgba(0,0,0,0.28), 0 8px 16px rgba(0,0,0,0.20);
}

.topbar-leave-btn {
  width: auto;
  min-height: 38px;
  padding: 9px 14px;
  border-radius: 12px;
  font-size: 13px;
  box-shadow: 0 4px 0 rgba(0,0,0,0.22);
}

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

.player-dead {
  opacity: 0.45;
  text-decoration: line-through;
}

/* Vote buttons — thème orange dans la carte vote */
.vote-btn {
  display: block;
  width: 100%;
  text-align: left;
  margin-bottom: 8px;
  background: rgba(30,10,2,0.80);
  border: 1px solid rgba(249,115,22,0.20);
  color: rgba(255,255,255,0.88);
  box-shadow: none;
  transition: all 0.18s ease;
  font-size: 14px;
  font-weight: 500;
}

.vote-btn:hover:not(:disabled) {
  background: rgba(249,115,22,0.18);
  border-color: rgba(249,115,22,0.50);
  filter: none;
  transform: none;
  box-shadow: 0 2px 14px rgba(249,115,22,0.14);
}

.vote-btn::after { display: none; }

.vote-btn-selected {
  outline: none !important;
  background: linear-gradient(135deg, rgba(249,115,22,0.32), rgba(194,65,12,0.26)) !important;
  border-color: rgba(249,115,22,0.72) !important;
  color: white !important;
  box-shadow: 0 0 20px rgba(249,115,22,0.18) !important;
}

.vote-confirm-wrap { margin-top: 10px; }
.vote-confirm-wrap p { margin: 0 0 8px; font-size: 13px; opacity: 0.80; }

#confirmVoteBtn {
  width: 100%;
  background: linear-gradient(180deg, #f97316, #ea580c) !important;
  box-shadow: 0 5px 0 rgba(0,0,0,0.28), 0 8px 22px rgba(249,115,22,0.32) !important;
}
#confirmVoteBtn:hover:not(:disabled) { filter: brightness(1.10); }
#confirmVoteBtn::after { background: linear-gradient(180deg, rgba(255,255,255,0.14) 0%, transparent 60%); }

/* ===== TIMER ===== */
.timer-wrap {
  flex: 0 0 auto;
  margin-bottom: 16px;
}

.timer-header-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.timer-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  opacity: 0.60;
  font-family: 'Syne', sans-serif;
}

.timer-bar {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  overflow: hidden;
}

.timer-fill {
  height: 100%;
  width: 100%;
  background: #22c55e;
  transition: width 0.15s linear, background 0.4s ease;
  border-radius: 999px;
  box-shadow: 0 0 16px rgba(34,197,94,0.30);
  position: relative;
}

.timer-fill::after {
  content: "";
  position: absolute;
  right: -1px; top: -1px; bottom: -1px;
  width: 6px;
  border-radius: 50%;
  background: inherit;
  box-shadow: 0 0 8px currentColor;
  filter: brightness(1.5);
}

.timer-text {
  font-size: 14px;
  font-weight: 700;
  min-width: 40px;
  text-align: right;
  font-family: 'Syne', sans-serif;
}

/* ===== SECRET CARD ===== */
#secretCard {
  background:
    radial-gradient(ellipse 80% 50% at 50% 100%, rgba(249,115,22,0.14) 0%, transparent 65%),
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(37,99,235,0.18) 0%, transparent 65%),
    rgba(12,18,38,0.90);
  border: 1px solid rgba(96,165,250,0.28);
}

#wordText {
  margin: 8px 0 0;
  font-family: 'Syne', sans-serif;
  font-size: 1.6vw;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.5px;
  color: #ffffff;
  text-align: center;
  padding: 1vh 1vw;
  border-radius: 1vw;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  text-shadow: 0 0 30px rgba(255,255,255,0.15);
  animation: wordReveal 0.5s cubic-bezier(0.22,1,0.36,1);
}

@keyframes wordReveal {
  from { opacity: 0; transform: scale(0.85); letter-spacing: 8px; }
  to { opacity: 1; transform: scale(1); letter-spacing: 0.5px; }
}

#chatHelp, #compositionHelp, #compositionSummary {
  font-size: 13px;
  opacity: 0.65;
}

#compositionSummary {
  color: #fdba74;
  font-weight: 600;
  opacity: 1;
}

/* ===== DECORATIVE SEPARATOR LINES ===== */
.deco-line {
  position: absolute;
  pointer-events: none;
  opacity: 0.06;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== SCROLLBARS ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
  border-radius: 999px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
  .landing-cards {
    grid-template-columns: 1fr;
    width: min(680px, 100%);
  }

  .login-card, .rules-card { min-height: auto; }

  .game-layout { grid-template-columns: 1fr; }
  .panel-left { order: 2; }
  .panel-center { order: 1; }
}

@media (max-width: 820px) {
  html, body { height: 100dvh; }
  body { overflow: hidden; }

  .app-shell {
    min-height: 100dvh;
    height: 100dvh;
    overflow: hidden;
  }

  /* ── Topbar mobile ── */
  .topbar {
    grid-template-columns: 1fr;
    gap: 4px;
    min-height: 64px;
    padding: 10px 16px 0;
    margin-bottom: 0;
    background: rgba(5,9,20,0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }

  .brand-logo {
    font-size: 20px;
    letter-spacing: 3px;
    text-align: center;
  }

  .brand-logo-svg {
    width: 28px;
    height: 28px;
  }

  .landing-header {
    display: none !important;
  }

  .topbar-left, .topbar-right { justify-content: center; }

  .top-meta { padding: 6px 11px; font-size: 12px; }

  .status-banner {
    position: static;
    justify-self: center;
    max-width: calc(100vw - 24px);
    text-align: center;
    font-size: 13px;
  }

  /* ── Page center mobile ── */
  .page-center {
    padding: 0;
    height: calc(100dvh - 64px);
    overflow: hidden;
    align-items: stretch;
  }

  /* ── Landing mobile ── */
  .start-screen {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    align-items: flex-start;
    -webkit-overflow-scrolling: touch;
  }

  .landing-stack {
    width: 100%;
    max-width: 100%;
    margin: 0;
    gap: 0;
    padding: 0;
    flex-direction: column;
    align-items: stretch;
  }

  .landing-header {
    order: 1;
    padding: 24px 20px 16px;
    background: rgba(5,9,20,0.60);
    border-bottom: 1px solid rgba(255,255,255,0.05);
  }

  .logo-free {
    min-height: 80px;
    width: auto;
  }

  .logo-free svg { width: 80px; height: 80px; }

  .logo-free::before {
    width: 130px; height: 130px;
    filter: blur(12px);
  }

  /* Tabs de navigation */
  .mobile-tabs {
    order: 2;
    display: flex;
    width: 100%;
    gap: 0;
    margin: 0;
    padding: 10px 16px;
    background: rgba(5,9,20,0.80);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    backdrop-filter: blur(12px);
  }

  .mobile-tab-btn {
    flex: 1;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
  }

  .mobile-tab-btn.active {
    box-shadow: 0 3px 12px rgba(59,130,246,0.30);
  }

  /* Cards — pleine largeur */
  .landing-cards {
    order: 3;
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100%;
    gap: 0;
    margin: 0;
  }

  #rulesCard { display: none; }
  #rulesCard.active { display: flex; }
  #roomSetupCard.hidden-tab { display: none; }

  .login-card, .rules-card {
    width: 100%;
    min-height: auto;
    max-height: none;
    padding: 24px 20px 32px;
    border-radius: 0;
    border: none;
    border-top: 1px solid rgba(255,255,255,0.05);
    background: rgba(10,16,34,0.95);
    box-shadow: none;
    overflow: visible;
  }

  .login-card::before, .rules-card::before { display: none; }

  .start-content h2 {
    font-size: 26px;
    margin-bottom: 6px;
    text-align: left;
  }

  .start-subtitle {
    font-size: 14px;
    margin-bottom: 20px;
    text-align: left;
    opacity: 0.65;
  }

  .rules-card h3 {
    font-size: 22px;
    margin-bottom: 14px;
    text-align: left;
  }

  .rules-card ul {
    gap: 10px;
    font-size: 14px;
    line-height: 1.5;
  }

  .form-block { margin-bottom: 14px; }
  .form-block label { margin-bottom: 7px; font-size: 14px; }

  input:not([type="range"]), select {
    padding: 14px 15px;
    font-size: 16px;
    border-radius: 14px;
  }

  input[type="range"] {
    padding: 0;
    background: transparent;
    border-radius: 0;
    height: auto;
  }

  button { padding: 14px 16px; font-size: 15px; border-radius: 14px; }

  .big-btn {
    min-height: 52px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 16px;
  }

  .separator { margin: 16px 0; font-size: 14px; }

  .join-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* ── Game mobile ── */
  .mobile-game-tabs { display: flex; }

  .game-layout {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    overflow: hidden;
  }

  .panel-left {
    order: 1;
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .panel-left::-webkit-scrollbar { display: none; }

  .panel-left .card {
    min-width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    flex: 0 0 auto;
    padding: 14px;
    border-radius: 16px;
    overflow-y: auto;
    max-height: 45vh;
    -webkit-overflow-scrolling: touch;
  }

  .panel-center {
    order: 2;
    flex: 1 1 auto;
    min-height: 0;
    padding: 0 8px 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .room-card {
    flex: 1 1 auto;
    min-height: 0;
    padding: 10px;
    border-radius: 18px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .timer-wrap { margin-bottom: 6px; flex-shrink: 0; }
  .timer-bar { height: 4px; }
  .timer-label, .timer-text { font-size: 11px; }

  .room-content {
    grid-template-columns: 1fr;
    gap: 6px;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .players-box,
  .chat-box,
  .end-box,
  .waiting-box {
    border-radius: 12px;
    padding: 10px;
  }

  .players-box {
    flex: 0 0 auto;
    max-height: 120px;
    overflow-y: auto;
  }

  .players-box h3 { margin-bottom: 6px; font-size: 11px; }
  .players-box ul { gap: 5px; }
  .players-box li { padding: 6px 8px; font-size: 12px; }
  .players-box li .player-sub { font-size: 11px; }

  .chat-box, .waiting-box, .end-box {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .messages {
    flex: 1 1 auto;
    min-height: 80px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .messages { padding: 8px; margin-bottom: 6px; }
  .message { padding: 6px 6px; font-size: 13px; }

  .chat-top-infos { margin-bottom: 6px; }
  .phase-line, .speaker-line { font-size: 13px; margin-bottom: 2px; }

  .role-dolls-wrap { margin-bottom: 7px; padding: 8px 9px; border-radius: 11px; }
  .role-dolls-title { font-size: 10px; margin-bottom: 6px; }
  .role-dolls { gap: 6px; }
  .role-doll { width: 22px; }
  .role-doll-head { width: 9px; height: 9px; }
  .role-doll-body { width: 14px; height: 11px; }

  .row { gap: 6px; }
  #chatInput { min-width: 0; font-size: 16px; }
  #sendChatBtn { white-space: nowrap; padding-left: 12px; padding-right: 12px; font-size: 14px; }

  #chatHelp, #compositionHelp, #compositionSummary, .vote-confirm-wrap p { font-size: 11px; }

  .waiting-title, .end-box h2 { font-size: 20px; }
  .waiting-box p, .end-box p { font-size: 14px; margin-bottom: 8px; }

  .waiting-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .waiting-meta-item { padding: 8px 9px; }
  .waiting-meta-label { font-size: 10px; }

  #wordText { font-size: 24px; padding: 13px 10px; border-radius: 12px; }

  .room-actions-bottom { margin-top: 7px; justify-content: stretch; }
  .room-actions-bottom button { flex: 1 1 0; min-height: 44px; font-size: 14px; }

  .card { border-radius: 16px; }
}

/* ===== MOBILE PANELS ===== */
/* Panels mobiles cachés par défaut partout */
.mobile-panel {
  display: none;
}

@media (max-width: 820px) {
  /* Sur mobile : display block par défaut, JS met display:none pour cacher */
  .mobile-panel {
    display: block;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Caché explicitement */
  .mobile-panel[style*="display: none"],
  .mobile-panel[style*="display:none"] {
    display: none !important;
  }

  .mobile-panel.hidden {
    display: none !important;
  }

  /* Le panel-left en mode mobile = plein écran au dessus */
  .panel-left {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
    padding: 8px !important;
    display: flex !important;
    flex-direction: column !important;
  }

  /* Les cards desktop sont cachées sur mobile */
  .desktop-only-cards {
    display: none !important;
  }

  /* Le panel-center est caché sur mobile quand on est en jeu */
  .game-started .panel-center {
    display: none !important;
  }
}

/* Liste joueurs dans l'onglet Composition mobile */
.players-list-mobile {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.players-list-mobile-item {
  padding: 9px 12px;
  border-radius: 11px;
  background: rgba(8,14,30,0.65);
  border: 1px solid rgba(255,255,255,0.05);
  font-size: 13px;
  font-weight: 500;
}

.players-list-mobile-item.player-current {
  border-color: rgba(249,115,22,0.50);
  background: linear-gradient(135deg, rgba(249,115,22,0.12), rgba(37,99,235,0.10));
}

.players-list-mobile-item.player-dead {
  opacity: 0.40;
  text-decoration: line-through;
}

/* Carte "pas encore le moment de voter" */
.vote-not-ready-card {
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(249,115,22,0.10) 0%, transparent 65%),
    rgba(10,6,2,0.90) !important;
  border: 1px solid rgba(249,115,22,0.22) !important;
  box-shadow: none !important;
}

.vote-not-ready-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  text-align: center;
  gap: 10px;
}

.vote-not-ready-icon {
  font-size: 36px;
  opacity: 0.50;
  margin-bottom: 4px;
}

.vote-not-ready-title {
  margin: 0;
  font-family: 'Syne', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: #fdba74;
  opacity: 0.80;
}

.vote-not-ready-sub {
  margin: 0;
  font-size: 13px;
  opacity: 0.55;
  line-height: 1.5;
  max-width: 280px;
}

/* Onglet Vote en phase active : style orange pulsant renforcé */
.mobile-game-tab.vote-tab.vote-tab-active-phase {
  background: linear-gradient(180deg, #f97316, #ea580c) !important;
  border-color: rgba(255,255,255,0.22) !important;
  color: white !important;
  box-shadow: 0 3px 16px rgba(249,115,22,0.45) !important;
  animation: none !important;
}


/* ===== MOBILE HIDDEN PANEL ===== */
@media (max-width: 820px) {
  .mobile-hidden-panel {
    display: none !important;
  }

  /* Sur mobile, les cards du panel-left prennent toute la hauteur disponible */
  .panel-left .card:not(.mobile-hidden-panel) {
    min-width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
  }
}

/* ===== NOISE GRAIN OVERLAY ===== */
.grain-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 128px 128px;
}
/* ===== CORRECTIONS MOBILES À AJOUTER À LA FIN DE style.css ===== */

@media (max-width: 820px) {
  /* Panel gauche = plein écran, panel centre = caché */
  .panel-left {
    order: 1;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    padding: 8px !important;
    gap: 0 !important;
  }

  .panel-center { display: none !important; }

  /* Cards : plein écran, cachées sauf celle active */
  .panel-left .card {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 16px;
    padding: 14px;
  }

  .mobile-hidden-panel { display: none !important; }

  /* Mot secret mobile */
  #wordText { font-size: 28px !important; padding: 20px !important; }
}
/* =====================================================
   AJOUTS MOBILES — à coller à la toute fin de style.css
   ===================================================== */

/* ── Bouton Reprendre dans la topbar ── */
#topResumeBtn {
  background: linear-gradient(180deg, #22c55e, #16a34a);
  box-shadow: 0 4px 0 rgba(0,0,0,0.22), 0 6px 14px rgba(34,197,94,0.28);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  border-radius: 12px;
  padding: 9px 14px;
  min-height: 38px;
  width: auto;
}

#topResumeBtn:hover {
  filter: brightness(1.10);
}

/* ── Bouton Lancer dans les cards mobiles ── */
#startBtnMobile,
#startBtnConfig {
  background: linear-gradient(180deg, #22c55e, #16a34a);
  box-shadow: 0 5px 0 rgba(0,0,0,0.28), 0 8px 18px rgba(34,197,94,0.28);
}

#startBtnMobile:hover:not(:disabled),
#startBtnConfig:hover:not(:disabled) {
  filter: brightness(1.10);
}

/* ── Card Joueurs + Compo pendant la partie (mobile) ── */
#playersCompoCard h2 {
  margin-top: 0;
  margin-bottom: 12px;
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: 0.70;
}

/* ── Card Joueurs en attente / lobby hôte (mobile) ── */
#waitingPlayersTab h2 {
  margin-top: 0;
  margin-bottom: 12px;
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: 0.70;
}

/* ── voteNotReadyCard : cacher inner quand "pas encore" ── */
@media (max-width: 820px) {
  /* S'assurer que les nouvelles cards suivent le même style que les autres panels mobiles */
  #playersCompoCard,
  #waitingPlayersTab {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Le bouton topbar reprendre reste compact sur mobile */
  #topResumeBtn {
    font-size: 12px;
    padding: 7px 11px;
    min-height: 34px;
  }

  /* Forcer voteCardInner visible par défaut, JS gère l'état */
  #voteCardInner {
    display: block;
  }
}
/* =====================================================
   AJOUTS MOBILES — coller à la toute fin de style.css
   ===================================================== */

/* ── Zone de contenu mobile ── */
.mobile-area {
  display: none;
  width: 100%;
  box-sizing: border-box;
}

/* ── Sur mobile : cacher le desktop-game-layout, montrer mobile ── */
@media (max-width: 820px) {
  /* Cacher complètement le layout desktop */
  .desktop-game-layout {
    display: none !important;
  }

  /* Afficher la barre d'onglets et la zone mobile */
  #mobileTabBar {
    flex-shrink: 0;
  }

  .mobile-area {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 12px 20px;
    box-sizing: border-box;
  }

  /* page-center en flex colonne pour que mobile-area prenne l'espace restant */
  .page-center {
    display: flex;
    flex-direction: column;
    padding: 0 !important;
    height: calc(100dvh - 64px);
    overflow: hidden;
  }

  /* start-screen garde son scroll */
  .start-screen {
    flex: 1 1 auto;
    overflow-y: auto;
  }

  /* mobileTabBar positionné dans le flux */
  #mobileTabBar {
    display: none; /* JS passe à flex quand nécessaire */
    flex-direction: row;
    gap: 6px;
    padding: 6px 8px;
    background: rgba(5,9,20,0.90);
    border-bottom: 1px solid rgba(255,255,255,0.07);
    overflow-x: auto;
    scrollbar-width: none;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  #mobileTabBar::-webkit-scrollbar { display: none; }

  /* Panels mobiles dans mobileArea */
  #mobileArea > div {
    width: 100%;
    box-sizing: border-box;
  }

  /* Chat mobile : hauteur fixe pour que les messages scrollent */
  .mob-panel-chat {
    display: flex !important;
    flex-direction: column;
    height: calc(100dvh - 64px - 50px - 20px); /* viewport - topbar - tabs - padding */
    max-height: 100%;
  }

  .mob-panel-chat .messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Mot mobile : centré verticalement */
  .mob-panel-word {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100dvh - 64px - 50px - 40px);
  }
}

/* ── Sur desktop : s'assurer que mobileTabBar et mobileArea restent cachés ── */
@media (min-width: 821px) {
  #mobileTabBar { display: none !important; }
  .mobile-area  { display: none !important; }
  .desktop-game-layout { display: grid !important; }
}
/* =====================================================
   AJOUTS MOBILES — coller à la toute fin de style.css
   ===================================================== */

/* ── Zone de contenu mobile ── */
.mobile-area {
  display: none;
  width: 100%;
  box-sizing: border-box;
}

/* ── Sur mobile : cacher le desktop-game-layout, montrer mobile ── */
@media (max-width: 820px) {
  /* Cacher complètement le layout desktop */
  .desktop-game-layout {
    display: none !important;
  }

  /* Afficher la barre d'onglets et la zone mobile */
  #mobileTabBar {
    flex-shrink: 0;
  }

  .mobile-area {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 12px calc(24px + env(safe-area-inset-bottom, 16px));
    box-sizing: border-box;
  }

  /* page-center en flex colonne pour que mobile-area prenne l'espace restant */
  .page-center {
    display: flex;
    flex-direction: column;
    padding: 0 !important;
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    height: calc(100dvh - 64px);
    overflow: hidden;
  }

  /* start-screen garde son scroll */
  .start-screen {
    flex: 1 1 auto;
    overflow-y: auto;
  }

  /* mobileTabBar positionné dans le flux */
  #mobileTabBar {
    display: none; /* JS passe à flex quand nécessaire */
    flex-direction: row;
    gap: 6px;
    padding: 6px 8px;
    background: rgba(5,9,20,0.90);
    border-bottom: 1px solid rgba(255,255,255,0.07);
    overflow-x: auto;
    scrollbar-width: none;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  #mobileTabBar::-webkit-scrollbar { display: none; }

  /* Panels mobiles dans mobileArea */
  #mobileArea > div {
    width: 100%;
    box-sizing: border-box;
  }

  /* Chat mobile : hauteur fixe pour que les messages scrollent */
  .mob-panel-chat {
    display: flex !important;
    flex-direction: column;
    height: calc(100dvh - 64px - 50px - 20px); /* viewport - topbar - tabs - padding */
    max-height: 100%;
  }

  .mob-panel-chat .messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Mot mobile : centré verticalement */
  .mob-panel-word {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100dvh - 64px - 50px - 40px);
  }
}

/* ── Sur desktop : s'assurer que mobileTabBar et mobileArea restent cachés ── */
@media (min-width: 821px) {
  #mobileTabBar { display: none !important; }
  .mobile-area  { display: none !important; }
  .desktop-game-layout { display: grid !important; }
}

/* ── Réduction hauteur globale pour rester au-dessus de la barre des tâches ── */
@media (min-width: 821px) {
  .app-shell {
    max-height: calc(100vh - 40px);
  }
  .panel-left {
    max-height: calc(100vh - 120px);
  }
}