:root {
  /* OKLCH Color System - Warm editorial palette */
  --color-bg: oklch(96% 0.01 80);
  --color-bg-deep: oklch(93% 0.015 80);
  --color-surface: oklch(99% 0.005 80 / 0.92);
  --color-surface-strong: oklch(99% 0.008 80 / 0.96);
  
  /* Text colors - tinted neutrals */
  --color-text: oklch(22% 0.02 60);
  --color-text-muted: oklch(48% 0.03 70);
  --color-text-subtle: oklch(62% 0.025 75);
  
  /* Accent - warm gold with better contrast */
  --color-accent: oklch(52% 0.13 70);
  --color-accent-light: oklch(78% 0.09 70);
  --color-accent-dark: oklch(38% 0.11 70);
  
  /* Line - subtle warm tint */
  --color-line: oklch(82% 0.02 70 / 0.4);
  
  /* Shadows - softer, more natural */
  --shadow-xl: 0 20px 60px oklch(35% 0.06 60 / 0.1);
  --shadow-md: 0 8px 24px oklch(35% 0.05 60 / 0.08);
  --shadow-sm: 0 2px 8px oklch(35% 0.04 60 / 0.06);
  
  /* Radius - slightly reduced for refinement */
  --radius-xl: 24px;
  --radius-lg: 16px;
  --radius-sm: 10px;
  
  /* Spacing - 24px base rhythm */
  --space-xs: 6px;
  --space-sm: 12px;
  --space-md: 24px;
  --space-lg: 48px;
  --space-xl: 72px;
  
  /* Motion - exponential easing family */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;
  
  /* Focus ring */
  --focus-ring: 0 0 0 3px oklch(70% 0.1 70 / 0.4);
}

* { box-sizing: border-box; }

html { 
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body { 
  min-height: 100%; 
}

body {
  margin: 0;
  color: var(--color-text);
  font-family: 'Manrope', sans-serif;
  line-height: 1.5;
  background:
    radial-gradient(circle at 20% 0%, oklch(70% 0.08 70 / 0.08), transparent 40%),
    radial-gradient(circle at 100% 100%, oklch(60% 0.06 80 / 0.06), transparent 50%),
    linear-gradient(180deg, var(--color-bg) 0%, var(--color-bg-deep) 100%);
  background-attachment: fixed;
}

button, input, textarea { 
  font: inherit; 
  color: inherit;
}

a { color: inherit; }

/* Page shell */
.page-shell {
  min-height: 100vh;
  position: relative;
  padding: var(--space-md);
  overflow-x: hidden;
}

/* Subtle grain texture */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* Ambient orbs - more subtle */
.ambient {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  opacity: 0.5;
}

.ambient-a {
  width: 50vw;
  height: 50vw;
  max-width: 600px;
  max-height: 600px;
  right: -10vw;
  top: -10vh;
  background: oklch(70% 0.1 70 / 0.15);
}

.ambient-b {
  width: 30vw;
  height: 30vw;
  max-width: 400px;
  max-height: 400px;
  left: -5vw;
  bottom: -10vh;
  background: oklch(85% 0.05 80 / 0.2);
}

/* Topbar - cleaner, less visual weight */
.topbar {
  max-width: 720px;
  margin: 0 auto var(--space-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
  position: relative;
  z-index: 2;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 100px;
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  backdrop-filter: blur(12px);
  transition: box-shadow var(--duration-fast) var(--ease-out-quart);
}

.brand-mark:hover {
  box-shadow: var(--shadow-sm);
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-accent);
}

.progress-meta {
  color: var(--color-text-subtle);
  font-size: 12px;
  font-weight: 500;
}

/* Layout */
.layout-stage {
  max-width: 680px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

/* Panel intro - more breathing room */
.panel-intro {
  padding: var(--space-lg) var(--space-md) var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--color-line);
}

.panel-intro .story-kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-sm);
}

.panel-intro .story-title {
  margin: 0 0 var(--space-sm);
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(24px, 3.8vw, 34px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  font-weight: 600;
  color: var(--color-text);
}

.panel-intro .story-subtitle {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 15px;
  line-height: 1.6;
  max-width: 45ch;
}

/* Panel */
.panel {
  width: 100%;
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  border: 1px solid oklch(100% 0.01 80 / 0.6);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.panel-question {
  display: flex;
  flex-direction: column;
  min-height: 70vh;
}

.app-banner {
  display: none;
  margin: 16px 16px 0;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid var(--color-line);
}

.app-banner.error {
  background: oklch(96% 0.03 28);
  color: oklch(42% 0.12 28);
  border-color: oklch(82% 0.05 28);
}

.app-banner.info {
  background: oklch(96% 0.02 80);
  color: var(--color-text-muted);
}

/* Progress */
.progress-track {
  width: 100%;
  height: 3px;
  background: var(--color-line);
  overflow: hidden;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent-dark), var(--color-accent));
  transition: width var(--duration-slow) var(--ease-out-expo);
  position: relative;
  overflow: hidden;
}

