.survivors-shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto 48px;
}

.survivors-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 26px 0 22px;
  padding: 28px;
  border: 3px solid #ffffff;
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 88% 22%, #fff4bd 0 34px, transparent 35px),
    linear-gradient(45deg, rgba(216, 220, 255, 0.32) 25%, transparent 25% 75%, rgba(216, 220, 255, 0.32) 75%),
    #fffefe;
  background-size: auto, 34px 34px, auto;
  box-shadow: 0 0 0 8px #6f86c8, 10px 10px 0 rgba(111, 134, 200, 0.24);
}

.survivors-hero h1 {
  margin: 0;
  font-size: clamp(2.2rem, 8vw, 4.8rem);
  line-height: 0.95;
}

.survivors-layout {
  display: grid;
  grid-template-columns: minmax(0, 780px) 260px;
  gap: 18px;
  align-items: start;
  justify-content: center;
}

.survivors-stage-wrap,
.survivors-panel,
.survivors-touch-controls {
  border: 3px solid #ffffff;
  border-radius: var(--radius);
  background: #fffefe;
  box-shadow: 0 0 0 7px #9fc8ee, 8px 8px 0 rgba(111, 134, 200, 0.22);
}

.survivors-stage-wrap {
  position: relative;
  overflow: hidden;
  padding: 12px;
}

#survivors-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  height: auto;
  border: 2px solid #6f86c8;
  border-radius: 12px;
  background: #171522;
}

.survivors-top-hud {
  position: absolute;
  top: 22px;
  left: 22px;
  right: 22px;
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 10px;
  pointer-events: none;
}

.survivors-hud-left,
.survivors-hud-center {
  display: flex;
  gap: 8px;
}

.survivors-hud-left {
  flex-direction: column;
  align-items: flex-start;
}

.survivors-hud-center {
  justify-content: center;
  flex-wrap: wrap;
}

.survivors-hud-left span,
.survivors-hud-center span,
.survivors-hud-center button,
.survivors-kills-hud {
  border: 2px solid rgba(255, 254, 254, 0.9);
  border-radius: 999px;
  background: rgba(255, 254, 254, 0.88);
  color: #52649d;
  font-size: 0.88rem;
  font-weight: 900;
  box-shadow: 0 3px 0 rgba(111, 134, 200, 0.2);
}

.survivors-hud-left span,
.survivors-hud-center span {
  padding: 7px 10px;
}

.survivors-top-hud strong {
  color: #b85091;
}

.survivors-hud-center button {
  padding: 7px 12px;
  font: inherit;
  cursor: pointer;
  pointer-events: auto;
}

.survivors-kills-hud {
  justify-self: end;
  min-width: 54px;
  padding: 7px 12px;
  text-align: center;
}

.survivors-heart-hud strong {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  vertical-align: middle;
}

.survivors-heart-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  filter: drop-shadow(0 2px 0 rgba(184, 80, 145, 0.22));
}

.survivors-heart-icon.is-empty {
  opacity: 0.28;
  filter: grayscale(1) drop-shadow(0 2px 0 rgba(111, 134, 200, 0.16));
}

.survivors-bottom-xp {
  position: absolute;
  left: 50%;
  bottom: 20px;
  z-index: 3;
  width: min(360px, calc(100% - 44px));
  transform: translateX(-50%);
  pointer-events: none;
}

.survivors-xp-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0 6px 5px;
  color: #fffefe;
  font-size: 0.78rem;
  font-weight: 900;
  text-shadow: 0 2px 0 rgba(23, 21, 34, 0.55);
}

.survivors-xp-label strong {
  color: #fff4bd;
}
.survivors-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.survivors-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 2px dashed rgba(111, 134, 200, 0.28);
}

.survivors-stat-row span,
.survivors-controls-copy span {
  color: var(--muted);
  font-weight: 800;
}

.survivors-xp-meter {
  height: 12px;
  overflow: hidden;
  border: 2px solid rgba(111, 134, 200, 0.5);
  border-radius: 999px;
  background: #fff7fb;
}

.survivors-xp-meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff8ec3, #63cdf8);
  transition: width 160ms ease;
}

.survivors-status {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
}

