/* ====================================================================================================
   Boîte à jeux · la table de jeu commune (nouveau style des jeux, d'après le pilote Chromo).
   Un écran de jeu qui porte la classe « tb » passe sur un tapis plein écran ; les briques (table.js) :
   .tb-bar / .tb-chip, .tb-opps (adversaires en arc), .tb-say (le meneur), .tb-tray (plateau de verre
   collé en bas) avec .tb-fan-hand (main en éventail), #tb-sheet (feuille). Les cartes classiques
   (.km-card, partagées par Kems, Poker, Bataille, Solitaire) prennent ici un vrai vernis.
   Chaque jeu règle ses couleurs de tapis avec --felt-hi / --felt-mid / --felt-lo sur [data-game="<jeu>"] (dans jeux/<jeu>.css).
   Chargé après ios.css.
   ==================================================================================================== */
/* les couleurs du tapis sont posées sur la page (le fond du body les lit) ; chaque jeu peut les redéfinir sur [data-game=<jeu>] */
[data-game] { --felt-hi: color-mix(in oklab, var(--bg), white 22%); --felt-mid: color-mix(in oklab, var(--bg), white 9%); --felt-lo: color-mix(in oklab, var(--bg), black 22%); }
.screen.tb {
  --tb-glass: color-mix(in oklab, var(--bg) 62%, transparent); --tb-glass-thick: color-mix(in oklab, var(--bg) 82%, transparent);
  --tb-hi: rgba(255, 255, 255, .3); --tb-rim: rgba(255, 255, 255, .14); --tb-edge: rgba(0, 0, 0, .35); --tb-field: rgba(255, 255, 255, .1);
  gap: 10px; padding-bottom: 0; display: flex; flex-direction: column; }
/* le tapis : la page entière, avec un grain de feutre et une lumière au-dessus de la table */
html:has(.screen.tb:not([hidden])) body { background:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .07 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"),
    radial-gradient(60% 34% at 50% 36%, color-mix(in oklab, var(--felt-hi) 85%, transparent), transparent 72%),
    radial-gradient(120% 70% at 50% 40%, var(--felt-mid), color-mix(in oklab, var(--felt-mid), var(--felt-lo) 55%) 62%, var(--felt-lo));
  background-color: var(--bg); background-attachment: fixed; }
html:has(.screen.tb:not([hidden])) body::before, html:has(.screen.tb:not([hidden])) .grain { display: none; }
@media (prefers-reduced-transparency: reduce) { html:has(.screen.tb:not([hidden])) body { background: var(--bg); } }
.screen.tb > .stack { gap: 10px; flex: 1; }

/* la ligne de partie et les puces */
.tb-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tb-bar > .tb-chip { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; line-height: 34px; }
.tb-chips { display: flex; gap: 8px; flex: none; }
.tb-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border: 0; border-radius: 999px; font: 600 13px var(--font); color: var(--ink-2);
  background: var(--tb-glass); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  box-shadow: inset 0 1px 0 var(--tb-hi), inset 0 0 0 .5px var(--tb-rim), 0 0 0 .5px var(--tb-edge); }
button.tb-chip { cursor: pointer; min-height: 44px; }
.tb-chip b:not([class]) { color: var(--ink); }
.tb-chip b { font-variant-numeric: tabular-nums; }
.tb-chip svg { width: 16px; height: 16px; }

/* les adversaires, en arc */
.tb-opps { position: relative; height: 118px; }
.tb-opps.none { display: none; }
.tb-opp { position: absolute; transform: translateX(-50%); width: 96px; display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; }
.tb-av { position: relative; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; line-height: 1;
  background: radial-gradient(circle at 35% 30%, color-mix(in oklab, var(--felt-mid), white 18%), color-mix(in oklab, var(--felt-lo), black 10%));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 0 0 2px rgba(255, 255, 255, .12), 0 8px 18px rgba(0, 0, 0, .4); }
