:root {
  color-scheme: dark;
  --ink: #f8f7ef;
  --muted: rgba(248, 247, 239, 0.72);
  --gold: #ffca1f;
  --hot: #ff4b86;
  --aqua: #38d6e8;
  --panel: rgba(15, 15, 18, 0.62);
  --stroke: rgba(255, 255, 255, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #0d0d11;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  touch-action: none;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.shell {
  position: relative;
  width: 100vw;
  height: 100svh;
  min-height: 420px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 202, 31, 0.22), transparent 26%),
    radial-gradient(circle at 82% 18%, rgba(56, 214, 232, 0.16), transparent 24%),
    linear-gradient(180deg, #16161d 0%, #101014 48%, #09090c 100%);
}

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

.hud {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  display: flex;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}

.hud > div,
.restart {
  min-width: 78px;
  padding: 9px 12px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(12px);
}

.label {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
}

.hud strong {
  display: block;
  margin-top: 3px;
  color: #fff;
  font-size: 19px;
  line-height: 1;
}

.restart,
.music {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  min-width: 104px;
  color: #15130b;
  background: linear-gradient(180deg, #ffe36f 0%, var(--gold) 100%);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

.music {
  top: calc(max(14px, env(safe-area-inset-top)) + 46px);
  min-width: 104px;
  color: #f8f7ef;
  background: rgba(15, 15, 18, 0.72);
}

.music.is-on {
  color: #111116;
  background: linear-gradient(180deg, #7ff5ff 0%, #38d6e8 100%);
}

.mobile-controls {
  position: absolute;
  inset: auto max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  pointer-events: none;
}

.joystick,
.jump {
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.joystick {
  position: relative;
  width: clamp(108px, 18vw, 142px);
  aspect-ratio: 1;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.02)),
    rgba(0, 0, 0, 0.34);
  box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.36), 0 16px 36px rgba(0, 0, 0, 0.28);
}

.stick {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: linear-gradient(180deg, #fff 0%, #d9e1ea 100%);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35), inset -8px -8px 14px rgba(0, 0, 0, 0.13);
}

.jump {
  width: clamp(92px, 15vw, 124px);
  aspect-ratio: 1;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  color: #14100a;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.52), transparent 44%),
    linear-gradient(180deg, #ffd94a 0%, #ff9f1f 100%);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.32), inset 0 -8px 12px rgba(142, 70, 0, 0.22);
  font-size: 14px;
  font-weight: 950;
}

.jump:active,
.restart:active,
.music:active {
  transform: translateY(1px) scale(0.98);
}

@media (hover: hover) and (pointer: fine) {
  .mobile-controls {
    opacity: 0.74;
  }
}

@media (max-width: 720px) and (orientation: portrait) {
  .shell {
    min-height: 560px;
  }

  .hud {
    gap: 6px;
  }

  .hud > div {
    min-width: 62px;
    padding: 8px 9px;
  }

  .hud strong {
    font-size: 16px;
  }

  .restart {
    min-width: 88px;
    padding: 8px 10px;
    font-size: 12px;
  }

  .music {
    top: calc(max(14px, env(safe-area-inset-top)) + 42px);
    min-width: 88px;
    padding: 8px 10px;
    font-size: 12px;
  }
}
