* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: #f5f4f0;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  cursor: default;
}

#canvas {
  display: block;
  position: fixed;
  inset: 0;
}

#ui {
  position: fixed;
  top: 24px;
  left: 24px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
}

#spawnInput {
  background: transparent;
  border: none;
  border-bottom: 1px solid #aaa;
  color: #111;
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 4px 0;
  width: 160px;
  outline: none;
  caret-color: #111;
  transition: border-color 0.2s;
}

#spawnInput::placeholder { color: #ccc; }
#spawnInput:focus { border-bottom-color: #111; }

#spawnButton {
  background: none;
  border: none;
  color: #bbb;
  font-size: 13px;
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: 4px 0;
  transition: color 0.15s;
}

#spawnButton:hover { color: #111; }

#counter {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 10;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #ccc;
}

#errorMsg {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #bbb;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

/* ── Items panel ── */

#items-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: none;
  border: none;
  color: #bbb;
  font-size: 11px;
  letter-spacing: 0.08em;
  cursor: pointer;
  padding: 4px 0;
  transition: color 0.15s;
  z-index: 20;
}

#items-toggle:hover { color: #111; }

#items-panel {
  position: fixed;
  bottom: 52px;
  right: 24px;
  z-index: 20;
  background: rgba(245, 244, 240, 0.96);
  border-top: 1px solid #ddd;
  padding: 14px 0 6px 0;
  width: 220px;
  display: none;
}

#items-panel.open { display: block; }

.item-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid #eee;
}

.item-row:last-child { border-bottom: none; }

.item-name {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: #111;
}

.item-words {
  font-size: 10px;
  letter-spacing: 0.04em;
  color: #aaa;
  text-align: right;
  max-width: 130px;
}

/* ── Gravity panel ── */

#gravity-toggle {
  position: fixed;
  bottom: 24px;
  right: 90px;
  background: none;
  border: none;
  color: #bbb;
  font-size: 11px;
  letter-spacing: 0.08em;
  cursor: pointer;
  padding: 4px 0;
  transition: color 0.15s;
  z-index: 20;
}

#gravity-toggle:hover { color: #111; }

#gravity-panel {
  position: fixed;
  bottom: 52px;
  right: 90px;
  z-index: 20;
  background: rgba(245, 244, 240, 0.96);
  border-top: 1px solid #ddd;
  padding: 14px 12px 10px;
  width: 160px;
  display: none;
}

#gravity-panel.open { display: block; }

#gravDial {
  position: fixed;
  top: 24px;
  right: 24px;
  cursor: crosshair;
  display: block;
  z-index: 20;
}

#grav-strength-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.grav-label {
  font-size: 10px;
  letter-spacing: 0.06em;
  color: #aaa;
  white-space: nowrap;
}

#gravStrength {
  flex: 1;
  height: 2px;
  -webkit-appearance: none;
  appearance: none;
  background: #ddd;
  outline: none;
  cursor: pointer;
}

#gravStrength::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #111;
  cursor: pointer;
}

#gravStrength::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #111;
  border: none;
  cursor: pointer;
}

#gravStrengthVal {
  font-size: 10px;
  letter-spacing: 0.06em;
  color: #aaa;
  width: 24px;
  text-align: right;
}

#grav-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.grav-preset {
  background: none;
  border: 1px solid #ddd;
  color: #aaa;
  font-size: 9px;
  letter-spacing: 0.06em;
  padding: 3px 6px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.grav-preset:hover {
  color: #111;
  border-color: #111;
}

.grav-preset.active {
  color: #111;
  border-color: #111;
}