/* ============================================================
   TypeRoot — design system
   Warm, calm, readable. Mobile-first. System fonts only.
   Brand root-green + per-type accent colors (set as --type-accent)
   ============================================================ */

:root {
  --bg: #f7f5f1;
  --surface: #ffffff;
  --ink: #23201b;
  --ink-soft: #5c564c;
  --ink-faint: #8a8377;
  --line: #e6e1d8;
  --brand: #3d7a5a;
  --brand-dark: #2f5f45;
  --brand-soft: #e4efe7;
  --gold: #d9a441;
  --shadow-sm: 0 1px 2px rgba(35,32,27,.06), 0 4px 12px rgba(35,32,27,.05);
  --shadow-md: 0 2px 4px rgba(35,32,27,.06), 0 12px 28px rgba(35,32,27,.09);
  --radius: 18px;
  --radius-sm: 10px;
  --type-accent: var(--brand);
  --serif: Georgia, "Times New Roman", "Songti SC", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 760px; margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(247,245,241,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  height: 62px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -.02em; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand .logo-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.nav { display: flex; align-items: center; gap: 22px; font-size: 14.5px; }
.nav a { color: var(--ink-soft); font-weight: 500; }
.nav a:hover { color: var(--brand-dark); text-decoration: none; }
.nav .btn { margin-left: 4px; }

@media (max-width: 640px) {
  .nav a:not(.btn):not(.nav-quiz) { display: none; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; padding: 11px 22px; border-radius: 999px;
  font-weight: 700; font-size: 15px; line-height: 1.2; cursor: pointer;
  border: 1px solid transparent; transition: transform .06s ease, box-shadow .15s ease, background .15s ease;
  text-decoration: none !important;
}
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(61,122,90,.28); }
.btn-primary:hover { background: var(--brand-dark); transform: translateY(-1px); }
.btn-gold { background: var(--gold); color: #fff; box-shadow: 0 6px 16px rgba(217,164,65,.3); }
.btn-ghost { background: transparent; color: var(--brand-dark); border-color: var(--brand); }
.btn-ghost:hover { background: var(--brand-soft); }
.btn-lg { padding: 15px 32px; font-size: 16.5px; }

/* ---------- Hero ---------- */
.hero { padding: 72px 0 56px; text-align: center; }
.hero h1 {
  font-size: clamp(32px, 5.4vw, 54px); line-height: 1.12; margin: 0 0 18px;
  letter-spacing: -.025em; font-weight: 800;
}
.hero h1 .accent { color: var(--brand); }
.hero p.lead {
  font-size: clamp(17px, 2.2vw, 20px); color: var(--ink-soft);
  max-width: 620px; margin: 0 auto 30px;
}
.hero .btn-lg { margin: 0 6px 10px; }
.hero .note { font-size: 13.5px; color: var(--ink-faint); margin-top: 14px; }

/* ---------- Sections ---------- */
.section { padding: 48px 0; }
.section-alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section h2 { font-size: clamp(24px, 3.4vw, 34px); letter-spacing: -.02em; margin: 0 0 8px; }
.section .sub { color: var(--ink-soft); margin: 0 0 32px; font-size: 16.5px; }

/* ---------- Type grid ---------- */
.type-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.type-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 16px; text-align: center; transition: transform .12s ease, box-shadow .15s ease;
  display: block; color: var(--ink); text-decoration: none !important;
  border-top: 4px solid var(--type-accent, var(--brand));
}
.type-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.type-card .sym { font-size: 26px; line-height: 1; }
.type-card .code { font-weight: 800; font-size: 19px; margin: 8px 0 2px; letter-spacing: .04em; }
.type-card .nick { font-size: 13px; color: var(--ink-soft); }

/* ---------- Steps / features ---------- */
.steps { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-top: 8px; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.step .num {
  width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; margin-bottom: 12px;
}
.step h3 { margin: 0 0 6px; font-size: 17px; }
.step p { margin: 0; color: var(--ink-soft); font-size: 14.5px; }

/* ---------- Pricing ---------- */
.price-grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 8px; align-items: stretch; }
.price-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px 26px; display: flex; flex-direction: column; position: relative;
}
.price-card.featured { border: 2px solid var(--brand); box-shadow: var(--shadow-md); }
.price-card .flag {
  position: absolute; top: -13px; left: 50%; transform: translateX(-50%);
  background: var(--brand); color: #fff; font-size: 12px; font-weight: 700;
  padding: 4px 14px; border-radius: 999px; white-space: nowrap;
}
.price-card h3 { margin: 0 0 2px; font-size: 19px; }
.price-card .price { font-size: 34px; font-weight: 800; margin: 10px 0 4px; letter-spacing: -.02em; }
.price-card .price small { font-size: 14px; font-weight: 500; color: var(--ink-faint); }
.price-card ul { list-style: none; padding: 0; margin: 16px 0 22px; flex: 1; }
.price-card li { padding: 7px 0 7px 26px; position: relative; font-size: 14.5px; color: var(--ink-soft); }
.price-card li::before { content: "✓"; position: absolute; left: 2px; color: var(--brand); font-weight: 800; }
.price-card .btn { text-align: center; }

/* ---------- Quiz page ---------- */
.quiz-shell { max-width: 640px; margin: 0 auto; padding: 40px 20px 80px; }
.quiz-head { text-align: center; margin-bottom: 26px; }
.quiz-head .q-count { color: var(--ink-faint); font-size: 13.5px; }
.progress-track { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 14px 0 26px; }
.progress-fill { height: 100%; background: var(--brand); border-radius: 99px; transition: width .25s ease; }
.q-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px 26px; box-shadow: var(--shadow-sm);
}
.q-card .q-text { font-size: 21px; line-height: 1.5; font-weight: 600; margin: 0 0 26px; }
.likert { display: grid; gap: 10px; }
.likert label {
  display: flex; align-items: center; gap: 14px; border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); padding: 13px 16px; cursor: pointer; font-size: 15px;
  transition: border-color .12s ease, background .12s ease;
}
.likert label:hover { border-color: var(--brand); background: var(--brand-soft); }
.likert input { accent-color: var(--brand); width: 18px; height: 18px; flex: none; }
.likert .lbl-small { margin-left: auto; color: var(--ink-faint); font-size: 12.5px; white-space: nowrap; }
.q-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; }
.q-nav .btn { flex: 1; }
.lang-toggle { position: fixed; right: 18px; bottom: 18px; z-index: 60; }
.lang-toggle button {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 9px 16px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  box-shadow: var(--shadow-sm);
}
[data-lang="zh"] .en-only { display: none; }
[data-lang="en"] .zh-only { display: none; }

