/* =====================================================
   留言板 · 精美版
   暖纸质感 × 蜂蜜金 × 墨色中文衬线标题
   ===================================================== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f6f1e6;
  --ink: #2e2a23;
  --muted: #97897a;
  --faint: #bfae8e;
  --line: #eadfc6;
  --card: #fffdf7;
  --amber: #c77414;
  --amber-deep: #9a5a0b;
  --gold: linear-gradient(135deg, #f7c948 0%, #ee9b1f 55%, #e07f0a 100%);
  --shadow: 0 12px 32px rgba(133, 94, 28, .10);
  --shadow-lg: 0 20px 48px rgba(133, 94, 28, .16);
  --r: 20px;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
}

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

::selection { background: #f7c948; color: #3a2c10; }

/* ---------- 背景装饰 ---------- */
.bg-decor { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(90px); }
.b1 { width: 540px; height: 540px; left: -170px; top: -150px; background: #ffe9b8; opacity: .55; }
.b2 { width: 460px; height: 460px; right: -150px; top: 24%; background: #ffe0bd; opacity: .45; }
.b3 { width: 620px; height: 620px; left: 28%; bottom: -280px; background: #f6e6c2; opacity: .5; }

.wrap { max-width: 880px; margin: 0 auto; padding: 28px 18px 80px; position: relative; }

/* ---------- 头部 ---------- */
.hero { text-align: center; padding: 56px 0 36px; animation: fadeDown .7s ease both; }
.home-link {
  display: inline-block; margin-bottom: 20px; padding: .42rem 1.1rem;
  font-size: .8rem; letter-spacing: .12em; text-decoration: none;
  color: var(--muted); background: rgba(255,253,247,.72);
  border: 1px solid var(--line); border-radius: 999px;
  transition: color .25s ease, border-color .25s ease, box-shadow .25s ease, transform .25s ease;
}
.home-link:hover {
  color: var(--amber-deep); border-color: #d9b45f;
  box-shadow: var(--shadow); transform: translateY(-1px);
}
.eyebrow {
  font-size: .72rem; letter-spacing: .55em; text-indent: .55em;
  color: var(--amber-deep); font-weight: 700; margin-bottom: 12px;
}
.hero h1 {
  font-family: var(--serif);
  font-size: 3.1rem; font-weight: 700;
  letter-spacing: .14em; text-indent: .14em;
  color: #2b2419;
}
.hero h1 .bee { display: inline-block; margin-right: .08em; animation: bob 3.2s ease-in-out infinite; }
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-8deg); }
  50% { transform: translateY(-9px) rotate(8deg); }
}
.rule { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 16px 0 12px; color: var(--amber); }
.rule i { display: block; width: 76px; height: 2px; border-radius: 2px; }
.rule i:first-child { background: linear-gradient(90deg, transparent, var(--amber)); }
.rule i:last-child { background: linear-gradient(90deg, var(--amber), transparent); }
.rule span { font-size: .8rem; }
.hero p { color: var(--muted); font-size: .95rem; letter-spacing: .06em; }

@keyframes fadeDown { from { opacity: 0; transform: translateY(-16px); } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }

