﻿:root {
  --bg-width: 2912;
  --bg-height: 1440;
  --timer-x: 2800;
  --timer-y: 1332;
  --score-x: 132;
  --score-y: 108;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at 20% 0%, #1c2430 0%, #0b0f15 45%, #030406 100%);
  color: #e7edf5;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body {
  display: grid;
  place-items: center;
}

.app {
  width: 100%;
  display: grid;
  place-items: center;
  padding: 12px;
}

.stage {
  position: relative;
  width: min(100%, calc((100vh - 24px) * (var(--bg-width) / var(--bg-height))));
  max-width: calc(100vw - 24px);
  aspect-ratio: calc(var(--bg-width) / var(--bg-height));
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  isolation: isolate;
  user-select: none;
  touch-action: none;
}

.bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.objects-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.9s ease;
  pointer-events: none;
}

.objects-layer.visible {
  opacity: 1;
}

.objects-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.target-item {
  position: absolute;
  transform-origin: top left;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.5));
  pointer-events: none;
}

.target-item.found-pulse {
  animation: foundPulse 0.5s ease-in-out infinite;
}

.target-item.found-static {
  opacity: 0.6;
}

.target-item.placeholder {
  border: 2px dashed rgba(255, 255, 255, 0.85);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.2);
}

.blackout,
.error-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.blackout {
  background: #000;
  opacity: 0;
}

.error-flash {
  background: rgba(240, 20, 20, 0.45);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.error-flash.active {
  opacity: 1;
}

.center-text {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  width: min(88%, 1020px);
  text-align: center;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.75);
  opacity: 0;
  pointer-events: none;
  z-index: 6;
}

.attention-text {
  font-size: clamp(20px, 2.2vw, 42px);
  font-weight: 700;
  letter-spacing: 0.4px;
}

.attention-text.visible {
  opacity: 1;
  animation: attentionPulse 1.4s ease-in-out infinite;
}

.instruction-text {
  font-size: clamp(16px, 1.25vw, 28px);
  line-height: 1.45;
  font-weight: 600;
  transition: opacity 0.6s ease;
}

.instruction-text.visible {
  opacity: 1;
}

.hud-circle {
  position: absolute;
  width: calc(178 / var(--bg-width) * 100%);
  aspect-ratio: 1;
  border-radius: 999px;
  background: rgba(8, 12, 20, 0.68);
  border: 2px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 28px rgba(0, 0, 0, 0.4), inset 0 0 24px rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(2px);
  display: grid;
  place-items: center;
  align-content: center;
  z-index: 8;
  pointer-events: none;
}

.score-hud {
  left: calc(var(--score-x) / var(--bg-width) * 100%);
  top: calc(var(--score-y) / var(--bg-height) * 100%);
  transform: translate(-50%, -50%);
}

.timer-hud {
  left: calc(var(--timer-x) / var(--bg-width) * 100%);
  top: calc(var(--timer-y) / var(--bg-height) * 100%);
  transform: translate(-50%, -50%);
}

.hud-label {
  font-size: clamp(10px, 0.62vw, 15px);
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: 0.84;
}

.hud-value {
  font-size: clamp(24px, 1.75vw, 40px);
  font-weight: 800;
  line-height: 1;
}

.result-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.68);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
  z-index: 30;
}

.result-modal.visible {
  opacity: 1;
  visibility: visible;
}

.result-card {
  width: min(92vw, 540px);
  border-radius: 16px;
  padding: 28px;
  background: linear-gradient(170deg, #f8faff 0%, #e7edf8 100%);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.42);
  color: #0f1928;
  text-align: center;
}

.result-title {
  margin: 0 0 10px;
  font-size: clamp(26px, 2.2vw, 40px);
}

.result-text {
  margin: 0 0 20px;
  font-size: clamp(16px, 1.2vw, 22px);
}

.restart-btn {
  border: 0;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(180deg, #0d7de7 0%, #045bb2 100%);
  color: #fff;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.restart-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 14px rgba(5, 71, 139, 0.35);
}

.restart-btn:active {
  transform: translateY(0);
}

@keyframes attentionPulse {
  0%,
  100% {
    opacity: 0.25;
  }
  50% {
    opacity: 1;
  }
}

@keyframes foundPulse {
  0% {
    filter: drop-shadow(0 0 5px rgba(34, 220, 90, 0.5)) drop-shadow(0 0 10px rgba(34, 220, 90, 0.3));
  }
  50% {
    filter: drop-shadow(0 0 10px rgba(34, 255, 112, 0.95)) drop-shadow(0 0 26px rgba(34, 255, 112, 0.78));
  }
  100% {
    filter: drop-shadow(0 0 5px rgba(34, 220, 90, 0.5)) drop-shadow(0 0 10px rgba(34, 220, 90, 0.3));
  }
}

@media (max-width: 900px) {
  .stage {
    border-radius: 10px;
  }

  .result-card {
    padding: 22px;
  }
}
