/* 橙子林样式（设计文档 §6）：颜色与刻度来自三站共享 token（决策 D10）。
   字体经 ../assets/fonts.css 继承主站本地字体；fixture 模式下静默回退系统字栈。 */
@import url("./tokens.css");

/* 橙子林特有：弹窗底色更实、举报用危险色、版心边距比主站窄 */
:root {
  --surface-strong: rgba(20, 16, 11, 0.92);
  --danger: #ff8f7a;
  --gutter: clamp(18px, 4vw, 40px);
}
html.light {
  --surface-strong: rgba(255, 252, 246, 0.96);
  --danger: #c2492f;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 0;
  background: var(--void);
  color: var(--text);
  font-family: var(--body);
  overflow-x: hidden;
  transition: background var(--dur-3) var(--ease-out), color var(--dur-3) var(--ease-out), border-color var(--dur-3) var(--ease-out);
}
body::selection { background: var(--orange); color: #000; }
html.light body::selection { color: #fff; }
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--orange-hot);
  outline-offset: 3px;
}
[hidden] { display: none !important; }

/* 视觉隐藏但保留在无障碍树里（不是 display:none） */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
/* canvas 的等价名单：键盘走到这里时浮出来，24 颗都能点开 */
.grove-list:focus-within {
  position: fixed;
  z-index: 60;
  left: max(16px, env(safe-area-inset-left));
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  width: auto; height: auto;
  max-height: min(56svh, 420px);
  margin: 0;
  padding: 10px;
  overflow-y: auto;
  clip: auto;
  display: grid;
  gap: 6px;
  white-space: normal;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--surface-strong);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  list-style: none;
}
html.light .grove-list:focus-within { background: #fffaf3; box-shadow: 0 24px 60px rgba(120, 66, 10, 0.24); }
.grove-list button {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: 0.8125rem;
  line-height: 1.6;
  text-align: left;
  cursor: pointer;
}
.grove-list button:hover { color: var(--text); border-color: var(--orange); }

/* ---------- 页头：与主站同一副骨架 ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 40;
  padding: 12px var(--gutter);
  background: rgba(0, 0, 0, 0.76);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  transition: background var(--dur-3) var(--ease-out);
}
html.light .site-header { background: rgba(250, 246, 239, 0.85); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1080px;
  margin: 0 auto;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-family: var(--display);
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.logo-mark { display: inline-flex; width: 28px; height: 28px; flex: none; }
.logo-mark svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 0 8px rgba(240, 135, 62, 0.35)); }
.logo-word { color: var(--text); }
.logo-sup {
  margin-left: 6px;
  padding: 2px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--orange);
  font-family: var(--label);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  vertical-align: 2px;
}
.nav-right { display: flex; align-items: center; gap: clamp(16px, 3vw, 36px); }
.icon-control {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--orange);
  cursor: pointer;
}
.icon-control::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 2px;
  border-radius: 2px;
  background: var(--orange);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-2) var(--ease-out);
}
.icon-control:hover { color: var(--orange-hot); }
.icon-control:hover::after { transform: scaleX(1); }
.theme-glyph { display: grid; place-items: center; width: 20px; height: 20px; }
.theme-glyph svg { display: block; width: 100%; height: 100%; transform: translateY(-2.5px); }

/* ---------- 页面骨架 ---------- */
.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: calc(var(--header-h) + 44px) var(--gutter) 24px;
}
.orchard-intro { max-width: 640px; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 22px;
  color: var(--text-soft);
  font-family: var(--label);
  font-size: var(--fs-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange-hot);
  box-shadow: 0 0 0 4px rgba(240, 135, 62, 0.18);
  animation: pulse 2.4s ease-in-out infinite;
  flex: none;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(240, 135, 62, 0.16); }
  50% { box-shadow: 0 0 0 6px rgba(240, 135, 62, 0.06); }
}
.orchard-intro h1 {
  margin: 0;
  font-size: clamp(38px, 6vw, 58px);
  line-height: 1.14;
  font-weight: 600;
  letter-spacing: -0.045em;
}
.orchard-lede {
  margin: 18px 0 0;
  font-size: 0.9375rem;
  line-height: 1.95;
  color: var(--text-soft);
}
.orchard-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 30px;
}
.plant-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 26px;
  border: 0;
  border-radius: 999px;
  background: var(--orange);
  color: #170d05;
  font-family: var(--body);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: box-shadow var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out);
}
.plant-cta:hover { box-shadow: 0 10px 32px rgba(240, 135, 62, 0.18); transform: translateY(-1px); }
.plant-cta:active { transform: translateY(0); }
.plant-cta:disabled { opacity: .5; cursor: default; }
html.light .plant-cta { background: #b8511a; color: #fff; }
.sort-toggle {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
}
.sort-btn {
  min-height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-soft);
  font-family: var(--body);
  font-size: 0.75rem;
  cursor: pointer;
  transition: background var(--dur-1), color var(--dur-1);
}
.sort-btn:hover { color: var(--text); background: var(--surface); }
.sort-btn.is-active { color: var(--orange); background: var(--surface); }
.orchard-hint {
  margin: 16px 0 0;
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

/* ---------- 果园画布 ---------- */
#groveSpace { position: relative; margin-top: 8px; }
#grove {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: manipulation;
}
.grove-status {
  min-height: 40px;
  margin: 4px 0 0;
  text-align: center;
  font-family: var(--label);
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  color: var(--text-muted);
}
/* 无限滚动哨兵与状态行分开：状态行带 role=status，拿它当哨兵每翻一页读屏就播一次 */
.grove-sentinel { height: 1px; }
.grove-empty {
  margin: 40px auto 8px;
  max-width: 460px;
  padding: 52px 32px;
  border: 1px dashed var(--line-strong);
  border-radius: 24px;
  text-align: center;
}
.empty-orb {
  width: 46px;
  height: 46px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, var(--orange-hot), var(--orange) 58%, var(--orange-deep));
  opacity: .55;
}
.empty-title { margin: 0; font-size: 1.0625rem; font-weight: 600; }
.empty-desc { margin: 10px 0 22px; font-size: 0.8125rem; line-height: 1.8; color: var(--text-soft); }
.retry-btn {
  min-height: 42px;
  padding: 0 22px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text-soft);
  font-size: 0.75rem;
  cursor: pointer;
  transition: color var(--dur-1), border-color var(--dur-1);
}
.retry-btn:hover { color: var(--orange); border-color: var(--orange); }

