@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600&family=Space+Grotesk:wght@400;600&display=swap');

:root {
  font-family: 'Space Grotesk', 'Trebuchet MS', sans-serif;
  color: #1f1a14;
  background: #f4ecd9;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 5% 0%, #fff7e4 0%, rgba(255,255,255,0) 40%),
    linear-gradient(145deg, #f7f0e1, #ead9bf);
}

a { color: inherit; }

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.brand {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(1.8rem, 3vw, 2.3rem);
  margin: 0;
}

.nav {
  display: flex;
  gap: 10px;
}

.btn {
  border: none;
  border-radius: 999px;
  background: #2c231a;
  color: #fff5e7;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
}

.btn.secondary {
  background: #8d6237;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.two {
  grid-template-columns: 1fr 1fr;
}

.card {
  background: rgba(255, 248, 237, 0.95);
  border: 1px solid rgba(40, 29, 20, 0.15);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 10px 18px rgba(0,0,0,0.08);
}

input, select {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #c8ae8f;
  padding: 10px;
  font: inherit;
  margin-top: 6px;
}

label { font-size: 0.92rem; display: block; margin-top: 10px; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table th, .table td {
  text-align: left;
  padding: 9px 6px;
  border-bottom: 1px solid rgba(44,35,26,0.12);
}

.msg { margin-top: 10px; font-weight: 600; color: #8f2e24; min-height: 1.2em; }

.play-layout {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 18px;
}

.board-wrap {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto auto;
  gap: 10px;
  align-items: stretch;
  justify-content: center;
  justify-items: center;
}

.turn-banner {
  min-height: 52px;
  border-radius: 14px;
  border: 3px solid rgba(176, 35, 35, 0.2);
  background: rgba(255,248,238,0.95);
  display: grid;
  place-items: center;
  padding: 10px 12px;
  font-weight: 700;
  color: #5d3b24;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.turn-banner.active {
  border-color: #b31414;
  box-shadow: 0 0 0 2px rgba(179, 20, 20, 0.2);
  color: #2c1c10;
}

.board {
  display: grid;
  width: min(100%, 640px);
  aspect-ratio: 1 / 1;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 6px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(20,16,13,0.08);
  border: 2px solid rgba(31, 27, 22, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255, 248, 238, 0.35);
}

.square {
  border: none;
  border-radius: 12px;
  display: grid;
  place-items: center;
  position: relative;
  padding: 0;
  cursor: pointer;
}

.square.light { background: #efe1ca; }
.square.dark { background: #c4a983; }
.square.selected { box-shadow: 0 0 0 3px #b27137; }
.square.move { box-shadow: 0 0 0 3px rgba(32,111,125,0.7); }
.square.suicide { box-shadow: inset 0 0 0 2px rgba(180, 20, 20, 0.52); }

.suicide-mark {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(170, 20, 20, 0.95);
  font-size: 1.6rem;
  font-weight: 700;
}

.piece {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1rem;
  filter: drop-shadow(0 7px 10px rgba(0,0,0,0.25));
}

.piece.white {
  background: #fff8ef;
  color: #2a1b12;
  border: 2px solid #2a1b12;
}

.piece.black {
  background: #2a1b12;
  color: #f8efe2;
  border: 2px solid #f8efe2;
}

.bob { width: 16px; height: 16px; border-radius: 50%; }

.badge {
  display: inline-block;
  border-radius: 999px;
  background: #efe1ca;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 700;
}

@media (max-width: 980px) {
  .grid.two, .play-layout { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .container { padding: 14px; }
  .turn-banner { min-height: 48px; }
}

