/* style.css - Main Layout & Table Styling for Fair Hearts */

:root {
  --table-green: #0b3a20;
  --table-green-light: #165c34;
  --table-felt-pattern: radial-gradient(ellipse at 50% 45%, #185e36 0%, #0d3b1f 65%, #062312 100%);
  --pill-wine-bg: linear-gradient(180deg, #7c1219 0%, #59090e 60%, #3d0509 100%);
  --pill-wine-active: linear-gradient(180deg, #991b24 0%, #750d15 60%, #52070c 100%);
  --pill-border-gold: #d4af37;
  --pill-border-active: #fbbf24;
  --gold: #f59e0b;
  --gold-glow: rgba(245, 158, 11, 0.55);
  --text-light: #f8fafc;
  --text-muted: #cbd5e1;
  --border-subtle: rgba(255, 255, 255, 0.12);
  --glass-bg: rgba(10, 20, 14, 0.88);
  --glass-border: rgba(212, 175, 55, 0.35);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #020617;
  color: var(--text-light);
  user-select: none;
}

/* App Fullscreen Container */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh; /* Mobile dynamic viewport */
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  max-width: 100vw;
  position: relative;
  overflow: hidden;
}

/* Top Navigation Bar */
header.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  height: 48px;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 100;
  flex-shrink: 0;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.brand-icon {
  font-size: 20px;
  color: #ef4444;
  filter: drop-shadow(0 0 6px rgba(239, 68, 68, 0.6));
}

.brand h1 {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.4px;
  white-space: nowrap;
}

.brand-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(74, 222, 128, 0.3);
  white-space: nowrap;
}

/* Vibe Coding Sticker Badge */
.vibe-coding-sticker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  padding: 1.5px;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transform: rotate(-3deg);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.2s ease;
  margin-left: 4px;
}

.vibe-coding-sticker:hover {
  transform: rotate(0deg) scale(1.1);
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.5);
}

.sticker-inner {
  background: #e11d48;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "Impact", "Arial Black", sans-serif;
  font-size: 10px;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.8px;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  line-height: 1;
}

.match-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.status-chip.hearts-locked { color: #94a3b8; }
.status-chip.hearts-broken {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.55);
  font-weight: 800;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-light);
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Responsive Text Toggling */
.btn-text-mobile {
  display: none;
}

/* Casino Green Felt Game Table */
main.game-table {
  flex: 1;
  min-height: 0;
  background: var(--table-felt-pattern);
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(120px, 1fr) auto;
  grid-template-columns: minmax(100px, 150px) 1fr minmax(100px, 150px);
  grid-template-areas:
    "top-left    north       top-right"
    "west        center      east"
    "bottom-left south       bottom-right";
  padding: 6px 14px 8px 14px;
  box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.72);
  overflow: visible;
  box-sizing: border-box;
}

/* Player Stations */
.player-station {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 10;
}

.station-north { grid-area: north; align-self: start; }
.station-west {
  grid-area: west;
  position: absolute;
  left: 0;
  top: 46%;
  transform: translateY(-50%);
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.station-east {
  grid-area: east;
  position: absolute;
  right: 0;
  top: 46%;
  transform: translateY(-50%);
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.station-south {
  grid-area: south;
  align-self: end;
  width: 100%;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Luxury Crimson & Gold Player Tags (matching reference screenshots) */
.player-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--pill-wine-bg);
  border: 1.5px solid var(--pill-border-gold);
  border-radius: 24px;
  padding: 4px 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.25);
  color: #ffffff;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
  user-select: none;
}

.player-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #1e293b;
  border: 1.5px solid var(--pill-border-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
}

