:root {
  --surface: #fbfefa;
  --ink: #243a2b;
  --ink-soft: #3f5947;
  --muted: #7d9382;
  --line: #e7f1e4;
  --green-50: #f0f9ee;
  --green-100: #e2f4e0;
  --green-200: #c9eacb;
  --green-300: #a9ddb0;
  --green-400: #8bce9c;
  --green-500: #6cb87f;
  --green-600: #4f9e69;
  --green-700: #3f8257;
  --green-800: #2f6543;
  --amber-ink: #8a6a3a;
  --shadow-card: 0 18px 36px -28px rgba(46, 86, 56, 0.55);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  color: var(--ink);
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(900px 620px at 12% 8%, #f8fdf5 0%, rgba(248, 253, 245, 0) 62%),
    radial-gradient(760px 560px at 92% 92%, #e3f2de 0%, rgba(227, 242, 222, 0) 60%),
    linear-gradient(150deg, #eff7ec, #e9f4e5);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button {
  font-family: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--green-400);
  outline-offset: 2px;
}

.phone {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(430px, 100%);
  height: min(880px, calc(100vh - 44px));
  height: min(880px, calc(100dvh - 44px));
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 40px;
  box-shadow:
    0 40px 80px -40px rgba(38, 78, 50, 0.45),
    0 10px 30px -18px rgba(38, 78, 50, 0.2);
}

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background:
    radial-gradient(420px 260px at 92% -6%, #e9f7e4 0%, rgba(233, 247, 228, 0) 70%),
    radial-gradient(360px 320px at -8% 104%, #e6f4e2 0%, rgba(230, 244, 226, 0) 70%),
    linear-gradient(180deg, #f9fdf7 0%, #f3faf0 100%);
}

/* ---------- 顶栏 ---------- */

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(14px + env(safe-area-inset-top)) 16px 8px;
}

.back-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--green-700);
  cursor: pointer;
  transition: transform 0.16s ease, opacity 0.2s ease, visibility 0.2s ease;
}

.back-btn svg {
  width: 21px;
  height: 21px;
}

.back-btn:active {
  transform: scale(0.92);
  opacity: 0.7;
}

.back-btn.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--green-800);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  background: var(--green-100);
  border-radius: 8px;
}

.brand-mark svg {
  width: 16px;
  height: 16px;
}

.step-pill {
  margin-left: auto;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 650;
  color: var(--green-700);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.progress {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  padding: 0 22px 6px;
}

.seg {
  flex: 1;
  height: 3px;
  border-radius: 99px;
  background: #e8f2e5;
  transition: background 0.35s ease;
}

.seg.is-on {
  background: linear-gradient(90deg, var(--green-400), var(--green-600));
}

/* ---------- 内容容器 ---------- */

.screen-host {
  flex: 1;
  min-height: 0;
  padding: 6px 22px 14px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
}

.screen-host::-webkit-scrollbar {
  display: none;
}

.screen {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 100%;
  padding-bottom: 2px;
  animation: screenIn 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.screen-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 4px 0 2px;
}

.eyebrow {
  margin: 0;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.16em;
  color: var(--green-500);
}

.screen-title {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.lede {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.footnote {
  margin: 2px 0 0;
  font-size: 11.5px;
  text-align: center;
  color: #a3b5a5;
}

/* ---------- 第 1 步：选植物 ---------- */

.plant-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 4px 16px 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f6fcf3 100%);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 30px;
  box-shadow: var(--shadow-card), inset 0 0 0 1px rgba(231, 241, 228, 0.8);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  animation: rise 0.45s 0.06s both;
}

.plant-card:active {
  transform: scale(0.985);
}

.plant-art {
  display: block;
  padding: 0 2px;
}

.plant-art svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 330px;
}

.plant-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 2px;
}

.plant-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
}

.plant-name {
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
}

.plant-note {
  font-size: 12.5px;
  color: var(--muted);
}

.plant-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 9px 13px;
  font-size: 12.5px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  background: linear-gradient(135deg, #7cc78d, var(--green-600));
  border-radius: 999px;
  box-shadow: 0 8px 18px -10px rgba(63, 130, 87, 0.9);
}

.plant-cta svg {
  width: 14px;
  height: 14px;
}

@media (hover: hover) {
  .plant-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 24px 44px -30px rgba(46, 86, 56, 0.6);
  }
}

/* ---------- 第 2 步：选症状 ---------- */

