* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  background: #000;
  color: #fff;
  font-family: Arial, sans-serif;
  overflow: hidden;
}

#game-root {
  position: relative;
  width: 100%;
  height: 100%;
}

#splash-overlay {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, rgba(8, 12, 30, 0.96) 0%, rgba(0, 0, 0, 0.98) 100%);
  color: #d9ecff;
}

.splash-card {
  width: min(960px, 92vw);
  max-height: 90vh;
  overflow: auto;
  border: 1px solid rgba(120, 170, 220, 0.35);
  border-radius: 14px;
  background: rgba(5, 10, 24, 0.88);
  padding: 24px;
  box-shadow: 0 0 28px rgba(70, 130, 210, 0.2);
}

.splash-type {
  font-family: "Orbitron", Arial, sans-serif;
  letter-spacing: 0.08em;
  white-space: pre-wrap;
}

#splash-title {
  text-align: center;
  font-size: clamp(28px, 4.4vw, 64px);
  font-weight: 900;
  min-height: 1.6em;
  margin-bottom: 22px;
  background: linear-gradient(180deg, #d8f0ff 0%, #8fd2ff 24%, #4f95d1 52%, #89c1ea 78%, #d9f3ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 12px rgba(88, 158, 210, 0.35);
}

#splash-cover-image {
  width: min(100%, 720px);
  max-height: 230px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(130, 190, 255, 0.3);
  display: block;
  margin: 0 auto 14px;
}

.splash-hint {
  margin-top: 14px;
  text-align: center;
  font-size: 13px;
  opacity: 0.8;
}

@media (min-width: 901px) and (pointer: fine) {
  .splash-hint {
    cursor: pointer;
  }
}

.splash-story-text {
  font-size: clamp(14px, 1.35vw, 20px);
  line-height: 1.65;
  min-height: 320px;
}

#splash-unlock-text {
  min-height: 130px;
  text-align: center;
}

#splash-welcome-text {
  min-height: 220px;
}

.splash-input {
  width: min(520px, 90%);
  display: block;
  margin: 8px auto 0;
  padding: 12px 14px;
  border: 1px solid rgba(124, 188, 235, 0.65);
  border-radius: 10px;
  outline: none;
  background: rgba(12, 26, 45, 0.95);
  color: #d9ecff;
  font-size: clamp(15px, 2.1vw, 22px);
  font-family: "Orbitron", Arial, sans-serif;
  text-align: center;
}

.splash-input:focus {
  border-color: #9ed9ff;
  box-shadow: 0 0 0 2px rgba(142, 207, 255, 0.18);
}

.splash-button {
  margin: 16px auto 0;
  display: block;
  cursor: pointer;
  border: 1px solid rgba(137, 216, 255, 0.9);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(40, 125, 180, 0.95) 0%, rgba(12, 58, 95, 0.95) 100%);
  color: #e8f6ff;
  padding: 10px 16px;
  font-size: clamp(14px, 2vw, 20px);
  font-family: "Orbitron", Arial, sans-serif;
}

.splash-button:hover {
  filter: brightness(1.12);
}

.splash-button:active {
  transform: translateY(1px);
}

.splash-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.25);
}

.splash-gender {
  margin: 12px auto 0;
  width: min(520px, 90%);
  display: flex;
  justify-content: center;
  gap: 16px;
  font-family: "Orbitron", Arial, sans-serif;
  font-size: clamp(13px, 1.5vw, 17px);
}

.splash-gender label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.splash-difficulty {
  margin: 12px auto 0;
  width: min(520px, 90%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  font-family: "Orbitron", Arial, sans-serif;
  font-size: clamp(13px, 1.5vw, 17px);
}

.splash-difficulty-label {
  width: 100%;
  text-align: center;
  opacity: 0.9;
}

.splash-difficulty label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  position: absolute;
  inset: 0;
}

#hud-top {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  z-index: 20;
}

.hud-item {
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 14px;
}

.hud-item-right {
  margin-left: auto;
}

#health-current {
  margin-top: 6px;
  width: 160px;
  height: 8px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(52, 10, 38, 0.9);
}

#health-current-fill {
  height: 100%;
  background: linear-gradient(90deg, #3dff78 0%, #ff2e8d 100%);
  transition: width 0.12s linear;
}

.health-spent {
  margin-top: 4px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
}

#death-message {
  position: absolute;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 26;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(32, 5, 5, 0.82);
  font-size: 14px;
  color: #ffd2d2;
}