.progress-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, oklch(100% 0 0 / 0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Question area */
.question-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  padding: var(--space-md);
}

.question-content {
  width: 100%;
}

/* Animation - exponential easing */
.question-content > div:first-child {
  animation: questionEnter var(--duration-normal) var(--ease-out-expo);
}

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

/* Question typography */
.question-number {
  color: var(--color-text-subtle);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: var(--space-sm);
}

.question-title {
  margin: 0 0 var(--space-sm);
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(30px, 4.8vw, 50px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  font-weight: 600;
  color: var(--color-text);
  max-width: 12ch;
}

.question-subtitle {
  margin: 0 0 var(--space-md);
  color: var(--color-text-muted);
  font-size: 16px;
  line-height: 1.6;
  max-width: 45ch;
}

.answer-hint {
  display: inline-flex;
  margin: 0 0 var(--space-sm);
  padding: 6px 10px;
  border-radius: 100px;
  background: oklch(95% 0.02 70);
  color: var(--color-accent-dark);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Selection meta for multi-choice */
.selection-meta {
  display: flex;
  justify-content: space-between;
  gap: var(--space-sm);
  color: var(--color-text-muted);
  font-size: 13px;
  margin-bottom: var(--space-sm);
  font-weight: 500;
}

/* Options grid */
.options-grid {
  display: grid;
  gap: var(--space-xs);
}

/* Option cards - refined with better interactions */
.option-card {
  display: grid;
  grid-template-columns: 36px 28px 1fr 24px;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--color-line);
  background: var(--color-surface-strong);
  cursor: pointer;
  position: relative;
  transition: 
    transform var(--duration-fast) var(--ease-out-quart),
    border-color var(--duration-fast) var(--ease-out-quart),
    background var(--duration-fast) var(--ease-out-quart),
    box-shadow var(--duration-fast) var(--ease-out-quart);
}

.option-card:hover {
  transform: translateY(-1px);
  border-color: oklch(70% 0.06 70);
  box-shadow: var(--shadow-sm);
}

.option-card:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.option-card.is-active {
  border-color: var(--color-accent-light);
}

.option-card.selected {
  background: oklch(97% 0.03 70);
  border-color: var(--color-accent);
  box-shadow: var(--shadow-sm);
}

.option-card.selected:hover {
  border-color: var(--color-accent-dark);
}

.option-card .option-check {
  transform: scale(0.8);
  opacity: 0;
  transition: 
    transform var(--duration-normal) var(--ease-spring),
    opacity var(--duration-fast) var(--ease-out-quart),
    background var(--duration-fast) var(--ease-out-quart),
    border-color var(--duration-fast) var(--ease-out-quart);
}

.option-card.selected .option-check {
  transform: scale(1);
  opacity: 1;
}

.option-key {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-subtle);
  background: oklch(95% 0.01 80);
  transition: all var(--duration-fast) var(--ease-out-quart);
}

.option-card.selected .option-key {
  background: var(--color-accent);
  color: white;
}

.option-main { min-width: 0; }

.option-text {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--color-text);
}

.option-card.selected .option-text {
  color: var(--color-accent-dark);
}

.option-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: transparent;
  border: 1.5px solid var(--color-line);
  background: var(--color-surface);
  transition: all var(--duration-fast) var(--ease-out-quart);
}

.option-card.selected .option-check {
  color: white;
  background: var(--color-accent);
  border-color: var(--color-accent);
}

/* Text inputs */
.text-input-wrapper {
  width: 100%;
  padding: var(--space-sm) 0;
}

.text-input {
  width: 100%;
  border: none;
  outline: none;
  padding: 12px 0 16px;
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--color-text);
  background: transparent;
  border-bottom: 2px solid var(--color-line);
  transition: 
    border-color var(--duration-fast) var(--ease-out-quart),
    transform var(--duration-fast) var(--ease-out-quart);
}

.text-input:focus {
  border-bottom-color: var(--color-accent);
  transform: translateY(-1px);
}

.text-input::placeholder { 
  color: var(--color-text-subtle);
  opacity: 0.5;
}

