/* =========================================================
   ZOMBIE EARTH — Agent Assessment (v2)
   #0a0a0a bg, #B10100 accent, #0d1f1f teal metal
   IBM Plex Mono throughout. No rounded corners. No glow.
   ========================================================= */

:root {
  --bg: #0a0a0a;
  --accent: #B10100;
  --accent-hover: #8A0000;
  --secondary: #2a4a4f;
  --teal: #0d1f1f;
  --text: #e8e4d9;
  --hover: #1a0000;
  --muted: #5a5650;
  --border: #222;
  --input-bg: #1a1a1a;
  --button-bg: #111111;

  --font: 'IBM Plex Mono', 'Courier New', monospace;
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 1px;
}

/* ---- Screens ---- */
.screen {
  display: none;
}
.screen.active {
  display: flex;
  animation: fadeIn 0.4s ease both;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---- App wrapper ---- */
.app {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ================================================
   SPLASH SCREEN
   ================================================ */
.splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #8B0000;
  animation: splashHold 2.5s ease forwards;
  pointer-events: none;
}

@keyframes splashHold {
  0% { opacity: 1; }
  60% { opacity: 1; }
  100% { opacity: 0; visibility: hidden; }
}

/* ================================================
   GLITCH ANIMATION (plays once, 2.5s after page load)
   ================================================ */
.glitch {
  position: relative;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
}

.glitch::before {
  color: var(--accent);
  animation: glitchBefore 1s ease forwards;
  animation-delay: 2.5s;
}

.glitch::after {
  color: var(--accent);
  animation: glitchAfter 1s ease forwards;
  animation-delay: 2.5s;
}

@keyframes glitchBefore {
  0% { clip-path: inset(40% 0 20% 0); transform: translateX(-4px); opacity: 0.9; }
  10% { clip-path: inset(10% 0 60% 0); transform: translateX(5px); opacity: 0.7; }
  20% { clip-path: inset(70% 0 5% 0); transform: translateX(-3px); opacity: 0.8; }
  30% { clip-path: inset(20% 0 30% 0); transform: translateX(4px); opacity: 0.6; }
  45% { clip-path: inset(0 0 0 0); transform: translateX(-1px); opacity: 0.3; }
  60% { clip-path: inset(0 0 0 0); transform: translateX(0); opacity: 0; }
  100% { clip-path: inset(0 0 0 0); transform: translateX(0); opacity: 0; }
}

@keyframes glitchAfter {
  0% { clip-path: inset(20% 0 40% 0); transform: translateX(4px); opacity: 0.8; }
  15% { clip-path: inset(50% 0 10% 0); transform: translateX(-5px); opacity: 0.6; }
  25% { clip-path: inset(5% 0 70% 0); transform: translateX(3px); opacity: 0.7; }
  40% { clip-path: inset(30% 0 20% 0); transform: translateX(-4px); opacity: 0.5; }
  55% { clip-path: inset(0 0 0 0); transform: translateX(1px); opacity: 0.2; }
  70% { clip-path: inset(0 0 0 0); transform: translateX(0); opacity: 0; }
  100% { clip-path: inset(0 0 0 0); transform: translateX(0); opacity: 0; }
}

/* ================================================
   LANDING
   ================================================ */
.landing {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 560px;
  padding: 12px 20px 32px;
  margin-top: -30px;
  background: #111111;
  border: 1px solid #222;
}

.landing-img {
  width: 100%;
  max-width: 520px;
  height: auto;
  display: block;
  margin-bottom: 8px;
}

.landing-copy {
  font-family: 'Oxanium', sans-serif;
  font-weight: 400;
  font-size: 18px;
  letter-spacing: 2px;
  color: var(--text);
  margin-bottom: 12px;
  text-align: center;
  position: relative;
  top: -35px;
  white-space: nowrap;
}

@media (max-width: 520px) {
  .landing-copy {
    white-space: normal;
  }
}

.landing-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.landing-form input {
  width: 100%;
  max-width: 320px;
  display: block;
  margin: 0 auto;
  padding: 12px 14px;
  background: var(--input-bg);
  border: 1px solid var(--accent);
  border-radius: 0;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  letter-spacing: 1px;
  outline: none;
  transition: border-color 0.2s;
}

.landing-form input::placeholder {
  color: var(--muted);
}

.landing-form input:focus {
  border-color: var(--accent);
}

/* ---- PROCEED Button ---- */
.btn-proceed {
  width: 100%;
  max-width: 240px;
  height: 56px;
  background: transparent;
  border: 2px solid var(--accent);
  border-radius: 0;
  cursor: pointer;
  padding: 0;
  margin-top: 4px;
  transition: background 0.2s, color 0.2s;
}

.btn-proceed:hover {
  background: var(--accent);
}

.btn-proceed:hover .btn-proceed-inner {
  color: var(--bg);
  animation: none;
}

.btn-proceed:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-proceed-inner {
  font-family: 'Oxanium', sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 4px;
  color: var(--accent);
  white-space: nowrap;
  display: block;
  text-align: center;
  animation: textPulse 1s ease-in-out infinite;
}

@keyframes textPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ================================================
   QUIZ — Worn teal metal background
   ================================================ */
.quiz {
  width: 100%;
  max-width: 560px;
  padding: 24px 20px 80px;
  position: relative;
}

/* Noise/grain overlay */
.screen-quiz-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

#screen-quiz,
#screen-results {
  background: var(--teal);
  position: relative;
}

#screen-quiz::before,
#screen-results::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

#screen-quiz > *,
#screen-results > * {
  position: relative;
  z-index: 1;
}

