/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --card-w: clamp(56px, 13vw, 90px);
  --card-h: clamp(84px, 19.5vw, 135px);
  --card-radius: clamp(5px, 1vw, 8px);
  --card-small-w: clamp(38px, 9vw, 60px);
  --card-small-h: clamp(57px, 13.5vw, 90px);
  --card-font: clamp(0.5rem, 1.8vw, 0.85rem);
  --font-base: clamp(0.78rem, 2.5vw, 1rem);
  --font-small: clamp(0.65rem, 1.8vw, 0.85rem);
  --table-bg: radial-gradient(ellipse at center, #162230, #0d1820 60%, #0a0e12);
  --felt: #162230;
  --accent: #5dd6e8;
  --accent-dim: rgba(93, 214, 232, 0.25);
  --red: #d32f2f;
  --black: #1a1a1a;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
  font-family: var(--font);
  font-size: var(--font-base);
  background: #0a0a0a;
  color: #e0e0e0;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== HEADER ===== */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: linear-gradient(180deg, #12181f, #0a0e12);
  border-bottom: 2px solid var(--accent);
}

header h1 {
  font-size: 1.6rem;
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.controls label {
  font-size: 0.85rem;
  color: #aaa;
}

.controls select {
  background: #2a2a4a;
  color: #e0e0e0;
  border: 1px solid #555;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.85rem;
}

.controls button, .action-btn {
  background: linear-gradient(180deg, #1a2c3a, #0d1a26);
  color: #e0e0e0;
  border: 1px solid #2d5060;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.controls button:hover, .action-btn:hover {
  background: linear-gradient(180deg, #2a4a60, #1a3040);
  border-color: var(--accent);
  color: #fff;
}

#lang-toggle {
  font-weight: bold;
  min-width: 36px;
}

/* ===== GAME TABLE ===== */
#game-table {
  position: relative;
  display: grid;
  min-height: 75vh;
  max-width: 100vw;
  background: var(--table-bg);
  border: 4px solid #2a1a0a;
  border-radius: 20px;
  margin: 5px;
  padding: 5px;
  box-shadow: inset 0 0 60px rgba(0,0,0,0.5), 0 4px 20px rgba(0,0,0,0.8);
  overflow: hidden;
}

/* Grid layouts per player count */
#game-table.players-2 {
  grid-template-areas:
    ". top ."
    ". trick ."
    ". bottom ."
    ". actions .";
  grid-template-columns: 1fr 3fr 1fr;
  grid-template-rows: auto 1fr auto auto;
}

#game-table.players-3 {
  grid-template-areas:
    ". top ."
    "left trick ."
    ". bottom ."
    ". actions .";
  grid-template-columns: 1fr 2fr 1fr;
  grid-template-rows: auto 1fr auto auto;
}

#game-table.players-4 {
  grid-template-areas:
    ". top ."
    "left trick right"
    ". bottom ."
    ". actions .";
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr);
  grid-template-rows: auto 1fr auto auto;
}

/* Player areas */
.player-area { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px; position: relative; min-width: 0; }

/* Player announcement bubbles */
.player-bubble {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  font-size: var(--font-small);
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 215, 0, 0.5);
  white-space: normal;
  max-width: min(180px, 45vw);
  text-align: center;
  z-index: 20;
  pointer-events: none;
  animation: bubbleIn 0.3s ease;
}

/* Position bubbles near the hand, without overlapping labels */
.player-area.top .player-bubble { bottom: -5px; }
.player-area.bottom .player-bubble { top: -5px; }

/* Side players: anchor bubble toward center, reduce font size to fit */
.player-area.left .player-bubble {
  top: -5px;
  left: auto;
  right: 0;
  transform: none;
  font-size: clamp(0.6rem, 1.6vw, 0.72rem);
  padding: 4px 8px;
  max-width: min(140px, 38vw);
}
.player-area.right .player-bubble {
  top: -5px;
  left: 0;
  transform: none;
  font-size: clamp(0.6rem, 1.6vw, 0.72rem);
  padding: 4px 8px;
  max-width: min(140px, 38vw);
}

