/* 门户、园区和顾问工作台共用的界面颜色。 */
:root {
  --site-brand: #137c6c;
  --site-strong: #105e53;
  --site-tint: #e8f5f1;
  --site-outgoing: #d6eee6;
  --site-bg: #f3f7f6;
  --site-surface: #fff;
  --site-ink: #203734;
  --site-secondary: #455f59;
  --site-muted: #586e68;
  --site-line: #d6e4de;
  --site-input: #f6f9f8;
  --site-header: linear-gradient(115deg, #d9f1e9, #f0f8f5 68%, #fff);
  --site-card: 16px;
  --site-control: 12px;
}
:where(button, a, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--site-brand);
  outline-offset: 2px;
}

@media (hover:none), (pointer:coarse) {
  html { -webkit-text-size-adjust:100%; text-size-adjust:100%; overscroll-behavior:none; }
  body { overscroll-behavior:none; }
  main, header, footer, nav, dialog, .sheet, .drawer, .app { touch-action:pan-x pan-y; }
  input:not([type=checkbox]):not([type=radio]):not([type=range]), textarea, select {
    font-size:max(16px, 1rem) !important;
  }
  .view, .drawer-b, .sheet, .sheet-body, #conversation, #msgs, #content, .chat-log, dialog {
    overscroll-behavior:contain;
  }
  html:has(body.lock),html:has(dialog[open]),html:has(#chat-sheet:not([hidden])),
  body.lock, body:has(dialog[open]),body:has(#chat-sheet:not([hidden])) { overflow:hidden; overscroll-behavior:none; }
}
@media (hover:none), (pointer:coarse) {
  html:has(#v-park.active), body:has(#v-park.active) { overflow:hidden; }
  body.lock #chat:not([hidden]), body:has(#chat-sheet:not([hidden])) #chat-sheet {
    bottom:var(--keyboard-inset, 0px); max-height:min(100dvh, var(--visible-height, 100dvh));
  }
}

/* 图形和点按范围分别设定。园区封面保留白色箭头，以便叠在照片上。 */
:root {
  --site-hit: 44px;
  --site-close-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m3 3 10 10M13 3 3 13' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round'/%3E%3C/svg%3E");
  --site-back-mark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m16 3.5-8.5 8.5 8.5 8.5' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.elder { --site-hit: 48px; }
:is(#app .topbar-back, #app .pf-back, .advisor-page .topbar .back, .wecom-page .topbar .back, .topbar #back) {
  position: relative;
  box-sizing: border-box;
  flex: none;
  width: var(--site-hit);
  height: var(--site-hit);
  padding: 0;
  border: 0;
  border-radius: var(--site-control);
  background: transparent;
  color: var(--site-strong);
  font-size: 0;
}
:is(#app .topbar-back, #app .pf-back, #site .hero-bar .back) > svg { visibility: hidden; }
:is(#app .topbar-back, #app .pf-back, #site .hero-bar .back, .advisor-page .topbar .back, .wecom-page .topbar .back, .topbar #back)::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 22px;
  height: 22px;
  margin: auto;
  background: currentColor;
  -webkit-mask: var(--site-back-mark) center / contain no-repeat;
  mask: var(--site-back-mark) center / contain no-repeat;
  pointer-events: none;
}
:is(#chat .dialog-head .close, #sheet .dialog-head .close, .icon-btn[aria-label="关闭"], #chat-close, .leave-x) {
  box-sizing: border-box;
  flex: none;
  width: var(--site-hit);
  height: var(--site-hit);
  padding: 0;
  border: 0;
  border-radius: var(--site-control);
  color: var(--site-secondary);
  background: radial-gradient(circle, var(--site-bg) 13px, transparent 13.7px);
  font-size: 0;
}
:is(#chat .dialog-head .close, #sheet .dialog-head .close, .icon-btn[aria-label="关闭"], #chat-close) { position: relative; }
.icon-btn[aria-label="关闭"] > svg { visibility: hidden; }
:is(#chat .dialog-head .close, #sheet .dialog-head .close, .icon-btn[aria-label="关闭"], #chat-close, .leave-x)::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 16px;
  height: 16px;
  margin: auto;
  background: currentColor;
  -webkit-mask: var(--site-close-mark) center / contain no-repeat;
  mask: var(--site-close-mark) center / contain no-repeat;
  pointer-events: none;
}
:is(.topbar-back, .pf-back, .topbar .back):active { background-color: var(--site-tint); }
.site-registration a { display: inline-flex; align-items: center; min-height: var(--site-hit); }

/* A field has one focus indicator. Grouped fields put it on their shared shell. */
:root { --field-focus: var(--site-brand); }
:is(input:not([type]), input:is([type="text"],[type="search"],[type="tel"],[type="email"],[type="url"],[type="password"],[type="number"],[type="date"],[type="time"],[type="datetime-local"]), textarea, select):focus {
  border-color:var(--field-focus) !important;
  box-shadow:none !important;
  outline:2px solid var(--field-focus) !important;
  outline-offset:-2px !important;
}
:is(.portal-search,.search-pill,.searchbox,.city-sbox,.mp-query,.member-input):focus-within {
  outline:none !important;
  box-shadow:none !important;
}
:is(.portal-search,.search-pill,.searchbox,.city-sbox,.mp-query,.member-input):has(> input:focus) {
  border-color:var(--field-focus) !important;
  outline:2px solid var(--field-focus) !important;
  outline-offset:-2px !important;
}
:is(.portal-search,.search-pill,.searchbox,.city-sbox,.mp-query,.member-input) > input:focus {
  border:0 !important;
  outline:none !important;
  box-shadow:none !important;
}
:is(h1,h2,h3,.drawer-h .t,.talk-head)[tabindex="-1"]:focus {outline:none}
@media (forced-colors:active) {
  :root { --field-focus: Highlight; }
}
/* Let the list search field and its clear button receive taps directly. */
.search-pill::after {pointer-events:none}

/* ==========================================================================
   全站界面统一（终检轮）——共享层，所有页面与城市共用，不含任何单园内容
   原则：沿用上方 --site-* 变量；不改变任何元素的位置/可点击性；只调间距、层次、对比度
   ========================================================================== */

/* 1 首页（保持区县 3 列稳定网格：不横滑、不居中、不位移；仅压缩间距与加强选中对比） */
#v-home .hm-chips { gap:6px; margin-bottom:12px; }
#v-home .hm-chips button { min-height:38px; font-weight:600; color:var(--site-secondary); }
#v-home .hm-chips button[aria-selected="true"],
#v-home .hm-chips button.on,
#v-home .hm-chips button.active { background:var(--site-strong); color:#fff; font-weight:700; }
.channel-features button { min-height:92px; }
.channel-features { margin-bottom:2px; }

/* 2 列表：园名最多两行；标签与地址层次低于园名；地址对比度达标 */
#v-list .park-card .name { white-space:normal; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; line-height:1.38; }
#v-list .ls-tags .tag { background:var(--site-tint); color:var(--site-strong); font-weight:500; }
#v-list .ls-addr { color:var(--site-muted); }
#v-list .ls-foot .ls-price { color:var(--site-muted); }

/* 2 地图：标签不超出图区（JS 同步做边缘内收），选中项在最上层 */
#v-map #mp-plot button { max-width:44%; }
#v-map #mp-plot { overflow:hidden; }

/* 3 详情：首屏只保留与底栏不重复的动作（“咨询费用”与底栏“在线咨询”重复，费用提问已在墓型卡里） */
@media (max-width:640px) {
  .park-choices [data-ask] { display:none; }
  .park-choices button { min-height:44px; }
  .finish .adv-stack { display:none; }           /* 顾问头像条与“选墓顾问”模块重复 */
  body:has(.dock) .park-footer { padding-bottom:calc(76px + env(safe-area-inset-bottom,0px)); } /* 底栏不盖页脚 */
}

/* 4 聊天：明确“谁在说话”——自助答复 / 顾问姓名 / 你 */
#messages .bubble.bot:not(.human-reply)::before { content:"自助答复"; display:block; margin-bottom:3px; font-size:12px; font-weight:600; color:var(--site-muted); }
#messages .bubble.human-reply > strong { display:block; margin-bottom:3px; font-size:12px; color:var(--site-brand); }

/* 7 表单/弹层：提交按钮固定在弹层底部，键盘打开时不被挡；失败时已填内容由原逻辑保留 */
#sheet .booking button.primary.full,
#sheet form button.primary.full { position:sticky; bottom:0; z-index:2; box-shadow:0 -10px 14px -6px #ffffffee, 0 0 0 6px #fff; }
#sheet .preview-status { scroll-margin-bottom:84px; }
#sheet label.form-label, #sheet .form-label { font-size:14px; font-weight:600; color:var(--site-ink); }
/* 错误态只在用户操作过该字段（失焦/提交）后出现，首次打开不预先标红；已填内容由原逻辑保留 */
#sheet .field:user-invalid, #sheet .field[aria-invalid="true"] { border-color:#b4473c; box-shadow:0 0 0 1px #b4473c; }
#sheet .preview-status[role="status"]:not([hidden]) { padding:8px 10px; border-radius:10px; background:var(--site-tint); color:var(--site-strong); }

/* 通用：图标按钮与关闭热区不低于 44px（沿用 --site-hit），键盘焦点保持可见 */
.icon-btn, .close, [data-close] { min-width:var(--site-hit,44px); min-height:var(--site-hit,44px); }

/* ==========================================================================
   加载 / 慢网 / 失败 · 整页与区块统一状态（青绿双叶 + 金日 + 浅色曲线）
   用在：园区 iframe 占位、首图与图片占位、相册大图、unavailable 整页
   ========================================================================== */
.app-state { display:grid; place-items:center; gap:12px; text-align:center; padding:26px 18px; }
.app-state-art { width:min(78vw,300px); aspect-ratio:2.5; background:url('/app/ui/media/states/loading.svg') center/contain no-repeat; }
.app-state[data-state="delayed"] .app-state-art { background-image:url('/app/ui/media/states/delayed.svg'); }
.app-state[data-state="unavailable"] .app-state-art { background-image:url('/app/ui/media/states/unavailable.svg'); }
.app-state-title { margin:0; font-size:18px; font-weight:700; color:var(--site-strong,#105e53); letter-spacing:.01em; }
.app-state-copy { margin:0; max-width:34em; font-size:14.5px; line-height:1.65; color:var(--site-secondary,#455f59); }
.app-state-acts { display:flex; gap:10px; flex-wrap:wrap; justify-content:center; margin-top:2px; }
.app-state-acts button, .app-state-acts a { min-height:46px; display:inline-flex; align-items:center; justify-content:center; padding:0 20px; border-radius:13px; font:inherit; font-weight:650; text-decoration:none; }
.app-state-acts .primary { background:var(--site-brand,#137c6c); color:#fff; border:0; cursor:pointer; }
.app-state-acts .ghost { background:#fff; color:var(--site-strong,#105e53); border:1px solid #cfe0d7; cursor:pointer; }
.app-state-page { min-height:100svh; min-height:100dvh; display:grid; place-items:center; padding:24px 18px; background:radial-gradient(120% 80% at 50% 0%,#eaf6f1,#f4f8f6 60%); }
.app-state-page .app-state { max-width:420px; }
.app-state-page .app-state-art { width:min(88vw,360px); aspect-ratio:2.2; }
/* 图片占位统一走同一张图（原规则已引用 states/*.svg，此处只统一其尺寸与留白） */
img:is([data-media-park],[data-story-slot]) { background-color:#e9f2ec; }
/* 减弱动效：不出现脉冲/旋转 */
@media (prefers-reduced-motion: reduce) {
  .app-state-art, .photo-graphic, .pf-photo { animation:none !important; transition:none !important; }
}

body[data-page-unavailable] {
  margin:0; background:#f4f8f6; font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;
}
body[data-page-unavailable] *, body[data-page-unavailable] *::after { box-sizing:border-box; }
.app-state-page { width:100%; box-sizing:border-box; }
.app-state-page .app-state { min-width:0; width:min(100%,420px); padding:24px 12px; }
.app-state-art { position:relative; max-width:100%; }
.app-state-art::after {
  content:""; position:absolute; left:50%; top:42%; transform:translate(-50%,-50%);
  width:clamp(58px,19vw,78px); aspect-ratio:1; border-radius:24%;
  background:url('/app/ui/icons/app-icon.svg') center/cover no-repeat;
}
#site :is(.hero,.lightbox) .photo-graphic { width:min(60vw,210px); height:84px; max-width:100%; }
#site :is(.hero,.lightbox) .photo-emblem {
  left:50%; top:42%; width:60px; height:60px; transform:translate(-50%,-50%);
}
