/* ============ Apple-style design system ============ */
:root {
  --bg: #ffffff;
  --bg-dark: #000000;
  --bg-gray: #f5f5f7;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-on-dark: #f5f5f7;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --radius-card: 28px;
  --radius-pill: 980px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* ============ Scroll reveal animations ============ */
.reveal, .reveal-scale {
  opacity: 0;
  transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1), transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal { transform: translateY(40px); }
.reveal-scale { transform: scale(0.85); }
.reveal.visible, .reveal-scale.visible { opacity: 1; transform: none; }
.delay-1 { transition-delay: 0.15s; }
.delay-2 { transition-delay: 0.3s; }
.delay-3 { transition-delay: 0.45s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .reveal-scale { opacity: 1; transform: none; transition: none; }
  * { animation: none !important; }
}

/* ============ Nav ============ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(251, 251, 253, 0.8);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.nav-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 22px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-lang {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.05);
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.2s;
}
.nav-lang:hover { background: rgba(0, 0, 0, 0.1); }
.nav-cta {
  font-size: 14px;
  color: #fff;
  background: var(--accent);
  text-decoration: none;
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  transition: background 0.2s;
}
.nav-cta:hover { background: var(--accent-hover); }

/* ============ Buttons ============ */
.btn {
  display: inline-block;
  font-family: inherit;
  font-size: 17px;
  font-weight: 500;
  padding: 14px 32px;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}
.btn:hover { transform: scale(1.04); }
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 113, 227, 0.35);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

/* ============ Hero ============ */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px 24px 80px;
  background: linear-gradient(180deg, #fbfbfd 0%, #f0f0f5 100%);
}
.hero-eyebrow {
  font-size: 19px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 12px;
}
.hero-title {
  font-size: clamp(44px, 8vw, 88px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.hero-asterisk { color: var(--text-secondary); font-size: 0.5em; vertical-align: super; }
.hero-sub {
  max-width: 620px;
  margin: 28px auto 40px;
  font-size: clamp(19px, 2.5vw, 24px);
  line-height: 1.45;
  color: var(--text-secondary);
}
.hero-footnote {
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-secondary);
}
.hero-cat {
  font-size: clamp(120px, 20vw, 220px);
  margin-top: 40px;
  animation: float 6s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-18px); }
}

/* ============ Feature sections ============ */
.feature { padding: 140px 24px; background: var(--bg); }
.feature-dark { background: var(--bg-dark); color: var(--text-on-dark); }
.feature-inner { max-width: 980px; margin: 0 auto; text-align: center; }
.feature-title {
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-bottom: 24px;
}
.feature-text {
  max-width: 640px;
  margin: 0 auto;
  font-size: clamp(18px, 2.2vw, 22px);
  line-height: 1.5;
  color: var(--text-secondary);
}
.feature-dark .feature-text { color: #a1a1a6; }

.text-gradient {
  background: linear-gradient(90deg, #2997ff, #a972ff, #ff6482);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.text-gradient-warm {
  background: linear-gradient(90deg, #ffb340, #ff6482);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  text-align: left;
}
.feature-card {
  background: var(--bg-gray);
  border-radius: var(--radius-card);
  padding: 40px 32px;
}
.feature-card-emoji { font-size: 44px; margin-bottom: 18px; }
.feature-card h3 { font-size: 24px; font-weight: 700; margin-bottom: 10px; }
.feature-card p { font-size: 16px; line-height: 1.5; color: var(--text-secondary); }

.trait-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 44px;
}
.trait-pills span {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text-on-dark);
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-size: 15px;
}

/* ============ Quiz ============ */
.quiz-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 120px 24px;
  background: var(--bg-gray);
}
.quiz-container { width: 100%; max-width: 680px; text-align: center; }

.quiz-intro h2 { font-size: clamp(36px, 6vw, 56px); font-weight: 700; letter-spacing: -0.025em; }
.quiz-intro p { font-size: 20px; color: var(--text-secondary); margin: 18px 0 36px; }

.progress-track {
  height: 6px;
  background: #d2d2d7;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 16px;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.quiz-step {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 28px;
}

.quiz-card { transition: opacity 0.28s cubic-bezier(0.4, 0, 0.6, 1), transform 0.28s cubic-bezier(0.4, 0, 0.6, 1), filter 0.28s; }
.quiz-card.slide-out { opacity: 0; transform: translateX(-36px) scale(0.98); filter: blur(4px); }
.quiz-card.slide-in { opacity: 0; transform: translateX(36px) scale(0.98); filter: blur(4px); transition: none; }
.quiz-card.slide-out-back { opacity: 0; transform: translateX(36px) scale(0.98); filter: blur(4px); }
.quiz-card.slide-in-back { opacity: 0; transform: translateX(-36px) scale(0.98); filter: blur(4px); transition: none; }