.player-bubble.combo {
  background: rgba(27, 94, 32, 0.9);
  border-color: #81c784;
  color: #c8e6c9;
}

.player-bubble.exchange {
  background: rgba(21, 101, 192, 0.85);
  border-color: #64b5f6;
  color: #bbdefb;
}

.player-bubble.chicago-announce {
  background: rgba(183, 28, 28, 0.9);
  border-color: #ef5350;
  color: #ffcdd2;
}

.player-bubble.nothing {
  background: rgba(80, 80, 80, 0.8);
  border-color: #777;
  color: #bbb;
}

@keyframes bubbleIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}
.player-area.top { grid-area: top; }
.player-area.bottom { grid-area: bottom; }
.player-area.left { grid-area: left; }
.player-area.right { grid-area: right; }

.player-area.left, .player-area.right { justify-content: center; }

.player-area.left .player-label,
.player-area.right .player-label {
  max-width: 100%;
  overflow: hidden;
  font-size: 0.65rem;
  padding: 2px 4px;
  gap: 3px;
}

.player-area.left .player-label .player-badge,
.player-area.right .player-label .player-badge {
  font-size: 0.55rem;
  padding: 1px 3px;
}

.player-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-small);
  color: #ccc;
  background: rgba(0,0,0,0.4);
  padding: 3px 12px;
  border-radius: 12px;
  white-space: nowrap;
}

.player-label .player-badge {
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: bold;
}

/* Active player indicator */
.player-area.active-turn .player-label {
  background: rgba(93, 214, 232, 0.2);
  border: 1px solid var(--accent);
  animation: pulse-glow 1.2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 4px rgba(93, 214, 232, 0.3); }
  50% { box-shadow: 0 0 12px rgba(93, 214, 232, 0.6); }
}

.player-badge.dealer {
  background: var(--gold);
  color: #1a1a1a;
}

.player-badge.chicago {
  background: var(--red);
  color: #fff;
}

.player-badge.shit {
  background: #795548;
  color: #fff;
}

/* Hands */
.hand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-wrap: nowrap;
  min-height: var(--card-h);
}

/* Fan effect for human hand */
.player-area.human .hand {
  gap: 0;
  height: calc(var(--card-h) + 30px);
  padding-top: 30px;
  overflow: visible;
  position: relative;
  align-items: flex-end;
}

.player-area.human .hand .card {
  margin-left: -15px;
  touch-action: manipulation;
  transform: translateY(0);
  will-change: transform;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  outline: 3px solid transparent;
  outline-offset: -3px;
}

.player-area.human .hand .card:first-child {
  margin-left: 0;
}

/* Hover effects only on devices with real hover (not touch) */
@media (hover: hover) {
  .player-area.human .hand .card:hover:not(.selected) {
    transform: translateY(-12px);
    z-index: 10;
    box-shadow: 0 8px 20px rgba(0,0,0,0.6);
  }

  .player-area.human .hand .card.selected:hover {
    transform: translateY(-28px);
  }
}

.player-area.human .hand .card.selected {
  transform: translateY(-25px);
  box-shadow: 0 4px 16px rgba(100,180,255,0.5);
  outline-color: #6ab4ff;
  z-index: 10;
}

.player-area.human .hand .card.playable {
  cursor: pointer;
}

.player-area.human .hand .card.playable:hover {
  border-color: var(--accent);
}

.player-area.human .hand .card:not(.playable).phase-tricks {
  opacity: 0.18;
  transform: translateY(0) scale(0.91) !important;
  filter: grayscale(0.5);
  cursor: not-allowed;
  transition: opacity 0.2s, transform 0.2s, filter 0.2s;
}

.player-area.human .hand .card.playable {
  box-shadow: 0 0 10px rgba(93, 214, 232, 0.55), 0 0 3px rgba(93, 214, 232, 0.3);
  border-color: var(--accent);
}

