* {
  box-sizing: border-box;
}

/* Game fonts (bundled, SIL OFL - see assets/fonts/LICENSES.txt).
   "Kenney Future" was the original design's display face but was never shipped:
   the name now points to Tektur, so every place designed for it gets the sci-fi face. */
@font-face { font-family: "Kenney Future"; src: url("assets/fonts/tektur-500.woff") format("woff"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Tektur"; src: url("assets/fonts/tektur-400.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Tektur"; src: url("assets/fonts/tektur-500.woff") format("woff"); font-weight: 500 900; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("assets/fonts/poppins-400.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("assets/fonts/poppins-500.woff") format("woff"); font-weight: 500 600; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("assets/fonts/poppins-700.woff") format("woff"); font-weight: 700 900; font-display: swap; }

body {
  margin: 0;
  padding: 0;
  font-family: "Poppins", "Segoe UI", Arial, sans-serif;
  background: #050607;
  color: white;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

.game-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
}

canvas {
  display: block;
}

.welcome-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(3, 9, 18, 0.58), rgba(2, 5, 10, 0.94)),
    radial-gradient(circle at 18% 22%, rgba(125, 249, 255, 0.12) 0 1px, transparent 2px),
    radial-gradient(circle at 74% 18%, rgba(255, 209, 102, 0.1) 0 1px, transparent 2px),
    radial-gradient(circle at 58% 76%, rgba(255, 122, 26, 0.1) 0 1px, transparent 2px),
    #03070d;
  background-size: auto, 180px 180px, 240px 240px, 220px 220px, auto;
}

/* Prevent the legacy welcome markup from flashing before the enhanced menu mounts. */
.welcome-screen:not(.enhanced-welcome) {
  visibility: hidden;
  pointer-events: none;
}

.welcome-starfield {
  position: absolute;
  inset: -20%;
  opacity: 0.5;
  background:
    repeating-linear-gradient(105deg, rgba(125, 249, 255, 0.18) 0 1px, transparent 1px 78px),
    repeating-linear-gradient(15deg, rgba(255, 209, 102, 0.12) 0 1px, transparent 1px 112px);
  transform: translate3d(0, 0, 0);
  animation: welcomeStarDrift 18s linear infinite;
  pointer-events: none;
}

.welcome-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(340px, 1.05fr);
  gap: 22px;
  width: min(1120px, calc(100vw - 32px));
  min-height: min(680px, calc(100vh - 48px));
  padding: 22px;
  border: 1px solid rgba(125, 249, 255, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(8, 18, 31, 0.94), rgba(18, 10, 12, 0.94) 52%, rgba(4, 14, 22, 0.94)),
    repeating-linear-gradient(90deg, rgba(125, 249, 255, 0.045) 0 1px, transparent 1px 76px);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7), inset 0 0 42px rgba(73, 245, 255, 0.08);
}

.welcome-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 18px;
}

.welcome-copy h1 {
  margin: 8px 0 12px;
  color: #f8fbff;
  font-size: clamp(48px, 9vw, 104px);
  line-height: 0.84;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow: 0 0 34px rgba(73, 245, 255, 0.26), 0 10px 40px rgba(0, 0, 0, 0.65);
}

.welcome-copy p {
  max-width: 560px;
  margin: 0;
  color: #d9e4ec;
  font-size: 18px;
  line-height: 1.5;
}

.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.welcome-actions button {
  min-width: 156px;
  min-height: 52px;
  border-color: rgba(125, 249, 255, 0.26);
}

#welcomeMenuButton {
  background: linear-gradient(135deg, rgba(10, 25, 38, 0.96), rgba(52, 64, 76, 0.9));
}

.welcome-showcase {
  display: grid;
  grid-template-rows: 1fr auto;
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025)),
    rgba(2, 7, 13, 0.52);
  perspective: 980px;
}

.welcome-orbit {
  position: relative;
  min-height: 420px;
  transform-style: preserve-3d;
}

.welcome-ship {
  position: absolute;
  left: 50%;
  top: 48%;
  width: min(340px, 70vw);
  max-width: 86%;
  image-rendering: auto;
  filter: drop-shadow(0 24px 26px rgba(0, 0, 0, 0.62)) drop-shadow(0 0 28px rgba(255, 209, 102, 0.42));
  transform: translate(-50%, -50%) rotateX(58deg) rotateZ(-10deg) scale(1.04);
  animation: welcomeShipFloat 4.6s ease-in-out infinite;
}

.welcome-station {
  position: absolute;
  left: 50%;
  top: 53%;
  width: min(430px, 84vw);
  opacity: 0.44;
  filter: drop-shadow(0 0 22px rgba(73, 245, 255, 0.24));
  transform: translate(-50%, -50%) rotateX(62deg) scale(1.08);
}

