/* Faux Raccord - mise en page propre à chaque écran */
.hero { position: relative; display: grid; justify-items: center; gap: 4px; margin-bottom: 8px; }
.hero .sticker { position: absolute; top: -18px; right: -4px; }
.stack { display: grid; gap: 18px; }
.topbar { display: flex; justify-content: flex-start; }
.title { margin: 0; text-align: center; font: 400 2rem/1.1 var(--font-title); text-shadow: var(--outline); }
.note { margin: 0; text-align: center; font-size: .9rem; opacity: .85; }

/* Écran « Rejoindre » */
.field input.codeinput { font: 400 2.4rem var(--font-title); letter-spacing: .2em; text-indent: .2em; text-transform: uppercase; }

/* Écran « Salon » (données fictives à ce stade) */
.codecard {
  appearance: none; display: grid; gap: 2px; justify-items: center; padding: 14px 10px 12px;
  color: var(--ink); background: var(--yellow); cursor: pointer; touch-action: manipulation;
  border: 4px solid var(--ink); border-radius: 22px; box-shadow: 8px 8px 0 var(--pink);
  transform: rotate(-2deg); font-family: var(--font-body);
}
.codecard:active { transform: rotate(-2deg) translate(3px, 3px); box-shadow: 4px 4px 0 var(--pink); }
.codecard__label { font-weight: 700; }
.codecard__code { font: 400 3rem/1 var(--font-title); letter-spacing: .1em; text-indent: .1em; }
.codecard__hint { font-size: .85rem; font-weight: 600; opacity: .75; }

