* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
}

.layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(280px, 420px) minmax(520px, 1fr);
  min-height: 100vh;
  padding: 1rem;
}

.panel {
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 12px;
  padding: 1rem;
}

h1 {
  margin: 0 0 0.5rem 0;
  font-size: 1.25rem;
}

.subtext {
  margin: 0 0 1rem 0;
  color: #94a3b8;
  line-height: 1.4;
}

.status-grid {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.strategy-row input[type="file"] {
  max-width: 100%;
  color: #cbd5e1;
}

button {
  border: 1px solid #334155;
  border-radius: 8px;
  background: #1e293b;
  color: #e2e8f0;
  padding: 0.5rem 0.7rem;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: #334155;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.message {
  min-height: 1.5rem;
  margin: 0;
  color: #cbd5e1;
}

.policy-hint {
  margin-bottom: 0.75rem;
}

.board-panel {
  display: grid;
  place-items: center;
}

.board {
  --board-size: 10;
  --cell-size: 50px;
  width: calc(var(--board-size) * var(--cell-size));
  height: calc(var(--board-size) * var(--cell-size));
  background: #f8fafc;
  border: 2px solid #334155;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
}

.cell {
  position: absolute;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  display: grid;
  place-items: center;
}

.cell.goal {
  box-shadow: inset 0 0 0 2px #b45309;
}

.cell.unreachable {
  background: #cbd5e1 !important;
}

.cell.shortest-path-cell {
  box-shadow: inset 0 0 0 2px #16a34a;
}

.distance-label {
  position: absolute;
  top: 4px;
  left: 5px;
  font-size: 0.72rem;
  line-height: 1;
  color: #1e293b;
  font-weight: 600;
  z-index: 2;
}

.move-score-label {
  position: absolute;
  right: 5px;
  bottom: 4px;
  font-size: 0.68rem;
  line-height: 1;
  color: #0f172a;
  font-weight: 700;
  z-index: 2;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 4px;
  padding: 1px 4px;
}

.cell.pawn-option {
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.45);
}

.cell.pawn-option-recommended {
  box-shadow:
    inset 0 0 0 3px #2563eb,
    inset 0 0 0 6px rgba(255, 255, 255, 0.75);
}

.pawn {
  width: 65%;
  height: 65%;
  border-radius: 50%;
  background: #2563eb;
  margin: auto;
  margin-top: 18%;
  z-index: 3;
  position: relative;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
}

.edge {
  position: absolute;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
  z-index: 6;
}

.edge.vertical {
  width: 8px;
}

.edge.horizontal {
  height: 8px;
}

.edge.wall {
  background: #111827;
}

.edge.preview {
  background: rgba(30, 64, 175, 0.45);
}

.edge:not(.wall):hover {
  background: rgba(100, 116, 139, 0.45);
}
