/* Shared game stage: table, deck, reveal card, message, game-flow status
   Load order matters: these stylesheets are ordered fragments of one cascade
   (see index.html). Mobile overrides live in responsive.css. */

.table {
  min-height: 17rem;
  border-radius: 8px;
  display: grid;
  grid-template-areas:
    "deck reveal message"
    "flow flow flow"
    "hand hand hand";
  grid-template-columns: minmax(5.5rem, 8rem) minmax(7rem, 10rem) minmax(0, 1fr);
  align-items: center;
  gap: clamp(0.7rem, 3vw, 1.5rem);
  padding: clamp(0.8rem, 3vw, 1.5rem);
  background:
    linear-gradient(45deg, transparent 0 47%, rgba(216, 180, 95, 0.12) 47% 49%, transparent 49% 100%),
    linear-gradient(135deg, transparent 0 47%, rgba(216, 180, 95, 0.1) 47% 49%, transparent 49% 100%),
    linear-gradient(#9a2424, var(--casino-red));
  background-size: 3.5rem 3.5rem, 3.5rem 3.5rem, auto;
  border: 1px solid rgba(216, 180, 95, 0.36);
}

.start-countdown {
  position: absolute;
  z-index: 12;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.3rem;
  min-height: 14rem;
  border-radius: inherit;
  background: rgba(7, 9, 24, 0.8);
  backdrop-filter: blur(4px);
  text-align: center;
  pointer-events: none;
}

.start-countdown strong {
  font-size: clamp(5rem, 24vw, 10rem);
  line-height: 0.9;
  color: #fff4a3;
  text-shadow:
    0 0 1.5rem rgba(255, 93, 145, 0.75),
    0.35rem 0.35rem 0 #8b5cf6;
  animation: start-countdown-pop 700ms cubic-bezier(0.18, 0.86, 0.3, 1.25) both;
}

.start-countdown span {
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@keyframes start-countdown-pop {
  from {
    opacity: 0;
    transform: scale(0.45);
  }
  55% {
    opacity: 1;
    transform: scale(1.12);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.deck {
  grid-area: deck;
  display: grid;
  gap: 0.55rem;
  justify-items: center;
}

.card {
  aspect-ratio: 2.5 / 3.5;
  width: 100%;
  max-width: 10rem;
  border-radius: 8px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(216, 180, 95, 0.34);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22);
  user-select: none;
}

.card-back {
  background:
    linear-gradient(45deg, rgba(216, 180, 95, 0.18) 25%, transparent 25% 50%, rgba(216, 180, 95, 0.18) 50% 75%, transparent 75%),
    #8b1e1e;
  background-size: 1rem 1rem;
  color: #fff7ed;
  font-size: 1.4rem;
  font-weight: 900;
}

.deck-status {
  min-height: 1.4rem;
  margin: 0;
  border-radius: 999px;
  padding: 0.32rem 0.65rem;
  background: rgba(25, 7, 7, 0.68);
  color: #ffe8a3;
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
}

.reveal-card {
  grid-area: reveal;
  background: var(--casino-cream);
  color: #171818;
  grid-template-rows: 1fr 1fr;
  transform-style: preserve-3d;
}

.reveal-card.red-card {
  color: #b82d33;
}

.rank {
  align-self: end;
  font-size: clamp(2rem, 9vw, 4rem);
  font-weight: 900;
}

.suit {
  align-self: start;
  font-size: clamp(2rem, 9vw, 4rem);
  line-height: 0.9;
}

.message {
  grid-area: message;
  min-width: 0;
  width: 100%;
}

.message p {
  color: var(--casino-muted);
}

.game-flow-status {
  grid-area: flow;
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.8rem;
  border: 1px solid rgba(108, 229, 255, 0.28);
  border-radius: 16px;
  padding: 0.75rem 0.85rem;
  background:
    linear-gradient(135deg, rgba(108, 229, 255, 0.09), rgba(139, 92, 246, 0.08)),
    rgba(9, 11, 27, 0.76);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.game-flow-status[data-tone="active"] {
  border-color: rgba(255, 79, 139, 0.55);
  background:
    linear-gradient(135deg, rgba(255, 79, 139, 0.16), rgba(139, 92, 246, 0.11)),
    rgba(9, 11, 27, 0.82);
  box-shadow:
    0 0 24px rgba(255, 79, 139, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.game-flow-icon {
  width: 2.6rem;
  height: 2.6rem;
  display: grid;
  place-items: center;
  border: 1px solid rgba(108, 229, 255, 0.3);
  border-radius: 12px;
  background: rgba(108, 229, 255, 0.1);
  color: var(--party-cyan);
  font-size: 1.25rem;
  font-weight: 900;
}

.game-flow-status[data-tone="active"] .game-flow-icon {
  border-color: rgba(255, 79, 139, 0.42);
  background: rgba(255, 79, 139, 0.13);
  color: #ff91b5;
  animation: game-flow-pulse 1.4s ease-in-out infinite alternate;
}

.game-flow-status > div {
  min-width: 0;
  display: grid;
  gap: 0.12rem;
}

.game-flow-status p {
  margin: 0;
}

.game-flow-status strong {
  overflow-wrap: anywhere;
  font-size: clamp(0.98rem, 2.5vw, 1.15rem);
}

#gameFlowDetail {
  color: var(--casino-muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.game-flow-badge {
  border-radius: 999px;
  padding: 0.35rem 0.58rem;
  background: rgba(108, 229, 255, 0.12);
  color: var(--party-cyan);
  font-size: 0.72rem;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
}

.game-flow-status[data-tone="active"] .game-flow-badge {
  background: rgba(255, 79, 139, 0.16);
  color: #ffb0ca;
}

#gameMessage,
#lastResult {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

#lastResult {
  min-height: 1.5rem;
  margin-bottom: 0;
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
}

#lastResult:empty {
  padding: 0;
}

.result-correct {
  background: rgba(55, 166, 98, 0.18);
  color: #baf3cd !important;
}

.result-wrong {
  background: rgba(200, 72, 79, 0.2);
  color: #ffd1d5 !important;
}

.result-neutral {
  background: rgba(216, 180, 95, 0.18);
  color: #ffe4a3 !important;
}

.own-hand {
  grid-area: hand;
  width: 100%;
  min-width: 0;
  border-top: 1px solid rgba(216, 180, 95, 0.26);
  padding-top: 0.8rem;
}