/* ---------- 弹窗 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
}
.overlay .scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(4px);
}
html.light .overlay .scrim { background: rgba(36, 20, 7, 0.38); }
.dialog {
  position: relative;
  width: min(440px, 100%);
  max-height: calc(100dvh - 48px);   /* 100vh 在移动 Safari 地址栏伸缩时虚高 */
  overflow: auto;
  padding: 26px 24px 24px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface-strong);
  backdrop-filter: blur(18px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  animation: dialog-in var(--dur-2) var(--ease-out);
}
html.light .dialog { box-shadow: 0 24px 80px rgba(120, 66, 10, 0.22); }
@keyframes dialog-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.dialog-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.dialog-close:hover { color: var(--text); background: var(--surface); }
.dialog-title { margin: 0 0 6px; font-size: 1.1875rem; font-weight: 600; letter-spacing: -0.02em; }
.dialog-desc { margin: 0 0 18px; font-size: 0.78125rem; line-height: 1.8; color: var(--text-muted); }

/* 橙子卡片 */
.card-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.card-orb {
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 50%;
  box-shadow: inset -4px -6px 12px rgba(0, 0, 0, 0.25), 0 6px 18px rgba(240, 135, 62, 0.2);
}
.card-meta { display: grid; gap: 3px; }
.card-nick { font-size: 0.875rem; font-weight: 600; }
.card-date { font-family: var(--label); font-size: var(--fs-xs); letter-spacing: 0.1em; color: var(--text-muted); }
.card-message {
  margin: 0 0 18px;
  font-size: 1rem;
  line-height: 1.9;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.card-stats { display: flex; gap: 12px; }
.stat-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text-soft);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: color var(--dur-1), border-color var(--dur-1), transform var(--dur-1);
}
.stat-btn span[aria-hidden] { color: var(--orange); font-size: 0.875rem; }
.stat-btn:hover:not(:disabled) { color: var(--text); border-color: var(--orange); transform: translateY(-1px); }
.stat-btn:disabled { opacity: .5; cursor: wait; }
/* 赞过 / 浇过：外观要有痕迹，否则下一次打开卡片看不出自己做过什么 */
.stat-btn.is-on {
  color: var(--orange);
  border-color: color-mix(in srgb, var(--orange) 55%, transparent);
  background: color-mix(in srgb, var(--orange) 12%, transparent);
}
.card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.text-btn {
  min-height: 36px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: color var(--dur-1);
}
.text-btn:hover { color: var(--text); }
.text-btn.danger:hover, .text-btn.danger[aria-expanded="true"] { color: var(--danger); }

/* 表单 */
.field { display: block; margin: 0 0 16px; }
.field-label {
  display: block;
  margin-bottom: 8px;
  font-family: var(--label);
  font-size: var(--fs-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
/* 字数计数跟在标签右侧，等宽数字避免输入时抖动 */
.field-count { float: right; color: var(--text-soft); letter-spacing: 0.06em; font-variant-numeric: tabular-nums; }
textarea, input[type="text"], input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--body);
  font-size: 0.875rem;
  line-height: 1.7;
  resize: vertical;
  transition: border-color var(--dur-1);
}
/* 只动边框，不碰 outline——焦点环是无障碍底线（范式 2.3） */
textarea:focus, input:focus { border-color: var(--orange); }
.hue-row { display: flex; align-items: center; gap: 14px; }
.hue-row input[type="range"] { flex: 1; accent-color: var(--orange); min-height: 32px; }
.hue-preview {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--orange);
  transition: background var(--dur-1);
}

