/* 永无乡二期 —— 视觉为临时版，定稿后主要改这一段变量和 .hero-art */
:root {
  --bg: #14182a;
  --bg-2: #1c2138;
  --card: #232943;
  --line: #343b5c;
  --text: #ecebf3;
  --muted: #9aa0bd;
  --accent: #d9b56a;
  --accent-ink: #1d1a12;
  --ok: #6fbf8f;
  --bad: #e07a7a;
  --warn: #e5b45a;
  --radius: 12px;
  --font: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --serif: "Songti SC", "Noto Serif SC", "STSong", serif;
  --hero-image: linear-gradient(160deg, #2b3361 0%, #191d33 55%, #3a2a3f 100%);
  --tabbar-h: 60px;
  --topbar-h: 52px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text); font: 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
body.bare { padding-bottom: 0; }
body.noscroll { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.3; }
h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .6em; }
code { background: var(--bg-2); padding: 1px 6px; border-radius: 6px; letter-spacing: .05em; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.error { color: var(--bad); min-height: 1em; margin: 0; font-size: .9rem; }
.error:empty { display: none; }
.warn { color: var(--warn); }
.danger { color: var(--bad) !important; }
.row { display: flex; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
[hidden] { display: none !important; }

/* ---------- 顶栏 / 底部导航 ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
body.bare .topbar { display: none; }
.topbar-inner { max-width: 1100px; margin: 0 auto; height: var(--topbar-h); display: flex; align-items: center; gap: 10px; padding: 0 12px; }
.back { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; }
.back:not(.placeholder):active { background: var(--bg-2); }
.brand { font-family: var(--serif); font-size: 1.15rem; letter-spacing: .2em; color: var(--accent); display: none; }
.page-title { font-weight: 600; flex: 1; }
.desk-nav { display: none; }
.topbar-inner:has(.back.placeholder) .brand { display: block; }   /* 手机上没有返回键的页面显示站名 */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg-2); border-top: 1px solid var(--line);
}
.tabbar:empty { display: none; }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .72rem; color: var(--muted); }
.tabbar a.active { color: var(--accent); }

@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .tabbar { display: none; }
  .brand { display: block; }
  .page-title { text-align: left; padding-left: 12px; border-left: 1px solid var(--line); }
  .desk-nav { display: flex; gap: 4px; }
  .desk-nav a { display: flex; gap: 6px; align-items: center; padding: 6px 12px; border-radius: 999px; color: var(--muted); }
  .desk-nav a:hover { color: var(--text); background: var(--bg-2); }
  .desk-nav a.active { color: var(--accent-ink); background: var(--accent); }
}

.view { max-width: 820px; margin: 0 auto; padding: 16px 12px 32px; }
.view-map, .view-admin { max-width: 1100px; }
.loading, .empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------- 通用组件 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); cursor: pointer; white-space: nowrap;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: .85rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.btn .icon { width: 18px; height: 18px; }
.link { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; font-size: .85rem; }
.icon-btn { background: none; border: 0; color: var(--muted); padding: 6px; cursor: pointer; }
input, textarea, select {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.chips { display: flex; gap: 6px; }
.chip { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 5px 14px; cursor: pointer; color: var(--muted); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.tag { display: inline-block; font-size: .75rem; padding: 1px 8px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); }
.tag.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.tag.gold { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); margin-top: 2px; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.badge { font-size: .68rem; padding: 0 6px; margin-left: 6px; border-radius: 4px; background: var(--accent); color: var(--accent-ink); font-weight: 700; vertical-align: 1px; }
.badge.big { font-size: .75rem; padding: 1px 8px; }

.avatar { display: inline-grid; place-items: center; border-radius: 50%; background: var(--line); color: var(--text); overflow: hidden; flex: none; font-weight: 600; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.xs { width: 22px; height: 22px; font-size: .7rem; }
.avatar.sm { width: 32px; height: 32px; font-size: .85rem; }
.avatar.md { width: 40px; height: 40px; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.3rem; }
.avatar.xl { width: 96px; height: 96px; font-size: 2rem; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--text); color: var(--bg); padding: 8px 16px; border-radius: 999px; opacity: 0; pointer-events: none; transition: .2s; z-index: 100; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); color: #fff; }

.overlay { position: fixed; inset: 0; background: rgb(0 0 0 / .55); z-index: 50; display: grid; place-items: center; padding: 16px; }
.dialog { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; width: 100%; max-width: 460px; max-height: 85vh; overflow: auto; }
.dialog .row.end { margin-top: 12px; }
.code-big { font: 600 1.6rem/1.2 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .15em; text-align: center; padding: 12px; background: var(--bg); border-radius: 10px; user-select: all; }

/* ---------- 登录 ---------- */
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 20px 16px; background: var(--hero-image); }
.auth-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 28px 22px; }
.auth-card .btn.block { margin-top: 8px; }
.auth-title { font-family: var(--serif); text-align: center; font-size: 2rem; letter-spacing: .4em; color: var(--accent); padding-left: .4em; }

