/* Drawbuddy.io — direction artistique cartoon / neo-brutalism doux */
:root {
  --blue-1: #2C5282;
  --blue-2: #3B82F6;
  --navy: #1E3A8A;
  --white: #FFFFFF;
  --green: #4ADE80;
  --green-d: #16A34A;
  --yellow: #FACC15;
  --yellow-d: #CA8A04;
  --red: #F87171;
  --red-d: #DC2626;
  --ink: #0F172A;
  --muted: #475569;
  --radius: 16px;
  --shadow: 0 6px 0 var(--navy);
  --shadow-sm: 0 4px 0 var(--navy);
  --font-title: "Fredoka", "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-body);
  font-weight: 800;
  color: var(--ink);
  background: linear-gradient(160deg, var(--blue-1) 0%, var(--blue-2) 100%) fixed;
  background-color: var(--blue-1);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
.bg-doodles {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .14;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220' fill='none' stroke='%23fff' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M30 40 l8 -18 l8 18 l-16 -11 h16z'/%3E%3Cpath d='M150 30 q15 -15 30 0 t30 0'/%3E%3Crect x='120' y='120' width='60' height='14' rx='4' transform='rotate(-35 150 127)'/%3E%3Cpath d='M180 100 l12 -8'/%3E%3Ccircle cx='60' cy='150' r='16'/%3E%3Cpath d='M20 200 q20 -30 40 0 q20 30 40 0'/%3E%3Cpath d='M100 70 l12 12 m0 -12 l-12 12'/%3E%3Cpath d='M190 190 l10 -20 l10 20z'/%3E%3C/svg%3E");
  background-size: 220px 220px;
}
.screen { position: relative; z-index: 1; min-height: 100dvh; }
h1, h2, h3 { font-family: var(--font-title); margin: 0; }

/* ---------- briques ---------- */
.card {
  background: var(--white);
  border: 3px solid var(--navy);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-title); font-weight: 700; font-size: 1.15rem;
  color: var(--ink); text-decoration: none;
  border: 3px solid var(--navy); border-radius: 14px;
  padding: 12px 20px; cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .08s, box-shadow .08s, filter .15s;
  user-select: none;
}
.btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--navy); }
.btn:disabled { filter: grayscale(.8) opacity(.6); cursor: not-allowed; transform: none; }
.btn-green { background: var(--green); }
.btn-yellow { background: var(--yellow); }
.btn-blue { background: #BFDBFE; }
.btn-red { background: var(--red); }
.btn-big { width: 100%; font-size: 1.35rem; padding: 16px; margin-top: 14px; animation: pulse 2.2s infinite; }
.btn-big:disabled { animation: none; }
.btn-small { font-size: .95rem; padding: 8px 12px; }
.icon-btn {
  width: 46px; height: 46px; border-radius: 12px; font-size: 1.3rem; cursor: pointer;
  background: var(--white); border: 3px solid var(--navy); box-shadow: var(--shadow-sm);
}
.icon-btn:active { transform: translateY(3px); box-shadow: none; }
.icon-btn.tiny { width: 32px; height: 32px; font-size: .95rem; border-width: 2px; box-shadow: 0 2px 0 var(--navy); }
.pill {
  display: inline-block; padding: 6px 12px; border-radius: 999px; background: var(--white);
  border: 2px solid var(--navy); font-weight: 900; font-size: .95rem;
}
.pill-yellow { background: var(--yellow); }
.muted { color: #E0E7FF; font-weight: 700; }
.card .muted { color: var(--muted); }

.logo { font-family: var(--font-title); font-weight: 700; color: var(--white); font-size: clamp(2.6rem, 8vw, 5rem); text-shadow: 0 5px 0 var(--navy); letter-spacing: .5px; -webkit-text-stroke: 2px var(--navy); }
.logo span { color: var(--yellow); }
.logo em { color: var(--green); font-style: normal; font-size: .6em; }
.logo.small { font-size: 1.8rem; text-shadow: 0 3px 0 var(--navy); -webkit-text-stroke: 1.5px var(--navy); }

.avatar { width: 40px; height: 40px; flex: none; display: block; }
.avatar.big { width: 96px; height: 96px; }
.wiggle { animation: wiggle 1.6s ease-in-out infinite; }
.bob { animation: bob 1.8s ease-in-out infinite; }

/* ---------- animations ---------- */
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }
@keyframes wiggle { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes bounceIn { 0% { transform: scale(.3); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } 80% { transform: scale(.96); } 100% { transform: scale(1); } }
@keyframes popIn { 0% { transform: scale(0) rotate(-10deg); } 70% { transform: scale(1.1) rotate(3deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes shake { 0%, 100% { transform: translateX(0) rotate(0); } 20% { transform: translateX(-6px) rotate(-3deg); } 40% { transform: translateX(6px) rotate(3deg); } 60% { transform: translateX(-4px) rotate(-2deg); } 80% { transform: translateX(4px) rotate(2deg); } }
@keyframes rotatePhone { 0%, 15% { transform: rotate(0); } 45%, 70% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }
@keyframes ring { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
@keyframes fall { 0% { transform: translate(0, -10vh) rotate(0); opacity: 1; } 100% { transform: translate(var(--dx), 105vh) rotate(var(--rot)); opacity: .9; } }
@keyframes halo { 0% { transform: translate(-50%, -50%) scale(.4); opacity: .8; } 100% { transform: translate(-50%, -50%) scale(1.6); opacity: 0; } }
@keyframes rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes floatUp { 0% { transform: translateY(6px); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }
.bounce-in, .bounce { animation: bounceIn .6s cubic-bezier(.2, 1.4, .5, 1) both; }
.pop { animation: popIn .45s cubic-bezier(.2, 1.4, .5, 1) both; animation-delay: calc(var(--i, 0) * 40ms); }
.shake { animation: shake .45s; }

.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti-layer i { position: absolute; top: 0; width: 10px; height: 14px; border: 1.5px solid rgba(30, 58, 138, .5); animation: fall linear forwards; }

.net-banner { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 80; background: var(--yellow); border: 3px solid var(--navy); border-radius: 12px; padding: 8px 16px; box-shadow: var(--shadow-sm); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; background: var(--white); border: 3px solid var(--navy); border-radius: 14px; padding: 12px 18px; box-shadow: var(--shadow-sm); animation: bounceIn .4s both; max-width: calc(100% - 32px); text-align: center; }
.toast.bad { background: #FEE2E2; }
.toast.ok { background: #DCFCE7; }
.toast.out { opacity: 0; transition: opacity .4s; }

/* ---------- accueil ---------- */
.home-wrap { max-width: 980px; margin: 0 auto; padding: 40px 16px; text-align: center; }
.tagline { color: var(--white); font-size: 1.25rem; margin: 6px 0 30px; text-shadow: 0 2px 0 var(--navy); }
.home-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 22px; }
.home-card { display: flex; flex-direction: column; align-items: center; gap: 10px; text-decoration: none; color: inherit; transition: transform .15s; }
.home-card:hover { transform: translateY(-4px) rotate(-1deg); }
.home-card p { margin: 0 0 6px; color: var(--muted); }
.big-emoji { font-size: 3.4rem; animation: bob 2s infinite; }
.how { list-style: none; text-align: left; margin: 26px auto 0; max-width: 640px; display: grid; gap: 8px; font-weight: 700; }

/* ---------- hôte : salon ---------- */
.host { padding: 16px 22px 18px; display: flex; flex-direction: column; }
.host-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.lobby-grid { flex: 1; display: grid; grid-template-columns: 1.15fr 1fr .85fr; gap: 20px; align-items: start; }
.join-card { text-align: center; }
.join-label { margin: 0; font-family: var(--font-title); font-size: 1.3rem; color: var(--muted); }
.room-code { display: flex; justify-content: center; gap: 10px; margin: 10px 0 16px; font-family: var(--font-title); font-size: clamp(4rem, 9vw, 8rem); line-height: 1; }
.room-code span { display: inline-block; background: var(--yellow); border: 4px solid var(--navy); border-radius: 18px; padding: 8px 14px 4px; box-shadow: 0 8px 0 var(--navy); animation: popIn .5s both, bob 2.4s ease-in-out infinite; animation-delay: calc(var(--i) * 90ms), calc(var(--i) * 200ms); }
.join-row { display: flex; gap: 16px; align-items: center; justify-content: center; flex-wrap: wrap; }
.qr { width: 184px; height: 184px; padding: 8px; border: 3px solid var(--navy); border-radius: 14px; background: #fff; display: grid; place-items: center; }
.qr img, .qr canvas { display: block; }
.qr-fallback { font-size: 4rem; }
.join-how p { margin: 4px 0; }
.join-url { font-family: var(--font-title); font-size: 1.15rem; color: var(--navy); background: #DBEAFE; border-radius: 10px; padding: 6px 10px; word-break: break-all; }
.players-card h2, .settings-card h2 { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.lobby-players { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.pcard { display: flex; flex-direction: column; align-items: center; gap: 6px; background: #EFF6FF; border: 2px solid var(--navy); border-radius: 14px; padding: 10px 6px; }
.pcard .avatar { width: 64px; height: 64px; }
.pname { font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.vip { color: var(--yellow-d); }
.empty { grid-column: 1 / -1; color: var(--muted); text-align: center; padding: 30px 10px; font-weight: 700; }
.set-label { margin: 12px 0 6px; color: var(--muted); font-weight: 800; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button { flex: 1; min-width: 54px; font-family: var(--font-title); font-weight: 700; font-size: 1.1rem; padding: 10px 6px; border: 3px solid var(--navy); border-radius: 12px; background: #fff; cursor: pointer; box-shadow: 0 3px 0 var(--navy); }
.seg button.on { background: var(--yellow); transform: translateY(2px); box-shadow: 0 1px 0 var(--navy); }

/* ---------- emplacements publicitaires ---------- */
ad-slot { display: block; }
.ad-slot .ad-inner { position: relative; display: flex; align-items: center; justify-content: center; gap: 12px; border: 2px dashed rgba(255, 255, 255, .55); border-radius: 12px; color: rgba(255, 255, 255, .85); background: rgba(15, 23, 42, .18); font-weight: 700; }
.ad-banner { margin-top: 16px; }
.ad-banner .ad-inner { height: 90px; max-width: 728px; margin: 0 auto; }
.ad-card .ad-inner { min-height: 250px; width: 100%; max-width: 300px; margin: 0 auto; flex-direction: column; background: rgba(255, 255, 255, .9); color: var(--muted); border: 3px dashed var(--navy); }
.ad-label { position: absolute; top: 6px; left: 10px; font-size: .7rem; text-transform: uppercase; letter-spacing: 1px; opacity: .8; }

/* ---------- hôte : jeu ---------- */
#hostGame { height: 100dvh; padding: 10px 16px 14px; }
.game-top { display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 18px; margin-bottom: 10px; }
.clock { position: relative; width: 92px; height: 92px; flex: none; }
.clock svg { width: 100%; height: 100%; display: block; }
.clock-num { position: absolute; left: 0; right: 0; top: 44%; transform: translateY(-50%); text-align: center; font-family: var(--font-title); font-weight: 700; font-size: 1.9rem; color: var(--navy); }
.clock.hurry { animation: ring .25s infinite; }
.clock.hurry .clock-num { color: var(--red-d); }
.hint { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-end; gap: 8px; min-height: 64px; }
.hint .slot { width: 34px; height: 46px; border-bottom: 6px solid var(--white); display: grid; place-items: center; font-family: var(--font-title); font-size: 2.1rem; color: var(--white); text-shadow: 0 3px 0 var(--navy); }
.hint .slot.shown { color: var(--yellow); animation: popIn .4s both; }
.hint .gap { width: 22px; }
.hint .sep { color: #fff; font-size: 2rem; font-family: var(--font-title); }
.hint .count { align-self: center; margin-left: 8px; font-size: 1rem; color: var(--navy); background: var(--yellow); border: 2px solid var(--navy); border-radius: 999px; padding: 2px 9px; }
.hint-msg { color: var(--white); font-family: var(--font-title); font-size: 1.7rem; text-shadow: 0 3px 0 var(--navy); }
.hint-msg b { color: var(--yellow); }
.top-right { display: flex; gap: 10px; align-items: center; }
.game-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 240px 1fr 280px; gap: 16px; }
.side-players, .side-chat { padding: 12px; display: flex; flex-direction: column; min-height: 0; }
#gamePlayers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.prow { position: relative; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 2px solid var(--navy); border-radius: 12px; background: #F8FAFC; transition: background .3s; }
.prow.drawing { background: #FEF9C3; }
.prow.guessed { background: #DCFCE7; }
.prow .rank { font-family: var(--font-title); width: 26px; color: var(--muted); }
.pinfo { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.pscore { font-size: .85rem; color: var(--muted); }
.badge { font-size: 1.2rem; }
.gain { position: absolute; right: -8px; top: -10px; background: var(--green); border: 2px solid var(--navy); border-radius: 999px; padding: 1px 8px; font-size: .85rem; animation: bounceIn .5s both; }
.board-wrap { min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; container-type: size; }
.paper { position: relative; width: min(100cqw, calc(100cqh * 16 / 9)); aspect-ratio: 16 / 9; background: #fff; border: 4px solid var(--navy); border-radius: 18px; box-shadow: 0 8px 0 var(--navy), inset 0 0 0 8px #F1F5F9; overflow: hidden; }
.paper canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.paper-clip { position: absolute; top: -2px; left: 50%; transform: translateX(-50%); width: 110px; height: 22px; background: #94A3B8; border: 3px solid var(--navy); border-top: 0; border-radius: 0 0 12px 12px; z-index: 2; }
.drawer-tag { position: absolute; left: 12px; bottom: 10px; display: flex; align-items: center; gap: 8px; font-weight: 900; color: var(--muted); z-index: 2; pointer-events: none; }
.drawer-tag:empty { display: none; }
.drawer-tag .avatar { width: 30px; height: 30px; }
.board-overlay { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; background: rgba(30, 58, 138, .35); backdrop-filter: blur(2px); }
.ov-card { background: #fff; border: 3px solid var(--navy); border-radius: 18px; box-shadow: var(--shadow); padding: 22px 28px; text-align: center; max-width: 80%; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ov-card p { margin: 0; color: var(--muted); }
.ov-timer { font-family: var(--font-title); font-size: 1.6rem; background: var(--yellow); border: 3px solid var(--navy); border-radius: 999px; padding: 2px 16px; }
.reveal-label { font-size: 1.1rem; }
.reveal-word { font-family: var(--font-title); font-size: clamp(2rem, 5vw, 3.6rem); color: var(--navy); background: var(--yellow); border: 4px solid var(--navy); border-radius: 16px; padding: 6px 22px; box-shadow: var(--shadow); word-break: break-word; }
.gains { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 640px; }
.gains li { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border: 2px solid var(--navy); border-radius: 999px; background: #F1F5F9; }
.gains li.won { background: #DCFCE7; }
.gains li .avatar { width: 28px; height: 28px; }
.gains li b { color: var(--green-d); }
.side-chat h3 { margin-bottom: 8px; }
.chat { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.chat li { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 10px; background: #F1F5F9; font-weight: 700; word-break: break-word; animation: floatUp .25s both; }
.chat li .avatar { width: 24px; height: 24px; }
.chat li.sys { background: transparent; color: var(--muted); font-style: italic; font-size: .9rem; }
.chat li.ok { background: var(--green); border: 2px solid var(--navy); animation: bounceIn .5s both; }

/* ---------- podium ---------- */
#hostEnd { padding: 20px; }
.end-title { text-align: center; color: var(--yellow); font-size: clamp(2.4rem, 6vw, 4.4rem); -webkit-text-stroke: 2px var(--navy); text-shadow: 0 6px 0 var(--navy); margin-bottom: 10px; }
.end-grid { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: end; max-width: 1200px; margin: 0 auto; width: 100%; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 14px; min-height: 420px; }
.pod { width: 200px; display: flex; flex-direction: column; align-items: center; }
.pod.empty { opacity: 0; }
.pod-player { display: flex; flex-direction: column; align-items: center; gap: 4px; animation: bounceIn .7s both; animation-delay: calc(var(--d) + .4s); }
.pod-player .pname { color: #fff; font-family: var(--font-title); font-size: 1.4rem; text-shadow: 0 3px 0 var(--navy); }
.pod-player .pscore { background: var(--white); border: 2px solid var(--navy); border-radius: 999px; padding: 2px 10px; }
.crown { font-size: 3rem; animation: bob 1.4s ease-in-out infinite; }
.crown.small { font-size: 2.2rem; }
.pod-block { width: 100%; margin-top: 8px; display: grid; place-items: center; font-family: var(--font-title); font-size: 3rem; color: var(--navy); border: 4px solid var(--navy); border-radius: 16px 16px 0 0; box-shadow: var(--shadow); transform-origin: bottom; animation: rise .7s cubic-bezier(.2, 1.3, .5, 1) both; animation-delay: var(--d); }
.pod1 .pod-block { height: 220px; background: var(--yellow); }
.pod2 .pod-block { height: 160px; background: #E2E8F0; }
.pod3 .pod-block { height: 110px; background: #FDBA74; }
.pod1 .avatar.big { width: 128px; height: 128px; }
.rest-list { list-style: none; margin: 18px auto 0; padding: 0; max-width: 560px; display: grid; gap: 8px; }
.rest-list li { display: flex; align-items: center; gap: 10px; background: #fff; border: 2px solid var(--navy); border-radius: 12px; padding: 6px 12px; }
.rest-list li em { margin-left: auto; font-style: normal; color: var(--muted); }
.end-side { display: flex; flex-direction: column; gap: 16px; }

/* ---------- manette ---------- */
.phone-wrap { max-width: 460px; margin: 0 auto; padding: 14px 16px 24px; display: flex; flex-direction: column; gap: 14px; }
.phone-wrap.center { align-items: center; text-align: center; justify-content: center; min-height: 100dvh; }
.phone-head { display: flex; justify-content: space-between; align-items: center; }
.join-form { display: flex; flex-direction: column; gap: 6px; }
.lbl { margin: 8px 0 2px; font-family: var(--font-title); color: var(--muted); font-size: 1rem; }
.code-input, .text-input, .guess-input {
  width: 100%; font-family: var(--font-title); font-weight: 700; border: 3px solid var(--navy); border-radius: 14px; padding: 12px 14px; font-size: 1.3rem; outline: none; background: #F8FAFC; color: var(--ink);
}
.code-input { text-align: center; font-size: 2.4rem; letter-spacing: 14px; text-transform: uppercase; background: #FEF9C3; }
.code-input:focus, .text-input:focus, .guess-input:focus { background: #fff; box-shadow: 0 0 0 4px rgba(250, 204, 21, .6); }
.av-editor { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.av-col { display: flex; flex-direction: column; gap: 8px; }
.arrow { width: 44px; height: 38px; border: 3px solid var(--navy); border-radius: 10px; background: #DBEAFE; font-size: 1rem; cursor: pointer; box-shadow: 0 3px 0 var(--navy); }
.arrow:active { transform: translateY(3px); box-shadow: none; }
.av-mid { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.av-preview .avatar { width: 112px; height: 112px; }
.wait-avatar .avatar { width: 140px; height: 140px; }
.wait-name { color: #fff; font-size: 2rem; text-shadow: 0 3px 0 var(--navy); }
.wait-msg { color: #fff; font-size: 1.1rem; max-width: 340px; }
.vip-box { width: 100%; text-align: left; }
.pick-title { color: #fff; font-size: 2rem; text-shadow: 0 3px 0 var(--navy); }
.cards { display: flex; flex-direction: column; gap: 14px; width: 100%; }
.word-card { font-family: var(--font-title); font-weight: 700; font-size: 1.7rem; padding: 22px 12px; border: 3px solid var(--navy); border-radius: 18px; box-shadow: var(--shadow); cursor: pointer; animation: popIn .45s both; animation-delay: calc(var(--i) * 120ms); color: var(--ink); }
.word-card:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--navy); }
.word-card.c0 { background: var(--green); }
.word-card.c1 { background: var(--yellow); }
.word-card.c2 { background: #F9A8D4; }
.tip { color: #fff; font-weight: 700; max-width: 340px; }
.me-badge { display: flex; align-items: center; gap: 8px; color: #fff; text-shadow: 0 2px 0 var(--navy); }
.me-badge b { margin-left: auto; background: var(--yellow); color: var(--ink); text-shadow: none; border: 2px solid var(--navy); border-radius: 999px; padding: 2px 10px; }
.guess-status { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; font-family: var(--font-title); font-size: 1.1rem; }
.mini-hint { letter-spacing: 2px; font-size: 1.3rem; white-space: pre-wrap; word-break: break-word; }
.mini-time { flex: none; background: var(--yellow); border: 2px solid var(--navy); border-radius: 999px; padding: 2px 10px; }
.guess-form { display: flex; gap: 8px; }
.guess-input { background: linear-gradient(135deg, #FEF9C3, #DCFCE7); font-size: 1.4rem; }
.guess-form .btn { font-size: 1.5rem; padding: 0 18px; }
.guess-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.guess-list li { background: rgba(255, 255, 255, .85); border: 2px solid var(--navy); border-radius: 12px; padding: 8px 12px; color: var(--muted); animation: floatUp .25s both; }
.guess-list li.close { background: var(--yellow); color: var(--ink); }
.close-tag { float: right; font-size: .85rem; background: #fff; border: 2px solid var(--navy); border-radius: 999px; padding: 0 8px; }
.close-banner { text-align: center; font-family: var(--font-title); font-size: 1.6rem; background: var(--yellow); border: 3px solid var(--navy); border-radius: 14px; box-shadow: var(--shadow-sm); padding: 8px; }
.found { text-align: center; font-family: var(--font-title); font-size: 1.6rem; background: var(--green); border: 3px solid var(--navy); border-radius: 18px; box-shadow: var(--shadow); padding: 16px; }
.found b { font-size: 2rem; }
.found .pts { display: block; margin-top: 6px; font-size: 1.2rem; }
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: .9rem; }
.feed li { color: #E0E7FF; font-weight: 700; }
.feed li.ok { color: var(--green); }
.feed li.sys { font-style: italic; opacity: .8; }
.feed li.secret { color: #BBF7D0; }
.gain-big { font-family: var(--font-title); font-size: 2.4rem; color: var(--green); -webkit-text-stroke: 1.5px var(--navy); text-shadow: 0 4px 0 var(--navy); animation: bounceIn .6s both .3s; }
.gain-none { font-family: var(--font-title); font-size: 1.4rem; color: #fff; }
.final-rank { font-family: var(--font-title); font-size: 4rem; color: var(--yellow); -webkit-text-stroke: 2px var(--navy); text-shadow: 0 5px 0 var(--navy); }
.final-rank small { font-size: 1.4rem; color: #fff; -webkit-text-stroke: 0; }
#reveal .reveal-word { font-size: 2.6rem; }

/* ---------- pad aveugle ---------- */
.pad-screen { height: 100dvh; overflow: hidden; touch-action: none; overscroll-behavior: none; user-select: none; -webkit-user-select: none; }
body.drawer-active { overflow: hidden; position: fixed; inset: 0; }
.pad-layout { position: absolute; inset: 0; display: flex; gap: 10px; padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
.toolbar { flex: none; display: flex; gap: 8px; background: #fff; border: 3px solid var(--navy); border-radius: 16px; box-shadow: 0 4px 0 var(--navy); padding: 8px; align-self: stretch; }
.palette { display: grid; grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(6, 1fr); gap: 6px; }
.sw { width: 34px; min-height: 26px; height: 100%; max-height: 40px; border-radius: 10px; background: var(--sw); border: 2.5px solid var(--navy); cursor: pointer; padding: 0; }
.sw.on { outline: 3px solid var(--yellow); outline-offset: 1px; transform: scale(1.1); }
.tools { display: grid; grid-template-rows: repeat(5, 1fr); gap: 6px; }
.sz, .tool { width: 44px; min-height: 30px; border: 2.5px solid var(--navy); border-radius: 10px; background: #F1F5F9; display: grid; place-items: center; cursor: pointer; padding: 0; font-size: 1.1rem; }
.sz i { display: block; width: var(--d); height: var(--d); border-radius: 50%; background: var(--sw, #111827); }
.sz.on { background: var(--yellow); }
.tool.undo { background: #DBEAFE; }
.tool.trash { background: var(--red); }
.tool.trash.confirm { background: var(--red-d); animation: shake .4s; }
.tool.trash.confirm::after { content: "?"; color: #fff; font-family: var(--font-title); }
.sz:active, .tool:active, .sw:active { transform: scale(.92); }
.pad-area { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; }
.pad-surface {
  position: relative; aspect-ratio: 16 / 9; width: 100%; max-height: 100%;
  background-color: #F1F5F9;
  background-image:
    linear-gradient(rgba(30, 58, 138, .10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 58, 138, .10) 1px, transparent 1px),
    linear-gradient(rgba(30, 58, 138, .20) 2px, transparent 2px),
    linear-gradient(90deg, rgba(30, 58, 138, .20) 2px, transparent 2px);
  background-size: 6.25% 11.111%, 6.25% 11.111%, 25% 33.333%, 25% 33.333%;
  background-position: -1px -1px, -1px -1px, -1px -1px, -1px -1px;
  border: 3px solid var(--navy); border-radius: 14px; box-shadow: 0 4px 0 var(--navy);
  overflow: hidden; touch-action: none; cursor: crosshair;
}
.pad-info { position: absolute; top: 6px; left: 8px; right: 8px; display: flex; align-items: center; gap: 10px; pointer-events: none; font-size: .95rem; color: var(--navy); }
.pad-info b { font-family: var(--font-title); font-size: 1.1rem; }
.pad-info .pad-time { margin-left: auto; background: var(--yellow); border: 2px solid var(--navy); border-radius: 999px; padding: 0 8px; }
.pad-info .icon-btn { pointer-events: auto; }
.pad-hint { position: absolute; bottom: 6px; right: 10px; font-size: .85rem; color: rgba(30, 58, 138, .5); pointer-events: none; }
.halo { position: absolute; width: 34px; height: 34px; border-radius: 50%; pointer-events: none; background: radial-gradient(circle, var(--hc) 0%, transparent 70%); animation: halo .2s ease-out forwards; }

.rotate-gate { display: none; position: fixed; inset: 0; z-index: 50; align-items: center; justify-content: center; padding: 16px; background: linear-gradient(160deg, var(--blue-1), var(--blue-2)); }
.rotate-gate.force { display: flex; }
@media (orientation: portrait) {
  body:not(.is-pc) .rotate-gate { display: flex; }
}
body.is-pc .rotate-gate { display: none !important; }
.rotate-card { background: #fff; border: 3px solid var(--navy); border-radius: 22px; box-shadow: var(--shadow); padding: 28px 22px; text-align: center; max-width: 340px; animation: shake 1.2s ease-in-out infinite; animation-delay: 1.6s; }
.rotate-card h2 { font-size: 1.9rem; margin: 10px 0 6px; }
.rotate-card p { color: var(--muted); margin: 0 0 12px; }
.rotate-card .me-badge { justify-content: center; color: var(--ink); text-shadow: none; }
.rotate-phone { display: inline-grid; place-items: center; width: 110px; height: 110px; border-radius: 50%; background: var(--yellow); border: 3px solid var(--navy); }
.rotate-phone span { font-size: 4rem; display: block; animation: rotatePhone 1.8s ease-in-out infinite; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .lobby-grid { grid-template-columns: 1fr 1fr; }
  .join-card { grid-column: 1 / -1; }
  .game-grid { grid-template-columns: 190px 1fr 220px; }
}
@media (max-width: 760px) {
  .lobby-grid { grid-template-columns: 1fr; }
  #hostGame { height: auto; }
  .game-top { grid-template-columns: auto 1fr; }
  .game-grid { grid-template-columns: 1fr; }
  .board-wrap { container-type: inline-size; }
  .paper { width: 100%; }
  .end-grid { grid-template-columns: 1fr; }
  .pod { width: 30vw; }
  .podium { min-height: 340px; }
}
@media (max-height: 420px) and (orientation: landscape) {
  .palette { gap: 4px; }
  .sw { width: 28px; min-height: 20px; }
  .sz, .tool { width: 38px; min-height: 24px; font-size: .95rem; }
  .toolbar { padding: 6px; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* =====================================================================
   v2 — mode hybride, cross-play PC/mobile, galerie, plein écran mobile
   ===================================================================== */

/* ---------- plein écran mobile : 100dvh, pas de rebond ---------- */
html, body { overscroll-behavior: none; }
.screen.phone { min-height: 100dvh; overscroll-behavior: none; }
.head-btns { display: flex; gap: 8px; }
.head-btns .icon-btn { width: 40px; height: 40px; font-size: 1.1rem; }
.phone-head .logo { text-decoration: none; }

/* ---------- accueil ---------- */
.home-wrap { max-width: 1180px; }
.home-cards { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.home-sub { margin: -6px 0 0 !important; font-family: var(--font-title); color: var(--navy) !important; font-size: 1.05rem; }
.home-card.featured { background: #F0FDF4; transform: translateY(-6px); box-shadow: 0 12px 0 var(--navy); }
.home-card.featured:hover { transform: translateY(-10px) rotate(1deg); }

/* ---------- rejoindre / créer ---------- */
.join-title { font-size: 1.5rem; color: var(--navy); text-align: center; }

/* ---------- salon d'attente joueur ---------- */
.wait-code-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.wait-code { font-family: var(--font-title); font-size: 3.4rem; letter-spacing: 10px; line-height: 1; background: var(--yellow); border: 3px solid var(--navy); border-radius: 14px; padding: 8px 8px 4px 18px; box-shadow: var(--shadow-sm); }
.wait-me { display: flex; align-items: center; gap: 14px; }
.wait-me .wait-avatar .avatar { width: 88px; height: 88px; }
.wait-me .wait-name { font-size: 1.7rem; margin-bottom: 4px; }
.wait-players { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.wait-players li { display: flex; align-items: center; gap: 6px; background: #fff; border: 2px solid var(--navy); border-radius: 12px; padding: 4px 8px; animation: popIn .4s both; overflow: hidden; }
.wait-players li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wait-players li.me { background: #FEF9C3; }
.wait-players .avatar { width: 30px; height: 30px; }

/* ---------- vue devineur : canevas en direct au-dessus du champ ---------- */
.guess-wrap { max-width: 1200px; padding-top: 10px; gap: 10px; }
.guess-head { display: flex; align-items: center; gap: 10px; }
.guess-head .me-badge { flex: 1; min-width: 0; }
.guess-main { display: flex; flex-direction: column; gap: 10px; }
.guess-board { display: flex; flex-direction: column; gap: 6px; }
.g-topbar { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.mini-clock { flex: none; font-family: var(--font-title); background: var(--yellow); border: 3px solid var(--navy); border-radius: 999px; padding: 2px 12px; box-shadow: 0 3px 0 var(--navy); font-size: 1.1rem; }
.mini-clock.hurry { background: var(--red); animation: ring .3s infinite; }
.hint-sm { flex: 1; min-height: 36px; gap: 4px; justify-content: flex-start; }
.hint-sm .slot { width: 18px; height: 28px; border-bottom-width: 4px; font-size: 1.2rem; }
.hint-sm .gap { width: 10px; }
.hint-sm .sep { font-size: 1.2rem; }
.hint-sm .count { font-size: .8rem; }
.hint-sm .hint-msg { font-size: 1.05rem; }
.small-paper { width: 100%; border-width: 3px; border-radius: 14px; box-shadow: 0 5px 0 var(--navy); }
.small-paper canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.small-paper .drawer-tag { left: 8px; bottom: 6px; font-size: .85rem; }
.small-paper .drawer-tag .avatar { width: 22px; height: 22px; }
.ov-card.small { flex-direction: row; flex-wrap: wrap; justify-content: center; padding: 10px 14px; font-size: 1rem; gap: 6px; }
.ov-card.small .avatar { width: 30px; height: 30px; }
.guess-side { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.found { font-size: 1.3rem; padding: 10px; }
.found b { font-size: 1.5rem; }
.g-scores { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.g-scores li { flex: none; display: flex; align-items: center; gap: 4px; background: rgba(255, 255, 255, .92); border: 2px solid var(--navy); border-radius: 999px; padding: 2px 8px 2px 2px; font-size: .85rem; }
.g-scores li.drawing { background: #FEF9C3; }
.g-scores li.guessed { background: #DCFCE7; }
.g-scores li.me { outline: 2px solid var(--yellow); }
.g-scores .avatar { width: 24px; height: 24px; }
.g-scores b { color: var(--navy); }
.feed { max-height: 22vh; overflow-y: auto; }
.feed li { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.feed .avatar { width: 18px; height: 18px; }

/* PC : canevas large à gauche, réponses à droite */
@media (min-width: 900px) {
  .guess-main { display: grid; grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
  .guess-side { background: rgba(255, 255, 255, .12); border-radius: var(--radius); padding: 10px; }
  .feed { max-height: 40vh; }
  .hint-sm .slot { width: 26px; height: 36px; font-size: 1.6rem; }
}
/* paysage mobile (devineur) : le canevas tient dans la hauteur */
@media (orientation: landscape) and (max-height: 520px) {
  .guess-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 38%); }
  .guess-board .paper { width: min(100%, calc((100dvh - 110px) * 16 / 9)); }
}

/* ---------- pad aveugle : curseur PC éphémère ---------- */
.pad-cursor { position: absolute; left: 0; top: 0; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--hc, #111827); box-shadow: 0 0 0 2px rgba(255, 255, 255, .8); transform: translate(-50%, -50%); pointer-events: none; opacity: 0; transition: opacity .25s; }
.pad-cursor.on { opacity: .9; transition: opacity .05s; }
body.is-pc .pad-surface { cursor: none; }
.only-pc { display: none; }
body.is-pc .only-pc { display: inline; }
body.is-pc .only-touch { display: none; }
body.is-pc .toolbar { padding: 10px; gap: 10px; align-self: center; }
body.is-pc .palette, body.is-pc .tools { grid-template-rows: none; grid-auto-rows: 40px; }
body.is-pc .sw { width: 40px; height: 40px; min-height: 0; max-height: none; }
body.is-pc .sz, body.is-pc .tool { width: 52px; height: 40px; min-height: 0; }
body.is-pc .tools { grid-template-rows: repeat(5, 40px); gap: 8px; }
body.is-pc .palette { grid-template-rows: repeat(6, 40px); }
body.is-pc .pad-layout { padding: 16px; gap: 16px; }

/* ---------- révélation joueur ---------- */
.reveal-paper { max-width: 420px; margin: 6px 0; }
.reveal-artist { display: flex; align-items: center; gap: 6px; color: #fff; margin: 0; }
.reveal-artist .avatar { width: 26px; height: 26px; }

/* ---------- fin de partie joueur ---------- */
.final-wrap { max-width: 1100px; align-items: stretch; }
.final-top { display: flex; flex-direction: column; align-items: center; gap: 6px; color: #fff; text-align: center; }
.final-top h2 { text-shadow: 0 3px 0 var(--navy); }
.final-board { list-style: none; margin: 0 auto; padding: 10px; width: 100%; max-width: 460px; display: grid; gap: 6px; }
.final-board li { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 10px; }
.final-board li.me { background: #FEF9C3; }
.final-board li span { width: 30px; font-family: var(--font-title); }
.final-board li em { margin-left: auto; font-style: normal; color: var(--muted); }
.final-board .avatar { width: 30px; height: 30px; }

/* ---------- galerie des chefs-d'œuvre ---------- */
.gallery-section { margin-top: 22px; width: 100%; }
#hostEnd .gallery-section { max-width: 1200px; margin-left: auto; margin-right: auto; }
.gallery-title { text-align: center; color: #fff; font-size: clamp(1.6rem, 4vw, 2.4rem); text-shadow: 0 4px 0 var(--navy); -webkit-text-stroke: 1px var(--navy); margin-bottom: 14px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }
.gal-card { margin: 0; background: #fff; border: 3px solid var(--navy); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px; transform: rotate(var(--tilt, 0deg)); animation: popIn .5s both; animation-delay: calc(var(--i) * 80ms); transition: transform .15s; }
.gal-card:hover { transform: rotate(0) translateY(-4px); }
.gal-paper { position: relative; aspect-ratio: 16 / 9; border: 2px solid var(--navy); border-radius: 10px; overflow: hidden; background: #fff; }
.gal-paper canvas { width: 100%; height: 100%; display: block; }
.gal-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.gal-card figcaption { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; }
.gal-word { font-family: var(--font-title); font-size: 1.3rem; color: var(--navy); }
.gal-artist { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.gal-artist .avatar { width: 24px; height: 24px; }
.gal-pts { margin-left: auto; background: var(--green); color: var(--ink); border: 2px solid var(--navy); border-radius: 999px; padding: 0 8px; font-size: .85rem; }
.gal-dl { width: 100%; }
.gal-empty { color: #fff; text-align: center; grid-column: 1 / -1; }


/* =====================================================================
   v3 — encoche / safe areas, plein écran iOS, retour accueil, modes,
        mots perso, réactions, galerie interactive, trophées
   ===================================================================== */

/* ---------- safe areas (encoche, Dynamic Island, barre d'état PWA) ---------- */
.home-wrap, .host, .phone-wrap {
  padding-top: max(12px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}
.home-wrap { padding-top: max(40px, env(safe-area-inset-top)); }
#hostGame { padding-top: max(10px, env(safe-area-inset-top)); }
.rotate-gate { padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.net-banner { top: max(10px, env(safe-area-inset-top)); }
.toast { bottom: max(24px, calc(env(safe-area-inset-bottom) + 12px)); }

/* ---------- logo = retour accueil ---------- */
.home-link { text-decoration: none; cursor: pointer; transition: transform .15s; display: inline-block; }
.home-link:hover { transform: rotate(-3deg) scale(1.04); }
.home-link:active { transform: scale(.94); }
.mini-logo { font-size: 1.5rem !important; flex: none; }
.abs-head { position: absolute; top: max(10px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left)); }
.phone-wrap.center { position: relative; }
#pick .phone-wrap.center, #reveal .phone-wrap.center { padding-top: max(64px, calc(env(safe-area-inset-top) + 52px)); }
.end-top { margin-bottom: 0; }

/* ---------- bulle d'aide plein écran (iPhone) ---------- */
.fs-tip {
  position: fixed; z-index: 95; left: 50%; transform: translateX(-50%);
  width: min(340px, calc(100% - 24px)); display: flex; gap: 10px; align-items: flex-start;
  background: #FEF9C3; border: 3px solid var(--navy); border-radius: 18px; box-shadow: var(--shadow); padding: 12px 36px 12px 12px;
}
.fs-tip.bounce { animation: none; }
.fs-tip p { margin: 0; font-weight: 800; line-height: 1.35; }
.fs-tip-icon { font-size: 1.8rem; }
.share-ico { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 2px solid var(--navy); border-radius: 6px; background: #fff; font-size: .85rem; }
.fs-tip-close { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--navy); background: #fff; cursor: pointer; font-weight: 900; }

/* ---------- boîte de confirmation ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 16px; background: rgba(15, 23, 42, .55); backdrop-filter: blur(3px); }
.modal-card { background: #fff; border: 3px solid var(--navy); border-radius: 20px; box-shadow: var(--shadow); padding: 22px; max-width: 360px; width: 100%; text-align: center; }
.modal-text { font-family: var(--font-title); font-size: 1.45rem; margin: 0 0 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }
.modal-actions .btn { flex: 1; }
body.modal-open { overflow: hidden; }

/* ---------- réglages : modes, catégorie, mots perso ---------- */
.settings-body .seg { margin-bottom: 2px; }
.seg-modes button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .85rem; padding: 8px 4px; line-height: 1.1; }
.seg-modes .m-ico { font-size: 1.4rem; }
.mode-tip { margin: 6px 0 0; font-size: .85rem; color: var(--muted); font-weight: 700; min-height: 1.2em; }
.cat-select, .custom-words {
  width: 100%; font-family: var(--font-body); font-weight: 800; font-size: 1rem; color: var(--ink);
  border: 3px solid var(--navy); border-radius: 12px; padding: 9px 10px; background: #F8FAFC; box-shadow: 0 3px 0 var(--navy);
}
.custom-words { resize: vertical; min-height: 54px; box-shadow: none; }
.cat-select:focus, .custom-words:focus { outline: none; background: #fff; box-shadow: 0 0 0 4px rgba(250, 204, 21, .6); }
label.set-label { display: block; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-weight: 800; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--green-d); }
.custom-count { margin: 6px 0 0; font-size: .85rem; color: var(--muted); }
.custom-count.warn { color: var(--red-d); }
.settings-card { max-height: calc(100dvh - 140px); overflow-y: auto; }
.vip-title { font-size: 1.2rem; color: var(--navy); }
.wait-pills { margin: 0; display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- suggestions de mots secrets ---------- */
.suggest-card { padding: 12px 14px; }
.suggest-card .set-label { margin-top: 0; }
.suggest-card small { font-weight: 700; }
.suggest-form { display: flex; gap: 8px; }
.suggest-form .text-input { font-size: 1.05rem; padding: 10px 12px; }
.suggest-info { margin: 8px 0 0; font-weight: 800; color: var(--navy); }

/* ---------- réactions emoji ---------- */
.react-layer { position: absolute; top: 0; right: 0; bottom: 0; width: 34%; pointer-events: none; z-index: 4; overflow: hidden; }
.react-bubble {
  position: absolute; right: 10px; display: flex; flex-direction: column; align-items: center;
  background: #fff; border: 3px solid var(--navy); border-radius: 18px; box-shadow: 0 4px 0 var(--navy); padding: 4px 10px;
  animation: reactFloat 2.5s ease-out forwards;
}
.rb-emoji { font-size: 2.2rem; line-height: 1; }
.rb-txt { font-family: var(--font-title); font-size: .9rem; color: var(--red-d); }
.rb-name { font-size: .7rem; color: var(--muted); max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.small-paper .react-bubble { padding: 2px 6px; border-width: 2px; border-radius: 12px; }
.small-paper .rb-emoji { font-size: 1.5rem; }
@keyframes reactFloat {
  0% { transform: translate(40px, 30px) scale(.4); opacity: 0; }
  15% { transform: translate(0, 0) scale(1.1); opacity: 1; }
  25% { transform: translate(0, -6px) scale(1); }
  80% { opacity: 1; }
  100% { transform: translate(var(--dx), -110px) scale(.9); opacity: 0; }
}
.react-bar { display: flex; gap: 6px; }
.react-btn {
  flex: 1; min-height: 44px; font-size: 1.5rem; border: 3px solid var(--navy); border-radius: 14px; background: #fff;
  box-shadow: 0 4px 0 var(--navy); cursor: pointer; transition: transform .08s, filter .2s; padding: 2px;
}
.react-btn.wide { flex: 2; font-family: var(--font-title); font-size: 1.05rem; background: var(--yellow); }
.react-btn:active { transform: translateY(4px); box-shadow: none; }
.react-bar.cooldown .react-btn { filter: grayscale(1) opacity(.55); pointer-events: none; }

/* ---------- pad : rappel, encre magique, trait unique ---------- */
.pad-ink { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pad-reminder {
  position: absolute; left: 50%; bottom: 30px; transform: translateX(-50%); max-width: 92%;
  background: rgba(254, 249, 195, .95); border: 2px solid var(--navy); border-radius: 999px; padding: 4px 12px;
  font-size: .85rem; font-weight: 900; color: var(--navy); text-align: center; pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pad-lock {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 16px; text-align: center;
  background: rgba(30, 58, 138, .55); color: #fff; font-family: var(--font-title); font-size: 1.4rem; text-shadow: 0 2px 0 var(--navy);
}
.pad-lock span { font-size: 2.4rem; }
body.pad-one .tool.undo, body.pad-one .tool.trash { visibility: hidden; }
body.pad-magic .pad-hint, body.pad-one .pad-hint { display: none; }
@media (max-height: 420px) { .pad-reminder { bottom: 24px; font-size: .75rem; } }

/* ---------- galerie interactive : visionneuse ---------- */
.gal-card { cursor: zoom-in; }
.gal-card:focus-visible { outline: 4px solid var(--yellow); outline-offset: 3px; }
.lightbox {
  position: fixed; inset: 0; z-index: 110; display: grid; place-items: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: rgba(15, 23, 42, .75); backdrop-filter: blur(4px);
}
.lb-card { position: relative; width: min(1100px, 100%); max-height: 100%; overflow-y: auto; background: #fff; border: 4px solid var(--navy); border-radius: 22px; box-shadow: 0 8px 0 var(--navy); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.lb-close { position: absolute; top: 10px; right: 10px; z-index: 2; }
.lb-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-right: 54px; }
.lb-word { font-family: var(--font-title); font-size: clamp(1.4rem, 4vw, 2.2rem); color: var(--navy); background: var(--yellow); border: 3px solid var(--navy); border-radius: 12px; padding: 2px 14px; }
.lb-artist { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.lb-artist .avatar { width: 30px; height: 30px; }
.lb-artist em { font-style: normal; background: var(--green); color: var(--ink); border: 2px solid var(--navy); border-radius: 999px; padding: 0 8px; font-size: .85rem; }
.lb-stage { display: flex; align-items: center; gap: 8px; }
.lb-paper { flex: 1; width: auto; max-height: calc(100dvh - 220px); max-width: calc((100dvh - 220px) * 16 / 9); margin: 0 auto; }
.lb-paper canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.lb-nav { flex: none; width: 44px; height: 64px; border: 3px solid var(--navy); border-radius: 12px; background: #DBEAFE; font-size: 1.2rem; cursor: pointer; box-shadow: 0 3px 0 var(--navy); }
.lb-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.lb-actions .btn { flex: 1 1 200px; }
@media (max-width: 600px) {
  .lb-nav { width: 34px; height: 48px; }
  .lb-actions .btn { font-size: 1rem; padding: 10px; }
  .modal-text { font-size: 1.25rem; }
}


/* =====================================================================
   v4 — correctifs testés sur iPhone & Samsung
   ===================================================================== */

/* ---------- mode sombre forcé (Samsung Internet / Chrome Android) : on garde nos couleurs ---------- */
:root, body { color-scheme: light only; forced-color-adjust: none; }
html { background: #2C5282; }

/* ---------- haut de page sous l'encoche (iPhone, PWA) ---------- */
@media (pointer: coarse), (max-width: 760px) {
  .home-wrap, .phone-wrap, .host { padding-top: calc(env(safe-area-inset-top, 20px) + 24px); }
  .phone-wrap.center { padding-top: calc(env(safe-area-inset-top, 20px) + 24px); }
  #pick .phone-wrap.center, #reveal .phone-wrap.center { padding-top: calc(env(safe-area-inset-top, 20px) + 76px); }
  .abs-head { top: calc(env(safe-area-inset-top, 20px) + 16px); }
  .guess-wrap { padding-top: calc(env(safe-area-inset-top, 20px) + 16px); }
  .net-banner { top: calc(env(safe-area-inset-top, 20px) + 8px); }
}

/* ---------- barre des joueurs (devineurs) : plus de débordement horizontal ---------- */
.g-scores { flex-wrap: wrap; overflow: visible; max-width: 100%; }
.g-scores li { max-width: 100%; min-width: 0; }
.g-scores li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 9.5em; }
.guess-wrap, .guess-main, .guess-side, .guess-board { min-width: 0; max-width: 100%; }

/* ---------- rotation paysage <-> portrait : pas de flash ---------- */
body.rotating .screen, body.rotating .rotate-gate, body.rotating .portrait-gate { visibility: hidden; }
body.rotating *, body.rotating *::before, body.rotating *::after { transition: none !important; }

/* ---------- devineur sur smartphone : portrait obligatoire ---------- */
.portrait-gate {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: linear-gradient(160deg, var(--blue-1), var(--blue-2));
}
.portrait-gate .rotate-card { max-width: 420px; padding: 18px 22px; }
.portrait-gate h2 { font-size: 1.5rem; }
.to-portrait { animation: toPortrait 1.8s ease-in-out infinite !important; }
@keyframes toPortrait { 0%, 15% { transform: rotate(-90deg); } 45%, 70% { transform: rotate(0); } 100% { transform: rotate(-90deg); } }
@media (max-height: 420px) {
  .portrait-gate .rotate-phone { width: 70px; height: 70px; }
  .portrait-gate .rotate-phone span { font-size: 2.6rem; }
  .portrait-gate h2 { font-size: 1.25rem; margin: 6px 0 4px; }
}

/* ---------- salon : expulser / désigner l'hôte ---------- */
.p-actions { display: inline-flex; gap: 4px; margin-left: auto; flex: none; }
.pa-btn {
  width: 28px; height: 28px; padding: 0; display: grid; place-items: center; cursor: pointer;
  border: 2px solid var(--navy); border-radius: 8px; box-shadow: 0 2px 0 var(--navy); font-size: .85rem; font-weight: 900; line-height: 1;
}
.pa-btn:active { transform: translateY(2px); box-shadow: none; }
.pa-kick { background: var(--red); color: #fff; }
.pa-crown { background: #FEF9C3; }
.pcard { position: relative; }
.pcard .p-actions { position: absolute; top: 4px; right: 4px; }
.wait-players li { padding-right: 6px; }

/* ---------- accueil : 3 cartes identiques (fond blanc, droites, même survol) ---------- */
.home-card, .home-card.featured { background: var(--white); transform: none; box-shadow: var(--shadow); }
.home-card:hover, .home-card.featured:hover { transform: translateY(-4px) rotate(-1deg); }


/* =====================================================================
   v5 — fond fixe, colonnes PC, mode Normal
   ===================================================================== */

/* ---------- fond : calque fixe sur le viewport (plus de coupure en défilant, iOS compris) ---------- */
/* html porte la couleur de repli ; body reste transparent pour laisser voir le calque fixe */
body { background: transparent; }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(160deg, var(--blue-1) 0%, var(--blue-2) 100%);
}
.bg-doodles { position: fixed; inset: 0; }

/* ---------- colonne des scores (écran TV / PC) : badge de points dans la carte ---------- */
#gamePlayers { overflow-x: hidden; overflow-y: auto; padding: 2px 2px 4px; }
.side-players { overflow: hidden; }
.prow {
  display: grid; grid-template-columns: 22px 36px minmax(0, 1fr) auto; align-items: center; gap: 6px;
  min-width: 0; padding: 6px 8px 6px 6px;
}
.prow .rank { width: auto; font-size: .9rem; }
.prow .avatar { width: 36px; height: 36px; }
.prow .pinfo { min-width: 0; }
.prow .pname { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .pscore { white-space: nowrap; }
.prow .badge { position: absolute; left: 50px; top: -2px; font-size: .95rem; line-height: 1; }
.prow .gain {
  position: static; grid-column: 4; justify-self: end; animation: bounceIn .5s both;
  padding: 1px 8px; font-size: .85rem; font-weight: 900; white-space: nowrap;
}

/* ---------- colonne des propositions : pseudos jamais coupés au milieu ---------- */
.game-grid { grid-template-columns: 260px 1fr 300px; }
.chat li { flex-wrap: wrap; word-break: normal; overflow-wrap: break-word; min-width: 0; }
.chat li b {
  white-space: nowrap; word-break: keep-all; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%; min-width: 0; flex: 0 1 auto;
}
.chat li.ok { gap: 4px; }
@media (max-width: 1100px) {
  .game-grid { grid-template-columns: 200px 1fr 250px; }
}

/* ---------- sélecteur de mode : 4 options ---------- */
.seg-modes { display: grid; grid-template-columns: repeat(4, 1fr); }
.seg-modes button { min-width: 0; }
.vip-box .seg-modes { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 480px) { .seg-modes { grid-template-columns: repeat(2, 1fr); } }
body.pad-normal .pad-hint { display: none; }


/* =====================================================================
   v6 — palette 16 couleurs, pot de peinture, avatars (accessoires, humeur,
        photo), Mode Imposteur, transitions, poster
   ===================================================================== */

/* ---------- barre d'outils : 16 couleurs (4x4) + 6 outils ---------- */
.palette { grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, 1fr); }
.sw { width: 28px; }
.tools { grid-template-rows: repeat(6, 1fr); }
body.is-pc .palette { grid-template-rows: repeat(4, 40px); }
body.is-pc .sw { width: 36px; height: 36px; }
body.is-pc .tools { grid-template-rows: repeat(6, 40px); }
.tool.fill { background: #FEF3C7; }
.tool.fill.on { background: var(--yellow); outline: 3px solid var(--navy); outline-offset: -3px; transform: scale(1.05); }
.pad-surface.fill-cursor { cursor: cell; }
body.pad-one .tool.fill { visibility: hidden; }
@media (max-height: 420px) and (orientation: landscape) {
  .sw { width: 24px; min-height: 18px; }
  .palette { gap: 3px; }
  .tools { gap: 4px; }
  .sz, .tool { min-height: 20px; }
}

/* ---------- canevas commun visible sur le pad (mode Normal / Imposteur) ---------- */
.pad-board { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; background: #fff; }
body.pad-normal .pad-surface, body.pad-imp .pad-surface { background-image: none; background-color: #fff; }
body.pad-imp .pad-hint { display: none; }

/* ---------- avatars : onglets, accessoires, photo, humeur ---------- */
.av-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.av-tab { font-family: var(--font-title); font-weight: 700; font-size: .95rem; padding: 9px 6px; border: 3px solid var(--navy); border-radius: 12px; background: #fff; cursor: pointer; box-shadow: 0 3px 0 var(--navy); }
.av-tab.on { background: var(--yellow); transform: translateY(2px); box-shadow: 0 1px 0 var(--navy); }
.photo-row { display: flex; gap: 14px; align-items: center; }
.photo-preview { flex: none; width: 112px; height: 112px; border-radius: 50%; border: 5px solid var(--navy); overflow: hidden; background: #F1F5F9; display: grid; place-items: center; box-shadow: 0 4px 0 var(--navy); }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-empty { font-size: 2.6rem; }
.photo-actions { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.photo-pick { cursor: pointer; text-align: center; line-height: 1.25; }
.photo-note { margin: 0; font-size: .78rem; color: var(--muted); font-weight: 700; }
.avatar.photo-av { position: relative; display: inline-block; border-radius: 50%; border: 3px solid var(--navy); overflow: visible; background: #fff; flex: none; }
.avatar.photo-av img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.avatar.photo-av.big { border-width: 5px; }
.mood-badge { position: absolute; right: -6px; top: -6px; font-style: normal; font-size: .9em; line-height: 1; filter: drop-shadow(0 1px 0 #fff); }
.avatar.big .mood-badge { font-size: 1.8rem; }
.avatar.mood-happy { animation: bob 1s ease-in-out infinite; }
.avatar.mood-sweat { animation: wiggle .5s ease-in-out infinite; }

/* ---------- Mode Imposteur ---------- */
.col-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--c); border: 2px solid var(--navy); margin-right: 5px; vertical-align: -1px; flex: none; }
.role-banner {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 12px;
  background: #DCFCE7; border: 3px solid var(--navy); border-radius: 14px; box-shadow: var(--shadow-sm); padding: 8px 12px;
  font-family: var(--font-title); font-size: 1.05rem;
}
.role-banner b { color: var(--green-d); font-size: 1.2rem; }
.role-banner.is-imp { background: #FEE2E2; animation: shake .6s 1; }
.rb-imp { color: var(--red-d); font-size: 1.25rem; }
.rb-cat { font-size: .95rem; color: var(--navy); }
.rb-cat b { color: var(--navy); font-size: 1rem; }
.vote-panel { padding: 12px; }
.vote-title { margin: 0 0 8px; font-family: var(--font-title); font-size: 1.15rem; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.vote-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.vote-btn {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px; min-width: 0; cursor: pointer;
  border: 3px solid var(--navy); border-radius: 12px; background: #fff; box-shadow: 0 3px 0 var(--navy);
  font-family: var(--font-body); font-weight: 900; font-size: .95rem; color: var(--ink); text-align: left;
}
.vote-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vote-btn .avatar { width: 28px; height: 28px; }
.vote-btn.on { background: var(--red); color: #fff; transform: translateY(2px); box-shadow: 0 1px 0 var(--navy); }
.vote-info { margin: 8px 0 0; font-size: .85rem; color: var(--muted); font-weight: 800; }
.legend { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.legend li { display: flex; align-items: center; gap: 4px; padding: 3px 10px 3px 6px; border: 2px solid var(--navy); border-radius: 999px; background: #F8FAFC; font-weight: 900; }
.legend .avatar { width: 24px; height: 24px; }
.vcount { margin-left: 4px; color: var(--red-d); }
.board-overlay.side { place-items: end; background: transparent; backdrop-filter: none; padding: 10px; pointer-events: none; }
.board-overlay.side .ov-card { max-width: 340px; padding: 12px 14px; }
.reveal-title { font-family: var(--font-title); font-size: 1.2rem; color: #fff; }
.last-chance { z-index: 70; }
.last-chance .modal-card { display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.lc-title { margin: 0; font-family: var(--font-title); font-size: 2rem; color: var(--red-d); }
.lc-cat { margin: 0; color: var(--navy); }
.wait-last { background: #FEF9C3; font-size: 1.1rem; }

/* ---------- écran de transition (début de manche) ---------- */
.transition {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle at 50% 40%, rgba(250, 204, 21, .35), transparent 60%), linear-gradient(160deg, var(--blue-1), var(--blue-2));
  animation: trIn .35s ease-out both;
}
.transition.out { animation: trOut .35s ease-in forwards; }
@keyframes trIn { from { opacity: 0; transform: scale(1.08); } to { opacity: 1; transform: scale(1); } }
@keyframes trOut { to { opacity: 0; transform: scale(.96); } }
.tr-card { background: #fff; border: 4px solid var(--navy); border-radius: 26px; box-shadow: 0 10px 0 var(--navy); padding: 22px 30px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; animation: bounceIn .6s cubic-bezier(.2, 1.4, .5, 1) both; max-width: 520px; }
.tr-round { margin: 0; font-family: var(--font-title); font-size: 1.1rem; background: var(--yellow); border: 3px solid var(--navy); border-radius: 999px; padding: 2px 14px; }
.tr-text { margin: 0; font-size: 1.15rem; color: var(--muted); }
.tr-name { margin: 0; font-family: var(--font-title); font-size: clamp(1.8rem, 6vw, 3rem); color: var(--navy); }
.tr-sub { margin: 0; color: var(--muted); }
.tr-imp { margin: 6px 0 0; font-family: var(--font-title); font-size: 1.6rem; color: #fff; background: var(--red-d); border: 3px solid var(--navy); border-radius: 14px; padding: 4px 14px; }
.tr-word { color: var(--green-d); font-size: 1.4rem; }
.tr-card .avatar.big { width: 110px; height: 110px; }

/* ---------- podium : roulement de tambour + poster ---------- */
.drumroll { font-size: 5rem; animation: shake .25s infinite; align-self: center; }
.btn-poster { width: 100%; font-size: 1.1rem; }
.gal-imp { color: var(--red-d); font-weight: 900; }


/* =====================================================================
   v7 — barre d'outils épurée, canevas PC 1080p, légende « qui a dessiné
        quoi », révélation spectaculaire de l'imposteur
   ===================================================================== */

/* ---------- barre d'outils : 10 couleurs (2 x 5) + 5 outils, sans pot de peinture ---------- */
.palette { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(5, 1fr); }
.sw { width: 34px; }
.tools { grid-template-rows: repeat(5, 1fr); }
body.is-pc .palette { grid-template-rows: repeat(5, 40px); }
body.is-pc .sw { width: 40px; height: 40px; }
body.is-pc .tools { grid-template-rows: repeat(5, 40px); }
@media (max-height: 420px) and (orientation: landscape) {
  .sw { width: 30px; min-height: 22px; }
  .palette { gap: 5px; }
  .tools { gap: 5px; }
  .sz, .tool { min-height: 24px; }
}

/* ---------- PC (≥ 1024 px) : l'écran de jeu tient entièrement dans la fenêtre ---------- */
@media (min-width: 1024px) {
  #hostGame { height: 100dvh; overflow: hidden; }
  #hostGame .game-grid { min-height: 0; overflow: hidden; }
  #hostGame .board-wrap { min-height: 0; overflow: hidden; align-items: center; justify-content: center; }
  #hostGame .paper {
    aspect-ratio: 16 / 9; height: auto; margin: 0 auto;
    width: min(100%, calc((100dvh - 175px) * 16 / 9));
    max-height: calc(100dvh - 175px);
  }
  #hostGame .side-players, #hostGame .side-chat { max-height: calc(100dvh - 135px); }
  /* joueur sur PC : le canevas des devineurs reste aussi dans l'écran */
  body.is-pc #guess .small-paper { width: min(100%, calc((100dvh - 230px) * 16 / 9)); max-height: calc(100dvh - 230px); margin: 0 auto; }
}

.vote-btn { border-color: var(--c, var(--navy)); border-width: 4px; }
#hostGame .side-chat { overflow-y: auto; }

/* ---------- révélation spectaculaire de l'imposteur ---------- */
.imp-reveal {
  position: fixed; inset: 0; z-index: 105; display: grid; place-items: center; padding: 16px;
  background: rgba(2, 6, 23, .82); overflow: hidden;
  padding-top: max(16px, env(safe-area-inset-top));
}
.ir-spot {
  position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 244, 200, .55) 0%, rgba(255, 244, 200, .12) 35%, transparent 62%);
  animation: spotSweep 1.5s ease-in-out both;
}
@keyframes spotSweep {
  0% { transform: translate(-60vw, -25vh); } 35% { transform: translate(35vw, 15vh); }
  70% { transform: translate(-20vw, 5vh); } 100% { transform: translate(0, 0); }
}
.ir-suspense { position: relative; z-index: 2; margin: 0; font-family: var(--font-title); font-size: clamp(2rem, 6vw, 3.4rem); color: #fff; text-shadow: 0 4px 0 #000; animation: shake .25s infinite; }
.imp-reveal .ir-card, .imp-reveal .ir-chip { display: none; }
.imp-reveal.shown .ir-suspense { display: none; }
.imp-reveal.shown .ir-spot { animation: none; transform: none; opacity: .9; }
.imp-reveal.shown .ir-card { display: flex; }
.ir-card {
  position: relative; z-index: 2; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  width: min(560px, 100%); max-height: 100%; overflow-y: auto;
  background: #fff; border: 5px solid var(--navy); border-radius: 26px; padding: 18px 20px 16px;
  animation: irZoom .7s cubic-bezier(.2, 1.5, .4, 1) both;
}
.artists-win .ir-card { box-shadow: 0 10px 0 var(--navy), 0 0 0 10px rgba(239, 68, 68, .45), 0 0 80px 20px rgba(239, 68, 68, .55); }
.imp-wins .ir-card { box-shadow: 0 10px 0 var(--navy), 0 0 0 10px rgba(250, 204, 21, .55), 0 0 90px 24px rgba(250, 204, 21, .6); }
@keyframes irZoom { 0% { transform: scale(.2) rotate(-8deg); opacity: 0; } 60% { transform: scale(1.08) rotate(2deg); opacity: 1; } 80% { transform: scale(.97); } 100% { transform: scale(1); } }
.ir-title { margin: 0; font-family: var(--font-title); font-size: clamp(1.3rem, 4.4vw, 2rem); line-height: 1.1; }
.artists-win .ir-title { color: var(--red-d); }
.imp-wins .ir-title { color: #B45309; }
.ir-face { position: relative; margin: 6px 0 2px; }
.ir-face .avatar.big { width: 150px; height: 150px; animation: bob 1.4s ease-in-out infinite; }
.ir-stamp {
  position: absolute; left: 50%; bottom: -6px; white-space: nowrap;
  font-family: var(--font-title); font-weight: 700; font-size: 1.15rem; letter-spacing: 1px;
  padding: 4px 14px; border-radius: 10px; border: 4px solid currentColor; background: rgba(255, 255, 255, .92);
  transform: translateX(-50%) rotate(-12deg); animation: stampIn .45s cubic-bezier(.3, 1.8, .5, 1) .55s both;
}
.artists-win .ir-stamp { color: var(--red-d); }
.imp-wins .ir-stamp { color: #B45309; }
@keyframes stampIn { 0% { transform: translateX(-50%) rotate(-12deg) scale(3); opacity: 0; } 100% { transform: translateX(-50%) rotate(-12deg) scale(1); opacity: 1; } }
.ir-name { margin: 8px 0 0; font-family: var(--font-title); font-size: clamp(2rem, 7vw, 3rem); color: var(--navy); line-height: 1; }
.ir-word { margin: 0; color: var(--muted); font-weight: 800; }
.ir-word b { color: var(--navy); font-family: var(--font-title); font-size: 1.2rem; }
.ir-sub { margin: 0; font-weight: 900; color: var(--ink); }
.ir-points { list-style: none; margin: 6px 0 4px; padding: 0; width: 100%; display: grid; gap: 6px; }
.ir-points li {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 6px; border-radius: 999px;
  border: 3px solid var(--c); background: #fff; background: color-mix(in srgb, var(--c) 12%, #FFFFFF); font-weight: 900; text-align: left;
}
.ir-points li .avatar { width: 28px; height: 28px; }
.ir-points li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ir-points li em { font-style: normal; color: var(--muted); font-size: .85rem; }
.ir-points li b { min-width: 52px; text-align: right; color: var(--muted); }
.ir-points li.won b { color: var(--green-d); font-size: 1.1rem; }
.ir-points li.is-imp { outline: 3px dashed var(--red-d); outline-offset: 2px; }
.ir-close { margin-top: 4px; }
/* réduite : bandeau cliquable en haut, le dessin et la légende redeviennent accessibles */
.imp-reveal.mini { inset: auto 0 auto 0; top: max(8px, env(safe-area-inset-top)); background: transparent; padding: 0; pointer-events: none; place-items: start center; }
.imp-reveal.mini .ir-card, .imp-reveal.mini .ir-spot { display: none; }
.imp-reveal.mini .ir-chip {
  display: block; pointer-events: auto; cursor: pointer; margin: 0 auto;
  font-family: var(--font-title); font-weight: 700; font-size: 1rem; padding: 8px 16px;
  border-radius: 999px; border: 3px solid var(--navy); box-shadow: var(--shadow-sm); animation: bounceIn .4s both;
}
.artists-win .ir-chip { background: #FEE2E2; color: var(--red-d); }
.imp-wins .ir-chip { background: #FEF3C7; color: #92400E; }

/* =====================================================================
   v8 — Mode Imposteur façon Undercover, réglages élargis, interface épurée
   ===================================================================== */

/* ---------- réglages : boutons de temps sur plusieurs lignes ---------- */
.seg-wrap button { flex: 1 0 auto; min-width: 58px; font-size: 1rem; padding: 8px 6px; }
.game-tip:empty { display: none; }
.custom-count:empty { display: none; }
.wait-msg:empty { display: none; }
.tip:empty { display: none; }

/* ---------- code du salon : espacement visuel uniquement ---------- */
.code-input { letter-spacing: .5em; text-indent: .5em; }

/* ---------- grille comparative des dessins ---------- */
.sheet-grid {
  width: 100%; max-height: 100%; overflow-y: auto; align-self: stretch;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; align-content: start;
  padding: 4px 4px 10px;
}
.sheet-grid-sm { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; max-height: none; overflow: visible; }
.sheet-empty { grid-column: 1 / -1; text-align: center; color: #fff; text-shadow: 0 2px 0 var(--navy); }
.sheet-card {
  margin: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0;
  background: #fff; border: 3px solid var(--navy); border-radius: 16px; box-shadow: var(--shadow-sm); padding: 8px;
  animation: popIn .4s both; animation-delay: calc(var(--i) * 70ms);
}
.sheet-paper {
  position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; padding: 0; cursor: zoom-in;
  border: 2px solid var(--navy); border-radius: 10px; overflow: hidden; background: #fff;
}
.sheet-paper canvas { width: 100%; height: 100%; display: block; }
.sheet-paper:focus-visible { outline: 4px solid var(--yellow); outline-offset: 2px; }
.sheet-card figcaption { display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 900; }
.sheet-who { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; }
.sheet-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-who em { font-style: normal; color: var(--muted); font-size: .85rem; }
.sheet-who .avatar { width: 28px; height: 28px; flex: none; }
.sheet-votes { white-space: nowrap; color: var(--red-d); }
.sheet-gain { white-space: nowrap; color: var(--green-d); }
.sheet-vote { width: 100%; }
.sheet-card.voted { box-shadow: 0 4px 0 var(--navy), 0 0 0 4px var(--red); }
.sheet-card.is-imp { border-color: var(--red-d); box-shadow: 0 4px 0 var(--navy), 0 0 0 5px rgba(220, 38, 38, .45); }
.sheet-stamp {
  position: absolute; top: 8px; right: 8px; transform: rotate(8deg);
  background: var(--red-d); color: #fff; border: 2px solid var(--navy); border-radius: 8px; padding: 2px 8px;
  font-family: var(--font-title); font-size: .9rem; animation: popIn .5s both .3s;
}
#boardWrap .sheet-grid { height: 100%; }
#guess .sheet-grid-sm { max-height: none; }

/* ---------- pad : bouton « J'ai terminé mon dessin » ---------- */
.pad-done {
  position: absolute; z-index: 6;
  right: max(16px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom));
  font-size: 1.05rem; padding: 10px 16px; box-shadow: 0 4px 0 var(--navy);
}
.pad-done:disabled { opacity: .6; }
@media (max-height: 420px) { .pad-done { font-size: .9rem; padding: 6px 12px; } }
.pad-reminder:empty { display: none; }

/* =====================================================================
   v10 — Mode Concours, manche suivante à la main, dessinateur mis en avant,
         salon PC sans défilement, grande grille des dessins sur PC
   ===================================================================== */

/* ---------- bouton « Manche suivante » (hôte / écran) : au-dessus de la révélation ---------- */
.next-round {
  position: fixed; left: 0; right: 0; margin: 0 auto; width: max-content; max-width: calc(100% - 32px); z-index: 108;
  bottom: max(18px, calc(env(safe-area-inset-bottom) + 12px));
  font-size: 1.35rem; padding: 14px 28px; white-space: nowrap;
  box-shadow: 0 6px 0 var(--navy), 0 0 0 6px rgba(74, 222, 128, .35);
  animation: pulse 2.2s infinite;
}
.next-round:disabled { opacity: .6; animation: none; }
.imp-reveal.shown .ir-card { margin-bottom: 70px; }

/* ---------- Imposteur / Concours : pas de journal de messages ---------- */
#hostGame.no-chat .side-chat { display: none; }
#hostGame.no-chat .game-grid { grid-template-columns: 260px minmax(0, 1fr); }
@media (max-width: 1100px) { #hostGame.no-chat .game-grid { grid-template-columns: 200px minmax(0, 1fr); } }
@media (max-width: 760px) { #hostGame.no-chat .game-grid { grid-template-columns: 1fr; } }
#guess.imp-mode #feed { display: none; }

/* ---------- qui dessine ? bandeau au-dessus du canevas ---------- */
.turn-hint {
  display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
  background: var(--yellow); color: var(--navy); text-shadow: none;
  border: 4px solid var(--navy); border-radius: 999px; box-shadow: 0 5px 0 var(--navy);
  padding: 4px 22px 4px 8px; animation: popIn .4s both;
}
.turn-hint .avatar { width: 64px; height: 64px; }
.turn-hint b { color: var(--navy) !important; font-size: 1.15em; }
.turn-hint em { font-style: normal; font-size: .75em; opacity: .8; }
.hint-sm .turn-hint { gap: 6px; padding: 2px 12px 2px 4px; border-width: 3px; box-shadow: 0 3px 0 var(--navy); }
.hint-sm .turn-hint .avatar { width: 36px; height: 36px; }

/* ---------- liste des joueurs : dessinateur doré et pulsant, les autres en retrait ---------- */
@keyframes goldPulse {
  0%, 100% { box-shadow: 0 0 0 3px #FACC15, 0 0 10px 2px rgba(250, 204, 21, .55); }
  50% { box-shadow: 0 0 0 4px #FACC15, 0 0 26px 8px rgba(250, 204, 21, .9); }
}
@keyframes pencil { 0%, 100% { transform: rotate(-12deg) translateY(0); } 50% { transform: rotate(14deg) translateY(-3px); } }
.turn-on .drawing { background: linear-gradient(135deg, #FEF9C3, #FDE047) !important; animation: goldPulse 1.4s ease-in-out infinite; z-index: 1; }
.turn-on .drawing .badge, .turn-on .drawing .pencil { display: inline-block; animation: pencil .6s ease-in-out infinite; font-size: 1.3rem; }
.turn-on > li:not(.drawing) { opacity: .45; filter: saturate(.6); transition: opacity .3s; }
#gamePlayers.turn-on .prow.drawing { transform: scale(1.04); }

/* ---------- Concours : qui a terminé ? ---------- */
.x-wait { max-width: 92%; }
.x-wait h2 { font-size: clamp(1.6rem, 4cqw, 3rem); color: var(--navy); }
.x-done { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.x-done li { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border: 2px solid var(--navy); border-radius: 999px; background: #F8FAFC; font-weight: 900; opacity: .6; }
.x-done li.done { background: #DCFCE7; opacity: 1; }
.x-done .avatar { width: 30px; height: 30px; }

/* ---------- grille : gagnant du concours, dessins anonymes ---------- */
.sheet-win { background: var(--yellow); color: var(--navy); }
.sheet-card.is-winner { border-color: #CA8A04; animation: popIn .4s both, goldPulse 1.6s ease-in-out infinite .4s; }
.sheet-anon b { color: var(--navy); }

/* ---------- type de partie : 3 choix ---------- */
.seg-games { display: grid; grid-template-columns: repeat(3, 1fr); }
.seg-games button { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; padding: 8px 4px; font-size: .95rem; line-height: 1.1; }
.seg-games .m-ico { font-size: 1.4rem; }

/* ---------- PC (≥ 1024 px) ---------- */
@media (min-width: 1024px) {
  /* salon hôte : tout tient dans l'écran, sans défilement (pub comprise) */
  #hostLobby { height: 100dvh; overflow: hidden; padding-top: 10px; padding-bottom: 10px; }
  #hostLobby .host-top { margin-bottom: 8px; }
  #hostLobby .lobby-grid { min-height: 0; align-items: stretch; gap: 16px; grid-template-columns: 1fr .95fr 1.25fr; }
  #hostLobby .card { min-height: 0; padding: 14px 16px; }
  #hostLobby .join-card { display: flex; flex-direction: column; justify-content: center; }
  #hostLobby .room-code { font-size: clamp(3rem, 6.2vw, 6.4rem); margin: 6px 0 12px; }
  #hostLobby .qr { width: 160px; height: 160px; }
  #hostLobby .players-card { display: flex; flex-direction: column; }
  #hostLobby .lobby-players { overflow-y: auto; min-height: 0; padding: 2px; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
  #hostLobby .pcard .avatar { width: 54px; height: 54px; }
  #hostLobby .settings-card { max-height: none; overflow: hidden; display: flex; flex-direction: column; }
  #hostLobby .settings-card h2 { margin-bottom: 2px; }
  #hostLobby .settings-body { display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; align-content: start; min-height: 0; }
  #hostLobby .set-block.sb-wide { grid-column: 1 / -1; }
  #hostLobby .set-block[hidden] { display: none !important; }
  #hostLobby .set-label { margin: 6px 0 4px; font-size: .9rem; }
  #hostLobby .seg { gap: 6px; }
  #hostLobby .seg button { padding: 6px 4px; font-size: .95rem; box-shadow: 0 2px 0 var(--navy); }
  #hostLobby .seg-modes button, #hostLobby .seg-games button { flex-direction: row; justify-content: center; gap: 4px; padding: 6px 4px; font-size: .85rem; }
  #hostLobby .seg-modes .m-ico, #hostLobby .seg-games .m-ico { font-size: 1.1rem; }
  #hostLobby .game-tip, #hostLobby .mode-tip { margin: 4px 0 0; font-size: .8rem; min-height: 0; }
  #hostLobby .cat-select { padding: 6px 8px; font-size: .95rem; }
  #hostLobby .custom-words { min-height: 38px; height: 38px; padding: 6px 8px; font-size: .9rem; resize: none; }
  #hostLobby .check { margin-top: 4px; font-size: .9rem; }
  #hostLobby .custom-count { margin-top: 2px; }
  #hostLobby .btn-big { margin-top: auto; padding: 12px; font-size: 1.25rem; flex: none; }
  #hostLobby .ad-banner { margin-top: 10px; flex: none; }

  /* grande grille des dessins (vote / révélation) */
  .sheet-grid, .sheet-grid-sm { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; align-content: center; }
  .sheet-paper { aspect-ratio: 16 / 9; }
  .sheet-card { padding: 10px; }
  .sheet-card figcaption { font-size: 1.05rem; }
  #boardWrap .sheet-grid { max-height: 100%; overflow-y: auto; }
  #guess.imp-mode .guess-main { grid-template-columns: minmax(0, 1fr) 300px; }
  #reveal .phone-wrap.center { max-width: 1280px; }
  #reveal .sheet-grid { width: 100%; }
}
/* grille compacte (mobile) : le pseudo sur sa propre ligne, votes et points dessous */
.sheet-grid-sm .sheet-card figcaption { flex-wrap: wrap; row-gap: 2px; }
.sheet-grid-sm .sheet-who { flex-basis: 100%; }
@media (min-width: 1024px) { .sheet-grid-sm .sheet-who { flex-basis: auto; } .sheet-grid-sm .sheet-card figcaption { flex-wrap: nowrap; } }

/* =====================================================================
   v11 — notation par étoiles, réactions 💩 👎, finitions visuelles
   ===================================================================== */

/* ---------- Concours : 5 étoiles sous chaque dessin adverse ---------- */
.star-bar { display: flex; justify-content: center; gap: 2px; padding-top: 2px; }
.star {
  background: none; border: 0; padding: 2px 3px; cursor: pointer; line-height: 1;
  font-size: 1.75rem; color: #CA8A04; transition: transform 80ms ease;
}
.star.on { color: #FACC15; text-shadow: 0 2px 0 var(--navy); }
.star:hover { transform: scale(1.15); }
.star:active { transform: scale(.9); }
.star:focus-visible { outline: 3px solid var(--yellow); border-radius: 6px; }
.sheet-rating { white-space: nowrap; color: #B45309; font-weight: 900; }

/* ---------- Imposteur : bordure rouge + badge à côté du pseudo (dessin jamais masqué) ---------- */
.sheet-card.is-imp { border-color: var(--red-d); box-shadow: 0 4px 0 var(--navy), 0 0 0 4px var(--red-d); }
.imp-badge {
  flex: none; margin-left: 4px; padding: 1px 8px; border-radius: 999px; white-space: nowrap;
  background: var(--red-d); color: #fff; font-size: .72rem; font-weight: 900; letter-spacing: .3px;
}
.imp-reveal .ir-chip { display: none !important; }

/* ---------- réactions : 5 boutons égaux ---------- */
.react-btn { font-size: 1.45rem; min-width: 0; }

/* ---------- salon : QR code, URL et bouton parfaitement centrés ---------- */
.join-row { flex-direction: column; align-items: center; justify-content: center; gap: 10px; margin: 0 auto; }
.join-how { display: flex; flex-direction: column; align-items: center; text-align: center; margin: 0 auto; }
.qr { margin: 0 auto; }

/* ---------- réglages : réponse immédiate au clic ---------- */
.seg button { transition: transform 80ms ease, background-color 80ms ease, box-shadow 80ms ease; }
.seg button:active { transform: scale(.95); box-shadow: 0 1px 0 var(--navy); }
.seg button.on:active { transform: translateY(2px) scale(.95); }

/* ---------- carte du dessinateur actif : jamais rognée ---------- */
#gamePlayers { padding: 6px 6px 8px; }
#gamePlayers .prow { box-sizing: border-box; width: 100%; max-width: 100%; }
#gamePlayers.turn-on .prow.drawing { transform: none; animation: goldPulseIn 1.4s ease-in-out infinite; }
@keyframes goldPulseIn {
  0%, 100% { box-shadow: 0 0 0 3px #FACC15, 0 0 6px 1px rgba(250, 204, 21, .5); }
  50% { box-shadow: 0 0 0 4px #FACC15, 0 0 10px 3px rgba(250, 204, 21, .85); }
}

/* ---------- PC : aucune barre de défilement parasite ---------- */
@media (min-width: 1024px) {
  html, body { height: 100dvh; max-height: 100dvh; overflow: hidden; }
  .screen { height: 100dvh; max-height: 100dvh; min-height: 0; overflow-x: hidden; overflow-y: auto; scrollbar-width: thin; }
  #hostLobby, #hostGame { overflow: hidden; }
  #hostLobby .lobby-grid, #hostLobby .card, #hostGame .game-grid { min-height: 0; }
}

/* =====================================================================
   v12 — salon PC défilable, QR centré, journal masqué sur mobile,
   étoiles du Concours, rotation mobile fluide
   ===================================================================== */

/* ---------- QR code : centrage réel (l'image ne déborde plus de sa boîte) ---------- */
.join-card { display: flex; flex-direction: column; align-items: center; text-align: center; }
.join-row { width: 100%; }
.qr {
  box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; margin: 0 auto; overflow: hidden;
}
.qr img, .qr canvas { margin: 0 auto; max-width: 100%; max-height: 100%; width: auto; height: auto; }

/* ---------- PC : réglages défilables, le bouton « Lancer » ne chevauche jamais rien ---------- */
@media (min-width: 1024px) {
  #hostLobby { overflow-x: hidden; overflow-y: auto; }
  #hostLobby .lobby-grid { flex: 1 1 auto; grid-template-rows: minmax(0, 1fr); }
  #hostLobby .settings-card { overflow: hidden; }
  #hostLobby .settings-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 2px 4px 6px 2px; scrollbar-width: thin; }
  #hostLobby .btn-big { position: relative; margin-top: 10px; flex: none; }
}
/* fenêtre basse : la page entière défile au lieu d'écraser les cartes */
@media (min-width: 1024px) and (max-height: 760px) {
  #hostLobby .lobby-grid { flex: none; min-height: 600px; }
}

/* ---------- mobile : aucun journal système (« X dessine… », « Manche X/Y ») ---------- */
body:not(.is-pc) #feed,
body:not(.is-pc) .feed { display: none !important; }
@media (max-width: 1023px), (pointer: coarse) and (max-width: 1366px) {
  #guess #feed, #guess .feed { display: none !important; }
}

/* ---------- Concours : notation tactile claire (5 grosses étoiles) ---------- */
.star-rate { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 4px 2px; }
.star-label { margin: 0; font-size: .85rem; font-weight: 900; color: var(--navy); text-align: center; }
.star-bar { display: flex; justify-content: center; gap: 8px; padding: 0; }
.star {
  -webkit-appearance: none; appearance: none; flex: none;
  width: 44px; height: 44px; min-width: 44px; padding: 0; margin: 0;
  display: grid; place-items: center; line-height: 1; font-size: 2rem;
  background: #F1F5F9; color: #CBD5E1; border: 2px solid #CBD5E1; border-radius: 12px;
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  text-shadow: none; transition: transform 60ms ease, background-color 60ms ease, color 60ms ease;
}
.star.on { background: #FEF3C7; color: #FACC15; border-color: var(--navy); text-shadow: 0 2px 0 var(--navy); box-shadow: 0 2px 0 var(--navy); }
.star:active { transform: scale(.88); }
@media (hover: hover) and (pointer: fine) {
  .star-bar:hover .star { background: #FEF3C7; color: #FACC15; border-color: var(--navy); }
  .star-bar .star:hover ~ .star { background: #F1F5F9; color: #CBD5E1; border-color: #CBD5E1; text-shadow: none; box-shadow: none; }
  .star:hover { transform: scale(1.08); }
}
.star-badge {
  margin: 2px 0 0; padding: 2px 10px; border-radius: 999px; font-size: .85rem; font-weight: 900;
  background: #F1F5F9; color: var(--muted); border: 2px dashed #CBD5E1;
}
.star-badge.on { background: #FACC15; color: var(--navy); border: 2px solid var(--navy); }
@media (max-width: 380px) { .star { width: 38px; height: 38px; min-width: 38px; font-size: 1.7rem; } .star-bar { gap: 5px; } }
/* étoiles : jamais de débordement — elles se partagent la largeur de la carte (44 px max) */
.star-rate { width: 100%; min-width: 0; box-sizing: border-box; }
.star-bar { width: 100%; max-width: 260px; gap: 6px; }
.star { flex: 1 1 0; width: auto; min-width: 0; max-width: 44px; height: auto; aspect-ratio: 1 / 1; font-size: clamp(1.1rem, 7vw, 2rem); }
/* mobile : notation sur une colonne, gros dessins et grosses étoiles */
@media (max-width: 1023px) {
  .sheet-grid-sm:has(.star-rate) { grid-template-columns: 1fr; }
}

/* =====================================================================
   v13 — salon sans barre de défilement fugace, podium Concours
   ===================================================================== */

/* ---------- salon : arrivée d'un joueur sans débordement (≤ 8 joueurs : jamais de barre) ---------- */
@keyframes cardIn { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: scale(1); } }
.lobby-players .pcard.pop, .wait-players li { animation: cardIn .35s cubic-bezier(.2, .9, .3, 1) both; animation-delay: calc(var(--i, 0) * 40ms); }
.lobby-players.few, #hostLobby .lobby-players.few, .wait-players.few { overflow: hidden; }

/* ---------- Concours : podium à 3 marches ---------- */
.sheet-grid.x-podium-mode { display: block; padding-bottom: 96px; } /* place pour « Manche suivante » */
.xp-wrap { display: flex; flex-direction: column; align-items: center; gap: 18px; width: 100%; }
.xp-podium { display: flex; align-items: flex-end; justify-content: center; gap: clamp(8px, 2vw, 22px); width: 100%; max-width: 1100px; padding-top: 6px; }
.xp-step { position: relative; margin: 0; flex: 1 1 0; min-width: 0; max-width: 340px; display: flex; flex-direction: column; align-items: stretch; gap: 10px; animation: xpRise .6s cubic-bezier(.2, 1.2, .4, 1) both; }
.xp-r1 { animation-delay: .5s; z-index: 2; max-width: 380px; }
.xp-r2 { animation-delay: .25s; }
.xp-r3 { animation-delay: 0s; }
@keyframes xpRise { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
.xp-art {
  position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; padding: 0; cursor: zoom-in;
  background: #fff; border: 3px solid var(--navy); border-radius: 14px; overflow: visible; box-shadow: var(--shadow-sm);
}
.xp-art canvas { width: 100%; height: 100%; display: block; border-radius: 11px; }
.xp-art:focus-visible { outline: 4px solid var(--yellow); outline-offset: 3px; }
.xp-r1 .xp-art { border-color: #CA8A04; box-shadow: 0 6px 0 var(--navy), 0 0 0 5px rgba(250, 204, 21, .6); animation: goldPulse 1.8s ease-in-out infinite 1.1s; }
.xp-medal { position: absolute; top: -16px; left: -12px; font-size: 2.2rem; line-height: 1; filter: drop-shadow(0 2px 0 var(--navy)); }
.xp-block {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px; text-align: center;
  border: 3px solid var(--navy); border-radius: 14px 14px 6px 6px; box-shadow: 0 6px 0 var(--navy); padding: 10px 8px; color: var(--navy);
}
.xp-r1 .xp-block { min-height: 150px; background: linear-gradient(#FDE047, #EAB308); }
.xp-r2 .xp-block { min-height: 115px; background: linear-gradient(#F1F5F9, #CBD5E1); }
.xp-r3 .xp-block { min-height: 85px; background: linear-gradient(#FDBA74, #D97706); }
.xp-place { font-family: var(--font-title); font-size: 1.5rem; line-height: 1; }
.xp-r1 .xp-place { font-size: 2rem; }
.xp-who { display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; max-width: 100%; font-weight: 900; }
.xp-who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xp-who em { font-style: normal; font-size: .85rem; }
.xp-who .avatar { width: 34px; height: 34px; flex: none; }
.xp-r1 .xp-who .avatar { width: 44px; height: 44px; }
.xp-score { font-weight: 900; font-size: 1.1rem; white-space: nowrap; }
.xp-score small { font-size: .8rem; opacity: .8; }
.xp-gain { background: #fff; border: 2px solid var(--navy); border-radius: 999px; padding: 0 10px; font-weight: 900; color: var(--green-d); }
.xp-mine .xp-block { outline: 3px dashed #fff; outline-offset: -8px; }
/* confettis légers sur le 1er (dans sa marche, sans déborder de l'écran) */
.xp-confetti { position: absolute; inset: -30px -6px auto; height: 80%; pointer-events: none; overflow: hidden; z-index: 3; }
.xp-confetti i {
  position: absolute; top: -12px; left: var(--x); width: 7px; height: 11px; border-radius: 2px;
  background: hsl(var(--h), 90%, 60%); animation: xpFall 2.6s linear infinite; animation-delay: var(--d);
}
@keyframes xpFall { from { transform: translateY(0) rotate(0); opacity: 1; } to { transform: translateY(320px) rotate(540deg); opacity: 0; } }
/* dessins suivants (4e et plus) : petite rangée sous le podium */
.xp-rest { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; width: 100%; }
.xp-mini {
  display: flex; flex-direction: column; gap: 4px; width: 210px; max-width: calc(50% - 5px); padding: 6px; cursor: zoom-in;
  background: #fff; border: 2px solid var(--navy); border-radius: 12px; box-shadow: var(--shadow-sm); font: inherit; color: var(--navy);
}
.xp-mini canvas { width: 100%; aspect-ratio: 16 / 9; border: 1px solid #CBD5E1; border-radius: 8px; }
.xp-mini-who { display: flex; align-items: center; gap: 4px; font-size: .8rem; font-weight: 900; min-width: 0; white-space: nowrap; overflow: hidden; }
.xp-mini-who b { overflow: hidden; text-overflow: ellipsis; }
.xp-mini-who .avatar { width: 20px; height: 20px; flex: none; }
.xp-mini-who em { font-style: normal; color: var(--green-d); }
/* écran hôte PC : le podium tient dans la zone de jeu */
@media (min-width: 1024px) {
  #boardWrap .sheet-grid.x-podium-mode { display: flex; flex-direction: column; justify-content: center; overflow-y: auto; }
  #boardWrap .xp-step { max-width: min(340px, 30vh * 16 / 9); }
  #boardWrap .xp-r1 { max-width: min(380px, 34vh * 16 / 9); }
  .xp-r1 .xp-block { min-height: 230px; } .xp-r2 .xp-block { min-height: 180px; } .xp-r3 .xp-block { min-height: 140px; }
  .xp-block { justify-content: center; }
}
@media (min-width: 1024px) and (max-height: 760px) {
  .xp-r1 .xp-block { min-height: 175px; } .xp-r2 .xp-block { min-height: 140px; } .xp-r3 .xp-block { min-height: 110px; }
}
/* téléphone : marches serrées, socles plus bas */
@media (max-width: 600px) {
  .xp-podium { gap: 6px; }
  .xp-medal { font-size: 1.6rem; top: -12px; left: -8px; }
  .xp-r1 .xp-block { min-height: 112px; } .xp-r2 .xp-block { min-height: 86px; } .xp-r3 .xp-block { min-height: 64px; }
  .xp-block { padding: 6px 4px; border-width: 2px; }
  .xp-place { font-size: 1.15rem; } .xp-r1 .xp-place { font-size: 1.4rem; }
  .xp-who { flex-direction: column; gap: 2px; font-size: .8rem; }
  .xp-who .avatar, .xp-r1 .xp-who .avatar { width: 28px; height: 28px; }
  .xp-score { font-size: .85rem; } .xp-score small { display: none; }
  .xp-gain { font-size: .75rem; padding: 0 6px; }
}
@media (prefers-reduced-motion: reduce) { .xp-confetti { display: none; } .xp-step, .xp-r1 .xp-art { animation: none; } }

/* =====================================================================
   v14 — difficulté des mots (Facile / Moyen / Difficile)
   ===================================================================== */
.word-card { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.wc-word { line-height: 1.1; word-break: break-word; }
.lv-badge {
  display: inline-flex; align-items: center; gap: 6px; vertical-align: middle;
  font-family: var(--font-body, "Nunito", sans-serif); font-weight: 900; font-size: 1rem; line-height: 1;
  background: #fff; color: var(--navy); border: 2px solid var(--navy); border-radius: 999px; padding: 4px 10px;
}
.lv-stars { color: #EAB308; letter-spacing: 1px; text-shadow: 0 1px 0 var(--navy); }
.lv-bonus { background: var(--navy); color: #fff; border-radius: 999px; padding: 2px 7px; font-size: .85rem; }
.lv2 .lv-bonus { background: #2563EB; }
.lv3 .lv-bonus { background: #DC2626; }
.lv3 { box-shadow: 0 0 0 3px rgba(220, 38, 38, .25); }
.lv-inline { font-size: .85rem; padding: 3px 8px; margin-left: 4px; }
.found .lv-inline { margin: 6px auto 0; }
.hint .lv-hint { align-self: center; margin-left: 8px; font-size: .95rem; }
.reveal-bonus { margin: 8px 0 0; font-weight: 900; display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
#revealTitle .lv-badge { font-size: .8rem; }


/* =====================================================================
   v15 — Infos & Confidentialité (accueil) + écran de transition opaque
   ===================================================================== */

/* ---------- bouton « Infos & Confidentialité » : même DA que les cartes, centré sous les 3 cartes ---------- */
.info-btn {
  display: flex; align-items: center; gap: 12px; width: max-content; max-width: 100%;
  margin: 20px auto calc(28px + env(safe-area-inset-bottom));
  font-family: var(--font-title); font-weight: 700; font-size: 1.05rem; line-height: 1; color: #1e3a8a;
  background: #ffffff; border: 3px solid #1e3a8a; border-radius: 999px; box-shadow: 0 4px 0 #1e3a8a;
  padding: 8px 20px 8px 8px; min-height: 48px; cursor: pointer;
  transition: transform .08s, box-shadow .08s, filter .15s;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.info-btn:hover { filter: brightness(1.04); transform: translateY(-1px); }
.info-btn:active { transform: translateY(4px); box-shadow: 0 0 0 #1e3a8a; }
.info-btn:focus-visible { outline: 4px solid var(--yellow); outline-offset: 3px; }
.info-q {
  flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--yellow); border: 2px solid #1e3a8a; font-family: var(--font-title); font-weight: 700; font-size: 1rem; color: #1e3a8a;
}
.info-label { white-space: nowrap; }
@media (max-width: 360px) { .info-btn { font-size: .95rem; gap: 9px; padding-right: 16px; } }

/* ---------- modale : carte large et confortable (PC), plein usage sur mobile ---------- */
.info-modal { z-index: 130; padding: 16px; }
.modal-card.info-card {
  position: relative; text-align: left;
  width: 92%; max-width: 680px; max-height: 82vh; max-height: 82dvh; overflow-y: auto; overscroll-behavior: contain;
  background: #fff; border-radius: 24px; border: 3px solid #1e3a8a; box-shadow: 0 8px 0 #1e3a8a; padding: 28px;
  animation: popIn .3s cubic-bezier(.2, 1.2, .5, 1) both;
}
.info-card h2 { color: #1e3a8a; font-size: 1.5rem; margin: 0 52px 12px 0; line-height: 1.2; }
.info-card h3 { font-family: var(--font-title); color: #1e3a8a; font-size: 1.1rem; margin: 18px 0 4px; }
.info-card p { margin: 0 0 8px; font-weight: 700; font-size: .97rem; line-height: 1.55; color: var(--ink); }
.info-card b { font-weight: 900; }
/* ✕ : pastille du jeu, en haut à droite, toujours visible pendant le défilement */
.info-close {
  position: sticky; top: 0; float: right; z-index: 2; margin: -10px -10px 0 12px;
  width: 42px; height: 42px; display: grid; place-items: center; padding: 0;
  font-family: var(--font-title); font-size: 1.15rem; font-weight: 700; color: #1e3a8a; line-height: 1;
  background: var(--yellow); border: 3px solid #1e3a8a; border-radius: 50%; box-shadow: 0 3px 0 #1e3a8a; cursor: pointer;
  transition: transform .08s, box-shadow .08s;
}
.info-close:hover { transform: translateY(-1px) rotate(90deg); }
.info-close:active { transform: translateY(3px); box-shadow: 0 0 0 #1e3a8a; }
.info-close:focus-visible { outline: 4px solid var(--yellow); outline-offset: 2px; }
.info-links { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 8px; clear: both; }
.info-links .btn { flex: 1 1 220px; }
.info-contact { text-align: center; font-size: .88rem !important; color: var(--muted) !important; margin: 8px 0 0 !important; }
.info-contact a { color: #1D4ED8; }
@media (max-width: 560px) {
  .modal-card.info-card { width: 100%; max-height: 88dvh; padding: 22px 18px; }
  .info-card h2 { font-size: 1.28rem; }
}

/* ---------- écran de transition « Manche X/Y — C'est au tour de… » : 100 % opaque ----------
   Le fond (dégradé + motif du jeu) est toujours opaque : on ne fait plus de fondu d'opacité sur l'overlay
   (qui laissait voir l'écran précédent). Entrée en volet circulaire, sortie en fondu vers le nouvel écran. */
.transition {
  background-color: var(--blue-1);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220' fill='none' stroke='%23fff' stroke-opacity='.14' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M30 40 l8 -18 l8 18 l-16 -11 h16z'/%3E%3Cpath d='M150 30 q15 -15 30 0 t30 0'/%3E%3Crect x='120' y='120' width='60' height='14' rx='4' transform='rotate(-35 150 127)'/%3E%3Cpath d='M180 100 l12 -8'/%3E%3Ccircle cx='60' cy='150' r='16'/%3E%3Cpath d='M20 200 q20 -30 40 0 q20 30 40 0'/%3E%3Cpath d='M100 70 l12 12 m0 -12 l-12 12'/%3E%3Cpath d='M190 190 l10 -20 l10 20z'/%3E%3C/svg%3E"),
    radial-gradient(circle at 50% 40%, rgba(250, 204, 21, .35), rgba(250, 204, 21, 0) 60%),
    linear-gradient(160deg, var(--blue-1), var(--blue-2));
  background-size: 220px 220px, auto, auto;
  opacity: 1;
  animation: trWipe .42s cubic-bezier(.4, 0, .2, 1) both;
  will-change: clip-path;
}
.transition.out { animation: trLeave .35s ease-in forwards; }
@keyframes trWipe { from { clip-path: circle(0% at 50% 45%); } to { clip-path: circle(150% at 50% 45%); } }
@keyframes trLeave { from { opacity: 1; } to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .transition { animation: none; } }

/* =====================================================================
   v16 — salon : arrivée animée une seule fois, aucun débordement horizontal,
         défilement vertical immédiat sur Chrome mobile (iOS & Android)
   ===================================================================== */

/* ---------- arrivée d'un joueur : l'animation ne joue que sur les cartes .enter (vraie première arrivée) ---------- */
.lobby-players > li, .wait-players > li, .lobby-players .pcard.pop { animation: none; }
.lobby-players > li.enter, .wait-players > li.enter { animation: cardIn .35s cubic-bezier(.2, .9, .3, 1) both; animation-delay: calc(var(--i, 0) * 40ms); }

/* ---------- jamais de débordement horizontal ----------
   `overflow-x: hidden` sur html + body ; `clip` quand il est pris en charge : il coupe aussi le débordement
   mais, contrairement à `hidden`, ne transforme pas <body> en conteneur défilant (sinon le défilement vertical
   se bloque sur mobile). */
html, body { max-width: 100%; overflow-x: hidden; }
@supports (overflow-x: clip) { html, body { overflow-x: clip; } }
.screen, .home-wrap, .phone-wrap, .host { max-width: 100%; }
.lobby-grid > *, .phone-wrap > * { min-width: 0; }

/* ---------- défilement vertical du salon : immédiat dès le premier geste ----------
   Les écrans du salon (#wait, #hostLobby) ne deviennent PAS des conteneurs défilants sur mobile : avec
   overscroll-behavior: none, un geste commencé dedans ne remonterait plus jusqu'à la page. Ils autorisent
   seulement le glissement vertical ; les listes internes défilent elles-mêmes si besoin. */
#hostLobby, #wait { touch-action: pan-y; -webkit-overflow-scrolling: touch; }
.settings-body, .lobby-players, .wait-players {
  overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; touch-action: pan-y; overscroll-behavior-y: auto;
}
/* ≤ 8 joueurs : toujours aucune barre de défilement dans la liste */
.lobby-players.few, #hostLobby .lobby-players.few, .wait-players.few { overflow: hidden; }

/* ---------- salon hôte sur petit écran : cartes centrées, code de salle qui tient dans la largeur ---------- */
@media (max-width: 700px) {
  .lobby-grid, #hostLobby .lobby-grid { grid-template-columns: minmax(0, 1fr); }
  .room-code { font-size: clamp(2.4rem, 12.5vw, 4rem); gap: clamp(4px, 1.6vw, 10px); }
  .room-code span { padding: 6px clamp(6px, 2.4vw, 14px) 2px; border-width: 3px; box-shadow: 0 6px 0 var(--navy); }
  .qr img, .qr canvas { max-width: 100%; height: auto; }
  .join-url { overflow-wrap: anywhere; }
}
/* joueur momentanément déconnecté (micro-coupure, mise en veille) : carte en retrait pendant le délai de grâce */
.lobby-players > li.away, .wait-players > li.away { opacity: .45; filter: grayscale(.6); transition: opacity .3s, filter .3s; }
/* difficulté des mots : « Facile — Points normaux » / « Moyen — Plus de points » / « Difficile — Encore plus de points » */
.lv-badge { gap: 0; }
.lv-name { font-family: var(--font-title); font-weight: 700; }
.lv-desc { font-weight: 800; color: var(--muted); }
.lv-desc::before { content: "\00a0—\00a0"; color: var(--navy); }
.lv1 .lv-name { color: var(--green-d); }
.lv2 .lv-name { color: #2563EB; }
.lv3 .lv-name { color: var(--red-d); }
.lv3 { box-shadow: none; border-color: var(--red-d); }
