/* Nerd Axis — playful modern theme */

:root {
  --bg-1: #2a1a5e;
  --bg-2: #6a2fb5;
  --bg-3: #ff5e7c;
  --card: rgba(255, 255, 255, 0.96);
  --ink: #211a3a;
  --ink-soft: #5b5378;
  --line: #ece8f6;
  --primary: #7c3aed;
  --primary-d: #6926d6;
  --shadow: 0 18px 50px rgba(30, 12, 70, 0.28);
  --radius: 22px;
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  color: var(--ink);
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-1), var(--bg-2) 55%, var(--bg-3));
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 16px 12px;
}

.app {
  width: 100%;
  max-width: 620px;
  flex: 1;
}

/* ===== Screens ===== */
.screen {
  display: none;
  animation: screen-in 0.4s ease both;
}
.screen.is-active {
  display: block;
}
@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Cards ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
}

/* ===== Intro ===== */
.intro-card {
  text-align: center;
}
.intro-emojis {
  font-size: 38px;
  letter-spacing: 6px;
  margin-bottom: 6px;
  animation: float 4s ease-in-out infinite;
}
@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}
.title {
  font-size: 52px;
  font-weight: 900;
  margin: 6px 0 8px;
  background: linear-gradient(90deg, #7c3aed, #ff5e7c);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -1px;
}
.subtitle {
  font-size: 18px;
  color: var(--ink-soft);
  line-height: 1.55;
  max-width: 460px;
  margin: 0 auto 26px;
}
.intro-note {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 18px;
}

/* ===== Buttons ===== */
.btn {
  font-family: inherit;
  font-weight: 800;
  font-size: 16px;
  border: none;
  border-radius: 14px;
  padding: 13px 22px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease,
    opacity 0.2s ease;
}
.btn:active {
  transform: scale(0.96);
}
.btn-primary {
  background: linear-gradient(90deg, var(--primary), #9333ea);
  color: #fff;
  box-shadow: 0 8px 20px rgba(124, 58, 237, 0.4);
}
.btn-primary:hover {
  box-shadow: 0 10px 26px rgba(124, 58, 237, 0.5);
}
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}
.btn-lg {
  font-size: 19px;
  padding: 16px 34px;
}
.btn-secondary {
  background: #f3eefe;
  color: var(--primary-d);
}
.btn-secondary:hover {
  background: #e9e0fd;
}
.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
}
.btn-ghost:hover {
  color: var(--ink);
}
.btn-ghost:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.btn-link {
  background: none;
  color: #fff;
  text-decoration: underline;
  padding: 4px 6px;
  font-size: 15px;
}