#front-death-overlay {
  position: absolute;
  inset: 0;
  z-index: 24;
  pointer-events: none;
  background: radial-gradient(circle at center, rgba(255, 235, 120, 0.55) 0%, rgba(255, 70, 45, 0.7) 45%, rgba(120, 0, 0, 0.82) 100%);
}

#hud-bottom {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 20;
}

#minimap {
  width: 150px;
  height: 150px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 20, 0.7);
}

#overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
}

#overlay-content {
  text-align: center;
  background: rgba(12, 12, 25, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 18px;
  width: min(680px, 92vw);
  max-height: 90vh;
  overflow: auto;
}

#overlay-victory-image {
  width: min(520px, 90%);
  max-height: 42vh;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid rgba(157, 217, 255, 0.55);
  margin: 8px auto 10px;
  display: block;
}

#overlay-victory-text {
  width: min(560px, 90%);
  max-height: 26vh;
  overflow: auto;
  margin: 6px auto 14px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(137, 216, 255, 0.55);
  background: rgba(6, 24, 43, 0.85);
  font-family: "Orbitron", Arial, sans-serif;
  line-height: 1.55;
  font-size: clamp(14px, 1.4vw, 20px);
}

#restart-btn {
  cursor: pointer;
  border: 1px solid #89d8ff;
  background: #043e67;
  color: #fff;
  border-radius: 8px;
  padding: 10px 16px;
}

.hidden {
  display: none !important;
}

#mobile-controls {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 25;
  pointer-events: none;
}

.mobile-control-window {
  position: absolute;
  width: max-content;
  border-radius: 12px;
  border: 1px solid rgba(157, 217, 255, 0.6);
  background: rgba(6, 22, 40, 0.85);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  padding: 10px;
  display: flex;
  gap: 8px;
  pointer-events: auto;
  touch-action: none;
}

#mobile-controls-vertical {
  left: 12px;
  bottom: 62px;
  flex-direction: column-reverse;
}

#mobile-controls-horizontal {
  right: 12px;
  bottom: 12px;
  flex-direction: row;
}

#mobile-controls-fire {
  right: 12px;
  bottom: 80px;
}

#mobile-controls.drag-enabled .mobile-control-window {
  border-color: rgba(255, 110, 110, 0.95);
  box-shadow: 0 0 0 2px rgba(255, 90, 90, 0.26);
}

#mobile-controls button {
  width: 50px;
  height: 50px;
  border-radius: 10px;
  border: 1px solid #9ed9ff;
  background: rgba(18, 50, 78, 0.9);
  color: #fff;
  font-size: 18px;
}

#btn-fire {
  width: 110px !important;
  font-size: 11px !important;
  background: rgba(135, 25, 40, 0.92) !important;
}

#mobile-controls.drag-enabled button {
  opacity: 0.56;
}

#mobile-move-toggle {
  display: none;
  position: absolute;
  left: 12px;
  bottom: 12px;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: 1px solid #d7d7d7;
  background: #ffffff;
  z-index: 26;
  padding: 0;
}

#fullscreen-toggle {
  position: absolute;
  left: 12px;
  top: 12px;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: rgba(8, 20, 36, 0.9);
  z-index: 26;
  padding: 0;
  cursor: pointer;
}

.fullscreen-icon {
  position: absolute;
  inset: 0;
}

.fullscreen-enter::before,
.fullscreen-enter::after,
.fullscreen-exit::before,
.fullscreen-exit::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: #fff;
  border-style: solid;
}

.fullscreen-enter::before {
  left: 8px;
  top: 8px;
  border-width: 2px 0 0 2px;
  box-shadow: 14px 0 0 -10px #fff, 0 14px 0 -10px #fff, 14px 14px 0 -10px #fff;
}

.fullscreen-enter::after {
  right: 8px;
  bottom: 8px;
  border-width: 0 2px 2px 0;
}

.fullscreen-exit {
  display: none;
}

.fullscreen-exit::before {
  left: 11px;
  top: 11px;
  width: 8px;
  height: 8px;
  border-width: 2px 0 0 2px;
}

.fullscreen-exit::after {
  right: 11px;
  bottom: 11px;
  width: 8px;
  height: 8px;
  border-width: 0 2px 2px 0;
}

#fullscreen-toggle.is-fullscreen .fullscreen-enter {
  display: none;
}

#fullscreen-toggle.is-fullscreen .fullscreen-exit {
  display: block;
}

#mobile-move-toggle.active {
  background: #d13c3c;
  border-color: #f7b2b2;
}

.cross-arrow {
  position: absolute;
  color: #111;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

#mobile-move-toggle.active .cross-arrow {
  color: #fff;
}

