/* 横滚 · 统一主题
   参考 miedeng.com 的做法：一套变量、一种卡片、克制的字号与色板。
   本文件是唯一样式来源，不依赖任何覆盖层。 */

:root {
  --accent: #3a7ca5;
  --accent-dark: #2b6081;
  --accent-light: #eaf2f7;
  --bg: #f5f7f8;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #888888;
  --line: #e8e8e8;
  --danger: #d9534f;
  --shadow: 0 2px 14px rgba(0,0,0,.06);
  --radius: 14px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  line-height: 1.6;
  padding-bottom: 40px;
}

.w, .m {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}

h1, h2, h3, h4 { font-weight: 600; margin: 0; }
h1 { font-size: 26px; letter-spacing: .5px; line-height: 1.2; }
h2 { font-size: 18px; margin-bottom: 8px; }
h3 { font-size: 15px; }
p { margin: 0 0 10px; }
small { font-size: 12px; color: var(--muted); }
a { color: var(--accent-dark); text-decoration: none; }

button, input, select, textarea { font-family: inherit; font-size: 13px; color: var(--text); }
button { cursor: pointer; }

/* ---------- 顶部导航 ---------- */
nav:not(.nav-drawer):not(.tabbar):not(.admin-top) {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 17px; font-weight: 600; }
.logo-mark { color: var(--accent); flex: none; }
.nav-links { display: flex; gap: 16px; margin-left: auto; }
.nav-links a { color: var(--muted); font-size: 13px; }
.nav-links a:hover { color: var(--accent); }
.nav-account { display: flex; align-items: center; gap: 8px; }
.nav-login {
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  border-radius: 10px; padding: 7px 14px; font-size: 13px;
}
.nav-login:hover { background: var(--accent-dark); }
.nav-user { position: relative; display: flex; align-items: center; gap: 6px; }
.nav-user[hidden], .nav-login[hidden], .nav-menu[hidden] { display: none !important; }
.nav-avatar-btn { display: flex; align-items: center; gap: 3px; border: 0; background: none; padding: 0; }
.nav-avatar { display: inline-flex; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-light); align-items: center; justify-content: center; font-size: 14px; }
.nav-avatar .av { width: 22px; height: 22px; font-size: 13px; margin: 0; }
.nav-caret { font-size: 10px; color: var(--muted); }
.nav-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  width: 176px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.12); padding: 6px;
}
.nav-menu-name { padding: 9px 10px; font-weight: 600; border-bottom: 1px solid var(--line); margin-bottom: 4px; word-break: break-all; }
.nav-menu button {
  display: flex; width: 100%; justify-content: space-between; align-items: center;
  padding: 9px 10px; border: 0; background: none; border-radius: 8px; text-align: left; color: var(--text);
}
.nav-menu button:hover { background: var(--accent-light); color: var(--accent-dark); }
.nav-menu-badge { color: var(--accent); font-weight: 600; }
.nav-toggle { display: none; border: 0; background: none; padding: 6px; }
.nav-toggle span { display: block; width: 20px; height: 2px; background: var(--text); margin: 4px 0; border-radius: 2px; }
.nav-mask { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 90; }
.nav-drawer { display: none; }

/* ---------- 栏目条 / 底部导航 ---------- */
.viewtabs {
  display: flex; gap: 4px; background: #eceef1; border-radius: 12px;
  padding: 4px; margin: 16px 0;
}
.viewtab {
  flex: 1; border: 0; background: transparent; padding: 9px 0; border-radius: 9px;
  color: #666; font-size: 14px;
}
.viewtab[aria-selected="true"] { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.09); }
.tabbar { display: none; }

