:root {
  --background: hsl(45 15% 97%);
  --foreground: hsl(0 0% 5%);
  --card: hsl(0 0% 100%);
  --card-muted: hsl(45 10% 88%);
  --primary: hsl(0 85% 45%);
  --primary-foreground: hsl(0 0% 100%);
  --secondary: hsl(50 100% 55%);
  --secondary-foreground: hsl(0 0% 10%);
  --accent: hsl(216 85% 45%);
  --accent-foreground: hsl(0 0% 100%);
  --border: hsl(0 0% 15%);
  --muted-foreground: hsl(0 0% 28%);
  --shadow: 4px 4px 0 0 hsl(0 0% 0% / 1);
  --shadow-hover: 6px 6px 0 0 hsl(0 0% 0% / 1);
  --shadow-soft: 8px 8px 0 0 hsl(0 0% 0% / 0.18);
  --radius: 0px;
  --font-sans: "DM Sans", sans-serif;
  --font-mono: "Space Mono", monospace;
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 140ms;
  --duration-base: 240ms;
  --duration-slow: 400ms;
}

/* ── Reset & base ────────────────────────────────────────── */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--foreground);
  background:
    radial-gradient(circle at top left,  hsl(50 100% 55% / 0.22), transparent 28%),
    radial-gradient(circle at bottom right, hsl(216 85% 45% / 0.18), transparent 30%),
    linear-gradient(180deg, hsl(45 15% 97%), hsl(45 22% 94%));
  transition: filter 220ms ease, transform 220ms var(--ease-spring);
}

body.page-pulse {
  filter: saturate(1.03) contrast(1.01);
}

/* Loading mask: prevents flash of unstyled animation state */
body.js-loading * { animation-play-state: paused !important; }
body.js-loading .loading-screen * { animation-play-state: running !important; }

/* ── Loading screen animations ────────────────────────────── */
@keyframes skeletonShimmer {
  0% {
    background: linear-gradient(90deg, var(--card-muted) 0%, var(--card) 50%, var(--card-muted) 100%);
    background-size: 200% 100%;
    background-position: 200% 0;
  }
  100% {
    background-size: 200% 100%;
    background-position: -200% 0;
  }
}

@keyframes skeletonPulse {
  0%, 100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

@keyframes loaderDotPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.4;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
}

@keyframes loadingScreenFade {
  0% {
    opacity: 1;
    pointer-events: auto;
  }
  90% {
    opacity: 1;
    pointer-events: auto;
  }
  100% {
    opacity: 0;
    pointer-events: none;
  }
}

@keyframes skeletonBlockSlideIn {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes loadingTextGlow {
  0%, 100% {
    color: var(--muted-foreground);
    text-shadow: none;
  }
  50% {
    color: var(--foreground);
    text-shadow: 0 0 8px rgba(232, 24, 42, 0.2);
  }
}

/* ── Page load phase animations ──────────────────────────── */
@keyframes loadingPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

@keyframes heroGlowIn {
  0% {
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
    filter: blur(4px);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes heroCtaCursor {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.02); }
}

@keyframes statCardStaggerIn {
  0% {
    opacity: 0;
    transform: translateX(-12px) rotateZ(-2deg);
  }
  100% {
    opacity: 1;
    transform: translateX(0) rotateZ(0);
  }
}

@keyframes gesturePulse {
  0%, 100% { 
    transform: scale(1);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.15);
    opacity: 0.8;
  }
}

@keyframes gestureArrowFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-4px) rotate(0deg); }
}

@keyframes configFadeIn {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes heroAccentGlow {
  0%, 100% {
    box-shadow: 0 0 0 0 currentColor;
  }
  50% {
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
  }
}

a  { color: inherit; text-decoration: none; }
button, input { font: inherit; }

/* ── Loading screen overlay ──────────────────────────────── */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at top left,  hsl(50 100% 55% / 0.22), transparent 28%),
    radial-gradient(circle at bottom right, hsl(216 85% 45% / 0.18), transparent 30%),
    linear-gradient(180deg, hsl(45 15% 97%), hsl(45 22% 94%));
  animation: loadingScreenFade 1.2s var(--ease-out) 2000ms forwards;
}

.loading-container {
  width: min(580px, calc(100% - 2rem));
  display: grid;
  gap: 2rem;
  perspective: 1000px;
}