.welcome-engine {
  position: absolute;
  left: 50%;
  top: 66%;
  width: 94px;
  height: 160px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(125, 249, 255, 0.9), rgba(255, 122, 26, 0.02));
  opacity: 0.72;
  filter: blur(10px);
  transform: translateX(-50%) rotateX(64deg);
  animation: welcomeEnginePulse 0.42s ease-in-out infinite alternate;
}

.welcome-target-ring {
  position: absolute;
  left: 50%;
  top: 51%;
  width: 330px;
  height: 330px;
  max-width: 76vw;
  max-height: 76vw;
  border: 1px solid rgba(255, 209, 102, 0.42);
  border-radius: 50%;
  box-shadow: inset 0 0 18px rgba(255, 209, 102, 0.14), 0 0 22px rgba(125, 249, 255, 0.12);
  transform: translate(-50%, -50%) rotateX(68deg);
}

.welcome-meteor {
  position: absolute;
  width: 78px;
  height: 78px;
  object-fit: contain;
  filter: drop-shadow(0 0 18px rgba(255, 122, 26, 0.58));
  animation: welcomeMeteorTumble 5s linear infinite;
}

.meteor-one {
  left: 11%;
  top: 18%;
}

.meteor-two {
  right: 11%;
  top: 22%;
  width: 66px;
  height: 66px;
  animation-duration: 6.2s;
}

.meteor-three {
  right: 20%;
  bottom: 17%;
  width: 92px;
  height: 92px;
  animation-duration: 4.4s;
}

.welcome-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.welcome-stat-grid span {
  min-height: 74px;
  padding: 10px;
  border: 1px solid rgba(125, 249, 255, 0.18);
  border-radius: 8px;
  background: rgba(4, 11, 20, 0.7);
  color: #cfe0eb;
  font-size: 13px;
}

.welcome-stat-grid strong {
  display: block;
  margin-bottom: 6px;
  color: #f9d66b;
  font-size: 18px;
}

@keyframes welcomeStarDrift {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(-80px, 50px, 0);
  }
}

@keyframes welcomeShipFloat {
  0%, 100% {
    transform: translate(-50%, -50%) rotateX(58deg) rotateZ(-10deg) scale(1.04);
  }
  50% {
    transform: translate(-50%, -54%) rotateX(58deg) rotateZ(-6deg) scale(1.09);
  }
}

@keyframes welcomeEnginePulse {
  from {
    opacity: 0.44;
    transform: translateX(-50%) rotateX(64deg) scaleY(0.82);
  }
  to {
    opacity: 0.84;
    transform: translateX(-50%) rotateX(64deg) scaleY(1.08);
  }
}

@keyframes welcomeMeteorTumble {
  from {
    transform: rotate(0deg) scale(1);
  }
  50% {
    transform: rotate(180deg) scale(1.08);
  }
  to {
    transform: rotate(360deg) scale(1);
  }
}

.hud {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 5;
  display: grid;
  gap: 6px;
  width: min(560px, calc(100vw - 28px));
  color: white;
  font-weight: 700;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.75);
  pointer-events: none;
}

#scoreDisplay,
#coinDisplay,
#lifeDisplay {
  font-size: 20px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#lifeDisplay {
  display: grid;
  grid-template-columns: auto 96px auto 96px;
  align-items: center;
  gap: 8px;
  max-width: 520px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(3, 8, 14, 0.44);
}

#lifeDisplay.life-damaged {
  background: rgba(255, 77, 77, 0.22);
  box-shadow: 0 0 18px rgba(255, 77, 77, 0.4);
}

.life-mini-bar {
  display: block;
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.life-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width 0.18s ease-out;
}

