/* ============================================================
 * 环球地理志 —— 样式（移动优先，手机浏览器直接可用）
 * ============================================================ */
:root {
  --bg: #f2f5f1;
  --card: #ffffff;
  --ink: #1f2d26;
  --muted: #68786f;
  --accent: #2f7d5d;
  --accent-soft: #e3f0e9;
  --line: #e2e8e2;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(31, 45, 38, 0.08);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.7;
}
main { max-width: 680px; margin: 0 auto; padding: 14px 14px 30px; }

.view { display: none; }
.view.active { display: block; animation: fade 0.25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- 顶栏与标签页 ---------- */
.topbar { max-width: 680px; margin: 0 auto; padding: 18px 14px 0; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 34px; }
.brand h1 { margin: 0; font-size: 22px; letter-spacing: 0.5px; }
.brand p { margin: 0; font-size: 12px; color: var(--muted); }
.tabs {
  display: flex; gap: 8px; margin-top: 14px;
  background: #fff; padding: 5px; border-radius: 999px; box-shadow: var(--shadow);
}
.tab {
  flex: 1; border: 0; background: transparent; padding: 9px 4px;
  border-radius: 999px; font-size: 14.5px; color: var(--muted); cursor: pointer; font-family: inherit;
}
.tab.active { background: var(--accent); color: #fff; font-weight: 600; }

/* ---------- 每日一学 ---------- */
.daily-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 6px 0 12px; }
.daily-title { text-align: center; line-height: 1.45; min-width: 0; flex: 1; }
.daily-title strong { display: block; font-size: 14px; white-space: nowrap; }
.daily-title small { color: var(--muted); font-size: 11px; display: block; }
#backToday { margin-top: 2px; border: 0; background: none; color: var(--accent); font-size: 12px; cursor: pointer; text-decoration: underline; padding: 0; font-family: inherit; }
.ghost-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 7px 12px; font-size: 13px; color: var(--ink); cursor: pointer; font-family: inherit; white-space: nowrap;
}
.ghost-btn:disabled { opacity: 0.35; cursor: default; }
.daily-actions { display: flex; justify-content: center; margin: 2px 0 8px; }
.learn-btn {
  border: 0; background: var(--accent-soft); color: var(--accent); font-weight: 600;
  border-radius: 999px; padding: 10px 26px; font-size: 14px; cursor: pointer; font-family: inherit;
}
.learn-btn.done { background: var(--accent); color: #fff; }

/* ---------- 区域卡片 ---------- */
.region-card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; margin-bottom: 14px;
}
.hero { position: relative; height: 150px; }
.hero svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 16px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.5)); color: #fff;
}
.hero-cap h3 { margin: 0; font-size: 22px; }
.hero-cap p { margin: 0; font-size: 12.5px; opacity: 0.92; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 16px 2px; }
.tags span { background: var(--accent-soft); color: var(--accent); font-size: 11.5px; padding: 3px 10px; border-radius: 999px; }

