:root {
  --gap: 8px;
  --board-size: 420px;
}

body {
  font-family: Inter, system-ui, Segoe UI, Roboto, Helvetica, Arial;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 24px;
  padding: 20px;
  background: #f6f8fb;
  color: #0b1220;
}

/* Panels */
.panel {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(12,20,40,0.08);
  width: 100%;
  max-width: 420px;
  box-sizing: border-box;
}

h1 {
  font-size: 18px;
  margin: 0 0 8px;
}

p.small {
  font-size: 13px;
  color: #556;
  margin: 0 0 12px;
}

/* Board */
#boardWrap {
  position: relative;
  width: 100%;
  max-width: var(--board-size);
  aspect-ratio: 1 / 1; /* keeps it square */
}

.board {
  position: relative;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg,#e9eef8,#fff);
  border-radius: 12px;
  padding: 12px;
  box-sizing: border-box;
}

.tile {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  border-radius: 10px;
  background: #2b6cff;
  color: #fff;
  box-shadow: 0 6px 14px rgba(43,108,255,0.18);
  transition: left 260ms ease, top 260ms ease, transform 160ms ease;
  user-select: none;
}

.tile.blank {
  background: transparent;
  box-shadow: none;
}

/* Controls */
.controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

textarea {
  width: 100%;
  height: 72px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  font-family: monospace;
  resize: vertical;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

button {
  padding: 8px 10px;
  border-radius: 8px;
  border: 0;
  background: #2b6cff;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  flex: 1;
}

button.secondary {
  background: #f1f5f9;
  color: #0b1220;
}

.smallbtn {
  padding: 6px 8px;
  font-size: 13px;
  flex: initial;
}

.status {
  font-size: 13px;
  color: #334155;
  margin-top: 6px;
}

.stepsView {
  margin-top: 12px;
  background: #f8fafc;
  padding: 8px;
  border-radius: 8px;
  height: 120px;
  overflow: auto;
  font-family: monospace;
  font-size: 13px;
  white-space: pre;
}

.controls-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.play {
  background: #10b981;
}

.info {
  font-size: 13px;
  color: #475569;
}

footer{
  margin-top:40px;
  width: 100%;
  padding:15px 10px;
  border-top: 2px solid #ddd;
  text-align:center;
  font-size:14px;
  color:#444;
  font-family: 'Segoe UI', Tahoma, sans-serif;
}
/* --- Responsive --- */
@media (max-width: 1024px) {
  body {
    gap: 16px;
    padding: 16px;
  }
}

@media (max-width: 768px) {
  body {
    flex-direction: column;
    align-items: center;
  }
  .panel {
    width: 100%;
    max-width: 100%;
  }
  #boardWrap {
    max-width: 90vw;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 16px;
  }
  textarea {
    height: 60px;
  }
  button {
    font-size: 13px;
    padding: 6px 8px;
  }
  .stepsView {
    font-size: 12px;
  }
}