:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --ink: #f6fbff;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  position: fixed;
  inset: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  background-color: #06131f;
  color: var(--ink);
  font-family: ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(120% 90% at 14% 4%, rgba(255, 145, 78, 0.13), transparent 52%),
    radial-gradient(110% 85% at 93% 14%, rgba(78, 196, 255, 0.11), transparent 55%),
    radial-gradient(120% 110% at 50% 108%, rgba(149, 101, 255, 0.16), transparent 58%),
    linear-gradient(163deg, #0b2131 0%, #071826 42%, #040f19 100%);
}

/* Soft, slowly wandering colour clouds behind the fruit. */
.orb {
  position: absolute;
  z-index: 0;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform;
}

.orb-a {
  width: 52vmax;
  height: 52vmax;
  top: -24vmax;
  left: -18vmax;
  opacity: 0.55;
  background: radial-gradient(circle at 38% 38%, rgba(255, 146, 73, 0.4), rgba(255, 146, 73, 0) 68%);
  filter: blur(34px);
  animation: drift-a 29s ease-in-out infinite alternate;
}

.orb-b {
  width: 60vmax;
  height: 60vmax;
  top: 6vmax;
  right: -34vmax;
  opacity: 0.45;
  background: radial-gradient(circle at 50% 50%, rgba(54, 214, 194, 0.34), rgba(54, 214, 194, 0) 68%);
  filter: blur(42px);
  animation: drift-b 36s ease-in-out infinite alternate;
}

.orb-c {
  width: 56vmax;
  height: 56vmax;
  bottom: -30vmax;
  left: 12vmax;
  opacity: 0.42;
  background: radial-gradient(circle at 50% 50%, rgba(152, 106, 255, 0.36), rgba(152, 106, 255, 0) 68%);
  filter: blur(48px);
  animation: drift-c 32s ease-in-out infinite alternate;
}

#game {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  outline: none;
}

.vignette {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: radial-gradient(125% 95% at 50% 44%, transparent 56%, rgba(0, 6, 11, 0.52) 100%);
}

.hint {
  position: absolute;
  top: calc(var(--safe-top) + 18px);
  left: 50%;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 0.45em;
  margin: 0;
  padding: 0.62em 1.15em;
  transform: translate(-50%, 6px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(9, 26, 40, 0.58);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  color: rgba(246, 251, 255, 0.92);
  font-size: clamp(15px, 2.5vmin, 20px);
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.hint.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.hint.is-hidden {
  opacity: 0;
  transform: translate(-50%, -9px);
  transition-duration: 0.5s;
}

.hint-spark {
  color: #ffd977;
  font-size: 0.9em;
  text-shadow: 0 0 12px rgba(255, 208, 96, 0.7);
}

.sound-toggle {
  position: absolute;
  top: calc(var(--safe-top) + 15px);
  right: calc(var(--safe-right) + 15px);
  z-index: 5;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 50%;
  background: rgba(7, 22, 34, 0.34);
  color: rgba(235, 247, 255, 0.64);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.sound-toggle:hover {
  background: rgba(12, 34, 50, 0.6);
  color: rgba(246, 251, 255, 0.92);
}

.sound-toggle:active {
  transform: scale(0.9);
}

.sound-toggle:focus-visible {
  outline: 2px solid rgba(255, 217, 119, 0.9);
  outline-offset: 3px;
}

.sound-toggle svg {
  width: 21px;
  height: 21px;
}

.sound-toggle .icon-off {
  display: none;
}

.sound-toggle[data-muted="true"] {
  color: rgba(235, 247, 255, 0.4);
}

.sound-toggle[data-muted="true"] .icon-on {
  display: none;
}

.sound-toggle[data-muted="true"] .icon-off {
  display: block;
}

.safe-probe {
  position: fixed;
  inset: 0;
  visibility: hidden;
  pointer-events: none;
  padding:
    env(safe-area-inset-top, 0px)
    env(safe-area-inset-right, 0px)
    env(safe-area-inset-bottom, 0px)
    env(safe-area-inset-left, 0px);
}

.noscript {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 10;
  transform: translate(-50%, -50%);
  padding: 1rem 1.5rem;
  border-radius: 1rem;
  background: rgba(8, 24, 38, 0.9);
  color: #fff;
  font-weight: 600;
}

@keyframes drift-a {
  to {
    transform: translate3d(11vmax, 7vmax, 0) scale(1.1);
  }
}

@keyframes drift-b {
  to {
    transform: translate3d(-13vmax, 9vmax, 0) scale(0.94);
  }
}

@keyframes drift-c {
  to {
    transform: translate3d(9vmax, -10vmax, 0) scale(1.08);
  }
}

@media (prefers-reduced-motion: reduce) {
  .orb {
    animation: none;
  }

  .hint {
    transition-duration: 0.2s;
  }
}