/* AI hands - overlap horizontally (top player) */
.player-area.top .hand .card {
  margin-left: -40px;
}
.player-area.top .hand .card:first-child {
  margin-left: 0;
}

/* AI hands - overlap vertically (left/right players) */
.player-area.left .hand,
.player-area.right .hand {
  flex-direction: column;
  min-height: 0;
}

.player-area.left .hand .card,
.player-area.right .hand .card {
  margin-left: 0;
  margin-top: calc(var(--card-small-h) * -0.55);
  width: var(--card-small-w);
  height: var(--card-small-h);
  font-size: clamp(0.45rem, 1.4vw, 0.6rem);
}
.player-area.left .hand .card:first-child,
.player-area.right .hand .card:first-child {
  margin-top: 0;
}

/* Hide unused player areas */
#game-table.players-2 .player-area.left,
#game-table.players-2 .player-area.right { display: none; }
#game-table.players-3 .player-area.right { display: none; }

/* ===== ANIMATIONS ===== */
@keyframes dealCard {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes cardAppear {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes trickWinFlash {
  0%, 100% { filter: brightness(1); }
  50%       { filter: brightness(1.6); }
}

@keyframes tallyIn {
  from { opacity: 0; transform: scaleY(0); transform-origin: bottom; }
  to   { opacity: 1; transform: scaleY(1); }
}

@keyframes comboWin {
  0%   { box-shadow: 0 0 0 rgba(93,214,232,0); }
  30%  { box-shadow: 0 0 18px rgba(93,214,232,0.8); }
  70%  { box-shadow: 0 0 18px rgba(93,214,232,0.8); }
  100% { box-shadow: 0 0 0 rgba(93,214,232,0); }
}

.card.dealing {
  animation: dealCard 0.2s ease both;
}

.card.trick-appear {
  animation: cardAppear 0.18s ease both;
}

.trick-slot.trick-win .card {
  animation: trickWinFlash 0.35s ease 2;
}

.tally-mark.tally-new {
  animation: tallyIn 0.25s ease both;
}

.player-label.combo-win {
  animation: comboWin 0.7s ease;
}

/* ===== CARDS ===== */
.card {
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--card-radius);
  border: 2px solid #888;
  background: #fff;
  position: relative;
  flex-shrink: 0;
  user-select: none;
  transition: opacity 0.3s, box-shadow 0.3s;
  box-shadow: 1px 2px 6px rgba(0,0,0,0.4);
  font-family: var(--font);
  font-size: var(--card-font);
}

.card.face-down {
  background: repeating-linear-gradient(
    45deg,
    #0d3050 0, #0d3050 4px,
    #164060 4px, #164060 8px
  );
  border-color: #1e6080;
}

.card.face-down::after {
  content: '🂠';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  opacity: 0.3;
}

/* Card content */
.card-corner {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.card-corner.top-left {
  top: 5px;
  left: 6px;
}

.card-corner.bottom-right {
  bottom: 5px;
  right: 6px;
  transform: rotate(180deg);
}

.card-rank {
  font-size: 1.05rem;
  font-weight: bold;
}

.card-suit-symbol {
  font-size: 0.85rem;
}

.card-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.2rem;
}

/* Suit colors */
.card.suit-spades, .card.suit-clubs { color: var(--black); }
.card.suit-hearts, .card.suit-diamonds { color: var(--red); }

/* ===== TRICK AREA ===== */
#trick-area {
  grid-area: trick;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.trick-slot {
  position: absolute;
  transition: all 0.4s ease;
}

.trick-slot[data-player="0"] { bottom: 10px; left: 50%; transform: translateX(-50%); }
.trick-slot[data-player="1"] { top: 10px; left: 50%; transform: translateX(-50%); }
.trick-slot[data-player="2"] { left: 20px; top: 50%; transform: translateY(-50%); }
.trick-slot[data-player="3"] { right: 20px; top: 50%; transform: translateY(-50%); }

.trick-slot .card {
  box-shadow: 2px 4px 12px rgba(0,0,0,0.5);
}

/* ===== COMBO PREVIEW ===== */
#combo-preview {
  background: rgba(93, 214, 232, 0.1);
  border: 1px solid rgba(93, 214, 232, 0.35);
  color: var(--accent);
  padding: 4px 16px;
  border-radius: 8px;
  font-size: var(--font-small);
  font-weight: 600;
  text-align: center;
  transition: opacity 0.2s;
  white-space: nowrap;
  margin-bottom: 4px;
}

