*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --green: #061a10;
  --green-dark: #083320;
  --green-light: #0d4a2e;
  --navy: #1a1a2e;
  --navy-light: #2a2a3e;
  --warm-white: #faf8f5;
  --cream: #f5f0e6;
  --gold: #d4a853;
  --gold-light: #e4c073;
  --gold-dark: #b8923a;
  --red: #c41e3a;
  --text: #f5f0e6;
  --text-light: rgba(245,240,230,0.65);
  --border: #3a3a4a;
  --card-bg: #1a1a2e;
  --card-shadow: 0 2px 8px rgba(0,0,0,0.4);
  --card-shadow-hover: 0 6px 20px rgba(0,0,0,0.5);
  --radius: 8px;
  --radius-lg: 12px;
  --font: 'Source Sans 3', system-ui, sans-serif;
  --font-display: 'Cinzel', Georgia, serif;
  --header-h: 56px;
  --transition: 200ms ease;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font);
  background: var(--green);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--gold-light); }

img { max-width: 100%; display: block; }

/* ── Header ── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--navy);
  color: var(--warm-white);
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gold);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.3px;
}
.header-logo:hover { color: var(--gold-light); }

.header-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}
.header-nav a {
  color: var(--warm-white);
  font-size: 0.875rem;
  padding: 6px 10px;
  border-radius: var(--radius);
  transition: background var(--transition);
}
.header-nav a:hover {
  background: rgba(255,255,255,0.1);
  color: var(--gold-light);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--warm-white);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
}

.theme-toggle {
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--warm-white);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}
.theme-toggle:hover { background: rgba(255,255,255,0.15); }

/* ── Main ── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
  width: 100%;
}

/* ── Game Hub ── */
.hub-hero {
  text-align: center;
  padding: 40px 16px 24px;
}
.hub-hero h1 {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  color: var(--gold);
  margin-bottom: 8px;
  font-family: var(--font-display);
}
.hub-hero p {
  color: var(--cream);
  font-size: 1rem;
  max-width: 500px;
  margin: 0 auto;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
  padding: 16px 0 32px;
}

.game-card {
  position: relative;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 0 12px 16px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--card-shadow);
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}
.game-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
}
.game-card:active { transform: translateY(-1px); }

.game-card .game-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--cream);
}
.game-card .game-count {
  font-size: 0.75rem;
  color: var(--text-light);
}

.game-card .status-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.625rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.status-live {
  background: #22c55e;
  color: #fff;
}
.status-soon {
  background: #3a3a4a;
  color: var(--cream);
}


/* ── Game Area ── */
.game-area {
  background: #040;
  border: 2px solid #0a0;
  border-radius: 12px;
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
  width: 100%;
  max-width: 700px;
  height: 80vh;
  min-height: 460px;
  margin: 0 auto;
  padding: 10px 4px;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
  gap: 4px;
  padding: 0 6px;
}

.game-title {
  color: var(--warm-white);
  font-size: 1.1rem;
  font-weight: 600;
}

.game-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }

.btn-gold {
  background: var(--gold);
  color: #1a1a1a;
}
.btn-gold:hover { background: var(--gold-light); }

.btn-outline {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: var(--warm-white);
}
.btn-outline:hover { background: rgba(255,255,255,0.1); }

