:root {
  --bg-top: #10233f;
  --bg-bottom: #04111f;
  --panel: rgba(7, 16, 29, 0.72);
  --panel-border: rgba(255, 255, 255, 0.12);
  --accent: #ffd84d;
  --accent-2: #52f2ff;
  --danger: #ff5f5f;
  --text: #f3f7ff;
  --muted: rgba(243, 247, 255, 0.68);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(82, 242, 255, 0.18), transparent 30%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  color: var(--text);
  font-family: 'Inter', sans-serif;
}

body {
  overflow: hidden;
}

.shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.shell::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}

.shell.hit-flash-duck::after,
.shell.hit-flash-jump::after {
  animation: hit-flash 0.52s ease-out;
}

.shell.hit-flash-duck::after {
  background:
    radial-gradient(
      circle at 50% 45%,
      rgba(255, 107, 107, 0.45),
      transparent 42%
    ),
    linear-gradient(180deg, rgba(255, 107, 107, 0.26), transparent 60%);
}

.shell.hit-flash-jump::after {
  background:
    radial-gradient(
      circle at 50% 48%,
      rgba(255, 211, 106, 0.44),
      transparent 40%
    ),
    linear-gradient(180deg, rgba(255, 211, 106, 0.24), transparent 62%);
}

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

canvas {
  display: block;
}

@keyframes hit-flash {
  0% {
    opacity: 0;
    transform: scale(0.98);
  }

  18% {
    opacity: 1;
    transform: scale(1.02);
  }

  100% {
    opacity: 0;
    transform: scale(1);
  }
}

.hud {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px;
  pointer-events: none;
}

.hud-pause-button {
  pointer-events: auto;
  align-self: flex-start;
  margin: 4px 14px 0 auto;
  min-width: 96px;
}

.brand h1,
.card h2 {
  margin: 0;
  font-family: 'Bungee', cursive;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.brand-kicker,
.eyebrow,
.label {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--accent-2);
}

.scoreboard {
  display: flex;
  gap: 12px;
}

.stat {
  min-width: 96px;
  padding: 12px 14px;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

.mission-stat {
  min-width: 180px;
}

.stat span:last-child {
  display: block;
  margin-top: 6px;
  font-size: 1.2rem;
  font-weight: 800;
}

.mission-stat small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: 20px;
  overflow-y: auto;
  background: rgba(3, 10, 19, 0.48);
  backdrop-filter: blur(8px);
}

.hidden {
  display: none;
}

.card {
  width: min(520px, 100%);
  max-height: calc(100vh - 40px);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 28px;
  background:
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.12),
      rgba(255, 255, 255, 0.06)
    ),
    rgba(10, 20, 34, 0.88);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  text-align: center;
  overflow-y: auto;
}

.card p {
  color: var(--muted);
  line-height: 1.55;
}

.pause-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.home-card {
  width: min(640px, 100%);
}

