/* ==========================================================
   Doomja : un plateau imprimé posé sur une table bleue.
   Couleurs : encre marine, carton blanc, jaune "bouton", rose chance.
   Typo : Archivo, on joue sur la largeur (wdth) pour les titres.
   ========================================================== */

/* Police Archivo hébergée avec le site (licence libre OFL, voir fonts/ARCHIVO-OFL.txt) */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url("../fonts/archivo-wdth.woff2") format("woff2");
}

:root {
  /* Thème « tapis de casino » : couleurs reposantes pour les longues parties */
  --table: #1b6b30; /* vert du tapis (motif losanges) */
  --table-deep: #0e4a1d;
  --table-shadow: #07320f;
  --ink: #1f1a14; /* brun-noir, plus doux que le noir */
  --ink-soft: #5a5146;
  --paper: #f6f0e1; /* crème, comme des cartes à jouer */
  --paper-line: #ddd3bd;
  --sun: #d9ad45; /* or doux */
  --sun-deep: #a8801f;
  --chance: #d94f6b;
  --chance-deep: #a8344d;
  --good: #2f7a4a;
  --bad: #b8433a;
  --airport: #2b4f8f;

  --radius-card: 16px;
  --radius-btn: 10px;
  --font: "Archivo", "Segoe UI", system-ui, sans-serif;
  --step: 160ms;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--table);
  /* Motif losanges (argyle) avec coutures en pointillés, plus clair au centre comme sous une lampe.
     Dessiné en SVG : net sur tous les écrans et presque rien à télécharger. */
  background-image:
    radial-gradient(ellipse at 50% 42%, rgba(70, 200, 90, 0.28) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 50%, transparent 35%, rgba(2, 24, 8, 0.6) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='120' viewBox='0 0 100 120'%3E%3Crect width='100' height='120' fill='%23155a26'/%3E%3Cpolygon points='50,0 100,60 50,120 0,60' fill='%231e7b31'/%3E%3Cg stroke='%23d9e6c8' stroke-opacity='0.42' stroke-width='1.1' stroke-dasharray='5 5' fill='none'%3E%3Cline x1='0' y1='0' x2='100' y2='120'/%3E%3Cline x1='100' y1='0' x2='0' y2='120'/%3E%3C/g%3E%3C/svg%3E");
  background-size: auto, auto, 120px 144px;
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
}

[hidden] {
  display: none !important;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 2px;
}

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

/* ---------- Éléments communs ---------- */

.wordmark {
  margin: 0;
  color: var(--paper);
  font-size: clamp(56px, 13vw, 128px);
  font-weight: 900;
  font-stretch: 125%;
  font-variation-settings: "wdth" 125;
  letter-spacing: -0.02em;
  line-height: 0.9;
  text-shadow: 0 6px 0 var(--table-shadow);
}

.wordmark-small {
  font-size: 26px;
  text-shadow: 0 3px 0 var(--table-shadow);
}

.paper {
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--radius-card);
  box-shadow: 0 8px 0 var(--table-shadow);
}

.screen {
  min-height: 100vh;
  padding: 16px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1240px;
  margin: 0 auto 20px;
  color: var(--paper);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 18px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-btn);
  background: var(--paper);
  box-shadow: 0 4px 0 var(--ink);
  color: var(--ink);
  font-weight: 700;
  font-variation-settings: "wdth" 105;
  cursor: pointer;
  transition: transform 80ms ease, box-shadow 80ms ease;
}

.btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ink);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn-primary {
  background: var(--sun);
}

.btn-secondary {
  background: #e9e0c6;
}

.btn-danger {
  background: var(--chance);
  color: #fff;
}

.btn-ghost {
  border-color: currentColor;
  background: transparent;
  box-shadow: none;
}

.topbar .btn-ghost {
  color: var(--paper);
}

.btn-small {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 14px;
}

.btn-large {
  min-height: 56px;
  font-size: 18px;
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--airport);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.field {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

.field small {
  color: var(--ink-soft);
  font-weight: 400;
}

.field input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-btn);
  background: #fff;
  font-weight: 500;
}

.hint {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.form-message {
  min-height: 1.4em;
  margin: 12px 0 0;
  font-weight: 600;
}

.form-message.is-error {
  color: var(--bad);
}

.form-message.is-success {
  color: var(--good);
}

.screen-menu .form-message {
  color: var(--paper);
  text-align: center;
}

/* ---------- Écran de connexion ---------- */

.screen-auth {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 32px;
  padding-bottom: 48px;
  text-align: center;
}

.tagline {
  max-width: 34ch;
  margin: 16px 0 28px;
  color: #e9e0c6;
  font-size: 18px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 22px;
  text-align: left;
}

.invite-banner {
  margin: -6px -6px 18px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--sun);
  font-weight: 600;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  border-radius: 12px;
  background: #ece5d3;
}

.tab {
  min-height: 40px;
  padding: 6px 4px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.tab[aria-selected="true"] {
  background: var(--paper);
  box-shadow: 0 0 0 2px var(--ink);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form .link-btn {
  justify-self: start;
  font-size: 14px;
}

/* ---------- Menu ---------- */

.menu-body {
  max-width: 900px;
  margin: 0 auto;
  padding-top: 4vh;
}

.menu-title {
  margin: 0;
  color: var(--paper);
  font-size: clamp(36px, 7vw, 64px);
  font-weight: 900;
  font-variation-settings: "wdth" 118;
  line-height: 1;
}

.menu-stats {
  margin: 10px 0 0;
  color: #e9e0c6;
}

.verify-note {
  display: inline-block;
  margin: 14px 0 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--paper);
}

.verify-note .link-btn {
  color: var(--sun);
}

.menu-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 22px;
  margin-top: 32px;
}

.menu-card {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 22px;
}

.menu-card h2 {
  margin: 0;
  font-size: 24px;
  font-variation-settings: "wdth" 112;
}

.menu-card > p {
  margin: 0;
  color: var(--ink-soft);
}

.join-form {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 10px;
}

.code-input {
  font-variation-settings: "wdth" 120;
  font-weight: 800 !important;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.code-input::placeholder {
  color: #b9bfd6;
}

/* ---------- Lobby ---------- */

.lobby-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
  gap: 32px;
  align-items: start;
  max-width: 1100px;
  margin: 0 auto;
  padding-top: 3vh;
}

.lobby-invite {
  color: var(--paper);
}

.lobby-label {
  margin: 0 0 6px;
  color: #e9e0c6;
  font-weight: 600;
}

.room-code {
  margin: 0;
  font-size: clamp(40px, 8vw, 110px);
  white-space: nowrap;
  font-weight: 900;
  font-variation-settings: "wdth" 125;
  letter-spacing: 0.04em;
  line-height: 1;
  text-shadow: 0 6px 0 var(--table-shadow);
  word-break: break-all;
}

.invite-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.invite-actions .btn-ghost {
  color: var(--paper);
}

.invite-link {
  margin: 14px 0 0;
  color: #b8c4f5;
  font-size: 14px;
  word-break: break-all;
}

.lobby-panel {
  padding: 22px;
}

.lobby-panel h2,
.lobby-panel h3 {
  margin: 0;
  font-variation-settings: "wdth" 112;
}

.lobby-panel h3 {
  margin: 22px 0 10px;
  font-size: 17px;
}

.lobby-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.count {
  color: var(--ink-soft);
  font-weight: 600;
}

.lobby-players {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.lobby-player {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 8px 10px;
  border: 2px solid var(--paper-line);
  border-radius: 12px;
}

.lobby-player.is-me {
  border-color: var(--ink);
}

.lobby-player .name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #ece5d3;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.tag-host {
  background: var(--sun);
  color: var(--ink);
}

.tag-off {
  background: #ffe1e6;
  color: var(--chance-deep);
}

.kick-btn {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.kick-btn:hover {
  background: #ffe1e6;
  color: var(--chance-deep);
}

.pawn-dot {
  flex: none;
  width: 26px;
  height: 26px;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--ink);
}

.color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  padding: 4px;
}

.swatch {
  position: relative;
  width: 38px;
  height: 38px;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--ink);
  cursor: pointer;
}

.swatch[aria-checked="true"] {
  box-shadow: 0 0 0 2px var(--ink), 0 0 0 6px var(--sun), 0 0 0 8px var(--ink);
}

.swatch:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.swatch .initial {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented button {
  min-height: 40px;
  padding: 6px 14px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.segmented button[aria-checked="true"] {
  background: var(--ink);
  color: var(--paper);
}

#lobby-money-info {
  margin-top: 12px;
}

#btn-start {
  width: 100%;
  margin-top: 22px;
}

.lobby-wait {
  margin-top: 14px;
  text-align: center;
}

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

.topbar-game {
  max-width: 1400px;
  margin-bottom: 14px;
}

.game-room {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.game-room strong {
  font-variation-settings: "wdth" 120;
  letter-spacing: 0.08em;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px;
  align-items: start;
  max-width: 1400px;
  margin: 0 auto;
}

.board-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

/* Le plateau : 11 x 11, les coins sont plus grands que les cases normales */
/* la « scène » contient le plateau (qui peut s'incliner en 3D) et les cartes posées au-dessus */
.board-stage {
  --tilt: 0deg;
  --spin: 0deg;
  --spin-time: 0.8s; /* même durée et même courbe pour le plateau, les pions et le centre */
  --spin-ease: cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  width: min(100%, calc(100vh - 110px));
  min-width: 300px;
  perspective: 1800px;
  perspective-origin: 50% 30%;
  container-type: inline-size;
}

.board-overlays {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

.board-overlays > * {
  pointer-events: auto;
}

.board {
  --corner: 1.86fr; /* coin = 1,86 x une case normale (proportions du plateau de référence) */
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, var(--corner)) repeat(9, minmax(0, 1fr)) minmax(0, var(--corner));
  grid-template-rows: minmax(0, var(--corner)) repeat(9, minmax(0, 1fr)) minmax(0, var(--corner));
  width: 100%;
  min-height: 0;
  aspect-ratio: 1;
  border: 3px solid var(--ink);
  background: var(--ink);
  gap: 2px;
  box-shadow: 0 14px 0 var(--table-shadow), 0 30px 50px rgba(3, 18, 12, 0.45);
  container-type: inline-size;
}

.square {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--paper);
  font-size: max(7px, 1.55cqi);
  line-height: 1.1;
  text-align: center;
}

/* contenu de la case, toujours orienté comme une case du bas (lisible depuis l'extérieur) :
   bande + prix côté centre, nom près du bord extérieur */
.sq {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5cqi;
  padding: 0.7cqi 0.5cqi 0.9cqi;
}

/* la bande de couleur fait partie du contenu : toujours en haut, sur toute la largeur */
.sq.has-band {
  padding-top: 0;
}

.sq.has-band > .owner-band {
  position: relative;
  flex: none;
  align-self: stretch;
  height: 20%;
  margin: 0 -0.5cqi 0.2cqi;
}

/* la flèche de Départ indique toujours le sens de la marche (vers la gauche) */
.corner-0 .big-arrow {
  display: inline-block;
  line-height: 1;
  transform: rotate(45deg);
}

.sq > .square-name {
  margin-top: auto; /* le nom descend contre le bord extérieur */
}

.sq:not(.has-band) > :first-child {
  margin-top: auto;
}

/* côtés gauche / droit : la case est large et basse, on tourne un contenu haut et étroit */
.side-left .sq,
.side-right .sq {
  inset: auto;
  top: 50%;
  left: 50%;
  width: calc(100% / 1.86);
  height: 186%;
}

.side-left .sq { transform: translate(-50%, -50%) rotate(90deg); }
.side-right .sq { transform: translate(-50%, -50%) rotate(-90deg); }
.side-top .sq { transform: rotate(180deg); }

/* coins : contenu tourné en diagonale, vers l'extérieur */
.corner .sq {
  justify-content: center;
  gap: 0.3cqi;
  padding: 3cqi 2cqi; /* garde le contenu près du centre de la diagonale (sinon les coins le coupent) */
}

.corner .sq > .square-name,
.corner .sq > :first-child {
  margin-top: 0;
}

.sq.corner-0 { transform: rotate(-45deg); }
.sq.corner-10 { transform: rotate(45deg); }
.sq.corner-20 { transform: rotate(135deg); }
.sq.corner-30 { transform: rotate(-135deg); }

.square-name {
  font-weight: 700;
  font-variation-settings: "wdth" 85;
  overflow-wrap: break-word;
  hyphens: auto;
}

.square-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3cqi;
  min-width: 0;
}