/* ---------- Results ---------- */
.result-shell { max-width: 760px; margin: 0 auto; padding: 48px 20px 90px; }
.result-hero { text-align: center; padding: 34px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.result-hero .sym { font-size: 44px; }
.result-hero .code { font-size: clamp(40px, 8vw, 60px); font-weight: 800; letter-spacing: .06em; margin: 6px 0 2px; }
.result-hero .nick { font-size: 20px; color: var(--ink-soft); }
.bars { margin: 26px auto 0; max-width: 520px; display: grid; gap: 14px; }
.bar-row { text-align: left; }
.bar-row .bar-labels { display: flex; justify-content: space-between; font-size: 13.5px; font-weight: 700; color: var(--ink-soft); margin-bottom: 5px; }
.bar-track { height: 10px; background: var(--line); border-radius: 99px; position: relative; }
.bar-fill { position: absolute; top: 0; bottom: 0; border-radius: 99px; background: var(--type-accent, var(--brand)); left: 0; }
/* left-anchored bars for E vs I etc.: we render two halves */
.result-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 30px; }
.result-copy { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; margin-top: 22px; box-shadow: var(--shadow-sm); }
.result-copy h2 { margin-top: 8px; }
.result-copy .summary { font-size: 16px; color: var(--ink); }

/* ---------- Type detail pages ---------- */
.type-hero { padding: 44px 0 10px; text-align: center; }
.type-hero .sym { font-size: 40px; color: var(--type-accent); }
.type-hero .code { font-size: clamp(38px, 7vw, 52px); font-weight: 800; letter-spacing: .05em; margin: 8px 0 4px; }
.type-hero .nick { font-size: 19px; color: var(--ink-soft); }
.type-body h2 { font-size: 22px; margin: 34px 0 10px; letter-spacing: -.01em; }
.two-col { display: grid; gap: 20px; grid-template-columns: 1fr 1fr; }
@media (max-width: 680px) { .two-col { grid-template-columns: 1fr; } }
.two-col .box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.two-col h3 { margin: 0 0 10px; font-size: 16px; }
.two-col ul { margin: 0; padding-left: 20px; }
.two-col li { margin: 6px 0; font-size: 14.5px; color: var(--ink-soft); }
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.tag { background: var(--brand-soft); color: var(--brand-dark); border-radius: 999px; padding: 5px 14px; font-size: 13px; font-weight: 600; }
.type-cta { text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 36px 24px; margin: 40px 0 0; }
.type-cta h2 { margin-top: 0; }

