/* ============================================
   Hearts — Game-Specific Styles
   (Layout, header, nav, footer, overlays, bob,
    tooltip, how-to-play come from /shared/common.css)
   ============================================ */

/* ---------- Scoreboard ---------- */
#scoreboard {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.score-cell {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 16px;
  text-align: center;
  min-width: 72px;
}

.score-name {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.score-value {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-heading);
}

/* ---------- Table / Play Area ---------- */
#table {
  position: relative;
  width: 100%;
  max-width: 720px;
  height: 520px;
  margin: 0 auto;
  background: radial-gradient(ellipse at center, #1a5c2a 0%, #0e3a1a 60%, #0a2c12 100%);
  border-radius: var(--radius-lg);
  border: 3px solid #0d2f14;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.4), 0 4px 24px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

/* ---------- AI Hands ---------- */
.ai-hand {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.ai-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 700;
}

.ai-cards {
  display: flex;
}

.hand-north {
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
}

.hand-north .ai-cards {
  flex-direction: row;
}

.hand-west {
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
}

.hand-west .ai-cards {
  flex-direction: column;
}

.hand-east {
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
}

.hand-east .ai-cards {
  flex-direction: column;
}

/* Card back for AI */
.card-back {
  width: 32px;
  height: 46px;
  background: linear-gradient(135deg, #1a3a8a 0%, #2851a3 50%, #1a3a8a 100%);
  border: 2px solid #4a7acc;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}

.card-back::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  right: 3px;
  bottom: 3px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 2px;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 3px,
    rgba(255, 255, 255, 0.04) 3px,
    rgba(255, 255, 255, 0.04) 6px
  );
}

.hand-north .card-back {
  margin-left: -16px;
}

.hand-north .card-back:first-child {
  margin-left: 0;
}

.hand-west .card-back,
.hand-east .card-back {
  margin-top: -30px;
}

.hand-west .card-back:first-child,
.hand-east .card-back:first-child {
  margin-top: 0;
}

/* ---------- Trick Area (Center) ---------- */
#trick-area {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 220px;
  height: 200px;
}

.trick-slot {
  position: absolute;
  width: 60px;
  height: 84px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.3s ease;
}

#trick-north {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

#trick-south {
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
}

#trick-west {
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}

#trick-east {
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

/* ---------- Playing Card ---------- */
.playing-card {
  width: 60px;
  height: 84px;
  background: #fff;
  border-radius: 6px;
  border: 1px solid #ccc;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3px 5px;
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  cursor: default;
  user-select: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease, margin-top 0.15s ease;
}

.playing-card .card-top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1;
}

.playing-card .card-rank {
  font-size: 16px;
}

.playing-card .card-suit-small {
  font-size: 12px;
  margin-top: -2px;
}

.playing-card .card-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 28px;
  line-height: 1;
}

.playing-card .card-bottom {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1;
  transform: rotate(180deg);
}

.playing-card.red {
  color: #d32f2f;
}

.playing-card.black {
  color: #1a1a1a;
}

/* ---------- Player Hand (South) ---------- */
#hand-south {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  height: 100px;
}

#hand-south .playing-card {
  margin-left: -20px;
  cursor: pointer;
  transition: transform 0.15s ease, margin-top 0.15s ease, box-shadow 0.15s ease;
}

#hand-south .playing-card:first-child {
  margin-left: 0;
}

#hand-south .playing-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  z-index: 10;
}

#hand-south .playing-card.selected {
  transform: translateY(-16px);
  box-shadow: 0 0 12px rgba(77, 166, 255, 0.6);
  border-color: var(--accent);
}

#hand-south .playing-card.playable {
  cursor: pointer;
}

#hand-south .playing-card.dimmed {
  opacity: 0.45;
  cursor: not-allowed;
}

#hand-south .playing-card.dimmed:hover {
  transform: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

/* ---------- Trick Card Animation ---------- */
.trick-card-enter {
  animation: trickSlideIn 0.3s ease forwards;
}

@keyframes trickSlideIn {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.trick-collect {
  animation: trickCollect 0.5s ease forwards;
}

@keyframes trickCollect {
  to {
    opacity: 0;
    transform: scale(0.3);
  }
}

/* ---------- Pass Phase Indicator ---------- */
#btn-pass-cards:not(:disabled) {
  background-color: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.pass-direction-label {
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

/* ---------- Round Results ---------- */
#round-results,
#game-over-results {
  text-align: left;
  margin: 12px 0;
}

.result-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 15px;
}

.result-row:last-child {
  border-bottom: none;
}

.result-row .result-name {
  color: var(--text-primary);
}

.result-row .result-points {
  color: var(--text-heading);
  font-weight: 700;
}

.result-row .result-total {
  color: var(--text-secondary);
  font-size: 13px;
  margin-left: 8px;
}

.result-row.winner .result-name {
  color: #4caf50;
}

.result-row.loser .result-name {
  color: #ef5350;
}

.shoot-moon-notice {
  text-align: center;
  color: #ffd740;
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 15px;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  #table {
    height: 460px;
    max-width: 100%;
  }

  .playing-card {
    width: 50px;
    height: 70px;
    border-radius: 5px;
    padding: 2px 4px;
  }

  .playing-card .card-rank {
    font-size: 13px;
  }

  .playing-card .card-suit-small {
    font-size: 10px;
  }

  .playing-card .card-center {
    font-size: 22px;
  }

  #hand-south .playing-card {
    margin-left: -18px;
  }

  .trick-slot {
    width: 50px;
    height: 70px;
  }

  #trick-area {
    width: 180px;
    height: 170px;
  }

  .card-back {
    width: 26px;
    height: 38px;
  }

  .hand-north .card-back {
    margin-left: -14px;
  }

  .hand-west .card-back,
  .hand-east .card-back {
    margin-top: -24px;
  }

  #scoreboard {
    gap: 8px;
  }

  .score-cell {
    padding: 4px 10px;
    min-width: 60px;
  }

  .score-value {
    font-size: 18px;
  }
}

@media (max-width: 480px) {
  #table {
    height: 400px;
  }

  .playing-card {
    width: 42px;
    height: 60px;
    border-radius: 4px;
    padding: 2px 3px;
  }

  .playing-card .card-rank {
    font-size: 11px;
  }

  .playing-card .card-suit-small {
    font-size: 9px;
  }

  .playing-card .card-center {
    font-size: 18px;
  }

  #hand-south .playing-card {
    margin-left: -16px;
  }

  .trick-slot {
    width: 42px;
    height: 60px;
  }

  #trick-area {
    width: 150px;
    height: 145px;
  }

  .card-back {
    width: 22px;
    height: 32px;
  }

  .hand-north .card-back {
    margin-left: -12px;
  }

  .hand-west .card-back,
  .hand-east .card-back {
    margin-top: -20px;
  }

  .ai-label {
    font-size: 10px;
  }

  #hand-south {
    bottom: 4px;
    height: 76px;
  }
}
