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

:root {
  --app-height: 100dvh;
  --app-vh: 1dvh;
}

html,
body {
  width: 100%;
  height: var(--app-height);
  min-height: var(--app-height);
  overflow: hidden;
  background: #050805;
  font-family: Arial, Helvetica, sans-serif;
  touch-action: none;
  -webkit-text-size-adjust: 100%;
}

body {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: var(--app-height);
  overscroll-behavior: none;
}

#root {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: var(--app-height);
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(3, 10, 4, 0.22), rgba(3, 10, 4, 0.56)),
    url("../assets/ui/BG Hover.png") center / cover no-repeat;
}

.hidden {
  display: none !important;
}

/* CAMERA */
#cameraView {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: var(--app-height);
  min-height: var(--app-height);
  object-fit: cover;
  background: #080808;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.camera-overlay {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.28) 0%, transparent 22%, transparent 78%, rgba(0, 0, 0, 0.22) 100%);
}

body.game-mode #cameraView {
  opacity: 1;
}

body.game-mode .camera-overlay {
  opacity: 1;
}

body.intro-mode #cameraView {
  opacity: 0;
}

body.intro-mode .camera-overlay {
  opacity: 0;
}

body.result-mode #cameraView,
body.result-mode .camera-overlay {
  opacity: 0;
}

/* In WebXR mode the browser provides the camera — hide our fallback elements */
body.xr-mode #cameraView,
body.xr-mode .camera-overlay {
  display: none !important;
}

.desktop-block {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 32px;
  color: #fff;
  text-align: center;
  background:
    linear-gradient(to bottom, rgba(2, 18, 5, 0.42), rgba(0, 8, 2, 0.84)),
    url("../assets/ui/bg_1080.png") center / cover no-repeat;
}

.desktop-block-panel {
  width: min(420px, 100%);
  display: grid;
  justify-items: center;
  gap: 14px;
}

.desktop-block-logo {
  width: min(300px, 78vw);
  height: auto;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.45));
}

.desktop-block h1 {
  margin-top: 4px;
  font-family: "Saira", Arial, Helvetica, sans-serif;
  font-size: 32px;
  line-height: 1;
  font-weight: 900;
}

.desktop-block p,
.desktop-block span {
  max-width: 320px;
  font-family: "Saira", Arial, Helvetica, sans-serif;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 700;
}

.desktop-block-qr {
  width: 180px;
  height: 180px;
  margin-top: 8px;
  padding: 10px;
  border-radius: 8px;
  background: #fff;
}

body.desktop-block-mode::before {
  display: none;
}

#xrCanvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: var(--app-height);
  min-height: var(--app-height);
  z-index: 1;
  display: none;
  background: transparent;
}

html.is-ios.is-standalone,
html.is-ios.is-standalone body,
html.is-ios.is-standalone #root,
html.is-ios.is-standalone #cameraView,
html.is-ios.is-standalone #xrCanvas {
  height: 100vh;
  min-height: 100vh;
}

body.xr-mode #xrCanvas {
  display: block;
}

body.camera-3d-mode #xrCanvas {
  z-index: 5;
  display: block;
  pointer-events: none;
}

/* GAME AREA */
#gameArea {
  position: fixed;
  inset: 0;
  z-index: 6;
  overflow: hidden;
  perspective: 900px;
  transform-style: preserve-3d;
}

/* CHILI ITEM */
.chili {
  position: absolute;
  width: clamp(54px, 10vw, 96px);
  height: auto;
  cursor: pointer;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: manipulation;
  transform-origin: 50% 58%;
  transform-style: preserve-3d;
  will-change: left, top, scale, filter;
  transition:
    left 90ms linear,
    top 90ms linear,
    scale 120ms ease,
    filter 120ms ease;
  filter:
    drop-shadow(0 8px 18px rgba(0, 0, 0, 0.55))
    drop-shadow(0 2px 6px rgba(0, 180, 60, 0.25));
  animation: chiliPop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.chili:active {
  transform: scale(0.82);
}

.chili-expire {
  animation: chiliExpire 0.38s ease-in forwards !important;
}

.chili-caught {
  animation: chiliCaught 0.28s ease-out forwards !important;
}

/* SUCCESS EFFECT */
.hit-effect {
  position: absolute;
  width: clamp(72px, 13vw, 112px);
  height: clamp(72px, 13vw, 112px);
  border-radius: 50%;
  border: 3px solid rgba(185, 255, 106, 0.95);
  pointer-events: none;
  animation: hitPulse 0.45s ease-out forwards;
}

.plus-one {
  position: absolute;
  color: #caff72;
  font-size: clamp(22px, 5vw, 34px);
  font-weight: 900;
  text-shadow: 0 5px 14px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  animation: plusOneMove 0.65s ease-out forwards;
}

/* ANIMATIONS */
@keyframes chiliPop {
  0% {
    transform: scale(0) rotate(-18deg);
    opacity: 0;
  }

  75% {
    transform: scale(1.14) rotate(8deg);
    opacity: 1;
  }

  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

@keyframes chiliExpire {
  0% {
    opacity: 1;
    transform: scale(1);
  }

  65% {
    opacity: 0.35;
    transform: scale(1);
  }

  100% {
    opacity: 0;
    transform: scale(1);
  }
}

@keyframes chiliCaught {
  0% {
    opacity: 1;
    transform: scale(1);
  }

  100% {
    opacity: 0;
    transform: scale(1.6);
  }
}

@keyframes hitPulse {
  0% {
    transform: scale(0.35);
    opacity: 1;
  }

  100% {
    transform: scale(1.55);
    opacity: 0;
  }
}

@keyframes plusOneMove {
  from {
    transform: translateY(0) scale(1);
    opacity: 1;
  }

  to {
    transform: translateY(-52px) scale(1.25);
    opacity: 0;
  }
}