.player-name {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.player-score-badge {
  font-size: 13px;
  font-weight: 800;
  color: #fbbf24; /* Clean gold points value */
  margin-left: 2px;
}

/* Vertical Side Tabs for West & East (matching reference game) */
.station-west .player-tag {
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 5px;
  border-radius: 0 14px 14px 0;
  border-left: none;
  box-shadow: 2px 4px 14px rgba(0, 0, 0, 0.5);
}

.station-west .player-name {
  writing-mode: vertical-lr;
  transform: rotate(180deg);
  font-size: 11px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.station-west .player-score-badge {
  margin-left: 0;
  margin-top: 2px;
  font-size: 11.5px;
}

.station-east .player-tag {
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 5px;
  border-radius: 14px 0 0 14px;
  border-right: none;
  box-shadow: -2px 4px 14px rgba(0, 0, 0, 0.5);
}

.station-east .player-name {
  writing-mode: vertical-lr;
  font-size: 11px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.station-east .player-score-badge {
  margin-left: 0;
  margin-top: 2px;
  font-size: 11.5px;
}

/* Active Turn State on Player Tag */
.player-tag.is-active-turn {
  background: var(--pill-wine-active) !important;
  border-color: var(--pill-border-active) !important;
  box-shadow: 0 0 18px var(--gold-glow), 0 4px 14px rgba(0, 0, 0, 0.6) !important;
  transform: scale(1.04);
}

/* Station Turn Arrows (matching reference screenshots) */
.station-turn-arrow {
  display: none;
  font-size: 16px;
  line-height: 1;
  color: #ef4444;
  filter: drop-shadow(0 0 5px rgba(239, 68, 68, 0.85));
  font-weight: 900;
  user-select: none;
  pointer-events: none;
}

.player-station.is-active-turn .station-turn-arrow {
  display: block;
}

.arrow-north {
  animation: bounceUp 0.8s infinite alternate ease-in-out;
  margin-top: 4px;
}

.arrow-south {
  animation: bounceDown 0.8s infinite alternate ease-in-out;
  margin-bottom: 4px;
}

.arrow-west {
  animation: bounceLeft 0.8s infinite alternate ease-in-out;
  margin-right: 4px;
}

.arrow-east {
  animation: bounceRight 0.8s infinite alternate ease-in-out;
  margin-left: 4px;
}

@keyframes bounceUp {
  0% { transform: translateY(0); opacity: 0.85; }
  100% { transform: translateY(-4px); opacity: 1; }
}

@keyframes bounceDown {
  0% { transform: translateY(0); opacity: 0.85; }
  100% { transform: translateY(4px); opacity: 1; }
}

@keyframes bounceLeft {
  0% { transform: translateX(0); opacity: 0.85; }
  100% { transform: translateX(-4px); opacity: 1; }
}

@keyframes bounceRight {
  0% { transform: translateX(0); opacity: 0.85; }
  100% { transform: translateX(4px); opacity: 1; }
}

/* In-round captured penalty badge next to player score */
.round-penalty-tag {
  color: #ef4444;
  font-size: 10px;
  font-weight: 800;
  margin-left: 3px;
  background: rgba(239, 68, 68, 0.25);
  border: 1px solid rgba(239, 68, 68, 0.45);
  padding: 1px 5px;
  border-radius: 6px;
  display: inline-block;
  vertical-align: middle;
}

/* Bot Real Hands (Face-down Card Backs) */
.bot-hand {
  display: flex !important;
  position: relative;
  z-index: 15;
  pointer-events: none;
  user-select: none;
}

.bot-card {
  width: clamp(24px, 2.4vw, 34px);
  height: clamp(34px, 3.5vw, 48px);
  border-radius: 4px;
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.bot-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 4px;
  display: block;
}

/* North Bot Hand - Horizontal Overlapping Fan Row below tag */
.bot-hand-north {
  flex-direction: row;
  justify-content: center;
  align-items: center;
  margin-top: 5px;
}

.bot-hand-north .bot-card {
  margin-left: clamp(-18px, -1.8vw, -12px);
}

.bot-hand-north .bot-card:first-child {
  margin-left: 0;
}

/* West Bot Hand - Vertical Overlapping Stack beside the left side tag */
.bot-hand-west {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin-top: 6px;
}

.bot-hand-west .bot-card {
  margin-top: clamp(-28px, -2.8vw, -18px);
}

.bot-hand-west .bot-card:first-child {
  margin-top: 0;
}

/* East Bot Hand - Vertical Overlapping Stack beside the right side tag */
.bot-hand-east {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin-top: 6px;
}

.bot-hand-east .bot-card {
  margin-top: clamp(-28px, -2.8vw, -18px);
}

.bot-hand-east .bot-card:first-child {
  margin-top: 0;
}

.bot-card-count {
  display: none !important;
}

/* Center Trick Arena (Clean Cards on Felt) */
.trick-arena {
  grid-area: center;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 0;
}

.trick-surface {
  width: clamp(280px, 32vw, 380px);
  height: clamp(200px, 26vh, 280px);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.trick-slot {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  width: clamp(64px, 5.8vw, 88px);
  height: clamp(92px, 8.4vw, 128px);
}

/* Cross formation on the felt table (matching reference screenshots) */
.slot-north {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

.slot-south {
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
}

.slot-west {
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
}

.slot-east {
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
}

.trick-slot .card {
  width: clamp(64px, 5.8vw, 88px) !important;
  height: clamp(92px, 8.4vw, 128px) !important;
  pointer-events: none;
  transform: none !important;
}

/* Table Message Overlay */
.table-message-toast {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--pill-wine-bg);
  border: 1px solid var(--pill-border-gold);
  color: var(--text-light);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 90;
  white-space: nowrap;
}

.table-message-toast.visible {
  opacity: 1;
}

/* Pass Control Panel: Floating in Table Center (matching reference screenshot) */
.pass-control-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--pill-wine-bg);
  border: 1.5px solid var(--pill-border-gold);
  border-radius: 22px;
  padding: 8px 18px;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.75);
  z-index: 120;
}

.pass-control-panel.visible {
  display: flex;
}

.pass-instruction {
  font-size: 12px;
  font-weight: 800;
  color: #fef08a;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pass-dir-icon {
  color: #ef4444;
  font-size: 14px;
}

.pass-buttons {
  display: flex;
  gap: 8px;
}

.btn-pass-confirm {
  background: #16a34a;
  color: #ffffff;
  border: 1px solid #4ade80;
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-pass-confirm:disabled {
  background: #475569;
  border-color: #64748b;
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-pass-auto {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

/* Human Hand Container */
.human-hand-container {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  width: 100%;
  max-width: 100vw;
  position: relative;
  overflow: visible;
  padding: 0;
  box-sizing: border-box;
}

.human-hand {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  position: relative;
  overflow: visible;
}

/* Fan Arc Hand Row */
.hand-row {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  width: 100%;
  overflow: visible;
}

.hand-row.row-fan {
  z-index: 20;
}

.hand-row .card {
  margin-left: clamp(-46px, -3.8vw, -28px);
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1),
              margin 0.2s ease,
              box-shadow 0.22s ease,
              filter 0.2s ease;
  transform-origin: 50% 120%;
}

.hand-row .card:first-child {
  margin-left: 0;
}

/* ========================================================
   MOBILE PHONE VIEWPORT (< 768px) - 100% UN-CROPPED & CLEAN
   ======================================================== */
@media (max-width: 768px) {
  html, body {
    position: fixed;
    width: 100vw;
    height: 100%;
    overflow: hidden;
  }

  #app {
    width: 100vw;
    max-width: 100vw;
    overflow: hidden;
  }

  /* Compact Top Bar on Mobile */
  header.top-bar {
    padding: 4px 8px;
    height: 42px;
    gap: 4px;
  }

  .brand {
    gap: 4px;
    min-width: 0;
    flex-shrink: 1;
  }

  .brand h1 {
    font-size: 13px;
    white-space: nowrap;
  }

  .brand-badge {
    display: none;
  }

  .vibe-coding-sticker {
    margin-left: 2px;
    padding: 1px;
    transform: rotate(-2deg) scale(0.85);
  }

  .sticker-inner {
    font-size: 9px;
    padding: 2px 4px;
  }

  .match-status-bar {
    gap: 4px;
    min-width: 0;
    flex-shrink: 1;
  }

  #badge-pass-dir {
    display: none;
  }

  .status-chip {
    font-size: 10px;
    padding: 2px 6px;
    white-space: nowrap;
  }

  .header-actions {
    gap: 3px;
    flex-shrink: 0;
  }

  .btn-icon {
    padding: 4px 6px;
    font-size: 12px;
  }

  .btn-icon .btn-label {
    display: none;
  }

  .btn-text-desktop {
    display: none;
  }

  .btn-text-mobile {
    display: inline;
  }

  /* Casino Game Table Mobile Portrait */
  main.game-table {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 4px 4px 2px 4px;
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
  }

  /* NORTH STATION: Pinned to top center */
  .station-north {
    position: relative;
    align-self: center;
    margin-top: 2px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  /* WEST STATION: Vertical label on left edge (matching reference game) */
  .station-west {
    position: absolute;
    left: 0;
    top: 42%;
    transform: translateY(-50%);
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .station-west .player-tag {
    writing-mode: vertical-lr;
    transform: rotate(180deg);
    border-radius: 0 12px 12px 0;
    padding: 12px 5px;
    gap: 6px;
    flex-direction: column;
    align-items: center;
  }

  .station-west .player-avatar {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }

  .station-west .player-name {
    font-size: 11px;
    max-width: none;
    white-space: nowrap;
  }

  .station-west .player-score-badge {
    font-size: 11px;
  }

  /* EAST STATION: Vertical label on right edge (matching reference game) */
  .station-east {
    position: absolute;
    right: 0;
    top: 42%;
    transform: translateY(-50%);
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .station-east .player-tag {
    writing-mode: vertical-lr;
    border-radius: 12px 0 0 12px;
    padding: 12px 5px;
    gap: 6px;
    flex-direction: column;
    align-items: center;
  }

  .station-east .player-avatar {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }

  .station-east .player-name {
    font-size: 11px;
    max-width: none;
    white-space: nowrap;
  }

  .station-east .player-score-badge {
    font-size: 11px;
  }

  .player-tag {
    padding: 3px 10px;
    gap: 6px;
    border-radius: 20px;
  }

  .player-avatar {
    width: 22px;
    height: 22px;
    font-size: 11px;
  }

  .player-name {
    font-size: 11px;
    max-width: 75px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .player-score-badge {
    font-size: 11px;
  }

  .bot-card-count {
    display: none; /* Keep mobile felt table clean and open */
  }

  /* Bot Hands visible and compact on mobile */
  .bot-hand {
    display: flex !important;
  }

  .bot-card {
    width: 20px;
    height: 28px;
  }

  .bot-hand-north .bot-card {
    margin-left: -12px;
  }

  .bot-hand-west .bot-card,
  .bot-hand-east .bot-card {
    margin-top: -18px;
  }

  /* CENTER TRICK ARENA */
  .trick-arena {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    position: relative;
    z-index: 15;
  }

  .trick-surface {
    width: 170px;
    height: 155px;
    border: none;
    background: transparent;
  }

  .trick-slot {
    width: 50px;
    height: 72px;
  }

  .trick-slot .card {
    width: 50px !important;
    height: 72px !important;
  }

  .slot-north { top: 0; }
  .slot-south { bottom: 0; }
  .slot-west  { left: 2px; }
  .slot-east  { right: 2px; }

  /* SOUTH STATION: Full width at the bottom */
  .station-south {
    width: 100%;
    max-width: 100vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: auto;
    position: relative;
    z-index: 40;
    padding-bottom: 2px;
    box-sizing: border-box;
  }

  .station-south .player-tag {
    margin-top: 3px;
    margin-bottom: 1px;
  }

  .pass-control-panel {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    bottom: auto;
    padding: 6px 14px;
    width: min(88vw, 290px);
    gap: 5px;
  }

  .pass-instruction {
    font-size: 11px;
  }

  .pass-buttons {
    gap: 6px;
    width: 100%;
  }

  .btn-pass-auto, .btn-pass-confirm {
    flex: 1;
    padding: 6px 8px;
    font-size: 11px;
    text-align: center;
  }

  /* Two-Tier Mobile Hand Container (Matching Reference Game) */
  .hand-two-tier {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    max-width: 100vw;
    height: clamp(120px, 25vh, 150px);
    margin-bottom: 3px;
  }

  .hand-two-tier .row-top {
    position: absolute;
    top: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    pointer-events: none;
  }

  .hand-two-tier .row-top .card {
    margin-left: clamp(-22px, -4.8vw, -12px);
    pointer-events: auto;
  }

  .hand-two-tier .row-top .card:first-child {
    margin-left: 0 !important;
  }

  .hand-two-tier .row-bottom {
    position: absolute;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    width: 100%;
    pointer-events: none;
  }

  .hand-two-tier .row-bottom .card {
    margin-left: clamp(-22px, -4.8vw, -12px);
    pointer-events: auto;
  }

  .hand-two-tier .row-bottom .card:first-child {
    margin-left: 0 !important;
  }

  .hand-row .card {
    margin-left: var(--hand-overlap, clamp(-30px, -6vw, -15px));
  }

  .hand-row .card:first-child {
    margin-left: 0 !important;
  }

  /* Scoreboard footer on mobile */
  footer.scoreboard-bar {
    height: 38px;
    padding: 2px 8px;
  }

  .score-player-name {
    font-size: 9.5px;
  }

  .score-player-points {
    font-size: 13px;
  }
}

/* Bottom Persistent Scoreboard */
footer.scoreboard-bar {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-subtle);
  height: 48px;
  padding: 4px 16px;
  z-index: 100;
  flex-shrink: 0;
}

.score-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.score-player-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.score-player-points {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-light);
}

.score-cell.is-leader .score-player-points {
  color: #4ade80; /* Lowest score is winning in Hearts */
}

/* Modals & Dialogs */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}

.modal-overlay.open {
  display: flex;
}

.modal-card {
  background: #0f172a;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  padding: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 10px;
}

.modal-title {
  font-size: 17px;
  font-weight: 800;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.modal-body {
  font-size: 13px;
  line-height: 1.6;
  color: #cbd5e1;
}

.round-score-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 13px;
}

.round-score-table th, .round-score-table td {
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}

.round-score-table th {
  color: var(--text-muted);
  font-weight: 700;
}

.round-score-table td.highlight {
  font-weight: 800;
  color: var(--gold);
}

.btn-primary-action {
  background: #2563eb;
  color: #ffffff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  width: 100%;
  transition: background 0.2s;
}

.btn-primary-action:hover {
  background: #1d4ed8;
}
