html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #000;
  color: #fff;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#stage {
  position: relative;
  width: min(100vw, 177.7777778vh);
  height: min(100vh, 56.25vw);
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

#bannerContainer {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#bannerContainer object {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#bgSVG {
  z-index: 1;
}
#shipSVG {
  z-index: 2;
}
#asteroidSVG {
  z-index: 3;
}

#UIContainer {
  position: absolute;
  top: 16px;
  right: 16px;
  transform: none;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.6rem;
  background: rgba(0, 0, 0, 0.6);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #555;
}

.ui-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

#debugPanel {
  display: none;
  gap: 0.75rem;
  align-items: flex-start;
}

#debugPanel.is-open {
  display: flex;
}

#UIContainer h2 {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
}

#UIContainer button {
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
}

#UIContainer button:hover {
  background: #444;
  color: #fff;
}

#buttonContainer,
#UIContainer fieldset {
  margin: 0;
  border: 1px solid #555;
  padding: 0.35rem 0.6rem;
}

#hud {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 12;
}

.hud-card {
  min-width: 190px;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(8, 8, 10, 0.45);
  backdrop-filter: blur(10px);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.5);
}

.hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.15rem 0;
}

.hud-label {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.75;
}

.hud-value {
  font-size: 1.05rem;
  font-weight: 700;
}

.hud-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.14);
  margin: 0.55rem 0;
}

.hud-pill {
  font-size: 0.85rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
}

.hud-pill.is-active {
  border-color: rgba(110, 215, 255, 0.6);
  background: rgba(110, 215, 255, 0.12);
}

.hud-pill.is-cooldown {
  border-color: rgba(255, 200, 120, 0.55);
  background: rgba(255, 200, 120, 0.12);
}

.property {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

#UIContainer ul {
  margin: 0;
  padding-left: 1rem;
}

.value {
  font-weight: bold;
}

.popup {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  z-index: 999;
}

.popup-inner {
  background: #111;
  padding: 2rem 3rem;
  border: 2px solid #fff;
  text-align: center;
  max-width: 400px;
}

.popup-inner h2 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: 2rem;
}

.screen {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 120, 70, 0.22), rgba(0, 0, 0, 0.88) 55%, rgba(0, 0, 0, 0.96)),
    linear-gradient(180deg, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.85));
  text-align: center;
}

#endScreen {
  justify-content: flex-start;
  align-items: flex-start;
  background: url("../assets/bgEnd.svg") center / cover no-repeat;
}

.end-menu {
  position: absolute;
  top: 25.5%;
  left: 54.5%;
  width: 380px;
  min-height: 405px;
  text-align: center;
}

.end-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 1.15rem 0 1.35rem;
}

.end-field {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.22);
  border-radius: 10px;
  padding: 0.8rem 0.85rem;
  text-align: left;
}

.end-field-label {
  display: block;
  font-size: 0.8rem;
  opacity: 0.78;
  letter-spacing: 0.02em;
}

.end-field-value {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.25rem;
  font-weight: 900;
}

#endReplayButton {
  border-color: rgba(255, 170, 120, 0.55);
  background: linear-gradient(180deg, rgba(255, 145, 95, 0.98), rgba(185, 65, 38, 0.96));
}

#endReplayButton:hover {
  background: linear-gradient(180deg, rgba(255, 165, 125, 0.99), rgba(205, 85, 55, 0.98));
}

.screen-inner {
  max-width: 560px;
  padding: 2rem 2.25rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(8, 8, 10, 0.55);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}

.screen-inner h1 {
  margin: 0 0 0.75rem;
  font-size: 2.6rem;
  letter-spacing: 0.02em;
}

.screen-inner p {
  margin: 0 0 1.25rem;
  opacity: 0.9;
  line-height: 1.4;
}

.kicker {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.75;
}

.subhead {
  font-size: 1.05rem;
  opacity: 0.9;
}

.fineprint {
  margin: 1rem 0 0;
  font-size: 0.85rem;
  opacity: 0.7;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin: 0 0 1.25rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.9rem;
  letter-spacing: 0.01em;
}

.screen-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.screen-actions button {
  padding: 0.55rem 1rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(20, 20, 20, 0.9);
  color: #fff;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}

.screen-actions button:hover {
  background: rgba(70, 70, 70, 0.9);
  transform: translateY(-1px);
}

#homeStartButton,
#endReplayButton {
  border-color: rgba(255, 160, 110, 0.7);
  background: linear-gradient(180deg, rgba(255, 140, 90, 0.95), rgba(190, 70, 40, 0.95));
}

#homeStartButton:hover,
#endReplayButton:hover {
  background: linear-gradient(180deg, rgba(255, 155, 110, 0.98), rgba(205, 85, 55, 0.98));
}