/* ---------- 首页 ---------- */
.hero { position: relative; border-radius: 16px; overflow: hidden; aspect-ratio: 16 / 9; margin-bottom: 14px; }
.hero-art { position: absolute; inset: 0; background: var(--hero-image); background-size: cover; background-position: center; }
.hero-text { position: absolute; left: 20px; bottom: 16px; }
.hero-text h1 { font-family: var(--serif); font-size: 2.2rem; letter-spacing: .3em; color: var(--accent); margin: 0; }
.hero-kicker { margin: 0; color: var(--muted); letter-spacing: .3em; }
.me-card { display: flex; gap: 14px; align-items: center; padding: 4px 4px 16px; }
.me-name { font-size: 1.15rem; font-weight: 600; }
.entries { display: grid; gap: 10px; }
@media (min-width: 640px) { .entries { grid-template-columns: repeat(3, 1fr); } }
.entry { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.entry .icon { width: 28px; height: 28px; color: var(--accent); }
.entry div { display: flex; flex-direction: column; }
.entry:hover { border-color: var(--accent); }

/* ---------- 论坛 ---------- */
.forum-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.forum-head .btn.primary { display: none; }
@media (min-width: 900px) { .forum-head .btn.primary { display: inline-flex; } .fab { display: none !important; } }
.fab { position: fixed; right: 16px; bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: 0 6px 20px rgb(0 0 0 / .4); z-index: 15; }
.fab .icon { width: 26px; height: 26px; }
.post-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.post-row { display: flex; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px 10px 6px; }
.post-row:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.post-main { flex: 1; min-width: 0; }
.post-title { margin: 2px 0 4px; font-size: 1rem; }
.excerpt { color: var(--muted); font-size: .9rem; margin: 0 0 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.thumb { width: 76px; height: 76px; border-radius: 8px; object-fit: cover; flex: none; align-self: center; }
.meta { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .8rem; flex-wrap: wrap; }
.meta .name { color: var(--text); }
.meta .icon { width: 15px; height: 15px; }
.like { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.like.vertical { flex-direction: column; justify-content: flex-start; min-width: 40px; gap: 0; font-size: .8rem; }
.like.on { color: var(--bad); }
.like.on .icon { fill: currentColor; }
.post-full h2 { margin-top: 8px; }
.post-full .body, .comment .body { white-space: pre-wrap; word-break: break-word; }
.gallery { display: grid; gap: 6px; margin: 12px 0; }
.gallery img { width: 100%; height: auto; max-height: 70vh; object-fit: contain; background: #000; border-radius: 8px; }
@media (min-width: 640px) { .gallery { grid-template-columns: repeat(2, 1fr); } .gallery a:only-child { grid-column: span 2; } }
.actions { display: flex; gap: 12px; align-items: center; margin-top: 8px; }
.comment-box { margin-bottom: 12px; }
.comment-box .row { margin-top: 6px; }
.comments h3 { margin: 16px 0 8px; }
.comment { padding: 8px 0 0 0; }
.replies { border-left: 2px solid var(--line); padding-left: 12px; margin-left: 10px; }
.comment .actions { margin-top: 2px; }
.compose input, .compose textarea { margin-bottom: 10px; }
.previews { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.preview { position: relative; width: 80px; height: 80px; }
.preview img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.preview button { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--text); color: var(--bg); display: grid; place-items: center; padding: 0; cursor: pointer; }
.preview .icon { width: 14px; height: 14px; }

/* ---------- 铃铛 / 通知 ---------- */
.bell { position: relative; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); flex: none; }
.bell:hover { color: var(--text); background: var(--bg-2); }
.bell .icon { width: 22px; height: 22px; }
.bell-badge { position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--bad); color: #fff; font-size: .68rem; font-weight: 700; line-height: 17px; text-align: center; }
.notice { align-items: flex-start; justify-content: flex-start; }
.notice.unread { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.notice-excerpt { margin: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comment.highlight > .body { background: color-mix(in srgb, var(--accent) 18%, transparent); border-radius: 6px; transition: background 2s; }
.section-title { margin: 18px 4px 8px; font-size: .95rem; color: var(--muted); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 个人设置 ---------- */
.center-col { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.list { padding: 0; overflow: hidden; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 14px 16px; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; cursor: pointer; }
.list-item:last-child { border-bottom: 0; }
.chev { color: var(--muted); font-size: 1.2rem; }

/* ---------- 地图 ---------- */
.map-strip { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 10px; padding-bottom: 2px; }
.strip-item { display: flex; align-items: center; gap: 6px; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); font-size: .85rem; white-space: nowrap; color: var(--muted); }
.strip-item.active { color: var(--text); border-color: var(--accent); }
.strip-item.disabled { opacity: .5; }
.strip-item.cleared .step-no { background: var(--ok); color: #0d1f14; }
.step-no { width: 22px; height: 22px; border-radius: 50%; background: var(--line); display: grid; place-items: center; font-size: .75rem; font-weight: 700; }
.map-status { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.map-status .btn { margin-left: auto; }
.map-frame { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #000; }
.map-scroll { overflow: auto; max-height: calc(100dvh - 230px); -webkit-overflow-scrolling: touch; }
.map-canvas { position: relative; width: 100%; user-select: none; }
.map-img { width: 100%; height: 100%; object-fit: cover; }
.marker {
  position: absolute; transform: translate(-50%, -50%); width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid #fff; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: .8rem;
  display: grid; place-items: center; cursor: pointer; box-shadow: 0 2px 8px rgb(0 0 0 / .5); padding: 0;
  transition: transform .15s;
}
.marker:hover, .marker:focus-visible { transform: translate(-50%, -50%) scale(1.15); }
.marker:active { transform: translate(-50%, -50%) scale(.92); }
.marker.required { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent), 0 2px 8px rgb(0 0 0 / .5); }
.marker.read { background: #8ea2d8; }
.marker.done { background: var(--ok); color: #0d1f14; }
@media (min-width: 900px) { .marker { width: 34px; height: 34px; } }
.zoom { position: absolute; right: 8px; bottom: 8px; display: flex; flex-direction: column; gap: 4px; }
.zoom button { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); font-size: 1.2rem; cursor: pointer; }
.next-panel { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.next-panel .btn { align-self: flex-start; }
.blocked { text-align: center; padding: 32px 16px; }
.countdown { font: 600 2.4rem/1 ui-monospace, Menlo, Consolas, monospace; margin: 4px 0 20px; color: var(--accent); }

/* 点位窗口：手机底部弹出，电脑居中 */
.sheet-overlay { place-items: end center; padding: 0; }
.sheet { background: var(--card); width: 100%; max-height: 88dvh; border-radius: 18px 18px 0 0; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
@media (min-width: 700px) {
  .sheet-overlay { place-items: center; padding: 20px; }
  .sheet { max-width: 560px; border-radius: 16px; max-height: 80vh; }
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; }
.sheet-head h3 { margin: 0; }
.sheet-body { overflow: auto; padding: 6px 16px; flex: 1; }
.sheet-foot { padding: 10px 16px 16px; }
.sheet-foot:empty { padding: 0 0 8px; }
.step-text { white-space: pre-wrap; animation: fade .25s; }
@keyframes fade { from { opacity: 0; } }
.step-img { margin: 0 0 12px; } .step-img img { border-radius: 8px; } .step-img figcaption { color: var(--muted); font-size: .85rem; margin-top: 4px; }
.step-item { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px dashed var(--accent); border-radius: 10px; margin-bottom: 12px; }
.step-item img { width: 56px; height: 56px; object-fit: contain; }
.step-item div { display: flex; flex-direction: column; }
.step-item p { margin: 2px 0 0; }
.puzzle { background: var(--bg-2); border-radius: 10px; padding: 12px; margin-bottom: 12px; }
.puzzle .row { margin-top: 6px; }
.puzzle.solved { border-left: 3px solid var(--ok); }
.puzzle .answer { color: var(--ok); }
.puzzle details { color: var(--muted); font-size: .9rem; }
.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }
.bag { list-style: none; padding: 0; margin: 0; }
.bag li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.bag img { width: 40px; height: 40px; object-fit: contain; }

/* ---------- 管理后台 ---------- */
.seg { display: flex; background: var(--bg-2); border-radius: 10px; padding: 3px; margin-bottom: 14px; }
.seg a { flex: 1; text-align: center; padding: 8px; border-radius: 8px; color: var(--muted); font-size: .9rem; }
.seg a.on { background: var(--card); color: var(--text); font-weight: 600; }
.admin section > .row, .admin section > .chips { margin-bottom: 10px; }
.search { max-width: 280px; }
.filters { flex-wrap: wrap; } .filters select { width: auto; flex: 1; min-width: 140px; }
.ptable { display: flex; flex-direction: column; gap: 8px; }
.prow { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: grid; gap: 8px; }
.prow.head { display: none; }
.pcell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pcell.who { gap: 10px; }
.pcell .label { color: var(--muted); font-size: .8rem; width: 4.5em; flex: none; }
.pcell select { width: auto; padding: 6px 10px; }
@media (min-width: 900px) {
  .ptable { gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
  .prow { grid-template-columns: 1.4fr 1.4fr 1.2fr 130px 100px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; align-items: center; }
  .prow.head { display: grid; background: var(--bg-2); color: var(--muted); font-size: .8rem; padding: 8px 12px; }
  .pcell .label { display: none; }
}
.admin-item strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plot-row { display: grid; grid-template-columns: 1fr; gap: 2px; cursor: default; }
@media (min-width: 700px) { .plot-row { grid-template-columns: 2fr 1fr 150px; align-items: center; } }
