:root {
  --bg: #F7F3EC;
  --card: #FFFFFF;
  --ink: #24221E;
  --ink2: #5E5A52;
  --ink3: #9A958B;
  --line: #ECE6DB;
  --green: #2F8F5B;
  --green-soft: #E4F3E8;
  --gold: #F2B534;
  --gold-deep: #B57A05;
  --gold-soft: #FFF3D6;
  --gray-soft: #EFEBE4;
  --r-lg: 22px;
  --r-md: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); overscroll-behavior: none; }
body {
  font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--ink); -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: var(--green); text-decoration: none; }
svg { display: block; }

#app { max-width: 480px; margin: 0 auto; height: 100vh; height: 100dvh; display: flex; flex-direction: column; position: relative; overflow: hidden; }

/* ---------- 顶栏 ---------- */
.top { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px 6px; flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 6px; font-size: 20px; font-weight: 800; letter-spacing: 1px; }
.brand-ic { width: 26px; height: 26px; }
.score-pill {
  display: flex; align-items: center; gap: 6px; background: var(--gold-soft); border-radius: 99px;
  padding: 5px 13px 5px 6px; transition: transform .2s;
}
.score-pill .sp-plant { width: 26px; height: 26px; border-radius: 50%; background: #fff; display: grid; place-items: center; }
.score-pill .sp-plant svg { width: 22px; height: 22px; }
.sp-label { font-size: 12px; color: var(--gold-deep); }
.score-pill b { font-size: 17px; color: var(--gold-deep); font-variant-numeric: tabular-nums; min-width: 1.2em; }
.score-pill.bump { animation: bump .5s ease; }
@keyframes bump { 30% { transform: scale(1.18); } 60% { transform: scale(.96); } }

/* ---------- 视图 ---------- */
.view { display: none; flex: 1; min-height: 0; flex-direction: column; }
.view.active { display: flex; }
#viewList { overflow-y: auto; padding: 4px 16px 24px; -webkit-overflow-scrolling: touch; }

/* ---------- 主题条 ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 8px 18px 6px; flex-shrink: 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; display: flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 99px;
  background: var(--card); font-size: 14px; color: var(--ink2); border: 1px solid var(--line);
}
.chip i { width: 8px; height: 8px; border-radius: 50%; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 600; }

.group-bar { display: flex; align-items: center; justify-content: space-between; padding: 6px 20px 8px; flex-shrink: 0; }
.dots { display: flex; gap: 5px; }
.dots i { width: 22px; height: 5px; border-radius: 3px; background: #E2DCD0; transition: background .3s; }
.dots i.want { background: var(--green); }
.dots i.done { background: var(--gold); }
.dots i.skip { background: #C9C2B5; }
.group-txt { font-size: 13px; color: var(--ink3); }

/* ---------- 卡片堆 ---------- */
.stack { position: relative; flex: 1; min-height: 0; margin: 0 16px 22px; }
.card {
  position: absolute; inset: 0; background: var(--card); border-radius: var(--r-lg);
  box-shadow: 0 10px 30px rgba(80, 64, 30, .10), 0 1px 3px rgba(80, 64, 30, .08);
  display: flex; flex-direction: column; overflow: hidden; touch-action: pan-y; user-select: none;
  will-change: transform; transform-origin: 50% 90%;
}
.card.c1 { transform: translateY(12px) scale(.95); opacity: .75; }
.card.c2 { transform: translateY(24px) scale(.9); opacity: .4; }
.card.c1 .card-foot, .card.c2 .card-foot, .card.c1 .cost-chips, .card.c2 .cost-chips { visibility: hidden; }
.card.anim { transition: transform .32s cubic-bezier(.2,.8,.3,1), opacity .32s; }
.card-head { padding: 16px 18px 14px; display: flex; align-items: center; gap: 10px; }
.th-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.th-ic svg { width: 22px; height: 22px; }
.ch-meta { flex: 1; min-width: 0; }
.ch-sec { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-num { font-size: 12px; color: var(--ink3); margin-top: 1px; }
.grade { font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 8px; flex-shrink: 0; }
.grade.A { background: #E1F3E7; color: #23794A; }
.grade.B { background: #FFF1D2; color: #9A6A08; }
.grade.C { background: #EFEBE4; color: #6E685E; }
.card-title { font-size: 21px; font-weight: 800; line-height: 1.42; padding: 14px 18px 0; letter-spacing: .3px; }
.plain-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.plain-row .plain-lb { margin-bottom: 0; }
.ratio-line { display: flex; gap: 6px; padding: 10px 18px 0; flex-wrap: wrap; }
.ratio { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; }
.ratio.r3 { background: #FFE9C2; color: #A0620A; }
.ratio.r2 { background: #F1EDE5; color: #7A7366; }
.ratio.r1 { background: #F4F2EE; color: #9A958B; }
.card-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 18px 4px; -webkit-overflow-scrolling: touch; }
.card-body.ovf { -webkit-mask-image: linear-gradient(#000 calc(100% - 34px), transparent); mask-image: linear-gradient(#000 calc(100% - 34px), transparent); }
.plain-lb { font-size: 12px; color: var(--ink3); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.plain-lb::before { content: ""; width: 3px; height: 12px; border-radius: 2px; background: currentColor; }
.plain { font-size: 16px; line-height: 1.78; color: #3A3732; }
.cost-chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 12px 14px 8px; }
.cc { background: var(--bg); border-radius: 12px; padding: 8px 2px 7px; text-align: center; }
.cc b { display: block; font-size: 14px; font-weight: 700; }
.cc span { font-size: 11px; color: var(--ink3); }
.cc.good b { color: var(--green); }
.cc.mid b { color: #A0700E; }
.cc.bad b { color: #C2553A; }
.card-foot { display: flex; justify-content: space-between; align-items: center; padding: 6px 18px 14px; font-size: 13px; color: var(--ink3); }
.card-foot .more { color: var(--green); font-weight: 600; display: flex; align-items: center; gap: 2px; }
.card-links { display: flex; align-items: center; gap: 9px; }
.card-share { display: flex; align-items: center; gap: 3px; padding: 4px 0 4px 9px; border-left: 1px solid var(--line); color: var(--green); font-weight: 600; }
.sheet-foot .btn { min-width: 0; padding: 0 12px; font-size: 14px; }
.sheet-foot .btn-share { flex: 0 0 64px; background: var(--green-soft); color: var(--green); }
.share-view { position: absolute; inset: 0; z-index: 70; background: var(--bg); display: flex; flex-direction: column; }
.share-view[hidden], .share-view [hidden] { display: none !important; }
.share-top { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; padding: 16px; gap: 8px; background: var(--card); }
.share-top b { font-size: 16px; }
.share-top button { font-size: 13px; color: var(--green); min-height: 30px; }
.share-scroll { flex: 1; min-height: 0; overflow: auto; padding: 16px 18px; -webkit-overflow-scrolling: touch; }
#shareImage { display: block; width: 100%; height: auto; border-radius: 16px; -webkit-touch-callout: default; user-select: auto; }
.share-loading { min-height: 280px; display: flex; flex-direction: column; justify-content: center; align-items: center; color: var(--ink2); font-size: 14px; }
.share-loading i { width: 30px; height: 30px; border: 3px solid var(--green-soft); border-top-color: var(--green); border-radius: 50%; animation: share-spin 0.8s linear infinite; }
@keyframes share-spin { to { transform: rotate(360deg); } }
.share-bottom { flex-shrink: 0; padding: 8px 18px calc(12px + var(--safe-b)); background: var(--card); border-top: 1px solid var(--line); }
.share-bottom p { font-size: 12px; color: var(--ink2); line-height: 1.5; margin: 4px 0 10px; text-align: center; }
.share-bottom .btn { width: 100%; }
.share-bottom .btn:disabled { opacity: .5; cursor: wait; }
.share-error { text-align: center; color: var(--ink2); padding-top: 80px; }
.share-error .btn { display: flex; margin: 20px auto; }
@media (max-width: 375px) { .card-links { gap: 6px; } .card-share { padding-left: 6px; } .sheet-foot { gap: 6px; } .sheet-foot .btn { font-size: 13px; } }

.stamp {
  position: absolute; top: 22px; font-size: 22px; font-weight: 900; padding: 4px 14px; border-radius: 12px;
  border: 3px solid currentColor; opacity: 0; pointer-events: none; letter-spacing: 2px;
}
.stamp.want { right: 18px; color: var(--green); transform: rotate(12deg); background: rgba(255,255,255,.92); }
.stamp.skip { left: 18px; color: #A39C90; transform: rotate(-12deg); background: rgba(255,255,255,.92); }
.stamp.done { left: 50%; top: 40%; color: var(--gold-deep); transform: translateX(-50%) rotate(-6deg); background: rgba(255,250,235,.96); }

/* 一组完成 */
.finish { position: absolute; inset: 0; background: var(--card); border-radius: var(--r-lg); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; box-shadow: 0 10px 30px rgba(80,64,30,.10); }
.finish .fz-plant svg { width: 96px; height: 96px; }
.finish h2 { font-size: 22px; margin: 10px 0 4px; }
.finish p { color: var(--ink2); font-size: 14px; margin: 0; line-height: 1.7; }
.fz-stats { display: flex; gap: 10px; margin: 18px 0 22px; }
.fz-stats div { background: var(--bg); border-radius: 14px; padding: 10px 14px; min-width: 76px; }
.fz-stats b { display: block; font-size: 22px; }
.fz-stats span { font-size: 12px; color: var(--ink3); }
.btn { display: inline-flex; align-items: center; justify-content: center; height: 46px; padding: 0 22px; border-radius: 99px; font-size: 15px; font-weight: 700; }
.btn-pri { background: var(--green); color: #fff; }
.btn-sec { background: var(--gray-soft); color: var(--ink); }
.btn-gold { background: var(--gold); color: #4A3200; }
.fz-btns { display: flex; gap: 10px; }

/* ---------- 操作按钮 ---------- */
.actions { display: flex; align-items: flex-end; justify-content: center; gap: 18px; padding: 14px 16px 10px; flex-shrink: 0; }
.act { display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 12px; color: var(--ink2); }
.act i { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: var(--card); box-shadow: 0 4px 14px rgba(80,64,30,.10); transition: transform .15s; }
.act:active i { transform: scale(.9); }
.act i svg { width: 26px; height: 26px; }
.act-skip i { color: #A39C90; }
.act-done i { width: 66px; height: 66px; background: var(--gold); color: #fff; }
.act-done span { color: var(--gold-deep); font-weight: 700; }
.act-want i { background: var(--green); color: #fff; }
.act-want span { color: var(--green); font-weight: 700; }
.act-undo { margin-right: -4px; }
.act-undo svg { width: 20px; height: 20px; }
.act-undo { width: 38px; height: 58px; justify-content: center; color: var(--ink3); }
.act-undo:disabled { opacity: .35; }

/* ---------- 底部 Tab ---------- */
.tabbar { display: flex; flex-shrink: 0; background: rgba(255,255,255,.92); border-top: 1px solid var(--line); padding: 6px 0 calc(6px + var(--safe-b)); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--ink3); position: relative; padding: 2px 0; }
.tab svg { width: 24px; height: 24px; }
.tab.on { color: var(--green); font-weight: 700; }
.badge { position: absolute; top: -2px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #E5533B; color: #fff; font-size: 11px; font-style: normal; line-height: 18px; text-align: center; font-weight: 700; display: none; }
.badge.show { display: block; }

/* ---------- 清单页 ---------- */
.hero { background: linear-gradient(160deg, #E4F3E8 0%, #FFF6DE 100%); border-radius: var(--r-lg); padding: 18px 18px 16px; margin-top: 6px; }
.hero-top { display: flex; align-items: center; gap: 14px; }
.hero-plant { width: 84px; height: 84px; border-radius: 24px; background: rgba(255,255,255,.75); display: grid; place-items: center; flex-shrink: 0; }
.hero-plant svg { width: 70px; height: 70px; }
.hero-lv { font-size: 13px; color: var(--green); font-weight: 700; }
.hero-score { font-size: 40px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hero-score small { font-size: 14px; font-weight: 600; color: var(--ink2); margin-left: 4px; }
.lvbar { height: 8px; border-radius: 4px; background: rgba(255,255,255,.8); margin: 14px 0 6px; overflow: hidden; }
.lvbar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #4CB377, #F2B534); transition: width .6s; }
.lv-tip { font-size: 12px; color: var(--ink2); }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.hero-stats div { background: rgba(255,255,255,.75); border-radius: 14px; padding: 9px 4px; text-align: center; }
.hero-stats b { display: block; font-size: 20px; }
.hero-stats span { font-size: 12px; color: var(--ink2); }

.block { background: var(--card); border-radius: var(--r-lg); padding: 16px; margin-top: 12px; }
.block-h { margin: 0 0 12px; font-size: 16px; }
.tp { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; }
.tp:last-child { margin-bottom: 0; }
.tp .th-ic { width: 30px; height: 30px; border-radius: 9px; }
.tp .th-ic svg { width: 17px; height: 17px; }
.tp-name { width: 64px; font-size: 14px; font-weight: 600; flex-shrink: 0; }
.tp-bar { flex: 1; height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; display: flex; }
.tp-bar i { height: 100%; transition: width .6s; }
.tp-num { font-size: 12px; color: var(--ink3); width: 58px; text-align: right; font-variant-numeric: tabular-nums; }

.seg { display: flex; background: var(--bg); border-radius: 12px; padding: 3px; margin-bottom: 12px; }
.seg button { flex: 1; height: 36px; border-radius: 10px; font-size: 14px; color: var(--ink2); }
.seg button.on { background: var(--card); color: var(--ink); font-weight: 700; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.seg b { font-weight: 700; margin-left: 2px; }
.li { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.li:last-child { border-bottom: 0; }
.li-bar { width: 4px; align-self: stretch; border-radius: 2px; flex-shrink: 0; }
.li-main { flex: 1; min-width: 0; }
.li-t { font-size: 15px; font-weight: 600; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.li-m { font-size: 12px; color: var(--ink3); margin-top: 3px; }
.li-btn { flex-shrink: 0; height: 32px; padding: 0 12px; border-radius: 99px; font-size: 13px; font-weight: 700; background: var(--gold-soft); color: var(--gold-deep); }
.li-pt { flex-shrink: 0; font-size: 13px; font-weight: 700; color: var(--gold-deep); }
.empty { text-align: center; color: var(--ink3); font-size: 14px; padding: 26px 0 14px; line-height: 1.8; }
.about { text-align: center; font-size: 11.5px; color: var(--ink3); line-height: 1.9; padding: 20px 4px 8px; }
.about-sep { margin: 0 6px; }

/* ---------- 详情弹层 ---------- */
.sheet-mask { position: absolute; inset: 0; background: rgba(30,25,15,.38); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 20; }
.sheet-mask.show { opacity: 1; pointer-events: auto; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; height: 88%; background: var(--card); border-radius: 24px 24px 0 0; z-index: 21; transform: translateY(102%); transition: transform .3s cubic-bezier(.2,.8,.3,1); display: flex; flex-direction: column; }
.sheet.show { transform: none; }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: #DDD6CA; margin: 9px auto 2px; flex-shrink: 0; }
.sheet-body { flex: 1; overflow-y: auto; padding: 8px 20px 20px; -webkit-overflow-scrolling: touch; }
.sheet-foot { display: flex; gap: 10px; padding: 10px 16px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); flex-shrink: 0; }
.sheet-foot .btn { flex: 1; }
.sd-head { display: flex; align-items: center; gap: 10px; margin: 6px 0 12px; }
.sd-title { font-size: 21px; font-weight: 800; line-height: 1.42; margin: 0 0 10px; }
.sd-sec { margin-top: 18px; }
.sd-sec h4 { margin: 0 0 6px; font-size: 13px; color: var(--ink3); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.sd-sec h4::before { content: ""; width: 3px; height: 12px; border-radius: 2px; background: currentColor; }
.sd-sec p { margin: 0; font-size: 15.5px; line-height: 1.8; color: #3A3732; }
.sd-plain { background: var(--green-soft); border-radius: 14px; padding: 12px 14px; }
.sd-plain p { color: #1F4D33; }
.sd-note p { color: var(--ink2); font-size: 14px; }
.sd-src ol { margin: 0; padding-left: 20px; }
.sd-src li { font-size: 13px; line-height: 1.65; color: var(--ink2); margin-bottom: 9px; word-break: break-all; }
.sd-src li a { display: inline-block; margin-top: 2px; font-size: 12.5px; }
.sd-loading { color: var(--ink3); font-size: 13px; }

/* ---------- 弹窗 / 提示 ---------- */
.modal { position: absolute; inset: 0; z-index: 40; display: none; align-items: center; justify-content: center; background: rgba(30,25,15,.45); padding: 28px; }
.modal.show { display: flex; }
.mbox { background: var(--card); border-radius: 26px; padding: 26px 22px 20px; width: 100%; max-width: 340px; text-align: center; animation: pop .35s cubic-bezier(.2,1.4,.4,1); }
@keyframes pop { from { transform: scale(.8); opacity: 0; } }
.mbox h2 { margin: 10px 0 6px; font-size: 22px; }
.mbox p { margin: 0; font-size: 14.5px; color: var(--ink2); line-height: 1.75; }
.mbox .btn { width: 100%; margin-top: 20px; }
.m-plant svg { width: 110px; height: 110px; margin: 0 auto; }
.ob-steps { text-align: left; margin: 18px 0 4px; }
.ob-steps div { display: flex; align-items: center; gap: 12px; padding: 9px 0; font-size: 14.5px; }
.ob-steps i { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; color: #fff; }
.ob-steps i svg { width: 18px; height: 18px; }
.ob-steps b { display: block; font-size: 15px; }
.ob-steps span { color: var(--ink3); font-size: 12.5px; }

.toast { position: absolute; left: 50%; bottom: 150px; transform: translate(-50%, 10px); background: rgba(36,34,30,.92); color: #fff; font-size: 14px; padding: 9px 16px; border-radius: 99px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 50; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.fly { position: absolute; z-index: 60; pointer-events: none; font-weight: 900; font-size: 20px; color: var(--gold-deep); text-shadow: 0 2px 0 #fff; }
.spark { position: absolute; z-index: 59; width: 7px; height: 7px; border-radius: 50%; pointer-events: none; }

/* ---------- 启动 ---------- */
.boot { position: fixed; inset: 0; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 99; transition: opacity .3s; }
.boot.hide { opacity: 0; pointer-events: none; }
.boot p { color: var(--ink3); font-size: 14px; margin-top: 14px; }
.boot-sprout { width: 14px; height: 14px; border-radius: 50%; background: var(--green); animation: breathe 1s ease-in-out infinite alternate; }
@keyframes breathe { to { transform: scale(1.8); opacity: .5; } }

@media (max-height: 760px) {
  .top { padding: 8px 16px 2px; }
  .chips { padding: 6px 16px 4px; }
  .chip { padding: 6px 12px; font-size: 13px; }
  .group-bar { padding: 4px 20px 6px; }
  .card-head { padding: 10px 14px 9px; }
  .th-ic { width: 32px; height: 32px; border-radius: 10px; }
  .card-title { font-size: 18px; padding: 10px 16px 0; line-height: 1.38; }
  .card-body { padding: 10px 16px 2px; }
  .plain { font-size: 15px; line-height: 1.66; }
  .cost-chips { padding: 8px 12px 4px; gap: 5px; }
  .cc { padding: 5px 2px 4px; border-radius: 10px; }
  .cc b { font-size: 13px; }
  .card-foot { padding: 4px 16px 10px; font-size: 12px; }
  .stack { margin-bottom: 18px; }
  .actions { padding: 6px 16px 6px; gap: 16px; }
  .act i { width: 50px; height: 50px; }
  .act i svg { width: 22px; height: 22px; }
  .act-done i { width: 56px; height: 56px; }
  .act-undo { height: 50px; }
}
