/* Client de session : mise en page seulement. L'identité visuelle (palette, polices pixel,
   panneaux, boutons, champs, icônes) est celle du thème Ribin, servi par le moteur sous
   /ribin/design.css (D-41). Ne rien redéfinir ici qui existe dans le thème. */
@import url("/ribin/design.css");

body {
  display: flex;
  flex-direction: column;
  padding: 0 var(--safe-r) var(--safe-b) var(--safe-l);
}

/* ------------------------------------------------------------------ Page */

.topbar {
  padding: calc(14px + var(--safe-t)) 16px 0;
  text-align: center;
}

.brand {
  font-family: var(--font-title);
  font-size: 22px;
  letter-spacing: 4px;
  color: var(--primary);
  text-shadow: 3px 3px 0 var(--pink), 6px 6px 0 var(--line);
}

main {
  flex: 1;
  width: 100%;
  max-width: 35rem;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

main > section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

h1 {
  font-size: 16px;
  margin: 6px 0 4px;
}

h2 {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label {
  color: var(--ink-dim);
  font-size: 20px;
}

small,
.status-text {
  color: var(--ink-dim);
}

.status-text {
  margin: 0;
}

.status-text:empty {
  display: none;
}

.instruction {
  margin: 0;
  color: var(--ink-dim);
  text-align: center;
}

.code-field {
  font-size: 22px;
}

select.input {
  appearance: none;
  border-radius: 0;
}

.field.check {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.field.check input {
  width: 24px;
  height: 24px;
  min-height: 24px;
  flex: none;
  accent-color: var(--primary);
}

.error {
  padding: 10px 12px;
  border: 3px solid var(--red);
  background: rgb(255 77 109 / 0.14);
  color: var(--ink);
  text-align: left;
}

.error::before {
  content: "! ";
  color: var(--red);
  font-family: var(--font-title);
}

.notice {
  width: calc(100% - 32px);
  max-width: 35rem;
  margin: 12px auto 0;
  padding: 10px 12px;
  border: var(--px) solid var(--line);
  background: var(--secondary);
  color: var(--line);
  box-shadow: 0 var(--px) 0 var(--line);
}

.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--primary);
  color: var(--line);
  border-bottom: var(--px) solid var(--line);
  font-size: 22px;
}

.banner-icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border: 3px solid var(--line);
  background: var(--red);
  color: var(--line);
  font-family: var(--font-title);
  font-size: 14px;
}

.banner-info {
  margin: 0;
  text-align: center;
}

/* ------------------------------------------------------------------ Salon */

