/* 吉米的榴莲园：暖色食品方向。主色墨绿，强调色榴莲金，中性阶掺一点黄绿。
   字阶 13/16/20/25/31，间距 4px 栅格，圆角 12/20 两档。 */
:root {
  color-scheme: light;
  --green: #2E5E3B;
  --green-2: #3E7A4E;
  --green-soft: #E3EEDD;
  --gold: #E0A42A;
  --gold-soft: #FBEFD0;
  --gold-ink: #8A5A06;
  --blue: #2F7FC8;
  --blue-soft: #E1EEF9;
  --red: #B84A33;
  --red-soft: #F8E4DD;
  --bg: #F4EEDF;
  --surface: #FFFCF4;
  --surface-2: #F9F3E4;
  --line: #E6DCC2;
  --ink: #26281D;
  --ink-2: #5E5D4B;
  --ink-3: #8C8A74;
  --r1: 12px;
  --r2: 20px;
  --sh1: 0 1px 2px rgba(60, 50, 20, .08);
  --sh2: 0 8px 24px rgba(60, 50, 20, .14);
  --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg) linear-gradient(180deg, #DCEBDD 0, #EAF0DA 180px, var(--bg) 360px) no-repeat;
  min-height: 100vh;
  overscroll-behavior-y: none;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
input { font: inherit; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 4px; }
.ico { width: 20px; height: 20px; flex: none; display: inline-block; }
.ico svg { width: 100%; height: 100%; stroke-width: 1.75; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- 启动 / 登录 ---------- */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--ink-2); }
.boot img { width: 120px; animation: sway 2.4s ease-in-out infinite; transform-origin: 50% 100%; }

