@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* === Design Tokens === */
:root {
  --bg-primary: #FFFBF0;
  --bg-dark: #181818;
  --accent: #FC5E00;
  --accent-yellow: #FFE08B;
  --accent-peach: #FFB994;
  --accent-purple: #CBA5F9;
  --accent-pink: #E58BA7;
  --text-primary: #181818;
  --text-muted: rgba(24, 24, 24, 0.6);
  --text-dark-primary: #FFFBF0;
  --text-dark-muted: rgba(255, 251, 240, 0.6);
  --font: 'Space Grotesk', sans-serif;
  --radius: 12px;
}

/* === Reset & Base === */
html, body { overflow-x: hidden; }
.nq-quiz * { margin: 0; padding: 0; box-sizing: border-box; }
.nq-quiz {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
  overscroll-behavior-x: none;
}

/* === Logo === */
.nq-logo {
  position: absolute;
  top: 20px;
  left: 24px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  text-decoration: none;
  text-transform: uppercase;
  z-index: 10;
}
.nq-logo:hover { color: var(--accent); }

/* === Progress Bar === */
.nq-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  gap: 4px;
  padding: 0 24px;
  height: 4px;
  z-index: 100;
  background: var(--bg-primary);
}
.nq-progress-seg {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(24, 24, 24, 0.1);
  transition: background 0.4s ease;
}
.nq-progress-seg.filled {
  background: var(--accent);
}

/* === Container === */
.nq-container {
  width: 100%;
  max-width: 640px;
  padding: 80px 24px 40px;
  display: flex;
  flex-direction: column;
}
@media (min-width: 768px) {
  .nq-container { padding: 80px 40px 40px; }
}

/* === Steps === */
.nq-step {
  display: none;
  flex-direction: column;
  min-height: calc(100vh - 120px);
  min-height: calc(100dvh - 120px);
  animation: nqFadeIn 0.3s ease forwards;
}
.nq-step.active { display: flex; }

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

/* === Question === */
.nq-question {
  font-size: 24px;
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1.3;
  margin-bottom: 8px;
}
@media (min-width: 768px) {
  .nq-question { font-size: 28px; }
}
.nq-subtitle {
  font-size: 16px;
  font-weight: 400;
  color: var(--text-muted);
  margin-bottom: 32px;
}

