
body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f8ff; /* Light sky blue */
    color: #333;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; /* Align to top */
    min-height: 100vh;
    /*text-align: center;*/
    overflow: hidden; /* Hide scrollbars */
}

h1 {
    color: #003366; /* Navy blue */
    margin: 10px 0;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100vh;
    /*max-width: 90vw;*/
    /*max-height: 70vh;*/
    background:  url(bg-mark.png) center center no-repeat;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    border: 3px solid #003366;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.ship-status-display .ship-status {
    /*width: 48%;*/
    text-align: left;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.ship-status-display .ship-status.player {
    background: #e6f7ff;
    border-color: #b3e0ff;
}

.ship-status-display .ship-status.enemy {
    background: #fff0f0;
    border-color: #ffcccc;
}

.ship-status-display h3 {
    /*border-bottom: 2px solid #ccc;*/
}

.ship-status-display .player h3 {  color: #003366; }
.ship-status-display .enemy h3 { color: #a00; }

.ship-status-display p {
    font-weight: bold;
    font-size: 0.9em;
}

.ship-status-display .health-bar {
    width: 100%;
    height: 10px;
    background: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
}

.ship-status-display .health-bar-inner {
    height: 100%;
    background: #28a745; /* Green */
    transition: width 0.3s ease;
}

.ship-status-display .health-bar-inner.enemy {
    background: #dc3545; /* Red */
}

#controls {
    margin-top: 10px;
    background: #fff;
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    width: 800px;
    max-width: 90vw;
}

#controls p {
    margin: 5px 0;
    font-size: 0.9em;
}

#controls span {
    display: inline-block;
    background: #eee;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 2px 6px;
    font-weight: bold;
    box-shadow: 0 2px 2px rgba(0,0,0,0.1);
    margin: 0 4px;
}

/* Modal for starting game (required for audio) */
#startModal,
#constrolsModal,
#gameoverModal,
#pausedModal  {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000000;
}

#loadingEngineModal  {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /*background: rgba(0, 0, 0, 0.7);*/
    background: rgb(0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000000;
}

#loadingEngineModal {
    display:none;
}

#constrolsModal {
    display: none;
    background: transparent;
    transform:  rotateX(31deg) scale(1.5);
    transform-origin: center center;
    transition: transform 0.6s ease;
}

#pausedModal {
    display: none;
}
#gameoverModal {
    display: none;
}

#loadingEnemyModal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;            
    z-index: 1000000;
}

.modal-area {
    padding: 0px;
    font-size: 1.5em;
    font-weight: bold;
    font-family: 'Inter', sans-serif;
    color: white;
    background: transparent;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    width: 450px;
    margin: auto;
    margin-top: 50px;
    /*box-shadow: 0 5px 15px rgba(0,0,0,0.3);*/
    transition: all 0.2s ease;
}

.enemy-modal-area {
    padding: 0px;
    background: transparent;
    border: none;
    border-radius: 0px;
    cursor: pointer;
    width: 450px;
    margin: auto;
    margin-top: 50px;
    /*box-shadow: 0 5px 15px rgba(0,0,0,0.3);*/
    transition: all 0.2s ease;
}

#startButton,
#restartButton {
    padding: 20px 40px;
    font-size: 1.5em;
    font-weight: bold;
    font-family: 'Inter', sans-serif;
    color: white;
    background: #28a745;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
}

#restartButton  {
    font-size: small;
}

#controls-area {
    padding: 20px 40px;
    font-size: 1.5em;
    font-weight: bold;
    font-family: 'Inter', sans-serif;
    background: transparent;
    border: none;
    border-radius: 0px;
    cursor: pointer;
    box-shadow: 0 0px 0px rgba(0,0,0);
    transition: all 0.2s ease;
}

#controls-area .ctrl-key {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Positions for keys */
#key-w {
  /*top: 50%;*/
  top: 30%;
  left: 50%;
  transform: translateX(-50%) translateZ(50px);
}

#key-e {
  /*bottom: 60px;*/
  top: 40%;
  right: 35%;
  transform: translateX(-50%) translateZ(-30px) rotateY(-20deg);
}

#key-q {
  top: 40%;
  left: 35%;

  transform: translateX(50%) translateZ(-30px) rotateY(20deg);
}