.btn-sm {
  padding: 5px 10px;
  font-size: 0.75rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

/* ── Cards ── */
.card {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: clamp(54px, 10vw, 90px);
  height: clamp(76px, 14vw, 126px);
  background: linear-gradient(145deg, #ffffff, #f5f0ea);
  border: 1px solid #c8bca8;
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  font-weight: 600;
  font-size: clamp(0.7rem, 1.5vw, 1rem);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
  line-height: 1;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
}

.card .card-rank {
  position: absolute;
  top: 3px;
  left: 5px;
  font-size: clamp(0.55rem, 1.2vw, 0.85rem);
  text-align: center;
  line-height: 1.2;
}
.card .card-rank-br {
  position: absolute;
  bottom: 3px;
  right: 5px;
  font-size: clamp(0.55rem, 1.2vw, 0.85rem);
  text-align: center;
  line-height: 1.2;
  transform: rotate(180deg);
}
.card .card-center {
  font-size: clamp(1.4rem, 4vw, 2.6rem);
}
.card .card-center.court {
  font-size: clamp(1.6rem, 4.2vw, 2.8rem);
}

.card.red { color: var(--red); }
.card.black { color: #2d2d2d; }

.card.selected {
  box-shadow: 0 0 0 3px var(--gold), var(--card-shadow);
  transform: translateY(-6px);
}

.card.disabled {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

.card-back {
  background: linear-gradient(135deg, #1e3a5f, #2a5298);
  border: 2px solid var(--gold-dark);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}
.card-back::before {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(255,215,0,0.15);
  border-radius: 5px;
}
.card-back::after {
  content: '♠';
  font-size: 1.4rem;
  color: rgba(255,255,255,0.12);
}

.card-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(54px, 10vw, 90px);
  height: clamp(76px, 14vw, 126px);
  border: 2px dashed rgba(255,255,255,0.2);
  border-radius: 6px;
}

/* ── Hearts Table Layout ── */
.table {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.table-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.player-area {
  text-align: center;
}

.player-label {
  color: rgba(255,255,255,0.7);
  font-size: 0.75rem;
  margin-bottom: 4px;
  font-weight: 500;
}

.player-hand {
  display: flex;
  gap: 4px;
  justify-content: center;
  flex-wrap: nowrap;
}

.player-score {
  color: var(--gold);
  font-size: 0.75rem;
  margin-top: 4px;
}

.trick-area {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 16px 0;
  min-height: 130px;
  align-items: center;
}

.trick-card {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.trick-card .mini-label {
  color: rgba(255,255,255,0.5);
  font-size: 0.625rem;
}

.pass-area {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 12px;
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius);
  margin: 8px 0;
}

.pass-area .btn {
  min-width: 80px;
}

/* ── Solitaire ── */
.solitaire-board {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0;
}

.solitaire-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.stock-area {
  display: flex;
  gap: 4px;
}

.foundations {
  display: flex;
  gap: 4px;
}

.columns-area {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.column {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 140px;
}

.column .card {
  margin-bottom: -50px;
}
.column .card:last-child { margin-bottom: 0; }
.column .card.face-down { margin-bottom: -60px; }

.empty-col {
  width: clamp(48px, 8vw, 80px);
  height: clamp(70px, 11vw, 112px);
  border: 2px dashed rgba(255,255,255,0.2);
  border-radius: 6px;
}

/* ── Spider ── */
.spider-board {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.spider-stock {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}

.spider-columns {
  display: flex;
  gap: 3px;
  justify-content: center;
}

.spider-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 140px;
}

.spider-column .card {
  margin-bottom: -50px;
}
.spider-column .card.face-down { margin-bottom: -60px; }

/* ── Stats / Scoreboard ── */
.scoreboard {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 12px 0;
}

.score-item {
  background: rgba(0,0,0,0.2);
  padding: 6px 14px;
  border-radius: var(--radius);
  color: var(--warm-white);
  font-size: 0.8125rem;
}

.score-item .label { opacity: 0.7; }
.score-item .value {
  font-weight: 700;
  color: var(--gold);
  margin-left: 4px;
}

/* ── Content Sections ── */
.content-section {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin: 16px 0;
}

.content-section h2 {
  font-size: 1.25rem;
  color: var(--gold);
  margin-bottom: 12px;
  font-family: var(--font-display);
}

.content-section h3 {
  font-size: 1rem;
  color: var(--gold-dark);
  margin: 16px 0 8px;
  font-family: var(--font-display);
}

.content-section p {
  color: var(--cream);
  font-size: 0.9375rem;
  line-height: 1.65;
  margin-bottom: 12px;
}

.content-section ul {
  list-style: none;
  padding: 0;
}
.content-section ul li {
  padding: 4px 0 4px 20px;
  position: relative;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--cream);
}
.content-section ul li::before {
  content: '♠';
  position: absolute;
  left: 0;
  color: var(--gold);
  font-size: 0.7rem;
}

/* ── Ad Placeholder ── */
.ad-placeholder {
  width: 100%;
  min-height: 60px;
  background: var(--cream);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 0.75rem;
  margin: 16px 0;
  border: 1px dashed var(--border);
}

/* ── Footer ── */
.footer {
  background: var(--navy);
  color: var(--cream);
  padding: 24px 16px;
  margin-top: 32px;
  font-size: 0.8125rem;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
}

.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-links a {
  color: var(--cream);
}
.footer-links a:hover { color: var(--gold-light); }
a.credit-link { color: var(--gold); }
a.credit-link:hover { color: var(--gold-dim); }

/* ── Modal / Toast ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active { display: flex; }

.modal {
  background: var(--warm-white);
  border-radius: var(--radius-lg);
  padding: 32px 24px 24px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.modal h2 { margin-bottom: 8px; color: var(--navy); }
.modal p { color: var(--text-light); margin-bottom: 20px; font-size: 0.9rem; }
.modal .btn { margin: 4px; }

/* ── Responsive ── */
/* ── Select / Dropdown ── */
select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23faf8f5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 26px !important;
  background-color: var(--navy) !important;
  color: var(--warm-white) !important;
  border: 1px solid rgba(255,255,255,0.3) !important;
  border-radius: var(--radius) !important;
  font-family: var(--font) !important;
  font-size: 0.75rem !important;
  padding: 5px 26px 5px 10px !important;
  cursor: pointer;
}
select option {
  background: var(--navy);
  color: var(--warm-white);
}

@media (max-width: 768px) {
  .header { padding: 0 12px; }
  .header-logo img { height: 26px !important; }

  .header-nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--navy);
    flex-direction: column;
    padding: 12px;
    gap: 4px;
    display: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  }
  .header-nav.open { display: flex; }
  .nav-toggle { display: block; }

  .game-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  .game-card { padding: 0 8px 12px; }

  .game-header { flex-direction: column; align-items: flex-start; gap: 4px; }
  .game-title { font-size: 1rem; }
  .game-controls { gap: 4px; }

  #game-board {
    --card-overlap: -38px;
    --card-overlap-side: -32px;
    --card-overlap-top: -25px;
    --card-w: 55px;
    --card-h: 75px;
  }
  #yourHand .card-svg { width: 55px; height: 75px; }
  #topHand .card-svg { width: 40px; height: 54px; }
  #leftHand .card-svg,
  #rightHand .card-svg { width: 54px; height: 40px; }
  .trick-slot .card-svg[data-pos="left"],
  .trick-slot .card-svg[data-pos="right"] { width: 54px; height: 40px; }
  .player-face { width: 26px; height: 26px; font-size: 0.7rem; }
  .player-name { font-size: 0.7rem; }

  .score-panel { gap: 4px; }
  .score-panel .sp-item { padding: 4px; }
  .score-panel .sp-item .sp-name { font-size: 0.6rem; }
  .score-panel .sp-item .sp-score { font-size: 0.8125rem; }

  .content-section { padding: 14px; }
  .content-section h2 { font-size: 1rem; }

  .solitaire-top { flex-direction: column; gap: 6px; align-items: center; }
  .columns-area { gap: 1px; overflow-x: auto; }
  .column .card {
    width: clamp(44px, 10vw, 58px);
    height: clamp(62px, 14vw, 82px);
    font-size: clamp(0.45rem, 1.2vw, 0.65rem);
    margin-bottom: -38px;
  }
  .column .card.face-down { margin-bottom: -44px; }
  .column .card .card-rank { font-size: clamp(0.35rem, 0.9vw, 0.5rem); top: 2px; left: 3px; }
  .column .card .card-center { font-size: clamp(0.6rem, 1.6vw, 1rem); }
  .column .empty-slot {
    width: clamp(44px, 10vw, 58px);
    height: clamp(62px, 14vw, 82px);
  }

  .foundation-piles .foundation {
    width: clamp(44px, 10vw, 58px);
    height: clamp(62px, 14vw, 82px);
  }
  .stock-pile .card { width: clamp(44px, 10vw, 58px) !important; height: clamp(62px, 14vw, 82px) !important; }
  .waste-pile .card { width: clamp(44px, 10vw, 58px) !important; height: clamp(62px, 14vw, 82px) !important; }
  .waste-pile .card { margin-left: -28px; }
  .waste-pile .card:first-child { margin-left: 0; }

  .spider-columns { gap: 1px; overflow-x: auto; }
  .spider-column .card {
    width: clamp(34px, 8vw, 46px);
    height: clamp(48px, 11vw, 66px);
    font-size: clamp(0.4rem, 1vw, 0.6rem);
    margin-bottom: -34px;
  }
  .spider-column .card.face-down { margin-bottom: -40px; }
  .spider-column .card .card-rank { font-size: clamp(0.3rem, 0.8vw, 0.45rem); top: 2px; left: 2px; }
  .spider-column .card .card-center { font-size: clamp(0.5rem, 1.3vw, 0.8rem); }
  .spider-column .empty-slot {
    width: clamp(34px, 8vw, 46px);
    height: clamp(48px, 11vw, 66px);
  }

  .completions-area .comp-slot { width: 24px; height: 32px; font-size: 0.5rem; }

  .btn { font-size: 0.7rem; padding: 5px 10px; }
  .btn-sm { padding: 4px 8px; font-size: 0.65rem; }

  .footer-inner { flex-direction: column; text-align: center; gap: 12px; }
}

@media (max-width: 480px) {
  :root { --header-h: 48px; }
  .game-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .game-card { padding: 0 6px 10px; }
  .game-card .game-name { font-size: 0.75rem; }
  .hub-hero { padding: 16px 8px 12px; }
  .hub-hero h1 { font-size: 1.1rem; }
  .hub-hero p { font-size: 0.8rem; }

  .game-area {
    height: 80vh;
    min-height: 80vh;
  }
  #game-board {
    --card-overlap: -35px;
    --card-overlap-side: -26px;
    --card-overlap-top: -20px;
    --card-w: 42px;
    --card-h: 58px;
  }
  #yourHand .card-svg { width: 42px; height: 58px; }
  #topHand .card-svg { width: 30px; height: 42px; }
  #leftHand .card-svg,
  #rightHand .card-svg { width: 42px; height: 30px; }
  .trick-slot .card-svg[data-pos="left"],
  .trick-slot .card-svg[data-pos="right"] { width: 42px; height: 30px; }
  .player-face { width: 20px; height: 20px; font-size: 0.55rem; }
  .player-name { font-size: 0.6rem; }
  #trick-area { min-height: 80px; }

  .column .card {
    width: clamp(38px, 10vw, 50px);
    height: clamp(54px, 14vw, 72px);
    margin-bottom: -32px;
  }
  .column .card.face-down { margin-bottom: -38px; }

  .spider-column .card {
    width: clamp(30px, 8vw, 42px);
    height: clamp(42px, 11vw, 58px);
    margin-bottom: -28px;
  }
  .spider-column .card.face-down { margin-bottom: -34px; }

  .share-bar { gap: 4px !important; }
  .share-bar .btn { padding: 4px 6px; }
  .share-bar .btn svg { width: 14px; height: 14px; }
}

