﻿/* 9友地图 · 荒原视觉（纸面 / 铜器 / 手绘线稿） */

:root {
  --paper: #EFE4CC;
  --paper-deep: #E3D4B4;
  --paper-lit: #FBF3E2;
  --ink: #2C2419;
  --ink-soft: rgba(44, 36, 25, 0.66);
  --ink-faint: rgba(44, 36, 25, 0.4);
  --brass: #B08A4F;
  --brass-lt: #D8B77A;
  --moss: #3E4A38;
  --rust: #8C3B2B;
  --fog: #C9C2AE;
  --line: rgba(44, 36, 25, 0.18);
  --shadow: 0 10px 30px rgba(58, 44, 24, 0.18), 0 2px 6px rgba(58, 44, 24, 0.14);
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "SimSun", "STSong", serif;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

/* 关键：.overlay / .panel 自己写了 display，会盖掉 [hidden] 的默认 display:none */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;            /* 拖动地图时不要触发下拉刷新 */
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

a { color: var(--rust); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; color: inherit; }

#map {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}
#map:active { cursor: grabbing; }

/* 纸纹 */
.paper-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.22'/%3E%3C/svg%3E");
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(74, 56, 30, 0.22) 100%);
}

/* ── 顶部 ───────────────────────────────────────────── */
.chrome-top {
  position: fixed;
  top: 14px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
  z-index: 20;
}
.chrome-top > * { pointer-events: auto; }

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(251, 243, 226, 0.86);
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.brand-name { font-size: 19px; font-weight: 700; letter-spacing: 2px; }
.brand-sub { font-size: 11px; color: var(--ink-faint); letter-spacing: 3px; }

.counter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--ink-soft);
  background: rgba(251, 243, 226, 0.82);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(560px, 52vw);
}
.counter-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--brass);
  box-shadow: 0 0 0 3px rgba(176, 138, 79, 0.22);
  animation: breathe 3.4s var(--ease) infinite;
}
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 3px rgba(176, 138, 79, 0.18); }
  50% { box-shadow: 0 0 0 6px rgba(176, 138, 79, 0.05); }
}

.top-actions { display: flex; gap: 8px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 12px;
  background: rgba(251, 243, 226, 0.86);
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: background 0.2s var(--ease), transform 0.2s var(--ease);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.chip:hover { background: #fff; transform: translateY(-1px); }
.chip-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brass); }

/* ── 左侧孤屿导航 ───────────────────────────────────── */
.rail {
  position: fixed;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: rgba(251, 243, 226, 0.82);
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 20;
}
.rail-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 54px;
  padding: 8px 6px;
  font-size: 11px;
  white-space: nowrap;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.18s var(--ease);
}
.rail-item:hover, .rail-item.on {
  color: var(--ink);
  background: rgba(216, 183, 122, 0.22);
  border-color: var(--line);
}
.rail-glyph { font-size: 15px; line-height: 1; color: var(--brass); }

/* ── 右侧面板 ──────────────────────────────────────── */
.panel {
  position: fixed;
  right: 16px;
  top: 76px;
  bottom: 96px;
  width: clamp(300px, calc(300px * var(--fs)), 460px);
  display: flex;
  flex-direction: column;
  background: rgba(251, 243, 226, 0.94);
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  z-index: 22;
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1px;
}
.icon-btn {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  font-size: 17px; line-height: 1;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: pointer;
}
.icon-btn:hover { background: rgba(44, 36, 25, 0.07); }

.panel-filter { display: flex; gap: 6px; padding: 10px 14px; }
.seg {
  flex: 1;
  padding: 5px 0;
  font-size: 12px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 2px;
  cursor: pointer;
}
.seg.on { background: var(--brass); color: var(--paper-lit); border-color: var(--brass); }