.hull-fill {
  background: linear-gradient(90deg, #ff4d4d, #ffd166);
}

.armor-fill {
  background: linear-gradient(90deg, #49f5ff, #7df9ff);
}

.carrier-fill {
  background: linear-gradient(90deg, #57ff7a, #ffd166);
}

.quest-tracker {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  width: min(330px, calc(100vw - 28px));
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(5, 8, 12, 0.72);
  color: #e8f4ff;
  font-size: 14px;
  line-height: 1.35;
  pointer-events: none;
  backdrop-filter: blur(8px);
}

.reward-overlay {
  position: fixed;
  inset: 0;
  z-index: 18;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 7, 17, 0.54);
  backdrop-filter: blur(10px);
}

.reward-modal {
  width: min(520px, calc(100vw - 32px));
  padding: 22px;
  border: 1px solid rgba(125, 249, 255, 0.36);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(12, 22, 38, 0.94), rgba(5, 9, 22, 0.96)),
    radial-gradient(circle at 20% 10%, rgba(73, 245, 255, 0.18), transparent 35%);
  color: #eff8ff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.48);
}

.reward-modal h2 {
  margin: 8px 0 10px;
  font-size: 28px;
}

.reward-modal p {
  margin: 0 0 18px;
  color: #cfe0eb;
  line-height: 1.45;
}

.reward-choice-area {
  display: grid;
  gap: 12px;
  margin: 0 0 16px;
}

.reward-choice-group {
  display: grid;
  gap: 8px;
}

.reward-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.reward-choice {
  min-height: 96px;
  padding: 10px;
  text-align: left;
  border-color: rgba(125, 249, 255, 0.18);
  background: linear-gradient(145deg, rgba(73, 245, 255, 0.08), rgba(255, 255, 255, 0.045));
}

.reward-model-window {
  display: grid;
  place-items: center;
  width: 100%;
  height: 88px;
  margin-bottom: 8px;
  border: 1px solid rgba(125, 249, 255, 0.22);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 40%, rgba(73, 245, 255, 0.18), rgba(2, 8, 16, 0.84));
  overflow: hidden;
}

.reward-model-window img {
  max-width: 92%;
  max-height: 92%;
  object-fit: contain;
  filter: drop-shadow(0 12px 12px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 14px rgba(125, 249, 255, 0.28));
  animation: menuModelFloat 3.4s ease-in-out infinite;
}

.reward-choice.selected {
  border-color: rgba(249, 214, 107, 0.72);
  box-shadow: 0 0 20px rgba(249, 214, 107, 0.18);
}

.reward-choice strong,
.reward-choice span {
  display: block;
}

@keyframes menuModelFloat {
  0%, 100% {
    transform: translateY(0) rotateZ(-2deg);
  }
  50% {
    transform: translateY(-5px) rotateZ(2deg);
  }
}

.reward-choice span {
  margin-top: 6px;
  color: #d9e4ec;
  font-size: 12px;
  line-height: 1.3;
}

.reward-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.reward-actions button {
  min-height: 44px;
}

.menu {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 20;
  width: min(1040px, calc(100vw - 28px));
  max-height: calc(100vh - 36px);
  overflow: auto;
  transform: translate(-50%, -50%);
  padding: 18px;
  border: 1px solid rgba(125, 249, 255, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(5, 12, 19, 0.99), rgba(10, 25, 38, 0.97) 48%, rgba(17, 14, 18, 0.96)),
    repeating-linear-gradient(90deg, rgba(73, 245, 255, 0.04) 0 1px, transparent 1px 82px),
    rgba(0, 0, 0, 0.9);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.72), inset 0 0 54px rgba(73, 245, 255, 0.11);
  text-align: left;
}

.menu h1,
.menu h2 {
  margin: 0;
  letter-spacing: 0;
}

.menu h1 {
  color: #f8fbff;
  font-size: clamp(38px, 7vw, 72px);
  line-height: 0.9;
  text-shadow: 0 0 28px rgba(73, 245, 255, 0.22);
}

.menu h2 {
  color: #f7e9bd;
  font-size: 22px;
}

.story {
  margin: 10px 0 0;
  max-width: 640px;
  color: #d9e4ec;
  line-height: 1.45;
}

.menu-frame {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(125, 249, 255, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.095), rgba(255, 255, 255, 0.025)),
    rgba(3, 7, 12, 0.38);
}

.menu-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 18px;
}

.menu-kicker,
.pilot-badge span,
.menu-dashboard span,
.profile-title {
  color: #7df9ff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.pilot-badge {
  min-width: 190px;
  padding: 12px 14px;
  border: 1px solid rgba(125, 249, 255, 0.24);
  border-radius: 8px;
  background: rgba(6, 14, 23, 0.72);
  box-shadow: inset 0 0 24px rgba(73, 245, 255, 0.06);
}

.pilot-badge strong {
  display: block;
  margin-top: 5px;
  color: #f9d66b;
  font-size: 22px;
}

.menu-dashboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.menu-dashboard div {
  min-height: 76px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(73, 245, 255, 0.08), rgba(255, 211, 79, 0.045));
}

.menu-dashboard strong {
  display: block;
  margin-top: 8px;
  color: #ffffff;
  font-size: 19px;
}

.menu-actions {
  display: grid;
  grid-template-columns: repeat(6, minmax(112px, 1fr));
  gap: 10px;
}

.shop-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.shop-tab {
  min-height: 40px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.08);
}

.shop-tab.active {
  border-color: rgba(249, 214, 107, 0.7);
  background: linear-gradient(135deg, rgba(249, 214, 107, 0.22), rgba(73, 245, 255, 0.1));
}