.quiz-question {
  font-size: clamp(28px, 4.5vw, 40px);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.quiz-subtitle { font-size: 17px; color: var(--text-secondary); margin: 12px 0 36px; }

.quiz-options { display: flex; flex-direction: column; gap: 14px; }
.quiz-option {
  animation: option-in 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(var(--stagger, 0) * 0.08s);
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 20px 24px;
  font-family: inherit;
  font-size: 18px;
  font-weight: 500;
  text-align: left;
  color: var(--text);
  background: #fff;
  border: 2px solid transparent;
  border-radius: 18px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.quiz-option:hover {
  transform: scale(1.02);
  border-color: var(--accent);
  box-shadow: 0 6px 20px rgba(0, 113, 227, 0.15);
}
.quiz-option .opt-emoji { font-size: 28px; }
.quiz-option.selected {
  border-color: var(--accent);
  background: #eaf3fe;
  transform: scale(1.03);
}
@keyframes option-in {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* ============ Level selector ============ */
.level-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.level-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 32px 20px;
  font-family: inherit;
  background: #fff;
  border: 2px solid transparent;
  border-radius: var(--radius-card);
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s, box-shadow 0.35s;
}
.level-card:hover {
  transform: translateY(-6px) scale(1.03);
  border-color: var(--accent);
  box-shadow: 0 16px 36px rgba(0, 113, 227, 0.18);
}
.level-card:active { transform: translateY(-2px) scale(1.0); }
.level-featured { border-color: var(--accent); }
.level-emoji { font-size: 40px; }
.level-name { font-size: 20px; font-weight: 700; color: var(--text); }
.level-desc { font-size: 14px; color: var(--text-secondary); }

.quiz-back {
  margin-top: 28px;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 16px;
  color: var(--accent);
  cursor: pointer;
}

/* ============ Results ============ */
.results-eyebrow {
  font-size: 17px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 20px;
}
.result-hero {
  background: #fff;
  border-radius: var(--radius-card);
  padding: 48px 36px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
  animation: pop-in 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes pop-in {
  from { opacity: 0; transform: scale(0.9) translateY(24px); }
  to { opacity: 1; transform: none; }
}
.result-hero .result-emoji { font-size: 96px; }
.result-hero h2 { font-size: clamp(34px, 5vw, 48px); font-weight: 700; letter-spacing: -0.02em; margin: 12px 0 4px; }
.result-hero .result-tagline { font-size: 19px; color: var(--text-secondary); font-style: italic; }
.result-score {
  font-size: 56px;
  font-weight: 700;
  color: var(--accent);
  margin: 20px 0 4px;
}
.result-score-label { font-size: 14px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.08em; }
.result-hero .result-desc { font-size: 17px; line-height: 1.55; color: var(--text); margin: 24px auto 0; max-width: 480px; }
.result-funfact {
  margin-top: 24px;
  padding: 16px 20px;
  background: var(--bg-gray);
  border-radius: 14px;
  font-size: 15px;
  color: var(--text-secondary);
}

.result-reasons {
  margin: 28px auto 0;
  max-width: 480px;
  text-align: left;
  background: var(--bg-gray);
  border-radius: 18px;
  padding: 22px 26px;
}
.result-reasons h4 { font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); margin-bottom: 12px; }
.result-reasons ul { list-style: none; }
.result-reasons li {
  font-size: 16px;
  line-height: 1.5;
  padding: 6px 0;
  animation: option-in 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(0.5s + var(--stagger, 0) * 0.15s);
}

.result-sources { margin-top: 24px; }
.result-sources h4 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-secondary); margin-bottom: 10px; }
.result-sources a, .runner-source {
  display: inline-block;
  font-size: 15px;
  color: var(--accent);
  text-decoration: none;
  margin: 4px 8px;
  transition: opacity 0.2s;
}
.result-sources a:hover, .runner-source:hover { text-decoration: underline; }
.runner-source { font-size: 13px; margin: 10px 0 0; }

.results-disclaimer { margin-top: 28px; font-size: 13px; color: var(--text-secondary); }

.results-runnerup-title { font-size: 22px; font-weight: 700; margin: 48px 0 20px; }
.results-runners { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 40px; }
.runner-card {
  background: #fff;
  border-radius: 20px;
  padding: 28px 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
  animation: pop-in 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(0.25s + var(--stagger, 0) * 0.15s);
}
.runner-card .runner-emoji { font-size: 48px; }
.runner-card h4 { font-size: 19px; font-weight: 700; margin: 10px 0 6px; }
.runner-score-track { height: 6px; background: var(--bg-gray); border-radius: 3px; margin: 12px 0 6px; overflow: hidden; }
.runner-score-fill {
  height: 100%;
  background: linear-gradient(90deg, #2997ff, #a972ff);
  border-radius: 3px;
  width: 0;
  transition: width 1s cubic-bezier(0.16, 1, 0.3, 1) 0.4s;
}
.runner-card .runner-pct { font-size: 14px; color: var(--text-secondary); }

@media (max-width: 540px) {
  .results-runners { grid-template-columns: 1fr; }
}

/* ============ Error / footer ============ */
.quiz-error p { font-size: 18px; color: var(--text-secondary); margin-bottom: 24px; }
.quiz-error code { background: #e8e8ed; padding: 2px 8px; border-radius: 6px; }

.footer {
  padding: 40px 24px;
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  background: var(--bg);
}
