:root {
  --bg: #080c1a;
  --surface: #11182e;
  --surface-2: #17203d;
  --border: #28355e;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --pink: #ff3b8d;
  --cyan: #22d3ee;
  --gold: #fbbf24;
  --purple: #a855f7;
  --emerald: #10b981;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at top center, #161f42 0%, var(--bg) 60%);
  color: var(--text);
  font-family: 'Space Grotesk', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Noto Sans SC', sans-serif;
  line-height: 1.6;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--cyan);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-shell {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

.top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(17, 24, 46, 0.88);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  margin-bottom: 18px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
  font-weight: 800;
  font-size: 1.08rem;
  letter-spacing: -0.01em;
}

.brand-link:hover {
  text-decoration: none;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.top-nav a {
  padding: 6px 10px;
  border-radius: 8px;
  color: #cbd5e1;
  font-size: 0.9rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
}

.top-nav a:hover {
  background: rgba(34, 211, 238, 0.14);
  color: #ffffff;
  text-decoration: none;
}

.locale-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.locale-links a {
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid var(--border);
  color: var(--gold);
  background: rgba(251, 191, 36, 0.08);
}

.card {
  background: linear-gradient(160deg, rgba(23, 32, 61, 0.96) 0%, rgba(14, 20, 40, 0.98) 100%);
  border: 2px solid var(--border);
  border-radius: 22px;
  padding: 26px 24px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.42);
}

.kicker-pill {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #080c1a;
  background: linear-gradient(90deg, var(--gold), #fde047);
  margin-bottom: 12px;
}

.main-h1 {
  margin: 0 0 10px;
  font-size: 2.2rem;
  line-height: 1.15;
  color: #ffffff;
  overflow-wrap: anywhere;
}

.hero-sub {
  margin: 0 0 20px;
  color: #cbd5e1;
  font-size: 1.04rem;
  max-width: 68ch;
}

.challenge-banner {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 59, 141, 0.14);
  border: 1.5px solid var(--pink);
  color: #ffe4f0;
}

.challenge-banner p {
  margin: 4px 0 0;
  font-size: 0.94rem;
}

.hero-actions,
.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
}

.btn-neon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 22px;
  border-radius: 12px;
  border: 2px solid transparent;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.btn-neon:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--pink) 0%, var(--purple) 100%);
  color: #ffffff;
  box-shadow: 0 8px 22px rgba(255, 59, 141, 0.34);
}

.btn-cyan {
  background: linear-gradient(135deg, var(--cyan) 0%, #3b82f6 100%);
  color: #080c1a;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--cyan);
  color: var(--cyan);
}

.btn-small {
  min-height: 42px;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  font-weight: 700;
  cursor: pointer;
}

.btn-small:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.scale-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.scale-chip {
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.scale-chip.lvl-3 { border-color: var(--pink); color: #fda4af; }
.scale-chip.lvl-2 { border-color: var(--cyan); color: #67e8f9; }
.scale-chip.lvl-1 { border-color: var(--gold); color: #fde68a; }
.scale-chip.lvl-0 { border-color: #475569; color: #94a3b8; }

.quiz-top-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.progress-text {
  font-weight: 800;
  color: var(--gold);
  font-size: 0.92rem;
}

.era-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(34, 211, 238, 0.45);
  background: rgba(34, 211, 238, 0.12);
  color: var(--cyan);
  font-size: 0.8rem;
  font-weight: 700;
}

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  overflow: hidden;
  margin-bottom: 18px;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pink), var(--cyan));
  transition: width 0.2s ease;
}

.question-title {
  margin: 0 0 8px;
  font-size: 1.48rem;
  line-height: 1.3;
  color: #ffffff;
  overflow-wrap: anywhere;
}

.question-hint {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.95rem;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.answer-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 4px;
  padding: 14px 16px;
  min-height: 68px;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: rgba(17, 24, 46, 0.85);
  color: #ffffff;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.1s ease;
}

.answer-btn:hover {
  transform: translateY(-1px);
  background: rgba(30, 41, 77, 0.95);
}

.answer-btn.lvl-3:hover { border-color: var(--pink); }
.answer-btn.lvl-2:hover { border-color: var(--cyan); }
.answer-btn.lvl-1:hover { border-color: var(--gold); }
.answer-btn.lvl-0:hover { border-color: #64748b; }

.ans-head {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ans-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 800;
}

.ans-title {
  font-size: 1.04rem;
  font-weight: 800;
}

.ans-desc {
  font-size: 0.84rem;
  color: var(--muted);
}

.quiz-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
}

.hotkey-hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.result-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.age-hero {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  margin: 14px 0 20px;
  padding: 18px;
  border-radius: 16px;
  background: rgba(8, 12, 26, 0.65);
  border: 1.5px solid var(--border);
}

.age-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--cyan);
  text-transform: uppercase;
}