.profile-strip {
  display: grid;
  grid-template-columns: 1.25fr auto minmax(160px, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(249, 214, 107, 0.36);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(249, 214, 107, 0.13), rgba(73, 245, 255, 0.07));
  text-align: left;
}

.profile-strip small {
  display: block;
  margin-top: 4px;
  color: #d9e4ec;
}

.profile-strip label {
  color: #cfe0eb;
  font-size: 14px;
  font-weight: 700;
}

.profile-strip input {
  min-height: 42px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  color: white;
  font-size: 16px;
  font-weight: 700;
  padding: 8px 10px;
  outline: none;
}

.audio-strip {
  display: grid;
  grid-template-columns: 1fr auto auto minmax(180px, 260px) auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(125, 249, 255, 0.28);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(73, 245, 255, 0.12), rgba(255, 122, 26, 0.07));
  text-align: left;
}

.audio-strip small {
  display: block;
  margin-top: 4px;
  color: #d9e4ec;
}

.audio-strip label,
.audio-strip strong {
  color: #eaf6ff;
  font-size: 14px;
  font-weight: 800;
}

.audio-strip input[type="range"] {
  width: 100%;
  accent-color: #7df9ff;
  cursor: pointer;
}

.audio-strip button {
  min-width: 84px;
}

button {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, #143d5a, #14a7a0);
  color: white;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s, filter 0.16s, border-color 0.16s;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  border-color: rgba(255, 255, 255, 0.34);
}

button.selected,
button.active {
  background:
    linear-gradient(135deg, #4a3710, #14635e);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  filter: grayscale(0.25);
}

.menu-panel {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid rgba(73, 245, 255, 0.16);
  border-radius: 8px;
  background: rgba(4, 10, 17, 0.76);
  box-shadow: inset 0 0 28px rgba(73, 245, 255, 0.04);
  text-align: left;
}

.hidden {
  display: none !important;
}

.option-grid,
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.shop-list {
  display: grid;
  gap: 18px;
  margin-top: 12px;
}

.shop-section h2 {
  margin: 0 0 10px;
}

.option-card {
  min-height: 116px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: #eff8ff;
  text-align: left;
}

.option-card.rare-card {
  border-color: rgba(125, 249, 255, 0.34);
  background: linear-gradient(145deg, rgba(73, 245, 255, 0.1), rgba(255, 255, 255, 0.045));
}

.option-card.epic-card {
  border-color: rgba(255, 139, 209, 0.42);
  background: linear-gradient(145deg, rgba(255, 139, 209, 0.13), rgba(73, 245, 255, 0.055));
}

.option-card.legendary-card {
  border-color: rgba(249, 214, 107, 0.58);
  background: linear-gradient(145deg, rgba(249, 214, 107, 0.16), rgba(255, 122, 26, 0.08));
  box-shadow: inset 0 0 28px rgba(249, 214, 107, 0.06);
}

.rarity-label {
  display: inline-block;
  margin-bottom: 8px;
  color: #7df9ff;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.option-card.active {
  border-color: #f9d66b;
  box-shadow: inset 0 0 0 1px rgba(249, 214, 107, 0.3);
}

.option-card h3 {
  margin: 0 0 6px;
  color: white;
  font-size: 18px;
}

.option-card p {
  margin: 0 0 12px;
  color: #cfe0eb;
  font-size: 14px;
  line-height: 1.35;
}

.character-action-row {
  display: grid;
  grid-template-columns: 76px 1fr;
  align-items: center;
  gap: 12px;
}

.ship-skill-tree {
  display: grid;
  gap: 6px;
  margin: 10px 0 12px;
}

.ship-skill-node {
  display: grid;
  grid-template-columns: 54px 1fr;
  column-gap: 8px;
  min-height: 58px;
  padding: 8px 10px;
  text-align: left;
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(125, 249, 255, 0.16);
  box-shadow: none;
}

.ship-skill-node.owned {
  border-color: rgba(52, 211, 153, 0.5);
  background: rgba(52, 211, 153, 0.1);
}

.ship-skill-model {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid rgba(125, 249, 255, 0.2);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.26);
  overflow: hidden;
}

.ship-skill-model img {
  max-width: 96%;
  max-height: 96%;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(125, 249, 255, 0.35));
}

.ship-skill-node strong,
.ship-skill-node span {
  display: block;
}

.ship-skill-node span {
  margin-top: 4px;
  color: #cfe0eb;
  font-size: 12px;
  line-height: 1.3;
}

.hero-preview {
  position: relative;
  width: 70px;
  height: 64px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.16), transparent 36px),
    linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  overflow: hidden;
  perspective: 160px;
}

.hero-preview span {
  position: absolute;
  display: block;
  left: 50%;
  top: 50%;
}