.near-list { list-style: none; margin: 0; padding: 4px 8px 8px; overflow-y: auto; flex: 1; }
.near-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 6px;
  border-bottom: 1px dashed var(--line);
  cursor: pointer;
  transition: background 0.16s var(--ease);
}
.near-item:hover { background: rgba(216, 183, 122, 0.16); }
.near-avatar {
  width: 30px; height: 30px;
  flex: none;
  display: grid; place-items: center;
  font-size: 13px;
  color: var(--paper-lit);
  background: var(--ink-soft);
  border-radius: 50%;
}
.near-avatar.same { background: var(--brass); }
.near-main { flex: 1; min-width: 0; }
.near-name { font-size: 13px; display: flex; align-items: center; gap: 6px; }
.near-sub { font-size: 11px; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge-server {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 2px;
  border: 1px solid currentColor;
  opacity: 0.85;
  flex: none;
}
.badge-server.other { color: var(--ink-faint); }
.near-dist { font-size: 11px; color: var(--ink-faint); flex: none; }
.panel-note {
  margin: 0;
  padding: 9px 14px;
  font-size: 11px;
  color: var(--ink-faint);
  border-top: 1px solid var(--line);
}

/* ── 底部 ─────────────────────────────────────────── */
.dock {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 52px;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  width: max-content;
  max-width: calc(100vw - 24px);
  z-index: 21;
}
.btn {
  padding: 11px 22px;
  white-space: nowrap;
  font-size: 14px;
  letter-spacing: 1px;
  border-radius: 3px;
  border: 1px solid var(--ink);
  cursor: pointer;
  transition: transform 0.18s var(--ease), background 0.18s var(--ease), box-shadow 0.18s var(--ease);
  box-shadow: 0 6px 16px rgba(58, 44, 24, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn:hover { transform: translateY(-1.5px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--brass); color: #2A2113; border-color: #8A6A33; font-weight: 600; }
.btn-primary:hover { background: var(--brass-lt); }
.btn-ghost { background: rgba(251, 243, 226, 0.92); color: var(--ink); }
.btn-block { width: 100%; margin-top: 6px; }
.btn-small { padding: 8px 12px; font-size: 12px; background: var(--moss); color: var(--paper-lit); border-color: #2C362A; }
.btn:disabled { opacity: 0.42; cursor: not-allowed; transform: none; }
.btn-danger { background: var(--rust); color: var(--paper-lit); border-color: #6C2A1E; }

.foot {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: linear-gradient(to top, rgba(239, 228, 204, 0.99) 70%, rgba(239, 228, 204, 0.9));
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  padding: 7px 16px 9px;
  font-size: 10.5px;
  color: var(--ink-faint);
  background: linear-gradient(to top, rgba(239, 228, 204, 0.96), rgba(239, 228, 204, 0.4));
  z-index: 19;
}
.foot-links { display: flex; gap: 10px; flex-wrap: wrap; }
.foot-links a { color: var(--ink-soft); }
.foot { color: var(--ink-soft); }
.foot-map { opacity: 0.8; }
.foot-attrib { opacity: 0.8; }
.foot-contact { opacity: 0.85; }
.foot-contact a { color: var(--ink-soft); text-decoration: none; border-bottom: 1px dotted currentColor; }
.foot-contact a:hover { color: var(--brass); }

/* ── 弹层 ─────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  /* 卡片比视口高时（比如手机横屏、PC 小窗），让遮罩自己滚动，
     否则底部按钮会被顶出屏幕，用户看不到「登录」在哪 */
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px;
  background: rgba(44, 36, 25, 0.4);
  backdrop-filter: blur(2px);
  z-index: 60;
  animation: fade 0.18s var(--ease);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.card {
  width: min(460px, 100%);
  max-height: min(84vh, 720px);
  margin: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid #B9A57E;
  border-radius: 4px;
  box-shadow: 0 24px 60px rgba(40, 28, 12, 0.34);
  position: relative;
  animation: rise 0.22s var(--ease);
}
@keyframes rise { from { transform: translateY(10px) scale(0.99); opacity: 0; } to { transform: none; opacity: 1; } }
.card::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(44, 36, 25, 0.12);
  border-radius: 2px;
  pointer-events: none;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px 10px;
  border-bottom: 1px solid var(--line);
}
.card-head h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: 1px; }
/* min-height:0 是关键：flex 子项默认不肯缩到内容高度以下，
   缺了它卡片一旦超过 max-height 就会把底部按钮顶出屏幕（PC 登录就踩了这个坑） */
.card-body { padding: 16px 18px; overflow-y: auto; min-height: 0; flex: 1 1 auto; }
.card-foot {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--line);
}
.card-foot:empty { display: none; }

/* ── 表单 ─────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.form-hint { margin: 0 0 2px; font-size: 12px; color: var(--ink-faint); }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12px; color: var(--ink-soft); display: flex; align-items: baseline; gap: 6px; }
.field em { font-style: normal; font-size: 10.5px; color: var(--ink-faint); font-weight: 400; }
.field input, .field select {
  padding: 9px 11px;
  font-family: var(--serif);
  font-size: 14px;
  color: var(--ink);
  background: rgba(255, 252, 244, 0.9);
  border: 1px solid #C2AF8B;
  border-radius: 2px;
  outline: none;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.field input:focus, .field select:focus {
  border-color: var(--brass);
  box-shadow: 0 0 0 3px rgba(176, 138, 79, 0.16);
}
.field-row { display: flex; gap: 8px; align-items: flex-end; }
.field-row .grow { flex: 1; min-width: 0; }

/* 省 / 市 / 区县 三级选择 */
.region-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.region-row select { width: 100%; min-width: 0; padding: 9px 6px; font-size: 13px; }
.region-row select:disabled { opacity: 0.45; background: rgba(227, 212, 180, 0.5); }
.region-row.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 520px) {
  .region-row { grid-template-columns: 1fr 1fr; }
  .region-row select:last-child { grid-column: 1 / -1; }
}

.consent-box {
  margin: 4px 0 0;
  padding: 10px 12px;
  background: rgba(227, 212, 180, 0.42);
  border: 1px solid var(--line);
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.consent { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; line-height: 1.55; cursor: pointer; }
.consent input { margin: 2px 0 0; accent-color: var(--brass); flex: none; }
.consent span { color: var(--ink-soft); }
.consent a { color: var(--rust); }
.consent em { display: block; font-style: normal; font-size: 10.5px; color: var(--ink-faint); margin-top: 2px; }
.form-fine { margin: 2px 0 0; font-size: 10.5px; color: var(--ink-faint); }
.dev-hint {
  margin: 0;
  padding: 8px 10px;
  font-size: 12px;
  background: rgba(176, 138, 79, 0.16);
  border: 1px dashed var(--brass);
  border-radius: 2px;
}

/* 名片 */
.profile-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.profile-avatar {
  width: 46px; height: 46px; flex: none;
  display: grid; place-items: center;
  font-size: 18px; color: var(--paper-lit);
  background: var(--brass);
  border-radius: 50%;
  border: 1px solid #8A6A33;
}
.profile-name { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.profile-meta { font-size: 11.5px; color: var(--ink-faint); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }
.profile-bio { font-size: 13px; line-height: 1.7; color: var(--ink-soft); margin: 0 0 12px; }
.kv { display: grid; grid-template-columns: 74px 1fr; gap: 6px 10px; font-size: 12.5px; margin: 0 0 12px; }
.kv dt { color: var(--ink-faint); }
.kv dd { margin: 0; word-break: break-all; }
.tip {
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--ink-faint);
  border-left: 2px solid var(--brass);
  padding-left: 10px;
  margin: 12px 0 0;
}

/* ── Toast ────────────────────────────────────────── */
.toasts {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 110px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  z-index: 80;
  pointer-events: none;
}
.toast {
  padding: 9px 16px;
  font-size: 13px;
  color: var(--paper-lit);
  background: rgba(44, 36, 25, 0.92);
  border-radius: 3px;
  box-shadow: var(--shadow);
  animation: toastIn 0.24s var(--ease);
  max-width: 80vw;
  text-align: center;
}
.toast.warn { background: rgba(140, 59, 43, 0.95); }
.toast.ok { background: rgba(62, 74, 56, 0.95); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── 天气层 ───────────────────────────────────────── */
.weather-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 5;
}
.weather-layer::before,
.weather-layer::after {
  content: "";
  position: absolute;
  inset: -20%;
  opacity: 0;
  transition: opacity 1.2s var(--ease);
}

/* 晴：暖光 */
body[data-weather="clear"] .weather-layer::before {
  opacity: 1;
  background: radial-gradient(60% 45% at 72% 18%, rgba(255, 226, 156, 0.5), transparent 70%);
}

/* 云 */
body[data-weather="cloudy"] .weather-layer::before {
  opacity: 1;
  background: radial-gradient(45% 30% at 30% 22%, rgba(255, 255, 255, 0.35), transparent 70%),
              radial-gradient(50% 28% at 72% 30%, rgba(226, 214, 190, 0.45), transparent 70%);
}

/* 雾 */
body[data-weather="fog"] .weather-layer::before {
  opacity: 1;
  background: linear-gradient(to bottom, rgba(214, 206, 188, 0.62), rgba(226, 218, 200, 0.2) 55%, rgba(214, 206, 188, 0.5));
  filter: blur(2px);
  animation: fogDrift 40s linear infinite alternate;
}
@keyframes fogDrift { from { transform: translateX(-3%); } to { transform: translateX(3%); } }

/* 雨 / 雪：粒子由 js/fx.js 在 #fx 画布上绘制，这里只保留色调与天气氛围 */
body[data-weather="rain"] .weather-layer::after {
  opacity: 1;
  background: linear-gradient(to bottom, rgba(82, 98, 112, 0.16), rgba(64, 78, 92, 0.05));
}

/* 暴雨：压暗 + 偶发闪电，雨滴同样是粒子 */
body[data-weather="storm"] .weather-layer { background: rgba(38, 46, 56, 0.18); }
body[data-weather="storm"] .weather-layer::after {
  opacity: 1;
  background: radial-gradient(120% 80% at 50% 0%, rgba(30, 38, 48, 0.45), transparent 62%);
  animation: lightning 9s steps(1) infinite;
}
@keyframes lightning {
  0%, 95.4%, 100% { filter: none; }
  96% { filter: brightness(1.55); }
  96.3% { filter: none; }
  96.7% { filter: brightness(1.3); }
}

/* 雪：冷色偏移 + 压一点饱和度，让白色雪花在米色纸面上看得出来 */
body[data-weather="snow"] .weather-layer::after {
  opacity: 1;
  background: linear-gradient(to bottom, rgba(198, 214, 228, 0.34), rgba(186, 202, 218, 0.14));
}
body[data-weather="snow"] #map {
  filter: saturate(0.82) brightness(0.97) contrast(1.02);
}
/* 夜 */
body[data-night="1"] #map { filter: brightness(0.82) saturate(0.9); }
body[data-night="1"] .vignette {
  background: radial-gradient(120% 90% at 50% 45%, rgba(28, 36, 54, 0.1) 40%, rgba(24, 30, 44, 0.5) 100%);
}
body[data-night="1"] .weather-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 1;
  background-image:
    radial-gradient(1.4px 1.4px at 12% 18%, rgba(255, 248, 220, 0.9), transparent),
    radial-gradient(1.2px 1.2px at 68% 12%, rgba(255, 248, 220, 0.7), transparent),
    radial-gradient(1.6px 1.6px at 82% 34%, rgba(255, 248, 220, 0.8), transparent),
    radial-gradient(1.2px 1.2px at 32% 8%, rgba(255, 248, 220, 0.6), transparent);
  background-size: 420px 300px;
}

@media (prefers-reduced-motion: reduce) {
  .weather-layer::before, .weather-layer::after { animation: none !important; }
  .counter-dot { animation: none; }
}
body[data-reduce-motion="1"] .weather-layer::before,
body[data-reduce-motion="1"] .weather-layer::after { animation: none !important; }

/* ── 条款页 ───────────────────────────────────────── */
/* 主站把 html/body 锁成 overflow:hidden（地图页需要），条款页是长文，必须解锁，
   否则整页划不动。靠 <html class="legal-html"> 精确限定，不影响地图页。 */
html.legal-html,
html.legal-html body {
  height: auto;
  min-height: 100%;
  overflow: auto;
  overscroll-behavior-y: auto;
}
.legal-body {
  overflow: auto;
  height: auto;
  min-height: 100%;
  background: var(--paper);
  font-family: var(--serif);
  line-height: 1.85;
}
.legal-top {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px;
  background: rgba(239, 228, 204, 0.95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
  z-index: 3;
}
.legal-back { font-size: 13px; color: var(--ink-soft); }
.legal-brand { font-size: 13px; letter-spacing: 3px; color: var(--brass); }
.legal-wrap {
  display: grid;
  grid-template-columns: 190px minmax(0, 760px);
  gap: 32px;
  justify-content: center;
  padding: 28px 22px 80px;
}
.legal-nav { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 70px; align-self: start; }
.legal-nav a {
  padding: 7px 10px;
  font-size: 13px;
  color: var(--ink-soft);
  border-left: 2px solid transparent;
}
.legal-nav a.on { color: var(--ink); border-left-color: var(--brass); background: rgba(216, 183, 122, 0.18); }
.legal-doc h1 { font-size: 24px; margin: 0 0 6px; letter-spacing: 1px; }
.legal-doc h2 { font-size: calc(17px * var(--fs)); margin: 30px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.legal-doc h3 { font-size: 15px; margin: 20px 0 8px; }
.legal-doc p { font-size: calc(14px * var(--fs)); color: var(--ink-soft); margin: 9px 0; }
.legal-doc strong { color: var(--ink); }
.legal-doc ul, .legal-doc ol { padding-left: 22px; font-size: calc(14px * var(--fs)); color: var(--ink-soft); }
.legal-doc li { margin: 5px 0; }
.legal-doc blockquote {
  margin: 14px 0;
  padding: 10px 16px;
  background: rgba(216, 183, 122, 0.16);
  border-left: 3px solid var(--brass);
}
.legal-doc blockquote p { margin: 4px 0; }
.legal-doc code { font-size: 12.5px; background: rgba(44, 36, 25, 0.07); padding: 1px 5px; border-radius: 2px; }
.legal-doc pre { overflow-x: auto; background: rgba(44, 36, 25, 0.06); padding: 12px; border-radius: 2px; }
.legal-meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--ink-faint);
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--line);
}
.md-table { overflow-x: auto; margin: 14px 0; }
.md-table table { border-collapse: collapse; width: 100%; font-size: calc(13px * var(--fs)); }
.md-table th, .md-table td {
  border: 1px solid rgba(44, 36, 25, 0.16);
  padding: 7px 9px;
  text-align: left;
  vertical-align: top;
  color: var(--ink-soft);
}
.md-table th { background: rgba(216, 183, 122, 0.2); color: var(--ink); font-weight: 600; }

