:root {
  --bg: #0a0a0f;
  --bg-card: #12121a;
  --bg-elevated: #1a1a26;
  --fg: #e8e8f0;
  --fg-muted: #8888a0;
  --accent: #7b5cff;
  --accent-glow: rgba(123, 92, 255, 0.35);
  --warn: #ff6b6b;
  --warn-glow: rgba(255, 107, 107, 0.3);
  --green: #4ade80;
  --border: rgba(255, 255, 255, 0.06);
  --radius: 12px;
  --font: 'Space Grotesk', sans-serif;
  --mono: 'DM Mono', monospace;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ====== HERO ====== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 60px;
  padding: 80px 40px;
  overflow: hidden;
}

.hero-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(123, 92, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(123, 92, 255, 0.04) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 20%, transparent 70%);
}

.hero-content {
  max-width: 540px;
  z-index: 1;
}

.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid rgba(123, 92, 255, 0.3);
  padding: 6px 14px;
  border-radius: 100px;
  margin-bottom: 28px;
}

.hero h1 {
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
}

.hero h1 .accent {
  color: var(--accent);
  font-style: italic;
}

.lede {
  font-size: 1.1rem;
  color: var(--fg-muted);
  line-height: 1.7;
  max-width: 460px;
  margin-bottom: 32px;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  background: var(--accent);
  color: #fff;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 14px 28px;
  border-radius: 10px;
  text-decoration: none;
  transition: background 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.hero-cta:hover {
  background: #6b4ee0;
  box-shadow: 0 4px 30px rgba(123, 92, 255, 0.5);
}

/* Profile Card Visual */
.hero-visual {
  z-index: 1;
  flex-shrink: 0;
}

.profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 340px;
  box-shadow: 0 0 80px var(--accent-glow), 0 4px 30px rgba(0,0,0,0.4);
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.avatar-placeholder {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
}

.profile-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bar {
  height: 10px;
  border-radius: 5px;
  background: var(--bg-elevated);
}

.bar-name { width: 120px; }
.bar-handle { width: 80px; }

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

.trait-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--fg-muted);
  width: 100px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.trait-track {
  flex: 1;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
}

.trait-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 1s ease;
}

.trait-fill.warn {
  background: var(--warn);
}

.trait-val {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--fg-muted);
  width: 28px;
  text-align: right;
}

.profile-insight {
  margin-top: 20px;
  padding: 14px;
  background: rgba(123, 92, 255, 0.06);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  font-size: 0.82rem;
  color: var(--fg-muted);
  line-height: 1.55;
  font-family: var(--mono);
}

/* ====== HOW IT WORKS ====== */
.how {
  padding: 120px 40px;
  max-width: 960px;
  margin: 0 auto;
}

.how h2 {
  font-size: 0.85rem;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 60px;
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 56px;
}

.step {
  display: grid;
  grid-template-columns: 60px 1fr;
  grid-template-rows: auto auto;
  gap: 0 24px;
}

.step-num {
  grid-row: 1 / -1;
  font-family: var(--mono);
  font-size: 2.4rem;
  font-weight: 300;
  color: rgba(123, 92, 255, 0.25);
  line-height: 1;
  padding-top: 4px;
}

.step h3 {
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.step p {
  font-size: 1rem;
  color: var(--fg-muted);
  line-height: 1.7;
  max-width: 560px;
}

/* ====== INSIGHTS ====== */
.insights {
  padding: 80px 40px 120px;
  max-width: 1060px;
  margin: 0 auto;
}

.insights-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.insight-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.insight-card:hover {
  border-color: rgba(123, 92, 255, 0.2);
  box-shadow: 0 0 40px rgba(123, 92, 255, 0.08);
}

.insight-icon {
  font-size: 1.6rem;
  margin-bottom: 18px;
}

.insight-card h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}

.insight-card p {
  font-size: 0.92rem;
  color: var(--fg-muted);
  line-height: 1.7;
}

/* ====== CLOSING ====== */
.closing {
  padding: 120px 40px;
  text-align: center;
}

.closing-content {
  max-width: 680px;
  margin: 0 auto;
}

.closing h2 {
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
}

.closing p {
  font-size: 1.05rem;
  color: var(--fg-muted);
  line-height: 1.75;
  max-width: 580px;
  margin: 0 auto;
}

/* ====== FOOTER ====== */
.site-footer {
  padding: 40px;
  border-top: 1px solid var(--border);
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-brand {
  font-weight: 600;
  font-size: 0.9rem;
}

.footer-sep {
  color: var(--fg-muted);
  opacity: 0.3;
}

.footer-note {
  font-size: 0.82rem;
  color: var(--fg-muted);
}

/* ====== SCANNER INPUT SECTION ====== */
.scanner-section {
  padding: 80px 40px 120px;
  text-align: center;
  background: linear-gradient(180deg, transparent 0%, rgba(123, 92, 255, 0.03) 100%);
  border-top: 1px solid var(--border);
}

.scanner-inner {
  max-width: 560px;
  margin: 0 auto;
}

.scanner-heading {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 16px;
}

.scanner-sub {
  font-size: 1.05rem;
  color: var(--fg-muted);
  margin-bottom: 40px;
}

.scanner-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.scanner-input-wrap {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 460px;
  background: var(--bg-card);
  border: 1px solid rgba(123, 92, 255, 0.3);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.scanner-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.scanner-at {
  padding: 0 4px 0 18px;
  font-family: var(--mono);
  font-size: 1rem;
  color: var(--fg-muted);
  user-select: none;
}

.scanner-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 16px 12px;
  font-size: 1rem;
  font-family: var(--mono);
  color: var(--fg);
  min-width: 0;
}

.scanner-input::placeholder {
  color: rgba(136, 136, 160, 0.5);
}

.scanner-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 24px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font);
  font-size: 0.92rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  white-space: nowrap;
  height: 100%;
}