/* ── Skeleton hero section ────────────────────────────────── */
.skeleton-hero {
  display: grid;
  gap: 0.8rem;
  padding: 1rem;
  border: 2px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
  animation: skeletonBlockSlideIn 480ms var(--ease-out) both;
}

.skeleton-block {
  height: 1rem;
  border-radius: 2px;
  background: var(--card-muted);
  animation: skeletonShimmer 2s linear infinite;
}

.skeleton-title {
  width: 70%;
  height: 1.4rem;
  animation-delay: 0ms;
}

.skeleton-subtitle {
  width: 90%;
  height: 0.75rem;
  animation-delay: 60ms;
}

.skeleton-group {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.5rem;
  animation-delay: 120ms;
}

.skeleton-button {
  flex: 1;
  height: 2.2rem;
  animation-delay: 180ms;
}

/* ── Skeleton stat cards ──────────────────────────────────── */
.skeleton-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.8rem;
  padding: 0 1rem;
}

.skeleton-card {
  height: 100px;
  border: 2px solid var(--border);
  border-radius: 0;
  background: var(--card);
  box-shadow: var(--shadow);
  animation: skeletonPulse 1.6s ease-in-out infinite;
  animation-delay: calc(var(--card-index, 0) * 100ms);
}

.skeleton-card:nth-child(1) { --card-index: 0; }
.skeleton-card:nth-child(2) { --card-index: 1; }
.skeleton-card:nth-child(3) { --card-index: 2; }

/* ── Loading indicator with dots ──────────────────────────── */
.loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.loader-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  animation: loaderDotPulse 1.4s ease-in-out infinite;
  box-shadow: var(--shadow-soft);
}

.loader-dot:nth-child(1) { animation-delay: 0ms; }
.loader-dot:nth-child(2) { animation-delay: 200ms; }
.loader-dot:nth-child(3) { animation-delay: 400ms; }

.loading-text {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted-foreground);
  font-weight: 500;
  letter-spacing: 0.04em;
  animation: loadingTextGlow 2s ease-in-out infinite;
}

/* Hide loading screen when page is ready */
body:not(.js-loading) .loading-screen {
  display: none;
}

/* ── Layout shell ────────────────────────────────────────── */
.page-shell {
  width: min(980px, calc(100% - 1rem));
  margin: 0 auto;
  padding: 0.5rem 0 1.8rem;
}

