body {
  margin: 0;
  overflow: hidden;
  background: linear-gradient(to bottom, #2c1445 0%, #ff4500 40%, #ff8c44 100%);
}

canvas {
  width: 100vw;
  height: 100vh;
  display: block;
}

canvas.underwater {
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  filter: blur(5px) contrast(2.2) brightness(0.4) saturate(1.8) hue-rotate(20deg);
  transform: scale(1.025);
  /* Enhanced pixelated rendering with much stronger effects */
}

#instructions {
  position: absolute;
  top: 20px;
  left: 20px;
  color: white;
  font-family: Arial, sans-serif;
  font-size: 14px;
  background: rgba(0,0,0,0.5);
  padding: 10px;
  border-radius: 5px;
}

#vitalsHUD {
  position: absolute;
  top: 20px;
  left: 20px;
  display: flex;
  gap: 20px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(0, 255, 0, 0.6);
  border-radius: 6px;
  padding: 8px 16px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  backdrop-filter: blur(5px);
}

#heartRate {
  color: #ff3030;
  font-weight: bold;
  text-shadow: 0 0 3px rgba(255, 48, 48, 0.8);
  animation: heartbeat 1s infinite;
}

#depthMeter {
  color: #30aaff;
  font-weight: bold;
  text-shadow: 0 0 3px rgba(48, 170, 255, 0.8);
}

#statusIndicator {
  color: #ffff30;
  font-weight: bold;
  text-shadow: 0 0 3px rgba(255, 255, 48, 0.8);
}

#chatWindow {
  position: absolute;
  bottom: 20px;
  left: 20px;
  width: 320px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid rgba(0, 255, 0, 0.6);
  border-radius: 6px;
  backdrop-filter: blur(5px);
  font-family: 'Courier New', monospace;
}

#chatHeader {
  background: rgba(0, 40, 0, 0.9);
  color: #00ff00;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: bold;
  border-bottom: 1px solid rgba(0, 255, 0, 0.3);
  border-radius: 5px 5px 0 0;
}

#chatMessages {
  height: 80px;
  overflow-y: auto;
  padding: 8px;
  font-size: 10px;
  line-height: 1.2;
}

.chat-message {
  margin-bottom: 4px;
  word-wrap: break-word;
}

.chat-timestamp {
  color: #666;
  font-size: 9px;
}

.chat-username {
  color: #00ffaa;
  font-weight: bold;
}

.chat-text {
  color: #ffffff;
}

.chat-system {
  color: #ffaa00;
  font-style: italic;
}

#chatInputArea {
  display: flex;
  border-top: 1px solid rgba(0, 255, 0, 0.3);
}

#chatInput {
  flex: 1;
  background: transparent;
  border: none;
  padding: 6px 8px;
  color: #00ff00;
  font-family: 'Courier New', monospace;
  font-size: 10px;
}

#chatInput:focus {
  outline: none;
  background: rgba(0, 40, 0, 0.3);
}

#chatSendBtn {
  background: rgba(0, 80, 0, 0.8);
  border: none;
  color: #00ff00;
  padding: 6px 12px;
  cursor: pointer;
  font-family: 'Courier New', monospace;
  font-size: 10px;
  border-radius: 0 0 5px 0;
}

#chatSendBtn:hover {
  background: rgba(0, 120, 0, 0.8);
}

#hotbar {
  position: absolute;
  bottom: 20px;
  right: 20px;
  display: flex;
  gap: 2px;
  background: rgba(0, 0, 0, 0.8);
  padding: 6px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(5px);
}

.hotbar-slot {
  width: 48px;
  height: 48px;
  background: rgba(40, 40, 40, 0.9);
  border: 1px solid #444;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: all 0.15s;
}

.hotbar-slot.selected {
  border-color: #00ff88;
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.4);
  background: rgba(0, 80, 40, 0.6);
}

.hotbar-slot:hover {
  border-color: #888;
  background: rgba(60, 60, 60, 0.9);
}

.goggles-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin-right: 15px;
}

.hotbar-item, .inventory-item {
  width: 36px;
  height: 36px;
  object-fit: contain;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.item-count {
  position: absolute;
  bottom: 2px;
  right: 2px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 10px;
  padding: 1px 3px;
  border-radius: 2px;
  min-width: 12px;
  text-align: center;
}

#inventory {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, rgba(20, 25, 35, 0.98), rgba(30, 35, 45, 0.98));
  border: 2px solid #4a90e2;
  border-radius: 20px;
  padding: 40px;
  display: none;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 
              0 0 40px rgba(74, 144, 226, 0.3);
  backdrop-filter: blur(15px);
}

