:root {
  --red: #c0392b;
  --red-deep: #8e2a20;
  --gold: #c9a24b;
  --gold-soft: #e8d29a;
  --jade: #2e7d6b;
  --ink: #2b2622;
  --ink-soft: #5b524a;
  --paper: #f7f1e6;
  --paper-2: #efe6d4;
  --white: #fffdf8;
  --line: #e4d8c2;
  --shadow: 0 10px 30px rgba(80, 50, 20, 0.12);
  --radius: 16px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.7;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container { width: min(1180px, 92%); margin: 0 auto; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(247, 241, 230, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav-wrap { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.logo-mark {
  width: 38px; height: 38px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--red), var(--red-deep));
  color: var(--gold-soft); border-radius: 10px; font-size: 20px;
  box-shadow: 0 4px 12px rgba(142, 42, 32, 0.4);
}
.logo-text { font-size: 22px; letter-spacing: 2px; color: var(--ink); }
.main-nav { display: flex; gap: 22px; }
.main-nav a { font-size: 15px; color: var(--ink-soft); position: relative; padding: 4px 0; transition: color .2s; }
.main-nav a:hover { color: var(--red); }
.main-nav a::after {
  content: ""; position: absolute; left: 0; bottom: -2px; width: 0; height: 2px;
  background: var(--red); transition: width .25s;
}
.main-nav a:hover::after { width: 100%; }
.nav-toggle { display: none; background: none; border: 0; font-size: 26px; color: var(--ink); cursor: pointer; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; color: #fff; padding: 90px 0 70px; }
.hero-bg {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(900px 400px at 80% -10%, rgba(201,162,75,.45), transparent 60%),
    radial-gradient(700px 500px at 10% 120%, rgba(46,125,107,.4), transparent 60%),
    linear-gradient(135deg, #7a1f17 0%, #9c2c20 40%, #b8442f 100%);
}
.hero-bg::before {
  content: "名"; position: absolute; right: -3%; top: -20%; font-size: 40vw;
  color: rgba(255,255,255,.06); font-weight: 800; line-height: 1;
}
.hero-bg::after {
  content: ""; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.04) 0 2px, transparent 2px 22px);
}
.hero-inner { position: relative; z-index: 1; text-align: center; }
.hero-tag {
  display: inline-block; padding: 6px 16px; border: 1px solid rgba(232,210,154,.6);
  border-radius: 999px; color: var(--gold-soft); font-size: 14px; letter-spacing: 3px; margin-bottom: 18px;
}
.hero-title { font-size: clamp(28px, 5vw, 52px); line-height: 1.25; font-weight: 800; letter-spacing: 1px; }
.hero-sub { margin: 18px auto 28px; max-width: 620px; color: rgba(255,255,255,.88); font-size: 17px; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-stats {
  margin-top: 46px; display: flex; gap: 40px; justify-content: center; flex-wrap: wrap;
}
.stat { text-align: center; }
.stat b { display: block; font-size: 28px; color: var(--gold-soft); }
.stat span { font-size: 13px; color: rgba(255,255,255,.75); }

.btn {
  display: inline-block; padding: 12px 26px; border-radius: 999px; font-size: 15px;
  font-weight: 600; cursor: pointer; border: 0; transition: transform .15s, box-shadow .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: linear-gradient(135deg, var(--gold), #b8893a); color: #fff; box-shadow: 0 8px 20px rgba(184,137,58,.4); }
.btn-ghost { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.5); }
.btn-block { width: 100%; }

/* ---------- Sections ---------- */
.section { padding: 64px 0; }
.section-alt { background: var(--paper-2); }
.section-head { text-align: center; margin-bottom: 38px; }
.section-title {
  font-size: 30px; letter-spacing: 2px; position: relative; display: inline-block; padding-bottom: 12px;
}
.section-title::after {
  content: ""; position: absolute; left: 50%; transform: translateX(-50%); bottom: 0;
  width: 56px; height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--red), var(--gold));
}
.section-desc { margin-top: 14px; color: var(--ink-soft); font-size: 16px; }

/* ---------- Cards ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 22px; }
.svc-card {
  background: var(--white); border-radius: var(--radius); padding: 26px 22px;
  border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s;
  position: relative; overflow: hidden;
}
.svc-card:hover { transform: translateY(-6px); box-shadow: 0 16px 38px rgba(80,50,20,.18); }
.svc-icon { font-size: 34px; margin-bottom: 12px; }
.svc-card h3 { font-size: 19px; margin-bottom: 8px; }
.svc-card p { color: var(--ink-soft); font-size: 14px; }
.svc-price { margin-top: 14px; color: var(--red); font-weight: 700; font-size: 16px; }
.svc-price small { color: var(--ink-soft); font-weight: 400; font-size: 12px; }

/* ---------- Dual layout ---------- */
.dual { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; align-items: start; }
.form-card {
  background: var(--white); border-radius: var(--radius); padding: 28px;
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.field { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field label { display: block; font-size: 14px; color: var(--ink-soft); margin-bottom: 6px; font-weight: 600; }
.field input, .field select {
  width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; background: var(--paper); color: var(--ink); outline: none; transition: border .2s;
}
.field input:focus, .field select:focus { border-color: var(--gold); }
.chip-group { display: flex; gap: 10px; flex-wrap: wrap; }
.chip {
  padding: 7px 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--paper); cursor: pointer; font-size: 14px; user-select: none; transition: all .2s;
}
.chip.active { background: var(--jade); color: #fff; border-color: var(--jade); }

.result-card {
  background: var(--white); border-radius: var(--radius); padding: 28px;
  border: 1px solid var(--line); box-shadow: var(--shadow); min-height: 280px;
}
.result-empty { text-align: center; color: var(--ink-soft); padding-top: 60px; }
.result-emoji { font-size: 46px; margin-bottom: 12px; }

/* score display */
.score-ring {
  width: 130px; height: 130px; border-radius: 50%; display: grid; place-items: center;
  margin: 0 auto 16px; font-weight: 800; font-size: 34px; color: #fff;
  background: conic-gradient(var(--gold) calc(var(--p) * 1%), #eee 0);
  position: relative;
}
.score-ring::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--white); }
.score-ring span { position: relative; color: var(--red); }
.score-title { text-align: center; font-size: 18px; margin-bottom: 14px; }
.score-bars { display: grid; gap: 10px; }
.score-bar { display: grid; grid-template-columns: 70px 1fr 40px; align-items: center; gap: 10px; font-size: 14px; }
.bar-track { height: 8px; background: var(--paper-2); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--jade), var(--gold)); border-radius: 6px; }
.score-note { margin-top: 16px; padding: 14px; background: var(--paper); border-radius: 10px; font-size: 14px; color: var(--ink-soft); }
.score-note b { color: var(--red); }

/* name results */
.name-result-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px;
  background: var(--paper); transition: border .2s;
}
.name-result-item:hover { border-color: var(--gold); }
.name-result-item .nm { font-size: 22px; font-weight: 700; color: var(--ink); }
.name-result-item .nm small { font-size: 13px; color: var(--ink-soft); font-weight: 400; margin-left: 8px; }
.name-result-item .sc { color: var(--red); font-weight: 700; }
.name-result-item .desc { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }

/* ---------- Name dict ---------- */
.filter-row { display: flex; gap: 10px; justify-content: center; margin-bottom: 24px; }
.filter-btn {
  padding: 8px 22px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--white); cursor: pointer; font-size: 14px; color: var(--ink-soft); transition: all .2s;
}
.filter-btn.active { background: var(--red); color: #fff; border-color: var(--red); }
.name-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.name-card {
  background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px;
  box-shadow: var(--shadow); transition: transform .2s;
}
.name-card:hover { transform: translateY(-4px); }
.name-card .n { font-size: 24px; font-weight: 700; color: var(--ink); }
.name-card .tag { font-size: 12px; color: var(--jade); border: 1px solid var(--jade); border-radius: 6px; padding: 1px 8px; margin-left: 8px; }
.name-card .src { font-size: 13px; color: var(--gold); margin: 8px 0 4px; }
.name-card .mean { font-size: 14px; color: var(--ink-soft); }

/* ---------- Search & char ---------- */
.search-bar { display: flex; gap: 10px; max-width: 520px; margin: 0 auto 26px; }
.search-bar input {
  flex: 1; padding: 12px 16px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 15px; background: var(--white); outline: none;
}
.search-bar input:focus { border-color: var(--gold); }
.char-result { max-width: 720px; margin: 0 auto; }
.char-card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow); display: grid; grid-template-columns: 120px 1fr; gap: 24px; align-items: center;
}
.char-big { font-size: 84px; text-align: center; color: var(--red); font-weight: 700; }
.char-info h3 { font-size: 22px; margin-bottom: 10px; }
.char-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.char-meta span { font-size: 13px; background: var(--paper-2); padding: 4px 12px; border-radius: 999px; }
.char-meta span b { color: var(--jade); }
.char-mean { color: var(--ink-soft); font-size: 15px; }
.muted { color: var(--ink-soft); text-align: center; }