/* ===== ACTION BAR ===== */
#action-bar {
  grid-area: actions;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px;
  flex-wrap: wrap;
}

.action-btn {
  font-size: var(--font-base);
  padding: clamp(6px, 2vw, 10px) clamp(12px, 4vw, 22px);
  font-weight: 600;
  min-height: 44px;
  touch-action: manipulation;
}

.action-btn.chicago {
  background: linear-gradient(180deg, #c62828, #8b0000);
  border-color: #ef5350;
  color: #fff;
}

.action-btn.chicago:hover {
  background: linear-gradient(180deg, #e53935, #b71c1c);
}

.hidden { display: none !important; }

/* ===== MESSAGE OVERLAY ===== */
#message-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  border-radius: 20px;
}

#message-text {
  background: linear-gradient(180deg, #0d1520, #070e18);
  color: var(--accent);
  font-size: 1.4rem;
  font-weight: bold;
  padding: 20px 40px;
  border-radius: 12px;
  border: 2px solid var(--accent);
  text-align: center;
  max-width: 80%;
  animation: popIn 0.3s ease;
}

@keyframes popIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ===== ROUND SUMMARY PANEL ===== */
#round-summary {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 110;
  border-radius: 20px;
}

#summary-content {
  background: linear-gradient(180deg, #0d1520, #070e18);
  border: 2px solid var(--accent);
  border-radius: 14px;
  padding: 20px 30px;
  min-width: 280px;
  max-width: 90%;
  animation: popIn 0.3s ease;
}

#summary-title {
  color: var(--accent);
  font-size: 1.2rem;
  text-align: center;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--accent-dim);
}

#summary-lines {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.summary-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-size: 0.9rem;
  color: #ccc;
}

.summary-line .summary-label {
  color: #999;
}

.summary-line .summary-player {
  color: #e0e0e0;
  font-weight: 600;
}

.summary-line .summary-points {
  font-weight: bold;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.85rem;
}

.summary-line .summary-points.positive {
  background: rgba(76,175,80,0.25);
  color: #81c784;
}

.summary-line .summary-points.negative {
  background: rgba(244,67,54,0.25);
  color: #ef5350;
}

.summary-line .summary-detail {
  color: #888;
  font-size: 0.8rem;
  font-style: italic;
}

#btn-continue {
  display: block;
  margin: 0 auto;
  min-width: 120px;
  text-align: center;
}

/* ===== SHOWN CARD AREA ===== */
#shown-card-area {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

#shown-card-area .label {
  color: #fff;
  background: rgba(0,0,0,0.6);
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
}

/* ===== CONTENT WRAPPER ===== */
#content-wrapper {
  display: flex;
  flex-direction: column;
}

#sidebar {
  display: flex;
  flex-direction: column;
}

/* ===== SCORE SECTION ===== */
#score-section {
  margin: 10px;
  padding: 15px;
  background: linear-gradient(180deg, #0d1520, #070e18);
  border-radius: 12px;
  border: 1px solid #1e2d3a;
}

#score-section h2 {
  color: var(--accent);
  font-size: 1.1rem;
  margin-bottom: 10px;
  text-align: center;
}

#score-grid {
  display: flex;
  gap: clamp(1px, 0.5vw, 4px);
  justify-content: center;
}

.score-column {
  flex: 1;
  max-width: 200px;
  border: 1px solid #444;
  border-radius: 8px;
  overflow: hidden;
  background: #1a1a2a;
}

