/* =========================================================
   How Normal Are You? — styles
   Mobile-first, dark, oversized, one-handed-friendly.
   ========================================================= */

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

:root {
  --bg: #0a0a0f;
  --bg-2: #14141c;
  --card: #1a1a25;
  --line: #2a2a38;
  --text: #f5f5f7;
  --muted: #8a8a99;
  --accent: #d4ff3a;       /* electric lime */
  --accent-ink: #0a0a0f;
  --danger: #ff3d71;
  --good: #2ee6a4;
  --radius: 18px;
  --radius-lg: 28px;
  --shadow: 0 12px 40px rgba(0,0,0,.4);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Inter", "SF Pro Display", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
}

body {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(212,255,58,.10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(255,61,113,.10), transparent 60%),
    var(--bg);
}

button, input, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

.app {
  min-height: 100dvh;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: calc(20px + var(--safe-top)) 20px calc(24px + var(--safe-bot));
  max-width: 520px;
  margin: 0 auto;
  position: relative;
}

/* ---------- screen transitions ---------- */
.screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  animation: fadeUp .45s ease both;
}
.screen.leaving { animation: fadeDown .25s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px);} to { opacity: 1; transform: none;} }
@keyframes fadeDown { from { opacity: 1;} to { opacity: 0; transform: translateY(8px);} }

/* ---------- landing ---------- */
.landing { justify-content: space-between; gap: 32px; }
.landing .top { display: flex; flex-direction: column; gap: 28px; padding-top: 12px; }
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; letter-spacing: .25em; text-transform: uppercase;
  color: var(--muted);
}
.brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px var(--accent); }

.h-display {
  font-size: clamp(48px, 12vw, 84px);
  line-height: .92;
  font-weight: 900;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}
.h-display .strike { display: block; }
.h-display .accent { color: var(--accent); }
.h-display .em { font-style: italic; font-weight: 800; }

.lead {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
  max-width: 38ch;
}
.lead strong { color: var(--text); font-weight: 600; }

.counter-pill {
  display: inline-flex; align-items: center; gap: 10px;
  align-self: flex-start;
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 12px 16px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.counter-pill .flame { font-size: 18px; }
.counter-pill .num { color: var(--accent); font-variant-numeric: tabular-nums; }
.counter-pill.is-error { color: var(--muted); }

.cta-wrap { display: flex; flex-direction: column; gap: 12px; }
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 22px 24px;
  border-radius: 16px;
  width: 100%;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 30px rgba(212,255,58,.25);
  transition: transform .12s ease, box-shadow .12s ease, background .2s ease;
  -webkit-tap-highlight-color: transparent;
  min-height: 64px;
}
.btn-primary:active { transform: scale(0.98); box-shadow: 0 4px 14px rgba(212,255,58,.2); }
.btn-primary[disabled] { opacity: .55; cursor: not-allowed; box-shadow: none; }

.fineprint { color: var(--muted); font-size: 12px; text-align: center; }

/* ---------- progress + question ---------- */
.progress {
  width: 100%;
  height: 6px;
  background: var(--bg-2);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 18px;
}
.progress .bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  border-radius: 999px;
  transition: width .35s cubic-bezier(.2,.7,.2,1);
  box-shadow: 0 0 12px rgba(212,255,58,.6);
}
.q-meta { color: var(--muted); font-size: 13px; letter-spacing: .15em; text-transform: uppercase; margin-bottom: 14px; font-variant-numeric: tabular-nums; }
.q-meta b { color: var(--text); font-weight: 700; }

.q-text {
  font-size: clamp(28px, 7vw, 38px);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 28px;
}

.answers { display: flex; flex-direction: column; gap: 12px; }
.btn-answer {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 22px 20px;
  border-radius: 16px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  min-height: 64px;
  transition: transform .1s ease, background .15s ease, border-color .15s ease;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.btn-answer:active { transform: scale(0.98); background: #20202c; }
.btn-answer.is-picked { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-answer.alt { background: transparent; }

.q-back {
  margin-top: 18px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 12px;
  -webkit-tap-highlight-color: transparent;
}
.q-back:active { color: var(--text); }

/* ---------- calculating / reveal ---------- */
.calculating { justify-content: center; align-items: center; text-align: center; gap: 24px; }
.calc-title {
  font-size: clamp(22px, 5vw, 28px);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.calc-title .dots::after { content: ''; animation: dots 1.4s steps(4, end) infinite; }
@keyframes dots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
  100% { content: ''; }
}
.calc-bar { width: min(280px, 80%); height: 4px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.calc-bar .fill {
  height: 100%; width: 30%;
  background: var(--accent);
  border-radius: 999px;
  animation: slide 1.4s ease-in-out infinite;
}
@keyframes slide {
  0%   { transform: translateX(-120%); }
  50%  { transform: translateX(120%); }
  100% { transform: translateX(120%); }
}

/* ---------- result ---------- */
.result { gap: 18px; }
.result .stamp {
  font-size: 12px; letter-spacing: .25em; text-transform: uppercase;
  color: var(--muted);
}
.score-wrap { display: flex; align-items: baseline; gap: 12px; }
.score-percent {
  font-size: clamp(120px, 32vw, 200px);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.06em;
  color: var(--accent);
  text-shadow: 0 0 60px rgba(212,255,58,.25);
  font-variant-numeric: tabular-nums;
}
.score-suffix {
  font-size: clamp(28px, 7vw, 40px);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  line-height: 1;
}
.class-title {
  font-size: clamp(28px, 7vw, 40px);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.05;
  text-transform: uppercase;
}
.class-title .dot { color: var(--accent); }

.blurb {
  color: var(--text);
  font-size: 17px;
  line-height: 1.5;
  border-left: 3px solid var(--accent);
  padding: 6px 0 6px 14px;
  background: linear-gradient(90deg, rgba(212,255,58,.05), transparent 40%);
  border-radius: 2px;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 14px;
  border-radius: 14px;
}
.stat .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .15em; margin-bottom: 6px; }
.stat .v { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .v.accent { color: var(--accent); }

.result-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 18px 20px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  min-height: 56px;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s ease;
}
.btn-secondary:active { background: #20202c; }
.btn-share { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: 0 8px 30px rgba(212,255,58,.25); }
.btn-share:active { background: #c2ee24; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }

.share-toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + var(--safe-bot));
  transform: translateX(-50%) translateY(20px);
  background: var(--accent);
  color: var(--accent-ink);
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .04em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transition: transform .25s ease, opacity .25s ease;
  z-index: 50;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
}
.share-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- error / offline ---------- */
.banner {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  text-align: center;
}
.banner.is-error { color: var(--danger); border-color: rgba(255,61,113,.3); }
.banner.is-warn { color: var(--good); }

.noscript-fallback {
  padding: 40px 20px;
  max-width: 480px;
  margin: 0 auto;
  color: var(--text);
}
.noscript-fallback h1 { font-size: 28px; margin-bottom: 12px; }

/* ---------- very small screens ---------- */
@media (max-width: 360px) {
  .app { padding-left: 16px; padding-right: 16px; }
  .h-display { font-size: 44px; }
  .q-text { font-size: 26px; }
  .score-percent { font-size: 110px; }
  .btn-answer { font-size: 16px; padding: 18px 16px; }
}

/* ---------- reduce motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