/* ── Shared box styling ──────────────────────────────────── */
.hero,
.sidebar-card,
.question-card,
.result-card,
.panel,
.stat-card,
.button,
.rating-box,
.summary-panel,
.progress-bar {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ── Framer-style motion primitives ─────────────────────── */
.motion-item {
  opacity: 0;
  transform: translateY(10px) scale(0.99);
  transition:
    opacity 360ms var(--ease-out),
    transform 440ms var(--ease-spring);
  transition-delay: var(--motion-delay, 0ms);
}

.motion-item.motion-in {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.hero.motion-item,
.result-card.motion-item,
.result-hero.motion-item {
  transform: translateY(14px) scale(0.985);
  transition:
    opacity 460ms var(--ease-out),
    transform 560ms cubic-bezier(0.22, 1, 0.36, 1);
}

.hero.motion-item.motion-in,
.result-card.motion-item.motion-in,
.result-hero.motion-item.motion-in {
  transform: translateY(0) scale(1);
}

.hero .stat-card.motion-item {
  transform: translateX(10px) scale(0.985);
  transition:
    opacity 320ms var(--ease-out),
    transform 420ms var(--ease-spring);
}

.hero .stat-card.motion-item.motion-in {
  transform: translateX(0) scale(1);
}

.spring-press {
  transform: translate(-1px, -1px) scale(0.98) !important;
}

/* ── Hero ────────────────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 0.6rem;
  padding: 0.65rem;
  background: linear-gradient(135deg, hsl(0 0% 100%), hsl(45 10% 90%));
  animation: heroGlowIn 560ms var(--ease-out) 80ms both;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: none;
  pointer-events: none;
}

.hero-copy h1 {
  margin: 0.25rem 0 0.45rem;
  font-size: clamp(1.25rem, 2.5vw, 2.1rem);
  line-height: 0.95;
  max-width: 9ch;
}

.hero-text {
  max-width: 58ch;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted-foreground);
}

/* ── Eyebrow ─────────────────────────────────────────────── */
.eyebrow {
  display: inline-block;
  padding: 0.35rem 0.6rem;
  border: 2px solid var(--border);
  background: var(--secondary);
  color: var(--secondary-foreground);
  box-shadow: var(--shadow);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.eyebrow.small { font-size: 0.72rem; }

/* ── Hero actions ────────────────────────────────────────── */
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.hero-actions .button-primary {
  position: relative;
  animation: heroCtaCursor 1.2s ease-in-out 800ms infinite;
}

.hero-actions .button-primary::after {
  content: "→";
  display: inline-block;
  margin-left: 0.25rem;
  animation: gestureArrowFloat 1.2s ease-in-out 800ms infinite;
}

.hero-panel {
  display: grid;
  gap: 0.5rem;
  align-content: start;
}

/* ── Stat cards ──────────────────────────────────────────── */
.stat-card {
  padding: 0.6rem;
  background: var(--card);
  animation: statCardStaggerIn 480ms var(--ease-out) both;
}

.stat-card:nth-child(1) { animation-delay: 140ms; }
.stat-card:nth-child(2) { animation-delay: 200ms; }
.stat-card:nth-child(3) { animation-delay: 260ms; }

.accent-yellow { background: hsl(50 100% 55% / 0.55); }
.accent-blue   { background: hsl(216 85% 45% / 0.12); }

.stat-label {
  display: block;
  margin-bottom: 0.28rem;
  color: var(--muted-foreground);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.stat-card strong,
.result-score-box strong,
.progress-count {
  display: block;
  font-size: 1.2rem;
  line-height: 1;
}

.stat-subtext {
  font-size: 0.72rem;
}

.stat-subtext,
.sidebar-copy,
.result-description,
.panel p,
.question-status {
  color: var(--muted-foreground);
}

/* ── Main layout ─────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
  gap: 0.8rem;
  margin-top: 0.8rem;
  align-items: start;
}

.method-mobile {
  display: none;
  margin-top: 0.75rem;
  padding: 0.65rem;
  border: 2px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
}

.method-mobile p {
  margin: 0.55rem 0 0;
  color: var(--muted-foreground);
  line-height: 1.45;
  font-size: 0.82rem;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar-card {
  position: sticky;
  top: 1rem;
  padding: 0.75rem;
  background: var(--card);
  display: grid;
  gap: 0.65rem;
  animation: slideRight var(--duration-slow) var(--ease-out) 100ms both;
}

.sidebar-section { display: grid; gap: 0.6rem; }

.progress-bar {
  overflow: hidden;
  height: 18px;
  background: var(--card-muted);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 320ms var(--ease-spring);
}

.scale-list {
  display: grid;
  gap: 0.55rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.scale-list li {
  display: grid;
  grid-template-columns: 2.4rem 1fr;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.92rem;
}

.scale-list span {
  display: inline-grid;
  place-items: center;
  padding: 0.4rem;
  border: 2px solid var(--border);
  background: var(--card-muted);
  font-family: var(--font-mono);
  font-weight: 700;
}

/* ── Content column ──────────────────────────────────────── */
.content-column {
  display: grid;
  gap: 0.8rem;
}

.question-list {
  display: grid;
  gap: 0.8rem;
}

.question-list.is-mobile-paged {
  gap: 0.55rem;
}

.mobile-question-nav {
  display: none;
}

.mobile-nav-status {
  margin: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--muted-foreground);
}

/* ── Question cards ──────────────────────────────────────── */
.question-card {
  margin: 0;
  padding: 0.7rem;
  background: var(--card);
  transition:
    box-shadow var(--duration-base) ease,
    border-color var(--duration-base) ease,
    transform var(--duration-base) var(--ease-spring);
  /* stagger set via JS inline style --i */
  animation: cardIn var(--duration-slow) var(--ease-out) calc(var(--i, 0) * 55ms) both;
}

.question-card:hover {
  transform: translate(-1px, -1px);
  box-shadow: var(--shadow-hover);
}

/* answered state */
.question-card.is-answered {
  border-color: var(--primary);
  box-shadow: 4px 4px 0 0 var(--primary);
}

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.65rem;
}

/* ── Trait pill ──────────────────────────────────────────── */
.trait-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.7rem;
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 0.8rem;
  font-weight: 700;
}

.trait-ind { background: hsl(0 85% 45%);    color: white; }
.trait-emp { background: hsl(50 100% 55%);  color: hsl(0 0% 10%); }
.trait-wis { background: hsl(216 85% 45%);  color: white; }
.trait-skl { background: hsl(45 10% 88%);   color: hsl(0 0% 5%); }
.trait-cre { background: hsl(0 0% 100%);    color: hsl(0 0% 5%); }

.question-status {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.question-card.is-answered .question-status {
  color: var(--primary);
}

.question-text {
  padding: 0;
  margin: 0 0 0.75rem;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.45;
}

/* ── Rating grid ─────────────────────────────────────────── */
.rating-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.5rem;
}

.rating-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.rating-box {
  display: grid;
  gap: 0.2rem;
  min-height: 58px;
  padding: 0.45rem 0.35rem;
  background: var(--background);
  cursor: pointer;
  transition:
    transform var(--duration-fast) var(--ease-spring),
    background var(--duration-fast) ease,
    color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease;
  will-change: transform;
}

.rating-box:hover {
  transform: translate(-2px, -2px) scale(1.03);
  box-shadow: var(--shadow-hover);
}

.rating-option input:focus-visible + .rating-box {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.rating-option input:checked + .rating-box {
  background: var(--primary);
  color: var(--primary-foreground);
  transform: translate(-2px, -2px) scale(1.02);
  box-shadow: var(--shadow-hover);
  animation: pop var(--duration-base) var(--ease-spring);
}

.rating-value {
  font-family: var(--font-mono);
  font-size: 0.92rem;
}

.rating-label {
  font-size: 0.66rem;
  line-height: 1.25;
  letter-spacing: 0.01em;
}

/* ── Action row ──────────────────────────────────────────── */
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ── Buttons ─────────────────────────────────────────────── */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 32px;
  padding: 0.42rem 0.62rem;
  font-weight: 800;
  background: var(--card);
  color: var(--foreground);
  cursor: pointer;
  transition:
    transform var(--duration-fast) var(--ease-spring),
    box-shadow var(--duration-fast) ease;
  will-change: transform;
}

.button:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-hover);
}

