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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #160205;
  color: #ffffff;
  font-family: 'Inter', sans-serif;
  user-select: none;
}

.stage {
  position: fixed;
  inset: 0;
  z-index: 1;
}

.stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 0 0 2px rgba(22, 2, 5, 0.45);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.crosshair.active {
  opacity: 1;
}

.loader {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: radial-gradient(circle at 50% 40%, #2c0409 0%, #160205 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-card {
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.loader-logo {
  height: 36px;
  width: auto;
  margin-bottom: 26px;
}

.loader-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}

.loader-status {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.68);
  margin-bottom: 20px;
}

.progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #bd0f34, #c96d52);
  transition: width 0.18s ease;
}

.progress-pct {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: #c96d52;
}

.hud {
  position: fixed;
  top: 20px;
  left: 24px;
  right: 24px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

.hud-group {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}

.btn-glass {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(22, 2, 5, 0.72);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #ffffff;
  text-decoration: none;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.btn-glass:hover {
  background: rgba(45, 5, 11, 0.9);
  border-color: rgba(255, 255, 255, 0.34);
  transform: translateY(-1px);
}

.hud-logo {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(22, 2, 5, 0.72);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.hud-logo img {
  height: 20px;
  width: auto;
  display: block;
}

.btn-red {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  background: #bd0f34;
  border: 1px solid #bd0f34;
  color: #ffffff;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.btn-red:hover {
  background: #9f0b2b;
  border-color: #9f0b2b;
  transform: translateY(-1px);
}

.welcome {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(22, 2, 5, 0.45);
  backdrop-filter: blur(6px);
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.welcome.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.welcome-card {
  width: 100%;
  max-width: 500px;
  padding: 36px 32px;
  border-radius: 22px;
  background: rgba(22, 2, 5, 0.86);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.welcome-tag {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(201, 109, 82, 0.18);
  color: #c96d52;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  margin-bottom: 16px;
}

.welcome-card h1 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 32px;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 12px;
}

.welcome-desc {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.74);
  margin-bottom: 24px;
}

.key-hints {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 26px;
  text-align: left;
}

.key-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
}

.key-item strong {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 11px;
  letter-spacing: 0.05em;
}

.btn-explore {
  width: 100%;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 700;
}

.controls-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(22, 2, 5, 0.74);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.view-btn {
  padding: 6px 14px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}

.view-btn.active {
  background: #bd0f34;
  color: #ffffff;
}

.bottom-hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.68);
  padding: 0 8px;
  white-space: nowrap;
}

.toast {
  position: fixed;
  top: 74px;
  right: 24px;
  z-index: 40;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(22, 2, 5, 0.9);
  border: 1px solid rgba(201, 109, 82, 0.5);
  color: #ffffff;
  font-size: 12px;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.pad {
  position: fixed;
  left: 20px;
  bottom: 80px;
  z-index: 25;
  display: none;
  grid-template-columns: repeat(3, 46px);
  grid-template-rows: repeat(3, 46px);
  gap: 6px;
}

.pad-btn {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(22, 2, 5, 0.72);
  backdrop-filter: blur(10px);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.pad-btn:active {
  background: #bd0f34;
}

.pad-up {
  grid-column: 2;
  grid-row: 1;
}

.pad-left {
  grid-column: 1;
  grid-row: 2;
}

.pad-right {
  grid-column: 3;
  grid-row: 2;
}

.pad-down {
  grid-column: 2;
  grid-row: 3;
}

@media (hover: none) and (pointer: coarse) {
  .pad {
    display: grid;
  }

  .bottom-hint {
    display: none;
  }
}

@media (max-width: 768px) {
  .hud {
    top: 14px;
    left: 14px;
    right: 14px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .hud-group {
    gap: 6px;
  }

  .hud-logo {
    display: none;
  }

  .btn-glass,
  .btn-red {
    padding: 7px 11px;
    font-size: 11px;
    white-space: nowrap;
  }

  .btn-explore {
    padding: 14px 24px;
    font-size: 15px;
  }

  .bottom-hint {
    display: none;
  }

  .welcome-card {
    padding: 28px 20px;
  }

  .welcome-card h1 {
    font-size: 26px;
  }

  .key-hints {
    grid-template-columns: 1fr;
  }

  .controls-bar {
    bottom: 14px;
    max-width: calc(100vw - 28px);
  }
}
