:root {
  --red: #e5202a;
  --red-deep: #b5121b;
  --ink: #120a0a;
  --white: #fff;
  --font-display: 'Rubik Glitch', 'Rubik', system-ui, sans-serif;
  --font-sans: 'Rubik', system-ui, sans-serif;
  --font-body: 'American Typewriter', 'Special Elite', 'Courier New', serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--ink); color: var(--white); overflow: hidden; }
body { font-family: var(--font-body); -webkit-tap-highlight-color: transparent; user-select: none; }

#app { position: relative; height: 100dvh; max-width: 600px; margin: 0 auto; overflow: hidden; }

/* ---------- Screens ---------- */
.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  opacity: 0; visibility: hidden;
  transition: opacity .5s ease, visibility .5s;
  background: var(--ink) center / cover no-repeat;
}
.screen.is-active { opacity: 1; visibility: visible; }

.content {
  position: relative; z-index: 2;
  flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: calc(env(safe-area-inset-top) + 9vh) 24px calc(env(safe-area-inset-bottom) + 6vh);
}
.content.center { justify-content: center; gap: 20px; }
.spacer { flex: 1; }

.screen--landing { background-image: url(../assets/bg-landing.jpg); }
.screen--landing::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.35) 0%, transparent 30%, transparent 60%, rgba(0,0,0,.55) 100%);
}
.screen--red { background-image: url(../assets/bg-red.jpg); }
.screen--red::after { content: ''; position: absolute; inset: 0; background: rgba(200, 10, 20, .35); mix-blend-mode: multiply; }

/* ---------- Type ---------- */
.kicker { font-family: var(--font-sans); font-size: clamp(22px, 6.5vw, 34px); letter-spacing: .08em; }
.glitch {
  font-family: var(--font-display); font-weight: 400; text-transform: uppercase;
  font-size: clamp(26px, 8vw, 44px); line-height: 1.05; letter-spacing: .02em;
  text-shadow: 2px 0 rgba(255,255,255,.25), -2px 0 rgba(0,0,0,.35);
}
.glitch--red { color: var(--red); font-size: clamp(36px, 11vw, 64px); text-shadow: 0 0 14px rgba(229,32,42,.5); }
.glitch--xl { font-size: clamp(44px, 14vw, 76px); line-height: .95; }
.body-copy { font-weight: 700; font-size: clamp(13px, 3.6vw, 17px); line-height: 1.35; max-width: 34ch; }
.screen--landing .body-copy { margin-bottom: 18px; }

/* ---------- Button ---------- */
.btn {
  display: inline-block; cursor: pointer; text-decoration: none;
  font-family: var(--font-display); text-transform: uppercase; font-size: clamp(16px, 4.6vw, 22px);
  color: var(--white); background: transparent;
  border: 2px solid var(--white); padding: 6px 14px;
  transition: background .2s, color .2s;
}
.btn:active { background: var(--white); color: var(--red-deep); }

/* ---------- Tips ---------- */
.tips {
  list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 22px 18px;
  width: min(100%, 250px); margin: 4vh 0 auto; padding-bottom: 20px;
  font-weight: 700; font-size: clamp(11px, 3.1vw, 14px); line-height: 1.25;
}
.tips li { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.tip-icon { width: 100%; aspect-ratio: 1; background: #000; border-radius: 6px; display: grid; place-items: center; }
.tip-icon svg { width: 62%; fill: none; stroke: var(--red); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.tip-icon .fill { fill: var(--red); stroke: none; }

/* ---------- Camera screen ---------- */
#camera { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.camera-shade { position: absolute; inset: 0; background: rgba(60, 0, 0, .3); }
.camera-shade::after { content: ''; position: absolute; inset: 0; background: url(../assets/grain.jpg) center / cover; mix-blend-mode: screen; opacity: .35; }
.radar { position: absolute; left: 50%; top: 46%; width: 125%; aspect-ratio: 1; transform: translate(-50%, -50%); pointer-events: none; mix-blend-mode: screen; }
.radar img { width: 100%; height: 100%; object-fit: contain; animation: pulse 2.4s ease-in-out infinite; }
.radar-line {
  position: absolute; left: 50%; top: 50%; width: 6px; height: 24%; transform: translateX(-50%);
  background: repeating-linear-gradient(var(--red) 0 16px, transparent 16px 26px);
}
@keyframes pulse { 50% { opacity: .75; transform: scale(1.03); } }

.arc-title { position: absolute; z-index: 3; top: calc(env(safe-area-inset-top) + 13vh); left: 50%; transform: translateX(-50%); width: min(80%, 360px); }
.arc-title text { font-family: var(--font-display); font-size: 20px; fill: var(--red); text-transform: uppercase; }

.state { position: absolute; inset: 0; z-index: 2; display: none; flex-direction: column; align-items: center; }
.state.is-active { display: flex; animation: fade .5s ease; }
@keyframes fade { from { opacity: 0; } }

.center-msg { position: absolute; top: 46%; transform: translateY(-50%); text-align: center; width: 100%; padding: 0 16px; font-size: clamp(22px, 7vw, 36px); }
.center-msg--sm { font-size: clamp(16px, 5vw, 26px); }

.hud {
  position: absolute; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom) + 5vh);
  display: flex; justify-content: space-between; align-items: flex-end; padding: 0 24px;
}
.hud-label { font-weight: 700; font-size: 15px; line-height: 1.15; margin-bottom: 6px; }
.energy { display: grid; gap: 3px; }
.energy i { display: block; height: 4px; background: var(--red); animation: meter 1.2s ease-in-out infinite alternate; }
.energy i:nth-child(1) { width: 52px; } .energy i:nth-child(2) { width: 40px; animation-delay: .2s; }
.energy i:nth-child(3) { width: 34px; animation-delay: .4s; } .energy i:nth-child(4) { width: 46px; animation-delay: .6s; }
@keyframes meter { to { transform: scaleX(.45); transform-origin: left; } }
.hud-right { text-align: right; }
.hud-value { font-weight: 700; font-size: 18px; }
.hud-coords { display: flex; gap: 10px; align-items: center; justify-content: flex-end; color: rgba(229,32,42,.6); font-size: 13px; line-height: 1.2; margin-top: 6px; }
.hazard { color: var(--red); font-size: 22px; }

.ghost { position: absolute; top: 20%; height: 60%; width: auto; filter: drop-shadow(0 0 30px rgba(0,0,0,.8)); animation: float 4s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-10px); } }
.chocolate { position: absolute; top: 28%; width: min(72%, 380px); }
.bottom {
  position: absolute; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom) + 6vh);
  display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding: 0 24px;
}
.code-label { font-weight: 700; font-size: 15px; }
.code { font-family: var(--font-display); color: var(--red); font-size: clamp(20px, 6vw, 30px); margin-top: -12px; user-select: all; }

/* ---------- Orientation guard (phones in landscape) ---------- */
.rotate { position: fixed; inset: 0; z-index: 99; display: none; place-items: center; text-align: center; padding: 24px; background: var(--ink); }
@media (orientation: landscape) and (max-height: 500px) { .rotate { display: grid; } }
