@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --bg-primary: #faf9f7;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f5f4f0;
  --bg-input: #f0efe9;
  --text-primary: #1a1a1a;
  --text-secondary: #6b6b6b;
  --text-tertiary: #9a9a9a;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.08);
  --accent-glow: rgba(79, 70, 229, 0.12);
  --border: #e8e6e1;
  --border-strong: #d4d2cc;
  --gradient-start: #4f46e5;
  --gradient-end: #7c3aed;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.06), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-hover: 0 16px 48px rgba(79,70,229,0.10), 0 4px 12px rgba(0,0,0,0.04);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --grain-opacity: 0.025;
}

/* Forced dark — warm reading room */
html.theme-dark {
  --bg-primary: #111113;
  --bg-secondary: #1a1a1f;
  --bg-card: #1e1e24;
  --bg-card-hover: #252530;
  --bg-input: #252530;
  --text-primary: #ececf0;
  --text-secondary: #9898a4;
  --text-tertiary: #686878;
  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-soft: rgba(129, 140, 248, 0.10);
  --accent-glow: rgba(129, 140, 248, 0.08);
  --border: #2a2a34;
  --border-strong: #363644;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.4);
  --shadow-hover: 0 16px 48px rgba(129,140,248,0.12), 0 4px 12px rgba(0,0,0,0.2);
  --grain-opacity: 0.015;
}

/* Auto: respect system preference */
@media (prefers-color-scheme: light) {
  html:not(.theme-dark):not(.theme-light) {
    --bg-primary: #faf9f7;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f5f4f0;
    --bg-input: #f0efe9;
    --text-primary: #1a1a1a;
    --text-secondary: #6b6b6b;
    --text-tertiary: #9a9a9a;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-soft: rgba(79, 70, 229, 0.08);
    --accent-glow: rgba(79, 70, 229, 0.12);
    --border: #e8e6e1;
    --border-strong: #d4d2cc;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.06), 0 1px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
    --shadow-hover: 0 16px 48px rgba(79,70,229,0.10), 0 4px 12px rgba(0,0,0,0.04);
    --grain-opacity: 0.025;
  }
}

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

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  overflow-x: hidden;
}

/* Subtle grain texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: var(--grain-opacity);
  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.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
  z-index: 9999;
}

h1, h2, h3, h4 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ── Header ── */
.header {
  padding: 14px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-logo {
  font-family: 'Outfit', sans-serif;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.header-logo a {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
}

.header-nav { display: flex; align-items: center; gap: 6px; }

/* ── Theme Toggle ── */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* ── Language Buttons ── */
.lang-btn {
  padding: 6px 14px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  letter-spacing: 0.01em;
}

.lang-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.lang-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ── Main Layout ── */
.main {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 48px 24px 0;
}

/* ── Hero ── */
.hero { text-align: center; padding: 56px 0 64px; }

.hero h1 {
  font-size: 48px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.035em;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.6;
  font-weight: 400;
}

/* Decorative accent line under hero */
.hero::after {
  content: '';
  display: block;
  width: 48px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end));
  margin: 28px auto 0;
}

/* ── Test Grid ── */
.test-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  padding-bottom: 56px;
}

.test-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 32px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

.test-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.test-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.test-card:hover::before { opacity: 1; }

.test-card.coming-soon {
  opacity: 0.55;
  cursor: default;
  background: var(--bg-card);
}

.test-card.coming-soon:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
  border-color: var(--border);
  background: var(--bg-card);
}

.test-card.coming-soon::before { display: none; }

.test-card-badge.coming {
  color: var(--text-tertiary);
  background: var(--bg-input);
}

.test-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 6px;
  width: fit-content;
}

.test-card h3 {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.test-card .desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.test-card .meta {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: auto;
  padding-top: 10px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* ── Test Page ── */
.test-container {
  max-width: 680px;
  margin: 0 auto;
  padding: 32px 0 120px;
}

.test-header { text-align: center; margin-bottom: 40px; }
.test-header h2 {
  font-size: 30px;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.025em;
}
.test-header-desc {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.test-header .progress-bar-bg {
  width: 100%;
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 20px;
}

.test-header .progress-bar {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end));
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.test-header .progress-text {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 36px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
  animation: cardIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.question-card .q-text {
  font-family: 'Outfit', sans-serif;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.55;
  margin-bottom: 28px;
  letter-spacing: -0.01em;
}

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

.option-btn {
  padding: 16px 20px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  text-align: left;
  transition: all 0.2s ease;
  line-height: 1.5;
  font-weight: 400;
}

.option-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateX(4px);
}

.option-btn.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 0 0 1px var(--accent);
}

.test-nav { display: flex; justify-content: space-between; margin-top: 20px; }

.test-nav button {
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
  letter-spacing: 0.01em;
}

.test-nav button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.test-nav button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.test-nav button.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.test-nav button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none !important;
}

/* ── Result Page ── */
.result-container {
  max-width: 640px;
  margin: 0 auto;
  padding: 40px 0 120px;
  text-align: center;
}

.result-type {
  font-family: 'Outfit', sans-serif;
  font-size: 80px;
  font-weight: 900;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
  line-height: 1;
}

.result-label {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 28px;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  font-weight: 600;
}

.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 32px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
  text-align: left;
}

.result-card h4 {
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 20px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.result-card .trait-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin: 12px 0;
}

.result-card .trait-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.result-card .trait-bar.left {
  background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end));
}

.result-card .trait-bar.right {
  background: linear-gradient(90deg, var(--gradient-end), var(--gradient-start));
}

.result-card .trait-labels {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.result-desc {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.75;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 32px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
  text-align: left;
}

.result-actions { margin-top: 24px; margin-bottom: 32px; }

.result-actions a {
  display: inline-block;
  padding: 13px 36px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s ease;
  letter-spacing: 0.01em;
}

.result-actions a:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-glow);
}

/* ── Ad Container ── */
.ad-container {
  max-width: 728px;
  margin: 0 auto;
  padding: 20px 0;
  text-align: center;
}

/* ── Footer ── */
.footer {
  text-align: center;
  padding: 36px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.footer-tagline {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}

.footer-copy {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 400;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .header { padding: 12px 16px; }
  .main { padding: 32px 16px 0; }
  .hero { padding: 36px 0 48px; }
  .hero h1 { font-size: 32px; }
  .hero p { font-size: 16px; }
  .test-grid { grid-template-columns: 1fr; }
  .question-card { padding: 24px; }
  .result-type { font-size: 52px; }
  .test-header h2 { font-size: 24px; }
  .option-btn { padding: 14px 16px; font-size: 14px; }
  .test-nav button { padding: 10px 20px; font-size: 13px; }
}
