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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a1a2e;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

#pond {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

#toolbar {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  align-items: center;
  background: rgba(10, 26, 46, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  z-index: 10;
}

.tool-group {
  display: flex;
  gap: 6px;
  align-items: center;
}

.tool-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  font-size: 18px;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.tool-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: scale(1.08);
}

.tool-btn.active {
  background: rgba(0, 245, 212, 0.2);
  border-color: rgba(0, 245, 212, 0.4);
}

#status-bar {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 16px;
  align-items: center;
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  letter-spacing: 0.5px;
  z-index: 10;
  pointer-events: none;
}

#online-count {
  color: rgba(0, 245, 212, 0.7);
  font-weight: 600;
}

#online-count::before {
  content: "● ";
  animation: pulse 2s ease-in-out infinite;
}

#hint {
  transition: opacity 1s ease;
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

#cooldown-bar {
  position: fixed;
  bottom: 62px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

#cooldown-bar.visible {
  opacity: 1;
}

#cooldown-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00f5d4, #4ecdc4);
  border-radius: 2px;
  transition: width 0.05s linear;
}

#cooldown-fill.ready {
  background: linear-gradient(90deg, #00f5d4, #00f5d4);
  box-shadow: 0 0 8px rgba(0, 245, 212, 0.5);
}

#event-banner {
  position: fixed;
  top: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: rgba(10, 26, 46, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 245, 212, 0.3);
  border-radius: 12px;
  padding: 10px 24px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  z-index: 11;
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

#event-banner.visible {
  transform: translateX(-50%) translateY(0);
}

#event-banner .event-timer {
  color: rgba(0, 245, 212, 0.8);
  margin-left: 8px;
}

#red-button {
  position: fixed;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ff4444, #cc0000);
  border: 3px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 20px rgba(255, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  z-index: 12;
  animation: redPulse 0.8s ease-in-out infinite;
  transition: transform 0.15s;
}

#red-button:hover {
  transform: scale(1.15);
}

#red-button:active {
  transform: scale(0.9);
}

@keyframes redPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.4); }
  50% { box-shadow: 0 0 35px rgba(255, 0, 0, 0.8), 0 4px 12px rgba(0, 0, 0, 0.4); }
}

#wave-pool-banner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 48px;
  font-weight: 900;
  color: rgba(255, 100, 100, 0.8);
  text-shadow: 0 0 30px rgba(255, 50, 50, 0.6);
  letter-spacing: 4px;
  z-index: 11;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s;
}

#wave-pool-banner.visible {
  opacity: 1;
  animation: wavePoolShake 0.3s ease-in-out infinite;
}

@keyframes wavePoolShake {
  0%, 100% { transform: translate(-50%, -50%); }
  25% { transform: translate(-52%, -50%); }
  75% { transform: translate(-48%, -50%); }
}

@media (max-width: 600px) {
  #toolbar {
    bottom: 8px;
    padding: 6px 10px;
    gap: 8px;
  }
  .tool-btn {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }
  #status-bar {
    font-size: 10px;
    top: 8px;
  }
  #feed {
    max-width: 200px;
    font-size: 11px;
  }
  #user-panel {
    width: 240px;
  }
}

/* ===== FEED ===== */
#feed {
  position: fixed;
  top: 40px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 10;
  pointer-events: auto;
  max-width: 260px;
  max-height: 60vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 245, 212, 0.2) transparent;
}

#feed::-webkit-scrollbar {
  width: 4px;
}

#feed::-webkit-scrollbar-thumb {
  background: rgba(0, 245, 212, 0.2);
  border-radius: 2px;
}

.feed-item {
  background: rgba(10, 26, 46, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 6px 12px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  letter-spacing: 0.3px;
  animation: feedSlide 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.feed-item .feed-name {
  color: rgba(0, 245, 212, 0.8);
  font-weight: 600;
}

.feed-item .feed-action {
  color: rgba(255, 255, 255, 0.5);
}

@keyframes feedSlide {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ===== USER PANEL ===== */
#user-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: rgba(10, 26, 46, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(0, 245, 212, 0.2);
  border-radius: 16px;
  padding: 0;
  width: 320px;
  max-height: 70vh;
  overflow: hidden;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

#user-panel.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

#user-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 14px;
  font-weight: 700;
  color: rgba(0, 245, 212, 0.9);
  letter-spacing: 0.5px;
}

#user-panel-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

#user-panel-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
}

#user-list {
  overflow-y: auto;
  max-height: 50vh;
  padding: 8px;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  transition: background 0.15s;
}

.user-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.user-row.me {
  background: rgba(0, 245, 212, 0.08);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 245, 212, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 2px;
}

.user-stats {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.user-stats span {
  white-space: nowrap;
}

#my-name {
  color: rgba(0, 245, 212, 0.5);
  font-weight: 500;
}

/* ===== RESPAWN BANNER ===== */
#respawn-banner {
  position: fixed;
  bottom: 70px;
  right: 12px;
  background: rgba(10, 26, 46, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 100, 100, 0.3);
  border-radius: 10px;
  padding: 10px 16px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  z-index: 14;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  max-width: 220px;
  animation: respawnPulse 2s ease-in-out infinite;
}

#respawn-banner.visible {
  opacity: 1;
}

@keyframes respawnPulse {
  0%, 100% { border-color: rgba(255, 100, 100, 0.3); }
  50% { border-color: rgba(255, 100, 100, 0.6); }
}
