:root {
  --bg: #050915;
  --cyan: #38f9ff;
  --pink: #ff4fd8;
  --gold: #ffd166;
  --lime: #7dffb3;
  --ink: #eef7ff;
  --muted: #9ab0d1;
  --panel: rgba(8, 12, 28, 0.78);
}

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

html,
body,
#app {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(900px 500px at 50% 15%, rgba(255, 79, 216, 0.16), transparent 62%),
    radial-gradient(700px 420px at 12% 72%, rgba(56, 249, 255, 0.14), transparent 58%),
    #020611;
  color: var(--ink);
  font-family: "Trebuchet MS", "Microsoft YaHei", system-ui, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

#game-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#game,
#game canvas {
  width: 100%;
  height: 100%;
  display: block;
}

#hud {
  position: absolute;
  z-index: 5;
  top: max(14px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  pointer-events: none;
}

.hud-chip {
  min-width: 96px;
  padding: 9px 13px;
  border-radius: 14px;
  background: rgba(4, 8, 18, 0.68);
  border: 1px solid rgba(120, 220, 255, 0.22);
  box-shadow: 0 0 24px rgba(56, 249, 255, 0.16);
  text-align: center;
}

.hud-chip span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.hud-chip strong {
  display: block;
  margin-top: 2px;
  color: var(--gold);
  font-size: 21px;
  font-weight: 900;
}

.banner {
  position: absolute;
  z-index: 8;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  padding: 13px 20px;
  border-radius: 999px;
  color: #07101a;
  background: linear-gradient(120deg, var(--lime), var(--cyan), var(--gold));
  box-shadow: 0 0 36px rgba(56, 249, 255, 0.38);
  font-weight: 900;
  letter-spacing: 0.08em;
  pointer-events: none;
}

.hidden {
  display: none !important;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 35%, rgba(56, 249, 255, 0.11), transparent 34%),
    rgba(1, 4, 12, 0.56);
  backdrop-filter: blur(8px);
}

.overlay.hidden {
  display: none;
}

.panel {
  width: min(620px, calc(100vw - 32px));
  padding: 36px 34px 30px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(18, 22, 48, 0.9), rgba(5, 9, 21, 0.94)),
    var(--panel);
  border: 1px solid rgba(120, 220, 255, 0.24);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.52),
    0 0 80px rgba(255, 79, 216, 0.13);
  text-align: center;
}

.panel.small {
  width: min(460px, calc(100vw - 32px));
}

.eyebrow {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.25em;
}

h1 {
  margin-top: 12px;
  font-size: clamp(42px, 9vw, 72px);
  line-height: 1;
  background: linear-gradient(120deg, #fff, var(--cyan), var(--pink), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 32px rgba(56, 249, 255, 0.18);
}

h2 {
  margin-bottom: 18px;
  font-size: 30px;
}

.subtitle {
  max-width: 36ch;
  margin: 16px auto 0;
  color: var(--muted);
  line-height: 1.7;
}

.stats-line {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 13px;
}

.stats-line strong {
  color: var(--gold);
}

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

button {
  appearance: none;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.primary,
.ghost {
  min-width: 132px;
  padding: 14px 20px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 15px;
  transition: transform 0.14s ease, filter 0.14s ease;
}

.primary {
  color: #06111a;
  background: linear-gradient(120deg, var(--lime), var(--cyan), var(--pink));
  box-shadow: 0 0 28px rgba(56, 249, 255, 0.28);
}

.ghost {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.13);
}

.primary:hover,
.ghost:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

.help-grid {
  display: grid;
  gap: 10px;
  margin: 18px 0 22px;
  text-align: left;
}

.help-grid div {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(120, 220, 255, 0.12);
}

.help-grid strong {
  color: var(--cyan);
}

.help-grid span {
  color: var(--muted);
}

#touch-controls {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
}

.touch-left,
.touch-right {
  position: absolute;
  bottom: max(22px, env(safe-area-inset-bottom));
  pointer-events: auto;
}

.touch-left {
  left: max(16px, env(safe-area-inset-left));
  display: flex;
  gap: 12px;
}

.touch-right {
  right: max(16px, env(safe-area-inset-right));
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.touch-btn {
  display: grid;
  place-items: center;
  border-radius: 20px;
  color: #06111a;
  font-weight: 1000;
  font-size: 24px;
  background: linear-gradient(145deg, rgba(125, 255, 179, 0.84), rgba(56, 249, 255, 0.78));
  border: 1px solid rgba(255, 255, 255, 0.26);
  box-shadow: 0 0 28px rgba(56, 249, 255, 0.22);
}

.touch-btn.dir {
  width: 72px;
  height: 62px;
}

.touch-btn.jump {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(255, 209, 102, 0.88), rgba(255, 79, 216, 0.78));
}

.touch-btn.skill {
  width: 62px;
  height: 58px;
  font-size: 18px;
}

.touch-btn.fire {
  color: #2b0b02;
  background: linear-gradient(145deg, rgba(255, 209, 102, 0.92), rgba(255, 75, 31, 0.82));
}

.touch-btn.down {
  transform: scale(0.94);
  filter: brightness(1.18);
}

@media (pointer: coarse), (max-width: 860px) {
  #touch-controls.active {
    display: block;
  }
}

@media (max-width: 620px) {
  #hud {
    width: calc(100vw - 18px);
    justify-content: center;
    gap: 6px;
  }

  .hud-chip {
    min-width: 0;
    flex: 1 1 0;
    padding: 8px 6px;
  }

  .hud-chip strong {
    font-size: 18px;
  }

  .panel {
    padding: 28px 20px 22px;
    border-radius: 20px;
  }

  .stats-line {
    flex-direction: column;
    gap: 8px;
  }

  .primary,
  .ghost {
    width: 100%;
  }

  .touch-btn.dir {
    width: 62px;
    height: 56px;
  }

  .touch-btn.jump {
    width: 82px;
    height: 82px;
  }

  .touch-right {
    gap: 8px;
  }

  .touch-btn.skill {
    width: 54px;
    height: 52px;
  }
}

@media (max-width: 380px) {
  .touch-left,
  .touch-right {
    gap: 6px;
  }

  .touch-left {
    left: max(10px, env(safe-area-inset-left));
  }

  .touch-right {
    right: max(10px, env(safe-area-inset-right));
  }

  .touch-btn.dir {
    width: 52px;
    height: 50px;
  }

  .touch-btn.skill {
    width: 46px;
    height: 48px;
  }

  .touch-btn.jump {
    width: 70px;
    height: 70px;
  }
}