/* ---------- 区块与卡片：全站唯一的容器语言 ---------- */
section { padding: 18px; margin-bottom: 16px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.lead { color: var(--muted); font-size: 13px; margin: 0 0 16px; line-height: 1.7; }
.note { color: #aaa; font-size: 12px; line-height: 1.6; }

.card, .callout { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 12px; }
.cards { display: grid; gap: 12px; margin-bottom: 16px; }

/* ---------- 按钮 / 输入 ---------- */
.btn {
  display: inline-block; border: 1px solid var(--accent); background: var(--accent);
  color: #fff; border-radius: 10px; padding: 11px 20px; font-size: 14px; font-weight: 500;
}
.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.o { background: #fff; border-color: var(--line); color: var(--text); }
.btn.o:hover { border-color: var(--accent); color: var(--accent); }
.btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.lk { border: 0; background: none; color: var(--accent-dark); padding: 0; font-size: 12px; }

.in {
  display: block; width: 100%; padding: 12px 13px; border: 1.5px solid var(--line);
  border-radius: 10px; background: #fff; margin-bottom: 8px; outline: 0; font-size: 14px;
}
.in:focus { border-color: var(--accent); }
textarea.in { resize: vertical; line-height: 1.6; }
select.in { appearance: auto; }

.chips, .chips3 { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chips button, .chips3 button {
  border: 1.5px solid var(--line); background: #fff; color: var(--text);
  border-radius: 20px; padding: 6px 13px; font-size: 13px;
}
.chips button[aria-pressed="true"], .chips3 button.on {
  border-color: var(--accent); background: var(--accent-light); color: var(--accent-dark); font-weight: 600;
}

.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 12px; background: var(--accent-light); color: var(--accent-dark); margin-right: 4px; }
.tag-sticky { background: var(--accent-light); color: var(--accent-dark); }
.tag-ad { background: #fff5e6; color: #b57a1f; }
.tag-quiet { background: #f2f4f6; color: var(--muted); }

/* ---------- 社区 / 资讯列表：统一的行样式 ---------- */
.row { display: block; padding: 14px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row h3 { margin-bottom: 5px; }
.row p { color: var(--muted); font-size: 13px; margin-bottom: 6px; line-height: 1.7; }
.row span { color: #aaa; font-size: 12px; }
.feed-list .row { cursor: pointer; }
.forum-layout { display: block; }
.forum-side { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); display: grid; gap: 12px; }
.side-card { background: #fafbfc; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.side-title { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.forum-side h3 { font-size: 13px; margin-bottom: 8px; }
.forum-side .chips { flex-direction: column; gap: 2px; margin: 0; }
.forum-side .chips button { text-align: left; border: 0 !important; background: transparent !important; padding: 7px 10px; border-radius: 8px; color: #666; }
.forum-side .chips button[aria-pressed="true"] { background: var(--accent-light) !important; color: var(--accent-dark) !important; }

.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 16px; }
.pager button { border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 5px 14px; font-size: 12px; }
.pager button:disabled { opacity: .4; }
.pinfo { font-size: 12px; color: var(--muted); }

/* ---------- 新手指南 ---------- */
.guide-tabs {
  display: flex; gap: 4px; background: #eceef1; border-radius: 12px;
  padding: 4px; margin: 0 0 20px;
}
.guide-tabs button { flex: 1; border: 0; background: transparent; padding: 9px 0; border-radius: 9px; color: #666; font-size: 13px; }
.guide-tabs button.on { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.09); }
.guide-tabs i { font-style: normal; font-size: 11px; color: #aaa; margin-right: 4px; }
.guide-tabs button.on i { color: var(--accent); }
.guide-pane { display: none; }
.guide-pane.on { display: block; }
.guide-pane h3:first-child { font-size: 16px; margin-bottom: 6px; }
.guide-pane h3.s2 { font-size: 15px; margin: 24px 0 10px; }

.wiz { display: grid; gap: 10px; }
.wiz label { font-size: 12px; color: var(--muted); }
.wiz label .in { margin-top: 4px; margin-bottom: 0; }
.wiz .btn { width: 100%; margin-top: 4px; }

table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
th { font-weight: 600; color: var(--muted); border-bottom: 1.5px solid var(--line); }

.steps { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.steps > div { background: #fafbfc; border-radius: 12px; padding: 14px; }
.steps i { display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center; background: var(--accent-light); color: var(--accent-dark); border-radius: 8px; font-size: 11px; font-style: normal; margin-bottom: 8px; }
.steps h3 { font-size: 14px; margin-bottom: 4px; }
.steps p { font-size: 12px; color: var(--muted); margin: 0; line-height: 1.6; }

.gear label { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.gear label span { flex: 1; }
.gear small { display: block; color: var(--muted); font-size: 12px; }
.gear b { font-size: 13px; font-weight: 600; }
.tot { display: flex; justify-content: space-between; align-items: center; padding: 16px 0 8px; }
.tot b { font-size: 22px; color: var(--accent-dark); }

.craft-grid { display: grid; gap: 10px; }
.craft-card { position: relative; background: #fafbfc; border-radius: 12px; padding: 16px; }
.craft-no { position: absolute; right: 14px; top: 14px; font-size: 11px; color: #bbb; }
.craft-card h3 { font-size: 15px; margin-bottom: 6px; }
.craft-card p { color: var(--muted); font-size: 12px; line-height: 1.7; margin-bottom: 10px; }
.craft-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.craft-meta span { background: var(--accent-light); color: var(--accent-dark); border-radius: 6px; padding: 3px 8px; font-size: 11px; }
.craft-meta b { margin-left: auto; color: var(--muted); font-size: 11px; font-weight: 500; }

/* ---------- 飞场地图 ---------- */
#map-wrap { margin-bottom: 12px; }
#map, #txmap { width: 100%; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
#map { height: auto; }
#txmap { height: 340px; }
.map-hint { font-size: 12px; color: #aaa; margin: 8px 0 0; }

/* ---------- 弹窗 ---------- */
.auth-mask, #articleModal, #spotReviewModal {
  position: fixed; inset: 0; background: rgba(0,0,0,.42); z-index: 120;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.auth-mask[hidden], #articleModal[style*="display:none"], #spotReviewModal[style*="display:none"] { display: none !important; }
.auth-mask #fauth { width: 100%; max-width: 380px; background: var(--card); border-radius: 16px; padding: 22px; margin: 0; max-height: 86vh; overflow: auto; }
#articleModalBox, #spotReviewBox { background: var(--card); border-radius: 16px; max-width: 640px; max-height: 80vh; overflow: auto; padding: 22px; width: 100%; }
#articleModal .article-body p { font-size: 14px; line-height: 1.85; margin-bottom: 14px; }

.auth-tabs, .auth-tab { display: flex; }
.auth-tabs { gap: 4px; background: #eceef1; border-radius: 12px; padding: 4px; margin-bottom: 16px; }
.auth-tab { flex: 1; border: 0; background: transparent; padding: 9px 0; border-radius: 9px; color: #666; }
.auth-tab.on { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.09); }
.auth-panel[hidden] { display: none !important; }

/* ---------- 工具页 ---------- */
.pagehead { text-align: center; padding: 26px 0 18px; }
.pagehead h1 { font-size: 26px; font-weight: 600; }
.pagehead p { color: var(--muted); font-size: 13px; margin: 7px 0 0; }
.steps2 { display: grid; gap: 12px; }
.crumb { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.meta { font-size: 12px; color: var(--muted); }
.video-slot { background: #fafbfc; border-radius: 12px; padding: 18px; text-align: center; color: var(--muted); font-size: 13px; }
.progress-wrap { margin-bottom: 14px; }
.progress-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.progress-bar { height: 6px; background: #eceef1; border-radius: 3px; overflow: hidden; }
.progress-bar > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.searchbar { display: flex; gap: 8px; margin-bottom: 16px; }
.searchbar input { flex: 1; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stats > div { background: #fafbfc; border-radius: 12px; padding: 14px; }
.stats b { display: block; font-size: 20px; font-weight: 600; }
.stats span { color: var(--muted); font-size: 12px; }
.admin-top { display: flex; gap: 16px; flex-wrap: wrap; padding: 14px 0; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.admin-top a { color: var(--muted); font-size: 13px; }
.admin-top a.cur, .admin-top a:hover { color: var(--accent); }
.checklist label { display: flex; gap: 8px; align-items: flex-start; padding: 7px 0; }

/* ---------- 页脚 ---------- */
footer {
  display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between;
  color: #bbb; font-size: 12px; text-align: center; margin-top: 24px; padding: 20px 0;
}
footer a { color: inherit; }

/* ---------- 移动端 ---------- */
@media (max-width: 680px) {
  .nav-links { display: none; }
  .nav-toggle { display: block; margin-left: auto; }
  .nav-mask.on { display: block; }
  .nav-drawer {
    display: block; position: fixed; top: 0; right: 0; bottom: 0; z-index: 100;
    width: 240px; background: var(--card); border-left: 1px solid var(--line);
    padding: 60px 20px 20px; transform: translateX(100%); transition: transform .2s;
  }
  .nav-drawer.open { transform: translateX(0); }
  .nav-drawer-link { display: block; width: 100%; padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--text); font-size: 14px; text-align: left; }
  .viewtabs { overflow-x: auto; flex-wrap: nowrap; }
  .viewtab { flex: none; padding: 8px 14px; font-size: 13px; }
  section { padding: 16px; border-radius: 12px; margin-bottom: 12px; }
  .steps { grid-template-columns: 1fr 1fr; }
  #txmap { height: 300px; }
  .auth-mask { align-items: flex-start; padding-top: 10vh; }
  .auth-mask #fauth { max-width: none; }
  body { padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px)); }
  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 80;
    background: var(--card); border-top: 1px solid var(--line);
    padding: 5px 4px env(safe-area-inset-bottom, 5px);
  }
  .tabbar-link { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font-size: 11px; background: none; border: 0; }
  .tabbar-link.cur { color: var(--accent); }
  .tabbar-link .ti { font-size: 19px; line-height: 1; }
}

/* ---------- 补充组件 ---------- */
.q { border-bottom: 1px solid var(--line); padding: 12px 0; }
.q:last-of-type { border-bottom: 0; }
.q summary { cursor: pointer; font-size: 14px; font-weight: 500; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.q summary::-webkit-details-marker { display: none; }
.q summary::after { content: "+"; color: var(--muted); font-size: 16px; font-weight: 400; flex: none; }
.q[open] summary::after { content: "−"; }
.q p { color: var(--muted); font-size: 13px; line-height: 1.75; margin: 8px 0 0; }

.gl { display: grid; gap: 8px; }
.gl > div { background: #fafbfc; border-radius: 10px; padding: 10px 12px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.gl b { color: var(--text); font-weight: 600; margin-right: 6px; }

.forum-main { min-width: 0; }
.tag2 { display: inline-block; font-size: 12px; border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 2px 10px; }
.tag2.acc { border-color: var(--accent); color: var(--accent); }
.ckin { display: block; width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; margin-top: 6px; }
.sim-compare-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.p { padding: 10px 0; border-bottom: 1px solid var(--line); }

@media (max-width: 680px) {
  .gl { grid-template-columns: 1fr; }
  .sim-compare-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr 1fr; }
}

/* ---------- 论坛：Flarum 式标签与双维度浏览 ---------- */
.side-seg { display: flex; gap: 4px; background: #eceef1; border-radius: 10px; padding: 3px; }
.side-seg button { flex: 1; border: 0; background: transparent; padding: 6px 0; border-radius: 8px; font-size: 12px; color: #666; }
.side-seg button.on { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.side-list { display: flex; flex-direction: column; gap: 2px; }
.side-list button {
  display: flex; justify-content: space-between; align-items: center;
  border: 0; background: transparent; padding: 8px 10px; border-radius: 8px;
  font-size: 13px; color: #555; text-align: left; width: 100%;
}
.side-list button:hover { background: #f4f6f8; }
.side-list button[aria-pressed="true"] { background: var(--accent-light); color: var(--accent-dark); font-weight: 600; }

.f-filterbar {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  background: var(--accent-light); color: var(--accent-dark);
  border-radius: 10px; padding: 8px 12px; font-size: 12px; margin-bottom: 12px;
}

.f-tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 2px 0 7px; }
.f-tag {
  display: inline-block; font-size: 11px; line-height: 1;
  padding: 4px 9px; border-radius: 999px;
  background: #f2f4f6; color: #66727e;
}
.f-tag:hover { background: var(--accent-light); color: var(--accent-dark); }
.f-tag-cat { background: var(--accent-light); color: var(--accent-dark); }

.fpost-meta { display: grid; grid-template-columns: 150px 1fr; gap: 10px; align-items: start; margin-bottom: 8px; }
.fpost-meta .in { margin-bottom: 0; }
.ftags-pick { display: flex; flex-direction: column; gap: 6px; }
.ftags-pick .in { margin-bottom: 0; }
.ftags-chosen { display: flex; flex-wrap: wrap; gap: 6px; }
.ftag {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--accent-light); color: var(--accent-dark);
  border-radius: 999px; padding: 4px 6px 4px 10px; font-size: 12px;
}
.ftag button { border: 0; background: none; color: inherit; font-size: 14px; line-height: 1; padding: 0 2px; cursor: pointer; }

@media (max-width: 680px) {
  .fpost-meta { grid-template-columns: 1fr; }
  .forum-side { order: -1; }
}

/* 正文图片统一限高：任何位置插入的图片都不超过 420px，竖图也不会占满屏幕 */
#fl img, #dmsgs img, #articleModalBox img, .row img, .article-body img {
  max-width: 100%; max-height: 420px; width: auto; height: auto;
  object-fit: contain; border-radius: 8px; display: block; margin: 8px 0;
}
@media (max-width: 680px) {
  #fl img, #dmsgs img, #articleModalBox img, .row img, .article-body img { max-height: 300px; }
}
/* 讨论行：只显示标题，收紧上下留白 */
#fl .row { padding: 13px 0; }
#fl .row h3 { font-size: 14px; margin-bottom: 4px; line-height: 1.5; }

/* 飞场：坐标折叠区，默认收起，普通用户不用管 */
.s-coord { margin: 8px 0; }
.s-coord summary { font-size: 12px; color: var(--muted); cursor: pointer; padding: 4px 0; }
.s-coord summary::-webkit-details-marker { display: none; }
.s-coord summary::before { content: "▸ "; color: #bbb; }
.s-coord[open] summary::before { content: "▾ "; }