.map { height: 210px; margin: 12px 16px 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #eaf1ec; }
.map-fallback-text { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 12.5px; color: var(--muted); text-align: center; padding: 10px; }
.leaflet-container { font-family: inherit; }

.facts { padding: 6px 16px 18px; }
.facts h4 { margin: 16px 0 4px; font-size: 13px; color: var(--accent); display: flex; align-items: center; gap: 6px; }
.facts h4::before { content: ""; width: 4px; height: 14px; background: var(--accent); border-radius: 2px; display: inline-block; }
.facts p { margin: 0; font-size: 14.5px; }
.facts .ext { background: #fdf8ec; border-left: 3px solid #e8b93d; padding: 8px 10px; border-radius: 0 8px 8px 0; }
.facts ul { margin: 4px 0 0; padding: 0; list-style: none; }
.facts .links li { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.facts .links li:last-child { border-bottom: 0; }
.facts .links strong { display: block; font-size: 13.5px; color: var(--ink); }
.facts .links span { font-size: 13px; color: var(--muted); }
.facts .exam li { position: relative; padding-left: 16px; font-size: 13.5px; margin-top: 6px; color: #41544a; }
.facts .exam li::before { content: "✦"; position: absolute; left: 0; color: var(--accent); font-size: 11px; top: 2px; }

.photos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0; }
.photos .photo { margin: 0; }
.photos img { width: 100%; height: 110px; object-fit: cover; border-radius: 10px; display: block; }

/* ---------- 区域档案 ---------- */
.archive-bar { display: flex; align-items: center; gap: 10px; margin: 6px 0 12px; }
#searchInput {
  flex: 1; min-width: 0; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 14px;
  font-size: 14px; font-family: inherit; background: #fff; outline: none;
}
#searchInput:focus { border-color: var(--accent); }
.count { font-size: 12px; color: var(--muted); white-space: nowrap; }

.archive-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.archive-card {
  border: 0; background: var(--card); border-radius: 14px; box-shadow: var(--shadow);
  overflow: hidden; text-align: left; cursor: pointer; font-family: inherit; padding: 0; display: block; position: relative;
}
.archive-card .thumb { height: 84px; position: relative; }
.archive-card .thumb svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.archive-card h3 { margin: 10px 12px 0; font-size: 15px; color: var(--ink); }
.archive-card p { margin: 2px 12px 10px; font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.continent { display: block; margin: 0 12px 12px; width: fit-content; font-size: 10.5px; color: var(--muted); background: var(--bg); padding: 2px 8px; border-radius: 999px; }
.kid-chip { position: absolute; top: 8px; right: 8px; font-size: 10.5px; color: #fff; background: rgba(0, 0, 0, 0.35); padding: 2px 8px; border-radius: 999px; backdrop-filter: blur(4px); }
.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 30px 0; }

.folder-head { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 14px; }
.folder-head h3 { margin: 0; font-size: 18px; }
.folder-head p { margin: 4px 0 10px; font-size: 13px; color: var(--muted); }
.folder-title { margin: 14px 2px 10px; font-size: 13px; color: var(--accent); }

/* ---------- 详情页新组件 ---------- */
.crumb-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.crumb {
  border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px;
  font-size: 12.5px; color: var(--accent); cursor: pointer; font-family: inherit;
}
.kind-chip { font-size: 11px; background: var(--accent-soft); color: var(--accent); padding: 3px 10px; border-radius: 999px; }

.map-lang-btn {
  position: absolute; top: 6px; right: 6px; z-index: 500;
  border: 0; background: rgba(255, 255, 255, 0.94); border-radius: 8px; padding: 4px 9px;
  font-size: 11px; cursor: pointer; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  color: var(--ink); font-family: inherit;
}

.facts .special { background: #eaf4ee; border-left: 3px solid var(--accent); padding: 8px 10px; border-radius: 0 8px 8px 0; }
.wild { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin-top: 6px; }
.wild-card { background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.wild-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wild-head strong { font-size: 13.5px; }
.wild-card p { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.badge { font-size: 10px; padding: 1px 8px; border-radius: 999px; color: #fff; }
.badge.flora { background: #3f8f63; }
.badge.fauna { background: #d97b2e; }
.badge.micro { background: #8a6fc8; }

.children-btn {
  margin-top: 16px; width: 100%; border: 1.5px solid var(--accent); background: #fff; color: var(--accent);
  border-radius: 12px; padding: 10px; font-size: 13.5px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.children-btn:active { background: var(--accent-soft); }

/* ---------- 原理实验室 ---------- */
.principle-head h2 { margin: 4px 0 2px; font-size: 20px; }
.principle-head p { margin: 0 0 10px; font-size: 13px; color: var(--muted); }

.slider-row {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 10px 14px;
}
.slider-row label { font-size: 13px; font-weight: 600; }
#declSlider { flex: 1; accent-color: var(--accent); }
#declOut { font-size: 12.5px; color: var(--accent); font-weight: 600; text-align: right; min-width: 150px; }

.belt-svg { background: #fff; border-radius: 14px; box-shadow: var(--shadow); margin-top: 10px; padding: 6px 4px; }
.belt-svg svg { width: 100%; height: auto; display: block; }
.belt-svg .hit { cursor: pointer; }
.belt-svg .hit:hover rect { filter: brightness(1.06); }
.axis { font-size: 10px; fill: #9aa8a0; }
.sun-label { font-size: 10px; fill: #d8912e; font-weight: 600; }
.band-name { font-size: 11.5px; font-weight: 600; fill: #3d4a42; }
.band-name.dark { fill: #5a3d1e; }
.band-sub { font-size: 9.5px; fill: #7c8a82; }
.band-sub.dark { fill: #8a6b45; }

.belt-note { font-size: 11px; color: var(--muted); margin: 8px 2px; }
.belt-info { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 12px 16px; margin-top: 4px; min-height: 70px; font-size: 13.5px; }
.belt-info strong { color: var(--accent); }
.belt-info p { margin: 4px 0 0; font-size: 13px; }

.apps { margin-top: 16px; }
.apps h3 { font-size: 14px; margin: 0 0 8px; }
.app-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.app-chips button {
  border: 1.5px solid var(--accent); color: var(--accent); background: #fff;
  border-radius: 999px; padding: 7px 14px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.app-chips button:active { background: var(--accent-soft); }

.roadmap { margin-top: 20px; border: 1.5px dashed var(--line); border-radius: 14px; padding: 12px 16px; color: var(--muted); }
.roadmap h3 { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.roadmap ul { margin: 0; padding-left: 18px; font-size: 13px; }

.foot { text-align: center; color: #9aa8a0; font-size: 11px; padding: 8px 0 26px; }

/* ============================================================
 * 电脑端适配（≥900px）：放宽版面、双栏布局
 * ============================================================ */
@media (min-width: 900px) {
  body { font-size: 15px; }
  .topbar, main, .foot { max-width: 1100px; }
  .topbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; padding-top: 24px; }
  .tabs { margin-top: 0; width: 460px; flex: none; }
  .brand h1 { font-size: 26px; }
  .brand p { font-size: 13px; }
  main { padding-top: 20px; }

  .daily-title strong { font-size: 15px; }

  /* 详情：地图加高，要素区双栏排版 */
  .hero { height: 230px; }
  .map { height: 330px; }
  .facts { column-count: 2; column-gap: 40px; }
  .facts > * { break-inside: avoid; }
  .facts h4 { break-after: avoid; }
  .wild { grid-template-columns: 1fr; }

  /* 档案：卡片更大 */
  .archive-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
  .archive-card .thumb { height: 100px; }

  /* 原理实验室：图左、讲解右 */
  .principle-grid { display: grid; grid-template-columns: 480px 1fr; gap: 26px; align-items: start; }
  .belt-svg { padding: 10px; }
}

/* ---------- 设置 · 联网查询 ---------- */
.gear-btn { margin-left: auto; border: 0; background: transparent; font-size: 22px; cursor: pointer; padding: 4px; align-self: flex-start; }
.settings-head h2 { margin: 10px 0 2px; font-size: 20px; }
.settings-head p { margin: 0 0 12px; font-size: 13px; color: var(--muted); }
.source-rows { display: grid; gap: 10px; margin-bottom: 14px; }
.src-row { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); }
.src-ctrl { display: flex; flex-direction: column; gap: 3px; }
.mini-btn { border: 1px solid var(--line); background: #fff; border-radius: 6px; width: 26px; height: 20px; line-height: 1; font-size: 12px; cursor: pointer; font-family: inherit; }
.src-main { display: flex; gap: 10px; align-items: flex-start; flex: 1; cursor: pointer; }
.src-main input { margin-top: 3px; }
.src-main strong { font-size: 14px; display: block; }
.src-main small { color: var(--muted); font-size: 11.5px; line-height: 1.4; display: block; }
.settings-block { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 14px 16px; }
.settings-block h3 { margin: 0 0 10px; font-size: 15px; }
.field { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.field span { font-size: 13px; width: 60px; flex: none; color: var(--muted); }
.field select, .field input { flex: 1; min-width: 0; border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 13.5px; font-family: inherit; background: #fff; }
.settings-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.key-link { font-size: 12.5px; color: var(--accent); }
.test-out { font-size: 12px; color: var(--muted); }

/* ---------- 联网查询结果 ---------- */
.online-miss { text-align: center; padding: 26px 10px; }
.online-miss p { color: var(--muted); }
.online-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { border: 1.5px solid var(--line); background: #fff; color: var(--muted); border-radius: 999px; padding: 6px 14px; font-size: 12.5px; cursor: pointer; font-family: inherit; }
.chip.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.online-card { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 14px 16px; }
.online-card p { font-size: 14px; }
.wiki { display: flex; gap: 12px; margin-bottom: 10px; }
.wiki-img { width: 110px; height: 110px; object-fit: cover; border-radius: 10px; flex: none; }
.wiki h4 { margin: 0 0 4px; font-size: 16px; }
.wiki p { margin: 0 0 6px; font-size: 13.5px; }
.geo-line { margin: 6px 0 0; font-size: 13px; }
.prompt-box { width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px; font-size: 12.5px; font-family: ui-monospace, Menlo, Consolas, monospace; resize: vertical; background: var(--bg); }
.ai-chip { background: #fdeeda; color: #b06a12; }
.draft-actions { display: flex; gap: 10px; margin: 12px 0 4px; flex-wrap: wrap; }
.ghost-btn.danger { color: #b03a2e; border-color: #e8c4bf; }
.loading { text-align: center; color: var(--muted); padding: 22px 0; }

/* ---------- 维基正文内嵌 / Mac 地图链接 ---------- */
.wiki-full { margin-top: 10px; background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.wiki-full h4 { margin: 0 0 6px; font-size: 13px; color: var(--accent); }
.wiki-text { font-size: 13px; line-height: 1.8; white-space: pre-wrap; word-break: break-word; }
.maps-link { display: inline-block; margin-top: 8px; font-size: 12.5px; }

/* ---------- 原理卡 / 收藏 ---------- */
.p-thumb { display: flex; align-items: center; justify-content: center; }
.p-thumb span { font-size: 40px; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,.25)); }
.p-hero { height: 170px; display: flex; align-items: center; justify-content: center; }
.hero-emoji { font-size: 64px; filter: drop-shadow(0 3px 6px rgba(0,0,0,.3)); }
.facts .mistakes li { color: #a05a20; }
.facts .mistakes li::before { content: "⚠"; color: #d8912e; }
.ghost-btn.mini { padding: 3px 10px; font-size: 11.5px; }
.ghost-btn.mini.danger { color: #b03a2e; border-color: #e8c4bf; }

/* ---------- 原理卡照片 / 动态演示 ---------- */
.thumb-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.p-emoji { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 40px; }
.p-hero { height: 200px; }
.p-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-credit { position: absolute; top: 8px; right: 8px; z-index: 3; background: rgba(0,0,0,.5); color: #fff; font-size: 10px; padding: 2px 9px; border-radius: 999px; max-width: 78%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.demo-chip { position: absolute; left: 8px; bottom: 8px; z-index: 3; background: rgba(0,0,0,.55); color: #fff; font-size: 10px; padding: 2px 8px; border-radius: 999px; }
.demo-box { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 12px 14px; margin: 12px 16px 0; }
.demo-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.demo-title { font-size: 14px; font-weight: 700; }
.demo-legend { font-size: 11.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.lg { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin: 0 2px; }
.demo-svg svg, .belt-svg svg { width: 100%; height: auto; display: block; }
.demo-hint { font-size: 12px; color: var(--muted); margin: 6px 0; }
.demo-info { background: var(--bg); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; min-height: 58px; }
.demo-info strong { color: var(--accent); }
.demo-info .badge { margin-left: 6px; }
.demo-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; align-items: center; }
.demo-tabs-right { margin-left: auto; display: inline-flex; gap: 8px; }
.demo-sub { margin-top: 10px; }
.demo-sub-head { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inset-svg { max-width: 320px; }
@keyframes flowDash { to { stroke-dashoffset: -24; } }
.flowline { stroke-dasharray: 4 8; animation: flowDash 0.9s linear infinite; stroke-linecap: round; }
.oc-label { font-size: 10.5px; fill: #4a5a52; font-weight: 600; }
.oc-land { font-size: 11px; fill: #8a7f6a; font-weight: 600; }
.examples { margin: 4px 0 0; padding-left: 20px; }
.examples li { margin-bottom: 10px; }
.examples strong { font-size: 13.5px; color: var(--ink); display: block; }
.examples .process { font-size: 13px; color: #41544a; margin: 2px 0 0; line-height: 1.75; }