#inventory h2 {
  color: #ffffff;
  margin: 0 0 30px 0;
  text-align: center;
  font-family: 'Courier New', monospace;
  font-size: 32px;
  text-shadow: 0 0 10px rgba(74, 144, 226, 0.6);
  letter-spacing: 2px;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 12px;
  margin-bottom: 40px;
  padding: 30px;
  background: rgba(15, 20, 30, 0.8);
  border-radius: 20px;
  border: 2px solid rgba(74, 144, 226, 0.4);
  min-height: 400px;
  justify-items: center;
  align-items: center;
  max-width: 100%;
  overflow: hidden;
  grid-template-rows: repeat(5, 1fr);
}

.inventory-slot {
  width: 70px;
  height: 70px;
  background: linear-gradient(145deg, rgba(45, 55, 70, 0.9), rgba(25, 30, 40, 0.9));
  border: 2px solid rgba(100, 120, 150, 0.5);
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3),
              0 4px 8px rgba(0, 0, 0, 0.2);
}

.inventory-slot:hover {
  border-color: #4a90e2;
  background: linear-gradient(145deg, rgba(65, 75, 90, 0.9), rgba(35, 45, 60, 0.9));
  transform: translateY(-2px);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3),
              0 8px 16px rgba(74, 144, 226, 0.3);
}

.inventory-slot.sellable:hover {
  border-color: #ffa500;
  background: linear-gradient(145deg, rgba(90, 70, 35, 0.9), rgba(60, 45, 20, 0.9));
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3),
              0 8px 16px rgba(255, 165, 0, 0.4);
}

.item-tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 8px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'Courier New', monospace;
  white-space: nowrap;
  z-index: 1000;
  pointer-events: none;
  border: 1px solid #666;
}

.inventory-controls {
  display: flex;
  gap: 15px;
  justify-content: center;
  padding-top: 10px;
}

.btn {
  padding: 15px 30px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  transition: all 0.3s ease;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-close {
  background: linear-gradient(145deg, #6c757d, #5a6268);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.btn-close:hover {
  background: linear-gradient(145deg, #7c858d, #6a7278);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.btn-shop {
  background: linear-gradient(145deg, #ffa500, #e69500);
  color: #1a1a1a;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-shop:hover {
  background: linear-gradient(145deg, #ffb733, #ff9500);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 165, 0, 0.4);
}

#shop {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.95);
  border: 3px solid #ffaa00;
  border-radius: 12px;
  padding: 20px;
  display: none;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
}

#shop h2 {
  color: #ffaa00;
  margin: 0 0 15px 0;
  text-align: center;
  font-family: 'Courier New', monospace;
}

.shop-money {
  text-align: center;
  color: #00ff00;
  font-family: 'Courier New', monospace;
  font-size: 18px;
  margin-bottom: 20px;
}

.shop-item {
  display: flex;
  align-items: center;
  padding: 10px;
  margin-bottom: 10px;
  background: rgba(40, 40, 40, 0.9);
  border-radius: 6px;
  border: 1px solid #666;
}

.shop-item:hover {
  background: rgba(60, 60, 60, 0.9);
  border-color: #ffaa00;
}

.shop-item img {
  width: 48px;
  height: 48px;
  margin-right: 15px;
  object-fit: contain;
}

.shop-item-info {
  flex: 1;
  color: white;
  font-family: 'Courier New', monospace;
}

.shop-item-name {
  font-weight: bold;
  margin-bottom: 5px;
}

.shop-item-price {
  color: #00ff00;
  font-size: 14px;
}

.btn-buy {
  background: #0066cc;
  color: white;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Courier New', monospace;
}

.btn-buy:hover {
  background: #0088ff;
}

.btn-buy:disabled {
  background: #444;
  cursor: not-allowed;
}

.btn-sell {
  background: #00aa00;
  color: white;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Courier New', monospace;
}

.btn-sell:hover {
  background: #00cc00;
}

.btn-sell:disabled {
  background: #444;
  cursor: not-allowed;
}

.fishing-indicator {
  position: absolute;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 20px;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  text-align: center;
  border: 2px solid #00aaff;
}

.shop-notification {
  position: absolute;
  bottom: 150px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 255, 136, 0.9);
  color: black;
  padding: 15px;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  text-align: center;
  border: 2px solid #00aa88;
  font-weight: bold;
}

.xray-notification {
  position: absolute;
  bottom: 200px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 255, 255, 0.9);
  color: black;
  padding: 15px 25px;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  text-align: center;
  border: 2px solid #00aaaa;
  font-weight: bold;
  font-size: 14px;
  box-shadow: 0 0 20px rgba(0, 255, 255, 0.5);
}

#playerStatsOverlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
}