/* === Option Cards (single-select) === */
.nq-options { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.nq-option {
  width: 100%;
  min-height: 56px;
  padding: 16px 20px;
  background: var(--bg-primary);
  border: 1px solid rgba(24, 24, 24, 0.15);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}
.nq-option:hover {
  border-color: rgba(24, 24, 24, 0.35);
  transform: translateY(-1px);
}
.nq-option:active { transform: scale(0.97); }
.nq-option.selected {
  color: var(--text-primary);
  border-color: transparent;
  transform: scale(1);
}

/* Ripple on click */
.nq-ripple {
  position: absolute;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.5;
  transform: scale(0);
  animation: nqRipple 0.5s ease-out forwards;
  pointer-events: none;
}
@keyframes nqRipple {
  to { transform: scale(4); opacity: 0; }
}

/* === "Other" text input inline === */
.nq-other-input {
  width: 100%;
  margin-top: 8px;
  padding: 0;
  height: 48px;
  border: none;
  border-bottom: 2px solid rgba(24, 24, 24, 0.2);
  background: transparent;
  font-family: var(--font);
  font-size: 16px;
  color: var(--text-primary);
  outline: none;
  display: none;
}
.nq-other-input.visible { display: block; }
.nq-other-input:focus { border-bottom-color: var(--accent); }
.nq-other-input::placeholder { color: rgba(24, 24, 24, 0.3); }

/* === Multi-select Chips === */
.nq-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 32px;
}
.nq-chip {
  padding: 12px 20px;
  border: 1px solid rgba(24, 24, 24, 0.2);
  border-radius: 100px;
  background: transparent;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.nq-chip:hover { border-color: rgba(24, 24, 24, 0.4); transform: translateY(-1px); }
.nq-chip:active { transform: scale(0.95); }
.nq-chip.selected {
  color: var(--text-primary);
  border-color: transparent;
}
.nq-chip.selected:hover { transform: translateY(-1px); }

/* === Text Input === */
.nq-input-wrap { margin-bottom: 32px; }
.nq-input {
  width: 100%;
  height: 56px;
  padding: 0;
  border: none;
  border-bottom: 2px solid rgba(24, 24, 24, 0.2);
  background: transparent;
  font-family: var(--font);
  font-size: 18px;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s ease;
}
.nq-input:focus { border-bottom-color: var(--accent); }
.nq-input::placeholder { color: rgba(24, 24, 24, 0.3); }

/* === Social Links (multi-field) === */
.nq-social-fields { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.nq-social-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nq-social-row .nq-input { flex: 1; height: 48px; font-size: 16px; }
.nq-social-remove {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nq-social-remove:hover { color: var(--accent); background: rgba(252, 94, 0, 0.08); }
.nq-add-link {
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
  padding: 8px 0;
  text-align: left;
  margin-bottom: 8px;
}
.nq-add-link:hover { text-decoration: underline; }
.nq-add-link:disabled { opacity: 0.3; cursor: not-allowed; text-decoration: none; }
.nq-helper {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 32px;
}

/* === Primary Button === */
.nq-btn {
  width: 100%;
  height: 56px;
  background: var(--bg-dark);
  color: var(--text-dark-primary);
  border: none;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: auto;
  position: relative;
  overflow: hidden;
}
.nq-btn:hover { background: #2a2a2a; transform: translateY(-1px); }
.nq-btn:active { transform: scale(0.98); }
.nq-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.nq-btn:disabled:hover { background: var(--bg-dark); transform: none; }
.nq-btn-cta { background: var(--accent); }
.nq-btn-cta:hover { background: #e05300; }

/* === Back Button === */
.nq-back {
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  padding: 12px 0;
  text-align: center;
  margin-top: 8px;
}
.nq-back:hover { color: var(--text-primary); }

/* === Loading State === */
.nq-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 24px;
  padding: 40px 0;
}
.nq-loading-bar {
  width: 100%;
  height: 4px;
  background: rgba(24, 24, 24, 0.1);
  border-radius: 2px;
  overflow: hidden;
}
.nq-loading-bar-fill {
  width: 30%;
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  animation: nqLoadSlide 1.5s ease-in-out infinite;
}
@keyframes nqLoadSlide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}
.nq-loading-text {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  min-height: 28px;
}

/* === Results Page === */
.nq-results-header {
  font-size: 28px;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 32px;
  line-height: 1.2;
}

/* Score Ring */
.nq-score-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 32px;
}
.nq-score-ring {
  position: relative;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}
.nq-score-ring svg { transform: rotate(-90deg); }
.nq-score-ring circle {
  fill: none;
  stroke-width: 6;
  cx: 40;
  cy: 40;
  r: 34;
}
.nq-score-ring .ring-bg { stroke: rgba(24, 24, 24, 0.1); }
.nq-score-ring .ring-fill {
  stroke-dasharray: 213.6;
  stroke-dashoffset: 213.6;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease;
}
.nq-score-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
}
.nq-score-label {
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Insight Cards */
.nq-insights { display: flex; flex-direction: column; gap: 12px; margin-bottom: 40px; }
.nq-insight {
  padding: 16px 20px;
  background: rgba(24, 24, 24, 0.03);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 15px;
  line-height: 1.5;
}
.nq-insight:nth-child(2) { border-left-color: var(--accent-purple); }
.nq-insight:nth-child(3) { border-left-color: var(--accent-yellow); }
.nq-insight:nth-child(4) { border-left-color: var(--accent-pink); }

/* Personalized Insight (Branch B) */
.nq-personalized {
  padding: 24px;
  background: rgba(24, 24, 24, 0.03);
  border-radius: var(--radius);
  border-left: 4px solid var(--accent);
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 40px;
}

/* CTA area */
.nq-cta-area { margin-top: auto; text-align: center; }
.nq-cta-muted {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 12px;
}

/* === Discount Charm === */
.nq-charm-wrap {
  display: none;
  flex-direction: column;
  align-items: center;
  margin-bottom: 28px;
}
.nq-charm-wrap.visible {
  display: flex;
  animation: nqCharmDrop 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.nq-charm {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.nq-charm-knot {
  width: 80px;
  height: auto;
  margin-bottom: -56px;
  z-index: 2;
  filter: drop-shadow(0 2px 6px rgba(24, 24, 24, 0.15));
}
@media (min-width: 768px) {
  .nq-charm-knot { width: 94px; margin-bottom: -66px; }
}
.nq-charm-body {
  position: relative;
  width: 120px;
  height: 182px;
  z-index: 1;
}
@media (min-width: 768px) {
  .nq-charm-body { width: 140px; height: 213px; }
}
.nq-charm-body svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 4px 16px rgba(24, 24, 24, 0.18));
}
.nq-charm-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 10px;
  pointer-events: none;
}
.nq-charm-pct {
  font-family: var(--font);
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
  /* color set dynamically */
}
@media (min-width: 768px) {
  .nq-charm-pct { font-size: 42px; }
}
.nq-charm-label {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255, 251, 240, 0.85);
  margin-top: 2px;
}
.nq-charm-date {
  font-family: var(--font);
  font-size: 9px;
  font-weight: 500;
  color: rgba(255, 251, 240, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: absolute;
  bottom: 12%;
  text-align: center;
  line-height: 1.4;
  white-space: pre-line;
}
@media (min-width: 768px) {
  .nq-charm-date { font-size: 10px; }
}
.nq-charm-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 10px;
  font-weight: 500;
}

