:root {
  --felt: #0f5132;
  --felt-dark: #0a3c25;
  --ink: #1d2733;
  --muted: #6b7785;
  --card-bg: #fdfdfb;
  --gold: #f2c14e;

  --team-blue: #2f6fed;
  --team-red: #e23b3b;
  --team-green: #29a745;

  --shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  --radius: 10px;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

/* ---- buttons ---- */
button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  background: #e9edf2;
  color: var(--ink);
  font-weight: 600;
  transition: transform 0.05s ease, background 0.15s ease, opacity 0.15s ease;
}
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary { background: var(--gold); color: #3a2c00; }
button.ghost { background: rgba(255, 255, 255, 0.15); color: #fff; }
button.danger { background: #f3d2d2; color: #7a1f1f; }

/* ---- segmented control ---- */
.segmented { display: inline-flex; background: rgba(255,255,255,0.15); border-radius: 8px; padding: 3px; gap: 3px; }
.segmented button { background: transparent; color: #fff; padding: 6px 14px; }
.segmented button.active { background: #fff; color: var(--ink); }

/* ===================================================================== */
/* Board grid (used on both screens)                                     */
/* ===================================================================== */
.board-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: clamp(2px, 0.5vmin, 6px);
  background: var(--felt-dark);
  padding: clamp(4px, 1vmin, 12px);
  border-radius: 14px;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.4), var(--shadow);
  width: 100%;
}

.cell {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--card-bg);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-weight: 700;
  user-select: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}
.cell.red { color: var(--team-red); }
.cell.black { color: #1d2733; }
.cell-rank { font-size: clamp(8px, 1.9vmin, 22px); }
.cell-suit { font-size: clamp(9px, 2.1vmin, 24px); }

.cell-corner {
  background: linear-gradient(135deg, #f7e7b0, #e9c869);
  color: #8a6a16;
}
.cell-corner .free { font-size: clamp(12px, 3vmin, 34px); }

.cell.clickable { cursor: pointer; }
.cell.target {
  background: rgba(242, 193, 78, 0.22);
  z-index: 2;
  animation: target-pulse 1s infinite;
}
.cell.removable {
  background: rgba(255, 107, 107, 0.22);
  z-index: 2;
  animation: removable-pulse 1s infinite;
}
@keyframes target-pulse {
  0%,100% { box-shadow: inset 0 0 0 4px var(--gold), 0 0 8px 1px rgba(242, 193, 78, 0.75); }
  50%     { box-shadow: inset 0 0 0 4px var(--gold), 0 0 18px 5px rgba(242, 193, 78, 1); }
}
@keyframes removable-pulse {
  0%,100% { box-shadow: inset 0 0 0 4px #ff6b6b, 0 0 8px 1px rgba(255, 107, 107, 0.75); }
  50%     { box-shadow: inset 0 0 0 4px #ff6b6b, 0 0 18px 5px rgba(255, 107, 107, 1); }
}

.cell.win { box-shadow: inset 0 0 0 3px var(--gold), 0 0 14px var(--gold); z-index: 2; }

/* ---- chips ---- */
.chip {
  position: absolute;
  inset: 5%;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4), inset 0 3px 5px rgba(255, 255, 255, 0.35),
    inset 0 -3px 6px rgba(0, 0, 0, 0.3);
}
/* Donut chips: transparent center so the card rank/suit stays readable. */
.chip-blue { background: radial-gradient(circle at 50% 50%, transparent 0 42%, #6ea0ff 46%, var(--team-blue) 100%); }
.chip-red { background: radial-gradient(circle at 50% 50%, transparent 0 42%, #ff7a7a 46%, var(--team-red) 100%); }
.chip-green { background: radial-gradient(circle at 50% 50%, transparent 0 42%, #62d486 46%, var(--team-green) 100%); }
.chip.locked::after {
  content: "";
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9);
}

/* ===================================================================== */
/* Card face (player hand)                                               */
/* ===================================================================== */
.card-face {
  position: relative;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  aspect-ratio: 5 / 7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  user-select: none;
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.card-face.red { color: var(--team-red); }
.card-face.black { color: #1d2733; }
.card-face .corner {
  position: absolute;
  font-size: 0.95rem;
  line-height: 0.95;
  text-align: center;
}
.card-face .corner.tl { top: 6px; left: 7px; }
.card-face .corner.br { bottom: 6px; right: 7px; transform: rotate(180deg); }
.card-face .pip { font-size: 2.6rem; }
.card-face .jack-center { font-size: 2.4rem; }
.card-face .jack-badge {
  position: absolute;
  bottom: 18%;
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  background: var(--ink);
  color: #fff;
  padding: 2px 6px;
  border-radius: 99px;
}
.card-face.jack-wild { box-shadow: var(--shadow), 0 0 0 2px #8e44ad inset; }
.card-face.jack-wild .jack-badge { background: #8e44ad; }
.card-face.jack-remove { box-shadow: var(--shadow), 0 0 0 2px #c0392b inset; }
.card-face.jack-remove .jack-badge { background: #c0392b; }

/* ---- team color text helpers ---- */
.t-blue { color: var(--team-blue); }
.t-red { color: var(--team-red); }
.t-green { color: var(--team-green); }
.dot { display: inline-block; width: 0.8em; height: 0.8em; border-radius: 50%; vertical-align: -1px; }
.dot.blue { background: var(--team-blue); }
.dot.red { background: var(--team-red); }
.dot.green { background: var(--team-green); }
