/* Club Penguin Game Styles */

/* Multiplayer Penguin Animations */

@keyframes playerEntrance {
  0% {
    opacity: 0;
    transform: scale(0.5) translateY(-20px);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.1) translateY(-5px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0px);
  }
}

/* Remote Player Styles */
.remote-players {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.remote-player {
  position: absolute;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px; /* center on the player's coordinates */
  transition:
    left 0.12s linear,
    top 0.12s linear,
    opacity 0.3s ease-out;
}

.remote-player.leaving {
  opacity: 0;
}

.remote-player-sprite {
  width: 100%;
  height: 100%;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.remote-player-sprite.entering {
  animation: playerEntrance 0.3s ease-out;
}

.remote-player-name {
  position: absolute;
  top: -25px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-family: 'Courier New', monospace;
  white-space: nowrap;
  border: 1px solid #4ecdc4;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* Player count indicator */
.player-count {
  position: fixed;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 12px;
  border-radius: 20px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  border: 2px solid #4ecdc4;
  box-shadow: 0 0 10px rgba(78, 205, 196, 0.3);
  z-index: 1000;
}

/* Retro scrollbars for Club Penguin page */
.club-penguin-page::-webkit-scrollbar {
  width: 16px;
  height: 16px;
}

.club-penguin-page::-webkit-scrollbar-track {
  background: #c0c0c0;
  border: 1px inset #c0c0c0;
}

.club-penguin-page::-webkit-scrollbar-thumb {
  background: linear-gradient(45deg, #808080, #c0c0c0);
  border: 1px outset #808080;
}

.club-penguin-page::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(45deg, #a0a0a0, #e0e0e0);
}

/* Firefox scrollbar styling */
.club-penguin-page {
  scrollbar-width: thick;
  scrollbar-color: #808080 #c0c0c0;
}

.club-penguin-page {
  font-family: 'Arial', sans-serif;
  background: #1a1a2e;
  color: white;
  user-select: none;
  height: 100vh;
  width: 100vw;
  overflow: auto; /* Enable scrolling for small screens */
  min-width: 1300px; /* Increased to accommodate debug panel */
  min-height: 600px; /* Minimum height to prevent crushing */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 20px;
  box-sizing: border-box;
}

/* Debug Panel - Left side */
.club-penguin-page #debug-panel {
  width: 250px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #333;
  border-radius: 8px;
  padding: 15px;
  height: fit-content;
  max-height: 80vh;
  overflow-y: auto;
  display: none; /* Hidden by default */
}

.club-penguin-page.debug-mode #debug-panel {
  display: block; /* Show in debug mode */
}

/* Game Container - Fixed size, no responsive scaling */
.club-penguin-page #game-container {
  position: relative;
  width: 1000px; /* Fixed width */
  height: 600px; /* Fixed height */
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
}

/* Main Game Stage */
.club-penguin-page #stage {
  position: relative;
  width: 960px;
  height: 540px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 2px solid #0066cc;
  border-radius: 8px;
  overflow: hidden;

  image-rendering: pixelated;
  box-shadow: 0 0 20px rgba(0, 102, 204, 0.3);
}

/* Penguin Sprite */
.club-penguin-page #penguin {
  position: absolute;
  width: 48px;
  height: 48px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 100;
  transition: transform 0.1s ease;
}

/* Walking animation states */
.club-penguin-page #penguin.walking {
  /* GIF will handle animation when walking */
}

.club-penguin-page #penguin.idle {
  /* Static frame when not walking */
}

/* Click Target Marker */
.club-penguin-page .click-marker {
  position: absolute;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border: 2px solid #00ff00;
  border-radius: 50%;
  pointer-events: none;
  animation: marker-pulse 0.6s ease-out forwards;
  z-index: 50;
}

@keyframes marker-pulse {
  0% {
    transform: scale(1);
    opacity: 1;
    border-color: #00ff00;
  }
  100% {
    transform: scale(2.5);
    opacity: 0;
    border-color: #88ff88;
  }
}

/* Hotspots (interaction areas) - Hidden by default */
.club-penguin-page .hotspot {
  position: absolute;

  z-index: 10;
  /* Hidden by default - only visible in debug mode */
  background: transparent;
  border: none;
  transition: background 0.2s ease;
}

/* Show hotspots only in debug mode */
.club-penguin-page.debug-mode .hotspot {
  background: rgba(255, 255, 0, 0.1);
  border: 1px dashed rgba(255, 255, 0, 0.3);
}

.club-penguin-page.debug-mode .hotspot:hover {
  background: rgba(255, 255, 0, 0.2);
}

/* Collision Debug Visualization */
.club-penguin-page .debug-mode .collider {
  position: absolute;
  background: rgba(255, 0, 0, 0.15);
  border: 1px dashed rgba(255, 0, 0, 0.4);
  pointer-events: none;
  z-index: 5;
}

/* Debug Panel Styling */
.club-penguin-page #debug-panel h3 {
  color: #00ccff;
  margin-bottom: 15px;
  font-size: 16px;
  border-bottom: 1px solid #333;
  padding-bottom: 5px;
}

.club-penguin-page #debug-info {
  background: rgba(0, 0, 0, 0.5);
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-family: monospace;
  margin-bottom: 15px;
}