.scanner-btn:hover { background: #6b4ee0; }
.scanner-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.scanner-disclaimer {
  font-size: 0.78rem;
  color: var(--fg-muted);
  opacity: 0.7;
}

.scanner-error {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 16px;
  background: rgba(255, 107, 107, 0.08);
  border: 1px solid rgba(255, 107, 107, 0.2);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--warn);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ====== SCAN RESULT PAGE ====== */
.result-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 40px;
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-back {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-back:hover { color: var(--accent); }

.result-main {
  max-width: 860px;
  margin: 0 auto;
  padding: 60px 40px 80px;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 48px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.result-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 500;
  color: #fff;
  flex-shrink: 0;
}

.result-identity {
  flex: 1;
}

.result-name {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 4px;
}

.result-handle {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--fg-muted);
}

.result-badge {
  flex-shrink: 0;
}

.badge-label {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid rgba(123, 92, 255, 0.3);
  padding: 5px 12px;
  border-radius: 100px;
}

.result-section {
  margin-bottom: 40px;
}

.section-title {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg-muted);
  margin-bottom: 20px;
}

/* Trait bars */
.traits-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}

.trait-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  align-items: center;
  gap: 20px;
}

.trait-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.trait-name {
  font-size: 0.92rem;
  font-weight: 500;
}

.trait-desc {
  font-size: 0.72rem;
  color: var(--fg-muted);
  line-height: 1.4;
}

.trait-bar-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.trait-bar-track {
  flex: 1;
  height: 8px;
  background: var(--bg-elevated);
  border-radius: 4px;
  overflow: hidden;
}

.trait-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  width: 0%;
  transition: width 0s;
}

.trait-bar-fill.warn { background: var(--warn); }

.trait-score {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--fg-muted);
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}

.trait-score.score-high { color: var(--accent); }
.trait-score.score-low { color: var(--fg-muted); opacity: 0.6; }

/* Two-column layout */
.result-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 40px;
}

.result-col { margin-bottom: 0; }

/* Emotion card */
.emotion-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  height: calc(100% - 38px);
}

.emotion-top {
  margin-bottom: 18px;
}

.emotion-dominant {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(123, 92, 255, 0.1);
  border: 1px solid rgba(123, 92, 255, 0.2);
  padding: 5px 12px;
  border-radius: 6px;
  margin-bottom: 16px;
}

.stress-meter {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stress-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.stress-track {
  flex: 1;
  height: 5px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
}

.stress-fill {
  height: 100%;
  background: var(--warn);
  border-radius: 3px;
  width: 0%;
  transition: width 0s;
}

.stress-val {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--fg-muted);
  width: 24px;
  text-align: right;
}

.emotion-summary {
  font-size: 0.92rem;
  color: var(--fg-muted);
  line-height: 1.65;
}

/* Patterns */
.patterns-list {
  list-style: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: calc(100% - 38px);
}

.pattern-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.92rem;
  color: var(--fg-muted);
  line-height: 1.5;
}

.pattern-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 6px;
}

/* Synopsis */
.synopsis-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
}

.synopsis-section .section-title {
  margin-bottom: 16px;
}

.synopsis-text {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--fg);
  border-left: 3px solid var(--accent);
  padding-left: 20px;
  margin-bottom: 16px;
}

.speculative-note {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--fg-muted);
  opacity: 0.7;
}

/* CTA row */
.result-cta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 48px;
}

.cta-btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-family: var(--font);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 13px 28px;
  border-radius: 10px;
  text-decoration: none;
  transition: background 0.2s;
}

.cta-btn:hover { background: #6b4ee0; }

.cta-share {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg-muted);
  font-family: var(--font);
  font-size: 0.88rem;
  padding: 12px 20px;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.cta-share:hover {
  border-color: rgba(255,255,255,0.15);
  color: var(--fg);
}

/* Error page */
.error-main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 130px);
  padding: 40px;
}

.error-card {
  text-align: center;
  max-width: 420px;
}

.error-icon {
  font-size: 2.5rem;
  margin-bottom: 20px;
}

.error-title {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.error-body {
  font-size: 1rem;
  color: var(--fg-muted);
  line-height: 1.7;
  margin-bottom: 32px;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 768px) {
  .hero {
    flex-direction: column;
    text-align: center;
    padding: 100px 24px 60px;
    gap: 40px;
  }

  .lede {
    margin: 0 auto;
  }

  .profile-card {
    width: 100%;
    max-width: 340px;
  }

  .how {
    padding: 80px 24px;
  }

  .step {
    grid-template-columns: 40px 1fr;
    gap: 0 16px;
  }

  .step-num {
    font-size: 1.8rem;
  }

  .insights {
    padding: 60px 24px 80px;
  }

  .insights-grid {
    grid-template-columns: 1fr;
  }

  .closing {
    padding: 80px 24px;
  }

  .footer-inner {
    justify-content: center;
  }

  /* Scanner responsive */
  .scanner-section {
    padding: 60px 24px 80px;
  }

  /* Result page responsive */
  .result-nav {
    padding: 16px 20px;
  }

  .result-main {
    padding: 40px 20px 60px;
  }

  .result-header {
    flex-wrap: wrap;
    gap: 14px;
  }

  .trait-row {
    grid-template-columns: 140px 1fr;
    gap: 12px;
  }

  .result-cols {
    grid-template-columns: 1fr;
  }

  .emotion-card,
  .patterns-list {
    height: auto;
  }

  .result-cta {
    flex-direction: column;
    align-items: flex-start;
  }
}