/* ============================================
   ŠKODA – 9 druhů plýtvání (specifické styly)
   ============================================ */

.play-area-waste {
  background: #1a3026;
  padding: 0;
  display: flex;
  flex-direction: column;
}

/* Viewport = clipping window */
.hall-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-card);
  touch-action: none;
  user-select: none;
  cursor: grab;
}

.hall-viewport.is-dragging { cursor: grabbing; }

/* The world is bigger than the viewport — only a slice is visible through the lens */
.hall-world {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--world-w, 900px);
  height: var(--world-h, 900px);
  transition: none;
}

/* Cover image of the whole hall — single image, fills the world */
.hall-cover {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* Bottom layer: schematic overview — slightly dimmed so detail under the lens stands out */
.hall-world--blur {
  filter: brightness(0.7) saturate(0.85) contrast(0.95);
  z-index: 1;
}

/* Top layer: sharp 2x2 grid of waste scenes, only revealed inside the lens */
.hall-world--bright {
  z-index: 3;
  pointer-events: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 0;
  -webkit-mask-image: radial-gradient(circle var(--lens-r, 80px) at var(--lens-wx, -999px) var(--lens-wy, -999px), #000 99%, transparent 100%);
  mask-image: radial-gradient(circle var(--lens-r, 80px) at var(--lens-wx, -999px) var(--lens-wy, -999px), #000 99%, transparent 100%);
}

.hall-cell {
  position: relative;
  overflow: hidden;
}

/* Blurred dark seam between the four cells so the hard edges don't pop visually.
   The pseudo-element draws a thin cross right at the seams (50%/50%) and a heavy
   blur smears it into a soft gradient on either side. */
.hall-world--bright::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    linear-gradient(90deg,
      transparent 0%,
      transparent calc(50% - 4px),
      rgba(0, 0, 0, 0.45) 50%,
      transparent calc(50% + 4px),
      transparent 100%),
    linear-gradient(0deg,
      transparent 0%,
      transparent calc(50% - 4px),
      rgba(0, 0, 0, 0.45) 50%,
      transparent calc(50% + 4px),
      transparent 100%);
  filter: blur(7px);
}

.hall-cell img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* The "_opraveno" image already shows the fix, so we just play a brief flash and a small badge */
.hall-cell.is-fixed img {
  animation: cell-fixed-flash 0.7s ease-out;
}

.hall-cell.is-fixed::after {
  content: "✓";
  position: absolute;
  top: 8%;
  right: 8%;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--skoda-green-light);
  color: var(--skoda-green-dark);
  font-size: 22px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  animation: cell-fixed-badge 0.55s ease-out;
}

@keyframes cell-fixed-flash {
  0% { filter: brightness(1); }
  35% { filter: brightness(1.4) saturate(1.2); }
  100% { filter: brightness(1); }
}

@keyframes cell-fixed-badge {
  0% { transform: scale(0.2); opacity: 0; }
  60% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* Lens — looks like a real magnifying glass: brass ring, glass highlight, vignette around */
.lens {
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0.06) 18%, transparent 32%),
    radial-gradient(circle at 70% 78%, rgba(0, 0, 0, 0.18) 0%, transparent 30%);
  box-shadow:
    /* brass ring (light + dark for depth) */
    0 0 0 5px #f4c66e,
    0 0 0 11px #b07820,
    0 0 0 14px #6b4615,
    /* outer drop shadow */
    0 10px 26px rgba(0, 0, 0, 0.55),
    /* dim around the lens — softer than before so the schematic map stays readable */
    0 0 0 9999px rgba(0, 0, 0, 0.42),
    /* glass highlights inside */
    inset 0 8px 22px rgba(255, 255, 255, 0.22),
    inset 0 -10px 18px rgba(0, 0, 0, 0.18);
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 4;
  transition: width 0.15s ease, height 0.15s ease;
}

/* Handle starts at the lower-right edge of the ring (~45° from center)
   and points outward radially (continuing the same 45° direction). */
.lens-handle {
  position: absolute;
  /* anchor at the ring edge — lower-right at 45° */
  left: 85.36%;   /* cos(45°)/2 + 50% = ~85.36% */
  top: 85.36%;
  width: 22px;
  height: 90px;
  /* origin at top-center so the bar grows outward from the ring */
  transform-origin: 50% 0%;
  transform: translate(-50%, 0) rotate(-45deg); /* point bottom-right radially */
  background:
    linear-gradient(90deg,
      #6b4615 0%,
      #b07820 18%,
      #f4c66e 50%,
      #b07820 82%,
      #6b4615 100%);
  border-radius: 11px;
  box-shadow:
    0 4px 10px rgba(0, 0, 0, 0.5),
    inset 0 0 6px rgba(0, 0, 0, 0.3);
}

/* Knob at the very end of the handle */
.lens-handle::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 22px;
  background: radial-gradient(ellipse at 30% 30%, #f4c66e 0%, #8a5a18 75%, #4a2f0d 100%);
  border-radius: 50%;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5);
}

/* The "ferrule" where the handle meets the ring */
.lens-handle::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 14px;
  background: radial-gradient(ellipse at center, #f4c66e 0%, #8a5a18 80%);
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* When lens is over a not-yet-found waste cell, glow softly */
.lens.is-on-target {
  box-shadow:
    0 0 0 5px #fff2cc,
    0 0 0 11px #d49640,
    0 0 0 14px #6b4615,
    0 10px 26px rgba(0, 0, 0, 0.55),
    0 0 0 9999px rgba(0, 0, 0, 0.42),
    inset 0 8px 22px rgba(255, 255, 255, 0.28),
    inset 0 -10px 18px rgba(0, 0, 0, 0.18),
    0 0 40px rgba(247, 169, 42, 0.6);
  animation: lens-pulse 0.9s ease-in-out infinite;
}

@keyframes lens-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.04); }
}

/* Found counter pill */
.found-counter {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--skoda-green-light);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
  z-index: 4;
}

/* Bottom waste list */
.waste-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-top: 8px;
  flex-shrink: 0;
}

.waste-chip {
  background: var(--skoda-green-mid);
  border: 1px solid var(--skoda-green-line);
  color: var(--skoda-white);
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-align: left;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  min-height: 38px;
  line-height: 1.15;
}

.waste-chip:hover {
  background: var(--skoda-green-line);
  border-color: var(--skoda-orange);
}

.waste-chip-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--skoda-orange);
  color: var(--skoda-green-dark);
  font-weight: 800;
  font-size: 10px;
  flex-shrink: 0;
}

.waste-chip.is-found {
  background: rgba(159, 229, 176, 0.18);
  border-color: var(--skoda-green-light);
  color: var(--skoda-green-light);
  cursor: default;
  opacity: 0.85;
}

.waste-chip.is-found .waste-chip-num {
  background: var(--skoda-green-light);
}

.waste-chip.is-found::after {
  content: "✓";
  margin-left: auto;
  color: var(--skoda-green-light);
  font-weight: 800;
}

.waste-chip.is-wrong {
  animation: shake 0.35s ease-out;
  border-color: var(--skoda-red);
}

/* ===== Bigger viewport on tablet+ ===== */
@media (min-width: 640px) {
  .lens { width: 280px; height: 280px; }
  .lens-handle { width: 26px; height: 110px; }
  .waste-chip { font-size: 12px; padding: 8px 10px; min-height: 46px; }
  .waste-chip-num { width: 22px; height: 22px; font-size: 12px; }
  .found-counter { font-size: 15px; padding: 8px 16px; top: 14px; left: 14px; }
}