.square-sub {
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.square-index {
  color: #c4c8db;
  font-size: 1.1em;
  font-weight: 700;
}

.square.empty .square-name {
  color: #b0b5cc;
  font-weight: 500;
}

/* bande de propriétaire, côté intérieur du plateau */
.owner-band {
  position: absolute;
  background: transparent;
}

/* chaque case est dessinée « vue de l'extérieur » : la bande est toujours en haut du contenu (.sq),
   puis le contenu est tourné selon le côté du plateau, donc la bande se retrouve côté centre */
.owner-band { top: 0; left: 0; right: 0; height: 20%; }

.square.airport .square-sub {
  white-space: nowrap;
}

.square.airport .icon {
  flex: none;
  width: 3.4cqi;
  height: 3.4cqi;
  color: var(--airport);
}


/* petit plateau (téléphone) : on garde l'essentiel pour que tout reste lisible */
@container (max-width: 560px) {
  .square.empty .square-name,
  .square.chance .square-name,
  .square.corner .square-sub,
  .square.airport .square-name,
  .square.cablecar .square-name,
  .square.fee .square-sub,
  .square.stock .square-sub,
  .square.hospital .square-sub,
  .square.lottery .lottery-rules,
  .square.tax .square-sub,
  .square.casino .square-sub,
  .square.roulette .square-sub,
  .square.casino .square-name,
  .square.roulette .square-name,
  .square.property .square-name {
    display: none;
  }

  .square.airport .icon {
    width: 4.2cqi;
    height: 4.2cqi;
  }

  .square-index {
    font-size: 1.3em;
  }

  .square.chance .chance-q {
    font-size: 5.5cqi;
  }

  .square.start .big-arrow {
    font-size: 1.4em;
  }
}

.square.tax {
  background: #f7ecd0;
}

.square.tax .tax-mark {
  color: var(--sun-deep);
  font-size: 3.6cqi;
  font-weight: 900;
  line-height: 1;
}

.square.casino {
  background: #e9fbf1;
}

.square.casino .icon {
  flex: none;
  width: 3.4cqi;
  height: 3.4cqi;
  color: #1f9e62;
}


/* roue du casino (au centre du plateau) */
.wheel-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  background: rgba(31, 26, 20, 0.35);
  cursor: pointer;
}

.wheel-box {
  display: grid;
  justify-items: center;
  gap: 1.4cqi;
  padding: 2.4cqi 3cqi;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: 0 8px 0 var(--ink);
}

.wheel-title {
  margin: 0;
  font-size: max(15px, 2.4cqi);
  font-weight: 900;
  font-variation-settings: "wdth" 120;
}

.wheel-holder {
  position: relative;
  width: max(200px, 38cqi);
  aspect-ratio: 1;
}

.wheel-pointer {
  position: absolute;
  top: -6px;
  left: 50%;
  z-index: 1;
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 22px solid var(--ink);
  transform: translateX(-50%);
}

.wheel-disc {
  width: 100%;
  height: 100%;
  border: 3px solid var(--ink);
  border-radius: 50%;
  overflow: hidden;
  transition: transform 3.2s cubic-bezier(0.12, 0.7, 0.18, 1);
}

.wheel-disc svg {
  display: block;
  width: 100%;
  height: 100%;
}

.wheel-disc text {
  font-family: var(--font);
  font-weight: 800;
}

.wheel-result {
  min-height: 1.3em;
  margin: 0;
  font-size: max(15px, 2.2cqi);
  font-weight: 800;
  text-align: center;
}

.wheel-result.is-good { color: var(--good); }
.wheel-result.is-bad { color: var(--bad); }

.debug-move {
  flex-basis: 100%;
  padding: 8px 10px;
  border: 2px dashed var(--ink-soft);
  border-radius: var(--radius-btn);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
}

.debug-move input {
  width: 4.5em;
  min-height: 34px;
  margin: 0 4px;
  padding: 4px 8px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  font-weight: 700;
}

.roulette-bets {
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 6px;
  justify-content: center;
}