.tb-opp.now .tb-av { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 0 0 3px var(--acc), 0 0 22px 2px color-mix(in oklab, var(--acc) 55%, transparent), 0 8px 18px rgba(0, 0, 0, .4); }
.tb-opp.off { opacity: .45; }
.tb-opp.out { opacity: .4; filter: grayscale(.7); }
@property --tb-t { syntax: '<percentage>'; inherits: false; initial-value: 0%; }
.tb-timer { position: absolute; inset: -7px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(var(--acc) var(--tb-t), rgba(255, 255, 255, .14) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px)); mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  animation: tb-tick 20s linear both; animation-delay: var(--since, 0s); }
.tb-opp.bot .tb-timer, .tb-opp.still .tb-timer { animation: none; --tb-t: 100%; opacity: .55; }
@keyframes tb-tick { from { --tb-t: 100%; } to { --tb-t: 0%; } }
.tb-fan { position: absolute; top: 28px; left: calc(50% + 12px); width: 36px; height: 30px; pointer-events: none; }
.tb-fan i { position: absolute; left: 6px; top: 0; width: 18px; height: 26px; border-radius: 4px; background: var(--tb-back, oklch(0.45 0.15 25)); box-shadow: inset 0 0 0 1.5px #fff, 0 2px 4px rgba(0, 0, 0, .4); transform-origin: 50% 100%; }
.tb-fan i:nth-child(1) { transform: rotate(-16deg); } .tb-fan i:nth-child(3) { transform: rotate(16deg); }
.tb-badge { position: absolute; top: -4px; left: calc(50% + 16px); min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: #fff; color: #111; font: 700 12px/22px var(--font); text-align: center; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tb-opp:has(.tb-fan) .tb-badge { top: 24px; left: calc(50% + 34px); }
.tb-badge.hot { background: var(--neg); color: #fff; }
.tb-nm { font-size: 13px; font-weight: 650; max-width: 96px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 3px rgba(0, 0, 0, .5); color: var(--ink); }
.tb-tag { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--acc); color: var(--on-acc); white-space: nowrap; }
.tb-tag.warn { background: var(--neg); color: #fff; box-shadow: 0 0 14px color-mix(in oklab, var(--neg) 70%, transparent); }
.tb-tag.soft { background: rgba(255, 255, 255, .14); color: var(--ink); }
.tb-opps.many { height: 112px; }
.tb-opps.many .tb-opp { width: 64px; }
.tb-opps.many .tb-av { width: 42px; height: 42px; font-size: 22px; }
.tb-opps.many .tb-fan { top: 20px; left: calc(50% + 6px); transform: scale(.82); }
.tb-opps.many .tb-nm { font-size: 11.5px; max-width: 64px; }

/* le meneur */
.tb-say { display: flex; flex-direction: row; justify-content: flex-start; gap: 12px; align-items: center; padding: 12px 16px; border-radius: 22px; text-align: left;
  background: var(--tb-glass); -webkit-backdrop-filter: blur(22px) saturate(180%); backdrop-filter: blur(22px) saturate(180%);
  box-shadow: inset 0 1.2px 0 var(--tb-hi), inset 0 0 0 .5px var(--tb-rim), 0 0 0 .5px var(--tb-edge), 0 10px 30px rgba(0, 0, 0, .3); }
.tb-say.hot { box-shadow: inset 0 1.2px 0 var(--tb-hi), inset 0 0 0 1px color-mix(in oklab, var(--acc) 55%, transparent), 0 0 0 .5px var(--tb-edge), 0 0 30px -6px color-mix(in oklab, var(--acc) 50%, transparent), 0 10px 30px rgba(0, 0, 0, .3); }
.tb-pip { width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 19px; line-height: 1;
  background: color-mix(in oklab, var(--acc) 22%, transparent); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--acc) 55%, transparent); }
.screen.tb .tb-say .mj-title { margin: 0; font-size: 20px; line-height: 1.15; letter-spacing: -.02em; color: var(--ink); }
.screen.tb .tb-say.hot .mj-title { color: var(--acc); }
.screen.tb .tb-say .mj-say { margin: 2px 0 0; font-size: 14.5px; color: var(--ink-2); line-height: 1.35; }

/* le plateau de verre collé en bas, et la main en éventail */
.tb-tray { position: sticky; bottom: 0; z-index: 5; margin: auto -20px 0; padding: 10px 14px max(14px, env(safe-area-inset-bottom)); border-radius: 30px 30px 0 0;
  background: var(--tb-glass-thick); -webkit-backdrop-filter: blur(34px) saturate(170%); backdrop-filter: blur(34px) saturate(170%);
  box-shadow: inset 0 1.2px 0 var(--tb-hi), inset 0 0 0 .5px var(--tb-rim), 0 -10px 30px rgba(0, 0, 0, .3); }
.tb-tray-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 2px 6px 0; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.tb-tray-top b { color: var(--ink); }
.tb-fan-hand { overflow-x: auto; overflow-y: visible; scrollbar-width: none; margin: 0 -14px; padding: 0 14px; }
.tb-fan-hand::-webkit-scrollbar { display: none; }
.tb-fan-in { position: relative; margin: 0 auto; }
.tb-slot { position: absolute; top: 0; transition: transform .32s cubic-bezier(.3, 1.3, .5, 1); }
.tb-slot > * { width: 100% !important; will-change: transform; }
.tb-slot.no > * { filter: saturate(.55) brightness(.62); }
.tb-slot.ok > * { box-shadow: 0 0 0 2.5px var(--acc), 0 0 20px 2px color-mix(in oklab, var(--acc) 48%, transparent), 0 12px 24px -6px rgba(0, 0, 0, .6) !important; }
.tb-slot.sel > * { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--acc), 0 14px 26px -6px rgba(0, 0, 0, .6) !important; }
.tb-acts { display: flex; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.tb-acts .btn { flex: 1 1 0; min-width: 120px; min-height: 50px; font: 650 16px var(--font); }
.screen.tb .tb-btn.glass { background: var(--tb-field); color: var(--ink); border: 0; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), inset 0 0 0 .5px var(--tb-rim); }
/* « hero » est aussi le titre de l'accueil dans style.css (.hero{padding:10px 0 0}) : on rétablit le rembourrage du bouton */
.screen.tb .tb-btn.hero { padding: 14px 20px; text-align: center; border: 0; color: oklch(0.25 0.06 75); font-weight: 700; background: linear-gradient(180deg, oklch(0.88 0.16 90), oklch(0.78 0.17 75));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 0 0 3px oklch(0.86 0.17 92 / .3), 0 10px 26px -8px oklch(0.7 0.17 75); }
/* style.css fait « respirer » tout .btn.danger (ancien Chromo) : pas dans le plateau, il bougerait sous le doigt */
.screen.tb .tb-btn.danger { animation: none; border: 0; background: var(--neg); color: #fff; box-shadow: 0 0 0 3px color-mix(in oklab, var(--neg) 30%, transparent), 0 10px 22px -8px var(--neg); }
.screen.tb .tb-btn.pulse { animation: tb-pulse 1.4s ease-in-out infinite; }
@keyframes tb-pulse { 50% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6), 0 0 0 7px oklch(0.86 0.17 92 / .18), 0 10px 26px -8px oklch(0.7 0.17 75); } }

