/* Refonte v2, Jeux (refonte-v2.js, gamesLobby). Shared tokens and components: v2.css. */

/* The mockup fits v2.css's tokens (--v2-tile-frame, --v2-tray, --v2-risk-*, --v2-seg-*); only these values are not
   there. */
:root {
  --v2-games-chip: #000000;
  --v2-games-note: #9aa2c8;
  --v2-games-note-key: #ffd84a;
  --v2-games-tile-sh: 0 0 0 1px rgba(0, 0, 0, .35), 0 10px 22px rgba(0, 0, 0, .4);
}
:root[data-theme="light"] {
  --v2-games-chip: #14123a;
  --v2-games-note: #5d6572;
  --v2-games-note-key: #24157a;
  --v2-games-tile-sh: 0 0 0 1px rgba(95, 70, 226, .08), 0 10px 22px rgba(58, 26, 150, .12);
}

/* ---- The lobby: two panes, one visible, switched by the header's segmented control ---- */

.v2-games { display: grid; gap: 10px; }
.jx-pane { display: grid; gap: 10px; }
.jx-pane[hidden] { display: none; }
.jx-seg { width: 100%; }
.jx-seg > button { flex: 1; border: 0; }

/* ---- The tile: frame, inside, tray ---- */

.jx-tile {
  position: relative; display: block; border-radius: 18px; padding: 3px; text-decoration: none;
  background: var(--v2-tile-frame); box-shadow: var(--v2-games-tile-sh); transition: transform .12s ease;
}
.jx-tile:active { transform: scale(.98); }
@media (hover: hover) {
  .jx-tile:hover { transform: translateY(-2px); }
}
.jx-art {
  position: relative; display: block; overflow: hidden; aspect-ratio: 1336 / 450; border-radius: 15px;
  background: center / cover no-repeat; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .35);
}
/* A drawing's box stops at the tile's foot: what overflows is cut inside the image itself instead of spilling under
   the next tile. The rendering is unchanged, the drawing stays pinned to the top. */
.jx-a {
  position: absolute; top: var(--jx-y); height: auto; max-height: calc(100% - var(--jx-y));
  object-fit: cover; object-position: 50% 0; pointer-events: none;
}
.jx-ti { position: absolute; height: auto; z-index: 3; pointer-events: none; }

/* The images that come in two versions (Find Pepe's grid, Stonks' curve): one rule per theme. */
.jx-clair { display: none; }
:root[data-theme="light"] .jx-clair { display: block; }
:root[data-theme="light"] .jx-sombre { display: none; }

.jx-tray {
  position: absolute; right: 0; bottom: 0; z-index: 4; display: flex; align-items: center; gap: 5px;
  padding: 5px 5px 4px 8px; border-radius: 14px 0 0 0; background: var(--v2-tray);
}
/* The two concave fillets that join the tray to the tile's edge. */
.jx-fil { position: absolute; width: 12px; height: 12px; background: radial-gradient(circle at 0 0, transparent 11.5px, var(--v2-tray) 12px); }
.jx-fil-l { left: -12px; bottom: 0; }
.jx-fil-t { right: 0; top: -12px; }

.jx-chip {
  position: relative; display: flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; border-radius: 999px;
  background: var(--v2-games-chip); font: 900 11.5px/1 var(--v2-font-ui); color: #ffffff; white-space: nowrap;
}
.jx-k { font-weight: 800; color: rgba(255, 255, 255, .75); }
.jx-max { letter-spacing: .03em; }
.jx-mult { color: var(--v2-gold); }

/* The risk: three bars, as many lit as levels, and the colour says the level. */
.jx-bars { display: flex; align-items: flex-end; gap: 1.5px; height: 11px; }
.jx-bars i { width: 4px; border-radius: 1px; background: rgba(255, 255, 255, .35); }
.jx-bars i:nth-child(1) { height: 5px; }
.jx-bars i:nth-child(2) { height: 8px; }
.jx-bars i:nth-child(3) { height: 11px; }
.jx-bars[data-risk="1"] i:nth-child(-n+1) { background: var(--v2-risk-low); }
.jx-bars[data-risk="2"] i:nth-child(-n+2) { background: var(--v2-risk-mid); }
.jx-bars[data-risk="3"] i:nth-child(-n+3) { background: var(--v2-risk-high); }

/* ---- The five money games' tiles: backgrounds per theme and the mockup's placements ---- */

