:root {
  color-scheme: dark;
  --bg: #05020b;
  --ink: #f7f2ff;
  --muted: #aeb4c8;
  --pink: #ff3df2;
  --violet: #9b4dff;
  --blue: #13d7ff;
  --mint: #32ffbf;
  --yellow: #ffe45c;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: "Trebuchet MS", "Arial Narrow", system-ui, sans-serif;
  touch-action: none;
  user-select: none;
}

button,
a {
  font: inherit;
}

.phone-shell {
  display: grid;
  min-height: 100svh;
  place-items: center;
  background:
    radial-gradient(circle at 50% 18%, rgba(91, 59, 180, 0.34), transparent 32%),
    linear-gradient(180deg, #05020b 0%, #070817 58%, #09030f 100%);
}

.game {
  position: relative;
  width: min(100vw, 480px);
  height: 100svh;
  min-height: 620px;
  max-height: 920px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(7, 4, 25, 0.35), rgba(1, 0, 7, 0.92)),
    radial-gradient(circle at 20% 30%, rgba(19, 215, 255, 0.2), transparent 28%),
    radial-gradient(circle at 82% 20%, rgba(255, 61, 242, 0.22), transparent 30%),
    #05020b;
}

.game.rush {
  animation: rushPulse 0.55s ease-in-out infinite alternate;
}

.skyline {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.moon {
  position: absolute;
  top: 9%;
  right: 16%;
  width: 54px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, #e9f7ff, #7ddfff 64%, transparent 67%);
  box-shadow: 0 0 38px rgba(19, 215, 255, 0.7);
  opacity: 0.7;
}

.tower {
  position: absolute;
  bottom: 0;
  width: 23%;
  background:
    repeating-linear-gradient(90deg, transparent 0 16px, rgba(19, 215, 255, 0.28) 16px 18px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.04) 0 18px, rgba(255, 61, 242, 0.22) 18px 20px),
    linear-gradient(180deg, #111026, #05040d);
  box-shadow: inset 0 0 18px rgba(19, 215, 255, 0.16);
  opacity: 0.82;
}

.tower-a {
  left: -3%;
  height: 35%;
}

.tower-b {
  left: 20%;
  height: 44%;
  clip-path: polygon(0 10%, 40% 10%, 48% 0, 56% 10%, 100% 10%, 100% 100%, 0 100%);
}

.tower-c {
  right: 21%;
  height: 38%;
}

.tower-d {
  right: -5%;
  height: 48%;
  clip-path: polygon(0 20%, 35% 20%, 50% 0, 65% 20%, 100% 20%, 100% 100%, 0 100%);
}

.kanji-sign {
  position: absolute;
  left: 7%;
  bottom: 35%;
  color: var(--pink);
  font-family: "Trebuchet MS", "Arial Narrow", system-ui, sans-serif;
  font-size: 22px;
  font-weight: 900;
  text-shadow: 0 0 8px var(--pink), 0 0 22px var(--pink);
  transform: rotate(-4deg);
}

.sign-two {
  left: auto;
  right: 9%;
  bottom: 45%;
  color: var(--blue);
  text-shadow: 0 0 8px var(--blue), 0 0 22px var(--blue);
  transform: rotate(5deg);
}

.rain-canvas,
.game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.game-canvas {
  z-index: 3;
  cursor: pointer;
}

.rain-canvas {
  z-index: 2;
  opacity: 0.7;
  pointer-events: none;
}

.hud {
  position: absolute;
  z-index: 5;
  top: max(14px, env(safe-area-inset-top));
  left: 14px;
  right: 14px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 10px;
  pointer-events: none;
}

.hud > div {
  min-width: 0;
}

.hud > div:last-child {
  text-align: right;
}

.label,
.eyebrow {
  display: block;
  color: var(--muted);
  font-family: "Trebuchet MS", "Arial Narrow", system-ui, sans-serif;
  font-size: 10px;
  letter-spacing: 0;
}

.hud strong {
  display: block;
  margin-top: 2px;
  font-family: "Trebuchet MS", "Arial Narrow", system-ui, sans-serif;
  font-size: clamp(24px, 7vw, 36px);
  line-height: 1;
  text-shadow: 0 0 12px rgba(19, 215, 255, 0.7);
}

.brand {
  text-align: center;
  text-transform: uppercase;
}

.brand span {
  display: block;
  color: var(--blue);
  font-family: "Trebuchet MS", "Arial Narrow", system-ui, sans-serif;
  font-size: 11px;
}

.brand strong {
  font-size: clamp(13px, 4vw, 18px);
  color: var(--pink);
  text-shadow: 0 0 12px rgba(255, 61, 242, 0.8);
}

.rush-meter {
  position: absolute;
  z-index: 5;
  top: calc(max(14px, env(safe-area-inset-top)) + 58px);
  left: 16px;
  right: 16px;
  height: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 18px rgba(155, 77, 255, 0.35);
}

.rush-meter span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--pink), var(--yellow));
  box-shadow: 0 0 18px var(--pink);
  transition: width 0.18s ease;
}

