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

:root {
  --accent-color: #5bb8a6;
  --accent-dim: rgba(91, 184, 166, 0.12);
  --accent-glow: rgba(91, 184, 166, 0.25);
  --green: #6db88a;
  --green-dim: rgba(109, 184, 138, 0.12);
  --yellow: #d4c35c;
  --yellow-dim: rgba(212, 195, 92, 0.12);
  --orange: #e8845c;
  --orange-dim: rgba(232, 132, 92, 0.12);
  --red: #e05c5c;
  --red-dim: rgba(224, 92, 92, 0.12);
  --bg: #141418;
  --surface: #1c1c22;
  --surface-2: #242430;
  --text: #dcdce4;
  --text-muted: #a0a0b0;
  --text-faint: #6e6e80;
  --border: #2a2a38;
  --radius: 12px;
  --focus-ring: 0 0 0 2px var(--accent-color);
}

/* Light mode overrides */
[data-theme="light"] {
  --accent-color: #3d9e8e;
  --accent-dim: rgba(61, 158, 142, 0.10);
  --accent-glow: rgba(61, 158, 142, 0.2);
  --green: #3d9960;
  --green-dim: rgba(61, 153, 96, 0.10);
  --yellow: #b5a030;
  --yellow-dim: rgba(181, 160, 48, 0.10);
  --orange: #d06a3a;
  --orange-dim: rgba(208, 106, 58, 0.10);
  --red: #c94444;
  --red-dim: rgba(201, 68, 68, 0.10);
  --bg: #f8f8fa;
  --surface: #ffffff;
  --surface-2: #eeeef2;
  --text: #1a1a2e;
  --text-muted: #555568;
  --text-faint: #8888a0;
  --border: #dddde4;
}

/* Theme toggle */
.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
  line-height: 1;
  padding: 0;
}

.theme-toggle:hover {
  border-color: var(--text-faint);
}

.toggle-icon {
  color: var(--text-faint);
}

[data-theme="light"] .btn-primary {
  color: #fff;
}

[data-theme="light"] .print-summary {
  background: white;
}

::selection {
  background: var(--accent-color);
  color: var(--bg);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.65;
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 24px;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--surface);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 8px;
  z-index: 1000;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.2s;
}

.skip-link:focus { top: 16px; }

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

button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Screens */
.screen { display: none; }
.screen.active { display: block; animation: fadeIn 0.35s ease-out; }

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

/* Hero */
.hero {
  padding-top: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.hero h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
}

.highlight { color: var(--accent-color); }

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 440px;
  margin-bottom: 36px;
  line-height: 1.7;
}

/* Face — interactive eyes + morph animation */
.face-swap {
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  animation: faceAppear 0.6s ease-out 0.5s forwards;
}

@keyframes faceAppear {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.face-swap svg {
  overflow: visible;
}

.face-ring {
  stroke: var(--accent-color);
  transition: stroke 2s ease-in-out;
}

.face-ring.tired {
  stroke: var(--text-faint);
}

.eye-socket {
  transition: fill 0.3s;
}

.pupil {
  fill: var(--accent-color);
  transition: cx 0.08s ease-out, cy 0.08s ease-out, fill 2s ease-in-out;
}

.pupil.tired {
  fill: var(--text-faint);
}

.face-mouth {
  stroke: var(--accent-color);
  transition: d 2s ease-in-out, stroke 2s ease-in-out;
}

.face-mouth.tired {
  stroke: var(--text-faint);
}

.eye-bags {
  stroke: var(--text-faint);
  opacity: 0;
  transition: opacity 2s ease-in-out;
}

.eye-bags.visible {
  opacity: 0.4;
}

/* Hero Stats */
.hero-stats {
  display: flex;
  gap: 28px;
  margin-bottom: 36px;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-faint);
  line-height: 1.4;
  max-width: 110px;
  text-align: center;
}

/* Social Proof */
.social-proof {
  font-size: 0.82rem;
  color: var(--text-faint);
  margin-bottom: 20px;
  opacity: 0;
  transition: opacity 0.5s ease-out;
}

.social-proof.visible { opacity: 1; }
.social-proof .proof-count { color: var(--text-muted); font-weight: 600; }

.hero-note {
  margin-top: 16px;
  font-size: 0.78rem;
  color: var(--text-faint);
}

