/* ==========================================================================
   TACTILE PLAYING CARDS (Classic 5:7 Portrait Playing Card Silhouette)
   ========================================================================== */
.game-card {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6px 7px;
  box-shadow: var(--shadow-card);
  transition: transform 0.25s var(--spring), box-shadow 0.2s ease, opacity 0.2s ease;
  position: relative;
  user-select: none;
  cursor: default;
}

.game-card.empty-pile-slot {
  background: rgba(15, 23, 42, 0.45) !important;
  border: 1.5px dashed rgba(255, 255, 255, 0.24) !important;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.35) !important;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.game-card.clickable {
  cursor: pointer;
}
.game-card.clickable:active {
  transform: scale(0.94);
}

/* Keyboard Accessibility Focus Rings (shown only on keyboard focus) */
button:focus-visible,
.game-card:focus-visible {
  outline: 2.5px solid #7dd3fc;
  outline-offset: 2px;
}
.game-card:focus-visible {
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.35), var(--shadow-lift);
  z-index: 7;
}

/* Elegant Golden Halo for valid targets & active cards */
.game-card.selectable {
  cursor: pointer;
  box-shadow: 0 0 12px var(--gold-glow), 0 0 0 2px var(--gold);
}
.game-card.flip-target {
  cursor: pointer;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.65), 0 0 0 2px var(--cyan) !important;
}
.flip-target-pill {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #0369a1, #0284c7);
  color: #e0f2fe;
  border: 1px solid #7dd3fc;
  font-size: 8.5px;
  font-weight: 900;
  letter-spacing: 0.4px;
  padding: 1px 6px;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}
.game-card.pulse-glow {
  box-shadow: 0 0 14px var(--gold-glow), 0 0 0 2px var(--gold);
  animation: gentleGlow 1.6s infinite alternate;
}
@keyframes gentleGlow {
  0% { opacity: 0.9; }
  100% { opacity: 1; }
}
.game-card.triple-target {
  box-shadow: 0 0 18px rgba(16, 185, 129, 0.75), 0 0 0 2.5px #34d399;
  z-index: 4;
}
.triple-clear-pill {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  background: #059669;
  color: #ecfdf5;
  border: 1px solid #6ee7b7;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.4px;
  padding: 1px 5px;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  z-index: 6;
}
.game-card.negative-clear-warn {
  box-shadow: 0 0 15px rgba(244, 63, 94, 0.65), 0 0 0 2.5px #fb7185;
  z-index: 4;
}
.negative-clear-pill {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  background: #9f1239;
  color: #ffe4e6;
  border: 1px solid #fda4af;
  font-size: 8.5px;
  font-weight: 900;
  letter-spacing: 0.3px;
  padding: 1px 5px;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  z-index: 6;
}
.game-card.last-hidden-card {
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.72), 0 0 0 2px #f59e0b;
  z-index: 3;
}
.last-card-pill {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  background: #b45309;
  color: #fef3c7;
  border: 1px solid #fbbf24;
  font-size: 8.5px;
  font-weight: 900;
  letter-spacing: 0.3px;
  padding: 1px 5px;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  z-index: 6;
}

/* True Two-Phase 3D Card Flip, Deal & Landing Animations */
@keyframes cardFlip3D {
  0% {
    transform: translateY(0) scale(1) rotateY(0deg);
    animation-timing-function: cubic-bezier(0.42, 0, 0.9, 0.65);
  }
  42% {
    transform: translateY(-11px) scale(1.07) rotateY(90deg);
    box-shadow: var(--shadow-lift);
  }
  42.01% {
    transform: translateY(-11px) scale(1.07) rotateY(-90deg);
    box-shadow: var(--shadow-lift);
    animation-timing-function: cubic-bezier(0.18, 0.89, 0.32, 1.1);
  }
  100% {
    transform: translateY(0) scale(1) rotateY(0deg);
  }
}
@keyframes cardBackFlipHide {
  0% { opacity: 1; }
  42%, 100% { opacity: 0; }
}
.game-card.just-flipped {
  animation: cardFlip3D 0.48s linear forwards;
  z-index: 8;
}
.card-back-flip-face {
  position: absolute;
  inset: -2px;
  border-radius: 10px;
  background: #151f30;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  padding: 5px;
  pointer-events: none;
  z-index: 9;
  animation: cardBackFlipHide 0.48s steps(1, end) forwards;
}
.game-card.reveal-end-card.just-flipped,
.game-card.reveal-end-card .card-back-flip-face {
  animation-duration: 0.56s;
}
@keyframes revealEndHalo {
  0% {
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0.45;
  }
}
.game-card.reveal-end-card::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  border: 2px solid rgba(125, 211, 252, 0.85);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.55), 0 0 8px rgba(251, 191, 36, 0.45);
  pointer-events: none;
  z-index: 7;
  animation: revealEndHalo 1.4s ease-out forwards;
}
@media (prefers-reduced-motion: reduce) {
  .game-card.reveal-end-card::after,
  .score-tick {
    animation: none !important;
  }
}