.button:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.button-primary {
  background: var(--primary);
  color: var(--primary-foreground);
}

.button-secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
}

.btn-icon {
  transition: transform var(--duration-base) var(--ease-spring);
}
.button:hover .btn-icon {
  transform: translateX(4px);
}

/* Answer-again button inside result-score-box */
.button-answer-again {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.85rem;
  min-height: 38px;
  padding: 0.5rem 0.9rem;
  font-size: 0.88rem;
  font-weight: 700;
  border: 2px solid var(--border);
  background: hsl(45 15% 97%);
  color: var(--foreground);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform var(--duration-fast) var(--ease-spring), box-shadow var(--duration-fast) ease;
}
.button-answer-again:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-hover);
}
.button-answer-again:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

/* ── Result card ─────────────────────────────────────────── */
.result-card {
  padding: 0.7rem;
  background: var(--card);
}

.is-hidden { display: none; }

/* entrance animation when result is shown */
.result-card.is-visible {
  animation: resultReveal var(--duration-slow) var(--ease-out) both;
}

.result-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  padding: 0.75rem;
  background: linear-gradient(135deg, hsl(0 85% 45%), hsl(216 85% 45%));
  color: white;
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
}

.result-card.is-visible .result-hero {
  animation: heroBreath 900ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.result-hero h2 {
  margin: 0.4rem 0 0.65rem;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 0.95;
  animation: slideDown 360ms var(--ease-spring) 60ms both;
}

.result-description {
  color: hsl(0 0% 100% / 0.88);
  max-width: 50ch;
}

.result-score-box {
  min-width: 170px;
  padding: 0.75rem;
  border: 2px solid var(--border);
  background: hsl(45 15% 97%);
  color: var(--foreground);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.8rem;
  margin-top: 0.8rem;
}

/* ── Panels ──────────────────────────────────────────────── */
.panel,
.summary-panel {
  padding: 0.75rem;
  background: var(--card);
}

.panel h3,
.summary-panel h3 {
  margin: 0 0 0.9rem;
  font-size: 1.05rem;
}

/* ── Config bar ──────────────────────────────────────────── */
.config-bar {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  padding: 0.75rem 0.85rem;
  margin-top: 0.9rem;
  border: 2px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
  animation: configFadeIn 560ms var(--ease-out) 320ms both;
}

.config-intro {
  grid-column: auto;
  display: grid;
  align-content: start;
  gap: 0.35rem;
  padding: 0.35rem 0.25rem 0.1rem;
  border-right: 2px solid var(--border);
}

.config-intro h2 {
  margin: 0;
  font-size: clamp(1.1rem, 2.3vw, 1.45rem);
  line-height: 1.1;
}

.config-intro p {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.84rem;
}

.config-group-card {
  margin: 0;
  min-width: 0;
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
  background: var(--background);
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  position: relative;
  overflow: hidden;
}

.config-group-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.config-title {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.2;
  font-weight: 800;
}

.config-note {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.8rem;
  line-height: 1.35;
}

.config-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.config-chip { cursor: pointer; }

.config-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.config-chip span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.72rem;
  border: 2px solid var(--border);
  background: var(--background);
  box-shadow: var(--shadow);
  font-size: 0.8rem;
  font-weight: 700;
  transition:
    background var(--duration-fast) ease,
    transform var(--duration-fast) var(--ease-spring),
    box-shadow var(--duration-fast) ease;
}

