/* ============================================================
 * look_bird · style.css
 * 浅色 / 深色双主题；简笔画小鸟纹样由 JS 以 SVG data-URI 写入 --bird-pattern
 * ============================================================ */

:root {
  --bg: #f4f7f1;
  --panel: #ffffff;
  --panel-2: #eef3ea;
  --text: #21301f;
  --muted: #6d7c69;
  --border: #dde5d8;
  --accent: #3f7d4e;
  --accent-2: #2f6140;
  --accent-soft: #e7f1e8;
  --danger: #b93a2c;
  --warn: #a9750a;
  --ok: #2e7d32;
  --shadow: 0 2px 10px rgba(30, 55, 32, .08);
  --radius: 12px;
  --bird-opacity: .55;
  --bird-pattern: none;
}

html[data-theme="dark"] {
  --bg: #121814;
  --panel: #1b231c;
  --panel-2: #212b22;
  --text: #e4ede1;
  --muted: #98a795;
  --border: #2c382d;
  --accent: #7cc08d;
  --accent-2: #a9d8b6;
  --accent-soft: #22301f;
  --danger: #e08578;
  --warn: #d9ac3a;
  --ok: #7cc08d;
  --shadow: 0 2px 12px rgba(0, 0, 0, .45);
  --bird-opacity: .18;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  color: var(--text);
  background-color: var(--bg);
  background-image: var(--bird-pattern);
  background-repeat: repeat;
  background-size: 168px 168px;
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 10px; line-height: 1.3; font-weight: 700; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0 0 10px; }

/* ---------------- 头部 ---------------- */
header.site-header {
  position: sticky;
  top: 0;
  z-index: 900;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(6px);
}