@keyframes cardSwapPop {
  0% {
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 0 14px var(--gold-glow), var(--shadow-lift);
  }
  60% {
    transform: scale(0.985) translateY(0.5px);
  }
  100% {
    transform: scale(1) translateY(0);
  }
}
.game-card.just-swapped {
  animation: cardSwapPop 0.34s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  z-index: 8;
}

@keyframes cardDealIn {
  0% {
    transform: translate3d(var(--deal-dx, 0px), -30px, 0) scale(0.86) rotateZ(var(--deal-rot, -3deg));
    opacity: 0;
  }
  100% {
    transform: translate3d(0, 0, 0) scale(1) rotateZ(0deg);
    opacity: 1;
  }
}
.game-card.deal-in {
  animation: cardDealIn 0.46s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.game-card.fx-awaiting-arrival {
  opacity: 0 !important;
  pointer-events: none;
}
@keyframes fxLandBounce {
  0% {
    transform: scale(1.055) translateY(-2px);
    box-shadow: 0 0 16px rgba(251, 191, 36, 0.55), var(--shadow-lift);
  }
  62% {
    transform: scale(0.985) translateY(0.5px);
  }
  100% {
    transform: scale(1) translateY(0);
  }
}
.game-card.fx-just-landed {
  animation: fxLandBounce 0.32s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes discardTossLand {
  0% {
    transform:
      translate(
        calc(var(--throw-x, 0px) * var(--pile-scatter, 1)),
        calc(var(--throw-y, 0px) * var(--pile-scatter, 1) - 3px)
      )
      rotate(calc(var(--throw-rot, 0deg) + var(--throw-kick, 3deg)))
      scale(1.075);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.7), 0 0 14px rgba(251, 191, 36, 0.45);
  }
  58% {
    transform:
      translate(
        calc(var(--throw-x, 0px) * var(--pile-scatter, 1)),
        calc(var(--throw-y, 0px) * var(--pile-scatter, 1) + 0.5px)
      )
      rotate(calc(var(--throw-rot, 0deg) - var(--throw-kick, 3deg) * 0.25))
      scale(0.98);
  }
  100% {
    transform:
      translate(
        calc(var(--throw-x, 0px) * var(--pile-scatter, 1)),
        calc(var(--throw-y, 0px) * var(--pile-scatter, 1))
      )
      rotate(var(--throw-rot, 0deg))
      scale(1);
  }
}
#discardPileCard.fx-just-landed:not(.empty-pile-slot) {
  animation: discardTossLand 0.34s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Spatial Flying Card FX Overlay Layer (True CSS 3D Two-Sided Card) */
#cardFxLayer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 85;
  overflow: hidden;
}
.fx-flying-wrap {
  position: fixed;
  left: 0;
  top: 0;
  width: 68px;
  height: 95px;
  margin-left: -34px;
  margin-top: -47.5px;
  perspective: 820px;
  pointer-events: none;
  will-change: transform, opacity;
}
.fx-flying-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  will-change: transform;
}
.fx-face-front,
.fx-face-back {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.fx-face-front {
  transform: rotateY(0deg);
}
.fx-face-back {
  transform: rotateY(180deg);
  background: #151f30;
  border: 1.5px solid rgba(255, 255, 255, 0.26);
  padding: 5px;
}
.fx-flying-inner .card-numeral {
  font-size: 31px;
}
.fx-action-tag {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: var(--gold-light);
  border: 1px solid rgba(251, 191, 36, 0.75);
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 8.5px;
  font-weight: 900;
  letter-spacing: 0.04em;
  white-space: nowrap;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.65);
}

