/* 全球农场 Global Farm — 手机 390px 优先，桌面最大宽 480px 居中。
 * 绿色田园配色；纯色底，不在花纹/图片背景上压文字。 */
* { box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  --green-dark: #1b5e20;
  --green: #2e7d32;
  --green-mid: #43a047;
  --green-light: #e8f5e9;
  --green-pale: #f1f8e9;
  --gold: #f9a825;
  --gold-light: #fff8e1;
  --soil: #8d6e63;
  --soil-light: #d7ccc8;
  --text: #263238;
  --muted: #607d8b;
  --border: #c8e6c9;
  --card: #ffffff;
  --danger: #c62828;
}

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

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: #c8e6c9;
  color: var(--text);
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
}

main { padding: 12px 14px 20px; background: var(--green-pale); min-height: calc(100vh - 120px); }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  background: var(--green); color: #fff;
  padding: 12px 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
}
.brand { font-size: 19px; font-weight: 700; flex: 1; white-space: nowrap; }
.brand-emoji { font-size: 22px; }
.coins {
  background: var(--gold-light); color: #5d4037;
  font-weight: 700; font-size: 16px;
  padding: 6px 12px; border-radius: 999px; white-space: nowrap;
}
.net { font-size: 13px; white-space: nowrap; }
.net.offline { color: #ffcc80; }

/* ---------- 提示条 ---------- */
.notice {
  background: #fff3e0; color: #e65100;
  border-bottom: 2px solid var(--gold);
  padding: 10px 14px; font-size: 14px; line-height: 1.5;
}

/* ---------- 通用 ---------- */
.section-title { font-size: 20px; margin: 6px 0 12px; }
.hint { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 8px 0; }
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px; margin: 14px 0;
  box-shadow: 0 1px 4px rgba(27, 94, 32, .08);
}
.card h3 { margin: 0 0 10px; font-size: 17px; }
.card p { margin: 8px 0; line-height: 1.6; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.row .btn { flex: 1; }
code { background: var(--green-light); padding: 2px 6px; border-radius: 6px; font-size: 13px; word-break: break-all; }

/* ---------- 按钮 ---------- */
.btn {
  min-height: 48px; padding: 10px 16px;
  font-size: 16px; font-family: inherit; cursor: pointer;
  border: none; border-radius: 12px;
  background: var(--green-light); color: var(--green-dark);
  transition: filter .15s;
}
.btn:active { filter: brightness(.92); }
.btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--green); color: #fff; }
.btn-accent { background: var(--gold); color: #3e2723; }
.btn-ghost { background: transparent; border: 2px solid var(--border); color: var(--green-dark); }
.btn-small { min-height: 40px; padding: 8px 12px; font-size: 15px; }
.btn-block { width: 100%; margin-top: 10px; }

/* ---------- 输入框 ---------- */
select {
  font-size: 16px; font-family: inherit; color: var(--text);
  min-height: 48px; padding: 10px 12px;
  border: 2px solid var(--border); border-radius: 10px;
  background: #fff; width: 100%;
}
select:focus { outline: none; border-color: var(--green-mid); }
input[type="text"], input[type="email"], input[type="number"] {
  font-size: 16px; font-family: inherit; color: var(--text);
  min-height: 48px; padding: 10px 12px;
  border: 2px solid var(--border); border-radius: 10px;
  background: #fff; width: 100%;
}
input:focus { outline: none; border-color: var(--green-mid); }
input[type="number"] { width: 76px; text-align: center; }

/* ---------- 农场地块 ---------- */
.plots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.plot {
  aspect-ratio: 1 / 1; border: none; cursor: pointer;
  border-radius: 14px; padding: 8px 4px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-family: inherit; color: var(--text);
  background: var(--soil-light); border: 2px dashed #a1887f;
}
.plot-emoji { font-size: 34px; line-height: 1; }
.plot-label { font-size: 15px; font-weight: 700; }
.plot-sub { font-size: 13px; color: var(--muted); }
.plot.growing { background: #c5e1a5; border: 2px solid var(--green-mid); }
.plot.ready { background: var(--gold-light); border: 2px solid var(--gold); animation: ready-pulse 1.2s ease-in-out infinite; }
.plot.ready .plot-sub { color: #e65100; font-weight: 700; }
@keyframes ready-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(249, 168, 37, .5); } 50% { box-shadow: 0 0 0 6px rgba(249, 168, 37, 0); } }

/* ---------- 仓库 ---------- */
.inv-row {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 0; border-bottom: 1px solid var(--green-light);
}
.inv-row:last-child { border-bottom: none; }
.inv-name { flex: 1; font-size: 16px; }
.inv-price { color: var(--muted); font-size: 14px; white-space: nowrap; }

/* ---------- 邻里 ---------- */
.hood-id { font-size: 13px; color: var(--muted); font-weight: 400; }
.members { list-style: none; margin: 0; padding: 0; }
.member {
  padding: 12px 10px; border-bottom: 1px solid var(--green-light);
  font-size: 16px; cursor: pointer; border-radius: 8px;
}
.member:last-child { border-bottom: none; }
.member.selected { background: var(--green-light); }
.member-me { color: var(--muted); font-size: 13px; }

/* ---------- 聊天 ---------- */
.chat-status { font-size: 13px; color: var(--muted); font-weight: 400; }
.chat-list {
  height: 260px; overflow-y: auto;
  background: var(--green-pale); border-radius: 10px;
  padding: 10px; display: flex; flex-direction: column; gap: 8px;
}
.chat-msg {
  max-width: 85%; align-self: flex-start;
  background: #fff; border: 1px solid var(--border);
  border-radius: 12px; padding: 8px 10px;
  display: flex; flex-direction: column; gap: 2px;
}
.chat-msg.mine { align-self: flex-end; background: #dcedc8; border-color: #a5d6a7; }
.chat-from { font-size: 12px; color: var(--muted); }
.chat-text { font-size: 15px; line-height: 1.5; word-break: break-word; }
.chat-text.translatable { cursor: pointer; }
.chat-translated-hint { font-size: 11px; color: var(--muted); cursor: pointer; }
.chat-time { font-size: 11px; color: var(--muted); text-align: right; }
.chat-input-row { display: flex; gap: 8px; margin-top: 10px; }
.chat-input-row input { flex: 1; }
.chat-input-row .btn { flex: 0 0 auto; }

/* ---------- 我的页 ---------- */
.magic-result { background: var(--green-light); border-radius: 10px; padding: 12px; margin-top: 12px; }
.magic-result a { color: var(--green-dark); word-break: break-all; font-size: 14px; }

/* ---------- 底部页签 ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 20;
  display: flex; background: #fff;
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, .08);
}
.tab-btn {
  flex: 1; border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 0 8px; font-size: 22px; font-family: inherit; color: var(--muted);
}
.tab-btn span { font-size: 13px; }
.tab-btn.active { color: var(--green); font-weight: 700; }

/* ---------- 种作物面板 ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(0, 0, 0, .45);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  width: 100%; max-width: 480px;
  background: #fff; border-radius: 18px 18px 0 0;
  padding: 18px 14px calc(18px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -4px 20px rgba(0, 0, 0, .2);
}
.sheet h3 { margin: 0 0 12px; font-size: 18px; }
.crop-menu { display: flex; flex-direction: column; gap: 8px; }
.crop-btn {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 56px; padding: 10px 12px;
  border: 2px solid var(--border); border-radius: 12px;
  background: var(--green-pale); cursor: pointer;
  font-family: inherit; color: var(--text); text-align: left;
}
.crop-btn:active { border-color: var(--green-mid); background: var(--green-light); }
.crop-emoji { font-size: 28px; }
.crop-name { font-size: 17px; font-weight: 700; flex: 1; }
.crop-meta { font-size: 13px; color: var(--muted); }

/* ---------- 提示气泡 ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%); z-index: 40;
  max-width: calc(100% - 32px);
  background: rgba(38, 50, 56, .94); color: #fff;
  font-size: 15px; line-height: 1.5; text-align: center;
  padding: 12px 18px; border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .3);
}
