* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  background: #05070f;
  color: #dfe7ff;
  user-select: none;
}

#space {
  display: block;
  width: 100vw;
  height: 100vh;
  cursor: default;
  touch-action: none;
}

#brand {
  position: fixed;
  top: 18px;
  left: 22px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #eaf2ff;
  text-shadow: 0 0 18px rgba(100, 160, 255, 0.55), 0 0 40px rgba(120, 180, 255, 0.25);
  z-index: 5;
  pointer-events: none;
}

#counter {
  position: fixed;
  top: 20px;
  right: 24px;
  font-size: 12px;
  letter-spacing: 0.4px;
  color: rgba(200, 215, 255, 0.7);
  z-index: 5;
  pointer-events: none;
}

#hint {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 16px;
  font-size: 12px;
  letter-spacing: 0.3px;
  white-space: nowrap;
  color: rgba(190, 205, 245, 0.55);
  background: rgba(10, 14, 28, 0.55);
  border: 1px solid rgba(120, 170, 255, 0.18);
  padding: 8px 14px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
  z-index: 5;
  pointer-events: none;
}

#hud {
  position: fixed;
  left: 22px;
  bottom: 20px;
  z-index: 6;
}

#toast {
  position: fixed;
  left: 50%;
  top: 60px;
  transform: translateX(-50%);
  font-size: 13px;
  letter-spacing: 0.4px;
  color: #e6f2ff;
  background: rgba(14, 22, 44, 0.85);
  border: 1px solid rgba(130, 175, 255, 0.4);
  padding: 9px 16px;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5), 0 0 20px rgba(80, 140, 255, 0.18);
  z-index: 8;
  pointer-events: none;
  transition: opacity 0.25s;
}

#addBtn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(90, 140, 255, 0.55), rgba(20, 30, 70, 0.9));
  border: 1px solid rgba(140, 190, 255, 0.5);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45), 0 0 24px rgba(90, 150, 255, 0.28);
  transition: transform 0.15s, box-shadow 0.15s;
}

#addBtn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 26px rgba(0, 0, 0, 0.55), 0 0 34px rgba(110, 170, 255, 0.5);
}

#addBtn:active {
  transform: scale(0.96);
}

#modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 14, 0.6);
  backdrop-filter: blur(4px);
}

#modal.hidden { display: none; }

.modal-box {
  width: min(360px, 90vw);
  background: linear-gradient(160deg, rgba(22, 30, 58, 0.95), rgba(10, 14, 30, 0.97));
  border: 1px solid rgba(130, 175, 255, 0.35);
  border-radius: 16px;
  padding: 26px 24px 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(80, 140, 255, 0.15);
}

.modal-box h2 {
  margin: 0 0 18px;
  font-size: 18px;
  letter-spacing: 0.5px;
  color: #eaf2ff;
}

#nickInput {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  color: #eaf2ff;
  background: rgba(6, 9, 20, 0.7);
  border: 1px solid rgba(120, 170, 255, 0.3);
  border-radius: 10px;
  outline: none;
  user-select: text;
  transition: border-color 0.15s, box-shadow 0.15s;
}

#nickInput:focus {
  border-color: rgba(140, 195, 255, 0.8);
  box-shadow: 0 0 0 3px rgba(90, 150, 255, 0.18);
}

#nickInput::placeholder {
  color: rgba(180, 195, 230, 0.4);
}

.error {
  color: #ff8f8f;
  font-size: 13px;
  margin: 10px 2px 0;
  min-height: 16px;
}

.hidden { display: none; }

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  justify-content: flex-end;
}

.modal-actions button {
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid rgba(130, 175, 255, 0.35);
  background: rgba(30, 40, 80, 0.6);
  color: #dfe7ff;
  transition: filter 0.12s, transform 0.12s;
}

.modal-actions button:hover { filter: brightness(1.15); }
.modal-actions button:active { transform: scale(0.97); }

.modal-actions button.primary {
  background: linear-gradient(180deg, #3d74ff, #2650d6);
  border-color: rgba(140, 195, 255, 0.6);
  color: #fff;
}

.modal-actions button:disabled {
  opacity: 0.55;
  cursor: default;
}