.player-stats-panel {
  position: absolute;
  background: rgba(0, 0, 0, 0.9);
  border: 2px solid #00ffff;
  border-radius: 8px;
  padding: 10px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: white;
  text-align: center;
  min-width: 150px;
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.6);
  backdrop-filter: blur(5px);
  animation: statsGlow 2s infinite alternate;
}

.player-name {
  color: #00ffff;
  font-weight: bold;
  font-size: 14px;
  margin-bottom: 5px;
  text-shadow: 0 0 5px rgba(0, 255, 255, 0.8);
}

.player-stat {
  color: #ffffff;
  margin: 3px 0;
  font-size: 11px;
}

.player-distance {
  color: #888888;
  font-size: 10px;
  margin-top: 5px;
  font-style: italic;
}

.kill-notification {
  position: absolute;
  background: rgba(0, 200, 0, 0.9);
  color: white;
  padding: 12px 18px;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  text-align: center;
  border: 2px solid #00aa00;
  font-weight: bold;
  z-index: 1500;
  animation: killNotificationFade 2s ease-out;
  pointer-events: none;
  box-shadow: 0 0 15px rgba(0, 200, 0, 0.6);
}

.kill-title {
  font-size: 14px;
  margin-bottom: 4px;
  color: #ffffff;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.kill-reward {
  font-size: 16px;
  font-weight: bold;
  color: #ffff00;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.kill-bonus {
  font-size: 11px;
  color: #aaffaa;
  font-style: italic;
  margin-top: 2px;
}

@keyframes killNotificationFade {
  0% { 
    transform: scale(0.5);
    opacity: 0;
  }
  20% { 
    transform: scale(1.1);
    opacity: 1;
  }
  100% { 
    transform: scale(1);
    opacity: 0;
  }
}

@keyframes statsGlow {
  0% { 
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.6);
    border-color: #00ffff;
  }
  100% { 
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.9);
    border-color: #44ffff;
  }
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

#pauseMenu {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.95);
  border: 3px solid #666;
  border-radius: 12px;
  padding: 30px;
  display: none;
  max-width: 800px;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 1000;
}

#pauseMenu h2 {
  color: white;
  margin: 0 0 20px 0;
  text-align: center;
  font-family: 'Courier New', monospace;
  font-size: 24px;
}

.pause-tutorial {
  color: white;
  font-family: Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  background: rgba(40, 40, 40, 0.8);
  padding: 20px;
  border-radius: 8px;
  border: 1px solid #666;
  margin-bottom: 20px;
}

.pause-controls {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

.pause-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  transition: all 0.2s;
  font-size: 14px;
}

.btn-resume {
  background: #00aa00;
  color: white;
}

.btn-resume:hover {
  background: #00cc00;
}

.boss-defeat-notification {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(45deg, rgba(255, 215, 0, 0.95), rgba(255, 140, 0, 0.95));
  color: #000;
  padding: 30px 40px;
  border-radius: 15px;
  font-family: 'Courier New', monospace;
  text-align: center;
  border: 4px solid #FFD700;
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
  animation: bossDefeatPulse 4s ease-out;
  z-index: 2000;
  display: none;
}

.boss-defeat-title {
  font-size: 28px;
  font-weight: bold;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  color: #8B0000;
}

.boss-defeat-reward {
  font-size: 24px;
  font-weight: bold;
  color: #006400;
  margin-bottom: 5px;
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

.boss-defeat-bonus {
  font-size: 14px;
  color: #4B0082;
  font-style: italic;
}

@keyframes bossDefeatPulse {
  0% { 
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 0;
  }
  20% { 
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 1;
  }
  100% { 
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}