/* ========== 重置 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
*:focus { outline: none; }

:root {
  /* —— 暖色系基底(Claude 风格) —— */
  --bg: #f5f0e8;            /* 暖米黄,主背景 */
  --bg-soft: #faf5ee;       /* 更浅的米色,卡片下层 */
  --surface: #ffffff;       /* 卡片纯白 */
  --surface-warm: #fdf8f1;  /* 带暖色调的卡片(突出风险等用) */
  --border: #ece3d4;        /* 极浅米色描边 */
  --border-soft: #f0e8d9;

  /* —— 文字 —— */
  --text: #2b2520;          /* 深褐色,不是黑 */
  --text-2: #6b5d52;        /* 暖灰褐 */
  --text-3: #a39686;        /* 浅暖灰 */

  /* —— 主色:Claude 珊瑚橙 —— */
  --primary: #d97757;
  --primary-dark: #b85f3f;
  --primary-soft: #fbe9df;  /* 主色淡化背景 */
  --accent: #c2845a;        /* 暖棕黄,次要点缀 */

  /* —— 风险三色(暖化版,不刺眼) —— */
  --high: #c4453e;
  --high-soft: #fbe9e6;
  --high-border: #f3c8c2;
  --medium: #d68a2c;
  --medium-soft: #fcf0db;
  --medium-border: #f1d9a8;
  --low: #b8941f;
  --low-soft: #faf3d8;
  --low-border: #ecdca0;
  --success: #5a8a5e;       /* 暖橄榄绿 */
  --success-soft: #e6efe2;

  /* —— 阴影:很轻,带暖色调 —— */
  --shadow-sm: 0 1px 2px rgba(80, 60, 40, 0.04);
  --shadow-md: 0 4px 14px rgba(80, 60, 40, 0.06);
  --shadow-lg: 0 10px 30px rgba(217, 119, 87, 0.10);

  --radius: 18px;
  --radius-sm: 12px;

  /* —— 字体 —— */
  --font-serif: "Source Serif Pro", "Noto Serif SC", "Songti SC", Georgia, "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body { padding-bottom: 40px; position: relative; overflow-x: hidden; }

/* ========== 背景装饰:温暖的圆点光晕,不再是深蓝 ========== */
.bg-decoration {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 280px;
  z-index: -2;
  overflow: hidden;
  background: linear-gradient(180deg, #f3e9d8 0%, var(--bg) 100%);
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.4;
}
.blob-1 { width: 260px; height: 260px; background: #f0c5a8; top: -80px; right: -40px; }
.blob-2 { width: 200px; height: 200px; background: #e8b88d; top: 60px; left: -40px; opacity: 0.3; }

/* ========== 顶栏 ========== */
.app-header {
  padding: 22px 18px 12px;
  position: relative;
  z-index: 1;
}
.header-inner { max-width: 720px; margin: 0 auto; }
.logo { display: flex; align-items: center; gap: 12px; color: var(--text); }
.logo-icon {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: white;
  box-shadow: 0 4px 12px rgba(217, 119, 87, 0.25);
}
.logo-icon svg { width: 22px; height: 22px; }
.logo-text h1 {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--text);
}
.logo-text p {
  font-size: 12.5px;
  color: var(--text-2);
  margin-top: 2px;
  font-weight: 400;
}

/* ========== 主体 ========== */
main {
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 18px;
  position: relative;
  z-index: 1;
}
.view { animation: fadeUp 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
.hidden { display: none !important; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== Hero ========== */
.hero {
  text-align: center;
  padding: 18px 16px 24px;
  color: var(--text);
}
.hero-illustration {
  width: 150px;
  height: 120px;
  margin: 0 auto 18px;
  filter: drop-shadow(0 8px 20px rgba(217, 119, 87, 0.18));
}
.hero-illustration svg { width: 100%; height: 100%; }
/* 重新着色插画(覆盖原 SVG 内联色) */
.hero-illustration svg rect[fill="white"] { fill: #fffbf4; }
.hero-illustration svg stop[stop-color="#6366f1"] { stop-color: var(--primary); }
.hero-illustration svg stop[stop-color="#8b5cf6"] { stop-color: var(--accent); }
.hero-illustration svg rect[fill="#cbd5ff"] { fill: #e8d4be; }
.hero-illustration svg rect[fill="#e5e7ff"] { fill: #f0e3d0; }
.hero-illustration svg rect[stroke="#e5e7ff"] { stroke: #ece3d4; }

.hero-title {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
  letter-spacing: -0.3px;
}
.hero-desc {
  font-size: 14.5px;
  color: var(--text-2);
  max-width: 360px;
  margin: 0 auto;
}

/* ========== 上传卡片 ========== */
.upload-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.upload-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1.5px solid transparent;
}
.upload-btn:active { transform: scale(0.985); }
.upload-btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #c2845a 100%);
  color: white;
  box-shadow: 0 4px 14px rgba(217, 119, 87, 0.25);
}
.upload-btn-primary:hover { box-shadow: 0 6px 18px rgba(217, 119, 87, 0.32); }
.upload-btn-secondary {
  background: var(--surface-warm);
  color: var(--text);
  border-color: var(--border);
}
.upload-btn-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.upload-btn-primary .upload-btn-icon {
  background: rgba(255, 255, 255, 0.22);
}
.upload-btn-secondary .upload-btn-icon {
  background: white;
  color: var(--primary);
}
.upload-btn-icon svg { width: 22px; height: 22px; }
.upload-btn-text { display: flex; flex-direction: column; align-items: flex-start; flex: 1; }
.upload-btn-title { font-size: 15.5px; font-weight: 600; }
.upload-btn-sub { font-size: 12.5px; opacity: 0.78; margin-top: 2px; }

.file-name {
  margin-top: 4px;
  padding: 10px 14px;
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--primary-dark);
  word-break: break-all;
  text-align: center;
  font-weight: 500;
}
.file-name:empty { display: none; }

/* ========== 检查清单 ========== */
.checklist {
  margin-top: 22px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-soft);
}
.checklist-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  letter-spacing: 0.4px;
}
.checklist-title svg { color: var(--primary); }
.checklist-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 18px;
}
.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text);
}
.check-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
}
.format-hint {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  font-size: 12.5px;
  color: var(--text-3);
  text-align: center;
  line-height: 1.5;
}

