* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #1a1a2e;
  color: #eee;
  display: flex;
  justify-content: center;
  padding: 20px;
  min-height: 100vh;
  user-select: none;
}

.container {
  display: flex;
  gap: 30px;
  align-items: flex-start;
}

/* --- Grid --- */

.grid {
  display: inline-grid;
  gap: 2px;
  background: #333;
  padding: 2px;
  border-radius: 4px;
}

.cell {
  width: 60px;
  height: 60px;
  background: #2a2a4a;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.1s;
}

.cell.blocked {
  background: #111;
  cursor: default;
}

.cell.placed {
  cursor: grab;
  border-radius: 3px;
}

.cell.highlight-ok {
  background: rgba(46, 204, 113, 0.35) !important;
  box-shadow: inset 0 0 0 2px rgba(46, 204, 113, 0.6);
}

.cell.highlight-bad {
  background: rgba(231, 76, 60, 0.25) !important;
  box-shadow: inset 0 0 0 2px rgba(231, 76, 60, 0.4);
}

/* --- Side panel --- */

.panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 280px;
}

.info {
  background: #16213e;
  padding: 16px;
  border-radius: 8px;
}

.info h2 { font-size: 14px; text-transform: uppercase; color: #888; margin-bottom: 8px; }

.solution-count {
  font-size: 28px;
  font-weight: bold;
  color: #f1c40f;
}

.solution-count.computing { color: #888; font-size: 18px; }

.controls { display: flex; gap: 8px; flex-wrap: wrap; }

button {
  background: #16213e;
  color: #eee;
  border: 1px solid #444;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s;
}

button:hover { background: #1a3a5c; }
button:disabled { opacity: 0.3; cursor: default; }

.nav { display: flex; align-items: center; gap: 12px; }
.nav span { font-size: 14px; color: #aaa; min-width: 80px; text-align: center; }

/* --- Piece tray --- */

.tray-title { font-size: 14px; text-transform: uppercase; color: #888; margin-bottom: 8px; }

.tray {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.piece-thumb {
  display: inline-grid;
  gap: 1px;
  padding: 6px;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: grab;
  background: #16213e;
  transition: border-color 0.15s, opacity 0.15s;
}

.piece-thumb:hover { border-color: #888; }
.piece-thumb.selected { border-color: #f1c40f; }
.piece-thumb.placed { opacity: 0.15; cursor: default; }
.piece-thumb.placed:hover { border-color: transparent; }

.piece-cell {
  width: 22px;
  height: 22px;
  border-radius: 2px;
}

.tray-controls {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* --- Drag float --- */

.drag-float {
  position: fixed;
  pointer-events: none;
  z-index: 1000;
  display: grid;
  gap: 2px;
  opacity: 0.75;
}

.drag-cell {
  width: 60px;
  height: 60px;
  border-radius: 3px;
  pointer-events: none;
}

/* --- Help --- */

.help {
  font-size: 12px;
  color: #555;
  line-height: 1.8;
  margin-top: 12px;
}

.help b { color: #888; }