/* Face-Down Card Back: Clean Classic Playing Card Back */
.game-card.face-down {
  background: #151f30;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  padding: 5px;
}
.card-pattern-frame {
  width: 100%;
  height: 100%;
  border-radius: 6px;
  border: 1px solid rgba(245, 158, 11, 0.38);
  background: 
    radial-gradient(circle at 50% 50%, rgba(245, 158, 11, 0.14) 0%, transparent 70%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.03) 0px, rgba(255, 255, 255, 0.03) 4px, transparent 4px, transparent 8px),
    linear-gradient(160deg, #1b283d 0%, #101826 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.45);
}
.card-crest-diamond {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  transform: rotate(45deg);
  border: 1.5px solid rgba(245, 158, 11, 0.75);
  background: linear-gradient(135deg, #1e293b, #0f172a);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.45);
}
.card-crest-diamond svg {
  width: 11px;
  height: 11px;
  fill: var(--gold);
  transform: rotate(-45deg);
}
.card-crest-title {
  display: none;
}

/* Face-Up Cards: Warm Cream Linen Tabletop Card Faces with Corner Pips & Printmaker Ink */
.game-card.face-up {
  --card-ink: #3E2B25;
  --card-frame: rgba(78, 52, 46, 0.28);
  --card-edge: #D6C7B2;
  --card-wash: rgba(78, 52, 46, 0.06);
  background: linear-gradient(165deg, #FCF8F0 0%, #F1E6D4 100%);
  color: var(--card-ink);
  border: 2px solid var(--card-edge);
}
.game-card.face-up::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 6px;
  border: 1.5px solid var(--card-frame);
  background: linear-gradient(180deg, var(--card-wash) 0%, transparent 28%, transparent 72%, var(--card-wash) 100%);
  pointer-events: none;
}
.game-card.val-neg2,
.game-card.val-neg1 {
  --card-ink: #5B21B6;
  --card-frame: rgba(124, 58, 237, 0.55);
  --card-edge: #A78BFA;
  --card-wash: rgba(139, 92, 246, 0.13);
}
.game-card.val-0 {
  --card-ink: #0F766E;
  --card-frame: rgba(15, 118, 110, 0.52);
  --card-edge: #5EEAD4;
  --card-wash: rgba(20, 184, 166, 0.12);
}
.game-card.val-1, .game-card.val-2, .game-card.val-3, .game-card.val-4 {
  --card-ink: #27603A;
  --card-frame: rgba(47, 107, 63, 0.48);
  --card-edge: #86C596;
  --card-wash: rgba(74, 155, 96, 0.12);
}
.game-card.val-5, .game-card.val-6, .game-card.val-7, .game-card.val-8 {
  --card-ink: #9A4A0B;
  --card-frame: rgba(180, 83, 9, 0.52);
  --card-edge: #F0B45B;
  --card-wash: rgba(217, 119, 6, 0.13);
}
.game-card.val-9, .game-card.val-10, .game-card.val-11, .game-card.val-12 {
  --card-ink: #9F1239;
  --card-frame: rgba(190, 18, 60, 0.55);
  --card-edge: #F4839E;
  --card-wash: rgba(225, 29, 72, 0.13);
}

.card-pip {
  position: absolute;
  font-size: clamp(8.5px, calc(var(--slot-w, 64px) * 0.145), 11.5px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--card-ink, #3E2B25);
  opacity: 0.9;
  pointer-events: none;
  z-index: 1;
}
.card-pip-tl {
  top: 6px;
  left: 7px;
}
.card-pip-br {
  bottom: 6px;
  right: 7px;
  transform: rotate(180deg);
}
.pile-deck-stack .card-pip {
  font-size: clamp(7.5px, calc(var(--pile-h, 74px) * 0.11), 11px);
}
.drag-card-ghost .card-pip,
.fx-flying-wrap .card-pip {
  font-size: 10px;
}
.held-mini-slot .card-pip,
.discard-underlay-card .card-pip,
.game-card.triple-target .card-pip-br,
.game-card.negative-clear-warn .card-pip-br,
.game-card.flip-target .card-pip-br {
  display: none;
}
.card-numeral {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--card-ink, #3E2B25);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.85);
  z-index: 1;
}

/* Cleared Column State */
.game-card.cleared {
  opacity: 0.12;
  background: transparent !important;
  border: 1.5px dashed rgba(255, 255, 255, 0.25) !important;
  box-shadow: none !important;
  transform: scale(0.94);
  pointer-events: none;
}

/* Dramatic Column Triple-Clear Celebration & Dissolve Juice */
@keyframes tripleGlowPulse {
  0% {
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.7), 0 0 0 2px #f59e0b;
    transform: scale(1.02);
  }
  100% {
    box-shadow: 0 0 24px rgba(251, 191, 36, 0.95), 0 0 0 3px #fbbf24;
    transform: scale(1.07);
  }
}
.game-card.column-clearing {
  animation: tripleGlowPulse 0.42s infinite alternate cubic-bezier(0.22, 1, 0.36, 1) !important;
  z-index: 6;
  border-color: #fbbf24 !important;
}
.game-card.column-clearing.just-flipped {
  animation: cardFlip3D 0.48s linear forwards !important;
  z-index: 12 !important;
}
.game-card.column-clearing-banish {
  transform: translateY(-8px) scale(0.84) !important;
  opacity: 0 !important;
  filter: brightness(1.65) !important;
  transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.36s ease-out, filter 0.36s ease-out !important;
  z-index: 6;
}
.triple-celebration-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #92400e, #d97706);
  color: #fff;
  border: 1.5px solid #fde047;
  padding: 4px 7px;
  border-radius: 10px;
  font-size: 9.5px;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
  letter-spacing: 0.2px;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.75), 0 0 14px rgba(251, 191, 36, 0.65);
  pointer-events: none;
  z-index: 20;
  animation: tripleBannerPop 0.3s cubic-bezier(0.22, 1.15, 0.36, 1) both;
}
.triple-celebration-banner.row-even-banner {
  left: calc(100% + var(--slot-pad, 3.5px));
}
.triple-celebration-banner.col-even-banner {
  top: calc(100% + var(--slot-pad, 3.5px));
}
.triple-celebration-banner.negative-clear-banner {
  background: linear-gradient(135deg, #881337, #be123c);
  border-color: #fda4af;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.75), 0 0 14px rgba(244, 63, 94, 0.6);
}
@keyframes tripleBannerPop {
  0% { transform: translate(-50%, -50%) scale(0.4); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Held-Card Action Tray (Always floating overlay centered over table so piles/grid never shift by 1px) */
.held-card-tray {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 16px);
  max-width: 356px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  background: linear-gradient(180deg, #1e293b, #0f172a);
  border: 1.5px solid var(--gold);
  border-radius: 14px;
  padding: 7px 11px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.75), 0 0 18px var(--gold-glow);
  animation: popInTray 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 25;
}
@keyframes popInTray {
  from { transform: translate(-50%, -44%) scale(0.95); opacity: 0; }
  to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.held-mini-slot {
  width: 44px;
  height: 62px;
  flex-shrink: 0;
  touch-action: none;
  cursor: grab;
}

/* Tactile Card Drag & Drop Ghost + Drop Target Highlights */
body.is-dragging-card,
body.is-dragging-card * {
  cursor: grabbing !important;
}
.pile-deck-stack .game-card.pulse-glow {
  cursor: grab;
}
.drag-card-ghost {
  position: fixed;
  left: 0;
  top: 0;
  width: 68px;
  height: 95px;
  margin-left: -34px;
  margin-top: -47.5px;
  pointer-events: none;
  z-index: 94;
  perspective: 750px;
  will-change: transform;
}
.drag-card-ghost .game-card {
  width: 100%;
  height: 100%;
  border-width: 2.5px;
  border-color: #fde047;
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.55);
}
.drag-card-ghost .card-numeral {
  font-size: 31px;
}
.drag-preview-pill {
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%) translateY(4px) scale(0.92);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.02em;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.72);
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 12;
}
.drag-preview-pill.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}
.drag-preview-pill.tone-good {
  background: linear-gradient(135deg, #065f46, #059669);
  border-color: #6ee7b7;
  color: #ecfdf5;
}
.drag-preview-pill.tone-warn {
  background: linear-gradient(135deg, #881337, #be123c);
  border-color: #fda4af;
  color: #fff1f2;
}
.drag-preview-pill.tone-clear {
  background: linear-gradient(135deg, #065f46, #047857);
  border-color: #fde047;
  color: #fef9c3;
}
.drag-preview-pill.tone-final {
  background: linear-gradient(135deg, #92400e, #d97706);
  border-color: #fde047;
  color: #fefce8;
}
.drag-preview-pill.tone-hidden {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border-color: rgba(251, 191, 36, 0.78);
  color: #fef3c7;
}
.drag-preview-pill.tone-neutral {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border-color: rgba(148, 163, 184, 0.55);
  color: #cbd5e1;
}
.drag-preview-pill.tone-discard {
  background: linear-gradient(135deg, #0c4a6e, #0284c7);
  border-color: #7dd3fc;
  color: #e0f2fe;
}
.game-card.drag-source-dimmed {
  opacity: 0.16 !important;
  transform: scale(0.92) !important;
}
.held-card-tray.dragging-held {
  opacity: 0.12 !important;
  pointer-events: none !important;
  transition: opacity 0.15s ease;
}
.piles-layout.dragging-reveal-discard {
  opacity: 1 !important;
  filter: none !important;
  transform: scale(0.96) !important;
}
.game-card.drag-drop-hover {
  transform: scale(1.08) translateY(-3px) !important;
  border-color: #fde047 !important;
  box-shadow: 0 0 22px rgba(251, 191, 36, 0.9), 0 0 0 2.5px #fbbf24 !important;
  z-index: 20 !important;
}
.game-card.drag-drop-hover.triple-target {
  border-color: #6ee7b7 !important;
  box-shadow: 0 0 26px rgba(16, 185, 129, 0.95), 0 0 0 3px #34d399 !important;
}
.game-card.drag-drop-hover.negative-clear-warn {
  border-color: #fda4af !important;
  box-shadow: 0 0 24px rgba(244, 63, 94, 0.9), 0 0 0 3px #fb7185 !important;
}
.grid-card-slot:has(.drag-drop-hover) {
  z-index: 22 !important;
}
#discardPileCard.discard-drop-ready {
  border: 2px dashed rgba(56, 189, 248, 0.78) !important;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.38) !important;
}
#discardPileCard.discard-drop-hover {
  transform:
    translate(
      calc(var(--throw-x, 0px) * var(--pile-scatter, 1)),
      calc(var(--throw-y, 0px) * var(--pile-scatter, 1) - 3px)
    )
    rotate(calc(var(--throw-rot, 0deg) * 0.35))
    scale(1.09) !important;
  border: 2.5px solid #38bdf8 !important;
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.92), 0 0 0 2.5px #7dd3fc !important;
}

.held-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.held-headline {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--gold-light);
}
.held-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.25;
}

