
:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  background: #17110b;
  font-family: Arial, Helvetica, sans-serif;
  touch-action: none;
  user-select: none;
}

body {
  overscroll-behavior: none;
}

#app, .game-area {
  width: 100%;
  height: 100%;
}

.game-area {
  position: fixed;
  inset: 0;
  overflow: hidden;

  /* Background is CSS, so it remains visible even if canvas timing differs. */
  background-image: url("./assets/ednica.png");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}

.shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(0,0,0,.18), rgba(0,0,0,.02) 35%, rgba(0,0,0,.18));
}

.hidden {
  display: none !important;
}

.hud {
  position: absolute;
  z-index: 30;
  top: calc(12px + var(--safe-top));
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.hud-card {
  min-width: 92px;
  padding: 9px 14px;
  border-radius: 16px;
  color: white;
  background: rgba(20, 14, 9, .75);
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  backdrop-filter: blur(8px);
}

.hud-label {
  display: block;
  font-size: 10px;
  letter-spacing: 1.3px;
  opacity: .72;
  margin-bottom: 2px;
}

.hud-card strong {
  font-size: 20px;
}

.pizza-layer {
  position: absolute;
  z-index: 12;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.pizza {
  position: absolute;
  top: 0;
  left: 0;
  width: 82px;
  height: 82px;
  object-fit: contain;
  transform-origin: 50% 50%;
  filter: drop-shadow(0 7px 5px rgba(0,0,0,.28));
  will-change: transform;
}

.catcher {
  position: absolute;
  z-index: 20;
  width: 120px;
  height: 58px;
  bottom: calc(18px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid #6b350c;
  border-top: 0;
  border-radius: 10px 10px 30px 30px;
  background: linear-gradient(#e8a649, #ba6a1c);
  box-shadow: 0 10px 24px rgba(0,0,0,.35);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 27px;
}

.catcher-rim {
  position: absolute;
  left: -7px;
  right: -7px;
  top: -12px;
  height: 18px;
  border: 4px solid #6b350c;
  border-radius: 50%;
  background: #f1b55b;
}

.catcher span {
  position: relative;
  z-index: 2;
}

.screen {
  position: absolute;
  z-index: 50;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(24px + var(--safe-top)) 20px calc(24px + var(--safe-bottom));
  background: rgba(16, 10, 6, .30);
}

.panel {
  width: min(92vw, 420px);
  padding: 30px 24px 24px;
  border-radius: 28px;
  text-align: center;
  color: #fff;
  background: rgba(30, 18, 10, .88);
  border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 24px 70px rgba(0,0,0,.45);
  backdrop-filter: blur(12px);
}

.logo {
  font-size: 58px;
  line-height: 1;
  margin-bottom: 10px;
}

h1, h2 {
  margin: 0;
  font-weight: 900;
  letter-spacing: .5px;
}

h1 {
  font-size: clamp(34px, 10vw, 48px);
}

h2 {
  font-size: clamp(28px, 8vw, 40px);
}

.panel > p {
  margin: 9px 0 18px;
  font-weight: 700;
  opacity: .8;
}

.round-info {
  padding: 14px;
  margin: 0 0 18px;
  border-radius: 16px;
  background: rgba(255,255,255,.08);
}

.primary-btn {
  width: 100%;
  min-height: 58px;
  border: 0;
  border-radius: 18px;
  font-size: 20px;
  font-weight: 900;
  color: #281500;
  background: linear-gradient(180deg, #ffc34a, #f39b16);
  box-shadow: 0 8px 0 #a85c0c, 0 14px 30px rgba(0,0,0,.25);
  cursor: pointer;
}

.primary-btn:active {
  transform: translateY(4px);
  box-shadow: 0 4px 0 #a85c0c, 0 8px 20px rgba(0,0,0,.24);
}

@media (max-height: 600px) {
  .catcher {
    bottom: calc(8px + var(--safe-bottom));
  }
  .panel {
    padding-top: 22px;
  }
  .logo {
    font-size: 45px;
  }
}


/* Click/tap collection mode */
.pizza-layer {
  pointer-events: none;
}

.pizza {
  pointer-events: auto;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-drag: none;
  transition: opacity 260ms ease, filter 260ms ease;
}

.pizza.collected {
  pointer-events: none;
  animation: pizza-pop 260ms cubic-bezier(.2,.9,.3,1) forwards;
}

@keyframes pizza-pop {
  0% {
    opacity: 1;
    scale: 1;
  }
  45% {
    opacity: 1;
    scale: 1.35;
    filter: drop-shadow(0 10px 10px rgba(0,0,0,.2)) brightness(1.2);
  }
  100% {
    opacity: 0;
    scale: .35;
    rotate: 22deg;
    filter: drop-shadow(0 0 0 transparent) brightness(1.35);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pizza.collected {
    animation-duration: 120ms;
  }
}


/* Food + trash bin mode */
.trash-wrap {
  position: absolute;
  z-index: 25;
  right: 12px;
  bottom: calc(12px + var(--safe-bottom));
  width: 108px;
  height: 120px;
  pointer-events: none;
}

.trash-bin {
  position: absolute;
  inset: 0;
  width: 108px;
  height: 120px;
  object-fit: contain;
  z-index: 3;
  filter: drop-shadow(0 8px 10px rgba(0,0,0,.3));
}

.trash-fill {
  position: absolute;
  left: 23px;
  right: 23px;
  bottom: 18px;
  height: 0%;
  max-height: 73px;
  background:
    radial-gradient(circle at 30% 20%, #ffcc44 0 10px, transparent 11px),
    radial-gradient(circle at 70% 35%, #e4472f 0 11px, transparent 12px),
    radial-gradient(circle at 45% 60%, #8cc63f 0 12px, transparent 13px),
    linear-gradient(to top, #8b5a2b, #d89b3f);
  border-radius: 10px 10px 14px 14px;
  overflow: hidden;
  z-index: 2;
  transition: height 220ms ease;
  opacity: .96;
}

.plus-one {
  position: absolute;
  z-index: 40;
  font-size: 24px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 6px #000, 0 0 8px rgba(255,178,31,.9);
  pointer-events: none;
  animation: plus-pop 650ms ease-out forwards;
}

@keyframes plus-pop {
  0%   { opacity: 0; transform: translate(-50%, -20%) scale(.7); }
  25%  { opacity: 1; transform: translate(-50%, -45%) scale(1.2); }
  100% { opacity: 0; transform: translate(-50%, -120%) scale(.95); }
}

.food-fly-clone {
  position: absolute;
  z-index: 39;
  pointer-events: none;
  object-fit: contain;
  filter: drop-shadow(0 7px 5px rgba(0,0,0,.28));
  will-change: transform, opacity;
}

@media (max-width: 390px) {
  .trash-wrap {
    width: 94px;
    height: 105px;
    right: 8px;
    bottom: calc(8px + var(--safe-bottom));
  }
  .trash-bin {
    width: 94px;
    height: 105px;
  }
  .trash-fill {
    left: 20px;
    right: 20px;
    bottom: 16px;
    max-height: 64px;
  }
}