@media (max-width: 820px) {
  .legal-wrap { grid-template-columns: 1fr; }
  .legal-nav { position: static; flex-direction: row; flex-wrap: wrap; }
}

/* ── 小屏 ─────────────────────────────────────────── */
@media (max-width: 720px) {
  .brand-sub { display: none; }
  .counter { max-width: 40vw; font-size: 11.5px; }
  .chip { padding: 7px 9px; font-size: 11px; }
  .rail {
    left: 8px;
    top: auto;
    bottom: 108px;
    transform: none;
    flex-direction: row;
    padding: 6px;
  }
  .rail-item { width: 46px; font-size: 10px; }
  .panel {
    left: 8px; right: 8px; width: auto;
    top: auto; bottom: 96px; max-height: 46vh;
  }
  .dock { bottom: 44px; }
  .btn { padding: 10px 16px; font-size: 13px; }
  .foot { font-size: 9.5px; gap: 4px 10px; }
}

/* ── 天气粒子画布 ─────────────────────────────────── */
#fx {
  position: fixed;
  inset: 0;
  display: block;
  z-index: 6;
  pointer-events: none;
}

/* ── 右侧比例尺 / 缩放 ────────────────────────────── */
.zoom {
  position: fixed;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 70px;
  padding: 8px;
  background: rgba(251, 243, 226, 0.88);
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 23;
  transition: right 0.24s var(--ease);
}
body.panel-open .zoom { right: calc(32px + clamp(300px, calc(300px * var(--fs)), 460px)); }