.tray-btn {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 800;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: transform 0.15s var(--spring), background 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 38px;
}
.tray-btn:active {
  transform: scale(0.93);
}
.tray-btn-primary {
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  color: #fff;
  box-shadow: 0 3px 10px rgba(56, 189, 248, 0.35);
}
.tray-btn-primary:disabled {
  opacity: 0.65;
  cursor: default;
}
.tray-btn-secondary {
  background: rgba(56, 189, 248, 0.18);
  border: 1px solid rgba(125, 211, 252, 0.45);
  color: #e0f2fe;
}

/* Floating Bar shown when peeking at the table after Round Over */
.round-results-bar {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 16px);
  max-width: 356px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: linear-gradient(180deg, #1e293b, #0f172a);
  border: 1.5px solid rgba(56, 189, 248, 0.72);
  border-radius: 14px;
  padding: 8px 11px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.75), 0 0 18px rgba(56, 189, 248, 0.25);
  animation: popInTray 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 25;
}
.round-results-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.round-results-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--gold-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.round-results-sub {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.round-results-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.round-results-actions .tray-btn {
  padding: 7px 10px;
  min-height: 36px;
  font-size: 12px;
}
.summary-peek-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  min-height: 34px;
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(125, 211, 252, 0.38);
  color: #e0f2fe;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: transform 0.15s var(--spring), background 0.15s ease;
}
.summary-peek-btn:hover {
  background: rgba(56, 189, 248, 0.24);
}
.summary-peek-btn:active {
  transform: scale(0.94);
}
.summary-peek-btn svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
  flex-shrink: 0;
}