.asset-preview-image {
  position: absolute;
  inset: 50% auto auto 50%;
  max-width: 84%;
  max-height: 84%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 0 12px rgba(125, 249, 255, 0.28)) drop-shadow(0 10px 14px rgba(0, 0, 0, 0.35));
  transform: translate(-50%, -50%);
  z-index: 3;
}

.hero-asset-image {
  max-width: 94%;
  max-height: 94%;
  animation: heroPreviewFloat 1.8s ease-in-out infinite;
}

.hero-aura {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  opacity: 0.26;
  filter: blur(2px);
  transform: translate(-50%, -50%) scale(1);
  animation: heroAuraPulse 1.7s ease-in-out infinite;
}

.hero-body {
  width: 24px;
  height: 34px;
  border-radius: 12px 12px 8px 8px;
  transform: translate(-50%, -42%);
  box-shadow: inset 0 -8px 10px rgba(0, 0, 0, 0.24);
  animation: heroPreviewFloat 1.8s ease-in-out infinite;
}

.hero-head {
  width: 18px;
  height: 16px;
  border-radius: 50%;
  transform: translate(-50%, -34px);
  background: rgba(255, 255, 255, 0.88);
  animation: heroPreviewFloat 1.8s ease-in-out infinite;
}

.hero-visor {
  width: 16px;
  height: 6px;
  border-radius: 999px;
  transform: translate(-50%, -34px);
  opacity: 0.9;
  animation: heroPreviewFloat 1.8s ease-in-out infinite;
}

.hero-wing {
  width: 22px;
  height: 8px;
  border-radius: 10px 2px 10px 2px;
  transform-origin: center;
  opacity: 0.92;
  animation: heroPreviewFloat 1.8s ease-in-out infinite;
}

.hero-wing.left {
  transform: translate(-32px, 2px) rotate(-22deg);
}

.hero-wing.right {
  transform: translate(10px, 2px) rotate(22deg);
}

.hero-engine {
  width: 9px;
  height: 22px;
  border-radius: 999px;
  transform: translate(-50%, 10px);
  opacity: 0.75;
  filter: blur(0.4px);
  animation: engineFlicker 0.22s infinite alternate;
}

.hero-preview.ship .hero-body {
  width: 26px;
  height: 42px;
  border-radius: 50% 50% 10px 10px;
  clip-path: polygon(50% 0, 92% 76%, 50% 100%, 8% 76%);
  transform: translate(-50%, -46%) rotateX(54deg) rotateZ(0deg);
  box-shadow: inset 0 -10px 12px rgba(0, 0, 0, 0.34), 0 8px 16px rgba(0, 0, 0, 0.28);
}

.hero-armor {
  width: 13px;
  height: 28px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--hero-color) 72%, #ffffff 28%);
  opacity: 0.9;
  transform: translate(-50%, -50%) rotateX(54deg);
  animation: heroPreviewFloat 1.8s ease-in-out infinite;
}

.hero-armor.left {
  transform: translate(-25px, -10px) rotateX(54deg) rotateZ(-18deg);
}

.hero-armor.right {
  transform: translate(12px, -10px) rotateX(54deg) rotateZ(18deg);
}

.hero-engine.left {
  transform: translate(-17px, 13px);
}

.hero-engine.right {
  transform: translate(8px, 13px);
}

.hero-ring {
  width: 48px;
  height: 24px;
  border: 2px solid var(--hero-accent);
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -48%) rotateX(68deg);
  animation: heroRingSpin 1.4s linear infinite;
}

.preview-heavy .hero-body,
.preview-industrial .hero-body,
.preview-shield .hero-body {
  width: 36px;
  height: 38px;
  clip-path: polygon(50% 0, 100% 58%, 78% 100%, 22% 100%, 0 58%);
}

.preview-heavy .hero-wing,
.preview-industrial .hero-wing,
.preview-shield .hero-wing {
  width: 30px;
  height: 12px;
}

.preview-dart .hero-body,
.preview-stealth .hero-body {
  width: 18px;
  height: 48px;
  clip-path: polygon(50% 0, 82% 74%, 50% 100%, 18% 74%);
}

.preview-dart .hero-wing.left,
.preview-stealth .hero-wing.left {
  transform: translate(-36px, 0) rotate(-12deg);
}

.preview-dart .hero-wing.right,
.preview-stealth .hero-wing.right {
  transform: translate(14px, 0) rotate(12deg);
}

.preview-phase .hero-ring,
.preview-shield .hero-ring,
.preview-scanner .hero-ring {
  opacity: 0.58;
}

.preview-pulse .hero-armor,
.preview-phase .hero-armor {
  border-radius: 50%;
  box-shadow: 0 0 14px var(--hero-accent);
}

