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

body {
    background-color: #000;
    color: #fff;
    font-family: 'Arial', sans-serif;
    overflow: hidden;
}

/* Canvas */
#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    display: none; /* Initially hidden until game starts */
}

/* Game Info Overlay */
.game-info {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 2;
    font-size: 18px;
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.7);
}

.game-info div {
    margin-bottom: 10px;
}

/* Level Message */
.level-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    font-size: 36px;
    font-weight: bold;
    color: #0ff;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 20px 40px;
    border-radius: 10px;
    display: none;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.7);
}

/* Game Over Screen */
.game-over {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 10;
}

.game-over h1 {
    font-size: 48px;
    margin-bottom: 20px;
    color: #f00;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.7);
}

.game-over p {
    font-size: 24px;
    margin-bottom: 30px;
}

/* Menu Screens */
.menu-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #000;
    background-image: 
        radial-gradient(white, rgba(255,255,255,.2) 2px, transparent 3px),
        radial-gradient(white, rgba(255,255,255,.15) 1px, transparent 2px),
        radial-gradient(white, rgba(255,255,255,.1) 2px, transparent 4px);
    background-size: 550px 550px, 350px 350px, 250px 250px;
    background-position: 0 0, 40px 60px, 130px 270px;
    z-index: 9;
}

.menu-container {
    background-color: rgba(0, 20, 40, 0.8);
    border: 2px solid #0066aa;
    border-radius: 10px;
    width: 80%;
    max-width: 800px;
    padding: 30px;
    box-shadow: 0 0 20px rgba(0, 100, 255, 0.5);
}

.game-title {
    font-size: 60px;
    text-align: center;
    margin-bottom: 40px;
    color: #0ff;
    text-shadow: 0 0 15px rgba(0, 255, 255, 0.7);
    letter-spacing: 8px;
    font-weight: bold;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.menu-button {
    background-color: #1a5a7a;
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 18px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
    width: 60%;
    text-align: center;
    letter-spacing: 1px;
    font-weight: bold;
}

.menu-button:hover {
    background-color: #2a6a8a;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 100, 200, 0.3);
}

/* Ship Customization Screen */
.ship-captain-section {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ship-captain-section label {
    color: #9ab;
    font-size: 16px;
}

.ship-captain-section input {
    background-color: #123;
    border: 1px solid #345;
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 16px;
    flex: 1;
}

.ship-captain-section input:focus {
    outline: none;
    border-color: #0ff;
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.3);
}

.main-content {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
}

.design-section {
    flex: 2;
    min-width: 300px;
}

.preview-section {
    flex: 1;
    min-width: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.drawing-canvas-container {
    background-color: #000;
    border: 2px solid #234;
    border-radius: 8px;
    width: 100%;
    height: 300px;
    margin-bottom: 15px;
    position: relative;
}

.ship-preview-container {
    background-color: #000;
    border: 2px solid #234;
    border-radius: 8px;
    width: 100%;
    height: 250px;
    margin-bottom: 15px;
    position: relative;
}

.ship-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.ship-option {
    background-color: #112;
    border: 2px solid #234;
    border-radius: 5px;
    padding: 8px 15px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.ship-option:hover {
    background-color: #123;
    transform: translateY(-2px);
}

.ship-option.selected {
    background-color: #124;
    border-color: #0ff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

.colors-panel {
    margin-bottom: 15px;
}

.colors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
    gap: 10px;
}

.color-option {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #333;
    cursor: pointer;
    transition: all 0.2s;
}

.color-option:hover {
    transform: scale(1.1);
    border-color: #555;
}

.color-option.selected {
    border-color: #fff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.status-bar {
    display: flex;
    justify-content: space-between;
    background-color: rgba(0, 30, 60, 0.5);
    border-radius: 4px;
    padding: 8px 15px;
    margin-bottom: 15px;
}

.instruction-panel {
    background-color: rgba(0, 30, 60, 0.3);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.instruction-panel ul {
    margin-left: 20px;
    color: #9ab;
}

.instruction-panel li {
    margin-bottom: 5px;
}

.drawing-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 15px;
}

.button {
    background-color: #124;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.button:hover {
    background-color: #235;
    transform: translateY(-2px);
}

.button.clear {
    background-color: #612;
}

.button.clear:hover {
    background-color: #723;
}

.center-point {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

/* High Scores Screen */
.high-scores-list {
    width: 100%;
    margin-bottom: 30px;
    max-height: 400px;
    overflow-y: auto;
}

.high-score-item {
    display: grid;
    grid-template-columns: 0.5fr 2fr 1fr 1fr 1fr;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid #234;
}

.high-score-item.header {
    font-weight: bold;
    color: #0ff;
    border-bottom: 2px solid #0ff;
}

.high-score-item.has-ship {
    cursor: pointer;
    transition: all 0.2s;
}

.high-score-item.has-ship:hover {
    background-color: rgba(0, 255, 255, 0.1);
}

.empty-scores {
    text-align: center;
    padding: 30px;
    color: #9ab;
    font-style: italic;
}

/* High Score Entry */
.high-score-entry {
    background-color: rgba(0, 50, 100, 0.5);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    text-align: center;
}

.high-score-entry p {
    color: #0ff;
    font-size: 24px;
    margin-bottom: 20px;
}

.option-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.option-group label {
    margin-bottom: 10px;
}

.option-group input {
    background-color: #123;
    border: 1px solid #345;
    color: #fff;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 16px;
    width: 100%;
    max-width: 300px;
}

.option-group input:focus {
    outline: none;
    border-color: #0ff;
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.3);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .game-title {
        font-size: 40px;
    }
    
    .menu-button {
        width: 80%;
    }
    
    .main-content {
        flex-direction: column;
    }
    
    .high-score-item {
        grid-template-columns: 0.5fr 1.5fr 1fr 1fr;
    }
    
    .high-score-item .date {
        display: none;
    }
}

/* Animation styles */
@keyframes pulse {
    0% { transform: scale(0.5); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

.point-pulse {
    position: absolute;
    pointer-events: none;
    animation: pulse 0.5s forwards;
}

.draw-mode-container {
    margin-bottom: 15px;
  }
  
  /* Active state for draw mode buttons */
  .mode-button.active {
    background-color: #1a5a3a;
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  }
  
  /* Hover state for all mode buttons */
  .mode-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
  }

  .ship-mini-preview {
    width: 60px;
    height: 60px;
    background-color: #000;
    border: 1px solid #234;
    border-radius: 4px;
    overflow: hidden;
    margin: 0 auto;
  }
  
  .ship-mini-canvas {
    width: 100%;
    height: 100%;
  }
  
  /* Update your high-score-item class to include the ship preview cell */
  .high-score-item {
    display: grid;
    grid-template-columns: 0.5fr 2fr 1fr 80px 1fr;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid #234;
    align-items: center;
  }
  
  .high-score-item.has-ship {
    cursor: pointer;
  }
  
  .high-score-item.has-ship:hover {
    background-color: rgba(0, 255, 255, 0.1);
  }
  
  .ship-preview-cell {
    display: flex;
    justify-content: center;
  }

/* Multiplayer UI Styles */
.connection-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding: 10px;
  background-color: rgba(0, 255, 255, 0.1);
  border-radius: 5px;
  border: 1px solid #234;
}

.status-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #666;
}

.status-indicator.connected {
  background-color: #0f0;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
}

.status-indicator.disconnected {
  background-color: #f00;
  box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
}

.multiplayer-options {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.option-group {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.available-sessions h3,
.current-session h3 {
  color: #0ff;
  margin-bottom: 10px;
  text-align: center;
}

.sessions-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #234;
  background-color: rgba(0, 0, 0, 0.3);
  padding: 10px;
  border-radius: 5px;
}

.session-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  margin-bottom: 5px;
  background-color: rgba(0, 255, 255, 0.1);
  border-radius: 3px;
  border: 1px solid #234;
}

.session-item.loading,
.session-item.empty,
.session-item.error {
  justify-content: center;
  color: #888;
  font-style: italic;
}

.session-item.error {
  color: #f88;
}

.session-info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}

.join-button {
  padding: 5px 15px;
  background-color: #0080ff;
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  transition: background-color 0.3s;
}

.join-button:hover {
  background-color: #0066cc;
}

.current-session {
  padding: 15px;
  background-color: rgba(0, 255, 255, 0.1);
  border-radius: 5px;
  border: 1px solid #0ff;
}

.session-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 15px;
  font-size: 14px;
}

