:root {
  --bg: #fbf5e8;
  --card: #ffffff;
  --ink: #5b4636;
  --muted: #9c8f78;
  --border: #ecdfc4;
  --brand: #d98a3d;
  --brand-dark: #b36b26;
  --brand-soft: #fbefd9;
  --success: #4a9b6e;
  --success-soft: #e6f3ea;
  --warning: #c78a3a;
  --warning-soft: #fbf1de;
  --danger: #d9707a;
  --danger-soft: #fbe6e9;
  --radius: 18px;

  /* 星星人主题 */
  --star-moon: #f0dfa0;
  --star-mint: #a8d5b5;
  --star-pink: #e8a9b0;
  --star-lavender: #c9b8e0;
  --star-gold: #e8b84b;
  --star-outline: #5b4636;
  --mascot-svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 120'%3E%3Cellipse cx='50' cy='90' rx='32' ry='26' fill='%23F5EFE1' stroke='%235B4636' stroke-width='2'/%3E%3Cpath d='M50 10 L74 56 Q50 68 26 56 Z' fill='%23A8D5B5' stroke='%235B4636' stroke-width='2' stroke-linejoin='round'/%3E%3Ccircle cx='50' cy='12' r='5' fill='%23E8B84B'/%3E%3Ccircle cx='39' cy='64' r='4' fill='%235B4636'/%3E%3Ccircle cx='61' cy='64' r='4' fill='%235B4636'/%3E%3Ccircle cx='33' cy='74' r='5' fill='%23E8A9B0' opacity='0.7'/%3E%3Ccircle cx='67' cy='74' r='5' fill='%23E8A9B0' opacity='0.7'/%3E%3Cpath d='M42 78 Q50 84 58 78' stroke='%235B4636' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  --confetti-svg: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cg transform='translate(25,30) scale(1.6)'%3E%3Cpolygon points='6,0 1.4,1.4 0,6 -1.4,1.4 -6,0 -1.4,-1.4 0,-6 1.4,-1.4' fill='%23E8B84B' opacity='0.55'/%3E%3C/g%3E%3Cg transform='translate(150,20) scale(1.0)'%3E%3Cpolygon points='6,0 1.4,1.4 0,6 -1.4,1.4 -6,0 -1.4,-1.4 0,-6 1.4,-1.4' fill='%23C9B8E0' opacity='0.5'/%3E%3C/g%3E%3Cg transform='translate(180,90) scale(1.3)'%3E%3Cpolygon points='6,0 1.4,1.4 0,6 -1.4,1.4 -6,0 -1.4,-1.4 0,-6 1.4,-1.4' fill='%23A8D5B5' opacity='0.45'/%3E%3C/g%3E%3Cg transform='translate(60,110) scale(0.8)'%3E%3Cpolygon points='6,0 1.4,1.4 0,6 -1.4,1.4 -6,0 -1.4,-1.4 0,-6 1.4,-1.4' fill='%23E8A9B0' opacity='0.5'/%3E%3C/g%3E%3Cg transform='translate(110,160) scale(1.4)'%3E%3Cpolygon points='6,0 1.4,1.4 0,6 -1.4,1.4 -6,0 -1.4,-1.4 0,-6 1.4,-1.4' fill='%23E8B84B' opacity='0.4'/%3E%3C/g%3E%3Cg transform='translate(20,170) scale(1.0)'%3E%3Cpolygon points='6,0 1.4,1.4 0,6 -1.4,1.4 -6,0 -1.4,-1.4 0,-6 1.4,-1.4' fill='%23C9B8E0' opacity='0.45'/%3E%3C/g%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background-color: var(--bg);
  background-image: var(--confetti-svg);
  background-repeat: repeat;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
}

.mascot-icon {
  display: inline-block;
  width: 28px;
  height: 34px;
  vertical-align: middle;
  background: var(--mascot-svg) no-repeat center / contain;
}
.hero-mascot {
  display: block;
  width: 96px;
  height: 115px;
  margin: 0 auto 12px;
  background: var(--mascot-svg) no-repeat center / contain;
}

h1, h2, h3, .brand {
  font-family: "STKaiti", "KaiTi", "PingFang SC", serif;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* 顶部导航 */
#site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.brand { font-size: 22px; font-weight: 700; color: var(--brand-dark); white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.nav-links { display: flex; gap: 18px; flex: 1; flex-wrap: wrap; }
.nav-link { color: var(--ink); font-size: 15px; padding: 4px 2px; border-bottom: 2px solid transparent; }
.nav-link:hover { text-decoration: none; color: var(--brand); }
.nav-link.active { color: var(--brand-dark); border-bottom-color: var(--brand); font-weight: 600; }
.nav-user { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); white-space: nowrap; }

main { max-width: 1080px; margin: 0 auto; padding: 32px 20px 64px; }

