/* ============================================================
   农事通 · 设计系统 v2（原生 CSS，手机优先）
   ============================================================ */
:root {
  --g900: #122e16;
  --g800: #1b5e20;
  --g700: #2e7d32;
  --g600: #388e3c;
  --g200: #c8e6c9;
  --g100: #e8f5e9;
  --bg: #f2f6f1;
  --card: #ffffff;
  --text: #182a1c;
  --text2: #5c6e60;
  --line: #e2eae2;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --gray-bg: #eef1ee;
  --radius: 16px;
  --shadow: 0 2px 14px rgba(18, 46, 22, .08);
  --shadow-lg: 0 8px 28px rgba(18, 46, 22, .14);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { max-width: 100%; overflow-x: hidden; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.center { text-align: center; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; background: none; border: none; padding: 0; cursor: pointer; }
.brand-logo { width: 30px; height: 30px; }
.brand b { font-size: 19px; color: var(--g800); letter-spacing: 1px; }
.topbar-tag { font-size: 12px; color: var(--text2); background: var(--g100); padding: 4px 10px; border-radius: 20px; }

/* ---------- 主体 ---------- */
main { max-width: 560px; margin: 0 auto; padding: 14px 14px calc(86px + env(safe-area-inset-bottom)); }
.view { animation: fadeUp .28s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--g800), var(--g600) 60%, #4a9d4f);
  border-radius: 20px; padding: 26px 20px 24px; color: #fff;
  box-shadow: var(--shadow-lg);
}
.hero::after {
  content: ""; position: absolute; right: -50px; top: -50px;
  width: 190px; height: 190px; border-radius: 50%;
  background: rgba(255,255,255,.10);
}
.hero::before {
  content: ""; position: absolute; right: 30px; bottom: -70px;
  width: 150px; height: 150px; border-radius: 50%;
  background: rgba(255,255,255,.07);
}
.hero h1 { margin: 10px 0 8px; font-size: 27px; line-height: 1.3; letter-spacing: 1px; }
.hero-sub { margin: 0; font-size: 15px; opacity: .92; }
.hero-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.hero-badges span {
  font-size: 11px; padding: 3px 9px; border-radius: 20px;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.25);
}

