:root {
  --cyan: #26e7ff;
  --blue: #1e68ff;
  --deep: #071745;
  --hud: rgba(8, 28, 82, 0.78);
  --hud-strong: rgba(21, 57, 143, 0.9);
  --gold: #ffd84a;
  --red: #ff3f55;
  --green: #7cf36b;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: Inter, ui-rounded, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 50% 12%, rgba(38, 231, 255, 0.2), transparent 28rem),
    linear-gradient(180deg, #071238, #020614 78%);
  color: var(--white);
}

body {
  display: grid;
  place-items: center;
}

button {
  font: inherit;
}

.game-shell {
  position: relative;
  container-type: inline-size;
  width: min(100vw, calc(100dvh * 9 / 16));
  height: min(100dvh, calc(100vw * 16 / 9));
  overflow: hidden;
  background: #071642;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 34px 90px rgba(0, 0, 0, 0.58);
  touch-action: none;
  user-select: none;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.arcade-hud {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.top-row {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  right: max(88px, calc(env(safe-area-inset-right) + 82px));
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.hud-pill {
  min-height: 44px;
  border: 2px solid rgba(38, 231, 255, 0.52);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(36, 78, 178, 0.9), rgba(8, 27, 82, 0.88));
  box-shadow:
    0 9px 18px rgba(0, 0, 0, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(10px);
}

.score-pill {
  flex: 1;
  min-width: 126px;
  padding: 6px 11px 7px;
}

.hud-pill span {
  display: block;
  color: #b9f5ff;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.hud-pill strong {
  display: block;
  margin-top: 4px;
  color: #fff;
  font-size: clamp(22px, 6.4cqw, 38px);
  font-weight: 950;
  line-height: 0.92;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.26);
  white-space: nowrap;
}

.coin-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 92px;
  padding: 6px 10px 6px 7px;
}

.coin-icon {
  display: grid;
  place-items: center;
  width: 28px;
  aspect-ratio: 1;
  border: 3px solid #c8ff9a;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 26%, #fff0f3, #ff4f61 55%, #c91635 100%);
  box-shadow:
    inset 0 -3px 0 rgba(110, 0, 19, 0.28),
    0 0 12px rgba(255, 87, 101, 0.5);
}

.coin-icon::after {
  width: 10px;
  height: 7px;
  border-radius: 10px 0 10px 0;
  background: #74f05f;
  transform: translate(5px, -12px) rotate(-24deg);
  content: "";
}

.coin-pill strong {
  margin-top: 0;
  font-size: clamp(21px, 5.4cqw, 32px);
}

.combo-pill {
  display: none;
  min-width: 74px;
  padding: 6px 9px;
}

.combo-pill.active {
  display: block;
  border-color: rgba(255, 216, 74, 0.7);
}

.pause-button,
.sound-toggle,
.boost-button {
  pointer-events: auto;
  cursor: pointer;
}

.pause-button {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  place-items: center;
  width: 60px;
  aspect-ratio: 1;
  border: 3px solid rgba(255, 255, 255, 0.62);
  border-radius: 8px;
  background: linear-gradient(180deg, #38c8ff, #1263e8 68%, #08308f);
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.34),
    inset 0 2px 0 rgba(255, 255, 255, 0.28);
}

.pause-button span {
  width: 8px;
  height: 42%;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
}

.hint-banner {
  position: absolute;
  top: 15%;
  left: 50%;
  max-width: 78%;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 7px 13px;
  background: rgba(4, 16, 48, 0.46);
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(12px, 3.2cqw, 16px);
  font-weight: 900;
  text-align: center;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(8px);
}

.boost-button {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(70px, calc(env(safe-area-inset-bottom) + 58px));
  display: grid;
  grid-template-columns: 48px auto;
  grid-template-rows: auto auto;
  column-gap: 8px;
  align-items: center;
  min-width: 126px;
  border: 2px solid rgba(255, 255, 255, 0.52);
  border-radius: 8px;
  padding: 8px 10px 8px 8px;
  background: linear-gradient(180deg, rgba(30, 104, 255, 0.92), rgba(8, 28, 82, 0.92));
  color: #fff;
  box-shadow:
    0 12px 26px rgba(0, 0, 0, 0.32),
    0 0 20px rgba(38, 231, 255, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.boost-icon {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 48px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 45% 32%, #7fffff 0 18%, #1263e8 58%, #061747 100%);
  box-shadow: inset 0 2px 8px rgba(255, 255, 255, 0.24);
}

.boost-icon::before {
  width: 20px;
  height: 29px;
  background: linear-gradient(180deg, #fff, #7fffff);
  clip-path: polygon(58% 0, 21% 46%, 48% 46%, 28% 100%, 82% 35%, 54% 36%);
  filter: drop-shadow(0 0 8px #26e7ff);
  content: "";
}

.boost-button strong {
  align-self: end;
  color: #fff46a;
  font-size: 18px;
  font-weight: 950;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 3px 0 #081032;
}

.boost-button small {
  align-self: start;
  color: #e9faff;
  font-size: 13px;
  font-weight: 950;
}

.boost-button small::before {
  content: "x";
}

.boost-button.active {
  animation: boostPulse 0.75s ease-in-out infinite;
}

.sound-toggle {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  width: 48px;
  aspect-ratio: 1;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-radius: 8px;
  background: rgba(7, 22, 66, 0.76);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(10px);
}

.speaker-icon {
  position: relative;
  display: block;
  width: 24px;
  height: 22px;
}

.speaker-icon::before {
  position: absolute;
  left: 0;
  top: 7px;
  width: 8px;
  height: 9px;
  border-radius: 3px;
  background: #fff;
  box-shadow: 8px -5px 0 -2px #fff, 8px 5px 0 -2px #fff;
  content: "";
}

.speaker-icon::after {
  position: absolute;
  right: 0;
  top: 3px;
  width: 12px;
  height: 16px;
  border: 3px solid #26e7ff;
  border-left: 0;
  border-radius: 0 14px 14px 0;
  content: "";
}

.sound-toggle.sound-off .speaker-icon::after {
  width: 18px;
  height: 3px;
  top: 10px;
  right: -2px;
  border: 0;
  border-radius: 3px;
  background: #ff3f55;
  transform: rotate(-38deg);
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 42%, rgba(37, 223, 255, 0.18), transparent 20rem),
    linear-gradient(180deg, rgba(5, 15, 48, 0.2), rgba(5, 15, 48, 0.78));
  pointer-events: none;
}

.overlay.hidden {
  display: none;
}

.panel {
  width: min(88%, 420px);
  border: 3px solid rgba(37, 223, 255, 0.72);
  border-radius: 8px;
  padding: 24px;
  background: linear-gradient(180deg, rgba(18, 62, 154, 0.94), rgba(6, 22, 73, 0.95));
  box-shadow:
    0 0 36px rgba(37, 223, 255, 0.42),
    0 26px 70px rgba(0, 0, 0, 0.42),
    inset 0 2px 0 rgba(255, 255, 255, 0.24);
  text-align: center;
  pointer-events: auto;
  backdrop-filter: blur(18px);
}

.panel-runner {
  width: min(78%, 300px);
  height: 130px;
  margin: 0 auto 10px;
  overflow: hidden;
}

.panel-runner img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 14px 16px rgba(0, 0, 0, 0.32));
}

.panel h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(34px, 9cqw, 60px);
  font-weight: 950;
  letter-spacing: 0;
  line-height: 0.95;
  text-shadow:
    0 4px 0 #061230,
    0 0 20px rgba(37, 223, 255, 0.58);
}

.panel p {
  max-width: 360px;
  margin: 14px auto 0;
  color: #d7f5ff;
  font-size: 14px;
  line-height: 1.5;
}

.panel-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0;
}

.panel-stats div {
  min-width: 0;
  border-radius: 8px;
  padding: 10px 6px;
  background: rgba(0, 0, 0, 0.2);
}

.panel-stats span {
  display: block;
  color: #9fefff;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.panel-stats strong {
  display: block;
  margin-top: 5px;
  color: #fff;
  font-size: 21px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

#startButton {
  width: min(100%, 260px);
  min-height: 50px;
  border: 3px solid rgba(255, 255, 255, 0.74);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffe866, #ffad00);
  color: #14203a;
  font-size: 15px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
  box-shadow:
    0 16px 28px rgba(0, 0, 0, 0.32),
    inset 0 2px 0 rgba(255, 255, 255, 0.55);
  cursor: pointer;
}

button:active {
  transform: translateY(1px);
}

.hints {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin-top: 15px;
}

.hints span {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 11px;
  font-weight: 850;
}

.mobile-controls {
  position: absolute;
  left: 3%;
  right: 3%;
  bottom: 8%;
  z-index: 6;
  display: none;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 10px;
  pointer-events: none;
}

.mobile-controls button {
  min-height: 54px;
  border: 2px solid rgba(37, 223, 255, 0.7);
  border-radius: 8px;
  background: rgba(7, 22, 66, 0.66);
  color: #fff;
  font-size: 22px;
  font-weight: 950;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(12px);
  pointer-events: auto;
}

#fireButton {
  background: linear-gradient(180deg, rgba(255, 216, 77, 0.94), rgba(255, 79, 216, 0.82));
  color: #071642;
  font-size: 15px;
  text-transform: uppercase;
}

@keyframes boostPulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.04);
  }
}

@media (hover: none) and (pointer: coarse) {
  .mobile-controls {
    display: grid;
  }
}

@media (max-height: 700px) {
  .panel-runner {
    display: none;
  }

  .boost-button {
    bottom: max(58px, calc(env(safe-area-inset-bottom) + 48px));
  }
}