.hero-preview.mech .hero-body {
  width: 32px;
  height: 30px;
  border-radius: 5px;
}

.hero-preview.mech .hero-head {
  width: 24px;
  height: 12px;
  border-radius: 4px;
  transform: translate(-50%, -30px);
}

.hero-preview.mech .hero-visor {
  transform: translate(-50%, -30px);
}

@keyframes heroPreviewFloat {
  0%, 100% {
    margin-top: -2px;
  }
  50% {
    margin-top: 3px;
  }
}

@keyframes heroAuraPulse {
  0%, 100% {
    transform: translate(-50%, -50%) scale(0.92);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.08);
  }
}

@keyframes engineFlicker {
  from {
    opacity: 0.42;
    height: 16px;
  }
  to {
    opacity: 0.88;
    height: 26px;
  }
}

@keyframes heroRingSpin {
  from {
    transform: translate(-50%, -48%) rotateX(68deg) rotateZ(0deg);
  }
  to {
    transform: translate(-50%, -48%) rotateX(68deg) rotateZ(360deg);
  }
}

.shop-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.shop-card-actions button {
  flex: 1 1 110px;
}

.weapon-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 10px 0;
}

.weapon-stat-grid span {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid rgba(119, 210, 255, 0.18);
  border-radius: 6px;
  background: rgba(8, 20, 32, 0.56);
  color: #b9d4e4;
  font-size: 12px;
  line-height: 1.25;
}

.weapon-stat-grid strong {
  display: block;
  color: #f7fbff;
  font-size: 13px;
  font-weight: 800;
}

.weapon-next-upgrade {
  margin: 0 0 10px;
  padding: 8px 9px;
  border-left: 3px solid #57ff7a;
  border-radius: 5px;
  background: rgba(52, 211, 153, 0.12);
  color: #d8fff0;
  font-size: 12px;
  line-height: 1.35;
}

.weapon-next-upgrade.maxed {
  border-left-color: #ffd166;
  background: rgba(255, 209, 102, 0.13);
  color: #fff2c0;
}

.upgrade-card,
.coin-pack-card {
  border-color: rgba(125, 249, 255, 0.22);
}

.coin-pack-card strong {
  color: #f9d66b;
}

.shop-note {
  margin: 0 0 10px;
  color: #cfe0eb;
  font-size: 13px;
  line-height: 1.35;
}

.weapon-preview {
  position: relative;
  height: 54px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.03));
  overflow: hidden;
}

.cosmetic-preview {
  position: relative;
  height: 54px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03));
  overflow: hidden;
}

.cosmetic-preview span {
  position: absolute;
  display: block;
  left: 50%;
  top: 50%;
}

.cosmetic-ship {
  width: 38px;
  height: 20px;
  border-radius: 50% 50% 8px 8px;
  transform: translate(-50%, -50%);
}

.cosmetic-aura {
  width: 58px;
  height: 34px;
  border: 2px solid;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.68;
}

.cosmetic-trail {
  width: 30px;
  height: 8px;
  border-radius: 12px;
  opacity: 0.7;
}

.cosmetic-trail.left {
  transform: translate(-42px, -50%);
}

.cosmetic-trail.right {
  transform: translate(12px, -50%);
}

.cosmetic-ring .cosmetic-aura {
  width: 68px;
  height: 40px;
}

.cosmetic-crown .cosmetic-ship::after {
  content: "";
  position: absolute;
  left: 8px;
  top: -9px;
  width: 22px;
  height: 10px;
  background: currentColor;
  clip-path: polygon(0 100%, 18% 10%, 38% 100%, 58% 10%, 78% 100%, 100% 10%, 100% 100%);
}