.hdr {
  max-width: 1240px;
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 9px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand svg { display: block; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.15; }
.brand-txt strong { font-size: 15px; letter-spacing: .5px; }
.brand-txt small { color: var(--muted); font-size: 11px; }

nav.nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1 1 auto; }
nav.nav a {
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}
nav.nav a:hover { background: var(--accent-soft); color: var(--accent-2); text-decoration: none; }
nav.nav a.active { background: var(--accent); color: #fff; }
html[data-theme="dark"] nav.nav a.active { color: #10210f; }

.hdr-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.school-pick { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.school-pick select { max-width: 190px; }

/* ---------------- 通用控件 ---------------- */
select, input, textarea, button { font-family: inherit; font-size: 13px; }

select, input[type="text"], input[type="number"], input[type="password"], input[type="datetime-local"], input[type="date"], input[type="search"], textarea {
  width: 100%;
  padding: 7px 9px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
}
select:focus, input:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 76px; resize: vertical; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 12px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  color: #fff;
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.btn:hover { background: var(--accent-2); text-decoration: none; }
.btn.ghost { color: var(--text); background: var(--panel); border-color: var(--border); }
.btn.ghost:hover { background: var(--accent-soft); color: var(--accent-2); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { filter: brightness(.92); }
.btn.small { padding: 3px 9px; font-size: 12px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.badge {
  display: inline-block;
  padding: 1px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.badge.ok { color: var(--ok); border-color: var(--ok); }
.badge.pending { color: var(--warn); border-color: var(--warn); }
.badge.rejected { color: var(--danger); border-color: var(--danger); }
.badge.admin { color: var(--accent-2); border-color: var(--accent); background: var(--accent-soft); }

/* ---------------- 布局 ---------------- */
main.container { max-width: 1240px; margin: 0 auto; padding: 18px 16px 40px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}
.card > h2 { display: flex; align-items: center; gap: 8px; }
.card-sub { color: var(--muted); font-size: 12px; margin: -4px 0 12px; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
}

.stat { text-align: center; padding: 14px 10px; }
.stat b { display: block; font-size: 24px; color: var(--accent-2); line-height: 1.2; }
.stat span { color: var(--muted); font-size: 12px; }

.split { display: flex; gap: 16px; align-items: flex-start; }
.split > .side { flex: 0 0 300px; }
.split > .main { flex: 1 1 auto; min-width: 0; }
@media (max-width: 900px) {
  .split { flex-direction: column; }
  .split > .side { flex: 1 1 auto; width: 100%; }
}

/* ---------------- 表格 ---------------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td { padding: 7px 9px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table.tbl th { color: var(--muted); font-weight: 600; background: var(--panel-2); white-space: nowrap; }
table.tbl tbody tr:hover { background: var(--accent-soft); }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-wrap { overflow-x: auto; }

/* ---------------- 地图 ---------------- */
.map-box { position: relative; }
.map { width: 100%; height: 480px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel-2); }
.map.small { height: 300px; }
.map.tall { height: 580px; }
.map-fallback { display: flex; align-items: center; justify-content: center; height: 100%; padding: 20px; color: var(--muted); text-align: center; }

/* 瓦片加载异常提示卡片 + 底图切换引导（浮于地图之上） */
.map-notice {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  z-index: 1200; width: min(520px, calc(100% - 150px));
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-left: 4px solid var(--warn);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 10px 12px; font-size: 13px; line-height: 1.6;
}
.map-notice p { margin: 4px 0 0; }
.map-notice-hd { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.map-notice-x { border: 0; background: transparent; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; padding: 0 4px; }
.map-notice-x:hover { color: var(--text); }
.map-notice-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.map-notice .btn { cursor: pointer; }

/* 地图左下角「底图异常？」按钮 */
.lbb-map-diag button {
  font: inherit; font-size: 12px; color: var(--text);
  background: var(--panel); border: 1px solid var(--border); border-radius: 6px;
  padding: 3px 8px; cursor: pointer; box-shadow: var(--shadow);
}
.lbb-map-diag button:hover { border-color: var(--accent); color: var(--accent); }
/* 左下「底图异常？」按钮：抬高一位，避开 Leaflet 整宽的底图署名条 */
.leaflet-container .leaflet-bottom .lbb-map-diag { margin-bottom: 48px; }
.leaflet-container { font-family: inherit; background: var(--panel-2); }
.leaflet-popup-content { margin: 10px 12px; font-size: 13px; }
.pop b { font-size: 14px; }
.pop em { display: block; color: var(--muted); font-style: italic; font-size: 12px; margin-bottom: 4px; }
.pop .row { margin: 2px 0; }
.pop img { max-width: 190px; max-height: 140px; border-radius: 6px; margin-top: 6px; display: block; }
.pop .tag { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 999px; border: 1px solid currentColor; }

.map-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.layer-panel { max-height: 300px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; background: var(--panel-2); }
.layer-panel label { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 12px; cursor: pointer; }
.layer-panel .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }

/* ---------------- 列表 ---------------- */
.rec-list { list-style: none; margin: 0; padding: 0; }
.rec-list li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.rec-list li:last-child { border-bottom: 0; }
.rec-list .t { flex: 0 0 52px; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.rec-list .sp { flex: 0 0 92px; font-weight: 600; }
.rec-list .d { flex: 1 1 auto; min-width: 0; color: var(--muted); font-size: 12px; }
.dayhdr { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.dayhdr h3 { margin: 0; }
.dayhdr .meta { color: var(--muted); font-size: 12px; }
.thumb { width: 42px; height: 42px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); cursor: pointer; }

.school-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: var(--panel-2); }
.school-card.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft) inset; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 12px; color: var(--muted); margin: 6px 0 10px; }
.kv b { color: var(--text); font-weight: 600; }

/* ---------------- 模态框 / 提示 ---------------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(20, 30, 20, .5); padding: 18px;
}
.modal {
  width: min(720px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 14px 44px rgba(0, 0, 0, .35);
  padding: 18px;
}
.modal h3 { display: flex; justify-content: space-between; align-items: center; }
.modal .close { cursor: pointer; color: var(--muted); font-size: 18px; line-height: 1; background: none; border: 0; }

#toast-wrap { position: fixed; right: 16px; bottom: 16px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 9px 14px; border-radius: 10px; color: #fff; background: #333;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25); font-size: 13px; max-width: 320px;
}
.toast.ok { background: #2e7d32; }
.toast.err { background: #b93a2c; }
.toast.info { background: #37506b; }

.note { padding: 9px 12px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 6px; color: var(--muted); font-size: 12px; }
.note.warn { border-left-color: var(--warn); }
.empty { padding: 22px; text-align: center; color: var(--muted); }

footer.site-footer { max-width: 1240px; margin: 0 auto; padding: 6px 16px 30px; color: var(--muted); font-size: 12px; }

.pwd-gate { max-width: 420px; margin: 60px auto; }
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button {
  padding: 7px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--panel); color: var(--muted);
}
.tabs button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
html[data-theme="dark"] .tabs button.active { color: #10210f; }
.tabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
html[data-theme="dark"] .tabs button.on { color: #10210f; }

/* ============================================================
 * 组件补充（页面脚本使用到的通用类）
 * ============================================================ */

/* 模态框显隐（JS 通过 .show 切换） */
.modal-mask { display: none; }
.modal-mask.show { display: flex; }

/* 文本工具类 */
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, "Courier New", monospace; font-size: 12px; }
.nowrap { white-space: nowrap; }

/* 统计条（主页 / 各页概览） */
.stat .stat-v { display: block; font-size: 24px; font-weight: 700; color: var(--accent-2); line-height: 1.2; }
.stat .stat-k { display: block; color: var(--muted); font-size: 12px; }
.stat .stat-k em { font-style: normal; margin-left: 3px; font-size: 11px; }

/* 概览用 chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px;
  color: var(--muted); background: var(--panel-2); border: 1px solid var(--border);
}
.chip b { color: var(--text); }
.chip.warn { color: var(--warn); border-color: var(--warn); }
.chip.ok { color: var(--ok); border-color: var(--ok); }

/* 色点 / 图例 */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.lg { display: inline-flex; align-items: center; gap: 5px; margin: 0 10px 6px 0; font-size: 12px; color: var(--muted); }
.lg i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; }

/* 表格（页面脚本使用 .data / .table-wrap 命名） */
.table-wrap, .tbl-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 7px 9px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table.data th { color: var(--muted); font-weight: 600; background: var(--panel-2); white-space: nowrap; }
table.data tbody tr:hover { background: var(--accent-soft); }
table.data tr.sel { background: var(--accent-soft); outline: 1px solid var(--accent); }
table.data td.ops, table.data th.ops { white-space: nowrap; }
table.data .ops .btn { margin: 1px 0; }
.bar-cell { width: 150px; }
.bar { display: block; height: 9px; border-radius: 999px; background: var(--accent); min-width: 2px; }

/* 日期侧栏（每日日志） */
.date-list { list-style: none; margin: 0; padding: 0; max-height: 560px; overflow: auto; }
.date-list li {
  padding: 8px 10px; border-radius: 8px; cursor: pointer; border: 1px solid transparent;
}
.date-list li:hover { background: var(--accent-soft); }
.date-list li.active { background: var(--accent-soft); border-color: var(--accent); }
.date-list li b { display: block; font-size: 13px; }
.date-list li small { color: var(--muted); font-size: 11px; }

/* 图层开关清单（历史轨迹） */
.layer-list { list-style: none; margin: 0; padding: 0; }
.layer-list li { border-bottom: 1px dashed var(--border); }
.layer-list li:last-child { border-bottom: 0; }
.layer-list li.off { opacity: .5; }
.layer-list label { display: flex; align-items: center; gap: 7px; padding: 7px 2px; cursor: pointer; font-size: 12px; }
.layer-list label b { font-size: 13px; }
.layer-list input[type="checkbox"] { width: auto; }

/* 日志页头 */
.log-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.log-head h2 { margin: 0; }
.log-head h2 small { font-weight: 400; }

/* 主页 hero */
.hero { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.hero .hero-txt { flex: 1 1 380px; min-width: 260px; }
.hero .hero-txt h1 { font-size: 26px; }
.hero-art { flex: 0 0 240px; }
.hero-art svg { display: block; width: 100%; height: auto; }

/* 照片预览 */
#photo-preview img { max-width: 220px; max-height: 160px; border-radius: 8px; border: 1px solid var(--border); margin-top: 6px; display: block; }

/* 地图容器补充 */
#edit-map { height: 280px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-row.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 700px) { .form-row, .form-row.cols-3 { grid-template-columns: 1fr; } }

/* 学校选择卡片内的按钮 */
.school-card h3 { margin-bottom: 4px; }
.school-card p { margin: 2px 0; font-size: 12px; }
.school-card .btn { margin-top: 8px; }

/* 底部 */
footer.site-footer a { color: var(--muted); }
.foot-links { display: flex; gap: 12px; flex-wrap: wrap; }

/* ============================================================
 * 地点搜索与自定义观测地点（geocode.js / places.js 使用）
 * ============================================================ */
.ps-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ps-row input[type="search"] { flex: 1 1 260px; min-width: 0; }
.ps-hint { margin: 8px 0 0; min-height: 18px; font-size: 12px; line-height: 1.6; color: var(--muted); }
.ps-hint.is-ok { color: var(--ok); }
.ps-hint.is-err { color: var(--danger); }
.ps-hint.is-busy { color: var(--accent-2); }
.ps-results { margin-top: 10px; }
.ps-empty { padding: 14px; border: 1px dashed var(--border); border-radius: 10px;
  text-align: center; font-size: 13px; color: var(--muted); }
.ps-item { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; margin-bottom: 8px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); }
.ps-item-main { flex: 1 1 260px; min-width: 0; }
.ps-item-main b { display: block; font-size: 14px; }
.ps-item-main small { display: block; margin-top: 2px; font-size: 12px; line-height: 1.6;
  color: var(--muted); word-break: break-word; overflow-wrap: anywhere; }
.ps-item-main .chips { margin-top: 4px; }
.ps-item-ops { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ps-manual { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border); }
.ps-manual > summary { padding: 4px 0; cursor: pointer; font-size: 13px; color: var(--accent-2); }
.ps-list { margin: 0; padding: 0; list-style: none; }
.ps-list li { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; padding: 10px 0; border-bottom: 1px dashed var(--border); }
.ps-list li:last-child { border-bottom: 0; }
.ps-list-title { font-size: 15px; }

/* ============================================================
 * 移动端适配（纯 CSS media queries，无新增依赖）
 * 覆盖：窄屏单列、主导航折叠、地图高度自适应与全屏、
 *       触摸目标 ≥44px、表格卡片化、筛选器横滚、安全区、深色主题
 * ============================================================ */

/* ---- 原生控件与基础观感（全尺寸通用） ---- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; }
input, select, textarea, button { font-family: inherit; }
input[type="text"], input[type="password"], input[type="search"], input[type="number"],
input[type="date"], input[type="time"], input[type="datetime-local"], input[type="url"],
input[type="tel"], input[type="email"], select, textarea {
  font-size: 16px;   /* 防止 iOS 聚焦自动放大 */
  line-height: 1.5;
  max-width: 100%;
}
input[type="date"], input[type="time"], input[type="datetime-local"] { min-height: 42px; }
textarea { resize: vertical; }
img, svg, canvas, iframe, table { max-width: 100%; }
.inline select, .inline input { max-width: 100%; }

