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

:root {
  /* Digital Atelier — Material Logic (brighter v2) */
  --surface: #14181c;
  --surface-dim: #0e1115;
  --surface-container-low: #1c2127;
  --surface-container-high: #262c33;
  --surface-container-highest: #2c333a;
  --surface-bright: #353d45;

  --primary: #b3c5ff;
  --primary-container: #003fa4;
  --on-primary: #0c0e10;
  --on-surface: #e0e6ed;
  --secondary: #9d9ea0;
  --outline-variant: #42494f;
  --error: #ee7d77;

  /* Ghost Border = outline_variant at 30% opacity */
  --ghost-border: rgba(66, 73, 79, 0.3);

  --radius-sm: 2px;
  --transition: 0.25s ease;
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--surface);
  color: var(--on-surface);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.02em;
}

/* === Ambient Background Layers === */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, rgba(0, 63, 164, 0.18) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 70% 20%, rgba(179, 197, 255, 0.09) 0%, transparent 60%),
    radial-gradient(ellipse 40% 50% at 20% 80%, rgba(0, 63, 164, 0.12) 0%, transparent 60%);
  pointer-events: none;
}

/* Dot grid texture */
body::after {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background-image: radial-gradient(rgba(179, 197, 255, 0.12) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 50%, black 20%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 50%, black 20%, transparent 80%);
}

/* Background canvas — animated particles */
#bg-canvas {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none;
}

/* Progress — 2px with subtle glow */
#progress-bar {
  position: fixed; top: 0; left: 0; right: 0; height: 2px;
  background: var(--surface-container-high); z-index: 100;
}
#progress-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--primary-container), var(--primary));
  transition: width 0.5s ease;
  box-shadow: 0 0 12px rgba(179, 197, 255, 0.3);
}

/* Nav — surface_container_low with bottom ghost border */
#nav {
  position: fixed; top: 2px; left: 0; right: 0; height: 72px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; z-index: 90;
  background: rgba(28, 33, 39, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 0.5px solid var(--ghost-border);
}
.logo { height: 40px; opacity: 0.95; }
.nav-right { display: flex; align-items: center; gap: 12px; }
#question-counter {
  font-size: 0.6875rem; color: var(--secondary);
  font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
}
.nav-btn {
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  border: 0.5px solid var(--ghost-border);
  background: transparent;
  color: var(--secondary);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.nav-btn:hover:not(:disabled) {
  background: var(--surface-bright);
  color: var(--on-surface);
}
.nav-btn:disabled { opacity: 0.15; cursor: not-allowed; }

/* Container */
#survey-container {
  height: 100vh; width: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 88px 20px 20px;
  position: relative; overflow: hidden;
  z-index: 1;
}

/* Slide */
.slide {
  max-width: 580px; width: 100%;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
  position: absolute;
  inset: 0; margin: auto;
  height: fit-content;
  padding: 32px 28px;
  transform: translateY(20px);
  pointer-events: none;
  background: rgba(17, 20, 22, 0.5);
  border: 0.5px solid var(--ghost-border);
  border-radius: 4px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.slide.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

/* Ambient glow behind active slide */
.slide.active::before {
  content: '';
  position: absolute;
  top: -40px; left: -40px; right: -40px; bottom: -40px;
  background: radial-gradient(ellipse at center, rgba(0, 63, 164, 0.06) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
  border-radius: 4px;
}

/* Section label — label-sm uppercase with accent dot */
.section-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0;
  font-size: 0.6875rem; font-weight: 500;
  color: var(--secondary);
  margin-bottom: 16px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: none; border: none;
}
.section-badge::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--primary);
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px rgba(179, 197, 255, 0.4);
  animation: pulse-dot 2.5s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 8px rgba(179, 197, 255, 0.4); }
  50% { box-shadow: 0 0 14px rgba(179, 197, 255, 0.7); }
}