.symptom-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 0;
  padding: 0;
  border: 0;
}

.symptom {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 10px 22px -20px rgba(46, 86, 56, 0.6);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
  animation: rise 0.4s both;
}

.symptom:nth-child(1) { animation-delay: 0.03s; }
.symptom:nth-child(2) { animation-delay: 0.06s; }
.symptom:nth-child(3) { animation-delay: 0.09s; }
.symptom:nth-child(4) { animation-delay: 0.12s; }
.symptom:nth-child(5) { animation-delay: 0.15s; }
.symptom:nth-child(6) { animation-delay: 0.18s; }
.symptom:nth-child(7) { animation-delay: 0.21s; }

.symptom:active {
  transform: scale(0.99);
}

.symptom.is-picked {
  background: linear-gradient(180deg, #fbfff9, #f0faf0);
  border-color: var(--green-300);
  box-shadow: 0 0 0 3px rgba(139, 206, 156, 0.2);
}

.s-icon {
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  background: linear-gradient(160deg, #f2faee, #e6f6e2);
  border-radius: 13px;
}

.s-icon svg {
  width: 30px;
  height: 30px;
}

.s-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.s-name {
  font-size: 15px;
  font-weight: 650;
  color: var(--ink);
}

.s-desc {
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.s-chev {
  flex: 0 0 auto;
  margin-left: auto;
  color: #b9cdba;
}

.s-chev svg {
  display: block;
  width: 16px;
  height: 16px;
}

@media (hover: hover) {
  .symptom:hover {
    border-color: var(--green-200);
    background: #fdfffc;
    transform: translateY(-1px);
  }
}

/* ---------- 第 3 步：四问 ---------- */

.qa-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.q-card {
  padding: 13px 14px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 10px 26px -24px rgba(46, 86, 56, 0.7);
  animation: rise 0.4s both;
}

.q-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.q-index {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  font-size: 11px;
  font-weight: 700;
  color: var(--green-700);
  background: var(--green-100);
  border-radius: 50%;
}

.q-title {
  font-size: 14px;
  font-weight: 650;
  color: var(--ink-soft);
}

.opts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.opt {
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  color: #415a48;
  background: #fbfdfa;
  border: 1px solid #e3efe2;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.opt:active {
  transform: scale(0.96);
}

.opt[aria-pressed="true"] {
  color: #fff;
  background: linear-gradient(135deg, #6cbb80, var(--green-600));
  border-color: var(--green-600);
  box-shadow: 0 8px 16px -10px rgba(63, 130, 87, 0.9);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 2px;
}

.chip {
  padding: 4px 10px;
  font-size: 11.5px;
  color: var(--green-700);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.chip.soft {
  background: var(--green-100);
  border-color: transparent;
}

/* ---------- 主按钮与底栏 ---------- */

.action-bar {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin-top: auto;
  padding: 14px 0 2px;
  background: linear-gradient(180deg, rgba(250, 253, 248, 0) 0%, #f5fbf2 42%, #f5fbf2 100%);
}

.hint-line {
  margin: 0 0 8px;
  font-size: 11.5px;
  text-align: center;
  color: #98ac9a;
}

.btn-primary {
  width: 100%;
  height: 52px;
  padding: 0;
  font-size: 16px;
  font-weight: 650;
  color: #fff;
  background: linear-gradient(135deg, #7ac68e, var(--green-600));
  border: 0;
  border-radius: 18px;
  box-shadow: 0 14px 26px -14px rgba(62, 124, 84, 0.7);
  cursor: pointer;
  transition: transform 0.16s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary:not(:disabled):active {
  transform: scale(0.985);
}

.btn-primary:disabled {
  color: #9caf9f;
  background: #dfeadf;
  box-shadow: none;
  cursor: not-allowed;
}

/* ---------- 第 4 步：结果 ---------- */

.result-hero {
  position: relative;
  overflow: hidden;
  padding: 18px;
  background: linear-gradient(155deg, #ffffff 10%, #f3fbef 100%);
  border: 1px solid #e8f3e4;
  border-radius: 24px;
  box-shadow: var(--shadow-card), inset 0 0 0 1px rgba(255, 255, 255, 0.85);
  animation: rise 0.45s 0.05s both;
}

.result-hero::after {
  content: "";
  position: absolute;
  right: -34px;
  bottom: -42px;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle at 35% 35%, rgba(139, 206, 156, 0.28), rgba(139, 206, 156, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
}

.result-hero.tone-alert {
  background: linear-gradient(155deg, #fffdfa 10%, #fdf2e8 100%);
  border-color: #f4e3ce;
}

.hero-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--green-700);
  background: var(--green-100);
  border-radius: 999px;
}

.hero-label svg {
  width: 12px;
  height: 12px;
}

.result-hero.tone-alert .hero-label {
  color: #b56a42;
  background: #fbeadd;
}

.hero-cause {
  position: relative;
  z-index: 1;
  margin: 12px 0 0;
  font-size: 21px;
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.hero-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 54px;
  height: 54px;
  opacity: 0.95;
}

.card {
  padding: 15px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 10px 26px -26px rgba(46, 86, 56, 0.6);
  animation: rise 0.5s 0.12s both;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--green-700);
}

.card-head svg {
  width: 14px;
  height: 14px;
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps li {
  display: flex;
  gap: 9px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.step-no {
  flex: 0 0 19px;
  display: grid;
  place-items: center;
  height: 19px;
  margin-top: 3px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--green-700);
  background: var(--green-50);
  border: 1px solid var(--green-200);
  border-radius: 50%;
}

.card.tip {
  background: linear-gradient(160deg, #fefaf1, #fcf3e3);
  border-color: #f3e5cd;
  animation-delay: 0.18s;
}

.card.tip .card-head {
  color: var(--amber-ink);
}

.card.tip p {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  color: #7c6a4d;
}

.rhythm {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 2px 4px;
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  animation: rise 0.5s 0.22s both;
}

.rhythm svg {
  flex: 0 0 15px;
  width: 15px;
  height: 15px;
  margin-top: 2px;
  color: var(--green-500);
}

.rhythm b {
  font-weight: 650;
  color: var(--green-700);
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 2px;
  animation: rise 0.5s 0.26s both;
}

.btn-ghost {
  height: 46px;
  font-size: 14px;
  font-weight: 600;
  color: var(--green-700);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease;
}

.btn-ghost:active {
  transform: scale(0.985);
  background: var(--green-50);
}

/* ---------- 第 1 步：拍照 ---------- */

.photo-stage {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  background: #fff;
  border: 1px dashed #cfe7cc;
  border-radius: 26px;
  box-shadow: var(--shadow-card);
  animation: rise 0.45s 0.05s both;
}

.photo-stage.has-photos {
  border-style: solid;
  border-color: var(--line);
}

.photo-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px 4px 2px;
}

.photo-empty svg {
  display: block;
  width: 100%;
  max-width: 240px;
  height: auto;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
}

.photo-grid.single {
  grid-template-columns: 1fr;
}

.photo-thumb {
  position: relative;
  margin: 0;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--green-50);
  border-radius: 16px;
  animation: rise 0.3s both;
}

.photo-grid.single .photo-thumb {
  max-height: 210px;
  aspect-ratio: 16 / 10;
}

.photo-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-remove {
  position: absolute;
  top: 7px;
  right: 7px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  color: #fff;
  background: rgba(36, 58, 43, 0.72);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.photo-actions {
  display: flex;
  gap: 10px;
}

.photo-btn {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 46px;
  font-size: 13.5px;
  font-weight: 650;
  color: var(--green-700);
  background: var(--green-50);
  border: 1px solid var(--green-200);
  border-radius: 15px;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease;
}

.photo-btn svg {
  width: 18px;
  height: 18px;
}

.photo-btn:active {
  transform: scale(0.98);
  background: var(--green-100);
}

.photo-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
  font-size: 11.5px;
  color: var(--muted);
}

.photo-meta b {
  font-weight: 650;
  color: var(--green-700);
  font-variant-numeric: tabular-nums;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

/* ---------- 第 2 步：AI 确认 ---------- */

.photo-strip {
  display: flex;
  gap: 8px;
  padding: 2px 0;
}

.photo-strip img {
  width: 62px;
  height: 62px;
  object-fit: cover;
  border: 2px solid #fff;
  border-radius: 14px;
  box-shadow: 0 6px 16px -10px rgba(46, 86, 56, 0.6);
}

.guess-card {
  position: relative;
  overflow: hidden;
  padding: 20px 18px;
  background: linear-gradient(155deg, #ffffff 10%, #f2faee 100%);
  border: 1px solid #e8f3e4;
  border-radius: 26px;
  box-shadow: var(--shadow-card), inset 0 0 0 1px rgba(255, 255, 255, 0.85);
  animation: rise 0.45s 0.08s both;
}

.guess-card::after {
  content: "";
  position: absolute;
  right: -50px;
  bottom: -60px;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle at 35% 35%, rgba(139, 206, 156, 0.26), rgba(139, 206, 156, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
}

.guess-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.demo-tag {
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 650;
  color: #a97e46;
  background: #fdf1dd;
  border-radius: 999px;
}

.guess-line {
  position: relative;
  z-index: 1;
  margin: 14px 0 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.guess-sym {
  color: var(--green-700);
}

.guess-note {
  position: relative;
  z-index: 1;
  margin: 10px 0 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
}

.guess-actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: auto;
  padding-top: 14px;
  animation: rise 0.45s 0.14s both;
}

/* ---------- 手动选症状浮层 ---------- */

.sheet-layer {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-end;
}

.sheet-layer[hidden],
.loading-veil[hidden] {
  display: none;
}

.sheet-scrim {
  position: absolute;
  inset: 0;
  padding: 0;
  background: rgba(30, 48, 36, 0.34);
  border: 0;
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.24s ease;
}

.sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: 82%;
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
  background: #fbfefa;
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -20px 50px -30px rgba(30, 60, 40, 0.5);
  transform: translateY(102%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.sheet-layer.is-open .sheet-scrim {
  opacity: 1;
}

.sheet-layer.is-open .sheet {
  transform: translateY(0);
}

.sheet-grabber {
  flex: 0 0 auto;
  width: 38px;
  height: 4px;
  margin: 2px auto 12px;
  background: #dbe9d8;
  border-radius: 99px;
}

.sheet-title {
  flex: 0 0 auto;
  margin: 0 0 12px;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}

.sheet-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.sheet-list::-webkit-scrollbar {
  display: none;
}

.sheet-list .symptom {
  flex: 0 0 auto;
  padding: 10px 11px;
}

.sheet-cancel {
  flex: 0 0 auto;
  margin-top: 10px;
}

/* ---------- 识别中 ---------- */

.loading-veil {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(249, 253, 247, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
  padding: 24px 32px;
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 24px 50px -30px rgba(46, 86, 56, 0.5);
}

.loading-card p {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--green-700);
}

.loader {
  position: relative;
  width: 46px;
  height: 46px;
}

.loader-ring {
  position: absolute;
  inset: 0;
  border: 3px solid var(--green-100);
  border-top-color: var(--green-500);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.loader-leaf {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--green-600);
}

.loader-leaf svg {
  width: 20px;
  height: 20px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- 底部导航 ---------- */

.tabbar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px 8px calc(9px + env(safe-area-inset-bottom));
  background: rgba(252, 254, 250, 0.9);
  border-top: 1px solid #e9f3e6;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 5px 0 3px;
  font-size: 10.5px;
  font-weight: 500;
  color: #9db2a0;
  background: none;
  border: 0;
  cursor: pointer;
  transition: color 0.18s ease;
}

.tab-icon {
  width: 26px;
  height: 26px;
  object-fit: cover;
  border-radius: 50%;
  filter: grayscale(1) opacity(0.5);
  transition: filter 0.18s ease, transform 0.18s ease;
}

.tab.is-active {
  font-weight: 650;
  color: var(--green-700);
}

.tab.is-active .tab-icon {
  filter: none;
  transform: translateY(-1px);
  box-shadow: 0 3px 7px rgba(79, 158, 105, 0.25);
}

/* ---------- 结果页 · AI 慢慢入口 ---------- */

.chat-entry {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  margin-top: 4px;
  padding: 13px 14px;
  text-align: left;
  background: linear-gradient(135deg, #ffffff, #f1faf0);
  border: 1px solid #dcefda;
  border-radius: 20px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
  animation: rise 0.5s 0.3s both;
}

.chat-entry:active {
  transform: scale(0.985);
}

.chat-entry-avatar {
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
}

.chat-entry-avatar svg {
  display: block;
  width: 38px;
  height: 38px;
}

.chat-entry-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.chat-entry-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--green-800);
}

.chat-entry-sub {
  font-size: 11.5px;
  color: var(--muted);
}

.chat-entry-arrow {
  flex: 0 0 auto;
  margin-left: auto;
  font-size: 18px;
  line-height: 1;
  color: #a9c4ad;
}

@media (hover: hover) {
  .chat-entry:hover {
    transform: translateY(-1px);
    box-shadow: 0 22px 40px -30px rgba(46, 86, 56, 0.65);
  }
}

/* ---------- AI 慢慢 · 对话页 ---------- */

.chat-screen {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(360px 240px at 88% -4%, #e9f7e4 0%, rgba(233, 247, 228, 0) 70%),
    linear-gradient(180deg, #f9fdf7 0%, #eef8ea 100%);
  animation: chatIn 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.chat-screen[hidden] {
  display: none;
}

.chat-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(14px + env(safe-area-inset-top)) 14px 12px;
  background: rgba(255, 255, 255, 0.78);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.chat-back {
  flex: 0 0 auto;
}

.chat-avatar {
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
}

.chat-avatar svg {
  display: block;
  width: 38px;
  height: 38px;
}

.chat-who {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.chat-name {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.chat-demo-tag {
  padding: 1px 6px;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--green-700);
  background: var(--green-100);
  border-radius: 99px;
}

.chat-demo-tag[hidden] {
  display: none;
}

.chat-status {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}

.chat-hold {
  flex: 0 0 36px;
  margin-left: auto;
}

.chat-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px 20px;
  overflow-y: auto;
}

.chat-day {
  align-self: center;
  margin: 0 0 2px;
  padding: 3px 10px;
  font-size: 10.5px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 99px;
}

.msg-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.msg {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  animation: rise 0.3s both;
}

.msg.user {
  flex-direction: row-reverse;
}

.msg-avatar {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
}

.msg-avatar svg {
  display: block;
  width: 30px;
  height: 30px;
}

.bubble {
  max-width: 76%;
  padding: 10px 13px;
  font-size: 13.5px;
  line-height: 1.65;
  word-break: break-word;
}

.msg.ai .bubble {
  color: var(--ink-soft);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  border-top-left-radius: 6px;
  box-shadow: 0 12px 26px -24px rgba(46, 86, 56, 0.7);
}

.msg.user .bubble {
  color: #fff;
  background: linear-gradient(135deg, #8bce9c, #6cb87f);
  border-radius: 16px;
  border-top-right-radius: 6px;
  box-shadow: 0 12px 24px -18px rgba(63, 130, 87, 0.8);
}

.bubble .msg-text {
  margin: 0;
}

.bubble img {
  display: block;
  width: 100%;
  max-width: 200px;
  margin-bottom: 6px;
  border-radius: 10px;
}

.bubble .typing {
  display: inline-flex;
  gap: 4px;
  padding: 3px 1px;
}

.bubble .typing i {
  width: 6px;
  height: 6px;
  background: var(--green-400);
  border-radius: 50%;
  animation: typingBlink 1.1s infinite ease-in-out;
}

.bubble .typing i:nth-child(2) {
  animation-delay: 0.15s;
}

.bubble .typing i:nth-child(3) {
  animation-delay: 0.3s;
}

.chat-composer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px calc(12px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid var(--line);
}

.chat-pick {
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--green-700);
  background: var(--green-50);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
}

.chat-pick:active {
  transform: scale(0.94);
}

.chat-pick svg {
  width: 20px;
  height: 20px;
}

.chat-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 14px;
  font-size: 14px;
  color: var(--ink);
  background: var(--green-50);
  border: 1px solid var(--line);
  border-radius: 999px;
  outline: none;
}

.chat-input:focus {
  background: #fff;
  border-color: var(--green-300);
}

.chat-input::placeholder {
  color: #a3b5a5;
}

.chat-send {
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: #fff;
  background: linear-gradient(135deg, #7cc78d, var(--green-600));
  border: 0;
  border-radius: 50%;
  box-shadow: 0 8px 18px -12px rgba(63, 130, 87, 0.9);
  cursor: pointer;
}

.chat-send:active {
  transform: scale(0.94);
}

.chat-send svg {
  width: 19px;
  height: 19px;
}

/* ---------- 提示条 ---------- */

.toast {
  position: absolute;
  bottom: 92px;
  left: 50%;
  z-index: 60;
  padding: 9px 16px;
  font-size: 12.5px;
  color: #fff;
  white-space: nowrap;
  background: rgba(36, 57, 43, 0.88);
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- 动画 ---------- */

@keyframes screenIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes chatIn {
  from {
    opacity: 0;
    transform: translateX(26px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes typingBlink {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

/* ---------- 小屏适配 ---------- */

@media (max-width: 600px) {
  body {
    padding: 0;
  }

  .phone {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.001ms !important;
  }
}
