:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f6f1;
  color: #1d211c;
}

body {
  margin: 0;
  overflow: hidden;
}

.controls button {
  border: 1px solid #b9bda8;
  background: #ffffff;
  border-radius: 8px;
  min-width: 42px;
  min-height: 38px;
  font: inherit;
  cursor: pointer;
}

.controls button:hover {
  background: #eef3e8;
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 320px;
  overflow: hidden;
}

.play-area {
  display: grid;
  place-items: center;
  padding: 24px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.board {
  width: min(88vmin, 760px);
  aspect-ratio: 1;
  position: relative;
  overflow: hidden;
  border: 2px solid #4d3a23;
  background:
    linear-gradient(135deg, rgba(238, 197, 112, 0.95), rgba(209, 157, 72, 0.95)),
    #d8b36f;
  box-shadow: 0 16px 40px rgba(31, 38, 26, 0.18);
}

.grid-lines {
  position: absolute;
  inset: 6.6%;
  border: 1px solid rgba(62, 43, 21, 0.76);
  background:
    repeating-linear-gradient(
      to right,
      rgba(62, 43, 21, 0.76) 0,
      rgba(62, 43, 21, 0.76) 1px,
      transparent 1px,
      transparent calc(100% / 14)
    ),
    repeating-linear-gradient(
      to bottom,
      rgba(62, 43, 21, 0.76) 0,
      rgba(62, 43, 21, 0.76) 1px,
      transparent 1px,
      transparent calc(100% / 14)
    );
  pointer-events: none;
}

.hoshi {
  position: absolute;
  width: 2.1%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #1d1b17;
  box-shadow: 0 1px 2px rgba(255, 255, 255, 0.22);
  pointer-events: none;
  z-index: 1;
}

.cell {
  position: absolute;
  width: 5.3%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 0;
  background: transparent;
  border-radius: 50%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  cursor: pointer;
  z-index: 2;
}

.cell::after {
  content: "";
  position: absolute;
  inset: 4%;
  border-radius: 50%;
}

.cell.black::after {
  background: radial-gradient(circle at 35% 30%, #555, #050505 68%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.cell.white::after {
  background: radial-gradient(circle at 35% 30%, #fff, #d8d8d8 74%);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.28);
}

.cell:not(.black):not(.white):not(:disabled):hover::after,
.cell.preview::after {
  background: rgba(255, 255, 255, 0.72);
  border: 2px solid rgba(47, 125, 103, 0.82);
  box-shadow: 0 2px 8px rgba(38, 45, 36, 0.18);
  box-sizing: border-box;
}

.cell.last {
  outline: 2px solid #2f7d67;
  outline-offset: 2px;
}

.panel {
  border-left: 1px solid #d7dac9;
  background: #fbfcf7;
  padding: 24px;
  overflow: auto;
  min-height: 0;
}

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

h1 {
  margin: 0;
  font-size: 28px;
}

.badge {
  border-radius: 999px;
  background: #dfe9dc;
  color: #245441;
  padding: 4px 10px;
  font-size: 13px;
}

.controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 22px 0;
  flex-wrap: wrap;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.stats {
  display: grid;
  gap: 10px;
  margin: 0 0 20px;
}

.stats div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e3e5d9;
}

dt {
  color: #656d5c;
}

dd {
  margin: 0;
  text-align: right;
}

.history {
  margin: 0;
  padding-left: 22px;
  line-height: 1.8;
  font-variant-numeric: tabular-nums;
}

.steps-label {
  display: block;
  margin: 0 0 6px;
  color: #656d5c;
  font-size: 14px;
}

.steps-box {
  width: 100%;
  min-height: 74px;
  resize: vertical;
  box-sizing: border-box;
  border: 1px solid #d0d4c4;
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 18px;
  font: 13px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
  color: #1d211c;
  background: #fff;
}

.probe-command {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #d0d4c4;
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 14px;
  font: 12px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
  color: #1d211c;
  background: #fff;
}

@media (max-width: 820px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .panel {
    border-left: 0;
    border-top: 1px solid #d7dac9;
  }
}
