:root {
  color-scheme: dark;
  background: #181714;
}

* { box-sizing: border-box; }

html, body { min-width: 320px; min-height: 100%; margin: 0; }

body { overflow: hidden; }

.scene {
  position: relative;
  width: 100%;
  min-height: 100svh;
  overflow: clip;
  isolation: isolate;
  background:
    radial-gradient(ellipse 70% 55% at 48% 42%, rgba(84, 75, 58, .32), transparent 75%),
    radial-gradient(ellipse 55% 70% at 4% 93%, rgba(82, 59, 43, .22), transparent 78%),
    radial-gradient(ellipse 70% 60% at 94% 8%, rgba(70, 55, 42, .18), transparent 78%),
    linear-gradient(125deg, #25231e 0%, #191916 43%, #201e19 100%);
}

/* A cached Canvas tile adds mineral detail over the existing lighting. */
.scene::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .78;
  background-image: var(--sand-texture);
  background-size: var(--sand-tile-size) var(--sand-tile-size);
  background-repeat: repeat;
  mix-blend-mode: overlay;
}

.scene::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  background: radial-gradient(ellipse 90% 80% at 50% 46%, transparent 42%, rgba(6, 6, 5, .34) 100%);
}

.fruit {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--size);
  height: auto;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
  transform: translate(-50%, -50%) translate(var(--clear-x, 0px), var(--clear-y, 0px)) rotate(var(--rotation));
  filter: drop-shadow(0 19px 13px rgba(0, 0, 0, .4)) drop-shadow(0 4px 4px rgba(0, 0, 0, .24));
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.surprise-button {
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: max(28px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  min-width: 204px;
  padding: 12px 28px;
  border: 1px solid rgba(255, 246, 218, .65);
  border-radius: 100px;
  background: linear-gradient(150deg, #eee7d4, #d6c5a3);
  color: #383a2c;
  box-shadow: 0 8px 32px #0006, inset 0 1px 0 #fff7;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 18px);
  transition: opacity 800ms ease, transform 800ms cubic-bezier(.22, 1, .36, 1), visibility 800ms;
  -webkit-tap-highlight-color: transparent;
}

.surprise-button.is-ready {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.surprise-button.is-dismissed {
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 14px);
  transition-duration: 350ms;
}

.surprise-button:hover { box-shadow: 0 10px 36px #0008, inset 0 1px 0 #fff9; }
.surprise-button:focus-visible { outline: 2px solid #fff5d3; outline-offset: 5px; }
.surprise-label { display: grid; gap: 2px; text-align: center; }
.surprise-label [lang="ar"] { font: 23px/1.2 Tahoma, Arial, sans-serif; }
.surprise-label [lang="en"] { font: 10px/1.4 Arial, sans-serif; letter-spacing: 1.5px; text-transform: uppercase; }

.plated-fruit {
  position: absolute;
  z-index: 12;
  height: auto;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 7px 5px #0005) drop-shadow(0 2px 2px #0003);
}
.fruit { opacity: 1; }
.surprise-button:disabled { cursor: wait; }

@media (prefers-reduced-motion: reduce) {
  .surprise-button { transition-duration: 250ms; }
}

.fruit { z-index: 1; }
/* Both layers sit beneath the curated fruit and never receive pointer input. */
.sand-response {
  position: absolute;
  z-index: 0;
  pointer-events: none;
  background-size: 100% 100%;
  transform: translate(-50%, -50%);
  opacity: 0;
}
.curation-plate {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  transform: translate(-50%, -50%);
  object-fit: contain;
  /* The PNG is the only plate artwork; its transparent outline casts a shadow. */
  filter: drop-shadow(0 16px 12px #0006) drop-shadow(0 3px 3px #0005);
}