/* 按钮 */
.btn-primary, .btn-ghost, .btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); text-decoration: none; }
.btn-primary:disabled { background: #ccbdb8; cursor: not-allowed; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--ink); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* 卡片 */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 3px 10px rgba(217, 138, 61, 0.08);
}
.card-grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 800px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* 首页 hero */
.hero { text-align: center; padding: 40px 0 20px; }
.hero h1 { font-size: 32px; margin-bottom: 12px; }
.hero p { color: var(--muted); font-size: 16px; max-width: 560px; margin: 0 auto 28px; }
.feature-card { text-align: left; display: flex; flex-direction: column; gap: 10px; }
.feature-card .icon { font-size: 28px; }
.feature-card h3 { margin: 0; font-size: 18px; }
.feature-card p { color: var(--muted); font-size: 14px; margin: 0; flex: 1; }

/* 表单 */
.form-field { margin-bottom: 16px; }
.form-field label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}
.form-field textarea { resize: vertical; min-height: 80px; }
.form-row { display: flex; gap: 12px; }
.form-row .form-field { flex: 1; }

/* 徽章 */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.badge-pending { background: var(--warning-soft); color: var(--warning); }
.badge-confirmed { background: #e3edf7; color: #2b5f92; }
.badge-completed { background: var(--success-soft); color: var(--success); }
.badge-cancelled { background: #eee; color: #999; }
.badge-ok { background: var(--success-soft); color: var(--success); }
.badge-issue { background: var(--danger-soft); color: var(--danger); }

/* 标签页 */
.tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--border); margin-bottom: 20px; flex-wrap: wrap; }
.tab-btn { background: none; border: none; padding: 10px 16px; font-size: 14px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; font-family: inherit; }
.tab-btn.active { color: var(--brand-dark); border-bottom-color: var(--brand); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* 表格 */
table.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data-table th, table.data-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
table.data-table th { color: var(--muted); font-weight: 600; font-size: 13px; }

/* 笔画选择器 */
.stroke-picker { display: flex; flex-wrap: wrap; gap: 10px; }
.stroke-chip {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
  background: #fff;
}
.stroke-chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* 诊断分类选择器 */
.category-picker { display: flex; flex-wrap: wrap; gap: 14px; }
.category-card {
  flex: 1;
  min-width: 160px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  background: #fff;
  transition: border-color 0.15s, transform 0.15s;
}
.category-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.category-card.active { border-color: var(--brand); background: var(--brand-soft); }
.category-card.disabled { cursor: not-allowed; opacity: 0.6; }
.category-card.disabled:hover { border-color: var(--border); transform: none; }
.category-card .cat-icon { font-size: 28px; display: block; margin-bottom: 6px; }
.category-card h4 { margin: 0 0 4px; font-size: 16px; }
.category-card p { margin: 0; font-size: 12px; color: var(--muted); }

/* AI 逐笔框选叠加层 */
.stroke-overlay-wrap { position: relative; display: inline-block; max-width: 100%; margin-bottom: 12px; }
.stroke-overlay-wrap img { display: block; max-width: 100%; max-height: 360px; border-radius: 8px; border: 1px solid var(--border); }
.stroke-box { position: absolute; border: 2px solid var(--success); border-radius: 4px; box-sizing: border-box; pointer-events: none; }
.stroke-box.issue { border-color: var(--danger); }
.stroke-box-num {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stroke-box.issue .stroke-box-num { background: var(--danger); }

/* 见证对比图 */
.testimonial-card { display: flex; flex-direction: column; gap: 12px; }
.testimonial-pair { display: flex; gap: 8px; }
.testimonial-pair figure { flex: 1; margin: 0; text-align: center; }
.testimonial-pair img { width: 100%; height: 180px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.testimonial-pair figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* 诊断上传预览 */
.upload-box {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
}
.upload-box img { max-width: 100%; max-height: 260px; border-radius: 8px; }
.issue-list { list-style: none; padding: 0; margin: 12px 0; }
.issue-list li { padding: 8px 0; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: flex-start; }

/* AI 聊天 */
.chat-window { display: flex; flex-direction: column; gap: 12px; min-height: 320px; max-height: 480px; overflow-y: auto; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.chat-bubble { max-width: 78%; padding: 10px 14px; border-radius: 12px; font-size: 14px; white-space: pre-wrap; }
.chat-bubble.user { align-self: flex-end; background: var(--brand); color: #fff; }
.chat-bubble.assistant { align-self: flex-start; background: #f1ece2; color: var(--ink); }
.chat-input-row { display: flex; gap: 10px; margin-top: 14px; }
.chat-input-row textarea { flex: 1; }

.empty-state { text-align: center; color: var(--muted); padding: 40px 0; }
.empty-state::before {
  content: '';
  display: block;
  width: 64px;
  height: 77px;
  margin: 0 auto 8px;
  background: var(--mascot-svg) no-repeat center / contain;
}
.muted { color: var(--muted); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.notice { padding: 12px 16px; border-radius: var(--radius); background: var(--warning-soft); color: var(--warning); font-size: 14px; margin-bottom: 16px; }
.notice-error { background: var(--danger-soft); color: var(--danger); }