.score-column-header {
  text-align: center;
  padding: clamp(3px, 1vw, 6px) clamp(4px, 1.5vw, 8px);
  font-weight: bold;
  font-size: var(--font-small);
  background: #2a2a4a;
  border-bottom: 1px solid #444;
  color: #e0e0e0;
}

.score-column-header .score-value {
  color: var(--accent);
  margin-left: 4px;
}

.score-row {
  height: clamp(28px, 5vw, 38px);
  display: flex;
  align-items: center;
  padding: 0 clamp(3px, 1vw, 6px);
  border-bottom: 1px solid #2a2a3a;
  position: relative;
}

.score-row.shit-zone {
  background: rgba(121, 85, 72, 0.25);
}

.score-row.shit-zone::after {
  content: '';
  position: absolute;
  right: 2px;
  top: 2px;
  width: 6px;
  height: 6px;
  background: #795548;
  border-radius: 50%;
}

.score-row.current-row {
  background: rgba(255, 215, 0, 0.1);
}

/* Tally marks */
.tally-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-right: 6px;
  height: 100%;
}

.tally-mark {
  width: 2px;
  height: clamp(16px, 3vw, 22px);
  background: #9e9e9e;
  display: inline-block;
}

/* Oblique marks for shit zones */
.tally-mark.oblique {
  background: #a1887f;
  transform: rotate(-20deg);
}

/* Row labels */
.score-row-label {
  position: absolute;
  right: 12px;
  font-size: 0.55rem;
  color: #555;
}

/* ===== GAME LOG ===== */
#game-log {
  margin: 0 10px 10px;
  padding: 10px 15px;
  background: #111;
  border-radius: 8px;
  border: 1px solid #333;
  max-height: 150px;
  overflow-y: auto;
  font-size: 0.8rem;
  color: #888;
}

#log-entries {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.log-entry {
  padding: 2px 0;
  border-bottom: 1px solid #1a1a1a;
}

.log-entry .highlight {
  color: var(--accent);
  font-weight: bold;
}

.log-entry .combo {
  color: #81c784;
}

.log-entry .points {
  color: #64b5f6;
}

.log-entry .negative {
  color: #ef5350;
}

/* ===== RULES OVERLAY ===== */
#btn-rules {
  font-weight: bold;
  min-width: 28px;
  border-radius: 50%;
  padding: 4px 8px;
  font-size: 0.9rem;
}

#rules-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
  padding: 20px;
}

#rules-content {
  background: linear-gradient(180deg, #0d1520, #070e18);
  border: 2px solid var(--accent);
  border-radius: 14px;
  max-width: 680px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  animation: popIn 0.25s ease;
}

#rules-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--accent-dim);
  flex-shrink: 0;
}

#rules-title {
  color: var(--accent);
  font-weight: bold;
  font-size: 1rem;
  letter-spacing: 1px;
  text-transform: uppercase;
}

#btn-rules-close {
  background: none;
  border: none;
  color: #8ec8d4;
  font-size: 1rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.2s;
}

#btn-rules-close:hover {
  color: var(--accent);
}

#rules-body {
  overflow-y: auto;
  padding: 18px 24px;
  color: #cce8ef;
  font-size: 0.85rem;
  line-height: 1.65;
  scrollbar-width: thin;
  scrollbar-color: #2d5060 #0a0e12;
}

#rules-body h1 {
  color: var(--accent);
  font-size: 1.15rem;
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--accent-dim);
}

#rules-body h2 {
  color: var(--accent);
  font-size: 0.95rem;
  margin: 18px 0 8px;
}

#rules-body h3 {
  color: #8ec8d4;
  font-size: 0.85rem;
  margin: 14px 0 6px;
}

#rules-body p {
  margin: 0 0 10px;
}

#rules-body strong { color: #e0f4f8; }
#rules-body em { color: #ffd700; font-style: italic; }

#rules-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0 14px;
  font-size: 0.8rem;
}

#rules-body td, #rules-body th {
  padding: 5px 10px;
  border: 1px solid rgba(93, 214, 232, 0.15);
  text-align: left;
  vertical-align: top;
}