/* ---- Quiz Header ---- */
.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}

.quiz-emblem {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.emblem-img {
  max-width: 60px;
  height: auto;
  display: block;
}

.emblem-label {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 3px;
  color: #cc0000;
  text-transform: uppercase;
}

.quiz-progress {
  font-family: var(--font);
  font-size: 12px;
  color: var(--secondary);
  letter-spacing: 1px;
}

.quiz-question {
  margin-bottom: 24px;
}

.quiz-text {
  font-family: var(--font);
  font-weight: 400;
  font-size: 22px;
  line-height: 1.4;
  color: var(--text);
  letter-spacing: 1px;
  text-align: left;
}

/* ---- Option Buttons ---- */
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  width: 100%;
  text-align: left;
  padding: 16px 18px;
  background: var(--button-bg);
  border: 1px solid var(--secondary);
  border-radius: 0;
  color: var(--text);
  font-family: var(--font);
  font-size: 18px;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.4);
}

.option-btn:hover {
  background: var(--hover);
  border-color: var(--accent);
}

.option-btn.selected {
  background: var(--hover);
  border-color: var(--accent);
  animation: selectFlash 0.3s ease;
}

@keyframes selectFlash {
  0% { border-color: #ff3333; }
  50% { border-color: #ff6666; }
  100% { border-color: var(--accent); }
}

.option-btn .opt-label {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
  min-width: 28px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  letter-spacing: 1px;
}

/* Q7 text input */
.quiz-textinput {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quiz-textinput input {
  width: 100%;
  padding: 14px 16px;
  background: var(--input-bg);
  border: 1px solid var(--accent);
  border-radius: 0;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  letter-spacing: 1px;
  outline: none;
  transition: border-color 0.2s;
}

.quiz-textinput input::placeholder {
  color: var(--muted);
}

.quiz-textinput input:focus {
  border-color: var(--accent);
}

.quiz-textinput button {
  width: 100%;
  padding: 14px 16px;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 0;
  color: #fff;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 2px;
  cursor: pointer;
  transition: background 0.2s;
}

.quiz-textinput button:hover {
  background: var(--accent-hover);
}

/* ---- Countdown Timer ---- */
.quiz-timer {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font);
  font-size: 20px;
  font-weight: 400;
  color: var(--secondary);
  letter-spacing: 2px;
  z-index: 10;
  transition: color 0.2s;
}

.quiz-timer.urgent {
  color: var(--accent);
  animation: timerFlash 0.5s ease infinite;
}

@keyframes timerFlash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.quiz-timer.expired {
  color: var(--accent);
  font-size: 16px;
  animation: none;
  opacity: 1;
}

/* ================================================
   RESULTS
   ================================================ */
.results {
  width: 100%;
  max-width: 520px;
  padding: 48px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.results-rank {
  font-family: var(--font);
  font-weight: 700;
  font-size: 2.4rem;
  letter-spacing: 4px;
  color: #cc0000;
  margin-bottom: 8px;
}

.results-points {
  font-family: var(--font);
  font-size: 1rem;
  color: var(--muted);
  letter-spacing: 1px;
  margin-bottom: 24px;
}

.results-response {
  font-family: var(--font);
  font-weight: 400;
  font-size: 18px;
  line-height: 1.8;
  color: var(--text);
  margin-bottom: 32px;
  max-width: 600px;
  letter-spacing: 0;
}

.results-copy {
  font-family: var(--font);
  font-size: 16px;
  font-weight: 400;
  color: var(--text);
  letter-spacing: 1px;
  margin-bottom: 24px;
}

.btn-share {
  width: 100%;
  max-width: 320px;
  padding: 14px 16px;
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 0;
  color: var(--accent);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 2px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  margin-bottom: 28px;
}

.btn-share:hover {
  background: var(--accent);
  color: #fff;
}

.results-inbox {
  font-family: var(--font);
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 1px;
}

/* ================================================
   REFERRAL MODAL
   ================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease both;
}

.modal-card {
  width: 100%;
  max-width: 400px;
  margin: 20px;
  padding: 32px 24px;
  background: #111111;
  border: 1px solid var(--accent);
}

.modal-title {
  font-family: var(--font);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 3px;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.modal-sub {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 400;
  color: var(--text);
  letter-spacing: 1px;
  line-height: 1.6;
  margin-bottom: 20px;
}

.modal-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--input-bg);
  border: 1px solid var(--accent);
  border-radius: 0;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  letter-spacing: 1px;
  outline: none;
  margin-bottom: 20px;
  transition: border-color 0.2s;
}

.modal-input::placeholder {
  color: var(--muted);
}

.modal-input:focus {
  border-color: var(--accent);
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-btn {
  flex: 1;
  padding: 12px 16px;
  border-radius: 0;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 2px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.modal-send {
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
}

.modal-send:hover {
  background: var(--accent-hover);
}

.modal-cancel {
  background: transparent;
  border: 1px solid var(--secondary);
  color: var(--text);
}

.modal-cancel:hover {
  border-color: var(--text);
}

/* ================================================
   RESPONSIVE
   ================================================ */
@media (min-width: 640px) {
  .landing {
    padding: 48px 32px;
  }
  .quiz {
    padding: 32px 32px 80px;
  }
  .results {
    padding: 64px 32px;
  }
  .results-rank {
    font-size: 3rem;
  }
}

@media (min-width: 768px) {
  .landing {
    padding: 64px 32px;
  }
  .quiz {
    padding: 40px 32px 80px;
  }
  .quiz-text {
    font-size: 24px;
  }
  .results {
    padding: 80px 32px;
  }
}
