/* ===== 基础 ===== */
html { background: #f7f4ec; -webkit-text-size-adjust: 100%; }
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }

:root {
  --accent: #2f6b4f;
  --ink: #14261f;
  --ink-2: #43584e;
  --muted: #7d9188;
  --paper: #f7f4ec;
  --line: #e7e1d3;
  --green: #2f9e77;
}

/* =========================================================
   游客落地页
   ========================================================= */
body.guest { background: #e9efe9; color: var(--ink); }
.guest-shell {
  position: relative; max-width: 480px; min-height: 100vh; margin: 0 auto;
  background: var(--paper); overflow: hidden;
}
@media (min-width: 560px) {
  body.guest {
    padding: 28px 0 44px;
    background: radial-gradient(820px 420px at 50% 0%, #deeae0, #c2d3c7 72%);
  }
  .guest-shell {
    min-height: calc(100vh - 72px); border-radius: 30px;
    box-shadow: 0 30px 70px rgba(16, 40, 32, .22);
  }
}

/* 首屏大图 */
.hero {
  position: relative; height: clamp(420px, 74vh, 600px); overflow: hidden; background: #16241d;
}
.hero-img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transform: scale(1.07); animation: heroIn 1.7s cubic-bezier(.22, .68, .2, 1) forwards;
}
@keyframes heroIn { to { transform: scale(1); } }
.hero-scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(6, 15, 11, .6) 0%, rgba(6, 15, 11, .06) 30%, rgba(6, 15, 11, .3) 56%, rgba(8, 18, 14, .94) 100%);
}
.hero-fallback {
  position: absolute; inset: 0; display: grid; place-items: center; font-size: 168px;
  background: linear-gradient(160deg, var(--accent), #12261f 78%);
  filter: drop-shadow(0 20px 30px rgba(0, 0, 0, .4));
}
.hero-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3;
  display: flex; align-items: center; justify-content: space-between; padding: 15px 17px;
}
.back {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-size: 15px; background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .28); backdrop-filter: blur(10px);
  transition: background .16s ease;
}
.back:active { background: rgba(255, 255, 255, .3); }
.code-chip {
  font-size: 10.5px; font-weight: 700; letter-spacing: .16em; color: #fff;
  padding: 7px 12px; border-radius: 999px; background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .26); backdrop-filter: blur(10px);
}

.hero-text {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 0 22px 46px; color: #fff;
}
.kicker {
  font-size: 10px; font-weight: 600; letter-spacing: .26em; text-transform: uppercase;
  color: rgba(255, 255, 255, .66);
}
.hero-text h1 {
  margin-top: 11px; font-size: 40px; font-weight: 800; line-height: 1.05; letter-spacing: -.02em;
  text-shadow: 0 2px 20px rgba(0, 0, 0, .25);
}
.latin { margin-top: 9px; font-size: 12px; font-style: italic; color: rgba(255, 255, 255, .6); }
.level {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 15px;
  padding: 6px 12px; border-radius: 9px; font-size: 11px; color: #fff;
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .24);
  backdrop-filter: blur(8px);
}
.level::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.level[data-tone="danger"] { background: rgba(212, 76, 52, .34); border-color: rgba(255, 152, 130, .4); }
.level[data-tone="safe"] { background: rgba(52, 178, 122, .3); border-color: rgba(140, 236, 186, .36); }