@media (min-width: 700px) {
  .game-area {
    height: calc(100vh - var(--header-h) - 60px);
    max-height: 700px;
    min-height: 580px;
    margin: 30px auto;
    padding: 30px 0 60px;
  }
}

/* ── Inline Vote Buttons ── */
.vote-btn { cursor: pointer; background: none; border: none; font-size: 1.2rem; padding: 2px 6px; border-radius: 4px; transition: transform var(--transition), background var(--transition); line-height: 1; }
.vote-btn:hover { transform: scale(1.2); background: rgba(255,255,255,0.1); }
.vote-btn.voted { transform: scale(1.1); }
.vote-btn.like.voted { color: #22c55e; }

.vote-feedback { font-size: 0.65rem; color: var(--text-light); min-width: 80px; text-align: center; }
.vote-count { font-size: 0.65rem; color: var(--text-light); min-width: 20px; text-align: left; }

/* ── Light Mode (toggled via ☀ button) ── */
body.dark {
  --green: #1a6b3c;
  --green-dark: #14552e;
  --green-light: #21804a;
  --navy: #1a1a2e;
  --navy-light: #2a2a3e;
  --warm-white: #faf8f5;
  --cream: #f0ebe3;
  --text: #2d2d2d;
  --text-light: #8c8c8c;
  --border: #d4c8b8;
  --card-shadow: 0 2px 8px rgba(0,0,0,0.15);
  --card-shadow-hover: 0 6px 20px rgba(0,0,0,0.25);
}

body.dark .card {
  background: linear-gradient(145deg, #ffffff, #f5f0ea);
  border-color: #c8bca8;
  color: #2d2d2d;
}
body.dark .card.black { color: #2d2d2d; }
body.dark .card-back {
  background: linear-gradient(135deg, #1e3a5f, #2a5298);
}
body.dark .game-card {
  background: var(--warm-white);
}
body.dark .status-soon {
  background: #d4c8b8;
  color: #666;
}
body.dark .content-section {
  background: var(--warm-white);
}
body.dark .content-section h2 {
  color: var(--navy);
  font-family: var(--font);
}
body.dark .content-section h3 {
  color: var(--text);
  font-family: var(--font);
}
body.dark .hub-hero h1 {
  font-family: var(--font);
}

/* ── Animations ── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 300ms ease forwards;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.pulse { animation: pulse 1.5s ease-in-out infinite; }

/* ── Utility ── */
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.w-full { width: 100%; }

/* ── Hearts Game Board (4-Player Absolute) ── */
#game-board {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 700px;
  margin: 0 auto;
  overflow: hidden;
  --card-w: 69px;
  --card-h: 94px;
  --card-overlap: -55px;
  --card-overlap-side: -48px;
  --card-overlap-top: -38px;
}
#top-player {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 80px;
}
#left-player {
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 2px;
  min-height: 120px;
}
#trick-area {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 160px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#right-player {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  gap: 2px;
  min-height: 120px;
}
#bottom-player {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  max-width: 92%;
}
#bottom-player .player-info {
  flex-direction: row;
  gap: 4px;
  padding: 1px 0;
}
#bottom-player .player-face {
  width: 24px;
  height: 24px;
  font-size: 0.65rem;
}
#bottom-player .player-name {
  font-size: 0.7rem;
}