#rules-body tr:first-child td {
  background: rgba(93, 214, 232, 0.08);
  font-weight: 600;
  color: var(--accent);
}

/* ===== GAME OVER OVERLAY ===== */
#game-over-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 20px;
}

#game-over-content {
  background: linear-gradient(180deg, #0d1520, #070e18);
  border: 2px solid var(--accent);
  border-radius: 16px;
  padding: 28px 32px;
  max-width: 600px;
  width: 100%;
  animation: popIn 0.35s ease;
  max-height: 90vh;
  overflow-y: auto;
}

.go-trophy {
  font-size: 2.8rem;
  text-align: center;
  margin-bottom: 6px;
}

.go-title {
  color: var(--accent);
  font-size: 1.4rem;
  text-align: center;
  margin: 0 0 4px;
}

.go-winner {
  color: #ffd700;
  font-size: 1rem;
  text-align: center;
  margin: 0 0 18px;
}

.go-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-bottom: 16px;
}

.go-table th {
  color: #8ec8d4;
  text-align: left;
  padding: 5px 8px;
  border-bottom: 1px solid var(--accent-dim);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.go-table td {
  padding: 6px 8px;
  color: #cce8ef;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.go-table tr.go-winner-row td {
  color: #ffd700;
  font-weight: bold;
}

.go-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}

.go-stat {
  background: rgba(93, 214, 232, 0.07);
  border: 1px solid var(--accent-dim);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}

.go-stat .go-val {
  font-size: 1.15rem;
  font-weight: bold;
  color: var(--accent);
}

.go-stat .go-lbl {
  font-size: 0.65rem;
  color: #7aaab5;
  margin-top: 3px;
}

/* ===== DESKTOP LAYOUT ===== */
@media (min-width: 900px) {
  :root {
    --card-w: clamp(72px, 6vw, 110px);
    --card-h: clamp(108px, 9vw, 165px);
    --card-font: clamp(0.55rem, 0.7vw, 0.9rem);
    --font-base: clamp(0.9rem, 1vw, 1.05rem);
    --font-small: clamp(0.75rem, 0.8vw, 0.9rem);
  }

  header {
    padding: 10px clamp(20px, 4vw, 40px);
  }

  #content-wrapper {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 10px;
    padding: 10px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    align-items: start;
  }

  #game-table {
    min-height: calc(100vh - 80px);
    margin: 0;
  }

  #sidebar {
    position: sticky;
    top: 10px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    gap: 10px;
    scrollbar-width: thin;
    scrollbar-color: #333 #111;
  }

  #score-section {
    margin: 0;
  }

  #game-log {
    margin: 0;
    max-height: 260px;
  }
}

@media (min-width: 1100px) {
  #content-wrapper {
    grid-template-columns: 1fr 320px;
  }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 700px) {
  :root {
    --card-w: 60px;
    --card-h: 90px;
    --card-radius: 5px;
  }

  header {
    flex-direction: column;
    gap: 8px;
    padding: 8px 12px;
  }

  header h1 { font-size: 1.2rem; }

  #game-table { min-height: 60vh; margin: 5px; padding: 8px; }

  .card-rank { font-size: 0.8rem; }
  .card-suit-symbol { font-size: 0.65rem; }
  .card-center { font-size: 1.5rem; }

  .player-area.human .hand .card { margin-left: -20px; }
  .player-area:not(.human) .hand .card { margin-left: -35px; }

  #message-text { font-size: 1rem; padding: 12px 20px; }

  .action-btn { font-size: 0.8rem; padding: 6px 12px; }
}

@media (max-width: 450px) {
  :root {
    --card-w: 48px;
    --card-h: 72px;
    --card-radius: 4px;
  }

  .card-center { font-size: 1.2rem; }
  .card-rank { font-size: 0.65rem; }
  .card-suit-symbol { font-size: 0.55rem; }
  .card-corner.top-left { top: 2px; left: 3px; }
  .card-corner.bottom-right { bottom: 2px; right: 3px; }

  .player-area.human .hand .card { margin-left: -18px; }
}
