canvas {
    position: fixed;
    top: 0;
    left: 0;
}

main {
    position: absolute;
    z-index: 1;
}

 .power-overlay {
    position: absolute;
    background: rgba(0, 20, 40, 0.9);
    border: 2px solid #00ffff;
    border-radius: 8px;
    padding: 20px;
    color: #00ffff;
    font-family: 'Courier New', monospace;
    z-index: 1000;
    min-width: 250px;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
  }
  
  .overlay-header {
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
  }

    .points-tracker-header {
    text-align: left;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 2px;
  }
  
  .power-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    table-layout: fixed;
    max-width: 100%;
  }
  
  .power-table th,
  .power-table td {
    border: 1px solid #00ffff;
    padding: 8px 12px;
    text-align: center;
  }
  td.point-spaces {
    height: 60px;
  }

  td.point-numbers {
    border:none;
  }  
  /* Point spaces with alliance colors */
  td.point-spaces {
    position: relative;
    border: 1px solid rgba(0, 255, 255, 0.3);
    min-height: 20px;
  }
  
  /* Hover effect to show score information */
  td.point-spaces:not(:empty):hover {
    box-shadow: 0 0 8px rgba(0, 255, 255, 0.6);
    transform: scale(1.1);
    z-index: 100;
    position: relative;
  }
  .power-table.points-tracker td {
    width: 45px;
  }
  .power-table th {
    background: rgba(0, 255, 255, 0.2);
    font-weight: bold;
  }
  
  .power-table tr:nth-child(even) {
    background: rgba(0, 255, 255, 0.1);
  }
  
  /* Overlay Toggle Panel */
  .overlay-toggle-panel {
    position: fixed;
    top: 280px; /* Position below points tracker */
    left: 20px;
    background: rgba(0, 20, 40, 0.95);
    border: 2px solid #00ffff;
    border-radius: 8px;
    padding: 15px;
    color: #00ffff;
    font-family: 'Courier New', monospace;
    z-index: 1001;
    min-width: 180px;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
  }
  
  .toggle-header {
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(0, 255, 255, 0.3);
    padding-bottom: 8px;
  }
  
  .toggle-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  
  .toggle-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
  }
  
  .toggle-item:hover {
    background: rgba(0, 255, 255, 0.1);
  }
  
  .toggle-item input[type="checkbox"] {
    appearance: none;
    width: 16px;
    height: 16px;
    border: 1px solid #00ffff;
    border-radius: 3px;
    background: transparent;
    position: relative;
    cursor: pointer;
  }
  
  .toggle-item input[type="checkbox"]:checked {
    background: #00ffff;
  }
  
  .toggle-item input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: -2px;
    left: 1px;
    color: #001428;
    font-size: 12px;
    font-weight: bold;
  }
  
  .toggle-label {
    font-size: 12px;
    user-select: none;
  }
  
  /* Mobile responsiveness for toggle panel */
  @media (max-width: 768px) {
    .overlay-toggle-panel {
      top: 320px; /* More space on mobile */
      left: 10px;
      min-width: 160px;
      padding: 12px;
    }
    
    .toggle-header {
      font-size: 12px;
    }
    
    .toggle-label {
      font-size: 11px;
    }
  }
  
  .close-overlay {
    position: absolute;
    top: 5px;
    right: 10px;
    background: none;
    border: none;
    color: #00ffff;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .close-overlay:hover {
    background: rgba(255, 0, 0, 0.3);
    border-radius: 50%;
  }

/* Planet Labels */
.planet-labels {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1000;
}

.planet-label {
  position: absolute;
  display: none; /* Initially hidden, positioned by JavaScript */
  background: rgba(0, 20, 40, 0.9);
  border: 1px solid #00ffff;
  border-radius: 6px;
  padding: 8px 12px;
  color: #00ffff;
  font-family: 'Courier New', monospace;
  text-align: center;
  min-width: 120px;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
  pointer-events: auto;
  transform: translateX(-50%) translateY(-100%); /* Center above sphere */
}

.planet-name {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.system-name {
  font-weight: 400;
  font-size: 12px;
  line-height: 1.2;
  font-style: italic;
  opacity: 0.8;
}

/* Power levels overlay positioning */
.planet-power-overlays {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 999;
}

.planet-power-overlay {
  position: absolute;
  display: none; /* Initially hidden, positioned by JavaScript */
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #333;
  border-radius: 4px;
  padding: 4px;
  pointer-events: auto;
  transform: translateX(0%) translateY(-50%);
  width: 160px;
  overflow: hidden;
  box-sizing: border-box;
}

.power-table .level-header {
  background: rgba(0, 20, 40, 0.8);
  color: #00ffff;
  font-weight: bold;
  width: 22px;
  max-width: 22px;
  text-align: center;
  font-size: 9px;
  padding: 2px;
  overflow: hidden;
  white-space: nowrap;
  box-sizing: border-box;
}

.power-table .level-label {
  background: rgba(0, 20, 40, 0.8);
  color: #00ffff;
  font-weight: bold;
  width: 22px;
  max-width: 22px;
  text-align: center;
  font-size: 10px;
  padding: 2px;
  overflow: hidden;
  white-space: nowrap;
  box-sizing: border-box;
}

.power-table .power-cell {
  text-align: center;
  width: 18px;
  max-width: 18px;
  height: 16px;
  min-height: 16px;
  vertical-align: middle;
  border: 1px solid #333;
  overflow: hidden;
  white-space: nowrap;
  box-sizing: border-box;
}

/* Infrastructure overlays positioning */
.planet-infrastructure-overlays {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 998; /* Below power overlays */
}

.planet-infrastructure-overlay {
  position: absolute;
  display: none; /* Initially hidden, positioned by JavaScript */
  background: rgba(0, 20, 40, 0.9);
  border: 1px solid #00ffff;
  border-radius: 6px;
  padding: 8px;
  pointer-events: auto;
  transform: translateX(0%) translateY(-50%);
  max-width: 200px;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

.infrastructure-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, 40px);
  gap: 3px;
  max-width: 300px;
}