/* Player info */
.player-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.player-face {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  color: #fff;
  flex-shrink: 0;
}
.player-name {
  color: rgba(255,255,255,0.85);
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}
.trick-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  background: var(--navy);
  color: var(--gold);
  font-size: 0.5rem;
  font-weight: 700;
  min-width: 14px;
  height: 14px;
  line-height: 14px;
  border-radius: 7px;
  text-align: center;
  padding: 0 3px;
  border: 1px solid var(--gold);
  box-sizing: border-box;
}

/* Card SVG wrapper */
.card-svg {
  display: inline-flex;
  width: var(--card-w, 69px);
  height: var(--card-h, 94px);
  flex-shrink: 0;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  overflow: hidden;
  touch-action: manipulation;
}
.card-svg > img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 8px;
}
.card-svg:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.card-svg.selected {
  transform: translateY(-8px);
  box-shadow: 0 0 0 2px var(--gold), 0 4px 12px rgba(0,0,0,0.25);
}
.card-svg.disabled {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

/* Player hands */
#yourHand {
  display: inline-flex;
  justify-content: center;
  padding: 2px 0;
}
#yourHand .card-svg {
  width: 72px;
  height: 98px;
}
#yourHand .card-svg + .card-svg {
  margin-left: var(--card-overlap);
}