/* Buttons */
.btn-primary {
  background: var(--accent-color);
  color: var(--bg);
  border: none;
  padding: 14px 40px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-primary:hover:not(:disabled) { opacity: 0.85; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 14px 28px;
  min-height: 44px;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.btn-secondary:hover:not(:disabled) { color: var(--text); border-color: var(--text-faint); }
.btn-secondary:disabled { opacity: 0.3; cursor: not-allowed; }

/* Progress */
.progress-bar {
  width: 100%;
  height: 3px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  background: var(--accent-color);
  border-radius: 2px;
  transition: width 0.4s ease-out;
  width: 0%;
}

.progress-text {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-faint);
  margin-bottom: 6px;
}

/* Question */
.question-card {
  padding: 28px 0;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  animation: slideIn 0.25s ease-out;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

.question-domain {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-color);
  letter-spacing: 0.3px;
  margin-bottom: 12px;
}

.question-card h2 {
  font-size: 1.15rem;
  font-weight: 500;
  min-height: 3.5em;
  margin-bottom: 24px;
  line-height: 1.6;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  min-height: 44px;
  font-size: 0.92rem;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
  font-family: inherit;
}

.option:hover { border-color: var(--text-faint); background: var(--surface-2); }

.option.selected {
  border-color: var(--accent-color);
  background: var(--accent-dim);
  animation: optionPulse 0.2s ease-out;
}

@keyframes optionPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.015); }
  100% { transform: scale(1); }
}

.nav-buttons {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

/* Loading */
.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
}

.loading-icon {
  margin-bottom: 28px;
}

.loading-mask {
  width: 50px;
  height: 30px;
  background: var(--accent-color);
  border-radius: 25px 25px 16px 16px;
  position: relative;
  animation: loadingMaskPulse 1.5s ease-in-out infinite;
}

.loading-mask-crack {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 1.5px;
  height: 14px;
  background: rgba(0,0,0,0.2);
  animation: crackGrow 1.5s ease-in-out infinite;
}

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

@keyframes crackGrow {
  0%, 100% { height: 8px; opacity: 0.2; }
  50% { height: 16px; opacity: 0.5; }
}

.loading-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  animation: loadingFade 1.5s ease-in-out infinite;
}

@keyframes loadingFade {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* Results */
#results > h1 {
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 32px;
  text-align: center;
}

/* Score Ring */
.score-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 32px;
}

.score-ring {
  position: relative;
  width: 140px;
  height: 140px;
  margin-bottom: 12px;
}

.score-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--surface-2);
  stroke-width: 6;
}

.ring-fill {
  fill: none;
  stroke: var(--accent-color);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
  transition: stroke-dashoffset 1.5s ease-out, stroke 0.8s ease-out;
}

.ring-fill.minimal { stroke: var(--accent-color); opacity: 0.35; }
.ring-fill.moderate { stroke: var(--accent-color); opacity: 0.55; }
.ring-fill.significant { stroke: var(--accent-color); opacity: 0.8; }
.ring-fill.severe { stroke: var(--accent-color); opacity: 1; }

.score-inner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.score-number { font-size: 2.2rem; font-weight: 700; color: var(--text); }
.score-total { font-size: 0.9rem; color: var(--text-faint); font-weight: 500; }

.score-label {
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 6px 16px;
  border-radius: 20px;
}

.score-label.minimal { background: var(--accent-dim); color: var(--accent-color); opacity: 0.6; }
.score-label.moderate { background: var(--accent-dim); color: var(--accent-color); opacity: 0.75; }
.score-label.significant { background: var(--accent-dim); color: var(--accent-color); opacity: 0.9; }
.score-label.severe { background: var(--accent-dim); color: var(--accent-color); opacity: 1; }

/* Domain Cards */
.domains-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}

.domain-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.domain-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.domain-icon { font-size: 1.2rem; }

.domain-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.domain-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.domain-score {
  font-size: 0.78rem;
  color: var(--text-faint);
  font-weight: 500;
}

.domain-bar {
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 10px;
}

.domain-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 1s ease-out;
  width: 0%;
}

.domain-bar-fill.minimal { background: var(--accent-color); opacity: 0.35; }
.domain-bar-fill.moderate { background: var(--accent-color); opacity: 0.55; }
.domain-bar-fill.significant { background: var(--accent-color); opacity: 0.8; }
.domain-bar-fill.severe { background: var(--accent-color); opacity: 1; }

.domain-desc {
  font-size: 0.82rem;
  color: var(--text-faint);
  line-height: 1.6;
}

/* Interpretation */
.interpretation {
  padding: 24px 0;
  margin-bottom: 24px;
  border-top: 1px solid var(--border);
}

.interpretation h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.interpretation p {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 12px;
  line-height: 1.7;
}

.interpretation ul {
  color: var(--text-muted);
  font-size: 0.88rem;
  padding-left: 18px;
  line-height: 1.8;
}

.noro-callout-card {
  margin-top: 20px;
  padding: 16px 18px;
  background: var(--accent-dim);
  border: 1px solid rgba(91, 184, 166, 0.15);
  border-left: 3px solid var(--accent-color);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.88rem;
  line-height: 1.7;
}

[data-theme="light"] .noro-callout-card {
  background: rgba(61, 158, 142, 0.06);
  border-color: rgba(61, 158, 142, 0.12);
  border-left-color: var(--accent-color);
}

.noro-link {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 600;
}

.noro-link:hover { text-decoration: underline; }

/* Breakdown */
.breakdown-card {
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  transform: translateY(8px);
}

.breakdown-card.stagger-in {
  animation: staggerIn 0.3s ease-out forwards;
}

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

.breakdown-card:last-child { border-bottom: none; }