/* 档案卡 */
.stat {
  position: relative; z-index: 3; margin: -30px 16px 0; padding: 4px 18px;
  background: #fff; border-radius: 18px; box-shadow: 0 18px 40px rgba(16, 38, 30, .13);
}
.stat .row { display: flex; gap: 16px; padding: 14px 0; }
.stat .row + .row { border-top: 1px solid #f0ebdf; }
.stat dt { flex: 0 0 44px; font-size: 11px; letter-spacing: .1em; color: #97a79e; padding-top: 2px; }
.stat dd { flex: 1; font-size: 13px; line-height: 1.68; color: #1d342a; font-weight: 500; }

/* 正文区块 */
.sec { padding: 32px 22px 0; }
.sec-label { display: flex; align-items: center; gap: 9px; }
.sec-label i {
  font-style: normal; font-size: 9.5px; font-weight: 700; letter-spacing: .04em;
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  color: var(--accent); background: #fff; border: 1px solid #e2ddcf;
}
.sec-label span { font-size: 10.5px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: #9aa8a0; }
.prose p { margin-top: 15px; font-size: 14.5px; line-height: 2.05; color: #2c423a; }
.prose p:first-child { font-size: 15.5px; color: #172e25; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 18px 22px 0; }
.chip {
  font-size: 11.5px; line-height: 1; padding: 9px 12px; border-radius: 10px;
  color: #1e4a3a; background: #fff; border: 1px solid #e4dfd2;
}

/* 第二张图 */
.photo { margin: 26px 16px 0; }
.photo img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 18px;
  box-shadow: 0 16px 34px rgba(16, 38, 30, .18);
}
.photo figcaption {
  margin-top: 10px; font-size: 10px; letter-spacing: .12em; color: #a7b3ab; text-align: right;
}

/* 展区信息 */
.rows { margin-top: 12px; }
.rows .row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid #eae4d6;
}
.rows .row:last-child { border-bottom: 0; }
.rows dt { font-size: 12px; color: #97a79e; }
.rows dd { font-size: 12.5px; font-weight: 600; color: #1d342a; text-align: right; }

.sign-foot { padding: 24px 22px 34px; }
.sign-foot .zoo {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 18px; border-top: 1px solid #eae4d6;
  font-size: 11px; letter-spacing: .08em; color: #97a79e;
}
.sign-foot .zoo b { color: var(--accent); letter-spacing: .12em; }
.credit { margin-top: 10px; font-size: 10px; line-height: 1.75; color: #b3bfb7; }

.reveal { opacity: 0; transform: translateY(16px); transition: opacity .65s ease, transform .65s ease; }
.reveal.is-in { opacity: 1; transform: none; }

/* 滚动后的迷你标题栏（仅手机） */
.mini-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 18px; background: rgba(247, 244, 236, .9);
  border-bottom: 1px solid rgba(20, 40, 32, .07); backdrop-filter: blur(16px);
  transform: translateY(-105%); transition: transform .32s cubic-bezier(.3, .8, .3, 1);
}
.mini-bar.on { transform: none; }
.mini-bar strong { font-size: 14px; font-weight: 700; color: #16302a; letter-spacing: .02em; }
.mini-bar span { font-size: 10px; font-weight: 700; letter-spacing: .14em; color: #9aa8a0; }
@media (min-width: 560px) { .mini-bar { display: none; } }

/* =========================================================
   管理后台
   ========================================================= */
body.admin {
  min-height: 100vh; color: #e8f4ee;
  background:
    radial-gradient(1000px 520px at 6% -10%, #1d5343 0%, transparent 60%),
    radial-gradient(860px 480px at 102% -8%, #14394c 0%, transparent 58%),
    #071713;
}
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 13px 24px; background: rgba(7, 23, 19, .74);
  border-bottom: 1px solid rgba(255, 255, 255, .08); backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 11px; flex: 0 0 auto; white-space: nowrap; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 20px;
  background: linear-gradient(135deg, #2f9e77, #16624a); box-shadow: 0 6px 16px rgba(47, 158, 119, .38);
}
.brand strong { display: block; font-size: 14.5px; letter-spacing: .3px; }
.brand small { display: block; margin-top: 2px; font-size: 11px; color: #83a999; }
.entry {
  font-size: 11.5px; padding: 7px 12px; border-radius: 999px; max-width: 46vw;
  color: #9fd8bf; background: rgba(79, 209, 165, .1); border: 1px solid rgba(79, 209, 165, .25);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.entry.is-warn { color: #ffd28a; background: rgba(255, 176, 58, .12); border-color: rgba(255, 176, 58, .34); }

.admin-grid {
  display: grid; grid-template-columns: 372px minmax(0, 1fr); gap: 24px;
  max-width: 1320px; margin: 0 auto; padding: 24px 24px 40px; align-items: start;
}
.panel {
  background: rgba(255, 255, 255, .045); border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 18px; padding: 18px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-head h2 { font-size: 14.5px; letter-spacing: .5px; }
.panel-head span { font-size: 11px; color: #7fa595; }

.form-col form { display: flex; flex-direction: column; gap: 12px; }
.gr2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fld { display: flex; flex-direction: column; gap: 6px; }
.fld > label { font-size: 11.5px; color: #8fb3a5; letter-spacing: .3px; }
input, textarea, select {
  width: 100%; font: inherit; font-size: 13px; color: #eaf5ef;
  padding: 10px 12px; border-radius: 10px;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12);
  transition: border-color .16s ease, background .16s ease;
}
input::placeholder, textarea::placeholder { color: #59766a; }
input:focus, textarea:focus { outline: none; border-color: #4fd1a5; background: rgba(79, 209, 165, .08); }
textarea { resize: vertical; min-height: 92px; line-height: 1.72; }
input[type="color"] { height: 42px; padding: 4px; cursor: pointer; }
.counter { align-self: flex-end; font-size: 10.5px; color: #5f7f71; }

.form-actions { display: flex; gap: 10px; margin-top: 4px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 18px; border-radius: 11px; font-size: 13px; font-weight: 600;
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.btn:active { transform: scale(.98); }
.btn-primary {
  flex: 1; color: #06251b; background: linear-gradient(135deg, #6ef0bf, #2f9e77);
  box-shadow: 0 10px 22px rgba(47, 158, 119, .32);
}
.btn-plain { color: #a7c8bb; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .1); }
.hint { margin-top: 12px; font-size: 11px; line-height: 1.75; color: #6f9385; }
.hint code { color: #8fd8b8; font-size: 10.5px; }
.link-btn { padding: 0; font-size: 11px; color: #7df0c6; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: #b6f7dd; }

.img-preview { display: flex; gap: 10px; }
.img-preview figure { margin: 0; width: 88px; }
.img-preview img, .img-preview .ph {
  width: 88px; height: 62px; border-radius: 9px; object-fit: cover; display: grid; place-items: center;
  font-size: 20px; background: rgba(255, 255, 255, .06); border: 1px dashed rgba(255, 255, 255, .16);
}
.img-preview img { border-style: solid; border-color: rgba(255, 255, 255, .12); }
.img-preview img.is-bad { border-color: rgba(255, 122, 92, .65); }
.img-preview figcaption {
  margin-top: 5px; font-size: 10px; line-height: 1.4; color: #6f9385;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.img-preview img.is-bad + figcaption { color: #ff9f88; }

.preview-col { display: flex; flex-direction: column; gap: 16px; }
.stage-row { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }

.base-bar {
  display: flex; flex-direction: column; gap: 8px; padding: 13px 15px; border-radius: 13px;
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .09);
}
.base-bar > label { font-size: 11.5px; color: #8fb3a5; letter-spacing: .3px; }
.base-row { display: flex; gap: 8px; }
.base-row input { flex: 1; }
.base-row .btn { flex: 0 0 auto; padding: 9px 15px; font-size: 12.5px; color: #c8e6d8; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .13); }
.base-hint { font-size: 11px; line-height: 1.75; color: #8fb3a5; }
.base-hint.warn { color: #ffcf84; }

.sign-card {
  width: 232px; padding: 14px; border-radius: 15px; color: #10312a; background: #fff;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .34);
}
.sc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.sc-code {
  font-size: 10.5px; font-weight: 700; letter-spacing: .6px; color: #1d7a5b;
  background: #eaf5ef; padding: 3px 7px; border-radius: 6px;
}
.sc-zoo { font-size: 9.5px; color: #93a49b; letter-spacing: .5px; }
.qr {
  aspect-ratio: 1 / 1; display: grid; place-items: center; overflow: hidden;
  border: 1px dashed #cfdcd5; border-radius: 9px; padding: 8px; background: #fff;
}
.qr svg, .qr img { width: 100%; height: 100%; }
.qr-err { font-size: 10px; color: #b06a5a; text-align: center; line-height: 1.6; }
.sc-name { margin-top: 10px; text-align: center; font-size: 15px; font-weight: 700; letter-spacing: .5px; }
.sc-hint { margin-top: 3px; text-align: center; font-size: 9.5px; color: #93a49b; }
.sc-note { margin-top: 4px; text-align: center; font-size: 8.5px; line-height: 1.5; color: #b3bfb7; }

.preview {
  width: 296px; height: 592px; padding: 9px; border-radius: 32px;
  background: linear-gradient(160deg, #2d3d37, #0d1512);
  box-shadow: 0 26px 52px rgba(0, 0, 0, .45);
}
.preview iframe { width: 100%; height: 100%; border: 0; border-radius: 24px; background: var(--paper); }

.actions { display: flex; flex-wrap: wrap; gap: 9px; }
.actions .btn { padding: 9px 14px; font-size: 12.5px; color: #c8e6d8; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .11); }
.actions .btn:hover { background: rgba(79, 209, 165, .14); border-color: rgba(79, 209, 165, .3); }
.url-line {
  font-size: 10.5px; line-height: 1.7; color: #5f7f71; word-break: break-all;
  padding: 9px 11px; border-radius: 9px; background: rgba(0, 0, 0, .22); border: 1px solid rgba(255, 255, 255, .06);
}

.list-wrap { max-width: 1320px; margin: 0 auto; padding: 0 24px 60px; }
.list-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.list-head h2 { font-size: 15px; letter-spacing: .5px; }
.list-head small { font-size: 11.5px; color: #7fa595; }
.list { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.item {
  position: relative; display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 11px 12px; border-radius: 12px; color: #10312a; background: #fff;
  border: 2px solid transparent; cursor: pointer;
  transition: transform .16s ease, border-color .16s ease;
}
.item:hover { transform: translateY(-3px); }
.item.is-active { border-color: #4fd1a5; }
.item .emoji { font-size: 22px; line-height: 1; }
.item .thumb { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; flex: 0 0 auto; }
.item strong { display: block; font-size: 13px; }
.item small { display: block; margin-top: 2px; font-size: 10px; color: #8b9c93; }
.item .del {
  position: absolute; top: 7px; right: 7px; padding: 2px 6px; border-radius: 6px;
  font-size: 10px; color: #c05a4a; background: #fdecea;
}

.toast {
  position: fixed; left: 50%; bottom: 32px; z-index: 90;
  padding: 10px 18px; border-radius: 999px; font-size: 12.5px; white-space: nowrap;
  color: #d8f0e4; background: rgba(14, 40, 32, .95); box-shadow: 0 12px 30px rgba(0, 0, 0, .3);
  opacity: 0; transform: translate(-50%, 14px); pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ===== 入口导航页 ===== */
body.home {
  min-height: 100vh; display: grid; place-items: center; padding: 30px 18px; color: #e8f4ee;
  background:
    radial-gradient(900px 480px at 12% -10%, #1d5343 0%, transparent 62%),
    radial-gradient(760px 420px at 100% 110%, #14394c 0%, transparent 58%),
    #071713;
}
.home-box { width: 100%; max-width: 760px; }
.home-title { text-align: center; margin-bottom: 26px; }
.home-title .logo {
  width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 15px; font-size: 27px;
  display: grid; place-items: center; background: linear-gradient(135deg, #2f9e77, #16624a);
  box-shadow: 0 10px 24px rgba(47, 158, 119, .4);
}
.home-title h1 { font-size: 22px; letter-spacing: .5px; }
.home-title p { margin-top: 8px; font-size: 13px; color: #8fb3a5; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .cards { grid-template-columns: 1fr; } }
.home-card {
  display: block; padding: 20px; border-radius: 18px; background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .1); transition: transform .18s ease, background .18s ease;
}
.home-card:hover { transform: translateY(-4px); background: rgba(79, 209, 165, .1); }
.home-card .k { font-size: 11px; letter-spacing: 1.6px; color: #6fe0b6; }
.home-card h3 { margin-top: 9px; font-size: 17px; }
.home-card p { margin-top: 8px; font-size: 12.5px; line-height: 1.85; color: #8fb3a5; }
.home-foot { margin-top: 22px; text-align: center; font-size: 11.5px; line-height: 1.9; color: #6f9385; }
.home-foot code { color: #7df0c6; }

@media (max-width: 1120px) {
  .admin-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .admin-grid { padding: 16px 14px 30px; }
  .list-wrap { padding: 0 14px 40px; }
  .stage-row { gap: 14px; }
  .preview { width: 100%; height: 520px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001s !important; animation-iteration-count: 1 !important; }
}

@media print {
  body.admin { background: #fff; }
  .topbar, .form-col, .preview, .actions, .url-line, .list-wrap, .hint { display: none !important; }
  .admin-grid { display: block; padding: 0; }
  .preview-col { gap: 0; }
  .sign-card { width: 72mm; box-shadow: none; border: 1px solid #b9b9b9; margin: 0 auto; }
}