body.modal-open { overflow: hidden; }
.dialog { overscroll-behavior: contain; }
.hue-row input[type="range"] { width: 100%; min-height: 44px; }
.plant-preview { display: flex; align-items: center; gap: 18px; margin: 4px 0 22px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.plant-preview .hue-preview { width: 60px; height: 60px; position: relative; flex: 0 0 60px; border: 0; box-shadow: inset -5px -7px 12px rgba(0,0,0,.12); }
.plant-preview .hue-preview::before { content: ''; position: absolute; top: -8px; left: 31px; width: 21px; height: 10px; border-radius: 100% 0 100% 0; background: var(--leaf); transform: rotate(-20deg); }
.plant-preview p { margin: 0; color: var(--text-soft); font-size: 0.875rem; line-height: 1.7; overflow-wrap: anywhere; }
.form-error {
  margin: 0 0 14px;
  font-size: 0.78125rem;
  line-height: 1.7;
  color: var(--danger);
}
.submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  background: var(--orange);
  color: #170d05;
  font-family: var(--body);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: box-shadow var(--dur-2) var(--ease-out);
}
.submit-btn:hover:not(:disabled) { box-shadow: 0 10px 32px rgba(240, 135, 62, 0.18); }
.submit-btn:disabled { opacity: .5; cursor: wait; }
html.light .submit-btn { background: #b8511a; color: #fff; }
.radio-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 2px;
  font-size: 0.875rem;
  color: var(--text-soft);
  cursor: pointer;
}
.radio-row input { accent-color: var(--orange); width: 16px; height: 16px; }
.radio-row:hover { color: var(--text); }

/* ---------- 提示与页脚 ---------- */
.toast-wrap {
  position: fixed;
  bottom: 26px;
  left: 50%;
  z-index: 70;
  display: grid;
  justify-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}
.toast-item {
  margin: 0;
  padding: 11px 20px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-strong);
  backdrop-filter: blur(14px);
  color: var(--text);
  font-size: 0.8125rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  animation: toast-in var(--dur-2) var(--ease-out);
}
html.light .toast-item { box-shadow: 0 12px 40px rgba(120, 66, 10, 0.2); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
.toast-item.is-out { opacity: 0; transform: translateY(6px); transition: opacity var(--dur-2), transform var(--dur-2); }
.no-script {
  margin: 30px auto;
  max-width: 460px;
  padding: 0 24px;
  text-align: center;
  font-size: 0.8125rem;
  line-height: 1.9;
  color: var(--text-soft);
}
.orchard-footer { padding: 56px 0 40px; text-align: center; }
.footer-small {
  margin: 0;
  font-family: var(--label);
  font-size: var(--fs-xs);
  letter-spacing: 0.22em;
  color: var(--text-muted);
}

@media (max-width: 560px) {
  /* 16px 以下 iOS 聚焦会自动放大页面，弹窗跟着跳 */
  /* 这里必须是 16px 而不是 1rem：根字号被用户调小时，rem 会掉回 16 以下，iOS 又开始自动放大 */
  .dialog input, .dialog textarea { font-size: 16px; }
  .page { padding-top: calc(var(--header-h) + 30px); }
  .orchard-actions { gap: 12px; }
  .plant-cta { flex: 1 1 100%; justify-content: center; }
  .sort-toggle { flex: 1; justify-content: center; }
  .sort-btn { flex: 1; }
  /* 触控目标：小屏上可点元素至少 44 像素（2026-09-29 体检后补） */
  .logo,
  .icon-control,
  .sort-btn,
  .retry-btn,
  .text-btn {
    min-height: 44px;
  }
  .icon-control { width: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none; }
  .dialog, .toast-item { animation: none; }
  .plant-cta, .stat-btn { transition: none; }
}

/* 登录/注册弹窗与登录态提示 */
.auth-tabs { margin: 4px 0 18px; }
.auth-tabs .sort-btn { flex: 1; }
#authForm .field:first-of-type { margin-top: 4px; }
.login-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 14px 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.login-hint b { color: var(--text-soft); font-weight: 600; }

/* 按下即反馈：与主站同一段（范式 4.3） */
@media (hover: hover) {
  :where(.plant-cta, .stat-btn, .submit-btn, .retry-btn, .dialog-close, .icon-control, .grove-list button):active {
    transform: scale(.97);
  }
}
