/* ─────────────────────────────────────────
   RESET & CUSTOM PROPERTIES
───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --iq:        #6c63ff;
  --iq-light:  #ede9ff;
  --eq:        #ff6584;
  --eq-light:  #ffe9ee;
  --dark:      #1a1a2e;
  --mid:       #2d2d44;
  --text:      #e0e0f0;
  --muted:     #8888aa;
  --card:      #22223a;
  --border:    rgba(255,255,255,0.08);
  --radius:    16px;
  --shadow:    0 8px 32px rgba(0,0,0,0.35);
  --transition: 0.28s cubic-bezier(.4,0,.2,1);
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--dark);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background-image:
    radial-gradient(ellipse at 20% 20%, rgba(108,99,255,0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(255,101,132,0.10) 0%, transparent 60%);
}

/* ─── SCREEN MANAGEMENT ─── */
.screen { display: none; width: 100%; max-width: 640px; animation: fadeUp .4s ease; }
.screen.active { display: flex; justify-content: center; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─────────────────────────────────────────
   LANDING SCREEN
───────────────────────────────────────── */
.landing-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.5rem 2rem;
  width: 100%;
  text-align: center;
}

.badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--iq), var(--eq));
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .3rem .9rem;
  border-radius: 99px;
  margin-bottom: 1.4rem;
}

.landing-card h1 {
  font-size: clamp(2.2rem, 8vw, 3rem);
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1rem;
}

.landing-card h1 span { color: var(--iq); }

.subtitle {
  color: var(--muted);
  font-size: .95rem;
  line-height: 1.6;
  max-width: 380px;
  margin: 0 auto 1.8rem;
}

/* Stat row */
.stat-row {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1.8rem;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .15rem;
  color: var(--muted);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.stat span {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  background: linear-gradient(135deg, var(--iq), var(--eq));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Name field */
.name-field {
  text-align: left;
  margin-bottom: 1.4rem;
}

.name-field label {
  display: block;
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: .45rem;
}

.name-field input {
  width: 100%;
  background: var(--mid);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: .95rem;
  padding: .7rem 1rem;
  outline: none;
  transition: border-color var(--transition);
}

.name-field input:focus { border-color: var(--iq); }

/* Previous result banner */
.prev-banner {
  background: rgba(108,99,255,0.12);
  border: 1px solid rgba(108,99,255,0.3);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  margin-bottom: 1.2rem;
  text-align: left;
}

.prev-banner p { font-size: .88rem; color: var(--text); margin-bottom: .7rem; }

.banner-actions { display: flex; gap: .7rem; flex-wrap: wrap; }

.hidden { display: none !important; }

/* ─────────────────────────────────────────
   BUTTONS
───────────────────────────────────────── */
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--iq) 0%, #a084ff 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  padding: .85rem 1.5rem;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
  letter-spacing: .03em;
}

.btn-primary:hover { opacity: .88; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: rgba(108,99,255,0.2);
  border: 1px solid rgba(108,99,255,0.4);
  color: var(--iq);
  border-radius: 8px;
  font-size: .82rem;
  font-weight: 600;
  padding: .45rem .9rem;
  cursor: pointer;
  transition: background var(--transition);
}

.btn-secondary:hover { background: rgba(108,99,255,0.35); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 8px;
  font-size: .82rem;
  font-weight: 600;
  padding: .45rem .9rem;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}

.btn-ghost:hover { border-color: var(--eq); color: var(--eq); }

/* ─────────────────────────────────────────
   QUIZ SCREEN
───────────────────────────────────────── */
.quiz-shell {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 1.8rem;
  width: 100%;
}

/* Header */
.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .9rem;
}

.quiz-meta {
  display: flex;
  align-items: center;
  gap: .8rem;
}

.cat-badge {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: .25rem .7rem;
  border-radius: 99px;
  background: var(--iq-light);
  color: var(--iq);
}

.cat-badge.eq { background: var(--eq-light); color: var(--eq); }

#question-counter {
  font-size: .82rem;
  color: var(--muted);
}

.btn-quit {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  font-size: .85rem;
  transition: all var(--transition);
}

.btn-quit:hover { border-color: var(--eq); color: var(--eq); }

/* Progress bar */
.progress-track {
  background: var(--mid);
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
  margin-bottom: 1.8rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--iq), var(--eq));
  border-radius: 99px;
  transition: width .5s cubic-bezier(.4,0,.2,1);
}

/* Question card */
.question-card {
  min-height: 260px;
  margin-bottom: 1.5rem;
}

.question-text {
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.55;
  color: var(--text);
  margin-bottom: 1.4rem;
}

/* Options */
.options-list {
  display: flex;
  flex-direction: column;
  gap: .7rem;
}

.option-btn {
  background: var(--mid);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: .9rem;
  font-weight: 500;
  padding: .8rem 1.1rem;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: .9rem;
}