.config-chip input:checked + span {
  background: var(--primary);
  color: var(--primary-foreground);
  transform: translate(-1px, -1px);
  box-shadow: var(--shadow-hover);
}

.config-chip span:hover {
  transform: translate(-1px, -1px);
  box-shadow: var(--shadow-hover);
}

/* ── Trait & ranking rows ────────────────────────────────── */
.trait-stack,
.ranking-list {
  display: grid;
  gap: 0.6rem;
}

.trait-row,
.ranking-row {
  padding: 0.65rem;
  border: 2px solid var(--border);
  background: var(--background);
  animation: cardIn 300ms var(--ease-out) calc(var(--i, 0) * 70ms) both;
}

.trait-row-header,
.ranking-row-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.mini-progress {
  margin-top: 0.65rem;
  height: 14px;
  border: 2px solid var(--border);
  background: var(--card-muted);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.mini-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 600ms var(--ease-spring);
}

.ranking-row p,
.trait-row p,
.summary-panel p {
  margin: 0.45rem 0 0;
  line-height: 1.5;
}

/* ── Summary + share ─────────────────────────────────────── */
.summary-panel {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.8rem;
}

.share-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.button-share {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.95rem;
  font-size: 0.88rem;
  min-height: 40px;
}

.share-x        { background: hsl(0 0% 5%);      color: white; }
.share-linkedin { background: hsl(210 100% 35%);  color: white; }
.share-wa       { background: hsl(142 70% 35%);   color: white; }

/* ── Confetti canvas ─────────────────────────────────────── */
#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}

/* ── Page welcome animation ─────────────────────────────── */
.welcome-banner {
  position: fixed;
  top: 1rem;
  left: 50%;
  z-index: 10001;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.8rem;
  border: 2px solid var(--border);
  background: linear-gradient(120deg, hsl(45 100% 58%), hsl(0 85% 45%));
  color: hsl(0 0% 100%);
  box-shadow: var(--shadow-hover);
  transform: translate(-50%, -12px) scale(0.97);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 520ms var(--ease-spring),
    opacity 420ms var(--ease-out);
  animation: welcomeGlow 1.4s ease-in-out infinite alternate;
}

.welcome-banner.is-visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.welcome-banner.is-exit {
  opacity: 0;
  transform: translate(-50%, -8px) scale(0.985);
}