/* Dynamic Coach / Status Bar (Locked height per viewport so player cards NEVER jitter on message change) */
.coach-bar {
  padding: 3px 10px;
  height: var(--coach-h);
  min-height: var(--coach-h);
  max-height: var(--coach-h);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(19, 28, 42, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: clamp(10.5px, calc(var(--coach-h) * 0.28 + 0.5px), 12.5px);
  font-weight: 700;
  color: #ffffff;
  text-align: center;
  line-height: 1.2;
  width: 100%;
  max-width: max(332px, calc(4 * var(--slot-w) + 8px));
  margin: 0 auto;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  transition: background 0.2s ease, border-color 0.2s ease;
}
.coach-bar.highlight {
  color: #ffffff;
  border-color: rgba(245, 158, 11, 0.55);
  background: rgba(245, 158, 11, 0.2);
}
.coach-bar.alert {
  color: #ffffff;
  border-color: rgba(244, 63, 94, 0.65);
  background: rgba(244, 63, 94, 0.25);
}

/* ==========================================================================
   BOTTOM PLAYER HAND (3x4 GRID)
   ========================================================================== */
.player-section {
  background: linear-gradient(180deg, #141c2a 0%, #0d131d 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px 18px 0 0;
  padding: var(--player-pad-y) 10px var(--player-pad-b);
  display: flex;
  flex-direction: column;
  gap: var(--player-gap);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}

.player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  height: var(--player-hdr-h);
  min-height: var(--player-hdr-h);
  max-height: var(--player-hdr-h);
  gap: 6px;
  width: 100%;
  max-width: max(332px, calc(4 * var(--slot-w) + 8px));
  margin: 0 auto;
  flex-shrink: 0;
  overflow: hidden;
}
.player-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
  flex: 1 1 auto;
}
.player-tag-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 88px;
}
.turn-status-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--text-muted);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 118px;
  flex-shrink: 1;
}
.turn-status-badge.your-turn {
  background: rgba(245, 158, 11, 0.24);
  border-color: rgba(245, 158, 11, 0.65);
  color: var(--gold-light);
}
.turn-status-badge.waiting {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
}
.turn-status-badge.final-turn-badge {
  background: rgba(244, 63, 94, 0.28);
  border-color: var(--ruby);
  color: #ffe4e6;
  animation: alertPulseBadge 1.2s infinite alternate;
}
.turn-status-badge.closer-badge {
  background: rgba(245, 158, 11, 0.28);
  border-color: var(--gold);
  color: var(--gold-light);
}
@keyframes alertPulseBadge {
  0% { transform: scale(0.98); opacity: 0.88; }
  100% { transform: scale(1.02); opacity: 1; }
}