.home-top-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.secondary-button {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.character-card-button {
  width: 100%;
  display: grid;
  gap: 6px;
  margin: 22px 0 18px;
  padding: 18px 20px;
  text-align: left;
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(82, 242, 255, 0.12), rgba(255, 216, 77, 0.08)),
    rgba(255, 255, 255, 0.04);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.character-card-button strong {
  font-size: 1.2rem;
}

.character-card-button small,
.character-card-kicker {
  color: var(--muted);
}

.character-card-kicker {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
}

.menu-card {
  width: min(620px, 100%);
}

.menu-list {
  display: grid;
  gap: 12px;
  margin: 20px 0;
}

.menu-item {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 16px 18px;
  text-align: left;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  box-shadow: none;
}

.menu-item strong {
  font-size: 1rem;
}

.menu-item span {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.menu-inline-button {
  justify-self: start;
  margin-top: 6px;
}

.menu-item.static-item {
  cursor: default;
}

.menu-item.selected-outfit {
  border-color: rgba(82, 242, 255, 0.48);
  background: rgba(82, 242, 255, 0.1);
}

.menu-item.locked-character {
  opacity: 0.5;
  filter: grayscale(0.25);
}

.chest-item {
  gap: 10px;
}

.chest-timer {
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0.03em;
}

.chest-action-button {
  justify-self: start;
}

.repair-card {
  text-align: left;
}

.repair-bank {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 18px 0 16px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(82, 242, 255, 0.08);
  border: 1px solid rgba(82, 242, 255, 0.16);
}

.repair-bank span {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
}

.repair-bank strong {
  font-size: 1.25rem;
  color: var(--accent);
}

.boss-card {
  display: grid;
  gap: 16px;
}

.boss-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.boss-stat {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.boss-stat span {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
}

.boss-stat strong {
  font-size: 1.4rem;
  color: var(--accent);
}

.repair-city-preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 0 0 18px;
}

.repair-visual-card {
  display: grid;
  gap: 10px;
  padding: 14px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.repair-visual-card strong {
  font-size: 0.92rem;
}

.repair-visual-stage {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.repair-building-visual {
  position: relative;
  height: 120px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(
    180deg,
    rgba(82, 242, 255, 0.12),
    rgba(16, 35, 63, 0.15)
  );
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.repair-building-core {
  position: absolute;
  left: 50%;
  bottom: 10px;
  width: 46px;
  border-radius: 10px 10px 4px 4px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #586579, #222f41);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.repair-building-windows {
  position: absolute;
  inset: 12px 8px 12px 8px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.repair-building-windows span {
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
}

.repair-building-debris,
.repair-building-sparks,
.repair-building-crown {
  position: absolute;
}

.repair-building-debris {
  inset: auto 10px 8px 10px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(255, 95, 95, 0.9),
    rgba(255, 193, 79, 0.65)
  );
  filter: blur(0.3px);
}

.repair-building-sparks {
  top: 14px;
  right: 12px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(82, 242, 255, 0.75);
  box-shadow: 0 0 14px rgba(82, 242, 255, 0.6);
}

.repair-building-crown {
  left: 50%;
  top: 8px;
  width: 26px;
  height: 10px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: linear-gradient(90deg, #ffe07a, #52f2ff);
  box-shadow: 0 0 16px rgba(255, 224, 122, 0.4);
}

.repair-building-visual[data-repair-stage='0'] .repair-building-core {
  background: linear-gradient(180deg, #4f5665, #212735);
  transform: translateX(-50%) rotate(-5deg);
  opacity: 0.82;
}

.repair-building-visual[data-repair-stage='0'] .repair-building-windows span {
  background: rgba(255, 95, 95, 0.12);
}

.repair-building-visual[data-repair-stage='1'] .repair-building-core {
  background: linear-gradient(180deg, #6a768c, #2e4056);
}

.repair-building-visual[data-repair-stage='1']
  .repair-building-windows
  span:nth-child(odd) {
  background: rgba(255, 216, 77, 0.35);
}

.repair-building-visual[data-repair-stage='2'] .repair-building-core {
  background: linear-gradient(180deg, #7fa4d8, #304d73);
}

.repair-building-visual[data-repair-stage='2'] .repair-building-windows span {
  background: rgba(82, 242, 255, 0.62);
  box-shadow: 0 0 10px rgba(82, 242, 255, 0.22);
}

.repair-list {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.repair-item {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.repair-item-visual-row {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 10px;
}

.repair-item-visual-row .repair-building-visual {
  width: 88px;
  height: 88px;
  flex: 0 0 auto;
}

.repair-item-visual-copy {
  display: grid;
  gap: 4px;
}

.repair-item-top,
.repair-step {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.repair-item-top {
  margin-bottom: 10px;
}

.repair-item h3 {
  margin: 0;
  font-size: 1rem;
}

.repair-progress {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.repair-missing {
  color: #ffb86c;
}

.repair-step {
  margin-top: 8px;
}

.repair-step-label {
  color: var(--text);
  font-weight: 600;
}

.repair-step button {
  min-width: 120px;
  padding: 10px 14px;
  font-size: 0.9rem;
}

.repair-step button[disabled] {
  cursor: default;
  filter: grayscale(0.2);
  opacity: 0.55;
  transform: none;
}

.repair-done {
  color: var(--accent-2);
  font-weight: 800;
}

.controls {
  display: grid;
  gap: 8px;
  margin: 20px 0 24px;
  color: var(--text);
  font-weight: 600;
}

.cutscene-strip {
  display: grid;
  gap: 12px;
  margin: 22px 0 18px;
}

.story-panel {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  text-align: left;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.story-panel strong {
  color: var(--accent);
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mission-brief {
  margin: 0 0 20px;
  color: var(--text) !important;
  font-weight: 700;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 14px 22px;
  background: linear-gradient(135deg, var(--accent), #ff9c42);
  color: #131313;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(255, 173, 66, 0.28);
  transition:
    transform 120ms ease,
    filter 120ms ease;
}

button:hover,
button:active {
  transform: translateY(-1px) scale(1.01);
  filter: brightness(1.04);
}

.touch-controls {
  position: absolute;
  left: 50%;
  bottom: 16px;
  z-index: 5;
  display: flex;
  gap: 10px;
  transform: translateX(-50%);
}

.touch-controls button {
  width: 58px;
  height: 58px;
  padding: 0;
  border-radius: 18px;
  background: rgba(5, 14, 25, 0.8);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: none;
}

.touch-controls button[data-action='super'] {
  background: linear-gradient(
    135deg,
    rgba(82, 242, 255, 0.9),
    rgba(255, 216, 77, 0.9)
  );
  color: #10233f;
  font-size: 1.2rem;
}

.hud-select,
.settings-select {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(5, 14, 25, 0.82);
  color: var(--text);
  font: 700 0.8rem inherit;
}

.rehab-speed {
  display: grid;
  gap: 8px;
}

#shop-button,
#chests-button,
#shop-overlay,
#chests-overlay {
  display: none !important;
}

.medxy-actions {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.medxy-actions button,
.medxy-actions a {
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(5, 14, 25, 0.86);
  color: var(--text);
  box-shadow: none;
  font-size: 0.72rem;
  font-weight: 800;
  text-decoration: none;
  backdrop-filter: blur(8px);
}

@media (min-width: 961px) {
  .touch-controls {
    display: none;
  }
}

@media (max-width: 960px) {
  .hud {
    flex-direction: column;
    gap: 14px;
  }

  .scoreboard {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .stat {
    min-width: 0;
    flex: 1;
  }

  .mission-stat {
    flex-basis: 100%;
  }

  .brand h1 {
    font-size: 1.6rem;
  }

  .home-top-actions {
    justify-content: stretch;
  }

  .home-top-actions button {
    flex: 1 1 calc(50% - 10px);
  }

  .repair-city-preview {
    grid-template-columns: 1fr;
  }

  .repair-item-visual-row {
    align-items: flex-start;
  }

  .hud-select {
    position: absolute;
    right: 12px;
    top: 12px;
    max-width: 112px;
  }

  .medxy-actions {
    right: 8px;
    bottom: 82px;
    max-width: 150px;
  }
}