/* ---------- 通用卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid rgba(234, 223, 198, .95);
  border-radius: var(--r);
  padding: 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

/* ---------- 表单卡片 ---------- */
.form-card { animation: rise .6s .1s ease both; position: relative; overflow: hidden; }
.form-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: var(--gold);
}
.form-card h2, .list-head h2 {
  font-family: var(--serif); font-size: 1.25rem; letter-spacing: .1em; margin-bottom: 16px;
}
.count { color: var(--faint); font-weight: 400; font-size: .9rem; font-family: inherit; }
.error {
  color: #c0392b; background: #fdeeee; border: 1px solid #f3c1b8;
  border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; font-size: .9rem;
}
.notice {
  background: #eef7ff; border: 1px solid #c2ddf3; color: #2b6cb0;
  text-align: center; animation: rise .5s ease both;
}
.tip { font-size: .82rem; color: var(--faint); margin-top: 12px; text-align: center; letter-spacing: .04em; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.msg-contact { margin-top: 10px; font-size: .78rem; color: var(--faint); letter-spacing: .05em; }
.contact-cell { font-size: .78rem; color: var(--muted); white-space: nowrap; line-height: 1.7; }

label { display: block; margin-bottom: 16px; font-size: .88rem; color: #6f6350; letter-spacing: .04em; }
input[type="text"], input[type="password"], input[type="email"], input[type="tel"], textarea {
  display: block; width: 100%; margin-top: 8px;
  padding: 12px 14px; font-size: 1rem; line-height: 1.5;
  border: 1.5px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--ink); font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
}
input::placeholder, textarea::placeholder { color: #c3b699; }
input:focus, textarea:focus {
  outline: none; border-color: var(--amber);
  box-shadow: 0 0 0 4px rgba(238, 155, 31, .14);
}
textarea { resize: vertical; min-height: 96px; }

button {
  display: inline-block; padding: 12px 34px; font-size: 1rem; letter-spacing: .1em;
  background: var(--gold); color: #fff; text-shadow: 0 1px 2px rgba(120, 60, 0, .25);
  border: none; border-radius: 999px; cursor: pointer;
  box-shadow: 0 6px 18px rgba(224, 127, 10, .35);
  transition: transform .18s, box-shadow .18s, filter .18s;
  position: relative; overflow: hidden;
}
button::after {
  content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.5), transparent);
  transform: skewX(-20deg); transition: left .5s;
}
button:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 10px 24px rgba(224,127,10,.4); }
button:hover::after { left: 130%; }
button:active { transform: translateY(1px); }

/* ---------- 留言列表 ---------- */
.list-head { margin: 34px 2px 16px; animation: rise .6s .15s ease both; }

.msg { position: relative; overflow: hidden; animation: rise .55s ease both; transition: transform .25s, box-shadow .25s; }
.msg::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--gold); opacity: 0; transition: opacity .25s;
}
.msg:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.msg:hover::before { opacity: 1; }