/* ---------- Blog ---------- */
.blog-list { display: grid; gap: 16px; }
.blog-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; display: block; color: var(--ink); text-decoration: none !important; transition: transform .12s ease, box-shadow .15s ease; }
.blog-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.blog-card h2 { margin: 0 0 6px; font-size: 19px; }
.blog-card p { margin: 0; color: var(--ink-soft); font-size: 14.5px; }
.article { max-width: 720px; margin: 0 auto; padding: 44px 20px 90px; }
.article h1 { font-size: clamp(26px, 4vw, 36px); line-height: 1.25; letter-spacing: -.02em; margin: 0 0 6px; }
.article .meta { color: var(--ink-faint); font-size: 13.5px; margin-bottom: 26px; }
.article h2 { margin: 40px 0 12px; font-size: 23px; }
.article h3 { margin: 28px 0 10px; font-size: 18.5px; }
.article p, .article li { font-size: 16.5px; color: #2e2a24; }
.article li { margin: 7px 0; }
.article table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 14.5px; }
.article th, .article td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; }
.article th { background: var(--surface); }
.article blockquote { border-left: 4px solid var(--brand); margin: 20px 0; padding: 6px 18px; background: var(--brand-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--ink-soft); }
.article code { background: var(--line); padding: 2px 6px; border-radius: 5px; font-size: 0.9em; }
.article .cta-box { background: var(--brand-soft); border-radius: var(--radius); padding: 22px; margin: 34px 0 10px; text-align: center; }
.article .cta-box p { margin: 0 0 12px; }

/* ---------- Legal / misc ---------- */
.legal { max-width: 760px; margin: 0 auto; padding: 48px 20px 90px; }
.legal h1 { font-size: 30px; }
.legal p, .legal li { color: var(--ink-soft); font-size: 15.5px; }
.legal h2 { font-size: 19px; margin: 28px 0 8px; }
.cta-banner { text-align: center; padding: 54px 20px; }
.cta-banner h2 { font-size: clamp(24px, 3.6vw, 34px); margin: 0 0 10px; }
.cta-banner p { color: var(--ink-soft); margin: 0 0 24px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 34px 0 40px; margin-top: 40px; background: var(--surface); }
.site-footer .cols { display: flex; flex-wrap: wrap; gap: 28px; justify-content: space-between; font-size: 13.5px; color: var(--ink-faint); }
.site-footer a { color: var(--ink-soft); }
.site-footer .fine { margin-top: 22px; font-size: 12px; color: var(--ink-faint); max-width: 720px; line-height: 1.6; }

/* ---------- Utilities ---------- */
.tac { text-align: center; }
.mt0 { margin-top: 0; }
.divider { border: none; border-top: 1px solid var(--line); margin: 40px 0; }