/* ---------- Hot chars ---------- */
.hot-chars { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 16px; }
.hot-item {
  background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 18px 10px;
  text-align: center; cursor: pointer; transition: transform .2s, box-shadow .2s; box-shadow: var(--shadow);
}
.hot-item:hover { transform: translateY(-5px); box-shadow: 0 14px 30px rgba(80,50,20,.18); }
.hot-char { font-size: 40px; font-weight: 700; color: var(--red); }
.hot-pinyin { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }
.hot-wx { display: inline-block; margin-top: 8px; font-size: 12px; color: #fff; background: var(--jade); padding: 2px 10px; border-radius: 999px; }
.hot-rank { font-size: 12px; color: var(--gold); }

/* ---------- Articles ---------- */
.article-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 22px; }
.article {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); transition: transform .2s;
  border-left: 4px solid var(--red);
}
.article:hover { transform: translateY(-4px); }
.article .cat { font-size: 12px; color: var(--jade); font-weight: 700; letter-spacing: 1px; }
.article h3 { font-size: 19px; margin: 8px 0; }
.article p { font-size: 14px; color: var(--ink-soft); }
.article .date { font-size: 12px; color: var(--gold); margin-top: 12px; display: block; }

/* ---------- Surnames ---------- */
.surname-cloud { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.surname-item {
  width: 64px; height: 64px; display: grid; place-items: center; border-radius: 14px;
  background: var(--white); border: 1px solid var(--line); font-size: 22px; font-weight: 600;
  cursor: pointer; box-shadow: var(--shadow); transition: transform .2s, background .2s, color .2s;
}
.surname-item:hover { transform: translateY(-4px); background: var(--red); color: #fff; }
.surname-detail {
  margin-top: 22px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); text-align: center;
}
.surname-detail h3 { font-size: 24px; color: var(--red); margin-bottom: 8px; }
.surname-detail p { color: var(--ink-soft); font-size: 15px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: #e9e1d3; padding: 50px 0 0; }
.footer-inner { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.4fr; gap: 30px; }
.site-footer .logo-text { color: #fff; }
.footer-about { margin-top: 14px; font-size: 14px; color: #c9bfae; max-width: 320px; }
.footer-col h4 { font-size: 16px; margin-bottom: 14px; color: var(--gold-soft); }
.footer-col a { display: block; font-size: 14px; color: #c9bfae; margin-bottom: 8px; }
.footer-col a:hover { color: #fff; }
.footer-tip { font-size: 13px; color: #c9bfae; }
.footer-bottom { margin-top: 40px; padding: 18px 0; border-top: 1px solid rgba(255,255,255,.12); text-align: center; font-size: 13px; color: #9c9282; }

.back-top {
  position: fixed; right: 22px; bottom: 22px; width: 46px; height: 46px; border-radius: 50%;
  border: 0; background: var(--red); color: #fff; font-size: 22px; cursor: pointer; display: none;
  box-shadow: 0 8px 18px rgba(142,42,32,.5); z-index: 60;
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .main-nav { display: none; position: absolute; top: 68px; left: 0; right: 0; flex-direction: column;
    background: var(--paper); padding: 16px; border-bottom: 1px solid var(--line); gap: 4px; }
  .main-nav.open { display: flex; }
  .nav-toggle { display: block; }
  .dual { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .char-card { grid-template-columns: 1fr; text-align: center; }
}
@media (max-width: 520px) {
  .footer-inner { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
}