.players { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.player {
  display: flex; align-items: center; gap: 8px; min-width: 0; padding: 8px 10px;
  font-weight: 700; color: var(--ink); background: var(--paper);
  border: 4px solid var(--ink); border-radius: 16px; box-shadow: 0 4px 0 var(--ink);
}
.player:nth-child(odd)  { transform: rotate(-1deg); }
.player:nth-child(even) { transform: rotate(1deg); }
.player__avatar {
  flex: none; display: grid; place-items: center; width: 38px; height: 38px; font-size: 1.3rem;
  background: var(--c); border: 3px solid var(--ink); border-radius: 50%;
}
.player__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player--empty { color: rgba(255, 255, 255, .75); background: transparent; border: 4px dashed rgba(255, 255, 255, .5); box-shadow: none; }
.count { margin: 0; text-align: center; font: 400 1.1rem var(--font-title); text-shadow: 0 2px 0 var(--ink); }

/* Étape 2 : états des joueurs et boutons masqués */
.player--offline { opacity: .45; }
.player--me { box-shadow: 0 4px 0 var(--ink), 0 0 0 3px var(--yellow); }
.btn[hidden] { display: none; }

/* Étape 3 : réglages du salon et écran de partie */
.settings { display: grid; gap: 10px; padding: 12px 14px; background: rgba(25, 11, 58, .6); border: 4px solid var(--ink); border-radius: 18px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; font-weight: 700; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper strong { min-width: 3.4ch; text-align: center; font: 400 1.3rem var(--font-title); }
.stepper .btn--icon { min-width: 44px; font-size: 1.4rem; }

.stage { display: flex; flex-direction: column; gap: 18px; }
.roundbar { display: flex; align-items: center; justify-content: space-between; }
.bigcount { margin: 0; text-align: center; font: 400 7rem/1 var(--font-title); color: var(--yellow); text-shadow: var(--outline), 0 8px 0 var(--pink); }
.prompt { font-size: 1.15rem; }
.photo { margin: 0; overflow: hidden; background: #fff; border: 4px solid var(--ink); border-radius: 18px; box-shadow: 0 6px 0 var(--ink); transform: rotate(-1deg); }
.photo img { display: block; width: 100%; height: auto; max-height: 38vh; object-fit: contain; }
.player__badge { flex: none; margin-left: auto; }

/* Chronomètre : anneau qui se vide (--p = pourcentage de temps restant) */
.timer {
  --p: 100; position: relative; display: grid; place-items: center; flex: none; width: 84px; height: 84px;
  background: conic-gradient(var(--pink) calc(var(--p) * 1%), rgba(255, 255, 255, .3) 0);
  border: 4px solid var(--ink); border-radius: 50%; box-shadow: 0 5px 0 var(--ink);
}
.timer::before { content: ""; position: absolute; inset: 8px; background: var(--paper); border: 3px solid var(--ink); border-radius: 50%; }
.timer span { position: relative; font: 400 1.9rem var(--font-title); color: var(--ink); }
.timer--urgent { animation: urgent .5s ease-in-out infinite alternate; }
.timer--urgent span { color: var(--pink); }
@keyframes urgent { to { transform: scale(1.12) rotate(4deg); } }

/* Étape 4 : éditeur de mèmes, galerie des créations */
.topbar { justify-content: space-between; align-items: center; gap: 10px; }
.topslot { display: flex; align-items: center; gap: 10px; }
.sticker--sm { padding: 4px 12px; font-size: .85rem; }
.timer--sm { width: 54px; height: 54px; box-shadow: 0 3px 0 var(--ink); }
.timer--sm::before { inset: 6px; border-width: 2px; }
.timer--sm span { font-size: 1.25rem; }
.title--sm { font-size: 1.6rem; }

/* Mise en page compacte pendant la création : tout tient sur un petit téléphone */
.is-editing #app { padding: 8px 10px max(10px, env(safe-area-inset-bottom)); }
.is-editing .screen { gap: 8px; justify-content: flex-start; }
.is-editing .stage { gap: 8px; }
.prompt--compact { margin: 0 0 12px; padding: 8px 12px; font-size: 1rem; line-height: 1.2; border-width: 3px; box-shadow: 0 3px 0 var(--ink); }
.prompt--compact::before { bottom: -26px; border-width: 13px 10px; }
.prompt--compact::after { bottom: -19px; border-width: 11px 8px; }

.editor { display: flex; flex-direction: column; gap: 8px; }
.editor__canvas {
  display: grid; place-items: center; width: 100%; height: clamp(200px, 40vh, 430px); height: clamp(200px, 40dvh, 430px);
  background: rgba(25, 11, 58, .55); border: 4px solid var(--ink); border-radius: 16px; overflow: hidden;
  touch-action: none; user-select: none; -webkit-user-select: none;
}
.editor__canvas * { touch-action: none; }
.editor__ctx { display: flex; align-items: center; gap: 6px; min-height: 48px; padding: 2px; overflow-x: auto; scrollbar-width: none; }
.editor__ctx::-webkit-scrollbar { display: none; }
.hint { font-size: .85rem; line-height: 1.2; }
.chip {
  flex: none; min-width: 44px; min-height: 44px; padding: 0 10px; font: 400 1.05rem var(--font-title);
  color: var(--ink); background: var(--paper); border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 3px 0 var(--ink);
  touch-action: manipulation; cursor: pointer;
}
.chip:active { transform: translateY(3px); box-shadow: none; }
.swatch { flex: none; width: 34px; height: 34px; background: var(--c); border: 3px solid var(--ink); border-radius: 50%; touch-action: manipulation; cursor: pointer; }
.swatch.is-on { outline: 3px solid var(--yellow); outline-offset: 2px; }
.editor__bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.editor__bar .btn { flex-direction: column; gap: 2px; min-height: 54px; padding: 6px 2px; font-size: .85rem; border-radius: 16px; box-shadow: 0 5px 0 var(--ink); }
.editor__bar .btn span { font-size: 1.35rem; line-height: 1; }

/* Fenêtres de saisie (rattachées au <body>) */
.sheet { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-start; justify-content: center; padding: max(12px, env(safe-area-inset-top)) 14px 14px; background: rgba(25, 11, 58, .72); }
.sheet[hidden] { display: none; }
.sheet__panel { display: grid; gap: 12px; width: 100%; max-width: 460px; margin-top: 6vh; padding: 14px; color: var(--ink); background: var(--paper); border: 4px solid var(--ink); border-radius: 22px; box-shadow: 0 8px 0 var(--ink); }
.sheet__panel[hidden] { display: none; }
.sheet__panel h3 { margin: 0; font: 400 1.3rem var(--font-title); }
.sheet textarea { width: 100%; min-height: 96px; padding: 10px 12px; resize: none; font: 700 1.15rem var(--font-body); color: var(--ink); background: #fff; border: 3px solid var(--ink); border-radius: 14px; }
.sheet__actions { display: flex; gap: 10px; }
.sheet__actions .btn { flex: 1; }
.stickers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sticker-btn { min-height: 64px; padding: 0 4px; font: 400 1.9rem var(--font-title); color: var(--ink); background: #fff; border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 3px 0 var(--ink); touch-action: manipulation; cursor: pointer; }
.sticker-btn--burst { font-size: 1rem; color: #fff; background: var(--c); text-shadow: 0 2px 0 var(--ink); }
.sticker-btn:active { transform: translateY(3px); box-shadow: none; }

/* Galerie des créations */
.gallery { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.card { overflow: hidden; color: var(--ink); background: var(--paper); border: 4px solid var(--ink); border-radius: 14px; box-shadow: 0 4px 0 var(--ink); }
.card__img { display: grid; place-items: center; min-height: 90px; font-size: .85rem; font-weight: 700; text-align: center; background: rgba(25, 11, 58, .12); }
.card__img img { display: block; width: 100%; height: auto; }
.card__name { margin: 0; padding: 4px 8px; font-weight: 700; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