.survivors-version {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.survivors-version strong {
  color: #52649d;
}


.survivors-dev-tools {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 2px dashed rgba(184, 80, 145, 0.42);
  border-radius: 12px;
  background: #fff7fb;
}

.survivors-dev-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.survivors-dev-heading strong {
  color: #52649d;
  font-size: 0.95rem;
}

.survivors-dev-heading span {
  color: #b85091;
  font-size: 0.78rem;
  font-weight: 900;
}

.survivors-dev-actions,
.survivors-dev-upgrades {
  display: grid;
  gap: 8px;
}

.survivors-dev-upgrades {
  max-height: 260px;
  overflow: auto;
  padding-right: 4px;
}

.survivors-dev-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.survivors-dev-actions button,
.survivors-dev-upgrades button {
  min-height: 36px;
  padding: 8px 10px;
  border: 2px solid rgba(111, 134, 200, 0.35);
  border-radius: 10px;
  background: #fffefe;
  color: #52649d;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 900;
  cursor: pointer;
  text-align: left;
}

.survivors-dev-actions button {
  text-align: center;
}

.survivors-dev-upgrades button {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}

.survivors-dev-upgrades button small {
  color: #b85091;
  font-size: 0.75rem;
  font-weight: 900;
}

.survivors-dev-actions button:hover,
.survivors-dev-actions button:focus-visible,
.survivors-dev-upgrades button:hover,
.survivors-dev-upgrades button:focus-visible {
  outline: 3px solid rgba(255, 142, 195, 0.45);
}

.survivors-dev-upgrades button:disabled {
  opacity: 0.5;
  cursor: default;
}

.survivors-controls-copy {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  padding: 12px;
  border-radius: 12px;
  background: #fff7fb;
}

.survivors-upgrade-modal {
  position: absolute;
  inset: 12px;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 18px;
  border-radius: 12px;
  background: rgba(20, 17, 33, 0.7);
  backdrop-filter: blur(3px);
}

.survivors-upgrade-modal.is-hidden {
  display: none;
}

.survivors-upgrade-dialog {
  width: min(720px, 100%);
  padding: 20px;
  border: 3px solid #fffefe;
  border-radius: 18px;
  background: #fffefe;
  box-shadow: 0 0 0 6px #6f86c8, 8px 8px 0 rgba(255, 183, 211, 0.28);
}

.survivors-upgrade-dialog h2 {
  margin: 4px 0 16px;
  font-size: clamp(1.4rem, 4vw, 2.2rem);
}

.survivors-upgrade-cards,
.survivors-difficulty-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.survivors-difficulty-cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.survivors-upgrade-card,
.survivors-difficulty-card {
  min-height: 132px;
  padding: 14px;
  border: 2px dashed rgba(111, 134, 200, 0.65);
  border-radius: 14px;
  background: linear-gradient(180deg, #fff7fb, #eef6ff);
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
  position: relative;
}

.survivors-upgrade-card:hover,
.survivors-upgrade-card:focus-visible,
.survivors-difficulty-card:hover,
.survivors-difficulty-card:focus-visible {
  outline: 3px solid rgba(255, 142, 195, 0.65);
  transform: translateY(-2px);
}

.survivors-upgrade-card span,
.survivors-upgrade-card b,
.survivors-upgrade-card small,
.survivors-difficulty-card span,
.survivors-difficulty-card b,
.survivors-difficulty-card small {
  display: block;
}

.survivors-upgrade-card em {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #fffefe;
  color: #b85091;
  font-style: normal;
  font-weight: 900;
  box-shadow: 0 0 0 2px #ffb7d3;
}

.survivors-upgrade-card span,
.survivors-difficulty-card span {
  margin-bottom: 8px;
  padding-right: 34px;
  color: #52649d;
  font-weight: 900;
}

.survivors-upgrade-card b,
.survivors-difficulty-card b {
  margin-bottom: 8px;
  color: #b85091;
  font-size: 0.94rem;
  font-weight: 900;
}

.survivors-upgrade-card small,
.survivors-difficulty-card small {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.35;
}


.survivors-owned-upgrades {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.survivors-owned-upgrade,
.survivors-empty-upgrades {
  padding: 12px;
  border: 2px dashed rgba(111, 134, 200, 0.45);
  border-radius: 12px;
  background: #fff7fb;
}

.survivors-owned-upgrade span,
.survivors-owned-upgrade b,
.survivors-owned-upgrade small {
  display: block;
}

.survivors-owned-upgrade span {
  color: #52649d;
  font-weight: 900;
}

.survivors-owned-upgrade b {
  color: #b85091;
  font-weight: 900;
}

.survivors-owned-upgrade small,
.survivors-empty-upgrades {
  color: var(--muted);
  font-weight: 800;
}
.survivors-touch-controls {
  display: none;
  margin-top: 18px;
  padding: 16px;
}

.survivors-touch-dpad {
  display: grid;
  grid-template-columns: repeat(3, minmax(64px, 1fr));
  grid-template-areas:
    ". up ."
    "left down right";
  gap: 10px;
}

.survivors-touch-dpad button {
  min-height: 56px;
  border: 3px solid #ffffff;
  border-radius: 18px;
  background: #d8dcff;
  color: #52649d;
  font-weight: 900;
  box-shadow: 0 0 0 4px #6f86c8, 4px 4px 0 rgba(111, 134, 200, 0.22);
}

.survivors-touch-dpad [data-hold="up"] { grid-area: up; }
.survivors-touch-dpad [data-hold="left"] { grid-area: left; }
.survivors-touch-dpad [data-hold="down"] { grid-area: down; }
.survivors-touch-dpad [data-hold="right"] { grid-area: right; }

@media (max-width: 900px) {
  .survivors-layout {
    grid-template-columns: 1fr;
  }

  .survivors-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .survivors-status,
  .survivors-controls-copy,
  .survivors-dev-tools,
  #restart-survivors {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .survivors-shell {
    width: min(100% - 24px, 1080px);
  }

  .survivors-hero {
    align-items: flex-start;
    flex-direction: column;
    padding: 22px;
  }

  .survivors-stage-wrap {
    padding: 8px;
  }

  .survivors-panel {
    grid-template-columns: 1fr;
  }

  .survivors-upgrade-modal {
    inset: 8px;
    padding: 12px;
  }

  .survivors-upgrade-dialog {
    padding: 16px;
  }

  .survivors-upgrade-cards,
  .survivors-difficulty-cards {
    grid-template-columns: 1fr;
  }

  .survivors-top-hud {
    top: 14px;
    left: 14px;
    right: 14px;
    grid-template-columns: 1fr auto;
    gap: 7px;
  }

  .survivors-hud-center {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .survivors-hud-left span,
  .survivors-hud-center span,
  .survivors-hud-center button,
  .survivors-kills-hud {
    padding: 5px 8px;
    font-size: 0.76rem;
  }

  .survivors-kills-hud {
    min-width: 42px;
  }

  .survivors-heart-icon {
    width: 20px;
    height: 20px;
  }

  .survivors-bottom-xp {
    bottom: 12px;
    width: min(330px, calc(100% - 28px));
  }

  .survivors-upgrade-card,
  .survivors-difficulty-card {
    min-height: auto;
  }

  .survivors-touch-controls {
    display: block;
  }
}