#key-s {
  /*bottom: 10px;*/
  top:  70%;
  left: 50%;
  transform: translateX(-50%) translateZ(-80px);
}

/* Hover / active feedback */
.ctrl-key:hover {
  box-shadow: 0 0 25px rgba(0,255,255,0.8);
  transform: scale(1.1);
}

#startButton:hover {
    background: #218838;
    transform: translateY(-2px);
}

#startButton:disabled {
    background: #555;
    cursor: not-allowed;
}

.ship-status-display {
    transform: perspective(168px) rotateX(-8deg) scale(0.5);
    transform-origin: center center;
    transition: transform 0.6s ease;
    border-radius:6px; display:block;
    padding:7px
}

.rs-margin {
    margin:0px!important;
}

.damage-flicker-glow {
    /*background-color: rgba(220, 38, 38, 0.85);*/
    background-color: rgba(220, 38, 38, 0.7) !important;
}
.hud {
position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%);
display: flex; gap: 10px; padding: 2px;
background: transparent; 
border-radius: 8px; backdrop-filter: blur(3px);
font-family: system-ui, Segoe UI, Roboto, sans-serif; color: #e9ecef; user-select: none;
}
.slot {
position: relative; width: 64px; height: 64px; border-radius: 6px;
background: linear-gradient(#1b2127,#12171c); box-shadow: inset 0 0 0 1px #1f2b36;
display: grid; place-items: center; overflow: hidden;
}
/*.slot.active { outline: 2px solid #2af0c3; box-shadow: 0 0 0 2px rgba(42,240,195,.35); }*/
.icon {
    width: 75%; height: 75%; border-radius: 6px;
    background: linear-gradient(#3b4a57,#2c3946); box-shadow: inset 0 0 0 1px #526476;
    display:flex; align-items:center; justify-content:center; font-size: 26px;
}
.count {
    /*position: absolute; */
    /*right: 6px; bottom: 20px;*/
    background: red; 
    color: #fff;
    font-weight: bold;
    padding: 2px 6px; border-radius: 0px; 
    /*font-weight: 700;*/
    box-shadow: 0px 0px 2px rgba(0,0,0.3);
}
.ctrl-key {
    background: #1bbb96; 
    /*background: #2af0c3; */
    color: #fff;
    font-weight: bold;
    padding: 2px 6px; border-radius: 0px; 
    font-size: x-small;
    box-shadow: 0px 0px 2px rgba(0,0,0.3);
    min-width: 8px;
    display: inline-block;
}
.cool {
    position: absolute; left: 6px; right: 6px; top: 6px; height: 6px;
    background: rgba(255,255,255,.12); border-radius: 4px; overflow:hidden;
}
.cool > i {
    display:block; height:100%; width:0%;
    /*background: linear-gradient(90deg, #ffaa33, #ffd166);*/
    background: linear-gradient(90deg, #1bbb96, #1bbb96);
}
.key {
    position: absolute; left: 50%; bottom: -2px; transform: translate(-50%,100%);
    color:#cbd5e1; font-size: 12px; background:#222a; padding:2px 6px; border-radius:4px;
    box-shadow: 0 0 0 1px #333a;
}
/* Respect reduced-motion preferences */
/*@media (prefers-reduced-motion: reduce) {
  .damage-flicker,
  .damage-flicker-glow {
    animation: none;
    background-color: rgba(220, 38, 38, 0.25);
  }
}*/

.left-panel {
}
.nav-hud {
  position: fixed;
  top: 10px; 
  left: 30px;
  color: #cfe9ff;
  font-family: "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  user-select: none;
}

.ship-info {
  margin-bottom: 6px;
}

.ship-top {
  display: flex; align-items: center; gap: 8px;
}

.ship-icon {
  width: 80px; height: 16px;
  background: linear-gradient(to right, #28f3ff, #00aaff);
  border-radius: 4px;
  box-shadow: 0 0 8px #1efcff;
}

.ship-name {
  color: #0ff;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.ship-hp {
  margin-left: auto;
  font-weight: 500;
  color: #9effa3;
}

.autopilot {
  color: #b0c8df;
  font-size: 13px;
  margin-left: 0px;
}
.autopilot span {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 0 5px;
  border-radius: 3px;
  font-weight: 600;
  margin-right: 4px;
}

.mini-map {
  display: flex; gap: 12px; align-items: flex-end;
}

.speed-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  font-size: 13px;
  line-height: 18px;
}

.speed-block .highlight {
  color: #fff;
  background: rgba(255,255,255,0.15);
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 600;
  margin-top: 4px;
}

.speed {
  margin-top: 2px;
  color: yellow;
  font-weight: bold;
  font-size: 13px;
}
.battle-hud {
  position: fixed;
  top: 20px; left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; justify-content: center;
  width: 80%; max-width: 900px;
  color: #e0faff; font-family: "Segoe UI", Roboto, sans-serif;
  user-select: none;
}

.team {
  display: flex; align-items: center; gap: 8px;
  flex: 1;
}

.hp-bar {
  flex: 1; height: 10px;
  background: rgba(255,255,255,0.15);
  border-radius: 4px; overflow: hidden;
  box-shadow: inset 0 0 2px rgba(0,0,0,0.6);
}

#team-left .hp-fill {
  height: 100%;
  background: linear-gradient(90deg,#ff5533,#ff9966);
}

#team-right .hp-fill {
  /*background: linear-gradient(90deg,#ff5533,green);*/
  background: linear-gradient(90deg, green, #70f700);
  /*background: linear-gradient(90deg,#00ffaa,#0099ff);*/
}

.hp-text {
  font-weight: 600; font-size: 14px;
  text-shadow: 0 0 4px rgba(0,0,0,0.6);
}

.center-info {
  display: flex; flex-direction: column; align-items: center;
  width: 160px;
}

.timer {
  font-size: 15px; font-weight: 600; color: #fff;
  text-shadow: 0 0 6px rgba(0,0,0,0.5);
}

.score-bar {
  position: relative;
  width: 120px; height: 4px; margin: 4px 0;
  background: rgba(255,255,255,0.2);
  display: flex;
}

.ally-score {
  background: linear-gradient(90deg,#00e5ff,#00ffa6);
}

.enemy-score {
  background: linear-gradient(90deg,#ff6633,#ff4444);
}

.scores {
  font-weight: 700; font-size: 18px; color: #fff;
  text-shadow: 0 0 4px rgba(0,0,0,0.5);
}

.close-btn {
  position: absolute;
  right: 20px; top: 15px;
  font-size: 28px;
  color: #fff;
  cursor: pointer;
  transition: 0.3s;
}
.close-btn:hover { color: #ff5050; }

.ship-image {
  /*width: 100%;*/
  border-radius: 8px;
  margin-bottom: 15px;
  box-shadow: 0 0 12px rgba(0,0,0,0.4);
}

.ship-header h2 {
  margin: 0;
  font-size: 22px;
  color: #61dafb;
}

.ship-header .date {
  font-size: small;
  color: #9ec3ff;
  margin-top: 2px;
}

.description {
  margin: 8px 0;
  font-size: x-small;
  color: #fff;
  line-height: 1.5;
}

.stats {
  margin-top: 10px;
  padding: 10px;
  background: rgba(255,255,255,0.05);
  border-radius: 6px;
  font-size: 14px;
}
.stats div {
  margin: 5px 0;
}
.stats span {
  color: #8bd6ff;
  font-weight: 600;
}
.ship-details-preview {
    background: #000;
    max-width: 55vh;
    padding: 17px;
    border-radius: 0px;
}
.marea {
    margin:0px;
    padding:10px;
    font-size: small;
    background:#630303;
    color: #fff;
}
/* Splash Container */
#splashScreen {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 1.5s ease;
}

/* Background Image */
.splash-bg {
  position: absolute;
  width: 100%; height: 100%;
  object-fit: cover;
  filter: brightness(0.35) blur(1.5px);
  z-index: 0;
}

/* Overlay tint */
.splash-overlay {
  position: absolute;
  width: 100%; height: 100%;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6), rgba(0,15,30,0.9));
  z-index: 1;
}

/* Title & Text */
.splash-title {
  position: relative;
  z-index: 2;
  text-align: center;
  color: #dff6ff;
  text-shadow: 0 0 25px rgba(0,255,255,0.4);
  margin-bottom: 40px;
  animation: floatTitle 4s ease-in-out infinite alternate;
}
.splash-title h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: 58px;
  letter-spacing: 4px;
  margin-bottom: 10px;
}
.splash-title p {
  font-size: 18px;
  color: #aad4ff;
}

/* Start Button */
#startBtn {
  position: relative;
  z-index: 2;
  font-size: 20px;
  letter-spacing: 2px;
  padding: 14px 40px;
  border: 2px solid #00ccff;
  border-radius: 6px;
  background: rgba(0,0,0,0.4);
  color: #e0f7ff;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.3s ease;
  box-shadow: 0 0 15px rgba(0,255,255,0.2);
}
#startBtn:hover {
  background: rgba(0,180,255,0.3);
  transform: scale(1.05);
  box-shadow: 0 0 25px rgba(0,255,255,0.6);
}

