:root {
  --green: #1f7a45;
  --green-soft: #2c8a55;
  --grid-line: #0f502a;
  --shadow: rgba(0, 0, 0, 0.1);
  --bg: #f3f5f4;
  --text: #1c1c1c;
  --white: #f7f7f7;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans JP", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 10% 20%, #f0f5f7 0%, #eef3f1 25%, #f5f7f4 60%);
  min-height: 100vh;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--white);
  box-shadow: 0 4px 14px var(--shadow);
  position: sticky;
  top: 0;
  z-index: 2;
}

.controls button {
  margin-left: 8px;
}

h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0.04em;
}

button {
  cursor: pointer;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #dfe5e2;
  background: linear-gradient(135deg, #ffffff, #f0f5f1);
  transition: transform 0.1s ease, box-shadow 0.2s ease;
  font-size: 14px;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px var(--shadow);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px var(--shadow);
}

.app {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  padding: 24px;
}

.sidebar {
  background: var(--white);
  padding: 20px;
  border-radius: 16px;
  box-shadow: 0 12px 32px var(--shadow);
  align-self: start;
}

.status {
  margin-bottom: 18px;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  line-height: 1.6;
}

.color-swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid #d0d0d0;
}

.color-swatch.black {
  background: #141414;
}

.color-swatch.white {
  background: #fefefe;
}

.message {
  margin: 4px 0 0;
  padding: 10px;
  background: #eef8f1;
  border-radius: 8px;
  min-height: 40px;
}

.rules h2 {
  margin-top: 0;
}

.rules ul {
  padding-left: 18px;
  margin: 6px 0 0;
  line-height: 1.5;
}

.board-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
}

.board {
  width: min(90vw, 640px);
  aspect-ratio: 1 / 1;
  background: var(--green);
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 4px;
}

.cell {
  background: var(--green-soft);
  border: 2px solid var(--grid-line);
  border-radius: 8px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s ease;
}

.cell:hover {
  transform: translateY(-1px);
}

.cell.valid::after {
  content: "";
  position: absolute;
  width: 46%;
  height: 46%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 0 2px rgba(15, 80, 42, 0.2);
}

.piece {
  width: 70%;
  height: 70%;
  border-radius: 50%;
  box-shadow: inset 0 6px 12px rgba(255, 255, 255, 0.22), inset 0 -8px 14px rgba(0, 0, 0, 0.25);
}

.piece.black {
  background: radial-gradient(circle at 30% 30%, #2e2e2e, #0c0c0c);
}

.piece.white {
  background: radial-gradient(circle at 30% 30%, #ffffff, #d1d1d1);
}

@media (max-width: 960px) {
  .app {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .app {
    padding: 16px;
  }

  .board {
    width: 92vw;
  }
}
