/*
 * Styles for the deck of cards & upgraded score panel
 */

.score-panel.score-panel--game {
  width: min(92%, 680px);
  margin: 0 auto;
  padding: 12px 18px;
  gap: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.score-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.score-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: #5f6368;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.score-value {
  font-size: 1.125rem;
  font-weight: 700;
  color: #202124;
  font-variant-numeric: tabular-nums;
}

.score-value.moves {
  color: #4285f4;
}

.score-value.round-current,
.score-item:first-child .score-value {
  color: #34a853;
}

.score-value.timer-display {
  color: #ea4335;
  min-width: 78px;
  text-align: center;
}

.score-panel--game .restart {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.score-panel--game .restart:hover {
  background-color: rgba(66, 133, 244, 0.12);
  transform: rotate(-25deg);
}

.score-panel--game .restart:active {
  transform: scale(0.94);
}

/* Deck grid */
.deck {
  display: grid;
  gap: 14px;
  width: 92%;
  max-width: 480px;
  margin: auto;
  padding: 14px;
  border-radius: 14px;
  grid-template-columns: repeat(3, 1fr);
}

.deck[data-round="1"] {
  grid-template-columns: repeat(2, 1fr);
  max-width: 340px;
}

.deck[data-round="2"],
.deck[data-round="3"] {
  grid-template-columns: repeat(3, 1fr);
  max-width: 480px;
}

.deck[data-round="4"] {
  grid-template-columns: repeat(4, 1fr);
  max-width: 600px;
}

.deck[data-round="5"] {
  grid-template-columns: repeat(5, 1fr);
  max-width: 720px;
}

.deck .card {
  background-image: url("../img/AnhCu/card.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 46% auto;
  background-color: rgba(231, 231, 231, 0.96);
  border-radius: 10px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 1px 3px 8px -4px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.deck .card:hover:not(.open):not(.match) {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px -4px rgba(0, 0, 0, 0.35);
}

.deck .card.open.show {
  background: #ffffff;
  box-shadow: 0 0 12px 1px rgba(66, 133, 244, 0.45);
  transform: scale(1.02);
}

.deck .card.match {
  background: #d7f7e0;
  box-shadow: 0 0 10px 1px rgba(52, 168, 83, 0.55);
  cursor: default;
}

.card img {
  position: absolute;
  height: 78%;
  width: 78%;
  box-sizing: border-box;
  object-fit: contain;
  border-radius: 8px;
  pointer-events: none;
}

/* Mobile responsive adjustments */
@media screen and (max-width: 540px) {
  .score-panel.score-panel--game {
    width: 94%;
    padding: 8px 12px;
    gap: 6px;
  }

  .score-label {
    font-size: 0.68rem;
  }

  .score-value {
    font-size: 0.95rem;
  }

  .deck {
    gap: 8px;
    padding: 6px;
    margin: auto;
  }

  /* Round 4 (8 cards): 3-3-2 centered layout on mobile */
  .deck[data-round="4"] {
    grid-template-columns: repeat(6, 1fr);
    max-width: 380px;
  }

  .deck[data-round="4"] .card {
    grid-column: span 2;
  }

  .deck[data-round="4"] .card:nth-child(7) {
    grid-column: 2 / span 2;
  }

  /* Round 5 (10 cards): 4-4-2 centered layout on mobile */
  .deck[data-round="5"] {
    grid-template-columns: repeat(8, 1fr);
    max-width: 400px;
  }

  .deck[data-round="5"] .card {
    grid-column: span 2;
  }

  .deck[data-round="5"] .card:nth-child(9) {
    grid-column: 3 / span 2;
  }
}
