:root {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: #f4fbff;
  background-color: #0c1b2e;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#app {
  position: relative;
}

canvas {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 0;
}

.panel {
  background: rgba(18, 40, 63, 0.78);
  border: 1px solid rgba(149, 237, 255, 0.82);
  border-radius: 8px;
  padding: 10px 12px;
  min-width: 230px;
  line-height: 1.5;
  color: #f7fcff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
}

.top-status {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(460px, calc(100vw - 28px));
  pointer-events: none;
  z-index: 20;
}

.mission-status {
  position: absolute;
  top: 112px;
  left: 50%;
  transform: translateX(-50%);
  width: min(460px, calc(100vw - 28px));
  min-width: 0;
  padding: 6px 10px;
  line-height: 1.2;
  font-size: 0.84rem;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  z-index: 20;
}

.info-panel {
  width: 100%;
  max-width: 360px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.bar-row strong {
  width: 52px;
  font-size: 0.86rem;
}

.bar-row span {
  width: 54px;
  text-align: right;
  font-size: 0.83rem;
  opacity: 0.95;
}

.stat-bar {
  position: relative;
  width: 100%;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(220, 245, 255, 0.55);
  background: rgba(8, 20, 34, 0.65);
}

.stat-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  transition: width 140ms linear;
}

.hull-fill {
  background: linear-gradient(90deg, #63c4ff, #9de2ff);
}

.shield-fill {
  background: linear-gradient(90deg, #ff6f77, #ffa8ad);
  z-index: 2;
}

.shield-trail-fill {
  background: linear-gradient(90deg, rgba(150, 30, 35, 0.85), rgba(210, 70, 75, 0.9));
  z-index: 1;
}

.laser-fill {
  background: linear-gradient(90deg, #6eff8c, #b9ff8a);
}

.reticle {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 170, 140, 0.95);
  border-radius: 50%;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 21;
}

.damage-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 22;
  opacity: 0;
  transition: opacity 35ms linear;
  background: radial-gradient(
    circle at center,
    rgba(255, 0, 0, 0) 24%,
    rgba(255, 30, 45, 0.35) 50%,
    rgba(255, 0, 20, 0.88) 100%
  );
  box-shadow: inset 0 0 170px rgba(255, 15, 25, 0.62), inset 0 0 34px rgba(255, 0, 10, 0.35);
}

.critical-banner {
  position: absolute;
  left: 50%;
  top: calc(50% - 48px);
  transform: translateX(-50%);
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 120, 120, 0.85);
  background: rgba(120, 0, 10, 0.52);
  color: #ffd9d9;
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  font-weight: 700;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 22;
  opacity: 0;
  transition: opacity 120ms linear;
}

.critical-banner.visible {
  opacity: 1;
}

.hit-arcs {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1px;
  height: 1px;
  pointer-events: none;
  z-index: 22;
}

.hit-arc {
  position: absolute;
  left: 0;
  top: 0;
  width: 76px;
  height: 76px;
  border-radius: 50%;
}

.hit-arc::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -13px;
  width: 18px;
  height: 5px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 60, 60, 0.15), rgba(255, 90, 90, 0.95), rgba(255, 60, 60, 0.15));
  box-shadow: 0 0 8px rgba(255, 80, 80, 0.7);
}

.reticle.hit {
  border-color: rgba(130, 255, 170, 0.98);
  box-shadow: 0 0 12px rgba(120, 255, 170, 0.8);
}

.reticle.miss {
  border-color: rgba(255, 220, 120, 0.98);
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}

.dot-core {
  background: #7dffe9;
}

.dot-station {
  background: #88c6ff;
}

.dot-exit {
  background: #d2ff9f;
}

.dot-enemy {
  background: #ff9f98;
}

.shot-feedback {
  position: absolute;
  left: 50%;
  top: calc(50% + 30px);
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 100ms linear;
  z-index: 21;
}

.shot-feedback.visible {
  opacity: 1;
}

.shot-feedback.hit {
  background: rgba(70, 170, 100, 0.7);
  border: 1px solid rgba(120, 255, 170, 0.9);
}

.shot-feedback.miss {
  background: rgba(140, 110, 40, 0.65);
  border: 1px solid rgba(255, 220, 120, 0.9);
}

.banner {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 8, 20, 0.58);
  z-index: 40;
  pointer-events: auto;
}

.banner.visible {
  display: flex;
}

.banner-card {
  border: 1px solid rgba(149, 237, 255, 0.9);
  border-radius: 10px;
  padding: 22px;
  background: #163352;
  max-width: 520px;
  pointer-events: auto;
}

.restart-btn {
  margin-top: 10px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid rgba(149, 237, 255, 0.95);
  background: rgba(45, 100, 155, 0.75);
  color: #f4fbff;
  cursor: pointer;
  pointer-events: auto;
}

.help {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  border: 1px solid rgba(149, 237, 255, 0.8);
  border-radius: 8px;
  background: rgba(20, 44, 70, 0.8);
  padding: 8px 12px;
  font-size: 0.9rem;
  color: #f3fbff;
  z-index: 20;
}

.mobile-controls {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 30;
  pointer-events: auto;
}

.mobile-row {
  display: flex;
  gap: 8px;
}

.mobile-btn {
  min-width: 84px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(149, 237, 255, 0.95);
  background: rgba(20, 44, 70, 0.86);
  color: #f4fbff;
  font-size: 0.84rem;
  font-weight: 600;
  touch-action: manipulation;
}

.mobile-btn.fire {
  background: rgba(120, 38, 38, 0.9);
  border-color: rgba(255, 150, 150, 0.95);
}

.mobile-btn:active {
  transform: scale(0.97);
}

.start-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 8, 20, 0.72);
  z-index: 38;
}

.start-overlay.visible {
  display: flex;
}

.start-card {
  border: 1px solid rgba(149, 237, 255, 0.9);
  border-radius: 10px;
  padding: 18px 20px;
  background: #163352;
  max-width: 460px;
  text-align: center;
}

.start-card h2 {
  margin: 0 0 10px;
}

.start-card p {
  margin: 8px 0;
}

@media (max-width: 768px) {
  .mission-status {
    top: 116px;
    width: min(420px, calc(100vw - 20px));
    font-size: 0.78rem;
  }

  .help {
    display: none;
  }

  .mobile-controls {
    display: flex;
    bottom: 8px;
  }
}