#topHand {
  display: inline-flex;
  justify-content: center;
}
#topHand .card-svg {
  width: 52px;
  height: 70px;
  transform: rotate(180deg);
}
#topHand .card-svg + .card-svg {
  margin-left: var(--card-overlap-top);
}

#leftHand, #rightHand {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}
#leftHand .card-svg,
#rightHand .card-svg {
  width: 70px;
  height: 52px;
}
#leftHand .card-svg {
  transform: rotate(90deg);
}
#rightHand .card-svg {
  transform: rotate(-90deg);
}
#leftHand .card-svg + .card-svg,
#rightHand .card-svg + .card-svg {
  margin-top: var(--card-overlap-side);
}

/* Trick area */
.trick-slot {
  position: absolute;
  width: var(--card-w, 69px);
  height: var(--card-h, 94px);
}
.trick-slot[data-pos="bottom"] { left: 50%; bottom: 8px; transform: translateX(-50%); }
.trick-slot[data-pos="top"] { left: 50%; top: 8px; transform: translateX(-50%); }
.trick-slot[data-pos="left"] { left: 8px; top: 50%; transform: translateY(-50%); }
.trick-slot[data-pos="right"] { right: 8px; top: 50%; transform: translateY(-50%); }
.trick-slot .trick-name {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.5);
  font-size: 0.6rem;
  font-weight: 500;
  white-space: nowrap;
  text-align: center;
}
.trick-slot .card-svg[data-pos="top"] {
  transform: rotate(180deg);
}
.trick-slot .card-svg[data-pos="left"] {
  width: 70px;
  height: 52px;
  transform: rotate(90deg);
}
.trick-slot .card-svg[data-pos="right"] {
  width: 70px;
  height: 52px;
  transform: rotate(-90deg);
}
.trick-slot[data-pos="bottom"] .trick-name { top: calc(100% + 2px); }
.trick-slot[data-pos="top"] .trick-name { bottom: calc(100% + 2px); }
.trick-slot[data-pos="left"] .trick-name { top: calc(100% + 2px); left: 50px; }
.trick-slot[data-pos="right"] .trick-name { top: calc(100% + 2px); left: 10px; }