.option-btn .opt-letter {
  min-width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--card);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
  transition: all var(--transition);
}

.option-btn:hover:not(:disabled) {
  border-color: var(--iq);
  background: rgba(108,99,255,0.1);
}

.option-btn:hover:not(:disabled) .opt-letter {
  background: var(--iq);
  border-color: var(--iq);
  color: #fff;
}

/* Selected state */
.option-btn.selected {
  border-color: var(--iq);
  background: rgba(108,99,255,0.15);
}

.option-btn.selected .opt-letter {
  background: var(--iq);
  border-color: var(--iq);
  color: #fff;
}

/* Correct / Wrong feedback */
.option-btn.correct {
  border-color: #22c55e;
  background: rgba(34,197,94,0.12);
}

.option-btn.correct .opt-letter {
  background: #22c55e;
  border-color: #22c55e;
  color: #fff;
}

.option-btn.wrong {
  border-color: var(--eq);
  background: rgba(255,101,132,0.12);
}

.option-btn.wrong .opt-letter {
  background: var(--eq);
  border-color: var(--eq);
  color: #fff;
}

.option-btn:disabled { cursor: default; }

/* Navigation */
.quiz-nav {
  display: flex;
  gap: .8rem;
}

.btn-nav {
  flex: 1;
  background: var(--mid);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: .9rem;
  font-weight: 600;
  padding: .75rem;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-nav:disabled { opacity: .35; cursor: default; }
.btn-nav:not(:disabled):hover { border-color: var(--iq); color: var(--iq); }

.btn-next-main:not(:disabled) {
  background: linear-gradient(135deg, var(--iq), #a084ff);
  border-color: transparent;
  color: #fff;
}

.btn-next-main:not(:disabled):hover { opacity: .88; }

/* ─────────────────────────────────────────
   RESULT SCREEN
───────────────────────────────────────── */
.result-shell {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 1.8rem;
  width: 100%;
}

.result-header {
  text-align: center;
  margin-bottom: 1.8rem;
}

.trophy { font-size: 3rem; margin-bottom: .5rem; }

.result-header h2 {
  font-size: 1.7rem;
  font-weight: 800;
  margin-bottom: .3rem;
}

.result-name { color: var(--iq); font-weight: 700; font-size: 1rem; }
.result-date { color: var(--muted); font-size: .78rem; margin-top: .2rem; }

.json-card {
  background: var(--mid);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 1.4rem;
}

.json-output {
  margin: 0;
  color: var(--text);
  font: 0.88rem/1.7 Consolas, "Courier New", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.verify-shell {
  text-align: center;
}

.verify-card {
  text-align: center;
}

.verify-note {
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: .5rem;
}

.verify-subtext {
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.6;
}

.result-page {
  display: flex;
  justify-content: center;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

/* Score grid */
.score-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.4rem;
}

.score-card {
  background: var(--mid);
  border-radius: 14px;
  padding: 1.2rem 1rem;
  text-align: center;
  border: 1px solid var(--border);
}

.score-label {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: .5rem;
}

.score-number {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: .2rem;
}

.iq-card .score-number { color: var(--iq); }
.eq-card .score-number { color: var(--eq); }

.score-outof {
  font-size: .78rem;
  color: var(--muted);
  margin-bottom: .8rem;
}

.score-bar-wrap {
  background: rgba(255,255,255,0.07);
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
}

.score-bar {
  height: 100%;
  border-radius: 99px;
  width: 0%;
  transition: width 1s cubic-bezier(.4,0,.2,1) .3s;
}

.iq-bar { background: linear-gradient(90deg, var(--iq), #a084ff); }
.eq-bar { background: linear-gradient(90deg, var(--eq), #ff9eb5); }

/* Interpretation */
.interpretation-card {
  background: var(--mid);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.3rem 1.2rem;
  margin-bottom: 1.4rem;
}

.interpretation-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: .6rem;
  color: var(--text);
}

.interpretation-card p {
  font-size: .88rem;
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: .9rem;
}

.strength-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.strength-tags span {
  font-size: .75rem;
  font-weight: 600;
  padding: .3rem .75rem;
  border-radius: 99px;
  background: rgba(108,99,255,0.18);
  color: var(--iq);
  border: 1px solid rgba(108,99,255,0.3);
}

/* Result actions */
.result-actions {
  display: flex;
  flex-direction: column;
  gap: .7rem;
}

/* ─────────────────────────────────────────
   RESPONSIVE
───────────────────────────────────────── */
@media (max-width: 480px) {
  .landing-card, .quiz-shell, .result-shell {
    padding: 1.6rem 1.2rem;
  }

  .stat-row { gap: 1rem; }

  .score-grid { grid-template-columns: 1fr; }
}