/* 地图：高度随视口自适应，触屏避免整页滚动干扰 */
.map { touch-action: pan-x pan-y; }
#home-map.map.small { height: 300px; }
@media (min-width: 701px) {
  #home-map.map.small { height: 340px; }
}

/* 表格横滚容器：保留圆角与滚动惯性 */
.table-wrap { -webkit-overflow-scrolling: touch; }

/* 可折叠筛选容器（由 app.js 自动包裹 .map-tools；折叠仅窄屏生效） */
.filter-toggle { display: none; }

/* 导航上的图标按钮（汉堡 / 主题 / 全屏） */
.icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px;
  background: rgba(255, 255, 255, .7); color: var(--fg); font-size: 16px; line-height: 1; cursor: pointer; }
.icon-btn:hover { border-color: var(--accent); }
[data-theme="dark"] .icon-btn { background: rgba(255, 255, 255, .06); }
#nav-toggle { display: none; }
/* 全屏按钮：定位在左上缩放控件下方，避免与 Leaflet 缩放/底图切换控件互相遮挡 */
.map-fs-btn { position: absolute; top: 80px; left: 10px; z-index: 500; }

/* ---- 窄屏 / 移动端 ---- */
@media (max-width: 760px) {
  /* 安全区：刘海屏与手势条内边距 */
  .container { padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right)); }
  .site-header { padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right)); }

  /* 主导航：折叠为汉堡菜单 */
  .site-header { position: sticky; top: 0; height: auto; min-height: 52px;
    flex-wrap: wrap; gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  .brand { max-width: 52%; font-size: 15px; }
  .brand .brand-sub { display: none; }
  .site-header .nav { display: none; }          /* 展开时改为 flex 列 */
  #nav-toggle { display: inline-flex; }
  .site-header .session { margin-left: auto; gap: 6px; }
  #school-select { max-width: 40vw; min-width: 0; }

  /* 开场动效：小屏位置下移，避免盖住头部与首次滚动内容 */
  .birds { top: 22vh; opacity: .4; }

  /* 单列流式布局 */
  .hero { flex-direction: column; align-items: stretch; gap: 14px; }
  .hero .hero-txt { flex: 1 1 auto; min-width: 0; }
  .hero-art { order: 2; flex: 0 0 auto; max-width: 280px; margin: 0 auto; }
  .grid, .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  .split { flex-direction: column; }
  .split > .side { flex: 1 1 auto; width: 100%; }
  .split > .main { width: 100%; }
  .form-row.cols-3 { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 12px; }

  /* 地图：随视口自适应 + 全屏 */
  .map { height: 60vh; min-height: 260px; }
  .map.small { height: 52vh; min-height: 240px; }
  .map.tall { height: 68vh; min-height: 300px; }
  #home-map.map.small { height: 52vh; }
  #admin-map.map.small { height: 46vh; min-height: 220px; }
  .map:fullscreen { height: 100vh; }
  .map:-webkit-full-screen { height: 100vh; }
  .map.map-fullscreen { position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1200; height: 100vh; border: 0; border-radius: 0; }

  /* 触摸目标 ≥44px */
  .btn, .tabs button, .school-card .btn, .site-header .btn,
  .icon-btn, .modal .close { min-height: 44px; }
  .btn.small { min-height: 44px; padding: 0 14px; font-size: 13px; }
  .site-header .nav a, .site-header .nav button { min-height: 44px; display: flex; align-items: center; }
  .tag-row { gap: 8px; }
  .tag-row > .btn, .tag-row > label.btn, .tag-row > a.btn { flex: 1 1 46%; justify-content: center; }
  .ps-item-ops > .btn, .ps-item-ops > label.btn { flex: 1 1 auto; justify-content: center; }
  .ps-row input[type="search"] { flex: 1 1 100%; }
  .ps-item-ops { width: 100%; }
  .tab, .tabs button { min-height: 44px; }

  /* 地图控件：触摸目标放大到 ≥44px，提示卡片与全屏按钮避开 Leaflet 角落控件 */
  .leaflet-control-zoom a { width: 44px !important; height: 44px !important;
    line-height: 44px !important; font-size: 22px !important; }
  .leaflet-control-layers-toggle { width: 44px; height: 44px; }
  .leaflet-control-attribution { font-size: 10px; line-height: 1.4; }
  .lbb-map-diag button { min-height: 44px; padding: 8px 12px; font-size: 13px; }
  .leaflet-container .leaflet-bottom .lbb-map-diag { margin-bottom: 56px; }
  .map-fs-btn { top: 110px; min-width: 44px; min-height: 44px; font-size: 18px; }
  .map-notice { top: 8px; left: 64px; right: 64px; width: auto; transform: none;
    max-height: 62%; overflow-y: auto; }
  .map-notice-x { display: flex; align-items: center; justify-content: center;
    min-width: 44px; min-height: 44px; padding: 0; font-size: 20px; }

  /* 勾选类开关：整行 label 作为 ≥44px 触摸目标，复选框本体适当放大 */
  label.inline { display: flex; align-items: center; gap: 8px; min-height: 44px; }
  .layer-list label { min-height: 44px; }
  label.inline input[type="checkbox"], .layer-list input[type="checkbox"] { width: 22px; height: 22px; }

  /* 文件选择控件：整体与内部按钮一并放大 */
  input[type="file"] { min-height: 44px; }
  input[type="file"]::file-selector-button { min-height: 40px; padding: 0 14px; margin-right: 8px; font-size: 13px; }

  /* 头部品牌区与下拉：统一 ≥44px 触摸目标 */
  .brand { min-height: 44px; }
  #school-select { min-height: 44px; }

  /* 表单控件：单列、满宽、避免 iOS 缩放 */
  .form-row { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .field { margin-bottom: 12px; }
  .field > input, .field > select, .field > textarea, .field > span { width: 100%; }
  /* 文本类控件统一 44px 触摸高度（复选框/单选/滑块等小控件不适用） */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
  select, textarea { min-height: 44px; }

  /* 表格：卡片化（需 HTML 行内 data-label 标注）；无标注时退化为横向滚动 */
  .table-wrap { overflow-x: auto; }
  .table-wrap table.data { min-width: 0; width: 100%; }
  .table-wrap table.data thead { display: none; }
  .table-wrap table.data, .table-wrap table.data tbody,
  .table-wrap table.data tr, .table-wrap table.data td { display: block; width: auto; }
  .table-wrap table.data tr { margin-bottom: 10px; padding: 10px 12px;
    border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); }
  .table-wrap table.data td { display: grid; grid-template-columns: 92px minmax(0, 1fr);
    gap: 8px; align-items: start; padding: 6px 0; border: 0; text-align: left;
    white-space: normal; overflow-wrap: anywhere; }
  .table-wrap table.data td:last-child { border-bottom: 0; }
  .table-wrap table.data td[data-label]::before { content: attr(data-label);
    font-size: 12px; color: var(--muted); }
  .table-wrap table.data td:not([data-label]) { grid-template-columns: minmax(0, 1fr); }
  .table-wrap table.data td.ops { grid-template-columns: minmax(0, 1fr); }
  .table-wrap table.data td.ops .tag-row, .table-wrap table.data td.ops .btn { width: 100%; }

  /* 筛选器：默认折叠收纳 */
  .filter-toggle { display: inline-flex; }
  .filter-panel.is-collapsed { display: none; }
  .log-head { flex-wrap: wrap; gap: 8px; }
  .tabs { flex-wrap: wrap; width: 100%; }
  .tabs button { flex: 1 1 40%; }
  .map-tools { flex-direction: column; align-items: stretch; gap: 8px; }
  .map-tools .inline { width: 100%; }
  .map-tools input, .map-tools select { width: 100% !important; min-width: 0 !important; }

  /* 弹窗 / 提示：不溢出 */
  .modal { width: auto; max-width: 100%; max-height: 84vh; overflow: auto; padding: 16px; }
  .modal-mask { padding: 12px; align-items: flex-start; }
  .modal .close { width: 44px; height: 44px; }
  .modal .form-row { grid-template-columns: minmax(0, 1fr); }
  .note, .chip, .school-card, .hint { word-break: break-word; }

  /* 底部信息与标题层级 */
  .foot-links { flex-direction: column; gap: 6px; }
  h1 { font-size: 20px; }
  h2 { font-size: 17px; }
  h3 { font-size: 15px; }

  /* 头部：安全区内边距、汉堡按钮与展开后的导航 */
  .hdr { padding: 8px max(12px, env(safe-area-inset-left)) 8px max(12px, env(safe-area-inset-right)); gap: 10px; }
  .hdr-tools { order: 1; margin-left: auto; gap: 6px; }
  #nav-toggle { order: 2; }
  .site-header .badge { padding: 2px 6px; font-size: 11px; }
  #theme-btn { padding: 0 10px; }
  nav.nav.open { display: flex; order: 3; flex: 1 1 100%; width: 100%;
    flex-direction: column; gap: 4px; padding-top: 6px; border-top: 1px dashed var(--border); }
  nav.nav.open a { padding: 10px; font-size: 14px; border-radius: 8px; }

  /* 日期开关：手机改为横向滚动条，避免占用整屏高度 */
  .date-list { display: flex; gap: 8px; max-height: none; overflow-x: auto; overflow-y: hidden;
    padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
  .date-list li { flex: 0 0 auto; min-width: 128px; }
  .date-list li b { font-size: 12px; }
  .tab, .tabs button { min-height: 44px; }
}

/* 超窄屏（如 320–360px）进一步收紧 */
@media (max-width: 400px) {
  .tag-row > .btn, .tag-row > label.btn, .tag-row > a.btn { flex: 1 1 100%; }
  .brand { font-size: 14px; }
  .table-wrap table.data td { grid-template-columns: 76px minmax(0, 1fr); }
}

/* 横屏矮视口：地图与弹窗高度以视口为准 */
@media (max-height: 480px) and (orientation: landscape) {
  .map { height: 70vh; min-height: 200px; }
  .modal { max-height: 92vh; }
}

/* 打印：隐藏导航与地图控件 */
@media print {
  .site-header, .map-fs-btn, .filter-toggle, .tag-row, .site-footer { display: none !important; }
  .map { height: 240px; }
}

/* ---- 深色主题：移动端保持一致观感 ---- */
@media (prefers-color-scheme: dark) {
  :root { color-scheme: dark; }
}
@media (prefers-color-scheme: dark) and (max-width: 760px) {
  [data-theme="auto"] .map-notice { background: rgba(18, 24, 20, .92); color: #e8f1e9; }
}