/* scores et fil : dans la feuille (#tb-sheet) sur téléphone, dans une carte de verre sur PC */
.tb-rows, .tb-log, .sheet .tb-rows, .sheet .tb-log { list-style: none; margin: 0; padding: 0; }
.tb-rows li { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 2px; border-top: .5px solid rgba(255, 255, 255, .12); }
.tb-rows li:first-child { border-top: 0; }
.tb-rows li.me .tb-n { color: var(--acc); }
.tb-e { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 19px; background: rgba(255, 255, 255, .08); flex: none; }
.tb-n { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.tb-n small { display: block; font-weight: 500; color: var(--ink-2); font-size: 13px; }
.tb-s { font: 700 19px var(--font); font-variant-numeric: tabular-nums; }
.tb-log li { padding: 9px 2px; border-top: .5px solid rgba(255, 255, 255, .1); font-size: 15px; color: var(--ink-2); }
.tb-log li:first-child { border-top: 0; color: var(--ink); }
.tb-sheet-say { margin: 0 0 8px; font-size: 14.5px; color: var(--ink-2); }
/* hors manche : les listes de l'ossature passent au verre */
.screen.tb .mj-list { background: var(--tb-glass); border: 0; border-radius: 20px; -webkit-backdrop-filter: blur(22px) saturate(180%); backdrop-filter: blur(22px) saturate(180%); box-shadow: inset 0 1px 0 var(--tb-hi), inset 0 0 0 .5px var(--tb-rim); }
.screen.tb .mj-meta { color: var(--ink-2); }
.screen.tb .btn.primary.lg { border: 0; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 10px 22px -12px color-mix(in oklab, var(--acc) 80%, black); }

/* les cartes classiques : face ivoire vernie, coins nets, vraie ombre ; dos à motif dans un cadre blanc */
.screen.tb .km-card { border: 0; border-radius: 10px;
  background: linear-gradient(165deg, #fffdf8, oklch(0.965 0.012 85) 55%, oklch(0.92 0.015 80));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1), inset 0 1px 0 #fff, 0 8px 18px -6px rgba(0, 0, 0, .5), 0 2px 4px rgba(0, 0, 0, .22); color: oklch(0.2 0.02 260); }
.screen.tb .km-card::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: linear-gradient(118deg, rgba(255, 255, 255, .55) 0 14%, transparent 30%); }
.screen.tb .km-card .km-corner b { font-family: var(--font); font-weight: 750; letter-spacing: -.02em; }
.screen.tb .km-card .km-pip { font-family: var(--font); filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .12)); }
.screen.tb .km-card .red { color: oklch(0.55 0.21 25); }
.screen.tb :is(.pk-card, .bt-card, .so-card, .km-back).back { border: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .16), transparent 60%),
    repeating-linear-gradient(45deg, color-mix(in oklab, var(--tb-back, oklch(0.45 0.15 25)), white 10%) 0 4px, var(--tb-back, oklch(0.45 0.15 25)) 4px 8px);
  box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 4.5px rgba(0, 0, 0, .12), 0 8px 18px -6px rgba(0, 0, 0, .5), 0 2px 4px rgba(0, 0, 0, .22); }

/* PC : la table au centre, les colonnes de droite en verre épais */
@media (min-width: 1100px) {
  .screen.tb .desk-side > * { background: var(--tb-glass-thick); border-radius: 26px; padding: 16px 18px;
    -webkit-backdrop-filter: blur(30px) saturate(170%); backdrop-filter: blur(30px) saturate(170%); box-shadow: inset 0 1.2px 0 var(--tb-hi), inset 0 0 0 .5px var(--tb-rim), 0 10px 30px rgba(0, 0, 0, .3); }
  .screen.tb .desk-side .mj-list { background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; border-radius: 0; }
  .screen.tb .tb-chips { display: none; }
  .screen.tb .tb-tray { margin: auto 0 0; }
  .screen.tb .tb-acts { max-width: 460px; margin: 4px auto 0; }
}
@media (prefers-reduced-motion: reduce) { .tb-slot { transition: none; } .screen.tb .tb-btn.pulse { animation: none; } }