/* ===== Quiz ===== */
.quiz-top {
  margin-bottom: 16px;
}
.progress {
  height: 12px;
  background: rgba(255, 255, 255, 0.28);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 3%;
  border-radius: 99px;
  background: linear-gradient(90deg, #ffd166, #ff5e7c);
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.progress-text {
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  margin-top: 8px;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.quiz-card.q-enter {
  animation: q-pop 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes q-pop {
  from {
    opacity: 0;
    transform: translateX(18px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
.question-text {
  font-size: 24px;
  font-weight: 900;
  line-height: 1.3;
  margin: 0 0 22px;
}
.answers {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.answer {
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  text-align: left;
  color: var(--ink);
  background: #f7f4fe;
  border: 2px solid transparent;
  border-radius: 16px;
  padding: 16px 18px;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
}
.answer:hover {
  transform: translateY(-2px);
  background: #f0eafe;
}
.answer.is-selected {
  border-color: var(--primary);
  background: #ede4ff;
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.22);
}
.quiz-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 18px;
}

/* ranking question */
.answers.rank {
  gap: 10px;
}
.rank-chip {
  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
  text-align: left;
  color: var(--ink);
  background: #f7f4fe;
  border: 2px solid transparent;
  border-radius: 16px;
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
}
.rank-chip:hover {
  transform: translateY(-2px);
  background: #f0eafe;
}
.rank-chip.is-ranked {
  border-color: var(--rank-color);
  background: color-mix(in srgb, var(--rank-color) 14%, #fff);
}
.rank-badge {
  flex: 0 0 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 15px;
  color: #fff;
  background: #cabfe6;
}
.rank-chip.is-ranked .rank-badge {
  background: var(--rank-color);
}
.rank-emoji {
  font-size: 22px;
}
.rank-hint {
  margin-top: 4px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
}

/* definitions — always visible (intro) */
.defs-block {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 2px dashed var(--line);
  text-align: left;
}
.defs-title {
  text-align: center;
  font-size: 20px;
  font-weight: 900;
  margin: 0 0 14px;
}

/* definitions — collapsible (results) */
.defs-wrap {
  margin-top: 20px;
  text-align: left;
}
.defs-wrap > summary {
  cursor: pointer;
  font-weight: 800;
  font-size: 15px;
  color: var(--primary-d);
  text-align: center;
  list-style: none;
  padding: 8px;
}
.defs-wrap > summary::-webkit-details-marker {
  display: none;
}
.defs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.def {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #f7f5fd;
  border-left: 5px solid var(--def-color);
  border-radius: 12px;
  padding: 10px 12px;
}
.def-emoji {
  font-size: 22px;
  line-height: 1.3;
}
.def-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.def-label {
  font-weight: 900;
  font-size: 15px;
}
.def-text {
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.4;
}
.def-franchise {
  font-size: 12px;
  color: var(--def-color);
  font-weight: 700;
  margin-top: 2px;
}

/* ===== Results ===== */
.results-card {
  text-align: center;
}
.result-emoji {
  font-size: 64px;
  animation: pop-in 0.5s cubic-bezier(0.22, 1.4, 0.4, 1) both;
}
@keyframes pop-in {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
  }
}
.result-headline {
  font-size: 32px;
  font-weight: 900;
  margin: 6px 0 10px;
  background: linear-gradient(90deg, #7c3aed, #ff5e7c);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.result-blurb {
  color: var(--ink-soft);
  line-height: 1.55;
  font-size: 16px;
  max-width: 480px;
  margin: 0 auto 24px;
}

/* viz toggle */
.viz-tabs {
  display: inline-flex;
  background: #f0ecfa;
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
  margin-bottom: 18px;
}
.viz-tab {
  font-family: inherit;
  font-weight: 800;
  font-size: 14px;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  padding: 8px 18px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.viz-tab.is-active {
  background: #fff;
  color: var(--primary-d);
  box-shadow: 0 2px 8px rgba(80, 40, 160, 0.14);
}
.viz-panel {
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

/* radar */
.radar-grid {
  fill: none;
  stroke: #e7e0f6;
  stroke-width: 1.5;
}
.radar-axis {
  stroke: #e7e0f6;
  stroke-width: 1.5;
}
.radar-label {
  font-size: 12px;
  font-weight: 800;
  fill: var(--ink);
}
.radar-pct {
  font-size: 11px;
  font-weight: 800;
  fill: var(--primary-d);
}
.radar-shape {
  fill: rgba(124, 58, 237, 0.32);
  stroke: #7c3aed;
  stroke-width: 2.5;
  stroke-linejoin: round;
  transform: scale(0);
  transition: transform 0.6s cubic-bezier(0.22, 1.2, 0.4, 1);
}
.radar-shape.is-in {
  transform: scale(1);
}
.radar-dot {
  stroke: #fff;
  stroke-width: 1.5;
}

/* venn */
.venn-circle {
  transform: scale(0);
  transition: transform 0.5s cubic-bezier(0.22, 1.3, 0.4, 1);
}
.venn-circle.is-in {
  transform: scale(1);
}
.venn-emoji {
  font-size: 20px;
}
.venn-pct {
  font-size: 11px;
  font-weight: 800;
  fill: var(--ink);
}

/* bars */
.bars {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 46px;
  align-items: center;
  gap: 10px;
}
.bar-label {
  font-weight: 800;
  font-size: 14px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 6px;
}
.bar-emoji {
  font-size: 18px;
}
.bar-track {
  height: 18px;
  background: #efeafa;
  border-radius: 99px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0;
  border-radius: 99px;
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.bar-pct {
  font-weight: 800;
  font-size: 14px;
  text-align: right;
}

/* breakdown chips */
.breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 18px 0 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f6f3fd;
  border-left: 5px solid var(--chip-color);
  border-radius: 10px;
  padding: 7px 12px;
  font-weight: 800;
  font-size: 14px;
}
.chip-pct {
  color: var(--ink-soft);
}

.results-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
}
.share-note {
  min-height: 20px;
  margin-top: 12px;
  font-weight: 800;
  font-size: 14px;
  color: var(--primary-d);
  opacity: 0;
  transition: opacity 0.2s;
}
.share-note.is-show {
  opacity: 1;
}

.shared-banner {
  margin-top: 16px;
  text-align: center;
  color: #fff;
  font-weight: 700;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

/* footer */
.footer {
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  margin-top: 22px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.footer a {
  color: #fff;
}

/* responsive */
@media (max-width: 480px) {
  .title {
    font-size: 42px;
  }
  .card {
    padding: 24px 18px;
  }
  .question-text {
    font-size: 21px;
  }
  .bar-row {
    grid-template-columns: 92px 1fr 42px;
  }
  .bar-label {
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