.welcome-kicker {
  display: inline-flex;
  align-items: center;
  padding: 0.16rem 0.42rem;
  border: 2px solid hsl(0 0% 100%);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.welcome-banner strong {
  font-size: 0.8rem;
  line-height: 1;
}

/* ── Mobile gesture hints ────────────────────────────────── */
.gesture-hint {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
  animation: gesturePulse 2s ease-in-out infinite;
}

.gesture-hint.is-visible-mobile {
  display: flex;
}

.gesture-hint-arrow {
  font-size: 1.2rem;
  animation: gestureArrowFloat 2s ease-in-out infinite;
}

.gesture-hint-text {
  font-size: 0.7rem;
  color: var(--muted-foreground);
  text-align: center;
  max-width: 60px;
}

.tap-burst {
  position: fixed;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 10002;
  --burst-ring: var(--primary);
  --burst-fill: hsl(50 100% 55% / 0.35);
  --burst-dot: var(--accent);
}

.tap-burst[data-theme="primary"] {
  --burst-ring: hsl(0 85% 45%);
  --burst-fill: hsl(0 85% 45% / 0.28);
  --burst-dot: hsl(50 100% 55%);
}

.tap-burst[data-theme="secondary"] {
  --burst-ring: hsl(50 100% 45%);
  --burst-fill: hsl(50 100% 55% / 0.35);
  --burst-dot: hsl(0 85% 45%);
}

.tap-burst[data-theme="rating"] {
  --burst-ring: hsl(216 85% 45%);
  --burst-fill: hsl(216 85% 45% / 0.28);
  --burst-dot: hsl(50 100% 55%);
}

.tap-burst[data-theme="config"] {
  --burst-ring: hsl(0 0% 15%);
  --burst-fill: hsl(0 0% 15% / 0.2);
  --burst-dot: hsl(0 85% 45%);
}

.tap-ring {
  position: absolute;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  margin-top: -7px;
  border: 2px solid var(--burst-ring);
  border-radius: 999px;
  background: var(--burst-fill);
  animation: tapSparkRing 520ms var(--ease-out) both;
}

.tap-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  margin-top: -3px;
  border-radius: 999px;
  background: var(--burst-dot);
  transform: rotate(var(--a)) translateX(0);
  animation: tapSparkDot 520ms var(--ease-out) both;
}

/* ── Floating progress pill ──────────────────────────────── */
.floating-progress {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.9rem;
  border: 2px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
  font-size: 0.88rem;
  font-weight: 700;
  font-family: var(--font-mono);
  transition: opacity 200ms ease, transform 200ms var(--ease-spring);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
}

.floating-progress.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.floating-progress-fill {
  display: inline-block;
  width: 60px;
  height: 8px;
  border: 2px solid var(--border);
  background: var(--card-muted);
  overflow: hidden;
  vertical-align: middle;
}

.floating-progress-fill span {
  display: block;
  height: 100%;
  background: var(--primary);
  transition: width 300ms var(--ease-spring);
}