.field { display: grid; gap: 4px; margin-bottom: 16px; }
.field label { font-size: 13px; color: var(--ink-2); }
.field input {
  height: 48px; padding: 0 16px; font-size: 16px; border-radius: var(--r1);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.field input:focus { outline: none; border-color: var(--green-2); box-shadow: 0 0 0 3px var(--green-soft); }
.form-err { min-height: 24px; color: var(--red); font-size: 13px; margin: -4px 0 8px; }
.switch { margin-top: 16px; text-align: center; color: var(--ink-2); font-size: 16px; }
.switch button { color: var(--green); font-weight: 600; padding: 8px 4px; }

/* 游客 */
.login-chip { height: 24px; padding: 0 8px; margin-left: 4px; border-radius: 999px; background: var(--green); color: #FBFAF2; font-size: 13px; font-weight: 600; vertical-align: 2px; }
.auth-reason { display: flex; align-items: center; gap: 8px; margin: -4px 0 16px; padding: 8px 12px; border-radius: var(--r1); background: var(--gold-soft); color: var(--gold-ink); font-weight: 600; }
.auth-reason img { width: 24px; height: 24px; flex: none; }

/* ---------- 按钮 ---------- */
.btn {
  height: 48px; padding: 0 20px; border-radius: var(--r1); font-weight: 600; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  transition: transform .15s ease-out, opacity .15s ease-out, background-color .15s ease-out;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--green); color: #FBFAF2; box-shadow: var(--sh1); }
.btn-gold { background: var(--gold); color: #2B1E02; box-shadow: var(--sh1); }
.btn-quiet { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.btn-block { width: 100%; }
.btn-sm { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn img { width: 20px; height: 20px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  padding: calc(8px + var(--safe-t)) 16px 8px;
  display: flex; align-items: center; gap: 12px;
  background: rgba(220, 235, 221, .86);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
}
.lv {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  background: var(--green); color: #FBFAF2; display: grid; place-items: center; line-height: 1;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .18);
}
.lv small { display: block; font-size: 10px; opacity: .8; text-align: center; }
.lv b { font-size: 16px; }
.who { min-width: 0; flex: 1; }
.who .name { font-weight: 600; font-size: 16px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.expbar { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); line-height: 1.3; }
.bar { height: 6px; border-radius: 3px; background: rgba(46, 94, 59, .14); overflow: hidden; flex: 1; max-width: 120px; }
.bar i { display: block; height: 100%; background: var(--green-2); border-radius: inherit; transition: width .25s ease-out; }
.coins {
  display: flex; align-items: center; gap: 4px; padding: 4px 12px 4px 4px; border-radius: 999px;
  background: var(--surface); box-shadow: var(--sh1); font-weight: 700; font-size: 16px; flex: none;
}
.coins img { width: 28px; height: 28px; }

/* ---------- 页面主体 ---------- */
.page { padding: 8px 16px calc(var(--tab-h) + var(--safe-b) + 24px); max-width: 560px; margin: 0 auto; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 12px; min-height: 40px; }
.head h2 { font-size: 20px; line-height: 1.25; margin: 0; }
.head .hint { font-size: 13px; color: var(--ink-2); }
.checkin { display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 12px; border-radius: 999px; background: var(--gold); color: #2B1E02; font-weight: 600; font-size: 13px; box-shadow: var(--sh1); }
.checkin .ico { width: 16px; height: 16px; }

/* ---------- 地块 ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile {
  position: relative; text-align: left; border-radius: var(--r2);
  background: radial-gradient(120% 60% at 50% 100%, #E6DABA 0, #EFE6CC 45%, var(--surface) 100%);
  border: 1px solid var(--line); box-shadow: var(--sh1);
  aspect-ratio: 1 / 1.22; padding: 36px 12px 12px; overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .15s ease-out, box-shadow .15s ease-out;
}
.tile:active { transform: scale(.98); }
.tile .art { flex: 1; min-height: 0; display: flex; align-items: flex-end; justify-content: center; pointer-events: none; margin-bottom: 8px; }
.tile .art img { max-width: 92%; max-height: 100%; object-fit: contain; transform-origin: 50% 100%; }
.tile .art.s0 img { max-width: 46%; max-height: 52%; }
.tile .art.s1 img { max-width: 66%; max-height: 78%; }
.tile .art.plot img { max-width: 84%; }
.tile.ripe { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft), var(--sh2); }
.tile.ripe .art img { animation: sway 3s ease-in-out infinite; }
.tile.locked { background: var(--surface-2); }
.tile.locked .art { opacity: .9; }
.tile .info { position: relative; z-index: 1; flex: none; }
.tile .nm { font-weight: 600; font-size: 16px; line-height: 1.3; display: flex; align-items: baseline; gap: 4px; }
.tile .nm small { font-size: 13px; font-weight: 400; color: var(--ink-2); }
.tile .tm { font-size: 13px; color: var(--ink-2); line-height: 1.4; margin: 2px 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .tm.warn { color: var(--red); font-weight: 600; }
.tile .tm.ok { color: var(--gold-ink); font-weight: 600; }
.pbar { height: 6px; border-radius: 3px; background: rgba(46, 94, 59, .12); overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--green-2); border-radius: inherit; }
.tile.ripe .pbar i { background: var(--gold); }
.chips { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; gap: 4px; flex-wrap: wrap; z-index: 2; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 8px 0 4px; border-radius: 999px;
  font-size: 13px; font-weight: 600; background: var(--surface); box-shadow: var(--sh1); line-height: 1;
}
.chip img { width: 20px; height: 20px; }
.chip.water { color: var(--blue); }
.chip.bug { color: var(--red); }
.chip.ripe { color: var(--gold-ink); background: var(--gold-soft); padding-left: 8px; }
.chip.done { color: var(--green); background: var(--green-soft); padding-left: 8px; }
.tile .empty-cta { font-weight: 600; color: var(--green); font-size: 16px; display: flex; align-items: center; gap: 4px; }
.tile .lock-cta { font-size: 13px; color: var(--ink-2); }

/* ---------- 动态 ---------- */
.feed { margin-top: 32px; }
.feed h3, .sec h3 { font-size: 16px; margin: 0 0 8px; color: var(--ink-2); font-weight: 600; }
.feed ul { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--r2); border: 1px solid var(--line); }
.feed li { display: flex; gap: 12px; align-items: center; padding: 12px 16px; font-size: 16px; }
.feed li + li { border-top: 1px solid var(--line); }
.feed li img { width: 28px; height: 28px; flex: none; }
.feed li .t { color: var(--ink-3); font-size: 13px; margin-left: auto; flex: none; }
.feed li span { min-width: 0; }
.blank { padding: 24px 16px; text-align: center; color: var(--ink-2); font-size: 16px; }
.blank img { width: 72px; margin: 0 auto 8px; opacity: .9; }

/* ---------- 列表行（商店/仓库/邻居） ---------- */
.sec { margin-bottom: 32px; }
.list { background: var(--surface); border-radius: var(--r2); border: 1px solid var(--line); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 72px; width: 100%; text-align: left; }
.row + .row { border-top: 1px solid var(--line); }
.row .pic { width: 52px; height: 52px; flex: none; display: grid; place-items: center; }
.row .pic img { width: 100%; height: 100%; object-fit: contain; }
.row .txt { flex: 1; min-width: 0; }
.row .t1 { font-weight: 600; line-height: 1.35; display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
.row .t1 small { font-size: 13px; color: var(--ink-3); font-weight: 400; }
.row .t2 { font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.row .act { flex: none; display: flex; gap: 8px; align-items: center; }
.row.dim .pic, .row.dim .txt { opacity: .5; }
.price { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; font-variant-numeric: tabular-nums; }
.price img { width: 18px; height: 18px; }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); }
.tag .ico { width: 14px; height: 14px; }
.tag.need { background: var(--blue-soft); color: var(--blue); }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #FBFAF2; flex: none; font-size: 16px; }
.rankno { width: 24px; text-align: center; font-weight: 700; color: var(--ink-3); flex: none; font-variant-numeric: tabular-nums; }
.rankno.top { color: var(--gold-ink); }

.seg { display: grid; grid-template-columns: 1fr 1fr; background: rgba(46, 94, 59, .08); padding: 4px; border-radius: var(--r1); margin-bottom: 16px; }
.seg button { height: 36px; border-radius: 9px; font-weight: 600; color: var(--ink-2); font-size: 16px; }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--sh1); }

.dex { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.dex div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r1); padding: 8px; text-align: center; font-size: 13px; line-height: 1.4; }
.dex img { width: 64px; height: 64px; margin: 0 auto 4px; object-fit: contain; }
.dex .no img { filter: grayscale(1) opacity(.35); }
.dex b { display: block; font-size: 16px; }
.dex span { color: var(--ink-2); }

/* ---------- 参观 ---------- */
.visit-bar { display: flex; align-items: center; gap: 8px; margin: 8px 0 12px; }
.back { display: inline-flex; align-items: center; height: 40px; padding: 0 12px 0 4px; border-radius: 999px; background: var(--surface); box-shadow: var(--sh1); font-weight: 600; flex: none; }
.visit-bar h2 { font-size: 20px; margin: 0; line-height: 1.25; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visit-note { font-size: 13px; color: var(--ink-2); margin: -4px 0 12px; }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(255, 252, 244, .94); border-top: 1px solid var(--line);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.tabbar button { display: grid; justify-items: center; align-content: center; gap: 2px; color: var(--ink-3); font-size: 13px; font-weight: 600; position: relative; }
.tabbar button .ico { width: 24px; height: 24px; }
.tabbar button[aria-current="page"] { color: var(--green); }
.tabbar .dot { position: absolute; top: 10px; left: calc(50% + 10px); width: 8px; height: 8px; border-radius: 50%; background: var(--red); }

/* ---------- 底部弹层 ---------- */
.mask { position: fixed; inset: 0; z-index: 40; background: rgba(30, 28, 15, .42); animation: fade .2s ease-out both; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-width: 560px; margin: 0 auto;
  background: var(--surface); border-radius: var(--r2) var(--r2) 0 0; box-shadow: var(--sh2);
  max-height: 86vh; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 8px 16px calc(24px + var(--safe-b));
  animation: up .22s ease-out both;
}
.sheet .grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 8px; }
.sheet-h { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.sheet-h h3 { margin: 0; font-size: 20px; line-height: 1.25; flex: 1; min-width: 0; }
.sheet-h .x { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); flex: none; }
.sheet .list { border-radius: var(--r1); }
.tree-head { display: flex; gap: 16px; align-items: flex-end; margin-bottom: 16px; }
.tree-head .pic { width: 104px; height: 104px; flex: none; display: flex; align-items: flex-end; justify-content: center; }
.tree-head .pic img { max-height: 100%; }
.tree-head .meta { flex: 1; min-width: 0; padding-bottom: 4px; }
.tree-head .meta .t1 { font-size: 20px; font-weight: 700; line-height: 1.25; }
.tree-head .meta .t2 { font-size: 13px; color: var(--ink-2); }
.big-time { font-size: 25px; font-weight: 700; line-height: 1.2; margin-top: 4px; font-variant-numeric: tabular-nums; }
.big-time.warn { color: var(--red); font-size: 20px; }
.big-time.ok { color: var(--gold-ink); }
.stats { display: grid; gap: 12px; margin-bottom: 16px; }
.stat { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px 12px; align-items: center; font-size: 16px; }
.stat img { width: 28px; height: 28px; }
.stat .v { color: var(--ink-2); font-size: 13px; }
.stat .bar { max-width: none; grid-column: 2 / 4; height: 8px; border-radius: 4px; margin-top: -4px; }
.stat .bar.water i { background: var(--blue); }
.stat .bar.water.low i { background: var(--red); }
.actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.actions.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.actions.one { grid-template-columns: minmax(0, 1fr); }
.actions .wide { grid-column: 1 / -1; }
.act-card {
  display: grid; justify-items: center; align-content: start; gap: 2px; text-align: center;
  padding: 12px 8px; min-height: 64px; border-radius: var(--r1); background: var(--surface-2); border: 1px solid var(--line);
  transition: transform .15s ease-out;
}
.act-card:active { transform: scale(.97); }
.act-card img { width: 48px; height: 48px; margin-bottom: 4px; }
.act-card.wide { grid-template-columns: 48px 1fr; justify-items: start; text-align: left; align-items: center; gap: 0 12px; }
.act-card.wide img { grid-row: span 2; margin: 0; }
.act-card b { font-size: 16px; line-height: 1.3; }
.act-card span { font-size: 13px; color: var(--ink-2); line-height: 1.3; }
.act-card.hot { background: var(--blue-soft); border-color: #BCD7EF; }
.act-card.hot-red { background: var(--red-soft); border-color: #EBC5B9; }
.act-card[disabled] { opacity: .45; pointer-events: none; }
.note { font-size: 13px; color: var(--ink-2); margin: 12px 0 0; line-height: 1.6; }

/* ---------- 提示 ---------- */
#toast {
  position: fixed; left: 50%; top: calc(72px + var(--safe-t)); z-index: 60; transform: translate(-50%, -8px);
  max-width: calc(100vw - 32px); width: max-content; padding: 12px 16px; border-radius: var(--r1);
  background: #2A2C20; color: #FBFAF2; font-size: 16px; line-height: 1.4; box-shadow: var(--sh2);
  opacity: 0; pointer-events: none; transition: opacity .2s ease-out, transform .2s ease-out;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--red); }

.err-page { min-height: 70vh; display: grid; place-content: center; justify-items: center; gap: 12px; text-align: center; padding: 16px; color: var(--ink-2); }

/* 弹层内容刷新时不重播动画 */
.still { animation: none !important; }
@keyframes sway { 0%, 100% { transform: rotate(-1.2deg); } 50% { transform: rotate(1.2deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (min-width: 520px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