/* ========== 加载中 ========== */
.loading-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 44px 24px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-soft);
}
.loading-animation { margin-bottom: 22px; }
.scan-doc {
  position: relative;
  width: 80px;
  height: 100px;
  margin: 0 auto;
  display: inline-block;
}
.scan-doc svg { width: 100%; height: 100%; }
.scan-doc svg rect[fill="white"] { fill: #fffbf4; }
.scan-doc svg rect[fill="#cbd5ff"] { fill: #e8d4be; }
.scan-doc svg rect[fill="#e5e7ff"] { fill: #f0e3d0; }
.scan-doc svg rect[stroke="#e5e7ff"] { stroke: #ece3d4; }
.scan-line {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 10px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  box-shadow: 0 0 12px var(--primary);
  animation: scan 1.8s ease-in-out infinite;
  border-radius: 2px;
}
@keyframes scan {
  0% { top: 10px; opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { top: 88px; opacity: 0; }
}
.loading-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.loading-desc { font-size: 13.5px; color: var(--text-2); margin-bottom: 24px; }
.progress-steps {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.step {
  font-size: 12px;
  padding: 6px 13px;
  background: var(--surface-warm);
  color: var(--text-3);
  border-radius: 20px;
  font-weight: 500;
  border: 1px solid var(--border-soft);
}
.step.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-color: transparent;
  animation: pulse 1.6s ease-in-out infinite;
}
.step.active:nth-child(2) { animation-delay: 0.5s; }
.step.active:nth-child(3) { animation-delay: 1s; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* ========== 错误 ========== */
.error-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 36px 24px;
  text-align: center;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-soft);
}
.error-icon {
  width: 58px; height: 58px;
  margin: 0 auto 16px;
  background: var(--high-soft);
  color: var(--high);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.error-icon svg { width: 28px; height: 28px; }
.error-card h3 {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}
.error-card p { color: var(--text-2); margin-bottom: 20px; font-size: 14px; }

/* ========== 结果 - 总览 ========== */
.result-summary {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-soft);
  margin-bottom: 20px;
}
.summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.contract-type-badge {
  background: var(--primary-soft);
  color: var(--primary-dark);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
}
.risk-score { text-align: right; }
.risk-score-num {
  font-family: var(--font-serif);
  font-size: 36px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.risk-score-num.score-high { color: var(--high); }
.risk-score-num.score-medium { color: var(--medium); }
.risk-score-num.score-safe { color: var(--success); }
.risk-score-label {
  display: block;
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 4px;
  letter-spacing: 0.3px;
}

.summary-text {
  font-size: 14.5px;
  color: var(--text);
  line-height: 1.7;
  padding: 14px 16px;
  background: var(--surface-warm);
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  border-left: 3px solid var(--primary);
}

.risk-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface-warm);
  margin-bottom: 12px;
}
.risk-bar-seg {
  transition: flex 0.4s ease;
}
.risk-bar-seg.high { background: var(--high); }
.risk-bar-seg.medium { background: var(--medium); }
.risk-bar-seg.low { background: var(--low); }

.risk-legend {
  display: flex;
  gap: 16px;
  font-size: 12.5px;
  color: var(--text-2);
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot {
  width: 8px; height: 8px; border-radius: 50%;
}
.legend-dot.high { background: var(--high); }
.legend-dot.medium { background: var(--medium); }
.legend-dot.low { background: var(--low); }

/* ========== 风险列表 ========== */
.section-title {
  display: flex;
  align-items: center;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0 4px 14px;
}

.risk-item {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-soft);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: fadeUp 0.35s ease both;
}
.risk-item:active { transform: scale(0.995); }
.risk-item::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
}
.risk-item.high::before { background: var(--high); }
.risk-item.medium::before { background: var(--medium); }
.risk-item.low::before { background: var(--low); }
.risk-item.high { background: linear-gradient(180deg, var(--high-soft) 0%, var(--surface) 60%); }
.risk-item.medium { background: linear-gradient(180deg, var(--medium-soft) 0%, var(--surface) 60%); }
.risk-item.low { background: linear-gradient(180deg, var(--low-soft) 0%, var(--surface) 60%); }

.risk-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.risk-badge {
  font-size: 11.5px;
  padding: 3px 11px;
  border-radius: 20px;
  font-weight: 700;
  letter-spacing: 0.3px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.risk-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.risk-badge.high { background: var(--high-soft); color: var(--high); }
.risk-badge.medium { background: var(--medium-soft); color: var(--medium); }
.risk-badge.low { background: var(--low-soft); color: var(--low); }

.risk-category {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
  flex: 1;
}

.risk-desc {
  font-size: 14.5px;
  color: var(--text);
  margin-bottom: 12px;
  line-height: 1.7;
}

.risk-quote {
  position: relative;
  background: var(--surface-warm);
  padding: 14px 14px 14px 38px;
  font-size: 13.5px;
  color: var(--text-2);
  margin-bottom: 12px;
  border-radius: var(--radius-sm);
  line-height: 1.6;
  border: 1px solid var(--border-soft);
}
.risk-quote::before {
  content: '"';
  position: absolute;
  left: 12px; top: 2px;
  font-size: 34px;
  color: var(--primary);
  font-family: Georgia, serif;
  opacity: 0.5;
  line-height: 1.2;
}

.risk-suggestion {
  background: var(--primary-soft);
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--primary-dark);
  line-height: 1.65;
  display: flex;
  gap: 10px;
}
.risk-suggestion::before {
  content: '💡';
  font-size: 16px;
  flex-shrink: 0;
}

/* ========== 按钮 ========== */
.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 22px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  font-family: inherit;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  box-shadow: 0 4px 14px rgba(217, 119, 87, 0.28);
}
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-primary:active, .btn-secondary:active { transform: scale(0.985); }
.full-width { width: 100%; margin-top: 10px; }

/* ========== 无风险状态 ========== */
.no-risks {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 38px 22px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-soft);
}
.no-risks-icon {
  width: 58px; height: 58px;
  margin: 0 auto 16px;
  background: var(--success-soft);
  color: var(--success);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}
.no-risks-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.no-risks-desc { font-size: 13.5px; color: var(--text-2); }

/* ========== 大屏适配 ========== */
@media (min-width: 600px) {
  .hero-title { font-size: 30px; }
  .checklist-grid { grid-template-columns: repeat(3, 1fr); }
}