/* Charm drop-in + swing */
@keyframes nqCharmDrop {
  0% { opacity: 0; transform: translateY(-60px) rotate(-8deg); }
  40% { opacity: 1; transform: translateY(4px) rotate(4deg); }
  60% { transform: translateY(-2px) rotate(-2deg); }
  80% { transform: translateY(1px) rotate(1deg); }
  100% { opacity: 1; transform: translateY(0) rotate(0deg); }
}

/* Subtle idle swing after landing */
.nq-charm-wrap.visible .nq-charm-body {
  animation: nqCharmSwing 3s ease-in-out 0.8s infinite;
  transform-origin: top center;
}
.nq-charm-wrap.visible .nq-charm-knot {
  animation: nqKnotSwing 3s ease-in-out 0.8s infinite;
  transform-origin: center center;
}
@keyframes nqCharmSwing {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(2deg); }
  75% { transform: rotate(-2deg); }
}
/* === Welcome Screen === */
[data-step="0"] {
  min-height: calc(100vh - 120px);
  min-height: calc(100dvh - 120px);
  max-height: calc(100vh - 120px);
  max-height: calc(100dvh - 120px);
  overflow: hidden;
}
.nq-welcome {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  min-height: 0;
}
.nq-welcome .nq-question {
  margin-bottom: 16px;
}
.nq-welcome-privacy {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0;
}
.nq-privacy-link {
  color: var(--text-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.nq-privacy-link:hover {
  color: var(--accent);
}
.nq-btn-start {
  font-size: 18px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nq-btn-start:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(24, 24, 24, 0.2);
}
.nq-btn-start:active {
  transform: scale(0.97);
}
/* Orange flash on click */
.nq-btn-start.clicked {
  background: var(--accent);
  transition: background 0.1s ease;
}

@keyframes nqKnotSwing {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-3deg); }
  75% { transform: rotate(3deg); }
}