.jx-g-findpepe .jx-art { background-image: url(/app/ui/jeux/findpepe-fond-sombre.webp?v=5c290540b8); }
:root[data-theme="light"] .jx-g-findpepe .jx-art { background-image: url(/app/ui/jeux/findpepe-fond-clair.webp?v=ccdb2b1274); }
.jx-g-findpepe .jx-a1 { left: 2.8%; --jx-y: 7.4%; width: 34.2%; z-index: 1; }
.jx-g-findpepe .jx-ti { left: 53.9%; top: 12.4%; width: 42.5%; }

.jx-g-road .jx-art { background-image: url(/app/ui/jeux/dogeroad-fond-sombre.webp?v=a374d41822); }
:root[data-theme="light"] .jx-g-road .jx-art { background-image: url(/app/ui/jeux/dogeroad-fond-clair.webp?v=304d6ec7e8); }
.jx-g-road .jx-a1 { left: 3%; --jx-y: 4%; width: 34%; z-index: 1; }
.jx-g-road .jx-ti { left: 52.1%; top: 12.4%; width: 45.1%; }

.jx-g-plinko .jx-art { background-image: url(/app/ui/jeux/nyanplinko-fond-sombre.webp?v=fe2af933f8); }
:root[data-theme="light"] .jx-g-plinko .jx-art { background-image: url(/app/ui/jeux/nyanplinko-fond-clair.webp?v=cc9a91dca8); }
.jx-g-plinko .jx-a1 { left: -4.7%; --jx-y: 9.5%; width: 46.9%; z-index: 1; }
.jx-g-plinko .jx-ti { left: 49.6%; top: 13.2%; width: 48.2%; }

.jx-g-stonks .jx-art { background-image: url(/app/ui/jeux/stonks-fond-sombre.webp?v=8b9bc96a20); }
:root[data-theme="light"] .jx-g-stonks .jx-art { background-image: url(/app/ui/jeux/stonks-fond-clair.webp?v=c528177186); }
.jx-g-stonks .jx-a1 { left: 18%; --jx-y: 14.5%; width: 27.5%; z-index: 1; }
.jx-g-stonks .jx-a2 { left: 3.1%; --jx-y: 5%; width: 28.3%; z-index: 2; }
.jx-g-stonks .jx-ti { left: 58.9%; top: 13.2%; width: 38.1%; }

.jx-g-duckrun .jx-art { background-image: url(/app/ui/jeux/duckrun-fond-sombre.webp?v=fb72e04655); }
:root[data-theme="light"] .jx-g-duckrun .jx-art { background-image: url(/app/ui/jeux/duckrun-fond-clair.webp?v=173c0e32fa); }
.jx-g-duckrun .jx-a1 { left: 4%; --jx-y: 4%; width: 27%; z-index: 2; }
.jx-g-duckrun .jx-ti { left: 42%; top: 15%; width: 54%; }

/* A tile the player cannot open yet: the art stays, drained of its colour, and the badge says when. Still a tile of
   the same size, so the lobby does not move the day the game opens. */
.jx-tile.jx-soon { cursor: default; }
.jx-tile.jx-soon .jx-art { filter: grayscale(1) brightness(0.74); }
.jx-tile.jx-soon .jx-art > * { pointer-events: none; }
/* Under maintenance (src/duckrun.ts): the greyed art loses its own duck, the one with the sign stands over it. */
.jx-tile.jx-pause .jx-a1 { visibility: hidden; }
.jx-pause-sign { position: absolute; left: 3%; bottom: 3px; height: calc(100% - 6px); width: auto; z-index: 3; pointer-events: none; }
.jx-soon-tag {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%; z-index: 6;
  padding: 0.42em 0.9em; border-radius: 999px; border: 2px solid rgba(255, 255, 255, 0.9);
  background: rgba(18, 18, 24, 0.82); color: #fff; font-weight: 800; font-size: clamp(12px, 3.6vw, 17px);
  text-transform: uppercase; letter-spacing: 0.02em; white-space: nowrap;
}

.jx-g-roulette .jx-art { background-image: url(/app/ui/jeux/nombres-fond-sombre.webp?v=63e9d26f34); }
:root[data-theme="light"] .jx-g-roulette .jx-art { background-image: url(/app/ui/jeux/nombres-fond-clair.webp?v=d32f7e9a72); }
.jx-g-roulette .jx-a1 { left: 2.5%; --jx-y: 16%; width: 38%; z-index: 1; }
.jx-g-roulette .jx-ti { left: 50%; top: 14%; width: 46%; }

