/* ============ POINTERPOINTER CLONE — immortal edition ============ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  background: #000000;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  cursor: crosshair;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center,
              rgba(0, 0, 0, 0) 55%,
              rgba(0, 0, 0, 0.38) 100%);
  pointer-events: none;
  z-index: 3;
}

/* ---------------- title card ---------------- */

#intro {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(28px + env(safe-area-inset-top))
           calc(28px + env(safe-area-inset-right))
           calc(28px + env(safe-area-inset-bottom))
           calc(28px + env(safe-area-inset-left));
  text-align: center;
  transition: opacity 0.6s ease;
}

#intro.gone {
  opacity: 0;
  pointer-events: none;
}

.intro-card {
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

#intro h1 {
  font-size: clamp(20px, 5vw, 40px);
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #ffffff;
  text-shadow: 0 0 26px rgba(255, 255, 255, 0.35);
  animation: riseIn 0.8s ease both;
}

.intro-line {
  color: #b9b9b9;
  font-size: clamp(13px, 2.6vw, 15px);
  line-height: 1.7;
  letter-spacing: 0.03em;
  animation: riseIn 0.8s ease both;
}

.intro-line:nth-of-type(1) { animation-delay: 0.20s; }
.intro-line:nth-of-type(2) { animation-delay: 0.40s; }
.intro-line:nth-of-type(3) { animation-delay: 0.60s; }

#intro .hint {
  margin-top: 12px;
  color: #ffffff;
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  animation: pulse 1.6s ease infinite;
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

@keyframes pulse {
  0%, 100% { opacity: 0.35; }
  50%      { opacity: 1; }
}

/* ---------------- the void prompt ---------------- */

#message {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  text-align: center;
  font-size: clamp(16px, 3vw, 21px);
  letter-spacing: 0.06em;
  color: #e8e8e8;
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.25);
  opacity: 1;
  transition: opacity 0.35s ease;
  pointer-events: none;
  z-index: 1;
}

#message.hidden {
  opacity: 0;
}

/* ---------------- the photo ---------------- */

#pointer {
  position: fixed;
  opacity: 0;
  transform: scale(1.045);
  transition: opacity 0.5s ease,
              transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  -webkit-user-drag: none;
  z-index: 2;
}

#pointer.visible {
  opacity: 1;
  transform: scale(1);
}

/* ---------------- tracer + scanner ---------------- */

.marker {
  position: fixed;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 5;
}

.marker svg {
  overflow: visible;
  transform: rotate(-90deg);
  filter: drop-shadow(0 0 7px rgba(255, 255, 255, 0.75));
}

.marker .ring {
  fill: none;
  stroke: #ffffff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: var(--circ);
  stroke-dashoffset: var(--circ);
  animation: trace 0.55s cubic-bezier(0.3, 0.7, 0.3, 1) forwards;
}

.marker .scan {
  fill: none;
  stroke: rgba(255, 255, 255, 0.55);
  stroke-width: 1.5;
  stroke-dasharray: 46 167.7;
  opacity: 0;
  transition: opacity 0.3s ease;
  animation: scanSpin 1.1s linear infinite;
}

.marker.scanning .scan { opacity: 1; }
.marker.locked .scan   { opacity: 0; }

.marker .dot {
  fill: #ffffff;
  opacity: 0;
  animation: dotIn 0.25s ease 0.4s forwards;
}

.marker.done {
  opacity: 0;
  transition: opacity 0.6s ease;
}

@keyframes trace {
  to { stroke-dashoffset: 0; }
}

@keyframes scanSpin {
  to { stroke-dashoffset: -213.7; }
}

@keyframes dotIn {
  to { opacity: 1; }
}

/* ---------------- backup-mode toast ---------------- */

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(8px);
  background: rgba(18, 18, 18, 0.88);
  border: 1px solid #333333;
  color: #d9d9d9;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.05em;
  padding: 8px 16px;
  border-radius: 999px;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
  z-index: 8;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