/* ---------- 模式入口卡 ---------- */
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.mode-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  border: none; border-radius: var(--radius); padding: 16px 14px;
  color: #fff; text-align: left; cursor: pointer; min-height: 128px;
  font-family: inherit; box-shadow: var(--shadow);
  transition: transform .12s ease;
}
.mode-card:active { transform: scale(.97); }
.mc-novice { background: linear-gradient(150deg, var(--g700), var(--g600)); }
.mc-expert { background: linear-gradient(150deg, #14532d, #166534); }
.mode-ico {
  width: 40px; height: 40px; border-radius: 12px; margin-bottom: 6px;
  background: rgba(255,255,255,.18); display: flex; align-items: center; justify-content: center;
}
.mode-ico svg { width: 24px; height: 24px; fill: none; stroke: #fff; stroke-width: 1.8; }
.mode-card b { font-size: 18px; }
.mode-card span { font-size: 13px; opacity: .9; }
.mode-go { font-style: normal; font-size: 13px; margin-top: auto; opacity: .95; }

/* ---------- 通用卡片 ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  padding: 16px; margin-top: 14px; box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.card-head h3 { margin: 0; font-size: 18px; }
.card-sub { font-size: 13px; color: var(--text2); }

.sec-title { font-size: 19px; margin: 22px 4px 10px; }
.sec-sub { font-size: 14px; color: var(--text2); margin: 2px 4px 10px; }

/* 今日速览条目 */
.q-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 9px 2px; border-bottom: 1px dashed var(--line);
}
.q-item:last-of-type { border-bottom: none; }
.q-type {
  flex-shrink: 0; font-size: 12px; font-weight: bold; color: var(--g700);
  background: var(--g100); border-radius: 8px; padding: 3px 8px; margin-top: 1px;
}
.q-type.warn { color: var(--amber); background: var(--amber-bg); }
.q-type.mute { color: var(--text2); background: var(--gray-bg); }
.q-detail { font-size: 15px; }

.ghost-btn {
  display: block; width: 100%; margin-top: 10px;
  background: var(--g100); color: var(--g800); border: none;
  border-radius: 12px; padding: 12px; font-size: 15px; font-weight: bold;
  font-family: inherit; cursor: pointer;
}
.ghost-btn:active { background: var(--g200); }
.ghost-btn.wide { margin-top: 14px; }

/* ---------- 特性网格 ---------- */
.feat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.feat-card {
  background: var(--card); border-radius: var(--radius); padding: 14px;
  box-shadow: var(--shadow);
}
.feat-ico {
  width: 38px; height: 38px; border-radius: 11px; background: var(--g100);
  display: flex; align-items: center; justify-content: center; margin-bottom: 8px;
}
.feat-ico svg { width: 22px; height: 22px; fill: none; stroke: var(--g700); stroke-width: 1.8; }
.feat-card b { display: block; font-size: 15px; margin-bottom: 2px; }
.feat-card span { font-size: 13px; color: var(--text2); }

/* 信任说明 */
.trust-card {
  margin-top: 16px; background: var(--g100); border: 1px solid var(--g200);
  border-radius: var(--radius); padding: 14px 16px;
}
.trust-card b { color: var(--g800); font-size: 14px; }
.trust-card p { margin: 6px 0 0; font-size: 12.5px; color: var(--text2); line-height: 1.7; }

.site-footer { margin-top: 20px; text-align: center; font-size: 12px; color: #8a9a8d; }
.site-footer a { color: #8a9a8d; }

/* ---------- 新手步骤条 ---------- */
.steps { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 6px 0 14px; }
.step { font-size: 13px; color: var(--text2); background: var(--gray-bg); padding: 5px 11px; border-radius: 20px; white-space: nowrap; }
.step.on { color: #fff; background: var(--g700); font-weight: bold; }
.steps i { width: 14px; height: 2px; background: var(--line); border-radius: 2px; }

.question { font-size: 23px; font-weight: bold; margin: 10px 4px 14px; }

/* 选项大按钮 */
.opt-col { display: flex; flex-direction: column; gap: 10px; }
.opt-btn {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 62px; padding: 10px 14px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 14px;
  font-size: 18px; font-weight: bold; color: var(--text);
  font-family: inherit; cursor: pointer; box-shadow: var(--shadow);
  transition: transform .1s ease, border-color .1s ease;
}
.opt-btn:active { transform: scale(.98); border-color: var(--g600); background: var(--g100); }
.opt-ava {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(140deg, var(--g600), var(--g800));
  color: #fff; font-size: 17px; display: flex; align-items: center; justify-content: center;
}
.opt-btn .opt-arrow { margin-left: auto; color: var(--text2); font-weight: normal; font-size: 16px; }
.hint { font-size: 13px; color: var(--text2); text-align: center; margin-top: 16px; }

/* ---------- 指导卡 ---------- */
.guide-card {
  background: var(--card); border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow-lg); border-top: 4px solid var(--g600);
}
.guide-stage { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.guide-title { color: var(--g700); font-weight: bold; font-size: 17px; margin: 0; }
.guide-months { font-size: 12px; color: var(--amber); background: var(--amber-bg); padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.guide-action { font-size: 24px; font-weight: bold; line-height: 1.45; margin: 10px 0 8px; }
.guide-detail { font-size: 16px; color: var(--text2); line-height: 1.6; margin: 0 0 10px; }
.guide-source { font-size: 12.5px; color: #8a9a8d; margin: 0; border-top: 1px dashed var(--line); padding-top: 8px; }
.guide-source b { color: var(--text2); }

/* ---------- 时间线 ---------- */
.timeline { position: relative; margin: 6px 2px; }
.tl-item { position: relative; padding: 0 0 14px 34px; }
.tl-item::before {
  content: ""; position: absolute; left: 11px; top: 26px; bottom: -2px;
  width: 2px; background: var(--line);
}
.tl-item:last-child::before { display: none; }
.tl-dot {
  position: absolute; left: 2px; top: 4px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--card); border: 2.5px solid var(--line);
}
.tl-item.now .tl-dot { border-color: var(--g600); background: var(--g600); box-shadow: 0 0 0 4px var(--g100); }
.tl-item.done .tl-dot { border-color: var(--g600); }
.tl-months { font-size: 12px; color: var(--text2); }
.tl-item.now .tl-months { color: var(--g700); font-weight: bold; }
.tl-body {
  background: var(--card); border-radius: 13px; padding: 11px 13px;
  border: 1.5px solid var(--line); margin-top: 3px;
}
.tl-item.now .tl-body { border-color: var(--g600); background: var(--g100); }
.tl-item.clickable .tl-body { cursor: pointer; }
.tl-item.clickable .tl-body:active { border-color: var(--g600); }
.tl-stage { font-weight: bold; font-size: 15.5px; }
.tl-item.now .tl-stage { color: var(--g800); }
.tl-now-tag { font-size: 11px; color: #fff; background: var(--g600); border-radius: 6px; padding: 1px 7px; margin-left: 6px; }
.tl-action { font-size: 14px; color: var(--text2); margin-top: 2px; }

/* ---------- 老手页 ---------- */
.quick-head { display: flex; align-items: baseline; justify-content: space-between; margin: 4px 4px 10px; }
.quick-head h2 { margin: 0; font-size: 22px; }
.quick-date { font-size: 13px; color: var(--text2); }
.chip-row { display: flex; align-items: flex-start; gap: 8px; margin: 8px 0; }
.chip-label { flex-shrink: 0; font-size: 13px; color: var(--text2); padding-top: 9px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  width: auto; min-height: 36px; padding: 6px 15px; margin: 0;
  border: 1.5px solid var(--line); border-radius: 20px;
  background: var(--card); color: var(--text); font-size: 14.5px; font-weight: normal;
}
.chip.active { background: var(--g700); border-color: var(--g700); color: #fff; font-weight: bold; }

.advice-item {
  background: var(--card); border-radius: 14px; padding: 14px 15px;
  margin: 10px 0; box-shadow: var(--shadow);
  display: flex; gap: 11px; align-items: flex-start;
}
.advice-type {
  flex-shrink: 0; font-size: 13px; font-weight: bold; color: var(--g700);
  background: var(--g100); border-radius: 9px; padding: 4px 10px; margin-top: 1px;
}
.advice-type.warn { color: var(--amber); background: var(--amber-bg); }
.advice-type.mute { color: var(--text2); background: var(--gray-bg); }
.advice-detail { font-size: 17px; line-height: 1.55; padding-top: 2px; }

/* ---------- 按钮 ---------- */
.big {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; min-height: 56px; margin: 0;
  border: none; border-radius: 14px; background: var(--g700); color: #fff;
  font-size: 18px; font-weight: bold; font-family: inherit; cursor: pointer;
  box-shadow: var(--shadow); transition: transform .1s ease;
}
.big:active { transform: scale(.97); background: var(--g800); }
.big.alt { background: var(--card); color: var(--g800); border: 1.5px solid var(--g600); box-shadow: none; }
.big.alt:active { background: var(--g100); }
.big.half { flex: 1; }
.bt-ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.btn-row { display: flex; gap: 10px; margin-top: 14px; }

/* ---------- 聊天问答 ---------- */
.chat-log {
  display: flex; flex-direction: column; gap: 10px;
  min-height: calc(100dvh - 260px);
  padding: 4px 2px 10px;
}
.bubble {
  max-width: 86%; padding: 12px 14px; border-radius: 16px;
  font-size: 17px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
}
.bubble.user { align-self: flex-end; background: var(--g700); color: #fff; border-bottom-right-radius: 5px; }
.bubble.ai { align-self: flex-start; background: var(--card); box-shadow: var(--shadow); border-bottom-left-radius: 5px; }
.bubble-src { display: block; font-size: 12px; color: #8a9a8d; margin-top: 6px; }
.chat-bar {
  display: flex; gap: 8px; align-items: flex-end;
  position: sticky; bottom: calc(76px + env(safe-area-inset-bottom));
  background: var(--bg); padding: 8px 0;
}
.chat-bar textarea {
  flex: 1; max-height: 96px; font-size: 16px; padding: 12px 14px;
  border-radius: 14px; border: 1.5px solid var(--line); background: var(--card);
  resize: none; outline: none; font-family: inherit;
}
.chat-bar textarea:focus { border-color: var(--g600); }
.send-btn {
  flex-shrink: 0; width: 50px; height: 50px; border: none; border-radius: 14px;
  background: var(--g700); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.send-btn svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 2; }
.send-btn:active { background: var(--g800); }

/* ---------- 拍照问 ---------- */
.page-title { font-size: 23px; margin: 8px 4px 4px; }
.upload-card {
  background: var(--card); border: 2px dashed var(--g200); border-radius: 20px;
  padding: 30px 18px; text-align: center; margin-top: 12px;
}
.upload-ico {
  display: inline-flex; width: 64px; height: 64px; border-radius: 20px;
  background: var(--g100); align-items: center; justify-content: center; margin-bottom: 10px;
}
.upload-ico svg { width: 34px; height: 34px; fill: none; stroke: var(--g700); stroke-width: 1.7; }
.upload-card b { display: block; font-size: 19px; margin-bottom: 4px; }
.upload-card p { margin: 0; font-size: 14px; color: var(--text2); }
.preview-wrap { text-align: center; }
img.preview { max-width: 240px; max-height: 320px; border-radius: 14px; box-shadow: var(--shadow-lg); margin: 8px auto; }
.hidden-file { display: none; }
.privacy { font-size: 13px; color: var(--text2); margin-top: 14px; }

/* 扫描动画 */
.scan-card { text-align: center; padding: 18px 0 6px; }
.scan-frame {
  width: 130px; height: 130px; margin: 0 auto 14px; border-radius: 22px;
  border: 3px solid var(--g200); position: relative; overflow: hidden;
  background: var(--g100);
}
.scan-line {
  position: absolute; left: 8%; right: 8%; height: 3px; border-radius: 3px;
  background: var(--g600); box-shadow: 0 0 12px var(--g600);
  animation: scan 1.6s ease-in-out infinite;
}
@keyframes scan { 0%,100% { top: 10px; } 50% { top: 112px; } }
.scan-text { font-size: 17px; color: var(--g800); font-weight: bold; }

/* ---------- AI 回答卡 ---------- */
.answer {
  background: var(--card); border-radius: var(--radius); padding: 16px;
  margin-top: 14px; box-shadow: var(--shadow-lg); border-left: 4px solid var(--g600);
  animation: fadeUp .3s ease;
}
.answer-text { font-size: 20px; line-height: 1.65; margin: 0 0 8px; }
.answer-src { font-size: 12.5px; color: #8a9a8d; margin: 0; }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: grid; grid-template-columns: repeat(4, 1fr);
  max-width: 560px; margin: 0 auto;
  background: rgba(255,255,255,.95); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
}
.tab {
  background: none; border: none; padding: 5px 0 3px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--text2); font-family: inherit;
}
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.tab span { font-size: 11.5px; }
.tab.on { color: var(--g700); font-weight: bold; }
.tab.on svg { stroke-width: 2.1; }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed; left: 0; right: 0; top: 0; bottom: 0; z-index: 99;
  background: rgba(10, 25, 12, .55);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal-box { background: #fff; border-radius: 20px; padding: 24px 20px; width: 100%; max-width: 360px; box-shadow: var(--shadow-lg); }
.modal-title { font-size: 22px; font-weight: bold; text-align: center; margin: 0 0 8px; }
.modal-detail { font-size: 16px; color: var(--text2); text-align: center; margin: 0 0 14px; }

/* ---------- 桌面适配 ---------- */
@media (min-width: 600px) {
  body { background: linear-gradient(180deg, #e9f0e7, var(--bg)); }
  .topbar { max-width: 560px; margin: 0 auto; border-radius: 0 0 16px 16px; border: 1px solid var(--line); border-top: none; }
  .tabbar { border: 1px solid var(--line); border-bottom: none; border-radius: 18px 18px 0 0; }
}

/* ---------- 统一 AI 对话页增补 ---------- */
.chat-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 4px 4px; }
.chat-head b { font-size: 21px; }
.mini-btn {
  background: var(--gray-bg); color: var(--text2); border: none;
  border-radius: 16px; padding: 6px 13px; font-size: 13px;
  cursor: pointer; font-family: inherit;
}
.mini-btn:active { background: var(--g200); }
.chat-note { font-size: 12px; color: #8a9a8d; margin: 0 6px 8px; }
.cam-btn {
  flex-shrink: 0; width: 46px; height: 46px;
  border: 1.5px solid var(--line); border-radius: 13px; background: var(--card);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.cam-btn:active { background: var(--g100); border-color: var(--g600); }
.cam-btn svg { width: 22px; height: 22px; fill: none; stroke: var(--g700); stroke-width: 1.8; }
.chat-bar textarea { min-height: 46px; }
.bubble .chat-img {
  width: 180px; max-width: 100%; border-radius: 10px;
  display: block; margin-bottom: 4px;
}
.feat-card.clickable { cursor: pointer; transition: transform .12s ease; }
.feat-card.clickable:active { transform: scale(.97); }
.chat-log { min-height: calc(100dvh - 300px); }
