/* Une inscription dans le tapis, sous tout le matériel. */
.game-table { isolation:isolate; }
.table-watermark { position:absolute; inset:0; z-index:-1; display:flex; flex-direction:column; justify-content:center; align-items:center; pointer-events:none; user-select:none; color:currentColor; opacity:.055; line-height:1; }
.table-watermark span { font:150px/1.1 Georgia,'Yu Mincho',serif; }
.table-watermark strong { font:64px/1.2 Georgia,serif; letter-spacing:.22em; padding-left:.22em; }

/* Chaque adversaire latéral occupe une zone bornée, sans espace vide entre
   sa Main et sa défausse. Jusqu'à quatre groupes restent entièrement visibles. */
@media(min-width:1000px) and (min-height:500px) {
 .in-game .game-table .seat.west,.in-game .game-table .seat.east {
  display:grid; grid-template-columns:minmax(0,1fr) 136px;
  grid-template-rows:38px 22px 18px minmax(0,128px);
  gap:2px 8px; width:100%; max-width:none; min-height:0; align-self:start;
 }
 .in-game .seat:is(.west,.east) .seat-title { grid-column:1/3; grid-row:1; min-width:0; }
 .in-game .seat:is(.west,.east) .seat-title>div { min-width:0; }
 .in-game .seat:is(.west,.east) .seat-title strong { display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
 .in-game .seat:is(.west,.east) .card-backs { grid-column:1; grid-row:2; margin:2px 0; }
 .in-game .seat:is(.west,.east) .discard-label { grid-column:1; grid-row:3; margin:0; align-self:center; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
 .in-game .seat:is(.west,.east) .discards { grid-column:1; grid-row:4; width:100%; max-width:250px; justify-self:center; grid-template-columns:repeat(6,minmax(0,1fr)); }
 .app-shell.in-game .seat:is(.west,.east) .discards .card.small { width:100%; max-width:34px; min-width:0; }
 .app-shell.in-game .game-surface .seat:is(.west,.east) .seat-exposed { grid-column:2; grid-row:2/5; height:172px; min-height:0; width:136px; }
 .in-game .seat:is(.west,.east) .seat-exposed .exposed-groups { flex-direction:column; justify-content:flex-start; align-items:center; min-width:0; width:100%; height:auto; gap:4px; padding:3px; }
 .in-game .game-table .seat:is(.west,.east):has(.exposed-group:nth-child(4)) { grid-template-rows:38px 22px 18px 188px; }
 .app-shell.in-game .game-surface .seat:is(.west,.east):has(.exposed-group:nth-child(4)) .seat-exposed { height:230px; }
 .in-game .seat:is(.west,.east) .kami-stick-slot { position:absolute; right:3px; top:30px; width:80px; }
 .in-game .seat:is(.west,.east) .revealed { top:40px; left:auto; right:0; width:96px; max-height:172px; }
 .in-game .game-table .table-center { min-height:0; }
 .app-shell.in-game .game-surface .hand { left:270px; right:250px; }
 .app-shell.in-game .player-heading .own-exposed { left:350px; right:250px; }
}

.victory-layer { position:fixed; inset:0; z-index:90; pointer-events:none; }
.under-reveal { position:absolute; left:50%; top:50%; transform:translate(-50%,-50%); display:flex; flex-direction:column; align-items:center; gap:14px; padding:22px; border:1px solid #f2d694; border-radius:16px; color:#fff4ce; background:#193f32f5; box-shadow:0 4px 22px #0005; text-align:center; max-width:calc(100vw - 32px); }
.under-flip { width:78px; height:110px; perspective:650px; }
.under-flip-inner { position:relative; width:100%; height:100%; transform-style:preserve-3d; animation:under-turn 850ms ease-in-out both; }
.under-back,.under-front { position:absolute; inset:0; backface-visibility:hidden; border-radius:8px; }
.under-back { display:flex; flex-direction:column; justify-content:center; align-items:center; border:3px solid #f4ead3; background:repeating-linear-gradient(45deg,#315247,#315247 5px,#27463c 5px,#27463c 10px); color:#f4ead3; }
.under-back span { font:38px Georgia,serif; }
.under-back b { font:13px Georgia,serif; letter-spacing:.15em; }
.under-front { transform:rotateY(180deg); }
.under-front .card { width:78px; height:110px; margin:0; }
@keyframes under-turn { 0%,20% { transform:rotateY(0); } 100% { transform:rotateY(180deg); } }
.rulebook-link { display:flex; flex-wrap:wrap; align-items:baseline; gap:5px 12px; }
.rulebook-link a { color:inherit; font-weight:700; text-underline-offset:3px; }
.rulebook-link small { opacity:.8; }
.result-under { display:flex; align-items:center; gap:14px; margin:12px 0; }
.result-under h3 { margin:0; }
.victory-banner { position:absolute; transform:translate(-50%,-50%); display:flex; flex-direction:column; align-items:center; gap:5px; padding:12px 22px; border-radius:12px; background:#193f32f2; border:1px solid #f2d694; box-shadow:0 4px 22px #0005; color:#fff4ce; text-align:center; max-width:280px; }
.victory-banner strong { font:32px Georgia,serif; white-space:nowrap; }
.victory-banner>span { font:13px Arial,sans-serif; }
.point-flight { position:absolute; transform:translate(-50%,-50%); animation:points-transfer 3s both; text-align:center; color:#fff7d9; }
.point-sticks { display:flex; flex-direction:column; gap:3px; align-items:center; }
.point-sticks i { display:block; width:56px; height:9px; border:1px solid #d6c89e; border-radius:3px; background:#fff4d6; color:#be4e43; font:8px/7px Arial,sans-serif; box-shadow:0 2px 6px #0005; }
.point-sticks i:nth-child(2) { transform:translateX(4px) rotate(-5deg); }
.point-sticks i:nth-child(3) { transform:translateX(-4px) rotate(4deg); }
.point-flight>span { display:block; margin-top:6px; padding:3px 6px; border-radius:4px; background:#173c31ed; font:12px Arial,sans-serif; white-space:nowrap; }
@keyframes points-transfer {
 0%,15% { transform:translate(-50%,-50%); opacity:1; }
 80%,94% { transform:translate(calc(-50% + var(--points-x)),calc(-50% + var(--points-y))); opacity:1; }
 100% { transform:translate(calc(-50% + var(--points-x)),calc(-50% + var(--points-y))); opacity:0; }
}
@media(prefers-reduced-motion:reduce) {
 .point-flight { animation:none; }
 .under-flip-inner { animation:none; transform:rotateY(180deg); }
}

/* Une scène de fin de Manche couvre uniquement le tapis, Main comprise. */
.game-surface { position:relative; }
.exhaustion-overlay {
 position:absolute; inset:0; z-index:95; display:flex; align-items:center;
 justify-content:center; overflow:hidden; border-radius:8px;
 background:#14271f; pointer-events:auto;
}
.exhaustion-overlay img { display:block; width:100%; height:100%; object-fit:contain; }

.winning-keys-reveal { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; gap:12px; padding:20px; background:#10271bf5; color:#fff4ce; pointer-events:auto; }
.winning-keys-reveal.preloading { visibility:hidden; pointer-events:none; }
.winning-keys-reveal h2 { flex-shrink:0; margin:0; font:26px Georgia,serif; text-align:center; }
.winning-keys-grid { display:grid; grid-template-columns:repeat(var(--key-columns),minmax(0,1fr)); grid-template-rows:repeat(var(--key-rows),minmax(0,1fr)); gap:12px; width:100%; max-width:1500px; flex:1; min-height:0; }
.winning-keys-grid figure { display:flex; flex-direction:column; justify-content:center; gap:6px; margin:0; min-width:0; min-height:0; padding:8px; border:1px solid #c9ad6a; border-radius:8px; background:#193f32; }
.winning-keys-grid img { display:block; width:100%; min-height:0; flex:1; object-fit:contain; }
.winning-keys-grid img.unavailable { visibility:hidden; }
.winning-keys-grid figcaption { flex-shrink:0; text-align:center; font:16px/1.2 Georgia,serif; }
@media(max-height:450px) {
 .winning-keys-reveal { padding:6px; gap:4px; }
 .winning-keys-reveal h2 { font-size:17px; }
 .winning-keys-grid { gap:5px; }
 .winning-keys-grid figure { padding:3px; gap:2px; }
 .winning-keys-grid figcaption { font-size:12px; }
}