/* Fade-out effect */
#splashScreen.fade-out {
  opacity: 0;
  pointer-events: none;
}

/* Floating title animation */
@keyframes floatTitle {
  from { transform: translateY(0px); }
  to { transform: translateY(-10px); }
}

/* Optional reflection effect */
.splash-title::after {
  content: attr(data-reflect);
  display: block;
  transform: scaleY(-1);
  color: rgba(180,230,255,0.2);
  margin-top: -20px;
  filter: blur(2px);
}
.enemy-card {
  right: 25px;
  width: 240px;
  background: rgba(20, 25, 30, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #e8f1f5;
  font-family: "Segoe UI", Roboto, sans-serif;
  backdrop-filter: blur(6px);
  padding: 0px;
  user-select: none;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
  transition: opacity 0.3s ease;
}

.enemy-header {
  display: flex;
  align-items: center;
  gap: 10px;
  /*margin-bottom: 8px;*/
}

.enemy-thumb {
/*  width: 56px;
  height: 38px;
*/  object-fit: cover;
  border-radius: 4px;
  opacity: 1;
  filter: grayscale(40%) brightness(0.8);
}

.enemy-info h3 {
  margin: 0;
  font-size: 15px;
  color: #f4f8fa;
  letter-spacing: 0.3px;
  font-weight: 600;
}

.enemy-info p {
  margin: 2px 0 0;
  font-size: 12px;
  color: rgba(220, 230, 240, 0.6);
}

.enemy-stats {
  margin-top: 6px;
}

.hp-bar {
  position: relative;
  width: 100%;
  height: 6px;
  /*background: rgba(255, 255, 255, 0.1);*/
  border-radius: 3px;
  overflow: hidden;
}

.hp-fill {
  height: 100%;
  /*background: rgba(255, 255, 255, 0.4);*/
  transition: width 0.4s ease;
}

.hp-text {
  font-size: 11px;
  color: rgba(235, 245, 255, 0.7);
  margin-top: 4px;
  text-align: right;
}

#team-right .hp-bar {
    /*background: green !important;*/
}
#team-left .hp-bar {
    /*background: red !important;*/
}

.steer-speed.active {
    background: #fff !important;
    color: #333;
    padding: 3px;
    border-radius:4px;
    text-shadow: 0px 0px 0px rgb(0, 0, 0) !important;
}
/* Main overlay */
#binocularOverlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
  display: none;
  backdrop-filter: brightness(0.9);
}

/* Dark circular mask for the binocular lenses */
.binocular-shadow {
  position: absolute;
  width: 100%; height: 100%;
  background: radial-gradient(
    circle at center,
    rgba(0, 0, 0, 0) 40%,
    rgba(0, 0, 0, 0.75) 70%,
    rgba(0, 0, 0, 0.9) 85%,
    rgba(0, 0, 0, 1) 100%
  );
}

/* Add shading around entire view for realism */
#binocularOverlay::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at center,
    rgba(0, 0, 0, 0) 45%,
    rgba(0, 0, 0, 0.5) 75%,
    rgba(0, 0, 0, 0.9) 100%
  );
}

/* Smooth fade in / out */
#binocularOverlay.show {
  opacity: 1;
  transition: opacity 0.5s ease-in;
}

#binocularOverlay.hide {
  opacity: 0;
  transition: opacity 0.5s ease-out;
}