/* Troll Balloon came after the mockup: a CSS background and title, like the culture tiles, and the game's Trollface. */
.jx-g-balloon .jx-art {
  background:
    repeating-conic-gradient(from 0deg at 22% 55%, rgba(255, 255, 255, .10) 0deg 8deg, transparent 8deg 22deg),
    linear-gradient(120deg, #ff5a5a, #b3243a);
}
.jx-g-balloon { --jx-stroke: #5a0614; --jx-fill: linear-gradient(180deg, #ffffff, #ffe0e0 60%, #ff8a8a); }
.jx-g-balloon .jx-a1 { left: 6%; --jx-y: 8%; width: 30%; z-index: 1; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .25)); }

/* Le vendeur (client/vendeur-tile.ts), drawn for its players alone: a CSS background and title like Troll Balloon,
   the shopkeeper's own picture, and one pill in the place of the risk and maximum chips, since nothing is staked. */
.jx-g-vendeur .jx-art { background: radial-gradient(60% 150% at 18% 0, #3a4270, #141a2c 75%); }
.jx-g-vendeur { --jx-stroke: #0b1030; --jx-fill: linear-gradient(180deg, #ffffff, #fff3b0 60%, #f6c928); }
.jx-g-vendeur .jx-a1 { left: 4%; --jx-y: 6%; width: 27%; z-index: 1; }
.jx-vd-chip {
  position: absolute; right: 4%; top: 46%; z-index: 3; display: flex; align-items: center; height: 22px;
  padding: 0 9px; border-radius: 999px; background: rgba(14, 8, 48, .72);
  font: 900 12px/1 var(--v2-font-ui); color: #ffffff;
}

/* The day's offered round, on the game it is played in: what the lobby's row used to say. */
.jx-offered {
  position: absolute; left: 3%; top: 7%; z-index: 4; display: flex; align-items: center; gap: 4px; height: 22px;
  padding: 0 9px; border-radius: 999px; background: var(--v2-gold);
  font: 900 12px/1 var(--v2-font-ui); color: #3a2400;
}
/* A badge that lands on a tile already on screen, once the day's offered rounds are known. */
.jx-offered-in { animation: jx-offered-in .18s ease-out both; }
@keyframes jx-offered-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .jx-offered-in { animation: none; } }

/* ---- The five culture games' tiles, drawn in CSS ---- */

.jx-c .jx-art {
  background:
    repeating-conic-gradient(from 0deg at 22% 55%, rgba(255, 255, 255, .10) 0deg 8deg, transparent 8deg 22deg),
    linear-gradient(120deg, var(--jx-a), var(--jx-b));
}
.jx-c-zoom { --jx-a: #ff7a8a; --jx-b: #ffb070; --jx-stroke: #8a1a2a; --jx-fill: linear-gradient(180deg, #ffffff, #ffe0d0 60%, #ffb38a); }
.jx-c-connu { --jx-a: #a98bff; --jx-b: #d98bff; --jx-stroke: #3a0f8a; --jx-fill: linear-gradient(180deg, #ffffff, #f0c8ff 60%, #c27aff); }
.jx-c-frise { --jx-a: #ffd45a; --jx-b: #ffa040; --jx-stroke: #7a3205; --jx-fill: linear-gradient(180deg, #ffffff, #fff3b0 60%, #ffc21f); }
.jx-c-memory { --jx-a: #6ea0ff; --jx-b: #5ad8ff; --jx-stroke: #0b1e6a; --jx-fill: linear-gradient(180deg, #ffffff, #9fd8ff 60%, #3b8cff); }
.jx-c-quiz { --jx-a: #5ad8c0; --jx-b: #49a8ff; --jx-stroke: #06385a; --jx-fill: linear-gradient(180deg, #ffffff, #c8f4ff 60%, #49c8ff); }

.jx-vis { position: absolute; left: 3%; top: 0; bottom: 0; width: 40%; display: grid; place-items: center; z-index: 1; }
.jx-ct {
  position: absolute; right: 4%; top: 13%; z-index: 3;
  font: italic 900 24px/1 var(--v2-font-ui); text-transform: uppercase;
}
.jx-ct-u { position: absolute; left: 0; top: 0; -webkit-text-stroke: 6px var(--jx-stroke); text-shadow: 0 3px 0 var(--jx-stroke), 0 5px 8px rgba(0, 0, 0, .25); }
.jx-ct-f { position: relative; background: var(--jx-fill); -webkit-background-clip: text; background-clip: text; color: transparent; }
.jx-free {
  position: absolute; right: 4%; top: 46%; z-index: 3; display: flex; align-items: center; height: 22px;
  padding: 0 9px 0 7px; border-radius: 999px; background: rgba(14, 8, 48, .72);
  font: 900 12px/1 var(--v2-font-ui); color: #ffffff;
}
.jx-bolt { margin-left: 9px; padding: 0 9px 0 14px; }
.jx-bolt svg { position: absolute; left: -10px; width: 20px; height: 20px; }

/* Zoom: the magnifier and its handle. */
.jx-v-zoom { position: relative; }
.jx-v-zoom i { display: block; width: 92px; height: 92px; overflow: hidden; border-radius: 50%; box-shadow: 0 0 0 5px #ffffff, 0 6px 14px rgba(0, 0, 0, .28); }
.jx-v-zoom img { width: 260%; height: 260%; margin: -60% 0 0 -70%; object-fit: cover; }
.jx-v-zoom b { position: absolute; right: -18px; bottom: -12px; width: 38px; height: 10px; border-radius: 5px; background: #ffffff; transform: rotate(45deg); }

/* Plus connu ?: two tilted thumbnails and the VS. */
.jx-v-connu { position: relative; display: flex; align-items: center; gap: 2px; }
.jx-v-connu i { display: block; width: 42px; height: 54px; overflow: hidden; border-radius: 9px; box-shadow: 0 4px 10px rgba(0, 0, 0, .3); }
.jx-v-connu i:first-child { transform: rotate(-7deg); }
.jx-v-connu i:last-child { transform: rotate(7deg); }
.jx-v-connu img { width: 100%; height: 100%; object-fit: cover; }
.jx-v-connu b {
  position: relative; z-index: 2; padding: 5px 7px; border-radius: 8px; background: var(--v2-gold);
  box-shadow: 0 3px 0 #b86a00; font: 900 13px/1 var(--v2-font-ui); color: #3a2400;
}

/* La Frise: one card and three milestones. */
.jx-v-frise { display: grid; gap: 6px; justify-items: center; }
.jx-v-frise i { display: block; width: 44px; height: 54px; overflow: hidden; border-radius: 8px; box-shadow: 0 4px 10px rgba(0, 0, 0, .3); }
.jx-v-frise img { width: 100%; height: 100%; object-fit: cover; }
.jx-v-frise span { display: flex; align-items: center; }
.jx-v-frise b { padding: 4px 7px; border-radius: 7px; background: #ffffff; box-shadow: 0 3px 0 rgba(0, 0, 0, .22); font: 900 11px/1 var(--v2-font-ui); color: #2a1200; }
.jx-v-frise b.q { background: #2a1200; color: var(--v2-gold); }
.jx-v-frise em { width: 9px; height: 4px; background: rgba(42, 18, 0, .5); }

/* Memory: six cards, two turned over. */
.jx-v-memory { display: grid; grid-template-columns: repeat(3, 32px); gap: 5px; transform: rotate(-6deg); }
.jx-v-memory i { position: relative; display: block; width: 32px; height: 42px; overflow: hidden; border-radius: 7px; background: rgba(255, 255, 255, .28); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .6); }
.jx-v-memory i::after { content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: #ffffff; }
.jx-v-memory i.up { background: none; box-shadow: 0 0 0 3px var(--v2-gold), 0 0 12px rgba(255, 216, 74, .6); }
.jx-v-memory i.up::after { content: none; }
.jx-v-memory img { width: 100%; height: 100%; object-fit: cover; }

/* Devine le mème: a blurred card and its question mark. */
.jx-v-quiz { position: relative; }
.jx-v-quiz i { display: block; width: 54px; height: 70px; overflow: hidden; border-radius: 9px; box-shadow: 0 5px 12px rgba(0, 0, 0, .3); }
.jx-v-quiz img { width: 100%; height: 100%; object-fit: cover; filter: blur(2px); }
.jx-v-quiz b { position: absolute; right: -16px; bottom: -8px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #ffffff; box-shadow: 0 4px 10px rgba(0, 0, 0, .3); font: 900 20px/1 var(--v2-font-ui); color: #06385a; }

/* The boosted rounds' rule, under the culture games. */
.jx-note { padding: 4px 6px; font: 700 13px/1.35 var(--v2-font-ui); color: var(--v2-games-note); }
.jx-note b { color: var(--v2-games-note-key); }

@media (min-width: 820px) {
  .v2-games { max-width: 960px; margin-inline: auto; }
  .jx-pane { grid-template-columns: 1fr 1fr; }
  .jx-note, .jx-pane > .lobby-note { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .jx-tile { transition: none; }
  .jx-tile:active { transform: none; }
  @media (hover: hover) {
    .jx-tile:hover { transform: none; }
  }
}