.invite {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.invite .label {
  margin: 4px 0 0;
}

.code {
  padding-left: 0.2em;
  color: var(--primary);
  font-family: var(--font-title);
  font-size: 34px;
  letter-spacing: 0.2em;
  text-shadow: 4px 4px 0 var(--line);
}

.code.huge {
  display: block;
  font-size: clamp(2.6rem, 11vw, 5rem);
  text-align: center;
}

.link {
  color: var(--ink-dim);
  font-size: 20px;
  word-break: break-all;
}

.count {
  font-family: var(--font-body);
  font-size: 20px;
  color: var(--ink-dim);
}

/* Membres : la « strip » du salon, un avatar pixel et son nom, en grille. */
.participants {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 16px 10px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.participant {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  text-align: center;
}

.participant-name {
  max-width: 100%;
  font-size: 22px;
  line-height: 1;
  overflow-wrap: anywhere;
}

/* Présence : carré plein = connecté, carré vide en tirets = déconnecté, avec son texte. */
.presence {
  position: absolute;
  top: -4px;
  right: 6px;
  z-index: 1;
  width: 14px;
  height: 14px;
  border: 3px solid var(--line);
  background: var(--green);
}

.presence.off {
  background: var(--bg);
  border-color: var(--ink-dim);
  border-style: dashed;
}

.participant:has(.presence.off) .avatar {
  opacity: 0.45;
}

.presence-label {
  color: var(--ink-dim);
  font-size: 17px;
  line-height: 1;
}

.participant .badge {
  font-size: 17px;
}

.participant .btn {
  min-height: 44px;
  padding: 4px 8px;
  font-size: 9px;
}

.status-banner {
  display: flex;
  align-items: center;
  gap: 12px;
}

.spinner {
  flex: none;
  width: 18px;
  height: 18px;
  border: 4px solid var(--panel-2);
  border-top-color: var(--primary);
  animation: spin 0.9s steps(8) infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Catalogue : des cartouches de jeu. */
.catalog {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.game-card {
  --accent: var(--primary);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: var(--px) solid var(--line);
  background: var(--bg);
  box-shadow:
    inset 0 -4px 0 color-mix(in srgb, var(--accent) 45%, transparent),
    0 var(--px) 0 var(--line);
}

.game-card:nth-child(4n+2) {
  --accent: var(--secondary);
}

.game-card:nth-child(4n+3) {
  --accent: var(--pink);
}

.game-card:nth-child(4n) {
  --accent: var(--green);
}

.game-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.game-tile {
  flex: none;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  background: var(--accent);
  border: 3px solid var(--line);
  box-shadow: inset -4px -4px 0 rgb(0 0 0 / 0.25), inset 4px 4px 0 rgb(255 255 255 / 0.35);
  color: var(--line);
  font-family: var(--font-title);
  font-size: 22px;
}

.game-card h3 {
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.game-card h4 {
  margin: 4px 0 0;
  font-family: var(--font-title);
  font-size: 9px;
  color: var(--ink-dim);
}

.game-card .players {
  margin: 0;
  color: var(--accent);
}

/* Étiquettes d'un jeu et filtres du catalogue (décision D-45). */
.game-card .game-tags {
  font-size: 14px;
}

.catalog-filters {
  margin: 0 0 14px;
  min-width: 0;
}

.catalog-filters legend {
  padding: 0 6px;
  font-family: var(--font-title);
  font-size: 10px;
  color: var(--ink-dim);
}

/* Fenêtre « Signaler » : par-dessus la page, sans masquer le bandeau de connexion. */
.report-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(0 0 0 / 0.6);
}

.report-overlay[hidden] {
  display: none;
}

.report-dialog {
  width: min(100%, 28rem);
  max-height: 100%;
  overflow-y: auto;
}

.report-dialog .row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.report-dialog [data-state="error"] {
  color: var(--red);
}

.history {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-entry {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border: 3px solid var(--line);
  background: var(--bg);
}

.history-entry strong {
  font-family: var(--font-title);
  font-size: 11px;
  font-weight: 400;
  color: var(--primary);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.controls:empty {
  display: none;
}

.controls-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.prepare-ms {
  font-size: 18px;
}

/* Code QR d'invitation : toujours noir sur blanc, quel que soit le thème. */
.qr {
  width: min(100%, 12rem);
  margin-top: 8px;
  padding: 8px;
  background: #ffffff;
  border: var(--px) solid var(--line);
  line-height: 0;
}

.qr:empty {
  display: none;
}

.qr svg {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.invite-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 32px;
}

/* ------------------------------------------------------------------ Partie */

.frame-slot {
  display: flex;
  flex: 1;
  min-height: 60dvh;
}

.view-frame {
  flex: 1;
  width: 100%;
  min-height: 60dvh;
  border: var(--px) solid var(--line);
  /* Une vue qui n'adopte pas le thème garde un fond clair lisible. */
  background: #ffffff;
  box-shadow: 0 var(--px) 0 var(--line);
}

[data-view="game"] {
  flex: 1;
}

body[data-screen="finished"] [data-view="game"],
body[data-screen="finished"] [data-view="screen-game"] {
  flex: none;
}

/* ------------------------------------------------------------------ Fin de partie */

.podium-entry {
  display: grid;
  grid-template-columns: 4.6rem auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 8px;
  border: var(--px) solid var(--line);
  background: var(--panel);
  box-shadow: inset 0 var(--px) 0 var(--panel-2), 0 var(--px) 0 var(--line);
  font-size: 24px;
  animation: podium-in 0.45s steps(5) both;
}

.podium-entry[data-rank="1"] {
  border-color: var(--primary);
  animation-name: podium-win;
  box-shadow: 0 0 0 3px var(--primary), 0 0 22px rgb(255 197 49 / 0.55);
}

.podium-entry-flat {
  grid-template-columns: auto 1fr auto;
}

.podium-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 8px;
  border: 3px solid var(--line);
  background: var(--metal, var(--panel-2));
  color: var(--ink);
  text-shadow: none;
  font-family: var(--font-title);
  font-size: 12px;
}

.podium-entry.rank-1 .podium-rank,
.podium-entry.rank-2 .podium-rank,
.podium-entry.rank-3 .podium-rank {
  color: var(--line);
  box-shadow: inset 3px 3px 0 var(--metal-light), inset -3px -3px 0 var(--metal-dark);
}

.podium-name {
  min-width: 0;
  background: none;
  padding: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}

.podium-score {
  font-family: var(--font-title);
  font-size: 11px;
  color: var(--primary);
  white-space: nowrap;
}

/* Jeu coopératif : l'issue de l'équipe et son score, avant les membres. */
.podium-team {
  margin: 0;
  padding: 12px;
  border: var(--px) solid var(--line);
  background: var(--panel);
  font-family: var(--font-title);
  font-size: 16px;
  line-height: 1.4;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.podium-team[data-victory="true"] {
  border-color: var(--green);
  color: var(--green);
  box-shadow: 0 0 22px rgb(77 219 122 / 0.4);
}

.podium-team[data-victory="false"] {
  border-color: var(--red);
  color: var(--red);
}

.podium-team-score {
  margin: 0;
  font-family: var(--font-title);
  font-size: 18px;
  color: var(--primary);
  text-align: center;
}

.reveal {
  animation: fade-up 0.4s steps(4) both;
}

@keyframes podium-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}

@keyframes podium-win {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }

  60% {
    transform: translateY(-4px) scale(1.03);
  }
}

/* ------------------------------------------------------------------ Barre commune */

/* Hauteur fixe de 48 px, au-dessus du cadre de jeu et du podium. */
.game-bar {
  position: sticky;
  top: 8px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  /* Hors de <main> : on reprend sa largeur et ses marges. 48 px dont 2 px de bord, pour que les
     boutons de 44 px (cibles tactiles) tiennent dedans. */
  width: calc(100% - 32px);
  max-width: calc(35rem - 32px);
  height: 48px;
  margin: 8px auto 0;
  padding: 0 2px 0 10px;
  background: var(--panel);
  border: 2px solid var(--line);
  box-shadow: inset 0 -3px 0 var(--primary), 0 var(--px) 0 var(--line);
}

body[data-bar="true"][data-role="player"] .topbar {
  display: none;
}

.bar-title {
  flex: 0 1 auto;
  max-width: 9rem;
  margin: 0;
  overflow: hidden;
  font-family: var(--font-title);
  font-size: 10px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-members {
  display: flex;
  flex: 1 1 auto;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  list-style: none;
}

.bar-member {
  position: relative;
  display: inline-flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 2px 8px 2px 2px;
  border: 2px solid var(--line);
  background: var(--bg);
  font-size: 18px;
}

.bar-member .avatar {
  border-width: 2px;
}

.bar-member.off {
  color: var(--ink-dim);
}

.bar-member.off .avatar {
  opacity: 0.45;
}

.bar-member .presence {
  position: static;
  width: 10px;
  height: 10px;
  border-width: 2px;
}

.bar-member-name {
  max-width: 6rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-sound-slot,
.bar-emote-slot,
.bar-menu {
  display: flex;
  flex: none;
}

.bar-menu {
  position: relative;
}

.bar-menu-button {
  width: 44px;
  min-height: 44px;
  height: 44px;
  padding: 0;
  font-size: 16px;
}

.bar-menu-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 14rem;
  padding: 10px;
  background: var(--panel);
  border: var(--px) solid var(--line);
  box-shadow:
    inset 0 var(--px) 0 var(--panel-2),
    0 var(--px) 0 var(--line),
    0 0 0 100vmax rgb(13 9 25 / 0.55);
}

.menu-item {
  justify-content: flex-start;
  min-height: 44px;
  text-align: left;
  font-size: 10px;
}

.menu-title {
  margin: 6px 0 0;
  font-family: var(--font-title);
  font-size: 9px;
  color: var(--ink-dim);
}

.bar-connection {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  color: var(--ink-dim);
  font-size: 17px;
}

/* Carré plein = connecté ; carré vide plein trait = connexion en cours ; carré en tirets =
   perdue. Le texte l'accompagne (masqué visuellement sur petit écran, lu par les lecteurs). */
.bar-connection-dot {
  width: 12px;
  height: 12px;
  border: 3px solid var(--green);
  background: var(--green);
}

.bar-connection[data-state="connecting"] .bar-connection-dot,
.bar-connection[data-state="idle"] .bar-connection-dot {
  border-color: var(--ink-dim);
  background: transparent;
}

.bar-connection[data-state="lost"] .bar-connection-dot {
  border-color: var(--red);
  border-style: dashed;
  background: transparent;
}

@media (max-width: 34rem) {
  .bar-title {
    max-width: 5.5rem;
  }

  .bar-connection-text {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

/* Zone de survol : le pointeur au-dessus du cadre de jeu n'est pas vu par la page, mais une
   bande transparente en haut de la fenêtre l'est, et réaffiche la barre masquée. */
.bar-hotspot {
  display: none;
}

/* ------------------------------------------------------------------ Son */

/* Bouton « muet » : carré dans la barre commune, flottant en haut à droite ailleurs. */
.sound-toggle[data-placement="bar"] {
  width: 44px;
  min-height: 44px;
  height: 44px;
  padding: 0;
  font-size: 16px;
}

.sound-toggle[data-placement="floating"] {
  position: fixed;
  top: calc(8px + var(--safe-t));
  right: calc(8px + var(--safe-r));
  z-index: 40;
  width: 44px;
  min-height: 44px;
  height: 44px;
  padding: 0;
  font-size: 16px;
}

/* Écran partagé : tant qu'aucun geste n'a eu lieu, le navigateur interdit le son. */
.sound-hint {
  position: fixed;
  left: calc(16px + var(--safe-l));
  bottom: calc(16px + var(--safe-b));
  z-index: 40;
  max-width: 24rem;
  margin: 0;
  padding: 4px 8px;
  background: var(--panel);
  border: 3px solid var(--line);
  color: var(--ink);
  font-size: 18px;
  pointer-events: none;
}

.sound-hint[hidden] {
  display: none;
}

/* ------------------------------------------------------------------ Émotes */

/* Bouton : rond et doré au salon (flottant), carré dans la barre. */
.emote-button {
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: var(--px) solid var(--line);
  background: radial-gradient(circle at 35% 30%, #ffe58a, var(--primary) 60%, var(--primary-dark));
  color: var(--line);
  font-size: 20px;
  line-height: 1;
  box-shadow: inset 0 -4px 0 rgb(0 0 0 / 0.2), 0 var(--px) 0 var(--line);
  touch-action: manipulation;
}

.emote-button:active:not([aria-disabled="true"]) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--line);
}

.emote-button[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

.emote-button[data-placement="bar"] {
  width: 44px;
  height: 44px;
  border-width: 3px;
  border-radius: 50%;
}

.emote-button[data-placement="floating"] {
  position: fixed;
  right: calc(16px + var(--safe-r));
  bottom: calc(16px + var(--safe-b));
  z-index: 40;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  font-size: 30px;
}

/* La roue : un panneau centré, le reste de la page assombri. */
.emote-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 50;
  width: min(22rem, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 12px;
  overflow: auto;
  background: var(--panel);
  border: var(--px) solid var(--line);
  box-shadow:
    inset 0 var(--px) 0 var(--panel-2),
    0 var(--px) 0 var(--line),
    0 0 0 100vmax rgb(13 9 25 / 0.78);
  transform: translate(-50%, -50%);
  animation: fade-up 0.15s steps(3);
}

.emote-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.emote-tab {
  flex: 1;
  min-height: 44px;
  padding: 4px 6px;
  border: 3px solid var(--line);
  background: var(--bg);
  color: var(--ink-dim);
  font-size: 18px;
  box-shadow: 0 3px 0 var(--line);
}

.emote-tab[aria-selected="true"] {
  background: var(--primary);
  color: var(--line);
}

/* Les émojis en cercle (positions posées par emotes.js) autour d'un moyeu. */
.emote-wheel {
  position: relative;
  width: min(100%, 20rem);
  aspect-ratio: 1;
  margin: 0 auto;
}

.emote-wheel::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(46 35 80 / 0.95) 30%, rgb(27 20 48 / 0.9) 70%);
  box-shadow: 0 0 0 var(--px) var(--line), 0 0 0 calc(var(--px) * 2) var(--panel-2);
}

.emote-emoji {
  position: absolute;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 3px solid var(--line);
  border-radius: 50%;
  background: var(--panel-2);
  font-size: 26px;
  line-height: 1;
  box-shadow: 0 3px 0 var(--line);
  transform: translate(-50%, -50%);
  transition: transform 0.08s;
}

.emote-emoji:hover,
.emote-emoji:focus-visible {
  z-index: 2;
  background: var(--primary);
  transform: translate(-50%, -50%) scale(1.25);
}

.emote-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.emote-phrase {
  justify-content: flex-start;
  text-align: left;
  font-size: 10px;
}

.emote-text .error {
  font-size: 20px;
}

[data-testid="emote-text-counter"][data-over="true"] {
  color: var(--red);
}

/* Bulles des émotes reçues : près du nom du membre, ou en pile en surimpression. */
.bubble-layer {
  position: fixed;
  inset: 0;
  z-index: 45;
  pointer-events: none;
}

.bubble-stack {
  position: fixed;
  top: 64px;
  right: 16px;
  z-index: 45;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  max-width: min(24rem, 80vw);
  pointer-events: none;
}

.bubble-layer .bubble,
.bubble-stack .bubble {
  position: relative;
  bottom: auto;
  left: auto;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  max-width: min(18rem, 80vw);
  overflow: visible;
  white-space: normal;
  overflow-wrap: anywhere;
  transform: none;
  font-size: 22px;
  animation: bubble-pop 0.18s steps(3) both;
}

.bubble-layer .bubble {
  position: absolute;
}

/* Le petit bec de la bulle, vers le haut. */
.bubble-layer .bubble::after {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 14px;
  border: 6px solid transparent;
  border-bottom-color: var(--line);
}

.bubble-stack .bubble::after {
  content: "";
  position: absolute;
  top: 100%;
  right: 14px;
  border: 6px solid transparent;
  border-top-color: var(--line);
}

.bubble-name {
  font-family: var(--font-title);
  font-size: 8px;
  color: var(--secondary-dark);
}

.bubble-emoji .bubble-text {
  font-size: 30px;
  line-height: 1.1;
}

@keyframes bubble-pop {
  from {
    opacity: 0;
    transform: scale(0.4);
  }
}

/* ------------------------------------------------------------------ Page écran : lisible de loin */

body[data-role="screen"] {
  font-size: 30px;
}

body[data-role="screen"] .topbar {
  padding-top: 20px;
}

body[data-role="screen"] .brand {
  font-size: 30px;
}

body[data-role="screen"] main {
  max-width: none;
  align-items: center;
  text-align: center;
}

body[data-role="screen"] main > section {
  width: 100%;
  align-items: center;
}

body[data-role="screen"] h1 {
  font-size: 28px;
}

body[data-role="screen"] h2 {
  justify-content: center;
  font-size: 18px;
}

body[data-role="screen"] .instruction {
  font-size: 30px;
}

body[data-role="screen"] .code.huge {
  font-size: clamp(4rem, 12vw, 8rem);
}

body[data-role="screen"] .participants {
  width: 100%;
  max-width: 70rem;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

body[data-role="screen"] .participant-name {
  font-size: 30px;
}

body[data-role="screen"] .presence {
  width: 20px;
  height: 20px;
  right: 18px;
}

body[data-role="screen"] .presence-label {
  font-size: 22px;
}

body[data-role="screen"] .catalog {
  width: 100%;
  max-width: 70rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  text-align: left;
}

body[data-role="screen"] .game-card h3 {
  font-size: 16px;
}

body[data-role="screen"] .game-tile {
  width: 68px;
  height: 68px;
  font-size: 30px;
}

body[data-role="screen"] .status-banner {
  justify-content: center;
}

body[data-role="screen"] .qr.big {
  width: clamp(11rem, 36vmin, 22rem);
  margin: 0;
}

body[data-role="screen"] .podium {
  width: 100%;
  max-width: 56rem;
}

body[data-role="screen"] .podium-entry {
  font-size: 34px;
  text-align: left;
}

body[data-role="screen"] .podium-rank {
  font-size: 16px;
  min-height: 56px;
}

body[data-role="screen"] .fill,
body[data-role="screen"] [data-view="screen-game"] {
  flex: 1;
}

body[data-role="screen"] .frame-slot {
  width: 100%;
  min-height: calc(100dvh - 120px);
}

/* Barre sur l'écran partagé : surimpression discrète en haut, masquée après 3 s d'inactivité.
   Elle ne réduit pas le cadre de jeu, qui garde toute la fenêtre. */
body[data-role="screen"] .game-bar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 25;
  padding: 0 16px;
  background: rgb(46 35 80 / 0.94);
  font-size: 22px;
  transition: opacity 0.25s, visibility 0.25s;
  text-align: left;
}

body[data-role="screen"][data-bar="true"] .bar-hotspot {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 24;
  display: block;
  height: 56px;
}

body[data-role="screen"] .game-bar[data-idle="true"] {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

body[data-role="screen"] .bar-title {
  max-width: 16rem;
  font-size: 12px;
}

body[data-role="screen"] .bubble-layer .bubble,
body[data-role="screen"] .bubble-stack .bubble {
  max-width: min(26rem, 40vw);
  font-size: 30px;
}

/* Écran partagé en partie et en fin de partie (data-fill, posé par app.js) : la vue plateau
   occupe toute la fenêtre, sans en-tête, sans marge et sans défilement de page. */
html:has(body[data-fill="true"]),
body[data-fill="true"] {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

body[data-role="screen"][data-fill="true"] {
  display: block;
  padding: 0;
  font-size: 1rem;
}

body[data-role="screen"][data-fill="true"] .topbar {
  display: none;
}

body[data-role="screen"][data-fill="true"] main {
  display: block;
  position: static;
  max-width: none;
  height: 100dvh;
  margin: 0;
  padding: 0;
}

body[data-role="screen"][data-fill="true"] [data-view="screen-game"] {
  position: fixed;
  inset: 0;
  display: block;
  width: auto;
  height: auto;
}

body[data-role="screen"][data-fill="true"] .frame-slot {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
}

body[data-role="screen"][data-fill="true"] .view-frame {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  box-shadow: none;
}

/* Le bandeau de connexion perdue et les notifications restent visibles par-dessus. */
body[data-fill="true"] #banner-slot,
body[data-fill="true"] .notice {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
}

body[data-fill="true"] .notice {
  top: 12px;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}

/* Fin de partie sur l'écran : le podium commun en surimpression compacte, en bas à droite,
   qui laisse voir l'essentiel de la vue plateau. */
body[data-role="screen"][data-fill="true"] [data-view="finished"] {
  position: fixed;
  z-index: 20;
  right: 16px;
  bottom: 16px;
  width: min(26rem, 36vw);
  max-height: 50dvh;
  overflow: auto;
  padding: 12px 14px;
  gap: 8px;
  align-items: stretch;
  text-align: left;
  background: var(--panel);
  border: var(--px) solid var(--line);
  box-shadow:
    inset 0 var(--px) 0 var(--panel-2),
    0 var(--px) 0 var(--line),
    0 8px 24px rgb(0 0 0 / 0.45);
}

body[data-role="screen"][data-fill="true"] [data-view="finished"] h1 {
  font-size: 12px;
  text-align: left;
  text-shadow: none;
}

body[data-role="screen"][data-fill="true"] [data-view="finished"] h2 {
  display: none;
}

body[data-role="screen"][data-fill="true"] .podium {
  max-width: none;
  gap: 6px;
}

body[data-role="screen"][data-fill="true"] .podium-entry {
  grid-template-columns: 3.4rem auto 1fr auto;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  font-size: 20px;
  border-width: 3px;
}

body[data-role="screen"][data-fill="true"] .podium-entry.podium-entry-flat {
  grid-template-columns: auto 1fr auto;
}

body[data-role="screen"][data-fill="true"] .podium-entry .avatar {
  width: 32px;
  height: 32px;
}

body[data-role="screen"][data-fill="true"] .podium-rank {
  min-height: 32px;
  padding: 0 4px;
  font-size: 9px;
}

body[data-role="screen"][data-fill="true"] .podium-score {
  font-size: 9px;
}

body[data-role="screen"][data-fill="true"] .podium-team {
  padding: 6px;
  font-size: 10px;
}

body[data-role="screen"][data-fill="true"] .podium-team-score {
  font-size: 11px;
}

@media (min-width: 40rem) {
  main {
    padding: 24px 16px;
  }

  h1 {
    font-size: 20px;
  }
}