/* ── Keyframes ───────────────────────────────────────────── */
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideRight {
  from { opacity: 0; transform: translateX(-18px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(22px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

@keyframes resultReveal {
  from { opacity: 0; transform: translateY(28px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

@keyframes heroBreath {
  0% { transform: scale(0.992); filter: saturate(0.97); }
  55% { transform: scale(1.003); filter: saturate(1.02); }
  100% { transform: scale(1); filter: saturate(1); }
}

@keyframes welcomeGlow {
  from { box-shadow: 6px 6px 0 0 hsl(0 0% 0% / 1); }
  to { box-shadow: 8px 8px 0 0 hsl(0 0% 0% / 1); }
}

@keyframes tapSparkRing {
  0% {
    opacity: 0.9;
    transform: scale(0.55);
  }
  65% {
    opacity: 0.6;
    transform: scale(2.2);
  }
  100% {
    opacity: 0;
    transform: scale(2.8);
  }
}

@keyframes tapSparkDot {
  0% {
    opacity: 0;
    transform: rotate(var(--a)) translateX(0) scale(0.7);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: rotate(var(--a)) translateX(26px) scale(0.5);
  }
}

@keyframes pop {
  0%   { transform: translate(-2px, -2px) scale(1); }
  50%  { transform: translate(-2px, -2px) scale(1.14); }
  100% { transform: translate(-2px, -2px) scale(1.06); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-5px); }
  40%       { transform: translateX(5px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (min-width: 1200px) {
  .page-shell {
    width: min(60vw, 900px);
  }
}

@media (max-width: 980px) {
  .config-bar,
  .hero,
  .layout,
  .result-grid,
  .summary-panel,
  .result-hero {
    grid-template-columns: 1fr;
  }

  .config-intro {
    border-right: 0;
    border-bottom: 2px solid var(--border);
    padding: 0.1rem 0 0.45rem;
  }

  .sidebar-card { position: static; }
}

@media (max-width: 720px) {
  .loading-container {
    width: min(90vw, 320px);
  }

  .skeleton-hero {
    padding: 0.8rem;
    gap: 0.6rem;
  }

  .skeleton-title {
    height: 1.2rem;
  }

  .skeleton-stats {
    gap: 0.6rem;
    padding: 0;
  }

  .loading-text {
    font-size: 0.75rem;
  }

  .page-shell {
    width: min(100% - 0.75rem, 1080px);
    padding-bottom: calc(5.25rem + env(safe-area-inset-bottom));
  }

  .hero,
  .sidebar-card,
  .question-card,
  .result-card,
  .panel,
  .summary-panel {
    box-shadow: var(--shadow-soft);
  }

  .config-intro {
    gap: 0.25rem;
    padding: 0.15rem 0;
  }

  .config-intro h2 {
    font-size: 1.05rem;
  }

  .config-intro p {
    font-size: 0.78rem;
  }

  .question-text { font-size: 0.96rem; }

  .config-group-card {
    padding: 0.6rem;
  }

  .config-choices {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .config-chip {
    width: 100%;
  }

  .config-chip span {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .rating-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.35rem;
  }

  .rating-box {
    min-height: 44px;
    padding: 0.32rem 0.2rem;
    place-items: center;
    text-align: center;
    gap: 0.05rem;
  }

  .rating-value {
    font-size: 0.9rem;
    line-height: 1;
  }

  .rating-label {
    display: none;
  }

  .hero-copy h1 { max-width: 100%; }

  .action-row,
  .hero-actions { flex-direction: column; }

  .button { width: 100%; }

  .question-list.is-mobile-paged .question-card {
    animation: slideDown 260ms var(--ease-out) both;
  }

  .mobile-question-nav {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem;
    border: 2px solid var(--border);
    background: var(--card);
    box-shadow: var(--shadow);
  }

  .mobile-question-nav .button {
    width: auto;
    min-height: 36px;
    padding: 0.4rem 0.55rem;
  }

  .action-row {
    position: sticky;
    bottom: calc(0.5rem + env(safe-area-inset-bottom));
    z-index: 40;
    margin-top: 0.35rem;
    padding: 0.45rem;
    border: 2px solid var(--border);
    background: hsl(45 15% 97% / 0.92);
    box-shadow: var(--shadow);
    backdrop-filter: blur(6px);
  }

  .question-header,
  .trait-row-header,
  .ranking-row-header {
    align-items: start;
  }

  .question-header {
    flex-direction: row;
    justify-content: space-between;
    gap: 0.5rem;
  }

  .sidebar-section#method {
    display: none;
  }

  .method-mobile {
    display: block;
  }

  .floating-progress { display: none; }

  .welcome-banner {
    width: calc(100% - 1rem);
    justify-content: center;
    text-align: center;
    padding: 0.4rem 0.6rem;
  }

  .welcome-banner strong {
    font-size: 0.72rem;
  }

  .gesture-hint.is-visible-mobile {
    display: flex;
  }

  .hero-actions .button-primary::after {
    display: none;
  }

  .hero-actions .button-primary {
    animation: none;
  }
}

@media (max-width: 390px) {
  .page-shell {
    width: calc(100% - 0.5rem);
    padding-bottom: calc(5.6rem + env(safe-area-inset-bottom));
  }

  .hero,
  .config-bar,
  .sidebar-card,
  .question-card,
  .result-card,
  .panel,
  .summary-panel {
    padding: 0.55rem;
  }

  .hero-copy h1 {
    font-size: clamp(1.1rem, 7vw, 1.45rem);
  }

  .question-text {
    font-size: 0.92rem;
    line-height: 1.35;
  }

  .rating-grid {
    gap: 0.28rem;
  }

  .rating-box {
    min-height: 48px;
    padding: 0.25rem 0.1rem;
  }

  .rating-value {
    font-size: 0.95rem;
  }

  .action-row {
    bottom: calc(0.35rem + env(safe-area-inset-bottom));
    padding: 0.4rem;
    gap: 0.4rem;
  }

  .button {
    min-height: 42px;
    padding: 0.48rem 0.55rem;
    font-size: 0.86rem;
  }

  .mobile-question-nav .button {
    min-height: 34px;
    padding: 0.35rem 0.45rem;
    font-size: 0.78rem;
  }

  .mobile-nav-status {
    font-size: 0.68rem;
  }

  .progress-count {
    font-size: 1.08rem;
  }

  .welcome-banner {
    width: calc(100% - 0.5rem);
    padding: 0.35rem 0.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .motion-item,
  .motion-item.motion-in {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .button,
  .rating-box,
  .question-card,
  .result-card,
  .panel,
  .summary-panel,
  .welcome-banner,
  .tap-burst,
  .tap-ring,
  .tap-dot,
  body {
    animation: none !important;
    transition: none !important;
  }
}