.infrastructure-item {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.infrastructure-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  box-sizing: border-box;
}

.infrastructure-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: rgba(0, 20, 40, 0.6);
  border: 2px solid #00ffff;
}

/* Theatre overlays positioning */
.planet-theatre-overlays {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 997; /* Below infrastructure overlays */
}

.planet-theatre-overlay {
  position: absolute;
  display: none; /* Initially hidden, positioned by JavaScript */
  background: rgba(0, 20, 40, 0.9);
  border: 1px solid #00ffff;
  border-radius: 6px;
  padding: 8px;
  pointer-events: auto;
  transform: translateX(0%) translateY(50%);
  max-width: 200px;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

.theatre-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, 40px);
  gap: 3px;
  max-width: 300px;
}

.theatre-item {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theatre-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  box-sizing: border-box;
}

.theatre-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: rgba(0, 20, 40, 0.6);
  border: 2px solid #00ffff;
}

/* Fleet overlays positioning */
.planet-fleet-overlays {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 996; /* Below theatre overlays */
}

.planet-fleet-overlay {
  position: absolute;
  display: none; /* Initially hidden, positioned by JavaScript */
  background: rgba(0, 20, 40, 0.9);
  border: 1px solid #00ffff;
  border-radius: 6px;
  padding: 8px;
  pointer-events: auto;
  transform: translateX(0%) translateY(100%);
  max-width: 200px;
  min-width: 120px;
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

.fleet-header {
  color: #00ffff;
  font-weight: bold;
  font-size: 12px;
  margin-bottom: 4px;
  padding: 2px 4px;
  text-align: center;
  border-bottom: 1px solid #00ffff;
  font-family: 'Courier New', monospace;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.infrastructure-header {
  color: #00ffff;
  font-weight: bold;
  font-size: 12px;
  margin-bottom: 4px;
  padding: 2px 4px;
  text-align: center;
  border-bottom: 1px solid #00ffff;
  font-family: 'Courier New', monospace;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.theatre-header {
  color: #00ffff;
  font-weight: bold;
  font-size: 12px;
  margin-bottom: 4px;
  padding: 2px 4px;
  text-align: center;
  border-bottom: 1px solid #00ffff;
  font-family: 'Courier New', monospace;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.fleet-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fleet-item {
  padding: 4px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: bold;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .planet-label {
    padding: 6px 10px;
    min-width: 100px;
  }
  
  .planet-name {
    font-size: 13px;
  }
  
  .system-name {
    font-size: 11px;
  }

  .planet-power-overlay {
    width: 140px;
    overflow: hidden;
    box-sizing: border-box;
  }
  
  .power-table {
    font-size: 9px;
    table-layout: fixed;
    max-width: 100%;
  }
  
  .power-table th {
    font-size: 7px;
    padding: 1px;
  }
  
  .power-table .power-cell {
    width: 16px;
    max-width: 16px;
    height: 14px;
    min-height: 14px;
    overflow: hidden;
    white-space: nowrap;
    box-sizing: border-box;
  }
  
  .power-table .level-header,
  .power-table .level-label {
    width: 18px;
    max-width: 18px;
    font-size: 8px;
    overflow: hidden;
    white-space: nowrap;
    box-sizing: border-box;
  }

  .infrastructure-grid {
    grid-template-columns: repeat(auto-fit, 30px);
    gap: 2px;
  }
  
  .infrastructure-item {
    width: 30px;
    height: 30px;
  }
  
  .infrastructure-icon {
    width: 30px;
    height: 30px;
  }

  .infrastructure-placeholder {
    width: 30px;
    height: 30px;
  }

  .theatre-grid {
    grid-template-columns: repeat(auto-fit, 30px);
    gap: 2px;
  }
  
  .theatre-item {
    width: 30px;
    height: 30px;
  }
  
  .theatre-icon {
    width: 30px;
    height: 30px;
  }

  .theatre-placeholder {
    width: 30px;
    height: 30px;
  }

  .fleet-item {
    font-size: 10px;
    padding: 3px 4px;
  }

  .fleet-header {
    font-size: 10px;
  }

  .infrastructure-header {
    font-size: 10px;
  }

  .theatre-header {
    font-size: 10px;
  }
}