:root {
  --bg-1: #f3d9a8;
  --bg-2: #f6b883;
  --paper: #fdf3dc;
  --ink: #201511;
  --board-dark: #6f4f2f;
  --board-light: #ead7b7;
  --red-piece: #b92f2f;
  --black-piece: #212121;
  --accent: #165f43;
  --accent-soft: #d3ebde;
  --shadow: rgba(30, 16, 12, 0.24);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next Condensed", "Gill Sans", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.34), transparent 40%),
    radial-gradient(circle at 86% 92%, rgba(255, 255, 255, 0.3), transparent 42%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2));
  display: flex;
  justify-content: center;
  padding: 24px;
}

.app-shell {
  width: min(1100px, 100%);
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 20px;
}

.game-panel,
.info-panel .card {
  background: var(--paper);
  border: 1px solid rgba(65, 39, 30, 0.2);
  border-radius: 18px;
  box-shadow: 0 12px 35px var(--shadow);
}

.game-panel {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: enter 420ms ease;
}

.panel-head h1,
.info-panel h2 {
  margin: 0;
  font-family: "Baskerville", "Palatino", "Book Antiqua", serif;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: rgba(32, 21, 17, 0.74);
}

.subtitle {
  margin: 6px 0 0;
  opacity: 0.82;
}

.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.turn-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.turn-indicator {
  margin: 0;
  padding: 8px 12px;
  border-radius: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid transparent;
}

.turn-indicator.human {
  background: #d8f0c9;
  color: #134b2d;
  border-color: #8ab573;
}

.turn-indicator.computer {
  background: #f3decf;
  color: #5c2617;
  border-color: #c08f79;
}

.turn-indicator.over {
  background: #ebe4db;
  color: #43342c;
  border-color: #b9a89c;
}

.status {
  margin: 0;
  padding: 9px 12px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: #0c4a33;
  font-weight: 700;
}

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

.difficulty-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

select,
button {
  border-radius: 10px;
  border: 1px solid rgba(30, 19, 15, 0.25);
  font: inherit;
}

select {
  padding: 6px 8px;
  background: #fff7e9;
}

button {
  padding: 8px 13px;
  background: var(--accent);
  color: #f5fff9;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease;
}

button:hover {
  filter: brightness(1.06);
}

button:active {
  transform: translateY(1px);
}

.board {
  width: min(100%, 640px);
  max-width: 100%;
  aspect-ratio: 1;
  border-radius: 14px;
  border: 2px solid rgba(27, 16, 11, 0.48);
  overflow: hidden;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  align-self: center;
}

.square {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  position: relative;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.square.light {
  background: var(--board-light);
}

.square.dark {
  background: var(--board-dark);
}

.square.selectable::after {
  content: "";
  position: absolute;
  inset: 21%;
  border: 2px dashed rgba(255, 255, 255, 0.7);
  border-radius: 50%;
}

.square.target::before {
  content: "";
  position: absolute;
  width: 20%;
  aspect-ratio: 1;
  background: rgba(255, 247, 225, 0.9);
  border-radius: 50%;
}

.square.selected {
  box-shadow: inset 0 0 0 4px #f9d34e;
}

.board.locked .square {
  cursor: wait;
}

.piece {
  width: 72%;
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow:
    inset 0 5px 8px rgba(255, 255, 255, 0.2),
    0 8px 12px rgba(0, 0, 0, 0.35);
  position: relative;
  animation: pop-in 250ms ease;
}

.piece.red {
  background:
    radial-gradient(circle at 30% 26%, rgba(255, 255, 255, 0.22), transparent 40%),
    var(--red-piece);
}

.piece.black {
  background:
    radial-gradient(circle at 30% 26%, rgba(255, 255, 255, 0.18), transparent 40%),
    var(--black-piece);
}

.piece.king::after {
  content: "K";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: "Baskerville", "Palatino", "Book Antiqua", serif;
  font-weight: 700;
  color: #f5d975;
  font-size: clamp(16px, 1.7vw, 22px);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.info-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.info-panel .card {
  padding: 16px;
}

.info-panel h2 {
  font-size: 1.2rem;
  margin-bottom: 10px;
}

.help {
  margin: 0 0 10px;
  opacity: 0.8;
}

.move-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.move-option {
  width: 100%;
  text-align: left;
  background: #fff9ec;
  color: #2a1812;
}

.move-option.filtered {
  border-color: #957246;
  background: #fff0c9;
}

.move-option:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@keyframes pop-in {
  from {
    transform: scale(0.88);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes enter {
  from {
    transform: translateY(12px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 920px) {
  body {
    padding: 14px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .board {
    width: min(94vw, 640px);
  }
}
