:root {
  --p1: #ef4444;
  --p2: #2563eb;

  --gap: 14px;
  --hero-start: #4c628a;
  --hero-end: #30425f;
}

.setup {
  height: 100%;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(12px, 2vw, 16px);
  overflow: hidden;
}

.hero {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  background: linear-gradient(145deg, #df9654, #b86b2b);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.heroInner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1 1 auto;
  min-height: 0;
}

.heroTitle {
  margin: 0;
  font-size: clamp(20px, 3.2vw, 34px);
  font-weight: 400;
  font-family: "CMB", "Segoe UI", system-ui, sans-serif;
  letter-spacing: .2px;
  color: #f7f9f2;
  text-shadow: 0 1px 0 rgba(8,20,14,.45);
}

.heroDesc {
  margin: 0;
  max-width: 60ch;
  font-weight: 750;
  line-height: 1.35;
  color: #f7f9f2;
}

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.mt8 { margin-top: 8px; }
.spacer { flex: 1 1 auto; min-height: 10px; }
.startRow { display: flex; justify-content: flex-end; gap: 10px; align-items: center; }

.game {
  height: 100%;
  display: grid;
  grid-template-columns: 1.7fr 0.6fr;
  gap: clamp(12px, 2vw, 16px);
  overflow: hidden;
  align-items: stretch;
}

.boardWrap {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.metaTop {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  margin-bottom: 10px;
  flex: 0 0 auto;
  flex-wrap: wrap;
}

.metaStrong { color: var(--text); font-family: "CMB", "Segoe UI", system-ui, sans-serif; font-weight: 400; }

.boardArea {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.grid {
  --cell: 140px;
  display: grid;
  grid-template-columns: repeat(3, var(--cell));
  grid-auto-rows: var(--cell);
  gap: var(--gap);
  justify-content: center;
  align-content: center;
  padding: 18px;
  overflow: visible;
}

.cell {
  width: var(--cell);
  height: var(--cell);
  border: 1px solid rgba(0,0,0,.14);
  border-radius: 18px;
  background: #fafafa;
  cursor: pointer;
  position: relative;
  box-shadow: inset 0 -16px 30px rgba(0,0,0,.06);
  transition: transform .06s ease, filter .12s ease, box-shadow .12s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.cell:active { transform: scale(.99); }
.cell.disabled { cursor: not-allowed; opacity: .75; }

.cell::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: radial-gradient(520px 360px at 25% 18%, rgba(255,255,255,.50), rgba(255,255,255,0) 60%);
  pointer-events: none;
  opacity: .6;
}

.piece {
  position: absolute;
  inset: 14px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.96);
  font-weight: 950;
  letter-spacing: .4px;
  border: 4px solid #000;
  box-shadow:
    0 18px 40px rgba(0,0,0,.18),
    inset 0 14px 20px rgba(255,255,255,.16),
    inset 0 -20px 30px rgba(0,0,0,.22);
  transform: translateZ(0);
}

.piece::before {
  content: "";
  position: absolute;
  inset: 10%;
  border-radius: 999px;
  background: radial-gradient(240px 160px at 30% 25%, rgba(255,255,255,.55), rgba(255,255,255,0) 60%);
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: .85;
}

.piece::after {
  content: "";
  position: absolute;
  inset: 12%;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,.35);
  pointer-events: none;
  box-shadow: inset 0 -10px 18px rgba(0,0,0,.10);
}

.p1 { background: linear-gradient(135deg, #ff6b6b, var(--p1)); }
.p2 { background: linear-gradient(135deg, #60a5fa, var(--p2)); }

.sz1 { inset: 30px; }
.sz2 { inset: 22px; }
.sz3 { inset: 14px; }

.pieceLabel {
  position: relative;
  z-index: 2;
  font-size: 18px;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(0,0,0,.35);
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,.18);
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: inset 0 -10px 18px rgba(0,0,0,.10);
  font-family: "CMB", "Segoe UI", system-ui, sans-serif;
}

.side {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px;
  background: #fff;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 10px;
  flex: 0 0 auto;
}

.picker {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fafafa;
  padding: 10px;
  margin-bottom: 10px;
  flex: 0 0 auto;
}

.pickerTitle {
  font-size: 12px;
  color: var(--muted);
  font-weight: 900;
  margin-bottom: 8px;
}

.pickRow {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.pickBtn {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  background: #fff;
  color: #111827;
  font-weight: 950;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 56px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: transform .06s ease, filter .12s ease, opacity .12s ease;
}

.pickBtn:active { transform: translateY(1px); }
.pickBtn.selected { outline: 4px solid #000; outline-offset: 0; }
.pickBtn.disabled { opacity: .5; cursor: not-allowed; }

.pickDot {
  border-radius: 999px;
  border: 3px solid #000;
  box-shadow:
    0 10px 20px rgba(0,0,0,.12),
    inset 0 -10px 18px rgba(0,0,0,.20),
    inset 0 10px 18px rgba(255,255,255,.18);
}

.dot1 { width: 22px; height: 22px; }
.dot2 { width: 28px; height: 28px; }
.dot3 { width: 34px; height: 34px; }

.msg {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fafafa;
  padding: 10px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 900;
  line-height: 1.25;
  flex: 0 0 auto;
  margin-bottom: 10px;
}

.msg strong { color: var(--text); font-family: "CMB", "Segoe UI", system-ui, sans-serif; font-weight: 400; }

.sideButtons {
  display: grid;
  gap: 10px;
  margin-top: auto;
  flex: 0 0 auto;
}

@media (max-width: 980px) {
  .setup { grid-template-columns: 1fr; }
  .row2 { grid-template-columns: 1fr; }
  .game { grid-template-columns: 1fr; }
  :root { --gap: 12px; }
}

@media (max-height: 700px) {

}