.combo-text,
.rush-text {
  position: absolute;
  z-index: 6;
  left: 50%;
  text-align: center;
  font-family: "Trebuchet MS", "Arial Narrow", system-ui, sans-serif;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) scale(0.86);
}

.combo-text {
  top: 18%;
  color: var(--yellow);
  font-size: clamp(22px, 8vw, 44px);
  text-shadow: 0 0 10px var(--yellow), 0 0 26px var(--pink);
}

.rush-text {
  top: 42%;
  width: 100%;
  color: #fff;
  font-size: clamp(30px, 10vw, 58px);
  text-shadow: 0 0 12px #fff, 0 0 28px var(--pink), 0 0 48px var(--violet);
}

.combo-text.show,
.rush-text.show {
  animation: popText 0.76s ease-out;
}

.overlay {
  position: absolute;
  z-index: 10;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(5, 2, 11, 0.38), rgba(5, 2, 11, 0.92)),
    radial-gradient(circle at 50% 35%, rgba(155, 77, 255, 0.32), transparent 38%);
  backdrop-filter: blur(2px);
}

.hidden {
  display: none;
}

h1,
h2 {
  margin: 8px 0 10px;
  font-family: "Trebuchet MS", "Arial Narrow", system-ui, sans-serif;
  font-weight: 900;
  line-height: 0.98;
  text-transform: uppercase;
}

h1 {
  max-width: 9ch;
  font-size: clamp(54px, 17vw, 82px);
  text-shadow: 0 0 14px var(--blue), 0 0 38px var(--pink);
}

h2 {
  font-size: clamp(44px, 13vw, 68px);
  text-shadow: 0 0 14px var(--pink);
}

.tagline {
  max-width: 310px;
  margin: 0 0 26px;
  color: #d7dcff;
  font-size: 18px;
  line-height: 1.25;
}

.primary-btn,
.secondary-btn {
  display: inline-flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.36);
  padding: 0 22px;
  color: #fff;
  font-family: "Trebuchet MS", "Arial Narrow", system-ui, sans-serif;
  font-weight: 900;
  text-decoration: none;
  text-transform: uppercase;
  box-shadow: 0 0 22px rgba(255, 61, 242, 0.46);
}

.primary-btn {
  background: linear-gradient(135deg, var(--pink), var(--violet) 58%, var(--blue));
}

.secondary-btn {
  background: rgba(19, 215, 255, 0.16);
}

.final-score {
  margin: 8px 0 14px;
}

.final-score span {
  display: block;
  color: var(--muted);
  font-family: "Trebuchet MS", "Arial Narrow", system-ui, sans-serif;
}

.final-score strong {
  display: block;
  font-family: "Trebuchet MS", "Arial Narrow", system-ui, sans-serif;
  font-size: clamp(48px, 15vw, 78px);
  line-height: 1;
  text-shadow: 0 0 18px var(--blue);
}

.title-award {
  margin-bottom: 22px;
  color: var(--yellow);
  font-family: "Trebuchet MS", "Arial Narrow", system-ui, sans-serif;
  font-size: clamp(22px, 7vw, 34px);
  font-weight: 900;
  text-shadow: 0 0 16px var(--yellow), 0 0 28px var(--pink);
}

.result-actions {
  display: grid;
  width: min(100%, 330px);
  gap: 12px;
}

.ad-slot {
  display: grid;
  width: min(100%, 320px);
  height: 56px;
  margin-top: 22px;
  place-items: center;
  border: 1px dashed rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.62);
  font-family: "Trebuchet MS", "Arial Narrow", system-ui, sans-serif;
  font-size: 11px;
}

@keyframes popText {
  0% {
    opacity: 0;
    transform: translateX(-50%) scale(0.65);
  }
  22% {
    opacity: 1;
    transform: translateX(-50%) scale(1.08);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) scale(1.18) translateY(-22px);
  }
}

@keyframes rushPulse {
  from {
    box-shadow: inset 0 0 40px rgba(155, 77, 255, 0.34), 0 0 24px rgba(255, 61, 242, 0.32);
  }
  to {
    box-shadow: inset 0 0 86px rgba(255, 61, 242, 0.54), 0 0 50px rgba(19, 215, 255, 0.42);
  }
}

@media (max-height: 680px) {
  .game {
    min-height: 100svh;
  }

  h1 {
    font-size: clamp(44px, 14vw, 66px);
  }

  .tagline {
    margin-bottom: 18px;
  }
}