.weapon-preview span {
  position: absolute;
  display: block;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.weapon-asset-image {
  max-width: 76%;
  max-height: 88%;
  transform: translate(-50%, -50%) scale(1.08);
}

.weapon-core {
  width: 28px;
  height: 18px;
  border-radius: 6px;
  opacity: 0.92;
}

.weapon-barrel {
  width: 62px;
  height: 8px;
  border-radius: 8px;
  transform: translate(-50%, -50%) translateX(22px);
}

.weapon-side {
  width: 18px;
  height: 8px;
  border-radius: 8px;
  opacity: 0.78;
}

.weapon-side.left {
  transform: translate(-50%, -50%) translate(-18px, -13px);
}

.weapon-side.right {
  transform: translate(-50%, -50%) translate(-18px, 13px);
}

.weapon-repeater .weapon-barrel {
  height: 18px;
  background: repeating-linear-gradient(90deg, currentColor 0 6px, rgba(255,255,255,0.25) 6px 10px) !important;
}

.weapon-rail .weapon-barrel,
.weapon-needle .weapon-barrel {
  width: 82px;
  height: 4px;
}

.weapon-triple .weapon-side,
.weapon-dual .weapon-side,
.weapon-splitter .weapon-side {
  width: 44px;
}

.weapon-orb .weapon-core,
.weapon-nova .weapon-core {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.weapon-crystal .weapon-core {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  transform: translate(-50%, -50%) rotate(45deg);
}

.weapon-nova {
  box-shadow: inset 0 0 28px rgba(255, 211, 79, 0.25);
}

.swatch {
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-right: 8px;
  border: 2px solid rgba(255, 255, 255, 0.65);
  border-radius: 50%;
  vertical-align: -4px;
}

.quest-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.scoreboard-status {
  margin: 10px 0 12px;
  color: #cfe0eb;
  font-size: 14px;
}

.scoreboard-list {
  display: grid;
  gap: 8px;
}

.scoreboard-header-row {
  display: grid;
  grid-template-columns: 58px minmax(180px, 1fr) minmax(110px, 0.44fr) 90px 14px;
  align-items: center;
  gap: 10px;
  padding: 0 12px 4px;
  color: #7df9ff;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.scoreboard-row {
  display: grid;
  grid-template-columns: 58px minmax(180px, 1fr) minmax(110px, 0.44fr) 90px 14px;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(73, 245, 255, 0.065), rgba(255, 255, 255, 0.045));
}

.scoreboard-row.gold {
  border-color: rgba(249, 214, 107, 0.62);
  background: linear-gradient(135deg, rgba(249, 214, 107, 0.15), rgba(73, 245, 255, 0.04));
}

.scoreboard-row.silver {
  border-color: rgba(215, 225, 255, 0.44);
}

.scoreboard-row.bronze {
  border-color: rgba(255, 155, 66, 0.44);
}

.scoreboard-row.local-player {
  border-color: rgba(249, 214, 107, 0.7);
  background: rgba(249, 214, 107, 0.12);
}

.scoreboard-pilot strong,
.scoreboard-run strong {
  display: block;
}

.scoreboard-rank,
.scoreboard-score {
  color: #f9d66b;
  font-weight: 700;
}

.scoreboard-score {
  font-size: 22px;
  text-align: right;
}

.scoreboard-meta {
  display: block;
  margin-top: 3px;
  color: #cfe0eb;
  font-size: 13px;
}

.scoreboard-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.scoreboard-tags span {
  padding: 3px 7px;
  border: 1px solid rgba(125, 249, 255, 0.18);
  border-radius: 999px;
  background: rgba(125, 249, 255, 0.08);
  color: #dffbff;
  font-size: 11px;
}

.scoreboard-run span {
  display: block;
  margin-top: 3px;
  color: #cfe0eb;
  font-size: 13px;
}

.scoreboard-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #6b7280;
}

.scoreboard-status-dot.online {
  background: #34d399;
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.8);
}

.scoreboard-status-dot.away {
  background: #f7c948;
}

.quest-item {
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.quest-item strong {
  display: block;
  color: white;
  margin-bottom: 6px;
}

.quest-item span {
  color: #cfe0eb;
}

.progress-bar {
  height: 8px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
}

.progress-fill {
  height: 100%;
  border-radius: 8px;
  background: linear-gradient(90deg, #f7c948, #34d399);
}

.shop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#shopCoins {
  color: #f9d66b;
  font-weight: 700;
}

.game-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(125, 249, 255, 0.018), transparent 20%, transparent 84%, rgba(255, 122, 26, 0.02)),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 6px);
  opacity: 0.22;
}

canvas {
  filter: none;
}

.hud > div,
#statusDisplay {
  width: fit-content;
  max-width: 100%;
  padding: 6px 10px;
  border: 1px solid rgba(125, 249, 255, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(3, 10, 18, 0.72), rgba(8, 22, 34, 0.42)),
    repeating-linear-gradient(90deg, rgba(125, 249, 255, 0.055) 0 1px, transparent 1px 36px);
  box-shadow: inset 0 0 20px rgba(73, 245, 255, 0.06), 0 12px 28px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(8px);
}

#lifeDisplay {
  width: min(520px, 100%);
  border-color: rgba(125, 249, 255, 0.22);
  box-shadow: inset 0 0 18px rgba(73, 245, 255, 0.08), 0 0 20px rgba(73, 245, 255, 0.06);
}

.quest-tracker {
  border-color: rgba(249, 214, 107, 0.28);
  background:
    linear-gradient(145deg, rgba(8, 16, 26, 0.82), rgba(16, 18, 22, 0.72)),
    repeating-linear-gradient(90deg, rgba(255, 209, 102, 0.045) 0 1px, transparent 1px 52px);
  box-shadow: inset 0 0 26px rgba(249, 214, 107, 0.055), 0 20px 42px rgba(0, 0, 0, 0.3);
}