.round-pill.final-round-active {
  color: #fda4af;
  font-weight: 800;
}
.round-pill.near-target-total {
  color: #fbbf24;
  font-weight: 800;
}
.player-revealed-stat {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
}
.player-revealed-stat #playerRevealedScore {
  font-size: 15px;
  font-weight: 900;
  color: var(--gold-light);
}
.player-hidden-badge {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-left: 3px;
  transition: all 0.2s ease;
}
.player-hidden-badge.warning {
  color: #fbbf24;
  font-weight: 800;
}
.player-hidden-badge.danger {
  color: #f87171;
  font-weight: 900;
  text-shadow: 0 0 8px rgba(248, 113, 113, 0.45);
  animation: alertPulseBadge 1.2s infinite alternate;
}

/* Hide cluttered spreadsheet column boxes while preserving DOM hooks */
.column-header-row {
  display: none;
}

/* The 3x4 Grid - Classic Playing Card Proportions (5:7 = 1:1.4) with Dynamic Compaction */
.grid-container {
  display: grid;
  grid-template-columns: repeat(4, var(--slot-w));
  grid-template-rows: repeat(3, var(--slot-h));
  justify-content: center;
  align-content: center;
  gap: 0;
  width: 100%;
  max-width: calc(4 * var(--slot-w) + 4px);
  min-height: calc(3 * var(--slot-h));
  margin: 0 auto;
}
.grid-container .card-numeral {
  font-size: clamp(16px, calc(var(--slot-w) * 0.42), 36px);
}

.grid-card-slot {
  position: relative;
  width: 100%;
  height: 100%;
  padding: var(--slot-pad);
  perspective: 750px;
  will-change: transform;
}
.grid-card-slot.slot-collapsed {
  padding: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.grid-card-slot:has(.column-clearing),
.grid-card-slot:has(.just-flipped),
.grid-card-slot:has(.just-swapped),
.grid-card-slot:has(.triple-target),
.grid-card-slot:has(.negative-clear-warn) {
  z-index: 14;
}
.grid-card-slot:has(.triple-celebration-banner) {
  z-index: 25 !important;
}
.grid-card-slot .game-card {
  position: relative;
  width: 100%;
  height: 100%;
}

/* Consistent floating held-card tray across all viewport heights */