.age-number-wrap {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.age-number {
  font-size: 4.2rem;
  line-height: 1;
  font-weight: 900;
  color: var(--gold);
}

.age-unit {
  font-size: 1.25rem;
  font-weight: 700;
  color: #e2e8f0;
}

.archetype-name {
  margin: 0 0 6px;
  font-size: 1.45rem;
  color: #ffffff;
}

.archetype-desc {
  margin: 0 0 8px;
  color: #cbd5e1;
  font-size: 0.96rem;
}

.stats-line {
  margin: 0;
  color: var(--pink);
  font-weight: 700;
  font-size: 0.88rem;
}

.gap-box,
.era-chart {
  margin-top: 18px;
  padding: 16px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid var(--border);
}

.gap-box h3,
.era-chart h3 {
  margin: 0 0 6px;
  font-size: 1.06rem;
  color: #ffffff;
}

.gap-prompt {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: var(--muted);
}

.gap-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.gap-form input {
  width: 140px;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: #080c1a;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
}

.gap-verdict {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(251, 191, 36, 0.14);
  border: 1px solid var(--gold);
  color: #fef08a;
  font-weight: 700;
}

.era-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.era-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 46px;
  align-items: center;
  gap: 10px;
}

.era-yr {
  font-family: monospace;
  font-size: 0.86rem;
  font-weight: 700;
  color: #e2e8f0;
}

.era-bar-bg {
  height: 14px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  overflow: hidden;
}

.era-bar-fill {
  height: 100%;
  border-radius: 999px;
}

.era-pct {
  font-family: monospace;
  font-size: 0.86rem;
  font-weight: 800;
  text-align: right;
  color: #ffffff;
}

.canvas-preview-wrap {
  margin-top: 20px;
  display: flex;
  justify-content: center;
}

#share-card-canvas {
  width: 100%;
  max-width: 340px;
  height: auto;
  border-radius: 16px;
  border: 1.5px solid var(--border);
}

.ad-slot {
  margin: 18px 0;
  min-height: 0;
  overflow: hidden;
  text-align: center;
}

.ad-slot:empty,
.ad-slot[data-active="false"] {
  display: none;
  margin: 0;
  min-height: 0;
}

.seo-section {
  margin-top: 22px;
  padding: 24px;
  background: rgba(17, 24, 46, 0.78);
  border: 1.5px solid var(--border);
  border-radius: 20px;
}

.seo-section h1 {
  margin: 0 0 12px;
  font-size: 1.95rem;
  color: #ffffff;
}

.seo-section h2 {
  margin: 24px 0 10px;
  font-size: 1.32rem;
  color: var(--cyan);
}

.seo-section h3 {
  margin: 16px 0 6px;
  font-size: 1.06rem;
  color: var(--gold);
}

.seo-section p,
.seo-section li {
  color: #cbd5e1;
  font-size: 0.97rem;
}

.seo-section ul,
.seo-section ol {
  padding-left: 20px;
}

.data-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 14px 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: rgba(34, 211, 238, 0.12);
  color: #ffffff;
  font-weight: 800;
}

.faq-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.faq-item {
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(8, 12, 26, 0.6);
  border: 1px solid var(--border);
}

.faq-item h3 {
  margin: 0 0 6px;
}

.faq-item p {
  margin: 0;
}

.site-footer {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 16px;
  margin-bottom: 12px;
}

.footer-links a {
  color: #94a3b8;
  font-size: 0.86rem;
}

.footer-links a:hover {
  color: var(--cyan);
}

.footer-notice {
  margin: 0 auto;
  max-width: 72ch;
  color: #64748b;
  font-size: 0.82rem;
}

/* Mobile responsive rules strictly ordered AFTER base styles */
@media (max-width: 700px) {
  .site-shell {
    padding: 10px 12px 36px;
  }

  .card,
  .seo-section {
    padding: 18px 16px;
    border-radius: 16px;
  }

  .main-h1 {
    font-size: 1.68rem;
  }

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

  .age-hero {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .age-number {
    font-size: 3.4rem;
  }

  .era-row {
    grid-template-columns: 82px minmax(0, 1fr) 40px;
    gap: 8px;
  }
}