.menu {
  backdrop-filter: blur(15px) saturate(1.2);
  outline: 1px solid rgba(255, 255, 255, 0.08);
}

.menu::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent, rgba(125, 249, 255, 0.08), transparent),
    radial-gradient(circle at 12% 0%, rgba(255, 209, 102, 0.14), transparent 34%),
    radial-gradient(circle at 88% 8%, rgba(73, 245, 255, 0.12), transparent 30%);
  opacity: 0.78;
}

.menu > * {
  position: relative;
  z-index: 1;
}

.menu-frame,
.menu-panel,
.option-card,
.reward-choice,
.scoreboard-row {
  box-shadow: inset 0 0 28px rgba(73, 245, 255, 0.045), 0 14px 34px rgba(0, 0, 0, 0.2);
}

.option-card {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(15, 31, 45, 0.86), rgba(5, 11, 18, 0.76)),
    repeating-linear-gradient(90deg, rgba(125, 249, 255, 0.04) 0 1px, transparent 1px 42px);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.option-card::after {
  content: "";
  position: absolute;
  inset: auto 12px 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(125, 249, 255, 0.55), transparent);
  opacity: 0.7;
}

.option-card:hover {
  transform: translateY(-2px);
  border-color: rgba(125, 249, 255, 0.34);
  box-shadow: inset 0 0 34px rgba(73, 245, 255, 0.07), 0 18px 42px rgba(0, 0, 0, 0.28);
}

.option-card.active {
  border-color: rgba(249, 214, 107, 0.64);
  box-shadow: inset 0 0 36px rgba(249, 214, 107, 0.09), 0 0 28px rgba(249, 214, 107, 0.12);
}

.weapon-preview,
.cosmetic-preview,
.reward-model-window {
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.18), rgba(73, 245, 255, 0.08) 34%, rgba(2, 8, 16, 0.78)),
    repeating-linear-gradient(90deg, rgba(125, 249, 255, 0.04) 0 1px, transparent 1px 24px);
  box-shadow: inset 0 0 22px rgba(73, 245, 255, 0.08);
}

.scoreboard-row {
  background:
    linear-gradient(90deg, rgba(11, 24, 36, 0.82), rgba(6, 13, 21, 0.66)),
    repeating-linear-gradient(90deg, rgba(125, 249, 255, 0.035) 0 1px, transparent 1px 46px);
}

button {
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}

.controls {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 10;
}

@media (max-width: 700px) {
  .welcome-screen {
    padding: 12px;
  }

  .welcome-panel {
    grid-template-columns: 1fr;
    gap: 12px;
    min-height: calc(100vh - 24px);
    max-height: calc(100vh - 24px);
    overflow: auto;
    padding: 12px;
  }

  .welcome-copy {
    padding: 6px;
  }

  .welcome-copy h1 {
    font-size: clamp(44px, 17vw, 68px);
  }

  .welcome-copy p {
    font-size: 15px;
  }

  .welcome-actions {
    margin-top: 16px;
  }

  .welcome-actions button {
    width: 100%;
  }

  .welcome-showcase {
    padding: 10px;
  }

  .welcome-orbit {
    min-height: 260px;
  }

  .welcome-ship {
    width: min(290px, 78vw);
  }

  .welcome-target-ring {
    width: 230px;
    height: 230px;
  }

  .welcome-meteor {
    width: 54px;
    height: 54px;
  }

  .meteor-three {
    width: 64px;
    height: 64px;
  }

  .welcome-stat-grid {
    grid-template-columns: 1fr;
  }

  .hud,
  .quest-tracker {
    font-size: 13px;
  }

  #lifeDisplay {
    grid-template-columns: auto 1fr;
    font-size: 15px;
  }

  .quest-tracker {
    top: auto;
    right: 14px;
    bottom: 72px;
  }

  .menu {
    padding: 10px;
  }

  .menu-frame {
    padding: 14px;
  }

  .menu-hero,
  .menu-dashboard,
  .profile-strip,
  .audio-strip,
  .shop-tabs,
  .menu-actions,
  .scoreboard-header-row,
  .scoreboard-row {
    grid-template-columns: 1fr;
  }

  .scoreboard-header-row {
    display: none;
  }

  .scoreboard-score {
    text-align: left;
  }

  .menu-actions button {
    width: 100%;
  }

  .character-action-row {
    grid-template-columns: 64px 1fr;
  }

  .reward-actions {
    grid-template-columns: 1fr;
  }

  .reward-choice-grid {
    grid-template-columns: 1fr;
  }
}
