* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  color: #fff;
}

/* ---------- Lobby ---------- */
.lobby-body {
  background: repeating-linear-gradient(90deg,#7a4a26,#7a4a26 3px,#6f4321 3px,#6f4321 6px);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lobby-card {
  background: rgba(0,0,0,.35);
  border: 2px solid #4a2f18;
  border-radius: 14px;
  padding: 32px 40px;
  text-align: center;
  min-width: 320px;
}
.lobby-card h1 { margin: 0 0 6px; font-size: 26px; }
.lobby-sub { opacity: .85; margin: 14px 0 10px; }
.lobby-players, .lobby-games { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.lobby-player-btn, .lobby-game-btn {
  background: #2874a6;
  border: 2px solid #5aa7d6;
  color: #fff;
  padding: 12px 26px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
}
.lobby-player-btn:hover, .lobby-game-btn:hover { filter: brightness(1.1); }

/* ---------- Game shell ---------- */
.game-body {
  background: repeating-linear-gradient(90deg,#7a4a26,#7a4a26 3px,#6f4321 3px,#6f4321 6px);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}
.game-wrap {
  width: 100%;
  max-width: 980px;
  height: 88vh;
  min-height: 560px;
  max-height: 760px;
  padding: 14px;
  border-radius: 10px;
  display: flex;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

.main-col { flex: 1; display: flex; flex-direction: column; height: 100%; min-width: 0; }
.band {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.band-top { border-bottom: 1px dashed rgba(255,255,255,.15); padding-bottom: 6px; }
.band-bottom { border-top: 1px dashed rgba(255,255,255,.15); padding-top: 6px; }
.band-cards {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  position: relative;
  flex-wrap: wrap;
}
.band-mid { flex: 1; display: flex; align-items: center; justify-content: center; gap: 22px; }
.mid-col { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 170px; }

.avatar-box {
  position: relative;
  border-radius: 8px;
  padding: 8px 6px;
  text-align: center;
  width: 96px;
}
.avatar-box .name { font-weight: 700; font-size: 13px; }
.avatar-box .score { font-weight: 800; font-size: 20px; line-height: 1.3; }
.avatar-box .dealer-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 27px;
  border-radius: 3px;
  background: linear-gradient(135deg,#2f6fa8,#1d4a75);
  border: 1.5px solid #dfe9f2;
}
.avatar-box.bigj { background: #b5432f; border: 2px solid #d97757; }
.avatar-box.bobbymac { background: #2874a6; border: 2px solid #5aa7d6; }
.avatar-box .discon { font-size: 10px; opacity: .8; }

/* ---------- Cards ---------- */
.card-face {
  width: 62px;
  height: 88px;
  border-radius: 6px;
  background: #fdfcf8;
  border: 1px solid #c9c2b3;
  box-shadow: 0 2px 5px rgba(0,0,0,.35);
  position: relative;
  user-select: none;
  flex-shrink: 0;
  cursor: default;
}
.card-face.small { width: 46px; height: 64px; }
.card-face.selected {
  border: 3px solid #f2c14e;
  box-shadow: 0 0 0 2px #f2c14e, 0 4px 8px rgba(0,0,0,.35);
  transform: translateY(-8px);
}
.card-face.clickable { cursor: pointer; }
.card-face .corner {
  position: absolute;
  left: 4px; top: 2px;
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
}
.card-face.small .corner { font-size: 12px; }
.card-face .corner.br {
  left: auto; right: 4px; top: auto; bottom: 2px;
  transform: rotate(180deg);
}
.card-face .corner .suit { font-size: 13px; }
.card-face.small .corner .suit { font-size: 11px; }
.card-face .pip {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px;
}
.card-face.small .pip { font-size: 20px; }
.card-face.red .corner, .card-face.red .pip { color: #c41e3a; }
.card-face.black .corner, .card-face.black .pip { color: #1a1a1a; }

.card-back {
  width: 62px; height: 88px;
  border-radius: 6px;
  background: linear-gradient(135deg,#2f6fa8,#1d4a75);
  border: 2px solid #dfe9f2;
  box-shadow: 0 2px 4px rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.card-back.small { width: 46px; height: 64px; }
.card-back .diamond { width: 60%; height: 60%; border: 2px solid #dfe9f2; transform: rotate(45deg); }

.card-group { display: flex; gap: 2px; }
.street-cards { display: flex; align-items: center; gap: 10px; }
.street-history .card-face { filter: grayscale(1); opacity: .45; }

.starter-wrap { text-align: center; }
.starter-wrap .lbl { font-size: 10px; opacity: .75; margin-bottom: 3px; }

/* ---------- Score popup / prompts ---------- */
.score-popup {
  background: rgba(0,0,0,.6);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 45px;
  font-weight: 800;
  white-space: nowrap;
  pointer-events: none;
}
.score-popup.ai { color: #ff9d8a; }
.score-popup.you { color: #7ec8ff; }
.prompt-text { text-align: center; font-size: 13px; opacity: .9; }
.discard-prompt { opacity: .9; font-size: 14px; text-align: center; }

.btn {
  border: none;
  color: #fff;
  padding: 8px 22px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
}
.btn-confirm { background: #3f9142; }
.btn-confirm[disabled] { background: #5c6b5d; cursor: default; }
.btn-play { background: #3f9142; padding: 9px 26px; font-weight: 800; font-size: 15px; }
.btn-blue { background: #2874a6; border: 2px solid #5aa7d6; }
.btn-stats { background: #6b4324; border: 2px solid #4a2f18; color: #f4e9d8; padding: 10px 0; font-size: 14px; width: 100%; }

/* ---------- Score table ---------- */
.score-table {
  background: rgba(0,0,0,.4);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
}
.score-table .row { display: grid; grid-template-columns: 44px repeat(4,32px) 38px; }
.score-table .row.head { opacity: .7; margin-bottom: 2px; }
.score-table .row div { padding: 1px 4px; text-align: center; }
.score-table .row .name { text-align: left; font-weight: 700; }
.score-table .row:not(.head) { font-weight: 700; }

/* ---------- Round-over reveal ---------- */
.reveal-block { text-align: center; }
.reveal-pts { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.reveal-cards { display: flex; gap: 4px; }
.crib-block .reveal-pts { font-size: 18px; }
.crib-label { font-size: 13px; opacity: .85; margin-bottom: 2px; }

/* ---------- Count ---------- */
.count-col { width: 64px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.count-num { font-size: 44px; font-weight: 800; line-height: 1; text-align: center; }
.count-lbl { font-size: 11px; opacity: .7; text-align: center; }

/* ---------- Board column ---------- */
.board-col { display: flex; flex-direction: column; gap: 8px; height: 100%; }
.board-wrap {
  background: linear-gradient(160deg,#9a6a3e,#6b4324);
  border: 3px solid #4a2f18;
  border-radius: 10px;
  padding: 8px 6px 6px;
  width: 170px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.board-wrap svg { flex: 1; min-height: 0; }
.board-legend { display: flex; justify-content: space-between; color: #f4e9d8; font-size: 11px; padding: 0 8px; }
.board-legend-sub { text-align: center; color: #f4e9d8; font-size: 9px; opacity: .7; }

/* ---------- Overlays ---------- */
.overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.75);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 20px; text-align: center;
}
.overlay-title { font-size: 28px; font-weight: 800; }

/* ---------- Stats page ---------- */
.stats-body {
  background: repeating-linear-gradient(90deg,#7a4a26,#7a4a26 3px,#6f4321 3px,#6f4321 6px);
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 24px; text-align: center;
}
.stats-card { background: rgba(0,0,0,.4); border: 1px solid rgba(255,255,255,.18); border-radius: 12px; padding: 24px 32px; max-width: 480px; }
.stats-card h1 { margin-top: 0; }
.stats-line { font-size: 16px; margin: 8px 0; }