.players-list h4 {
  color: #0ff;
  margin-bottom: 8px;
}

.player-item {
  padding: 5px;
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
  margin-bottom: 3px;
  font-size: 12px;
}

.session-controls {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.menu-button.secondary {
  background-color: #666;
  border-color: #888;
}

.menu-button.secondary:hover {
  background-color: #777;
  border-color: #999;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .multiplayer-options {
    padding: 0 10px;
  }
  
  .option-group {
    flex-direction: column;
  }
  
  .session-item {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
  
  .session-controls {
    flex-direction: column;
  }
}
/* Ship Gallery Styles */
.ship-gallery-container {
  max-width: 900px;
}

.gallery-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 20px 0;
}

.gallery-nav-button {
  width: 60px;
  height: 60px;
  font-size: 32px;
  background-color: rgba(0, 100, 255, 0.3);
  border: 2px solid #0066aa;
  border-radius: 50%;
  color: #0ff;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-nav-button:hover:not(:disabled) {
  background-color: rgba(0, 150, 255, 0.5);
  transform: scale(1.1);
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
}

.gallery-nav-button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.gallery-ship-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.gallery-ship-preview {
  background-color: #000;
  border: 2px solid #0066aa;
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 0 20px rgba(0, 100, 255, 0.3);
}

#galleryShipCanvas {
  display: block;
  border-radius: 5px;
}

.gallery-ship-info {
  text-align: center;
  min-width: 300px;
}

.gallery-ship-info h3 {
  color: #0ff;
  font-size: 24px;
  margin-bottom: 10px;
  text-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.gallery-ship-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 20px;
  font-size: 14px;
  color: #aaa;
  margin-bottom: 10px;
}

.gallery-ship-details div {
  text-align: left;
}

.gallery-ship-details span {
  color: #fff;
}

.gallery-ship-passphrase {
  font-size: 12px;
  color: #666;
  padding: 8px;
  background-color: rgba(0, 0, 0, 0.3);
  border-radius: 5px;
  word-break: break-all;
}

.gallery-ship-passphrase span {
  color: #888;
  font-family: 'Courier New', monospace;
}

.gallery-counter {
  text-align: center;
  font-size: 18px;
  color: #0ff;
  margin-bottom: 20px;
}

.gallery-actions {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 20px;
}

.gallery-actions .menu-button {
  min-width: 150px;
}

/* Mobile responsive for gallery */
@media (max-width: 768px) {
  .gallery-content {
    flex-direction: column;
    gap: 15px;
  }
  
  .gallery-nav-button {
    width: 50px;
    height: 50px;
    font-size: 24px;
  }
  
  .gallery-ship-display {
    width: 100%;
  }
  
  #galleryShipCanvas {
    width: 250px;
    height: 250px;
  }
  
  .gallery-ship-info {
    min-width: auto;
    width: 100%;
  }
  
  .gallery-actions {
    flex-direction: column;
  }
  
  .gallery-actions .menu-button {
    width: 100%;
  }
}