.cross-arrow.up { top: 3px; left: 50%; transform: translateX(-50%); }
.cross-arrow.left { top: 50%; left: 4px; transform: translateY(-50%); }
.cross-arrow.right { top: 50%; right: 4px; transform: translateY(-50%); }
.cross-arrow.down { bottom: 3px; left: 50%; transform: translateX(-50%); }

#camera-controls {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 21;
  display: none;
  gap: 8px;
  align-items: center;
}

#camera-controls button {
  cursor: pointer;
  border: 1px solid rgba(137, 216, 255, 0.75);
  background: rgba(4, 62, 103, 0.9);
  color: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1;
}

#camera-controls #btn-zoom-in,
#camera-controls #btn-zoom-out {
  padding: 10px 16px;
  font-size: 18px;
}

@media (max-width: 900px), (pointer: coarse) {
  .splash-card {
    width: 94vw;
    padding: 16px;
  }

  #splash-title {
    margin-bottom: 12px;
  }

  #splash-cover-image {
    width: 100%;
    max-height: 38vh;
    object-fit: cover;
    margin-bottom: 10px;
  }

  #mobile-move-toggle {
    display: block;
  }

  #fullscreen-toggle {
    top: auto;
    left: 62px;
    bottom: 12px;
  }

  #mobile-controls {
    display: block;
  }

  #mobile-controls-vertical {
    left: 12px;
    right: auto;
    top: auto;
    bottom: 62px;
  }

  #mobile-controls-fire {
    right: 12px;
    left: auto;
    top: auto;
    bottom: 80px;
  }

  #mobile-controls-horizontal {
    right: 12px;
    left: auto;
    top: auto;
    bottom: 12px;
  }

  #camera-controls {
    display: flex;
    left: 12px;
    top: 108px;
    bottom: auto;
    gap: 6px;
    flex-wrap: wrap;
    max-width: 260px;
  }

  #hud-bottom {
    top: 108px;
    right: 12px;
    bottom: auto;
  }

  #minimap {
    width: 128px;
    height: 128px;
  }

  #camera-controls button {
    padding: 8px 10px;
    font-size: 12px;
  }
}

@media (min-width: 901px) and (pointer: fine) {
  #camera-controls {
    display: flex;
  }

  #camera-controls {
    bottom: 170px;
  }
}

@media (min-width: 901px) and (pointer: fine) {
  #hud-top {
    top: auto;
    bottom: 12px;
  }

  #hud-bottom {
    bottom: 170px;
  }
}

/* Кнопка меню паузы */
#btn-game-menu.game-menu-btn {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: 1px solid rgba(137, 216, 255, 0.75);
  background: rgba(4, 62, 103, 0.92);
  color: #dff6ff;
  font-size: 20px;
  line-height: 1;
  z-index: 26;
  padding: 0;
  cursor: pointer;
}

#btn-game-menu.game-menu-btn.is-disabled,
#btn-game-menu.game-menu-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.pause-overlay {
  position: absolute;
  inset: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 4, 12, 0.72);
  backdrop-filter: blur(4px);
}

.pause-overlay.hidden {
  display: none;
}

.pause-card {
  width: min(400px, 90vw);
  padding: 22px 24px 20px;
  border-radius: 14px;
  border: 1px solid rgba(120, 170, 220, 0.45);
  background: rgba(6, 14, 30, 0.94);
  box-shadow: 0 0 32px rgba(40, 90, 160, 0.35);
}

.pause-title {
  margin: 0 0 18px;
  font-family: "Orbitron", Arial, sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: center;
  color: #d9ecff;
}

.pause-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pause-button {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(137, 216, 255, 0.55);
  background: rgba(10, 52, 88, 0.95);
  color: #e8f7ff;
  font-family: "Orbitron", Arial, sans-serif;
  font-size: 15px;
  cursor: pointer;
}

.pause-button:hover {
  border-color: #b8e8ff;
  background: rgba(18, 72, 118, 0.98);
}

.pause-button-danger {
  border-color: rgba(255, 120, 120, 0.55);
  background: rgba(72, 18, 28, 0.92);
}

.pause-button-danger:hover {
  border-color: #ffb0b0;
  background: rgba(96, 28, 38, 0.95);
}

.pause-settings-body {
  min-height: 120px;
  margin-bottom: 16px;
  border-radius: 10px;
  border: 1px dashed rgba(120, 170, 220, 0.35);
  background: rgba(2, 8, 20, 0.65);
}

@media (max-width: 900px), (pointer: coarse) {
  #btn-game-menu.game-menu-btn {
    top: 52px;
    right: 12px;
  }
}