.zoom-btn {
  width: 54px;
  height: 40px;
  display: grid;
  place-items: center;
  font-size: calc(15px * var(--fs));
  line-height: 1;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.16s var(--ease), color 0.16s var(--ease), transform 0.12s var(--ease);
}
.zoom-btn:hover { background: rgba(216, 183, 122, 0.26); color: var(--ink); border-color: var(--line); }
.zoom-btn:active { transform: scale(0.93); }
.zoom-reset { font-size: 11px; }

/* ══════════════════════════════════════════════════
   手机适配（<=720px）：安全区、触控尺寸、底部堆叠布局
   ══════════════════════════════════════════════════ */
@media (max-width: 720px) {
  html, body { height: 100dvh; }

  /* 顶部 */
  .chrome-top {
    top: calc(8px + env(safe-area-inset-top, 0px));
    left: 8px;
    right: 8px;
    gap: 6px;
  }
  .brand { padding: 7px 10px; flex: none; }
  .brand-name { font-size: 15px; letter-spacing: 0.5px; white-space: nowrap; }
  .brand-sub { display: none; }
  .counter {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 52vw;
    padding: 7px 10px;
    font-size: 11px;
    gap: 6px;
  }
  #counter-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chip { min-height: 34px; padding: 6px 9px; font-size: 11px; white-space: nowrap; }
  #btn-basemap { display: none; }   /* 手机上不占位置，底图信息在页脚 */
  .top-actions { flex: none; }

  /* 左：孤屿导航 → 底部横向条 */
  .rail {
    left: 8px;
    right: 8px;
    top: auto;
    bottom: calc(40px + env(safe-area-inset-bottom, 0px));
    transform: none;
    flex-direction: row;
    gap: 2px;
    padding: 5px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  .rail::-webkit-scrollbar { display: none; }
  .rail-item {
    flex: 1 0 auto;
    min-width: 46px;
    padding: 6px 4px;
    font-size: 10px;
    min-height: 46px;
    justify-content: center;
  }
  .rail-glyph { font-size: 16px; }

  /* 底部按钮 → 浮在导航条上方 */
  .dock {
    bottom: calc(112px + env(safe-area-inset-bottom, 0px));
    gap: 8px;
  }
  .btn { min-height: 44px; padding: 11px 20px; font-size: 14px; }
  .btn-small { min-height: 36px; padding: 8px 12px; }

  /* 右侧缩放 / 设置 */
  .zoom {
    top: auto;
    bottom: calc(178px + env(safe-area-inset-bottom, 0px));
    right: 8px;
    transform: none;
    width: 58px;
    padding: 5px;
  }
  .zoom-btn { width: 46px; height: 40px; font-size: calc(16px * var(--fs)); }
  body.panel-open .zoom { right: 8px; opacity: 0; pointer-events: none; }

  /* 雷达面板 → 底部抽屉 */
  .panel {
    left: 8px;
    right: 8px;
    top: auto;
    bottom: calc(178px + env(safe-area-inset-bottom, 0px));
    width: auto;
    max-height: 48dvh;
  }
  .near-list { -webkit-overflow-scrolling: touch; }

  /* 页脚：手机上法律链接收进「条款」，只留三行必要信息 */
  .foot {
    padding: 5px 8px calc(12px + env(safe-area-inset-bottom, 0px));
    font-size: 9px;
    gap: 2px 6px;
    line-height: 1.45;
  }
  .foot-links { display: none; }
  .foot-map { display: none; }
  /* 手机端只保留「非官方声明 + 审图号」一行；法律链接走「条款」，联系邮箱在法律页内 */
  .foot-contact { display: none; }
  .foot-attrib { font-size: 9px; }

  /* 弹层全宽、可滚动 */
  .overlay { padding: 10px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
  .card {
    width: 100% !important;
    max-height: 88dvh;
    border-radius: 4px;
  }
  .card-body {
    padding: 14px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .card-foot { padding: 10px 14px calc(12px + env(safe-area-inset-bottom, 0px)); flex-wrap: wrap; }
  .card-foot .btn { flex: 1 1 auto; }

  /* iOS 聚焦输入框会自动放大页面：移动端统一 16px */
  .field input, .field select, .char-search, .char-select, .region-row select {
    font-size: 16px !important;
  }
  .consent { font-size: 13px; }
  .consent input { width: 18px; height: 18px; }

  .toasts { bottom: calc(212px + env(safe-area-inset-bottom, 0px)); }
  .toast { font-size: 13px; padding: 10px 15px; }

  /* 触控时不要出现粘滞 hover */
  .btn:hover, .chip:hover, .rail-item:hover, .zoom-btn:hover, .near-item:hover {
    transform: none;
    background: inherit;
  }
  .btn-primary:hover { background: var(--brass); }
  .chip:hover { background: rgba(251, 243, 226, 0.86); }
}

/* 小屏（<380px）：页脚只留非官方声明 */
@media (max-width: 380px) {
  .foot-links { display: none; }
  .counter { max-width: 34vw; }
  .rail-item { min-width: 42px; font-size: 9.5px; }
}

/* 横屏矮屏：压缩上下留白 */
@media (orientation: landscape) and (max-height: 520px) {
  .rail { bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
  .dock { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .zoom { bottom: calc(136px + env(safe-area-inset-bottom, 0px)); }
  .panel { bottom: calc(128px + env(safe-area-inset-bottom, 0px)); max-height: 50dvh; }
  .foot { display: none; }
  .card { max-height: 92dvh; }
}

/* ── 触控细节（全端通用） ─────────────────────────── */
button, .btn, .chip, .rail-item, .seg, .set-seg button, .link-btn {
  touch-action: manipulation;          /* 去掉双击缩放的 300ms 等待 */
  -webkit-touch-callout: none;         /* 长按不弹系统菜单 */
}
.chrome-top, .rail, .dock, .panel, .zoom, .foot {
  user-select: none;
  -webkit-user-select: none;
}
#map { -webkit-user-drag: none; }

/* ══ 补齐：公告 / 设置 / 角色选择器 / 字号 / 登录同意 ══ */

/* 字号档位（--fs 是所有文字缩放的基准） */
html { --fs: 1.15; }
html[data-font="s"] { --fs: 1; }
html[data-font="m"] { --fs: 1.15; }
html[data-font="l"] { --fs: 1.4; }
html[data-font="xl"] { --fs: 1.7; }
html[data-font="l"] .card { width: min(540px, 100%); }
html[data-font="xl"] .card { width: min(620px, 100%); }

.brand-name { font-size: calc(19px * var(--fs)); }
.brand-sub { font-size: calc(11px * var(--fs)); }
.counter { font-size: calc(13px * var(--fs)); }
.chip { font-size: calc(12px * var(--fs)); }
.rail-item { font-size: calc(11px * var(--fs)); }
.rail-glyph { font-size: calc(15px * var(--fs)); }
.panel-head h2 { font-size: calc(14px * var(--fs)); }
.seg { font-size: calc(12px * var(--fs)); }
.near-name { font-size: calc(13px * var(--fs)); }
.near-sub { font-size: calc(11px * var(--fs)); }
.badge-server { font-size: calc(10px * var(--fs)); }
.near-dist { font-size: calc(11px * var(--fs)); }
.panel-note { font-size: calc(11px * var(--fs)); }
.btn { font-size: calc(14px * var(--fs)); }
.btn-small { font-size: calc(12px * var(--fs)); }
.foot { font-size: calc(10.5px * var(--fs)); }
.card-head h2 { font-size: calc(16px * var(--fs)); }
.field > span { font-size: calc(12px * var(--fs)); }
.field input, .field select { font-size: calc(14px * var(--fs)); }
.field em { font-size: calc(10.5px * var(--fs)); }
.consent { font-size: calc(12px * var(--fs)); }
.consent em { font-size: calc(10.5px * var(--fs)); }
.form-hint { font-size: calc(12px * var(--fs)); }
.form-fine { font-size: calc(10.5px * var(--fs)); }
.profile-bio { font-size: calc(13px * var(--fs)); }
.profile-name { font-size: calc(16px * var(--fs)); }
.profile-meta { font-size: calc(11.5px * var(--fs)); }
.kv { font-size: calc(12.5px * var(--fs)); }
.tip { font-size: calc(11.5px * var(--fs)); }
.toast { font-size: calc(13px * var(--fs)); }
.dev-hint { font-size: calc(12px * var(--fs)); }

/* 关闭纸面纹理 */
body.no-grain .paper-grain { display: none; }

/* 左栏未读红点 */
.rail-item { position: relative; }
.rail-dot {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--rust);
  box-shadow: 0 0 0 2px rgba(251, 243, 226, 0.9);
}

/* 登录页：一键同意 */
.consent-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 2px 0 -4px;
  font-size: calc(11.5px * var(--fs));
  color: var(--ink-faint);
}
.link-btn {
  padding: 2px 0;
  font-family: var(--serif);
  font-size: calc(12px * var(--fs));
  color: var(--rust);
  background: transparent;
  border: 0;
  border-bottom: 1px dashed rgba(140, 59, 43, 0.5);
  border-radius: 0;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

/* 公告 */
.notice-list { display: flex; flex-direction: column; gap: 10px; }
.notice {
  padding: 11px 13px;
  background: rgba(255, 252, 244, 0.7);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brass);
  border-radius: 2px;
}
.notice.warn { border-left-color: #C08A3E; background: rgba(216, 183, 122, 0.16); }
.notice.important { border-left-color: var(--rust); background: rgba(140, 59, 43, 0.07); }
.notice-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 5px; }
.notice-head strong { font-size: calc(14px * var(--fs)); font-weight: 600; }
.notice-head time { margin-left: auto; font-size: calc(10.5px * var(--fs)); color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.notice .pin {
  font-style: normal;
  font-size: calc(10px * var(--fs));
  padding: 1px 5px;
  color: var(--paper-lit);
  background: var(--brass);
  border-radius: 2px;
}
.notice p { margin: 0; font-size: calc(12.5px * var(--fs)); line-height: 1.75; color: var(--ink-soft); }

/* 设置 */
.set-h { margin: 16px 0 8px; font-size: calc(12px * var(--fs)); font-weight: 600; letter-spacing: 1px; color: var(--ink-soft); }
.set-h:first-child { margin-top: 0; }
.set-seg { display: flex; gap: 6px; }
.set-seg button {
  flex: 1;
  padding: 8px 0;
  font-size: calc(13px * var(--fs));
  color: var(--ink-soft);
  background: rgba(255, 252, 244, 0.7);
  border: 1px solid var(--line);
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.16s var(--ease);
}
.set-seg button:hover { background: rgba(216, 183, 122, 0.2); }
.set-seg button.on { color: var(--paper-lit); background: var(--brass); border-color: var(--brass); }
.set-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 10px;
  background: rgba(227, 212, 180, 0.28);
  border: 1px solid var(--line);
  border-radius: 2px;
}
.set-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 2px;
  font-size: calc(13px * var(--fs));
  color: var(--ink-soft);
  cursor: pointer;
}
.set-row input { accent-color: var(--brass); width: 15px; height: 15px; }

.zoom-sep { display: block; width: 30px; height: 1px; margin: 3px 0; background: var(--line); }

/* 本命角色选择器 */
.char-search {
  width: 100%;
  margin-bottom: 6px;
  padding: 7px 10px;
  font-family: var(--serif);
  font-size: calc(13px * var(--fs));
  color: var(--ink);
  background: rgba(255, 252, 244, 0.92);
  border: 1px solid #C2AF8B;
  border-radius: 2px;
  outline: none;
}
.char-search:focus { border-color: var(--brass); box-shadow: 0 0 0 3px rgba(176, 138, 79, 0.16); }
.char-select {
  width: 100%;
  padding: 4px;
  font-family: var(--serif);
  font-size: calc(13px * var(--fs));
  color: var(--ink);
  background: rgba(255, 252, 244, 0.92);
  border: 1px solid #C2AF8B;
  border-radius: 2px;
  outline: none;
}
.char-select optgroup { font-weight: 600; color: var(--ink-faint); }
.char-select option { padding: 3px 6px; }
.char-select option:checked { background: var(--brass); color: var(--paper-lit); }

.char-current {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 7px;
  padding: 6px 9px;
  font-size: calc(12px * var(--fs));
  color: var(--ink-faint);
  background: rgba(216, 183, 122, 0.16);
  border: 1px solid var(--line);
  border-radius: 2px;
}
.char-current-name { font-size: calc(14px * var(--fs)); font-weight: 600; color: var(--ink); }
.char-current-name.empty { font-weight: 400; color: var(--ink-faint); }
.char-clear { margin-left: auto; }

/* ── 使用指南的表格 ───────────────────────────────── */
.guide-table {
  width: 100%;
  margin: 12px 0 16px;
  border-collapse: collapse;
  font-size: calc(13.5px * var(--fs));
  color: var(--ink-soft);
}
.guide-table th,
.guide-table td {
  padding: 7px 10px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.guide-table th { background: rgba(176, 138, 79, 0.1); color: var(--ink); font-weight: 600; }
.guide-table td strong { color: var(--ink); }
@media (max-width: 720px) {
  .guide-table { font-size: calc(12.5px * var(--fs)); }
  .guide-table th, .guide-table td { padding: 6px 7px; }
}
.legal-foot-note { margin-top: 26px; padding-top: 12px; border-top: 1px solid var(--line); font-size: calc(12.5px * var(--fs)); color: var(--ink-faint); }
.form-note {
  margin: 0 0 10px;
  padding: 8px 10px;
  font-size: calc(12px * var(--fs));
  color: var(--ink-soft);
  background: rgba(176, 138, 79, 0.08);
  border-left: 2px solid var(--brass);
  border-radius: 2px;
}

/* ── 新手引导的三步 ───────────────────────────────── */
.guide-steps {
  margin: 10px 0 12px;
  padding-left: 20px;
  font-size: calc(13.5px * var(--fs));
  color: var(--ink-soft);
  line-height: 1.75;
}
.guide-steps li { margin-bottom: 8px; }
.guide-steps b { color: var(--ink); }

/* 提交时缺同意项：让条款框闪一下，指明要勾哪里 */
@keyframes consentFlash {
  0%, 100% { background: transparent; box-shadow: none; }
  25% { background: rgba(140, 59, 43, 0.1); box-shadow: 0 0 0 2px rgba(140, 59, 43, 0.35); }
  60% { background: rgba(140, 59, 43, 0.06); box-shadow: 0 0 0 2px rgba(140, 59, 43, 0.2); }
}
.consent-box.flash { animation: consentFlash 0.9s ease 2; border-radius: 3px; }