.sim-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
  margin: 1rem 0;
}

#gridCanvas {
  border-radius: 1.2rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
  background: #1a1a1a;
  display: block;
  width: 400px;
  height: 400px;
  border: 1px solid #2a2a2a;
}

.controls {
  flex: 1;
  min-width: 220px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 1.2rem;
  padding: 1.2rem;
}

.controls label {
  display: block;
  font-weight: 500;
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: #cbd5e1;
}

.controls input[type="range"] {
  width: 100%;
  margin: 0.2rem 0 0.3rem;
  background: #2a2a2a;
  height: 6px;
  border-radius: 4px;
  -webkit-appearance: none;
  appearance: none;
}

.controls input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #214E34;
  cursor: pointer;
}

.controls .val {
  font-weight: 600;
  color: #7DC89A;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0.8rem 0 0.3rem;
}

.btn-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn {
  background: #2a2a2a;
  border: none;
  padding: 0.4rem 1rem;
  border-radius: 40px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  color: #e0e0e0;
  border: 1px solid #2a2a2a;
}

.btn-primary {
  background: #0D2419;
  color: #7DC89A;
  border-color: #214E34;
}
.btn-primary:hover { background: #123324; }

.btn-success {
  background: #0f2a1a;
  color: #86d9a0;
  border-color: #2a4a3a;
}
.btn-success:hover { background: #1a3a2a; }

.btn-danger {
  background: #2a0f0f;
  color: #f8a0a0;
  border-color: #4a2a2a;
}
.btn-danger:hover { background: #3a1a1a; }

.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem 1.5rem;
  font-size: 0.85rem;
  background: #0f0f0f;
  padding: 0.4rem 0.8rem;
  border-radius: 1rem;
  border: 1px solid #2a2a2a;
  color: #cbd5e1;
}

.stats span {
  font-weight: 600;
  color: #7DC89A;
}

.q-grid-mini {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
  max-width: 180px;
  margin: 0.5rem 0;
}

.q-grid-cell {
  background: #0f0f0f;
  border: 1px solid #2a2a2a;
  border-radius: 4px;
  padding: 3px 1px;
  font-size: 0.55rem;
  text-align: center;
  font-weight: 500;
  color: #e0e0e0;
  transition: background 0.2s;
}

@media (max-width: 600px) {
  #gridCanvas { width: 280px; height: 280px; }
}