.bet-option {
  min-height: 34px;
  padding: 4px 10px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.bet-option.bet-red { background: #ffe1e3; }
.bet-option.bet-black { background: #e3e6f0; }

.bet-option[aria-checked="true"] {
  background: var(--ink);
  color: var(--paper);
}

.roulette-number {
  width: 6em;
  min-height: 36px;
  padding: 4px 10px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  font-weight: 700;
}

.square.roulette {
  background: #fdeaea;
}

.square.roulette .icon {
  flex: none;
  width: 3.4cqi;
  height: 3.4cqi;
  color: #c0262f;
}

.casino-controls {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.casino-bet {
  font-weight: 700;
}

.casino-bet input {
  width: 6.5em;
  min-height: 40px;
  margin: 0 4px;
  padding: 6px 10px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-btn);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.casino-quick {
  justify-content: center;
}

.casino-quick button {
  min-height: 34px;
  padding: 4px 10px;
  font-size: 13px;
}

/* ---------- villes (terrains) ---------- */
.square.property,
.square.airport {
  cursor: pointer;
}

.group-band {
  display: flex;
  align-items: center;
  justify-content: center;
}

.side-top .group-band,
.side-bottom .group-band,
.side-left .group-band,
.side-right .group-band {
  height: 20%;
}


.buildings {
  display: flex;
  flex-direction: inherit;
  gap: 0.25cqi;
}

.buildings .house {
  width: 1.1cqi;
  height: 1.1cqi;
  border: 1px solid var(--ink);
  border-radius: 1px;
  background: #3ad17a;
}

.buildings .hotel {
  width: 2.6cqi;
  height: 1.3cqi;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: #e63946;
}


.owner-dot {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-right: 0.25em;
  border: 1px solid var(--ink);
  border-radius: 50%;
  vertical-align: -0.1em;
}

.square.is-mortgaged {
  background: repeating-linear-gradient(135deg, #f1f1f4 0 6px, #e2e3ea 6px 12px);
}

.square.is-mortgaged .square-name {
  color: var(--ink-soft);
}

/* fiche d'une ville */
.deed-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: rgba(31, 26, 20, 0.35);
  cursor: pointer;
}

.deed {
  width: min(86%, 300px);
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 0 8px 0 var(--ink);
  font-size: 14px;
}

.deed-head {
  display: grid;
  gap: 2px;
  padding: 12px;
  border-bottom: 3px solid var(--ink);
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.deed-head span {
  font-size: 12px;
  font-weight: 700;
}

.deed-head strong {
  font-size: 20px;
  font-variation-settings: "wdth" 115;
}

.deed-airport {
  background: var(--airport);
}

.deed table {
  width: 100%;
  border-collapse: collapse;
}

.deed td {
  padding: 5px 12px;
  border-bottom: 1px solid var(--paper-line);
}

.deed td:last-child {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.deed tr.is-now td {
  background: #f5e7c0;
}

.deed .deed-note td {
  color: var(--ink-soft);
  font-size: 12px;
  text-align: left;
}

.deed-status {
  margin: 0;
  padding: 10px 12px;
  font-weight: 600;
}

/* panneau Mes propriétés */
.my-props {
  display: grid;
  gap: 8px;
  max-height: 320px;
  margin: 10px 0 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.my-prop {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 2px solid var(--paper-line);
  border-radius: 10px;
}

.my-prop-name {
  padding: 0 0 0 10px;
  border: 0;
  border-left: 6px solid var(--group);
  background: none;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.my-prop-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.my-prop-actions .btn-small {
  min-height: 30px;
  padding: 3px 8px;
  font-size: 12px;
  box-shadow: 0 2px 0 var(--ink);
}

/* logos des cases Casino, Coupe du monde et Dîme (images dans public/img) */
.square-logo {
  flex: none;
  width: 4.4cqi;
  height: 4.4cqi;
  object-fit: contain;
}

.square-logo.logo-corner {
  width: 7cqi;
  height: 7cqi;
}

.square-logo.logo-chance {
  width: 4.8cqi;
  height: 4.8cqi;
}

@container (max-width: 560px) {
  .square-logo {
    width: 5.6cqi;
    height: 5.6cqi;
  }
}

.square.cablecar {
  cursor: pointer;
}

.square.cablecar .icon,
.square.fee .icon {
  flex: none;
  width: 3.6cqi;
  height: 3.6cqi;
}

.square.cablecar .icon { color: #0f8a7e; }
.square.fee .icon { color: #8a3ffc; }
.square.cablecar .square-sub { white-space: nowrap; }

.deed-cablecar,
.title-card-head.is-cablecar {
  background: #0f8a7e;
}

.lottery-rules {
  color: var(--ink-soft);
  font-size: 0.78em;
  font-weight: 600;
  line-height: 1.15;
}

.lottery-pot {
  padding: 0 0.6em;
  border-radius: 999px;
  background: var(--sun);
  font-size: 0.75em;
  font-weight: 800;
  white-space: nowrap;
}

.square.lottery {
  background: #faf3e0;
}

.square.chance {
  background: #fff0f3;
}

.square.chance .chance-q {
  color: var(--chance);
  font-size: 4.2cqi;
  font-weight: 900;
  line-height: 1;
  font-variation-settings: "wdth" 125;
}

.square.chance .square-name {
  color: var(--chance-deep);
}

.square.corner {
  font-size: max(8px, 1.8cqi);
}

.square.corner .square-name {
  font-variation-settings: "wdth" 110;
  font-weight: 900;
}

.square.start {
  background: var(--sun);
}

.square.start .big-arrow {
  font-size: 1.4em;
  font-weight: 900;
  line-height: 0.8;
}

.square.island {
  background: #e2f6f4;
}

.square.worldcup {
  background: #f5e7c0;
}

.square .corner-icon {
  flex: none;
  width: 4.6cqi;
  height: 4.6cqi;
}

.square.island .corner-icon { color: #12807a; }
.square.worldcup .corner-icon { color: var(--sun-deep); }

/* case qui accueille la Coupe du monde */
.square.is-worldcup {
  background: #f5e7c0;
  box-shadow: inset 0 0 0 0.45cqi var(--sun-deep);
}

.square.is-worldcup::after {
  content: "×3";
  position: absolute;
  top: 0.4cqi;
  right: 0.5cqi;
  padding: 0 0.6cqi;
  border-radius: 999px;
  background: var(--sun-deep);
  color: #fff;
  font-size: max(8px, 1.3cqi);
  font-weight: 900;
}

.actions-note {
  flex-basis: 100%;
}

.square.jail .bars {
  width: 5.5cqi;
  height: 5cqi;
  border: 0.35cqi solid var(--ink);
  border-radius: 0.4cqi;
  background: repeating-linear-gradient(90deg, var(--ink) 0 0.35cqi, transparent 0.35cqi 1.25cqi);
}

.square.parking .park-icon {
  font-size: 4cqi;
  line-height: 1;
}

.square.is-current {
  box-shadow: inset 0 0 0 0.5cqi var(--sun);
}

/* centre du plateau */
.board-center {
  position: relative;
  grid-row: 2 / 11;
  grid-column: 2 / 11;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--paper);
  background-image: radial-gradient(#e4dccb 1px, transparent 1px);
  background-size: 2.2cqi 2.2cqi;
}

.board-logo {
  position: absolute;
  color: var(--airport);
  font-size: 9cqi;
  font-weight: 900;
  font-variation-settings: "wdth" 125;
  letter-spacing: -0.02em;
  opacity: 0.1;
  transform: rotate(-38deg);
  user-select: none;
  pointer-events: none;
}

.controls {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 2.2cqi;
  width: 82%;
  text-align: center;
}

.turn-label {
  margin: 0;
  font-size: max(15px, 2.6cqi);
  font-weight: 800;
  font-variation-settings: "wdth" 112;
  line-height: 1.15;
}

.turn-label .who {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.turn-label .pawn-dot {
  width: 1.1em;
  height: 1.1em;
  border-width: 2px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
}

.actions .hint {
  align-self: center;
}

/* dés */
.dice {
  display: flex;
  gap: 2.4cqi;
}

.die {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: max(48px, 8.5cqi);
  height: max(48px, 8.5cqi);
  padding: 14%;
  border: 2px solid var(--ink);
  border-radius: 18%;
  background: #fff;
  box-shadow: 0 5px 0 var(--ink);
}

.die .pip {
  width: 74%;
  height: 74%;
  margin: auto;
  border-radius: 50%;
  background: var(--ink);
}

.dice.is-double .die {
  background: var(--sun);
}

.die.is-rolling {
  animation: tumble 600ms cubic-bezier(0.3, 0.7, 0.4, 1);
}

@keyframes tumble {
  0% { transform: translateY(0) rotate(0); }
  30% { transform: translateY(-28%) rotate(160deg); }
  60% { transform: translateY(6%) rotate(300deg); }
  100% { transform: translateY(0) rotate(360deg); }
}

/* carte chance */
.chance-card {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  background: rgba(31, 26, 20, 0.35);
  cursor: pointer;
}

.chance-inner {
  position: relative;
  width: min(78%, 360px);
  padding: 4cqi 3.5cqi 3cqi;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: var(--chance);
  color: #fff;
  box-shadow: 0 8px 0 var(--ink);
  text-align: center;
  animation: card-in 520ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.chance-card.is-good .chance-inner {
  background: #1f9e62;
}

.chance-mark {
  position: absolute;
  top: -0.2em;
  right: 0.2em;
  font-size: 12cqi;
  font-weight: 900;
  line-height: 1;
  opacity: 0.22;
}

.chance-title {
  margin: 0;
  font-size: max(14px, 2cqi);
  font-weight: 800;
  font-variation-settings: "wdth" 120;
}

.chance-text {
  margin: 1.4cqi 0;
  font-size: max(16px, 2.6cqi);
  font-weight: 700;
  line-height: 1.25;
}

.chance-who {
  margin: 0;
  font-size: max(12px, 1.6cqi);
  opacity: 0.85;
}

@keyframes card-in {
  0% { transform: rotateY(90deg) scale(0.8); }
  100% { transform: rotateY(0) scale(1); }
}

/* pions */
.pawn-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pawn {
  position: absolute;
  top: 0;
  left: 0;
  width: 5cqi; /* bien visible : environ deux tiers de la largeur d'une case */
  height: 5cqi;
  min-width: 18px;
  min-height: 18px;
  transform-style: preserve-3d;
  transition: transform var(--step) ease-out;
  will-change: transform;
}

/* le pion visible (cercle en 2D, pion debout en 3D) */
.pawn-body {
  position: absolute;
  inset: 0;
  border: 0.5cqi solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 0.3cqi var(--ink), 0 0.5cqi 0 0.3cqi rgba(6, 34, 24, 0.6);
  transition: transform var(--spin-time) var(--spin-ease), border-radius 0.3s ease;
  will-change: transform;
}

.pawn.is-jumping {
  transition-duration: 450ms;
  transition-timing-function: cubic-bezier(0.5, -0.4, 0.4, 1.4);
}

.pawn.is-current {
  z-index: 2;
}

/* en prison : anneau rose autour du pion */
.pawn.is-jailed .pawn-body {
  box-shadow: 0 0 0 0.3cqi var(--ink), 0 0 0 0.75cqi var(--chance), 0 0.5cqi 0 0.75cqi rgba(6, 34, 24, 0.6);
}

.pawn.is-out {
  display: none;
}

.controls-mobile {
  width: 100%;
}

/* ---------- Vue 3D : plateau incliné, pions debout ---------- */
.board {
  transform: rotateX(var(--tilt)) rotateZ(var(--spin));
  transform-origin: 50% 50%; /* pivot exactement au centre du plateau */
  transform-style: preserve-3d;
  transition: transform var(--spin-time) var(--spin-ease);
  /* pas de will-change en permanence : le navigateur figerait une image du plateau puis la déformerait
     (texte flou). On ne l'active que pendant une rotation (classe is-spinning, voir board.js). */
  backface-visibility: hidden;
}

/* le centre fait partie de la scène 3D : sans ça, en vue 3D, le navigateur croit qu'on clique
   sur le fond du centre et pas sur les boutons (décalage entre l'affichage et la zone cliquable) */
.board-center {
  transform-style: preserve-3d;
}

/* les dés et boutons du centre restent face au joueur quand on fait tourner le plateau,
   et sont posés très légèrement au-dessus du plateau pour recevoir les clics */
.board-center .controls {
  transform: translateZ(3px) rotateZ(calc(-1 * var(--spin)));
  transition: transform var(--spin-time) var(--spin-ease);
}

/* pendant une rotation seulement : calcul par la carte graphique, fluide */
.board-stage.is-spinning .board,
.board-stage.is-spinning .board-center .controls {
  will-change: transform;
}

.pawn-layer {
  transform-style: preserve-3d;
}

body.view-3d .board-stage {
  --tilt: 50deg;
  margin: -6% 0 0;
}

/* en 3D, pas de voile rectangulaire derrière les cartes (il ne suivrait pas le plateau incliné) */
body.view-3d .chance-card,
body.view-3d .wheel-overlay,
body.view-3d .deed-overlay {
  background: transparent;
}

body.view-3d .board {
  /* petite ombre égale tout autour : le plateau tourne, une ombre décalée d'un côté tournerait avec lui */
  box-shadow: 0 0 0 2px var(--ink), 0 0 1.6cqi 0.3cqi rgba(3, 18, 12, 0.5);
}

/* en 3D, le pion se lève face à la caméra (il annule l'inclinaison et la rotation du plateau) */
body.view-3d .pawn-body {
  top: -70%;
  border-radius: 50% 50% 42% 42% / 55% 55% 45% 45%;
  transform-origin: 50% 100%;
  transform: rotateZ(calc(-1 * var(--spin))) rotateX(calc(-1 * var(--tilt)));
}

body.view-3d .pawn::after {
  content: "";
  position: absolute;
  left: 5%;
  right: 5%;
  bottom: -12%;
  height: 40%;
  border-radius: 50%;
  background: rgba(4, 22, 15, 0.45);
  filter: blur(1px);
}

/* (téléphone + 3D) */
body.view-3d .controls-mobile:not(:empty) {
  width: min(100%, 720px);
  margin-top: 18px;
  padding: 18px 16px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-card);
  background: var(--paper);
  box-shadow: 0 8px 0 var(--table-shadow);
}

body.view-3d .controls-mobile .controls {
  width: 100%;
  gap: 14px;
}

body.view-3d .controls-mobile .die {
  width: 56px;
  height: 56px;
}

#btn-view-3d[aria-pressed="true"] {
  background: var(--sun);
  border-color: var(--sun);
  color: var(--ink);
}

/* panneau de droite */
.side {
  display: grid;
  gap: 18px;
}

.side-panel {
  padding: 16px;
}

.side-panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
  font-variation-settings: "wdth" 112;
}

.players {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.player-row {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 4px 10px;
  padding: 10px;
  border: 2px solid var(--paper-line);
  border-radius: 12px;
}

.player-row.is-turn {
  border-color: var(--ink);
  background: #f8efd6;
}

.player-row.is-bankrupt {
  opacity: 0.5;
}

.player-row .name {
  min-width: 0;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-row .money {
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  font-variation-settings: "wdth" 110;
}

.player-row .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  grid-column: 2 / 4;
}

.money-delta {
  position: absolute;
  top: -10px;
  right: 10px;
  padding: 1px 7px;
  border-radius: 999px;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  animation: delta 1600ms ease-out forwards;
}

.money-delta.up { background: var(--good); }
.money-delta.down { background: var(--bad); }

@keyframes delta {
  0% { opacity: 0; transform: translateY(6px); }
  15% { opacity: 1; transform: translateY(0); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-8px); }
}

.log-panel {
  display: flex;
  flex-direction: column;
}

.log {
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 280px;
  margin: 0 0 12px;
  padding: 0 4px 0 0;
  overflow-y: auto;
  list-style: none;
  font-size: 14px;
}

.log li {
  padding-left: 10px;
  border-left: 3px solid var(--paper-line);
}

.log li.good { border-color: var(--good); }
.log li.bad { border-color: var(--bad); }
.log li.dice { border-color: var(--sun-deep); }
.log li.turn { border-color: var(--ink); font-weight: 700; }
.log li.system { color: var(--ink-soft); }

.log li.chat {
  border-color: var(--airport);
  background: #f1ead8;
  border-radius: 0 6px 6px 0;
  padding: 3px 8px 3px 10px;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.chat-form input {
  min-width: 0;
  min-height: 36px;
  padding: 6px 10px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-btn);
}

/* ---------- Dialogue, toasts, bannière ---------- */

.dialog {
  max-width: 440px;
  padding: 22px;
  color: var(--ink);
}

.dialog::backdrop {
  background: rgba(4, 22, 15, 0.6);
}

.dialog h2 {
  margin: 0 0 8px;
  font-variation-settings: "wdth" 112;
}

.dialog p {
  margin: 0 0 18px;
  color: var(--ink-soft);
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dialog .btn-ghost {
  color: var(--ink);
}

/* ---------- Possessions ---------- */
.possessions-btn {
  padding: 2px 8px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.possessions-btn:hover {
  background: var(--sun);
}

.dialog-wide {
  width: min(94vw, 900px);
  max-width: none;
  max-height: 88vh;
}

.possessions-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.possessions-head h2 {
  margin: 0;
}

.dialog .possessions-head .btn-ghost {
  color: var(--ink);
}

.possessions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.title-card {
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 4px 0 var(--ink);
  font-size: 13px;
}

.title-card-head {
  display: grid;
  gap: 1px;
  padding: 10px;
  border-bottom: 2px solid var(--ink);
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.title-card-head.is-airport {
  background: var(--airport);
}

.title-card-head span {
  font-size: 11px;
  font-weight: 700;
}

.title-card-head strong {
  font-size: 17px;
  font-variation-settings: "wdth" 112;
}

.title-card-rent {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 8px 10px;
  background: #f5e7c0;
  font-weight: 600;
}

.dialog .title-card p {
  margin: 0;
}

.title-card-rent strong {
  white-space: nowrap;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.title-card-status {
  margin: 0;
  padding: 6px 10px 2px;
  color: var(--ink-soft);
  font-weight: 600;
}

.title-card table {
  width: 100%;
  border-collapse: collapse;
}

.title-card td {
  padding: 3px 10px;
}

.title-card td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.title-card tr.is-now td {
  background: #e9fbf1;
  font-weight: 800;
}

.title-card-foot {
  margin: 0;
  padding: 6px 10px 8px;
  border-top: 1px solid var(--paper-line);
  color: var(--ink-soft);
  font-size: 11px;
}

.title-card.is-mortgaged {
  opacity: 0.75;
}

.title-card.is-mortgaged .title-card-head {
  filter: grayscale(0.7);
}

.toasts {
  position: fixed;
  bottom: 16px;
  left: 50%;
  z-index: 50;
  display: grid;
  gap: 8px;
  width: min(92vw, 420px);
  transform: translateX(-50%);
}

.toast {
  padding: 12px 16px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 0 5px 0 var(--ink);
  font-weight: 600;
  animation: toast-in 200ms ease-out;
}

.toast.is-error {
  background: #ffe1e6;
}

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

.connection-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  padding: 8px;
  background: var(--chance);
  color: #fff;
  font-weight: 700;
  text-align: center;
}

/* ---------- Petits écrans ---------- */

@media (max-width: 1000px) {
  .game-layout {
    grid-template-columns: 1fr;
  }

  .board-stage {
    width: 100%;
    max-width: 720px;
  }

  .log {
    height: 220px;
  }
}

@media (max-width: 760px) {
  .lobby-body {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .topbar-game .wordmark-small {
    display: none;
  }

  .controls-mobile:not(:empty) {
    margin-top: 26px;
    padding: 18px 16px;
    border: 2px solid var(--ink);
    border-radius: var(--radius-card);
    background: var(--paper);
    box-shadow: 0 8px 0 var(--table-shadow);
  }

  .controls-mobile .controls {
    width: 100%;
    gap: 14px;
  }

  .controls-mobile .die {
    width: 56px;
    height: 56px;
  }

  .controls-mobile .dice {
    gap: 14px;
  }

  .controls-mobile .turn-label {
    font-size: 18px;
  }

  .board {
    min-width: 0;
  }
}

@media (max-width: 480px) {
  .join-form {
    grid-template-columns: 1fr;
  }

  .tab {
    font-size: 13px;
  }
}

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

/* ---------- Maisons et hôtels en volume (vue 3D) ---------- */
.building-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transform-style: preserve-3d;
  display: none;
}

body.view-3d .building-layer {
  display: block;
}

/* en 3D, les petits carrés plats laissent la place aux maisons en volume */
body.view-3d .buildings {
  visibility: hidden;
}

.b3d {
  --w: 1.65cqi; /* largeur (le long de la bande) */
  --d: 1.6cqi;  /* profondeur */
  --h: 1.3cqi;  /* hauteur des murs */
  --r: calc(var(--d) / 2); /* hauteur du toit (pente à 45°) */
  --wall: #3ad17a;
  --wall-side: #2bb365;
  --wall-back: #23994f;
  --roof: #c0392b;
  --roof-dark: #962d22;
  position: absolute;
  left: 0;
  top: 0;
  width: var(--w);
  height: var(--d);
  transform: translate(calc(var(--x) - var(--w) / 2), calc(var(--y) - var(--d) / 2)) rotateZ(var(--a));
  transform-style: preserve-3d;
}

/* ombre portée sur le plateau */
.b3d::before {
  content: "";
  position: absolute;
  inset: -12%;
  border-radius: 20%;
  background: rgba(4, 22, 15, 0.35);
  filter: blur(1px);
}

.b3d b {
  position: absolute;
  display: block;
  box-shadow: inset 0 0 0 1px rgba(4, 22, 15, 0.45);
}

.b3d .w.front {
  left: 0;
  top: calc(var(--d) - var(--h));
  width: var(--w);
  height: var(--h);
  background: var(--wall);
  transform-origin: 50% 100%;
  transform: rotateX(-90deg);
}

.b3d .w.back {
  left: 0;
  top: 0;
  width: var(--w);
  height: var(--h);
  background: var(--wall-back);
  transform-origin: 50% 0;
  transform: rotateX(90deg);
}

.b3d .w.left,
.b3d .w.right {
  top: 0;
  width: calc(var(--h) + var(--r));
  height: var(--d);
  background: var(--wall-side);
}

.b3d .w.left {
  left: 0;
  transform-origin: 0 50%;
  transform: rotateY(-90deg);
}

.b3d .w.right {
  left: calc(var(--w) - var(--h) - var(--r));
  transform-origin: 100% 50%;
  transform: rotateY(90deg);
}

/* pignons triangulaires de la maison */
.house3d .w.left { clip-path: polygon(0 0, 61.9% 0, 100% 50%, 61.9% 100%, 0 100%); }
.house3d .w.right { clip-path: polygon(100% 0, 38.1% 0, 0 50%, 38.1% 100%, 100% 100%); }

.b3d .roof {
  left: -10%;
  width: 120%;
  height: calc(var(--d) * 0.7071 + 1px);
}

.b3d .roof.front {
  top: calc(var(--d) * 0.2929 - 1px);
  background: var(--roof);
  transform-origin: 50% 100%;
  transform: translateZ(var(--h)) rotateX(-45deg);
}

.b3d .roof.back {
  top: 0;
  background: var(--roof-dark);
  transform-origin: 50% 0;
  transform: translateZ(var(--h)) rotateX(45deg);
}

/* hôtel : un bloc rouge plus large et plus haut, toit plat, avec des fenêtres */
.hotel3d {
  --w: 4cqi;
  --d: 2cqi;
  --h: 2.6cqi;
  --r: 0px;
  --wall: #e63946;
  --wall-side: #c42d39;
  --wall-back: #a8232f;
}

.hotel3d .w.front {
  background:
    repeating-linear-gradient(90deg, transparent 0 14%, rgba(255, 244, 200, 0.9) 14% 26%, transparent 26% 33.3%) 0 22% / 100% 22% no-repeat,
    repeating-linear-gradient(90deg, transparent 0 14%, rgba(255, 244, 200, 0.9) 14% 26%, transparent 26% 33.3%) 0 62% / 100% 22% no-repeat,
    var(--wall);
}

.hotel3d .top {
  inset: 0;
  background: #ff6b6b;
  transform: translateZ(var(--h));
}

/* ---------- Échanges entre joueurs ---------- */
.trades {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.trade {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 2px solid var(--sun);
  border-radius: 10px;
  background: #faf3e0;
}

.trade p {
  margin: 0;
  font-size: 14px;
}

.trade-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin: 14px 0;
}

.trade-side {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 2px solid var(--paper-line);
  border-radius: 12px;
}

.trade-side legend {
  padding: 0 6px;
  font-weight: 800;
}

.trade-squares {
  display: grid;
  gap: 4px;
  max-height: 38vh;
  overflow-y: auto;
}

.trade-square {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-left: 6px solid var(--group);
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.trade-square:has(input:disabled) {
  color: var(--ink-soft);
  cursor: not-allowed;
}

.trade-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.trade-field input {
  width: 110px;
  min-height: 36px;
  padding: 4px 8px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-btn);
  font: inherit;
}

/* ---------- Règles ---------- */
.rules {
  display: grid;
  gap: 14px;
  margin-top: 12px;
  overflow-y: auto;
  font-size: 15px;
  line-height: 1.45;
}

.rules h3 {
  margin: 0 0 4px;
  font-variation-settings: "wdth" 110;
}

.rules p,
.rules ul {
  margin: 0;
}

.rules ul {
  padding-left: 20px;
}

.rules li + li {
  margin-top: 4px;
}

/* Cartes des aéroports et téléphériques : couleur neutre (seules les villes ont une couleur de groupe) */
.deed-head.deed-airport,
.deed-head.deed-cablecar,
.title-card-head.is-airport,
.title-card-head.is-cablecar {
  background: #e7e5df;
  color: var(--ink);
  text-shadow: none;
}

/* ---------- Petites cartes de propriété (échanges) ---------- */
.mini-card {
  display: grid;
  overflow: hidden;
  width: 132px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 3px 0 var(--ink);
  font-size: 12px;
  cursor: pointer;
}

.mini-card-head {
  display: grid;
  gap: 1px;
  padding: 6px 6px 7px;
  border-bottom: 2px solid var(--ink);
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.mini-card-head.is-neutral {
  background: #e7e5df;
  color: var(--ink);
  text-shadow: none;
}

.mini-card-head span {
  font-size: 10px;
  font-weight: 700;
}

.mini-card-head strong {
  font-size: 14px;
  font-variation-settings: "wdth" 105;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.mini-card-body p {
  margin: 0;
}

.mini-card-rent {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
  padding: 5px 7px;
  background: #f5e7c0;
  font-weight: 600;
}

.mini-card-rent strong {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.mini-card-foot {
  padding: 4px 7px 6px;
  color: var(--ink-soft);
  font-size: 11px;
}

.mini-card.is-mortgaged .mini-card-head {
  filter: grayscale(0.7);
}

.mini-card.is-mortgaged {
  opacity: 0.8;
}

/* sélection dans la fenêtre d'échange : la carte entière est le bouton */
.trade-squares {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 10px;
  padding: 4px 2px 8px;
}

.trade-pick {
  position: relative;
  display: grid;
  gap: 4px;
  justify-items: center;
  border-radius: 10px;
  transition: transform 120ms ease;
}

.trade-pick:hover .mini-card {
  transform: translateY(-2px);
}

.trade-pick:has(input:checked) .mini-card {
  outline: 4px solid var(--sun);
  outline-offset: 2px;
  transform: translateY(-3px);
}

.trade-pick:has(input:checked)::after {
  content: "✓";
  position: absolute;
  top: -8px;
  right: -8px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--sun);
  font-weight: 900;
}

.trade-pick:has(input:focus-visible) .mini-card {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.trade-pick:has(input:disabled) {
  cursor: not-allowed;
}

.trade-pick:has(input:disabled) .mini-card {
  cursor: not-allowed;
  filter: grayscale(0.85);
  opacity: 0.55;
}

.trade-pick-note {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
}

/* panneau « Échanges » : cartes de chaque côté */
.trade-title {
  font-weight: 700;
}

.trade-offer {
  display: grid;
  gap: 4px;
}

.trade .trade-offer-title {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.trade-cards {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.trade .mini-card {
  width: 118px;
}

.tag.trade-chip {
  padding: 6px 10px;
  border: 2px solid var(--ink);
  background: #fff;
  font-size: 13px;
  font-weight: 800;
}

/* ---------- Responsive : zones cliquables et taille du plateau en 3D ---------- */
/* La barre du haut et le panneau de droite passent toujours au-dessus du plateau incliné :
   sinon, en petite fenêtre, la partie du plateau qui « dépasse » en 3D capte les clics. */
.topbar-game,
.side {
  position: relative;
  z-index: 10;
}

.board-wrap {
  position: relative;
  z-index: 1;
}

/* Le centre (dés + boutons) est posé un poil au-dessus du plateau. Son overflow:hidden l'empêche
   d'être en 3D, donc on le soulève lui-même : les clics arrivent bien sur les boutons. */
body.view-3d .board-center {
  transform: translateZ(2px);
}

/* En 3D, la perspective agrandit le bord avant du plateau : on le réduit pour qu'il tienne
   dans la largeur de l'écran, et on ne le remonte plus sous la barre du haut. */
body.view-3d .board-stage {
  margin: -11% 0 -9%; /* le plateau incliné est moins haut : on récupère l'espace vide au-dessus et en dessous */
}

body.view-3d .board {
  width: 84%;
  margin: 0 auto;
}

/* filet de sécurité : jamais de défilement horizontal de la page */
.screen-game {
  overflow-x: clip;
}

/* fenêtre étroite : la barre du haut passe sur deux lignes proprement */
@media (max-width: 760px) {
  .topbar-game {
    flex-wrap: wrap;
    justify-content: center;
  }

  .game-room {
    justify-content: center;
    gap: 8px;
  }

  .game-room > span {
    flex-basis: 100%;
    text-align: center;
  }
}

/* même chose pour les cases : légèrement au-dessus du fond du plateau pour recevoir les clics
   (les maisons et les pions sont posés juste au-dessus des cases) */
body.view-3d .board > .square {
  transform: translateZ(1px);
}

body.view-3d .building-layer,
body.view-3d .pawn-layer {
  transform: translateZ(1.5px);
}


/* ---------- Pions : vrais pions de jeu de société ---------- */
.pawn-defs {
  position: absolute;
  width: 0;
  height: 0;
}

/* vue de dessus (2D) : la tête au centre, le socle autour, avec un reflet */
.pawn-body {
  background:
    radial-gradient(circle at 40% 36%, rgba(255, 255, 255, 0.9) 0 8%, rgba(255, 255, 255, 0) 20%),
    radial-gradient(circle, var(--pawn) 0 33%, rgba(0, 0, 0, 0.32) 35% 39%, var(--pawn) 41% 100%);
  background-color: var(--pawn);
}

.pawn-figure {
  display: none;
}

/* vue 3D : le pion se lève, silhouette pleine dans la couleur du joueur */
body.view-3d .pawn-body {
  top: auto;
  right: -8%;
  bottom: 50%; /* le pied du pion est au centre de son emplacement */
  left: -8%;
  height: 170%;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  transform-origin: 50% 100%;
}

body.view-3d .pawn-figure {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 0.25cqi 0.2cqi rgba(4, 22, 15, 0.45));
}

.pawn-shape {
  fill: var(--pawn);
  stroke: var(--ink);
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.pawn-shine {
  fill: url(#pawn-shine);
  pointer-events: none;
}

.pawn-gloss {
  fill: #fff;
  opacity: 0.8;
}

/* ombre au sol, sous le pied du pion */
body.view-3d .pawn::after {
  top: 30%;
  right: 0;
  bottom: auto;
  left: 0;
  height: 40%;
}

/* pion sur l'Île perdue : anneau rouge au sol (3D) */
body.view-3d .pawn.is-jailed::after {
  background: rgba(230, 57, 70, 0.55);
  box-shadow: 0 0 0 0.3cqi var(--chance);
}

/* joueur dont c'est le tour : petit halo jaune au sol */
body.view-3d .pawn.is-current::after {
  background: rgba(217, 173, 69, 0.7);
  box-shadow: 0 0 0.6cqi 0.2cqi rgba(217, 173, 69, 0.9);
}

body.view-3d .pawn.is-jailed .pawn-body {
  box-shadow: none;
}

/* ---------- Objets pour les pions ---------- */
/* pastille d'un joueur avec son objet : fond blanc, anneau à sa couleur */
.pawn-dot.has-token {
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  border-color: var(--pawn);
  background: #fff !important;
}

.pawn-dot.has-token img {
  width: 82%;
  height: 82%;
  object-fit: contain;
}

/* sélecteur dans le lobby */
.token-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 8px;
  padding: 4px;
}

.token-option {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 8px 4px 6px;
  border: 2px solid var(--paper-line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.token-option img,
.token-option svg {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.token-option svg .pawn-shape {
  fill: var(--pawn);
  stroke-width: 2;
}

.token-option:hover:not(:disabled) {
  border-color: var(--ink);
  transform: translateY(-1px);
}

.token-option[aria-checked="true"] {
  border-color: var(--ink);
  background: color-mix(in srgb, var(--pawn) 22%, #fff);
  box-shadow: 0 0 0 3px var(--sun), 0 3px 0 3px var(--ink);
}

.token-option:disabled {
  cursor: not-allowed;
  opacity: 0.4;
  filter: grayscale(0.6);
}

/* sur le plateau, vue de dessus (2D) : l'objet dans un rond blanc cerclé de la couleur du joueur */
.pawn.is-object .pawn-body {
  border-color: var(--pawn);
  background: #fff;
}

.pawn-token {
  position: absolute;
  inset: 8%;
  width: 84%;
  height: 84%;
  object-fit: contain;
  pointer-events: none;
}

.pawn-base {
  display: none;
}

/* en 3D : l'objet se tient debout sur un socle rond à la couleur du joueur */
body.view-3d .pawn.is-object .pawn-body {
  border: 0;
  background: none;
}

body.view-3d .pawn-base {
  position: absolute;
  right: 6%;
  bottom: 0;
  left: 6%;
  display: block;
  height: 20%;
  border: 0.25cqi solid var(--ink);
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 35% 30%, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0) 55%),
    var(--pawn);
}

body.view-3d .pawn-token {
  inset: auto 0 10% 0;
  width: 100%;
  height: 78%;
  filter: drop-shadow(0 0.2cqi 0.15cqi rgba(4, 22, 15, 0.45));
}

@media (max-width: 760px) {
  .room-code {
    font-size: clamp(40px, 13vw, 96px);
  }
}

/* ---------- Pions en volume (vue 3D), comme les maisons ---------- */
.pawn-3d {
  display: none;
}

body.view-3d .pawn > .pawn-body {
  display: none;
}

body.view-3d .pawn-3d {
  position: absolute;
  inset: 0;
  display: block;
  transform-style: preserve-3d;
}

/* disques empilés : chacun est un rond posé à plat à la hauteur --z (fraction de la largeur du pion) */
.pawn-3d {
  --pw: 5cqi; /* largeur du pion : toutes les tailles des modèles en dépendent */
}

.p3-disc {
  position: absolute;
  top: calc(50% + (var(--dy, 0) - var(--r)) * 100%);
  left: calc(50% + (var(--dx, 0) - var(--r)) * 100%);
  width: calc(var(--r) * 200%);
  height: calc(var(--r) * 200%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0) 45%),
    radial-gradient(circle, var(--disc, var(--pawn)) 55%, color-mix(in srgb, var(--disc, var(--pawn)) 62%, #000) 100%);
  transform: translateZ(calc(var(--z) * var(--pw)));
}

.p3-disc.is-rim {
  box-shadow: inset 0 0 0 calc(var(--pw) * 0.025) color-mix(in srgb, var(--disc, var(--pawn)) 50%, #000);
}

/* socle des objets : un peu plus sombre, bord marqué */
.p3-base {
  background:
    radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 50%),
    radial-gradient(circle, var(--pawn) 60%, color-mix(in srgb, var(--pawn) 55%, #000) 100%);
}

.p3-base.is-top {
  box-shadow: inset 0 0 0 0.14cqi color-mix(in srgb, var(--pawn) 45%, #000), 0 0 0 0.08cqi var(--ink);
}

/* la figurine se lève sur le socle (comme le mur avant d'une maison) */
.p3-fig {
  position: absolute;
  bottom: 50%;
  left: -18%;
  width: 136%;
  height: 136%;
  transform-origin: 50% 100%;
  /* toujours vue de trois quarts : elle suit la rotation du plateau en restant tournée de 28°
     vers le joueur, pour qu'on voie à la fois sa face et son épaisseur */
  transform: rotateZ(calc(28deg - var(--spin))) translateZ(calc(0.18 * 5cqi)) rotateX(-90deg);
  transform-style: preserve-3d;
  transition: transform var(--spin-time) var(--spin-ease);
}

.p3-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: translateZ(calc(var(--k) * 0.15cqi));
}

/* faces avant et arrière : l'objet en métal argenté, avec ses détails */
.p3-face {
  object-fit: contain;
  filter: grayscale(1) brightness(1.18) contrast(1.25) drop-shadow(0 0 0.05cqi rgba(20, 26, 40, 0.8));
}

/* tranches : la silhouette pleine en métal plus sombre, pour l'épaisseur */
.p3-side {
  background: linear-gradient(180deg, #c9ced8, #7d8596 55%, #545b6b);
  -webkit-mask: var(--src) center / contain no-repeat;
  mask: var(--src) center / contain no-repeat;
}

/* ombre au sol un peu plus large pour les pions en volume */
body.view-3d .pawn::after {
  top: 18%;
  right: -6%;
  left: -6%;
  height: 64%;
  filter: blur(2px);
}

/* ---------- Aperçu du pion dans le lobby ---------- */
.pawn-preview {
  display: grid;
  justify-items: center;
  gap: 4px;
  width: 190px;
  margin: 14px auto 6px;
  padding: 0 0 10px;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: radial-gradient(circle at 50% 35%, #ffffff, #e4e8f5 75%);
  box-shadow: 0 4px 0 var(--ink);
}

.pawn-preview figcaption {
  font-size: 14px;
  font-weight: 800;
}

.preview-stage {
  display: grid;
  width: 100%;
  height: 170px;
  place-items: end center;
  padding-bottom: 26px;
  perspective: 700px;
}

/* petite case du plateau, qui oscille lentement pour montrer le volume */
.preview-floor {
  --spin: 0deg;
  position: relative;
  width: 84px;
  height: 84px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--paper);
  background-image: radial-gradient(#e4dccb 1px, transparent 1px);
  background-size: 8px 8px;
  transform: rotateX(56deg) rotateZ(-25deg);
  transform-style: preserve-3d;
  animation: preview-turn 5s ease-in-out infinite alternate;
}

@keyframes preview-turn {
  from { transform: rotateX(56deg) rotateZ(-35deg); }
  to { transform: rotateX(56deg) rotateZ(35deg); }
}

.preview-floor .pawn {
  top: calc(50% - 32px);
  left: calc(50% - 32px);
  width: 64px;
  height: 64px;
  transform: translateZ(1px);
  transition: none;
}

.preview-floor .pawn::after {
  content: "";
  position: absolute;
  top: 18%;
  right: -6%;
  left: -6%;
  height: 64%;
  border-radius: 50%;
  background: rgba(4, 22, 15, 0.35);
  filter: blur(3px);
}

.preview-floor .pawn-3d {
  position: absolute;
  inset: 0;
  display: block;
  transform-style: preserve-3d;
}

/* mêmes pions que sur le plateau, mais avec des tailles en pixels */
.preview-floor .pawn-3d {
  --pw: 64px;
}

.preview-floor .p3-base.is-top {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--pawn) 45%, #000), 0 0 0 1px var(--ink);
}

.preview-floor .p3-fig {
  transform: rotateZ(28deg) translateZ(calc(0.18 * 64px)) rotateX(-90deg);
  transition: none;
}

.preview-floor .p3-layer {
  transform: translateZ(calc(var(--k) * 2px));
}

.preview-floor .p3-face {
  filter: grayscale(1) brightness(1.18) contrast(1.25) drop-shadow(0 0 0.6px rgba(20, 26, 40, 0.8));
}

@media (prefers-reduced-motion: reduce) {
  .preview-floor {
    animation: none;
  }
}


/* ---------- Pièces des modèles : anneaux, plaques verticales, pavés ---------- */
.p3-ring {
  position: absolute;
  top: calc(50% - var(--r) * 100%);
  left: calc(50% - var(--r) * 100%);
  box-sizing: border-box;
  width: calc(var(--r) * 200%);
  height: calc(var(--r) * 200%);
  border: calc(var(--t) * var(--pw)) solid var(--disc, var(--pawn));
  border-radius: 50%;
  box-shadow: inset 0 0 0 calc(var(--pw) * 0.012) color-mix(in srgb, var(--disc, var(--pawn)) 55%, #000);
  transform: translateZ(calc(var(--z) * var(--pw)));
}

.p3-panel {
  position: absolute;
  top: calc(50% - var(--h) * 100%);
  left: calc(50% - var(--w) * 50%);
  width: calc(var(--w) * 100%);
  height: calc(var(--h) * 100%);
  background: linear-gradient(180deg, color-mix(in srgb, var(--disc, var(--pawn)) 75%, #fff), var(--disc, var(--pawn)) 45%, color-mix(in srgb, var(--disc, var(--pawn)) 70%, #000));
  transform-origin: 50% 100%;
  transform: rotateZ(var(--a)) translate3d(calc(var(--x) * var(--pw)), calc(var(--y) * var(--pw)), calc(var(--z) * var(--pw))) rotateX(-90deg);
}

.p3-panel.is-fin {
  clip-path: polygon(0 0, 100% 100%, 0 100%);
}

.p3-panel.is-spike {
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.p3-panel.is-wheel,
.p3-panel.is-window {
  border-radius: 50%;
}

.p3-panel.is-wheel {
  background: radial-gradient(circle, color-mix(in srgb, var(--disc) 60%, #fff) 0 22%, var(--disc) 26%);
}

.p3-panel.is-window {
  box-shadow: 0 0 0 calc(var(--pw) * 0.025) #5b6272;
}

.p3-box {
  position: absolute;
  top: calc(50% + (var(--y) - var(--d) / 2) * 100%);
  left: calc(50% + (var(--x) - var(--w) / 2) * 100%);
  width: calc(var(--w) * 100%);
  height: calc(var(--d) * 100%);
  transform: translateZ(calc(var(--z) * var(--pw)));
  transform-style: preserve-3d;
}

.p3-box b {
  position: absolute;
  display: block;
  box-shadow: inset 0 0 0 calc(var(--pw) * 0.012) rgba(4, 22, 15, 0.4);
}

.p3-box .f-top {
  inset: 0;
  background: color-mix(in srgb, var(--disc, var(--pawn)) 78%, #fff);
  transform: translateZ(calc(var(--h) * var(--pw)));
}

.p3-box .f-front {
  top: calc(100% - var(--h) * var(--pw));
  left: 0;
  width: 100%;
  height: calc(var(--h) * var(--pw));
  background: var(--disc, var(--pawn));
  transform-origin: 50% 100%;
  transform: rotateX(-90deg);
}

.p3-box .f-back {
  top: 0;
  left: 0;
  width: 100%;
  height: calc(var(--h) * var(--pw));
  background: color-mix(in srgb, var(--disc, var(--pawn)) 70%, #000);
  transform-origin: 50% 0;
  transform: rotateX(90deg);
}

.p3-box .f-left,
.p3-box .f-right {
  top: 0;
  width: calc(var(--h) * var(--pw));
  height: 100%;
  background: color-mix(in srgb, var(--disc, var(--pawn)) 84%, #000);
}

.p3-box .f-left {
  left: 0;
  transform-origin: 0 50%;
  transform: rotateY(-90deg);
}

.p3-box .f-right {
  left: calc(100% - var(--h) * var(--pw));
  transform-origin: 100% 50%;
  transform: rotateY(90deg);
}

/* toit de la voiture dans la couleur du joueur, vitres claires sur les côtés */
.p3-box .f-top.is-roof {
  background: color-mix(in srgb, var(--pawn) 80%, #fff);
}

/* points du dé (blancs) */
.p3-box b[class*="dots-"] {
  --dot: radial-gradient(circle, #fff 0 52%, rgba(255, 255, 255, 0) 58%);
  background-repeat: no-repeat;
  background-size: 22% 22%;
}

.p3-box .dots-1 { background-image: var(--dot), none; background-position: 50% 50%; }
.p3-box .dots-3 { background-image: var(--dot), var(--dot), var(--dot); background-position: 15% 15%, 50% 50%, 85% 85%; }
.p3-box .dots-4 { background-image: var(--dot), var(--dot), var(--dot), var(--dot); background-position: 15% 15%, 85% 15%, 15% 85%, 85% 85%; }
.p3-box .dots-5 { background-image: var(--dot), var(--dot), var(--dot), var(--dot), var(--dot); background-position: 15% 15%, 85% 15%, 50% 50%, 15% 85%, 85% 85%; }
.p3-box .dots-6 { background-image: var(--dot), var(--dot), var(--dot), var(--dot), var(--dot), var(--dot); background-position: 18% 15%, 82% 15%, 18% 50%, 82% 50%, 18% 85%, 82% 85%; }

/* les faces du dé gardent leur couleur sous les points */
.p3-box .f-top[class*="dots-"] { background-color: color-mix(in srgb, var(--pawn) 78%, #fff); }
.p3-box .f-front[class*="dots-"] { background-color: var(--pawn); }
.p3-box .f-back[class*="dots-"] { background-color: color-mix(in srgb, var(--pawn) 70%, #000); }
.p3-box .f-left[class*="dots-"],
.p3-box .f-right[class*="dots-"] { background-color: color-mix(in srgb, var(--pawn) 84%, #000); }

/* les objets sont un peu plus petits que le pion classique : on les agrandit pour qu'ils se voient bien */
.pawn-3d.pawn-model {
  transform: scale3d(1.3, 1.3, 1.3);
  transform-origin: 50% 50% 0;
}

/* le plateau est toujours incliné : il prend moins de hauteur, on peut donc l'élargir */
body.view-3d .board-stage {
  width: min(100%, calc((100vh - 90px) * 1.3));
}

@media (max-width: 1000px) {
  body.view-3d .board-stage {
    width: 100%;
    max-width: 820px;
  }
}

/* ======================================================================
   Tout tient dans la fenêtre, sans défilement (ordinateur et tablette)
   ====================================================================== */

/* ---------- Lobby : code + joueurs à gauche, réglages à droite ---------- */
.lobby-body {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 560px);
  max-width: 1240px;
  padding-top: 1vh;
}

.room-code {
  font-size: clamp(40px, 6.2vw, 96px);
}

.invite-actions {
  margin-top: 18px;
}

.lobby-players-card {
  margin-top: 18px;
  padding: 16px 18px;
  color: var(--ink);
}

.lobby-settings > h3:first-child {
  margin-top: 0;
}

.lobby-panel h3 {
  margin: 16px 0 8px;
}

.pawn-choice {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 168px;
  gap: 12px;
  align-items: start;
}

.token-picker {
  grid-template-columns: repeat(auto-fill, minmax(66px, 1fr));
  gap: 6px;
  padding: 2px;
}

.token-option {
  padding: 6px 2px 5px;
}

.token-option img,
.token-option svg {
  width: 34px;
  height: 34px;
}

.pawn-choice .pawn-preview {
  width: 168px;
  margin: 0;
}

.pawn-choice .preview-stage {
  height: 150px;
}

.lobby-settings #btn-start {
  width: 100%;
  margin-top: 14px;
}

@media (max-width: 760px) {
  .pawn-choice {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

/* ---------- Partie : la page fait exactement la hauteur de la fenêtre ---------- */
@media (min-width: 761px) {
  .screen-game:not([hidden]) {
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-height: 0;
    padding: 10px 16px 12px;
    overflow: hidden;
  }

  .topbar-game {
    flex: none;
    margin-bottom: 8px;
  }

  .game-layout {
    flex: 1;
    min-height: 0;
    width: 100%;
    grid-template-columns: minmax(0, 1fr) clamp(260px, 26vw, 340px);
    gap: 16px;
    align-items: stretch;
  }

  .board-wrap {
    justify-content: center;
    min-height: 0;
  }

  /* le plateau prend la place disponible en hauteur (il est incliné, donc moins haut que large) */
  body.view-3d .board-stage {
    width: min(100%, calc((100vh - 70px) * 1.32));
    max-width: none;
  }

  /* colonne de droite : les panneaux se partagent la hauteur, et défilent à l'intérieur si besoin */
  .side {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    overflow: hidden;
  }

  .side > .side-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 12px 14px;
  }

  .side-panel h2 {
    flex: none;
    margin-bottom: 8px;
    font-size: 17px;
  }

  .side > .side-panel:first-child {
    flex: 0 1 auto;
  }

  .players {
    min-height: 0;
    overflow-y: auto;
  }

  #trades-panel {
    flex: 0 1 auto;
    max-height: 38%;
  }

  .trades {
    min-height: 0;
    overflow-y: auto;
  }

  #my-props-panel {
    flex: 1 1 0;
    min-height: 110px;
  }

  .my-props {
    flex: 1;
    min-height: 0;
    max-height: none;
  }

  .log-panel {
    flex: 1 1 0;
    min-height: 140px;
  }

  .log {
    flex: 1;
    height: auto;
    min-height: 0;
  }

  .chat-form {
    flex: none;
  }
}

/* écrans moyens : on garde le plateau et la colonne de droite côte à côte */
@media (min-width: 761px) and (max-width: 1000px) {
  .game-layout {
    grid-template-columns: minmax(0, 1fr) 260px;
  }

  .log {
    height: auto;
  }
}

/* --- ajustements pour que tout tienne --- */
@media (min-width: 761px) {
  .topbar-game {
    width: 100%;
  }

  /* liste des joueurs plus compacte, et jamais plus de 45 % de la colonne */
  .side > .side-panel:first-child {
    max-height: 45%;
  }

  .player-row {
    gap: 2px 8px;
    padding: 6px 8px;
  }

  .player-row .pawn-dot {
    width: 22px;
    height: 22px;
  }

  .players {
    gap: 6px;
  }
}

/* lobby : joueurs sur deux colonnes, code de la room adapté à la hauteur */
.room-code {
  font-size: clamp(40px, min(6.2vw, 11vh), 96px);
}

@media (min-width: 900px) {
  .lobby-players {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .lobby-player {
    gap: 8px;
    min-height: 40px;
    padding: 5px 8px;
  }

  .lobby-player .tag {
    padding: 1px 6px;
    font-size: 11px;
  }
}

/* fenêtre peu haute : on resserre les marges du lobby */
@media (max-height: 760px) and (min-width: 761px) {
  .screen-lobby .topbar {
    margin-bottom: 8px;
  }

  .lobby-panel {
    padding: 14px 18px;
  }

  .lobby-panel h3 {
    margin: 10px 0 6px;
  }

  .invite-actions {
    margin-top: 12px;
  }

  .invite-link {
    margin-top: 8px;
  }

  .lobby-players-card {
    margin-top: 12px;
    padding: 12px 14px;
  }

  .pawn-choice .preview-stage {
    height: 120px;
    padding-bottom: 18px;
  }

  .lobby-settings #btn-start {
    min-height: 46px;
    margin-top: 10px;
  }
}

/* lobby : sur écran moyen, la colonne des réglages est plus étroite pour laisser la place aux joueurs */
@media (min-width: 761px) and (max-width: 1099px) {
  .lobby-body {
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 22px;
  }

  .pawn-choice {
    grid-template-columns: minmax(0, 1fr) 140px;
  }

  .pawn-choice .pawn-preview {
    width: 140px;
  }
}

/* les joueurs passent sur deux colonnes seulement si la carte est assez large */
.lobby-players-card {
  container-type: inline-size;
}

@media (min-width: 900px) {
  .lobby-players {
    grid-template-columns: 1fr;
  }
}

@container (min-width: 520px) {
  .lobby-players {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 761px) {
  #my-props-panel {
    overflow-y: auto;
  }
}

@media (min-width: 761px) and (max-width: 1099px) {
  .pawn-choice {
    grid-template-columns: minmax(0, 1fr) 118px;
    gap: 10px;
  }

  .pawn-choice .pawn-preview {
    width: 118px;
  }

  .pawn-choice .preview-stage {
    height: 118px;
    padding-bottom: 14px;
  }

  .token-picker {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
  }

  .token-option {
    padding: 4px 1px;
    font-size: 10px;
  }

  .token-option img,
  .token-option svg {
    width: 26px;
    height: 26px;
  }

  .lobby-settings .color-picker {
    gap: 6px;
  }

  .lobby-settings .swatch {
    width: 32px;
    height: 32px;
  }
}

@container (min-width: 420px) {
  .lobby-players {
    grid-template-columns: 1fr 1fr;
  }
}

@container (max-width: 559px) {
  .lobby-player .name {
    overflow: hidden;
    min-width: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .lobby-player .tag:not(.tag-host) {
    display: none;
  }
}

@media (min-width: 761px) and (max-width: 1099px) {
  .lobby-settings .segmented {
    gap: 6px;
  }

  .lobby-settings .segmented button {
    padding: 6px 10px;
    font-size: 14px;
  }
}

@media (max-height: 640px) {
  .screen-auth {
    padding-top: 8px;
    padding-bottom: 8px;
  }
}

/* tablette en hauteur : plateau en haut, panneaux côte à côte en dessous */
@media (min-width: 761px) and (orientation: portrait) {
  .game-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  body.view-3d .board-stage {
    width: min(100%, calc((100vh - 330px) * 1.3));
  }

  .side {
    flex-direction: row;
    align-items: stretch;
  }

  .side > .side-panel,
  .side > .side-panel:first-child,
  #my-props-panel,
  .log-panel {
    flex: 1 1 0;
    max-height: none;
    min-height: 0;
  }

  #trades-panel {
    max-height: none;
  }
}

#my-props-panel .debug-move {
  flex: none;
}

/* aperçu du pion un peu dézoomé : on voit le pion en entier, tête comprise */
.pawn-preview {
  --pv: 50px; /* largeur du pion dans l'aperçu */
}

.preview-floor {
  width: calc(var(--pv) * 1.35);
  height: calc(var(--pv) * 1.35);
}

.preview-floor .pawn {
  top: calc(50% - var(--pv) / 2);
  left: calc(50% - var(--pv) / 2);
  width: var(--pv);
  height: var(--pv);
}

.preview-floor .pawn-3d {
  --pw: var(--pv);
}

.preview-stage {
  padding-bottom: 30px;
}

@media (min-width: 761px) and (max-width: 1099px) {
  .pawn-choice .pawn-preview {
    --pv: 36px;
  }

  .pawn-choice .preview-stage {
    padding-bottom: 20px;
  }
}

@media (max-height: 760px) and (min-width: 761px) {
  .pawn-choice .pawn-preview {
    --pv: 40px;
  }
}

.pawn-preview {
  --pv: 46px;
}

.preview-stage {
  padding-bottom: 18px;
}

/* ---------- Cartes un peu plus petites partout ---------- */
.mini-card {
  width: 112px;
  border-radius: 7px;
  font-size: 11px;
}

.mini-card-head {
  padding: 5px 5px 6px;
}

.mini-card-head span {
  font-size: 9px;
}

.mini-card-head strong {
  font-size: 12.5px;
}

.mini-card-rent {
  padding: 4px 6px;
}

.mini-card-rent strong {
  font-size: 12.5px;
}

.mini-card-foot {
  padding: 3px 6px 5px;
  font-size: 10px;
}

.trade .mini-card {
  width: 104px;
}

.possessions-grid {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}

/* ---------- Fenêtre d'échange plus grande : toutes les cartes se voient en entier ---------- */
#dialog-trade {
  width: min(96vw, 1180px);
  max-height: 94vh;
  overflow-y: auto;
}

#dialog-trade .trade-squares {
  max-height: none;
  overflow: visible;
  padding: 8px 4px 10px;
}

#dialog-trade .trade-columns {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

/* ---------- Mes propriétés : la carte à gauche, les boutons à droite ---------- */
.panel-head {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.panel-head h2 {
  margin: 0;
}

.side-panel .panel-head {
  margin-bottom: 8px;
}

.panel-head .btn-ghost {
  min-height: 28px;
  padding: 2px 8px;
  color: var(--ink);
  font-size: 12px;
}

.my-prop {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 6px;
}

.my-prop .mini-card {
  width: 104px;
}

.my-prop .my-prop-actions {
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
}

.my-prop .my-prop-actions .btn-small {
  width: 100%;
  white-space: normal;
  line-height: 1.15;
}

/* grandes cartes (Mes propriétés en grand) : boutons sous la carte */
.title-card-actions {
  padding: 8px 10px 10px;
  border-top: 1px solid var(--paper-line);
}

.title-card-actions .btn-small {
  flex: 1 1 auto;
}

@media (min-width: 761px) {
  /* les cartes de Mes propriétés ont plus de place que le journal */
  #my-props-panel {
    flex: 2 1 0;
    overflow: hidden;
  }

  #my-props-panel .my-props {
    overflow-y: auto;
  }

  .log-panel {
    flex: 1 1 0;
  }

  #my-props-panel .hint {
    flex: none;
    font-size: 13px;
  }
}

/* ---------- Dés en 3D lancés au milieu du plateau ---------- */
.dice-layer {
  --ds: 6.4cqi; /* taille d'un dé */
  position: relative;
  grid-row: 2 / 11;
  grid-column: 2 / 11;
  pointer-events: none;
  transform: translateZ(3px);
  transform-style: preserve-3d;
}

.die3d {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--ds);
  height: var(--ds);
  transform-style: preserve-3d;
  will-change: transform;
}

.die3d-face {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  padding: 13%;
  border: max(1px, 0.25cqi) solid var(--ink);
  border-radius: 18%;
  background: radial-gradient(circle at 30% 25%, #ffffff, #eef0f6 70%);
  backface-visibility: hidden;
}

.die3d-face .pip {
  width: 76%;
  height: 76%;
  margin: auto;
  border-radius: 50%;
  background: var(--ink);
}

.die3d-face.face-1 .pip { background: var(--chance); }

.die3d .face-1 { transform: translateZ(calc(var(--ds) / 2)); }
.die3d .face-6 { transform: rotateY(180deg) translateZ(calc(var(--ds) / 2)); }
.die3d .face-3 { transform: rotateY(90deg) translateZ(calc(var(--ds) / 2)); }
.die3d .face-4 { transform: rotateY(-90deg) translateZ(calc(var(--ds) / 2)); }
.die3d .face-2 { transform: rotateX(-90deg) translateZ(calc(var(--ds) / 2)); }
.die3d .face-5 { transform: rotateX(90deg) translateZ(calc(var(--ds) / 2)); }

/* faces de côté un peu plus sombres : on sent le volume */
.die3d .face-3,
.die3d .face-4 {
  background: radial-gradient(circle at 30% 25%, #f4f5f9, #d9dce6 75%);
}

.die3d .face-2,
.die3d .face-5 {
  background: radial-gradient(circle at 30% 25%, #f8f9fc, #e2e5ee 75%);
}

/* double : les dés brillent un instant */
.dice-layer.is-double .die3d-face {
  border-color: var(--sun-deep);
  box-shadow: 0 0 0.8cqi rgba(217, 173, 69, 0.9);
}

/* les dés plats du centre ne servent plus : les vrais dés sont sur le plateau */
.controls .dice {
  display: none;
}

/* ---------- Panneau « Mes propriétés » : un seul gros bouton ---------- */
#my-props-panel {
  padding: 0;
}

@media (min-width: 761px) {
  #my-props-panel {
    flex: none;
    min-height: 0;
    overflow: visible;
  }
}

.props-open {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-radius: var(--radius-card);
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 17px;
  font-weight: 800;
  font-variation-settings: "wdth" 112;
  text-align: left;
  cursor: pointer;
}

.props-open::after {
  content: "→";
  font-size: 18px;
}

.props-open:hover {
  background: #f7ecd0;
}

.props-open .props-count {
  margin-left: auto;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
}

.props-open.is-alert {
  background: #ffe3e6;
  box-shadow: inset 0 0 0 2px var(--chance);
}

/* ---------- Propriétaire : une petite plaque plantée au-dessus de la case ---------- */
.owner-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transform: translateZ(2px);
  transform-style: preserve-3d;
}

/* point d'ancrage sur la case ; la plaque se lève face au joueur (comme les pions) */
.owner-mark {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  transform: translate3d(var(--x), var(--y), 0) rotateZ(calc(-1 * var(--spin))) rotateX(calc(-1 * var(--tilt)));
  transform-origin: 0 0;
  transform-style: preserve-3d;
  transition: transform var(--spin-time) var(--spin-ease);
}

.owner-flag {
  position: absolute;
  bottom: 0;
  left: 0;
  max-width: 9cqi;
  overflow: hidden;
  padding: 0.25cqi 0.7cqi;
  border: max(1px, 0.18cqi) solid var(--ink);
  border-radius: 999px;
  background: var(--owner);
  box-shadow: 0 0.25cqi 0 rgba(4, 22, 15, 0.45);
  color: #fff;
  font-size: max(8px, 1.25cqi);
  font-weight: 800;
  line-height: 1.15;
  text-overflow: ellipsis;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.55);
  white-space: nowrap;
  transform: translate(-50%, -1.6cqi);
}

/* petit mât qui relie la plaque à la case */
.owner-flag::after {
  content: none;
}

.owner-mark::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: calc(-0.12cqi);
  width: 0.24cqi;
  height: 1.7cqi;
  border-radius: 0.2cqi;
  background: var(--ink);
}

.owner-mark.is-mortgaged .owner-flag {
  background: repeating-linear-gradient(45deg, var(--owner) 0 4px, color-mix(in srgb, var(--owner) 55%, #fff) 4px 8px);
  opacity: 0.8;
}

/* la plaque se lit dans le sens de la case (comme le nom et le prix), debout au-dessus d'elle */
.owner-mark {
  transform: translate3d(var(--x), var(--y), 0) rotateZ(var(--a)) rotateX(-90deg);
  transition: none;
}

/* plaque presque à plat (inclinée de 35° vers le bord), en relief au-dessus de la case :
   elle se lit comme le texte de la case et reste visible de tous les côtés */
.owner-mark {
  transform: translate3d(var(--x), var(--y), 0.4cqi) rotateZ(var(--a)) rotateX(-35deg);
}

.owner-mark::before {
  display: none;
}

.owner-flag {
  transform: translate(-50%, 50%);
  box-shadow: 0 0.3cqi 0.4cqi rgba(4, 22, 15, 0.5);
}

.owner-flag {
  transform: translate(-50%, 50%);
}

/* ---------- Annonce d'argent au centre du plateau (3 s) ---------- */
.money-announce {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 8;
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: min(70%, 320px);
  max-width: 82%;
  padding: 14px 22px;
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 0 8px 0 var(--ink), 0 18px 40px rgba(3, 18, 12, 0.45);
  color: var(--ink);
  text-align: center;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.money-announce[hidden] {
  display: none;
}

.money-announce.is-good {
  background: #e3f9ec;
  border-color: #13804a;
}

.money-announce.is-bad {
  background: #ffe6e9;
  border-color: #c2182e;
}

.money-announce-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: clamp(18px, 3.2cqi, 30px);
  font-weight: 900;
  font-variation-settings: "wdth" 112;
  line-height: 1.15;
}

.money-announce-line .pawn-dot {
  flex: none;
  width: 1.2em;
  height: 1.2em;
}

.money-announce-reason {
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: clamp(12px, 1.6cqi, 15px);
  font-weight: 600;
}

.money-announce.is-showing {
  animation: money-pop 3s ease forwards;
}

@keyframes money-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  8% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  14% { transform: translate(-50%, -50%) scale(1); }
  85% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -54%) scale(0.96); }
}

/* ---------- Panneau de contrôle ---------- */
.admin-badge {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--sun);
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.admin-body {
  display: grid;
  gap: 16px;
  max-width: 1240px;
  margin: 0 auto;
}

.admin-head {
  color: var(--paper);
}

.admin-head h1 {
  margin: 0 0 4px;
  font-variation-settings: "wdth" 115;
}

.admin-head .hint {
  color: #e9e0c6;
}

.admin-rooms {
  display: grid;
  gap: 14px;
}

.admin-room {
  padding: 14px 16px;
}

.admin-room.is-finished {
  opacity: 0.8;
}

.admin-room-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.admin-room-head h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.04em;
}

.admin-room-head .my-prop-actions {
  margin-left: auto;
}

.admin-players {
  display: grid;
  gap: 6px;
}

.admin-player {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(160px, 1fr) minmax(0, 2fr);
  align-items: center;
  gap: 8px 14px;
  padding: 8px 10px;
  border: 2px solid var(--paper-line);
  border-radius: 10px;
}

.admin-player.is-turn {
  border-color: var(--ink);
  background: #f8efd6;
}

.admin-player.is-bankrupt {
  opacity: 0.55;
}

.admin-who {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.admin-who .pawn-dot {
  width: 22px;
  height: 22px;
}

.admin-info {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.admin-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.admin-tools input {
  width: 100px;
  min-height: 32px;
  padding: 3px 8px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-btn);
  font: inherit;
}

.admin-tools .btn-small,
.admin-room-head .btn-small {
  min-height: 32px;
  padding: 3px 10px;
  font-size: 13px;
}

@media (max-width: 900px) {
  .admin-player {
    grid-template-columns: 1fr;
  }
}

/* la plaque se pose juste au-delà du bord intérieur de la case (vers le centre), dans le sens de lecture */
.owner-flag {
  transform: translate(-50%, -0.25cqi);
}

/* plaque posée à plat, légèrement surélevée : visible de tous les côtés du plateau */
.owner-mark {
  transform: translate3d(var(--x), var(--y), 0.5cqi) rotateZ(var(--a));
}

.owner-flag {
  transform: translate(-50%, -0.35cqi);
}

.admin-tools select {
  min-height: 32px;
  max-width: 190px;
  padding: 3px 6px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-btn);
  background: #fff;
  font: inherit;
  font-size: 13px;
}

.admin-player {
  grid-template-columns: minmax(170px, 1fr) minmax(150px, 0.8fr) minmax(0, 2.6fr);
}

/* Bouton « Suivi » : le plateau tourne pour garder le pion qui joue en bas */
.btn-follow[aria-pressed="true"] {
  background: rgba(217, 173, 69, 0.18);
  border-color: rgba(217, 173, 69, 0.55);
}
.btn-follow[aria-pressed="false"] {
  opacity: 0.55;
  text-decoration: line-through;
}

/* ---------- Joueur parti : chrono et bouton Exclure ---------- */
.away-timer {
  font-variant-numeric: tabular-nums;
}
.possessions-btn.btn-kick {
  border-color: var(--bad);
  color: var(--bad);
}
.possessions-btn.btn-kick:hover {
  background: var(--bad);
  color: var(--paper);
}
#dialog-away {
  max-width: min(92vw, 460px);
}

/* ---------- Bouton du son ---------- */
.btn-sound {
  min-width: 38px;
  padding-inline: 8px;
  line-height: 1;
}

/* ---------- Classement de fin de partie ---------- */
#dialog-end {
  width: min(94vw, 760px);
  overflow-y: auto;
}
.end-ranking {
  list-style: none;
  margin: 14px 0 6px;
  padding: 0;
  display: grid;
  gap: 10px;
}
.end-row {
  display: grid;
  grid-template-columns: 40px minmax(110px, 0.8fr) 3fr;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 2px solid var(--paper-line);
  border-radius: 12px;
  background: #fff;
}
.end-row.is-winner {
  border-color: var(--sun-deep);
  background: #f7ecd0;
  box-shadow: 0 3px 0 var(--sun-deep);
}
.end-row.is-me .end-who strong {
  text-decoration: underline;
  text-decoration-color: var(--sun);
  text-decoration-thickness: 3px;
  text-underline-offset: 3px;
}
.end-rank {
  font-size: 1.35rem;
  font-weight: 800;
  text-align: center;
  color: var(--ink-soft);
}
.end-row.is-winner .end-rank {
  font-size: 1.6rem;
}
.end-who {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.end-who strong {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1.05rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.end-who small {
  color: var(--ink-soft);
  font-size: 0.8rem;
}
.end-stats {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 14px;
}
.end-stats div {
  min-width: 0;
}
.end-stats dt {
  font-size: 0.7rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.end-stats dd {
  margin: 0;
  font-weight: 700;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
@media (max-width: 620px) {
  .end-row {
    grid-template-columns: 32px 1fr;
  }
  .end-stats {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- Salon : paramètres de la partie ---------- */
.game-settings {
  margin-top: 22px;
  padding: 4px 16px 16px;
  border: 2px dashed var(--paper-line);
  border-radius: 14px;
}
.game-settings h3 {
  margin-top: 14px;
}
.game-settings h4 {
  margin: 16px 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}
.game-settings > .hint {
  margin: 0;
}
.segmented button:disabled {
  cursor: default;
  opacity: 0.75;
}
.segmented button[aria-checked="true"]:disabled {
  opacity: 1;
}
.setting-toggle {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 12px;
  padding: 10px 12px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}
.setting-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.setting-switch {
  position: relative;
  width: 44px;
  height: 26px;
  margin-top: 2px;
  border: 2px solid var(--ink);
  border-radius: 99px;
  background: var(--paper-line);
  transition: background 0.2s ease;
}
.setting-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--ink);
  box-sizing: border-box;
  transition: transform 0.2s ease;
}
.setting-toggle input:checked + .setting-switch {
  background: var(--sun);
}
.setting-toggle input:checked + .setting-switch::after {
  transform: translateX(18px);
}
.setting-toggle input:focus-visible + .setting-switch {
  outline: 3px solid var(--sun-deep);
  outline-offset: 2px;
}
.setting-toggle:has(input:disabled) {
  cursor: default;
  border-color: var(--paper-line);
}
.setting-text {
  display: grid;
  gap: 2px;
}
.setting-text small {
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.35;
}

/* ---------- Enchère en cours (au centre du plateau) ---------- */
.auction {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
  max-width: 520px;
}
.auction-card {
  flex: none;
}
.auction-side {
  display: grid;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.auction-best {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 15px;
}
.auction-best strong {
  font-size: 19px;
  font-variant-numeric: tabular-nums;
}
.auction-timer {
  position: relative;
  height: 22px;
  border: 2px solid var(--ink);
  border-radius: 99px;
  background: #fff;
  overflow: hidden;
}
.auction-bar {
  position: absolute;
  inset: 0;
  background: var(--sun);
  transform-origin: left center;
  transition: transform 0.2s linear;
}
.auction-timer.is-urgent .auction-bar {
  background: var(--chance);
}
.auction-left {
  position: relative;
  display: block;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  line-height: 18px;
  font-variant-numeric: tabular-nums;
}
.auction-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.auction-buttons .btn {
  padding: 7px 10px;
  font-size: 13px;
}
.auction-side .hint {
  margin: 0;
}
@media (max-width: 760px) {
  .auction {
    flex-direction: column;
  }
}
body.auction-open .dice-layer {
  opacity: 0;
  transition: opacity 0.25s ease;
}

/* Mise tapée librement : le maximum est rappelé entre parenthèses */
.casino-bet {
  text-align: center;
}
.casino-max {
  display: inline-block;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-soft);
}
.casino-bet input::placeholder,
.auction-offer input::placeholder {
  color: #9aa1bb;
  font-weight: 600;
}

/* Enchère : champ « Ton offre » + Proposer */
.auction-offer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-weight: 700;
}
.auction-offer input {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  padding: 5px 10px;
  border: 2px solid var(--ink);
  border-radius: var(--radius-btn);
  font: inherit;
  font-variant-numeric: tabular-nums;
}
.auction-offer .btn {
  padding: 7px 12px;
  font-size: 13px;
}

/* ---------- Partie rapide et chrono par tour ---------- */
.segmented-wrap {
  flex-wrap: wrap;
}
.game-limit {
  padding: 3px 10px;
  border: 2px solid currentColor;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.game-limit.is-last {
  background: var(--sun);
  border-color: var(--sun);
  color: var(--ink);
}
.turn-timer {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 99px;
  background: var(--paper-line);
  color: var(--ink);
  font-size: 0.8em;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}
.turn-timer.is-urgent {
  background: var(--chance);
  color: #fff;
}

/* ---------- Table de roulette : roue à gauche, tapis de mise à droite ---------- */
.roulette-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(3, 18, 12, 0.6);
  backdrop-filter: blur(2px);
}
.roulette-overlay[hidden] {
  display: none;
}
.roulette-room {
  width: min(1180px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 18px 22px 20px;
  border: 3px solid #b8913a;
  border-radius: 22px;
  color: #f4ecd6;
  background-color: #1f6b3f;
  background-image:
    radial-gradient(ellipse at 40% 30%, rgba(255, 255, 255, 0.1), transparent 60%),
    radial-gradient(ellipse at 50% 120%, rgba(0, 0, 0, 0.35), transparent 60%);
  box-shadow: 0 0 0 6px #5b3a14, 0 24px 60px rgba(0, 0, 0, 0.55);
}
.roulette-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}
.roulette-head h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.04em;
  color: #f3d27a;
}
.roulette-status {
  flex: 1;
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}
.roulette-status.is-good {
  color: #9dffc0;
}
.roulette-status.is-bad {
  color: #ffb3a8;
}
.roulette-head .roulette-hide {
  color: #f4ecd6;
  border-color: rgba(244, 236, 214, 0.6);
}
.roulette-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) 1.6fr;
  align-items: center;
  gap: 26px;
}
.roulette-wheel-wrap {
  display: grid;
  place-items: center;
}
.roulette-wheel {
  width: 100%;
  max-width: 380px;
  filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.45));
}
.roulette-wheel text {
  fill: #fff;
  font-size: 7.2px;
  font-weight: 700;
  font-family: var(--font);
  text-anchor: middle;
  dominant-baseline: central;
}
.rw-rotor,
.rw-orbit {
  transform-box: view-box;
  transform-origin: 50% 50%;
}
.rw-arm {
  stroke: #e9c46a;
  stroke-width: 3.2;
  stroke-linecap: round;
}
.rw-knob {
  fill: #e9c46a;
  stroke: #9a6b1f;
  stroke-width: 0.8;
}
.rw-ball {
  transform-box: fill-box;
}

/* tapis de mise */
.roulette-table {
  display: grid;
  grid-template-columns: 1.15fr repeat(12, 1fr) 1.25fr;
  grid-template-rows: repeat(3, minmax(38px, auto)) minmax(40px, auto) minmax(40px, auto);
  gap: 0;
  border: 2px solid rgba(244, 236, 214, 0.75);
  font-family: Georgia, "Times New Roman", serif;
}
.rt-cell {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 3px;
  border: 1px solid rgba(244, 236, 214, 0.6);
  background: rgba(255, 255, 255, 0.04);
  color: #f4ecd6;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.12s ease;
}
.roulette-overlay.is-watching .rt-cell,
.roulette-room.is-watching .rt-cell {
  cursor: default;
}
.rt-cell:hover,
.rt-cell.is-covered {
  background: rgba(255, 255, 255, 0.16);
}
.rt-cell:focus-visible {
  outline: 3px solid #f3d27a;
  outline-offset: -3px;
}
.rt-zero {
  clip-path: polygon(38% 0, 100% 0, 100% 100%, 38% 100%, 0 50%);
  padding-left: 18%;
}
.rt-disc {
  display: grid;
  place-items: center;
  width: min(30px, 100%);
  aspect-ratio: 1;
  border-radius: 50%;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}
.rt-disc.rt-red {
  background: #d22b2b;
}
.rt-disc.rt-black {
  background: #151515;
}
.rt-disc.rt-green {
  background: #2f9e4f;
  border: 1px solid rgba(255, 255, 255, 0.6);
}
.rt-column .rt-label {
  font-size: 12px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}
.rt-label {
  white-space: nowrap;
}
.rt-out sup {
  font-size: 0.6em;
}
.rt-diamond {
  display: block;
  width: 46px;
  height: 22px;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}
.rt-diamond.rt-red {
  background: #d22b2b;
}
.rt-diamond.rt-black {
  background: #151515;
}
.rt-cell.is-winner {
  background: rgba(243, 210, 122, 0.45);
  box-shadow: inset 0 0 0 3px #f3d27a;
  animation: rt-win 0.8s ease-in-out 3;
}
@keyframes rt-win {
  50% {
    box-shadow: inset 0 0 0 3px #fff, 0 0 18px #f3d27a;
  }
}

/* jetons */
.rt-chip,
.rc-chip {
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-family: var(--font);
  font-weight: 800;
  border: 3px dashed rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35), 0 3px 0 rgba(0, 0, 0, 0.35);
}
.rt-chip {
  position: absolute;
  z-index: 2;
  width: 30px;
  height: 30px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  pointer-events: none;
  animation: rt-drop 0.18s ease-out;
}
.rt-zero .rt-chip {
  left: 62%;
}
@keyframes rt-drop {
  from {
    transform: translate(-50%, -80%) scale(1.2);
    opacity: 0;
  }
}
.rt-chip.is-lost {
  opacity: 0.35;
  filter: grayscale(0.8);
}
.rt-chip.is-won {
  box-shadow: 0 0 0 2px #f3d27a, 0 0 14px #f3d27a;
}
.rt-chip-5 {
  background: #c0392b;
}
.rt-chip-10 {
  background: #2d5fa8;
}
.rt-chip-25 {
  background: #2e8b57;
}
.rt-chip-100 {
  background: #202020;
}
.rt-chip-500 {
  background: #7b3fa0;
}

/* commandes sous le tapis */
.roulette-controls {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}
.rc-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}
.rc-chips {
  display: flex;
  gap: 8px;
}
.rc-chip {
  width: 46px;
  height: 46px;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.12s ease;
}
.rc-chip:hover {
  transform: translateY(-2px);
}
.rc-chip.is-selected {
  transform: translateY(-4px);
  box-shadow: 0 0 0 3px #f3d27a, 0 6px 0 rgba(0, 0, 0, 0.35);
}
.rc-custom {
  font-weight: 700;
}
.rc-custom input {
  width: 5.5em;
  margin: 0 4px;
  padding: 6px 8px;
  border: 2px solid #b8913a;
  border-radius: var(--radius-btn);
  background: #f6f0e1;
  color: var(--ink);
  font: inherit;
}
.rc-total,
.rc-note {
  margin: 0;
}
.rc-total strong {
  font-size: 20px;
  color: #f3d27a;
}
.rc-total small,
.rc-note {
  font-size: 13px;
  color: rgba(244, 236, 214, 0.8);
}
.rc-note.is-warn {
  color: #ffd38a;
}
.rc-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.rc-buttons .btn-ghost {
  color: #f4ecd6;
  border-color: rgba(244, 236, 214, 0.6);
}

@media (max-width: 860px) {
  .roulette-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .roulette-wheel {
    max-width: 220px;
  }
  .roulette-room {
    padding: 12px;
  }
  .roulette-table {
    grid-template-rows: repeat(3, minmax(30px, auto)) minmax(34px, auto) minmax(34px, auto);
  }
  .rt-cell {
    padding: 1px;
    font-size: 11px;
  }
  .rt-disc {
    font-size: 10px;
  }
  .rt-diamond {
    width: 28px;
    height: 15px;
  }
  .rt-chip {
    width: 22px;
    height: 22px;
    font-size: 8px;
    border-width: 2px;
  }
  .rc-chip {
    width: 40px;
    height: 40px;
  }
}

/* ---------- Nappe en 3D sous le plateau ----------
   Le même motif à losanges que le fond, posé dans le plan incliné du plateau (même inclinaison) : on a
   l'impression que le plateau est posé sur la table. Quand on tourne, seul le plateau pivote. */
.table-cloth {
  position: absolute;
  left: -110%;
  top: -110%;
  width: 320%;
  aspect-ratio: 1;
  pointer-events: none;
  transform: rotateX(var(--tilt)); /* inclinée comme le plateau, mais elle ne tourne pas avec lui */
  transform-origin: 50% 50%;
  background-color: #1b6b30;
  background-image:
    radial-gradient(circle at 50% 50%, rgba(2, 24, 8, 0.55) 0%, rgba(2, 24, 8, 0.25) 16%, transparent 24%),
    radial-gradient(circle at 50% 50%, rgba(90, 220, 110, 0.22) 0%, transparent 45%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='120' viewBox='0 0 100 120'%3E%3Crect width='100' height='120' fill='%23155a26'/%3E%3Cpolygon points='50,0 100,60 50,120 0,60' fill='%231e7b31'/%3E%3Cg stroke='%23d9e6c8' stroke-opacity='0.42' stroke-width='1.1' stroke-dasharray='5 5' fill='none'%3E%3Cline x1='0' y1='0' x2='100' y2='120'/%3E%3Cline x1='100' y1='0' x2='0' y2='120'/%3E%3C/g%3E%3C/svg%3E");
  background-size: auto, auto, 8.5cqi 10.2cqi;
  background-position: center;
  -webkit-mask-image: radial-gradient(closest-side, #000 45%, rgba(0, 0, 0, 0.6) 70%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 45%, rgba(0, 0, 0, 0.6) 70%, transparent 100%);
}

/* hors de la vue 3D (ou sans inclinaison), pas de nappe */
body:not(.view-3d) .table-cloth {
  display: none;
}

/* la nappe déborde du plateau : on évite qu'elle crée une barre de défilement */
.screen-game {
  overflow-x: clip;
}
/* les panneaux sous le plateau (téléphone) restent au-dessus de la nappe */
.controls-mobile {
  position: relative;
  z-index: 3;
}

/* Pendant la partie, le fond de la page est un vert sombre uni : seule la nappe en 3D porte les
   losanges (sinon on voit le motif plat « en transparence » là où la nappe s'efface). */
body.view-3d:has(#screen-game:not([hidden])) {
  background-color: #0b3d18;
  background-image: radial-gradient(ellipse at 50% 55%, #145a26 0%, #0b3d18 55%, #052410 100%);
  background-size: auto;
}

/* cagnotte du Parc Paofai, sur deux lignes pour tenir dans le coin */
.park-pot {
  padding: 0.15em 0.6em;
  border-radius: 0.6em;
  background: var(--sun);
  font-size: 0.75em;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
}
.park-pot b {
  font-size: 1.25em;
  font-weight: 900;
  white-space: nowrap;
}
.park-pot[hidden] {
  display: none;
}

/* ---------- Portique de la Coupe du monde ----------
   Debout sur le bord intérieur de la ville qui accueille la Coupe : deux poteaux marron et une bannière
   à la couleur du joueur, avec « Coupe du monde » écrit en petit (lisible des deux côtés). */
.cup-arch {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--len);
  height: 9.5cqi;
  margin-left: calc(var(--len) / -2);
  margin-top: -9.5cqi;
  transform-origin: 50% 100%;
  transform: translate3d(var(--x), var(--y), 0.5cqi) rotateZ(var(--a)) rotateX(-90deg);
  transform-style: preserve-3d;
  pointer-events: none;
}
/* poteaux : cylindres (12 faces verticales autour de l'axe) */
.cup-post3d {
  --r: 0.5cqi; /* rayon */
  position: absolute;
  bottom: 0;
  width: calc(var(--r) * 2);
  height: calc(100% - 4cqi); /* s'arrête sous la bannière, qui repose dessus */
  transform-style: preserve-3d;
}
.cup-post-l {
  left: 0;
}
.cup-post-r {
  right: 0;
}
.cup-post3d i {
  position: absolute;
  top: 0;
  left: 50%;
  /* faces nettement plus larges que 2·r·tan(15°) : elles se chevauchent, plus aucun jour entre elles */
  width: calc(var(--r) * 0.8);
  height: 100%;
  margin-left: calc(var(--r) * -0.4);
  background: #6b4220;
  filter: brightness(var(--l));
  transform: rotateY(calc(var(--k) * 30deg)) translateZ(calc(var(--r) * 0.9));
}
.cup-post3d .cup-cap {
  top: 0;
  left: 0;
  width: 100%;
  height: calc(var(--r) * 2);
  margin: calc(var(--r) * -1) 0 0;
  border-radius: 50%;
  background: #8a5a2b;
  filter: none;
  transform: rotateX(90deg);
  backface-visibility: visible;
}

/* bannière : pavé (face avant, arrière, dessus, dessous, deux bouts) */
.cup-box {
  --d: 0.9cqi; /* épaisseur */
  --h: 3.8cqi; /* hauteur */
  --w: calc(var(--len) + 1.6cqi); /* largeur */
  position: absolute;
  top: 0.3cqi;
  left: -0.8cqi;
  width: var(--w);
  height: var(--h);
  transform-style: preserve-3d;
}
.cup-face {
  position: absolute;
  box-sizing: border-box;
  background: color-mix(in srgb, var(--owner) 72%, #000);
}
.cup-front,
.cup-back {
  inset: 0;
  display: grid;
  place-items: center;
  padding: 0 0.3cqi;
  background: var(--owner);
  box-shadow: inset 0 0 0 max(1px, 0.12cqi) rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: max(7px, 1.2cqi);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 0;
  white-space: nowrap;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.6);
  backface-visibility: hidden;
}
.cup-front {
  transform: translateZ(calc(var(--d) / 2));
}
.cup-back {
  transform: rotateY(180deg) translateZ(calc(var(--d) / 2));
}
.cup-top,
.cup-bottom {
  left: -1px;
  top: 50%;
  width: calc(100% + 2px);
  height: calc(var(--d) + 2px);
  margin-top: calc(var(--d) / -2 - 1px);
}
.cup-top {
  background: color-mix(in srgb, var(--owner) 85%, #fff);
  transform: rotateX(90deg) translateZ(calc(var(--h) / 2));
}
.cup-bottom {
  transform: rotateX(-90deg) translateZ(calc(var(--h) / 2));
}
.cup-end-l,
.cup-end-r {
  top: -1px;
  left: 50%;
  width: calc(var(--d) + 2px);
  height: calc(100% + 2px);
  margin-left: calc(var(--d) / -2 - 1px);
}
.cup-end-l {
  transform: rotateY(-90deg) translateZ(calc(var(--w) / 2));
}
.cup-end-r {
  transform: rotateY(90deg) translateZ(calc(var(--w) / 2));
}