.club-penguin-page #debug-info div {
  margin: 2px 0;
}

.club-penguin-page #debug-tools {
  margin-top: 10px;
}

.club-penguin-page #rect-tool-btn,
.club-penguin-page #save-rects-btn,
.club-penguin-page #clear-rects-btn {
  background: #0066cc;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;

  font-size: 12px;
  width: 100%;
  margin-bottom: 5px;
}

.club-penguin-page #rect-tool-btn:hover,
.club-penguin-page #save-rects-btn:hover,
.club-penguin-page #clear-rects-btn:hover {
  background: #0052a3;
}

.club-penguin-page #rect-tool-btn.active {
  background: #00cc66;
}

.club-penguin-page #clear-rects-btn {
  background: #cc6600;
}

.club-penguin-page #clear-rects-btn:hover {
  background: #aa5500;
}

.club-penguin-page #rect-instructions {
  font-size: 11px;
  color: #00ff00;
  margin: 5px 0;
  text-align: center;
}

.club-penguin-page #rect-list h4 {
  color: #ffcc00;
  font-size: 13px;
  margin: 15px 0 10px 0;
}

.club-penguin-page #rect-items {
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 10px;
}

.club-penguin-page .rect-item {
  background: rgba(255, 255, 255, 0.1);
  padding: 5px 8px;
  margin: 3px 0;
  border-radius: 3px;
  font-size: 10px;
  font-family: monospace;
  position: relative;
}

.club-penguin-page .rect-item .delete-btn {
  position: absolute;
  right: 5px;
  top: 2px;
  background: #cc0000;
  color: white;
  border: none;
  width: 16px;
  height: 16px;
  border-radius: 2px;
  font-size: 10px;
  line-height: 1;
}

/* Drawing rectangle preview */
.club-penguin-page .drawing-rect {
  position: absolute;
  border: 2px dashed #00ff00;
  background: rgba(0, 255, 0, 0.1);
  pointer-events: none;
  z-index: 1000;
}

/* Interactive Elements */
.club-penguin-page .interactive-element {
  position: absolute;

  z-index: 50;
  transition: transform 0.1s ease;
}

.club-penguin-page .interactive-element:hover {
  transform: scale(1.05);
}

.club-penguin-page .interactive-element.button {
  background: #4caf50;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.club-penguin-page .interactive-element.button:hover {
  background: #45a049;
}

/* Dialogue System - Clean Text Only */
.club-penguin-page #dialogue-box {
  position: absolute;
  z-index: 1000;
  display: none;
  pointer-events: none;
}

.club-penguin-page #dialogue-box.active {
  display: block;
}

.club-penguin-page #dialogue-text {
  color: #000000;
  font-family: Arial, sans-serif;
  font-size: 18px;
  font-weight: normal;
  line-height: 1;
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
  background: #fff;
  cursor: pointer;
  pointer-events: all;
  transition:
    color 0.2s ease,
    text-shadow 0.2s ease;
  white-space: pre-line;
  /* Make text look pixelated/shitty */
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
  font-smooth: never;
  text-rendering: optimizeSpeed;
  text-shadow:
    0 0 4px rgba(0, 0, 0, 0.5),
    1px 1px 2px rgba(255, 255, 255, 0.8);
}

.club-penguin-page #dialogue-text:hover {
  color: #333333;
  text-shadow:
    0 0 8px rgba(0, 0, 0, 0.5),
    1px 1px 2px rgba(255, 255, 255, 0.8);
}

/* Hide unused elements */
.club-penguin-page #dialogue-speaker,
.club-penguin-page #dialogue-continue {
  display: none;
}

/* Fixed size - no responsive behavior */

/* Room Transition Effect */
.club-penguin-page .room-transition {
  animation: room-fade 0.5s ease-in-out;
}

@keyframes room-fade {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

/* Chat Input Bar */
.chat-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50px;
  background: rgba(0, 0, 0, 0.9);
  border-top: 2px solid #4ecdc4;
  display: none;
  z-index: 2000;
  padding: 10px;
  box-sizing: border-box;
  font-family: 'Courier New', monospace;
}

.chat-bar.open {
  display: block;
}

.chat-bar input {
  width: 100%;
  height: 30px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid #4ecdc4;
  border-radius: 4px;
  color: white;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  padding: 0 10px;
  outline: none;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.chat-bar input:focus {
  background: rgba(255, 255, 255, 0.2);
  border-color: #00ff00;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

/* Speech Bubble Styles */
.speech-bubble {
  position: absolute;
  background: rgba(255, 255, 255, 0.95);
  color: #000;
  padding: 8px 12px;
  border-radius: 15px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  max-width: 200px;
  width: max-content;
  word-wrap: break-word;
  line-height: 1.2;
  border: 2px solid #4ecdc4;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  z-index: 150;
  pointer-events: none;
  white-space: pre-wrap;
  animation: speech-bubble-appear 0.3s ease-out;
  /* Local player's bubble: positioned on the stage via left/top */
  transform: translate(-50%, -100%);
}

/* Remote players' bubbles: attached inside the player container */
.speech-bubble.attached {
  bottom: calc(100% + 32px);
  left: 50%;
  transform: translateX(-50%);
}

.speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid #4ecdc4;
}

@keyframes speech-bubble-appear {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}