.breakdown-bar-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.breakdown-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.breakdown-bar {
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
}

.breakdown-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--accent-color);
  transition: width 1s ease-out;
  width: 0%;
}

.breakdown-bar-fill.low { background: var(--accent-color); opacity: 0.35; }

.breakdown-value {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-faint);
  min-width: 28px;
  text-align: right;
}

/* Accordions */
.info-accordions { margin-bottom: 24px; }

.info-accordion { border-bottom: 1px solid var(--border); }
.info-accordion:last-child { border-bottom: none; }

.info-accordion summary {
  padding: 14px 0;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-faint);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  -webkit-user-select: none;
  user-select: none;
}

.info-accordion summary::-webkit-details-marker { display: none; }

.info-accordion summary::after {
  content: '';
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--text-faint);
  border-bottom: 1.5px solid var(--text-faint);
  transform: rotate(45deg);
  transition: transform 0.2s ease-out;
  flex-shrink: 0;
  margin-left: 12px;
}

.info-accordion[open] summary::after { transform: rotate(-135deg); }
.info-accordion summary:hover { color: var(--text-muted); }

.accordion-body { padding: 0 0 16px; }

.accordion-body p {
  font-size: 0.84rem;
  color: var(--text-faint);
  line-height: 1.7;
}

/* Action Buttons */
.results-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 24px;
}

.btn-action {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 14px 18px;
  min-height: 44px;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  font-family: inherit;
}

.btn-action:hover { color: var(--text); border-color: var(--text-faint); }
.action-icon { font-size: 0.9rem; }

/* Email */
.email-capture {
  display: none;
  text-align: center;
  margin-bottom: 28px;
}

.email-capture.visible { display: block; animation: fadeIn 0.25s ease-out; }

.email-prompt { font-size: 0.84rem; color: var(--text-muted); margin-bottom: 12px; }

.email-form {
  display: flex;
  gap: 8px;
  max-width: 360px;
  margin: 0 auto;
}

.email-form input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 16px;
  color: var(--text);
  font-family: inherit;
}

.email-form input::placeholder { color: var(--text-faint); }
.email-form input:focus { outline: none; border-color: var(--accent-color); }

.btn-sm { padding: 14px 20px; min-height: 44px; font-size: 0.85rem; }

.email-note { display: none; margin-top: 10px; font-size: 0.78rem; color: var(--text-faint); }
.email-note.visible { display: block; }

/* Share */
.share-section {
  text-align: center;
  padding: 20px 0;
  margin-bottom: 20px;
  border-top: 1px solid var(--border);
}

.share-prompt { font-size: 0.84rem; color: var(--text-faint); margin-bottom: 10px; }

.share-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-share {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 14px 16px;
  min-height: 44px;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s, border-color 0.15s;
}

.btn-share:hover { color: var(--text); border-color: var(--text-faint); }

.share-copied {
  font-size: 0.78rem;
  color: var(--green);
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.2s;
}

.share-copied.visible { opacity: 1; }

/* Print */
.print-summary { display: none; }

@media print {
  body * { visibility: hidden; }

  .print-summary, .print-summary * { visibility: visible; }

  .print-summary {
    display: block;
    position: absolute;
    left: 0; top: 0;
    width: 100%;
    padding: 40px;
    background: white;
    color: #1a1a1a;
    font-size: 11pt;
    line-height: 1.6;
  }

  .print-summary h1 { font-size: 16pt; margin-bottom: 4px; color: #1a1a1a; }
  .print-date { font-size: 9pt; color: #666; margin-bottom: 24px; }

  .print-summary table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
    font-size: 10pt;
  }

  .print-summary th, .print-summary td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
  }

  .print-summary th {
    font-weight: 600; color: #444;
    font-size: 9pt; text-transform: uppercase; letter-spacing: 0.5px;
  }

  .print-summary h2 { font-size: 13pt; margin: 24px 0 12px; padding-bottom: 4px; border-bottom: 1px solid #ddd; }
  .print-item { margin-bottom: 8px; font-size: 10pt; }
  .print-footer { margin-top: 32px; padding-top: 16px; border-top: 1px solid #ccc; font-size: 8.5pt; color: #888; }
}

/* Responsive */
@media (max-width: 600px) {
  .hero h1 { font-size: 1.6rem; }
  .hero-stats { gap: 16px; flex-wrap: wrap; justify-content: center; }
  .stat-value { font-size: 1.1rem; }
  .stat-label { font-size: 0.68rem; }
  .question-card { padding: 20px 0; }
  .question-card h2 { min-height: 3.2em; }
  .container { padding: 20px 16px; }
  .results-actions { flex-direction: column; align-items: stretch; }
  .email-form { flex-direction: column; }
  .nav-buttons { flex-direction: column; }
}

@media (max-width: 360px) {
  .hero h1 { font-size: 1.35rem; }
  .container { padding: 16px 12px; }
  .hero-stats { gap: 12px; }
  .stat-value { font-size: 1rem; }
}