/* Navigation */
.nav-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md) var(--space-md);
  border-top: 1px solid var(--color-line);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-left: auto;
}

.key-hint {
  color: var(--color-text-subtle);
  font-size: 12px;
  display: none; /* Hide on mobile by default, show on desktop */
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid var(--color-line);
  background: var(--color-surface);
  font-size: 11px;
  font-family: inherit;
}

/* Buttons - refined interactions */
.btn-ghost,
.btn-primary,
.cta-primary,
.cta-secondary {
  border: none;
  border-radius: 100px;
  padding: 12px 24px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  position: relative;
  overflow: hidden;
  transition: 
    transform var(--duration-fast) var(--ease-out-quart),
    box-shadow var(--duration-fast) var(--ease-out-quart),
    opacity var(--duration-fast) var(--ease-out-quart),
    background var(--duration-fast) var(--ease-out-quart);
}

/* Focus states for accessibility */
.btn-ghost:focus-visible,
.btn-primary:focus-visible,
.cta-primary:focus-visible,
.cta-secondary:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn-ghost {
  color: var(--color-text-muted);
  background: transparent;
}

.btn-ghost:hover {
  color: var(--color-text);
  transform: translateX(-2px);
}

.btn-ghost:active {
  transform: translateX(-1px);
}

.btn-primary,
.cta-primary {
  color: white;
  background: linear-gradient(135deg, var(--color-accent-dark), var(--color-accent));
  box-shadow: 
    0 4px 16px oklch(45% 0.12 60 / 0.25),
    inset 0 1px 0 oklch(100% 0 0 / 0.2);
}

.btn-primary:hover:not(:disabled),
.cta-primary:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 8px 24px oklch(45% 0.12 60 / 0.3),
    inset 0 1px 0 oklch(100% 0 0 / 0.2);
}

.btn-primary:active:not(:disabled),
.cta-primary:active {
  transform: translateY(-1px);
  box-shadow: 
    0 4px 12px oklch(45% 0.12 60 / 0.25),
    inset 0 1px 0 oklch(100% 0 0 / 0.2);
}

.btn-primary:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* Result panel */
.panel-result {
  padding: var(--space-lg) var(--space-md);
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-content {
  width: 100%;
  max-width: 560px;
}

.result-badge {
  display: inline-flex;
  padding: 8px 14px;
  border-radius: 100px;
  background: oklch(95% 0.03 70);
  color: var(--color-accent-dark);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--space-sm);
}

.result-title {
  margin: 0 0 var(--space-sm);
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(40px, 6vw, 64px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-weight: 600;
  color: var(--color-text);
}

.result-desc {
  margin: 0 0 var(--space-md);
  color: var(--color-text-muted);
  font-size: 17px;
  line-height: 1.6;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.result-score,
.result-route-card,
.result-summary {
  padding: var(--space-sm);
  border-radius: var(--radius-lg);
  background: var(--color-surface-strong);
  border: 1px solid var(--color-line);
  transition: border-color var(--duration-fast) var(--ease-out-quart);
}

.result-route-card:hover {
  border-color: oklch(70% 0.06 70);
}

.result-route-label,
.score-label {
  color: var(--color-text-subtle);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.result-route-value,
.score-value {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-text);
}

.result-summary {
  margin-bottom: var(--space-md);
}

.result-summary p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 14px;
  line-height: 1.7;
}

.cta-grid {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.cta-secondary {
  color: var(--color-text);
  background: var(--color-surface-strong);
  border: 1px solid var(--color-line);
}

.cta-secondary:hover {
  background: var(--color-surface);
  border-color: oklch(70% 0.06 70);
  transform: translateY(-1px);
}

/* Responsive */
@media (min-width: 768px) {
  .key-hint { display: block; }
  .page-shell { padding: var(--space-lg); }
  .question-wrapper { padding: var(--space-lg); }
  .panel-intro { padding: var(--space-xl) var(--space-lg) var(--space-lg); }
}

@media (max-width: 480px) {
  :root { --space-md: 20px; --space-lg: 32px; }
  .page-shell { padding: 16px; }
  .option-card { grid-template-columns: 32px 24px 1fr 20px; padding: 14px; gap: 12px; }
  .option-key { width: 32px; height: 32px; font-size: 11px; }
  .option-text { font-size: 15px; }
  .text-input { font-size: 28px; }
  .result-stats { grid-template-columns: 1fr; }
  .nav-controls { flex-direction: column-reverse; align-items: stretch; }
  .nav-right { width: 100%; justify-content: space-between; }
  .btn-ghost, .btn-primary { width: 100%; text-align: center; }
}