.msg-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  color: #fff; font-weight: 700; font-size: 1.25rem;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,.15), inset 0 0 0 2px rgba(255,255,255,.35);
}
.name { font-weight: 700; font-size: 1.02rem; }
.time { color: var(--faint); font-size: .8rem; letter-spacing: .03em; }
.floor {
  margin-left: auto; font-size: .78rem; color: var(--amber-deep);
  background: #faf0d7; border: 1px solid #f0dcb0;
  padding: 2px 12px; border-radius: 999px; letter-spacing: .05em;
}
.msg-body { font-size: 1rem; word-break: break-word; color: #453d31; }

.empty {
  text-align: center; color: var(--muted); padding: 56px 20px;
  font-size: 1.05rem; animation: rise .6s .2s ease both;
}
.empty::before { content: "🍯"; display: block; font-size: 2.6rem; margin-bottom: 12px; }

/* ---------- 分页 ---------- */
.pager { text-align: center; margin: 26px 0; color: var(--muted); font-size: .9rem; }
.pager a {
  display: inline-block; color: var(--amber-deep); text-decoration: none;
  background: var(--card); border: 1px solid var(--line);
  padding: 7px 20px; margin: 0 10px; border-radius: 999px;
  box-shadow: 0 3px 10px rgba(133,94,28,.08);
  transition: all .2s;
}
.pager a:hover { background: var(--gold); color: #fff; border-color: transparent; }

/* ---------- 页脚 ---------- */
footer { text-align: center; color: var(--faint); font-size: .8rem; margin-top: 44px; letter-spacing: .06em; }
a { color: var(--amber-deep); }

/* =====================================================
   后台
   ===================================================== */
body.admin { background: #f4efe3; }
body.admin .wrap { max-width: 920px; }

.admin-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 26px 4px 20px; flex-wrap: wrap; gap: 12px;
  animation: fadeDown .6s ease both;
}
.admin-bar h1 {
  font-family: var(--serif); font-size: 1.7rem; letter-spacing: .1em;
  background: linear-gradient(120deg, #8a5a10, #c77414);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.admin-bar a { color: var(--amber-deep); text-decoration: none; margin-left: 16px; font-size: .9rem; }
.admin-bar a:hover { text-decoration: underline; }
.admin-user { color: var(--muted); font-size: .9rem; }

.stats { display: flex; gap: 14px; margin-bottom: 18px; animation: rise .6s .08s ease both; }
.stat {
  flex: 1; display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid rgba(234,223,198,.95);
  border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow);
  transition: transform .2s;
}
.stat:hover { transform: translateY(-2px); }
.stat > i {
  font-style: normal; font-size: 1.5rem; flex-shrink: 0;
  width: 48px; height: 48px; border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #fdf3d8, #fbe3ae);
  box-shadow: inset 0 0 0 1px #f0dcb0;
}
.stat b { display: block; font-size: 1.55rem; color: var(--ink); line-height: 1.2; }
.stat b.warn { color: #d97a1f; }
.stat span { font-size: .8rem; color: var(--muted); letter-spacing: .05em; }

.tabs { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; animation: rise .6s .12s ease both; }
.tabs a {
  padding: 8px 20px; border-radius: 999px; font-size: .9rem; text-decoration: none;
  background: var(--card); border: 1px solid var(--line); color: #6f6350;
  box-shadow: 0 3px 10px rgba(133,94,28,.06); transition: all .2s;
}
.tabs a:hover { border-color: var(--amber); color: var(--amber-deep); }
.tabs a.active { background: var(--gold); color: #fff; border-color: transparent; text-shadow: 0 1px 2px rgba(120,60,0,.25); }

.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar label { margin: 0; display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: .9rem; }
.toolbar input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--amber); }
button.btn-danger, button.btn-approve { padding: 9px 22px; font-size: .88rem; letter-spacing: .05em; }
button.btn-danger { background: linear-gradient(135deg, #e07864, #c94838); box-shadow: 0 6px 16px rgba(201,72,56,.3); }
button.btn-approve { background: linear-gradient(135deg, #63b96a, #3f9a46); box-shadow: 0 6px 16px rgba(63,154,70,.3); }

.admin-table {
  width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card);
  border: 1px solid rgba(234,223,198,.95); border-radius: 16px; overflow: hidden;
  font-size: .88rem; box-shadow: var(--shadow);
  animation: rise .6s .16s ease both;
}
.admin-table th, .admin-table td { padding: 12px 14px; text-align: left; }
.admin-table thead th {
  background: linear-gradient(180deg, #faf3df, #f5ecd4);
  color: #7a6a4d; font-weight: 700; font-size: .8rem; letter-spacing: .12em;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.admin-table tbody tr { transition: background .15s; }
.admin-table tbody tr:not(:last-child) td { border-bottom: 1px solid #f3ead3; }
.admin-table tbody tr:hover { background: #fffaf0; }
.admin-table td input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--amber); }
.admin-table .content-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-table .ip-cell, .admin-table .time-cell { white-space: nowrap; color: var(--muted); font-size: .8rem; }
.admin-table .empty-cell { text-align: center; color: var(--muted); padding: 40px; }
.op-cell { white-space: nowrap; }
.del-link { color: #c0392b; text-decoration: none; }
.del-link:hover { text-decoration: underline; }
.approve-link { color: #2e7d32; text-decoration: none; margin-right: 12px; font-weight: 600; }
.approve-link:hover { text-decoration: underline; }

.badge {
  display: inline-block; padding: 3px 12px; border-radius: 999px;
  font-size: .76rem; white-space: nowrap; letter-spacing: .05em;
}
.badge-pending { background: #fff3d6; color: #b9791a; border: 1px solid #f0d9a0; }
.badge-approved { background: #e6f6e6; color: #2e7d32; border: 1px solid #bfe3bf; }

/* ---------- 小屏适配 ---------- */
@media (max-width: 560px) {
  .hero h1 { font-size: 2.3rem; }
  .form-row { grid-template-columns: 1fr; }
  .stats { flex-wrap: wrap; }
  .stat { flex: 1 1 calc(50% - 7px); }
  .admin-table .ip-cell { display: none; }
  .card { padding: 18px; }
}

/* ---------- 减少动效偏好 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