/* Question number — label-sm */
.q-number {
  font-size: 0.6875rem; font-weight: 500;
  color: var(--outline-variant);
  margin-bottom: 8px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Question — headline-md, Medium weight */
.q-text {
  font-size: 1.125rem; font-weight: 500;
  line-height: 1.5; margin-bottom: 8px;
  color: var(--on-surface);
}

/* Hint — body-sm */
.q-hint {
  font-size: 0.75rem; line-height: 1.6;
  color: var(--secondary);
  margin-bottom: 24px;
}

/* Ghost Input — 0.5px outline_variant bottom-border, focus → primary */
.input-text, .input-textarea {
  width: 100%; padding: 8px 0;
  background: transparent;
  border: none;
  border-bottom: 0.5px solid var(--ghost-border);
  color: var(--on-surface);
  font-family: inherit; font-size: 0.875rem;
  letter-spacing: -0.02em;
  transition: var(--transition);
  outline: none;
}
.input-text:focus, .input-textarea:focus {
  border-bottom-color: var(--primary);
  box-shadow: 0 1px 8px rgba(179, 197, 255, 0.1);
}
.input-text::placeholder, .input-textarea::placeholder {
  color: var(--outline-variant);
}
.input-textarea {
  min-height: 100px; resize: vertical;
  line-height: 1.7;
}

/* Number input */
.input-number {
  width: 100px; padding: 8px 0;
  background: transparent;
  border: none;
  border-bottom: 0.5px solid var(--ghost-border);
  color: var(--on-surface);
  font-family: 'Inter', sans-serif;
  font-size: 1.5rem; font-weight: 600;
  letter-spacing: -0.02em;
  outline: none;
  transition: var(--transition);
  -moz-appearance: textfield;
}
.input-number::-webkit-inner-spin-button,
.input-number::-webkit-outer-spin-button { -webkit-appearance: none; }
.input-number:focus { border-bottom-color: var(--primary); box-shadow: 0 1px 8px rgba(179, 197, 255, 0.1); }
.number-unit {
  font-size: 0.75rem; color: var(--secondary); margin-left: 8px;
  font-weight: 500;
}
.number-row { display: flex; align-items: baseline; }

/* Option cards — tonal layering, zero dividers, 8px vertical gap */
.options-grid {
  display: flex; flex-direction: column; gap: 0;
}
.option-card {
  padding: 8px 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
  display: flex; align-items: center; gap: 12px;
  user-select: none;
}
.option-card:hover {
  background: var(--surface-bright);
}
.option-card.selected {
  background: var(--surface-container-high);
  border-left: 2px solid var(--primary);
}
.option-key {
  width: 20px; height: 20px;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--ghost-border);
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6875rem; font-weight: 600;
  color: var(--secondary);
  flex-shrink: 0;
  transition: var(--transition);
  letter-spacing: 0;
}
.option-card.selected .option-key {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.option-label {
  font-size: 0.875rem; line-height: 1.4;
}

/* Rank — zero dividers, 8px padding */
.rank-list { display: flex; flex-direction: column; gap: 0; }
.rank-item {
  padding: 8px 12px;
  background: transparent;
  border: none;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; user-select: none;
  transition: background 0.15s ease;
}
.rank-item:hover { background: var(--surface-bright); }
.rank-item.selected { background: var(--surface-container-high); }
.rank-number {
  width: 20px; height: 20px; border-radius: var(--radius-sm);
  border: 0.5px solid var(--ghost-border);
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6875rem; font-weight: 700;
  color: var(--secondary);
  flex-shrink: 0;
}
.rank-item.selected .rank-number {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.rank-grip {
  color: rgba(66,73,79,0.3); font-size: 12px; flex-shrink: 0;
}
.rank-label { font-size: 0.75rem; flex: 1; }
.rank-hint {
  font-size: 0.6875rem; color: var(--outline-variant);
  margin-top: 8px; letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Structured input */
.struct-row {
  display: grid; grid-template-columns: 1fr 80px 48px 1fr;
  gap: 8px; margin-bottom: 0; align-items: start;
}
.struct-row .input-text { padding: 6px 0; font-size: 0.75rem; }
.struct-header {
  display: grid; grid-template-columns: 1fr 80px 48px 1fr;
  gap: 8px; margin-bottom: 4px;
}
.struct-header span {
  font-size: 0.6875rem; color: var(--outline-variant); font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.add-row-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px; border-radius: var(--radius-sm);
  background: transparent;
  border: 0.5px solid var(--ghost-border);
  color: var(--secondary);
  font-size: 0.6875rem; font-weight: 500; cursor: pointer;
  transition: var(--transition);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.add-row-btn:hover { background: var(--surface-bright); color: var(--on-surface); }
.no-pay-btn {
  margin-left: 8px;
  padding: 4px 12px; border-radius: var(--radius-sm);
  background: transparent;
  border: 0.5px solid var(--ghost-border);
  color: var(--secondary);
  font-size: 0.6875rem; font-weight: 500; cursor: pointer;
  transition: var(--transition);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.no-pay-btn:hover { background: var(--surface-bright); }
.no-pay-btn.active {
  background: var(--surface-container-high);
  color: var(--primary);
  border-color: var(--primary);
}

/* Chips — surface_container_high bg, label-md text */
.chip-grid {
  display: flex; flex-wrap: wrap; gap: 4px;
}
.chip {
  padding: 4px 12px; border-radius: var(--radius-sm);
  background: var(--surface-container-high);
  border: none;
  font-size: 0.75rem; font-weight: 500; cursor: pointer;
  transition: background 0.15s ease;
  user-select: none;
  color: var(--on-surface);
}
.chip:hover { background: var(--surface-bright); }
.chip.selected {
  background: linear-gradient(135deg, var(--primary), #8aa8ff);
  color: var(--on-primary);
  box-shadow: 0 1px 8px rgba(179, 197, 255, 0.15);
}

.other-inline {
  display: inline-flex; align-items: center; gap: 4px;
}
.other-inline .input-text {
  width: 120px; padding: 4px 0; font-size: 0.75rem;
}

/* CTA — primary action: gradient bg, glow */
.cta-row {
  margin-top: 24px;
  display: flex; align-items: center; gap: 12px;
}
.btn-next {
  padding: 8px 24px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary), #8aa8ff);
  color: var(--on-primary);
  font-size: 0.75rem; font-weight: 600;
  border: none; cursor: pointer;
  transition: var(--transition);
  display: inline-flex; align-items: center; gap: 6px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  box-shadow: 0 2px 12px rgba(179, 197, 255, 0.2);
}
.btn-next:hover { filter: brightness(0.9); box-shadow: 0 2px 20px rgba(179, 197, 255, 0.3); }

.btn-back {
  padding: 8px 16px; border-radius: var(--radius-sm);
  background: transparent;
  border: 0.5px solid var(--ghost-border);
  color: var(--secondary);
  font-size: 0.75rem; font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex; align-items: center; gap: 6px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.btn-back:hover {
  background: var(--surface-bright);
  color: var(--on-surface);
  border-color: var(--secondary);
}
.btn-next svg { transition: transform 0.15s; }
.btn-next:hover svg { transform: translateX(2px); }
.enter-hint {
  font-size: 0.6875rem; color: var(--outline-variant);
  display: flex; align-items: center; gap: 4px;
}
.key-badge {
  padding: 1px 4px; border-radius: var(--radius-sm);
  border: 0.5px solid var(--ghost-border);
  font-size: 0.625rem; font-weight: 500;
  color: var(--outline-variant);
  background: transparent;
}

/* Welcome & Thankyou slides — no card border, open feel */
.slide:has(.welcome-slide),
.slide:has(.thankyou-slide) {
  background: transparent;
  border: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.slide:has(.welcome-slide)::before,
.slide:has(.thankyou-slide)::before {
  display: none;
}

/* Welcome — dramatic, layered */
.welcome-slide, .thankyou-slide { text-align: center; position: relative; }
.welcome-logo {
  height: 32px; margin-bottom: 36px;
  opacity: 0.9;
  filter: drop-shadow(0 0 20px rgba(179, 197, 255, 0.2));
}
.welcome-title {
  font-size: 1.75rem; font-weight: 600;
  line-height: 1.3; margin-bottom: 16px;
  color: var(--on-surface);
  letter-spacing: -0.02em;
}
.welcome-sub {
  font-size: 0.8125rem; color: var(--secondary);
  line-height: 1.7; margin-bottom: 32px;
  max-width: 380px; margin-left: auto; margin-right: auto;
}
.welcome-meta {
  display: flex; justify-content: center; gap: 40px;
  margin-bottom: 36px;
}
.meta-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  position: relative;
}
.meta-item::after {
  content: '';
  position: absolute; right: -20px; top: 50%; transform: translateY(-50%);
  width: 1px; height: 24px;
  background: var(--ghost-border);
}
.meta-item:last-child::after { display: none; }
.meta-value {
  font-size: 1.25rem; font-weight: 600;
  color: var(--primary);
  letter-spacing: -0.02em;
}
.meta-label {
  font-size: 0.6875rem; color: var(--outline-variant);
  font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.05em;
}
.btn-start {
  padding: 10px 40px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary), #8aa8ff);
  color: var(--on-primary);
  font-size: 0.8125rem; font-weight: 600;
  border: none; cursor: pointer;
  transition: var(--transition);
  display: inline-flex; align-items: center; gap: 8px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  box-shadow: 0 4px 24px rgba(179, 197, 255, 0.25);
}
.btn-start:hover {
  filter: brightness(0.9);
  box-shadow: 0 4px 32px rgba(179, 197, 255, 0.35);
  transform: translateY(-1px);
}
.welcome-hex-ring {
  margin-bottom: 24px;
  opacity: 0.8;
  animation: hex-spin 30s linear infinite;
}
@keyframes hex-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.welcome-divider {
  width: 40px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  margin: 0 auto 24px;
  opacity: 0.5;
}

/* Thankyou */
.thankyou-title {
  font-size: 1.5rem; font-weight: 600; margin-bottom: 16px;
  color: var(--on-surface);
  letter-spacing: -0.02em;
}
.thankyou-sub {
  font-size: 0.8125rem; color: var(--secondary); line-height: 1.7;
}

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

/* Scrollbar — invisible track */
::-webkit-scrollbar { width: 2px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--outline-variant); border-radius: 1px; }

.scroll-content {
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding-right: 4px;
}

/* Responsive */
@media (max-width: 640px) {
  .q-text { font-size: 1rem; }
  .welcome-title { font-size: 1.25rem; }
  .struct-row { grid-template-columns: 1fr; }
  .struct-header { display: none; }
  #nav { padding: 0 12px; }
  #survey-container { padding: 48px 8px 12px; }
  .slide { padding: 24px 20px; }
  .welcome-meta { gap: 20px; }
  .meta-item::after { right: -10px; }
}

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