/* 月白花笺 · 网站主题
   以整幅插画为背景, 界面是压在画上的磨砂玻璃卡片.
   配色取自插画: 雾灰紫的夜空 / 白羽 / 绯红 / 花朵的蓝 */
:root {
  --night: #23212f;
  --slate: #3c3a51;
  --mist: #8f8ba3;
  --feather: #f6f4fb;
  --crimson: #b3243b;
  --crimson-hi: #cf3a52;
  --crimson-soft: rgba(179, 36, 59, .10);
  --azure: #6b7bd3;
  --azure-soft: rgba(107, 123, 211, .14);
  --ok: #3f9c74;
  --warn: #c28a2c;

  --text: #23212f;
  --text-sub: #6a667d;
  --text-hint: #9894aa;
  --line: rgba(60, 58, 81, .12);

  --glass: rgba(248, 246, 252, .74);
  --glass-strong: rgba(250, 249, 253, .9);
  --glass-border: rgba(255, 255, 255, .6);
  --shadow: 0 18px 50px -18px rgba(25, 22, 40, .45);

  --radius: 20px;
  --radius-sm: 12px;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text);
  background: var(--night);
  -webkit-font-smoothing: antialiased;
}

/* ---------- 背景插画 ---------- */
/* 图片由 common.js 插入 (加载完淡入, 只请求一次, 随机图不会前后不一致) */
.backdrop {
  position: fixed; inset: 0; z-index: -2; overflow: hidden;
  background: radial-gradient(ellipse at 70% 30%, #4a4762, var(--night) 70%);
}
.backdrop img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center 30%;
  opacity: 0; transform: scale(1.04);
  transition: opacity 1s ease, transform 1.6s ease;
}
.backdrop img.loaded { opacity: 1; transform: scale(1.01); }
.backdrop::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(1200px 700px at 85% 20%, transparent 0, rgba(35, 33, 47, .1) 60%),
    linear-gradient(100deg, rgba(30, 28, 42, .55) 0%, rgba(30, 28, 42, .15) 45%, rgba(30, 28, 42, .05) 70%, rgba(30, 28, 42, .3) 100%);
}
.backdrop.dim::after {
  background: linear-gradient(180deg, rgba(30, 28, 42, .35), rgba(30, 28, 42, .6));
}
/* 个人中心: 顶部头像区压暗, 浅色插画上白字也看得清 */
.backdrop.top::after {
  background:
    linear-gradient(180deg, rgba(30, 28, 42, .62) 0, rgba(30, 28, 42, .38) 330px, rgba(30, 28, 42, .12) 560px, rgba(30, 28, 42, .3) 100%);
}
/* 星点 */
.stars {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    radial-gradient(1.2px 1.2px at 12% 18%, rgba(255,255,255,.8), transparent),
    radial-gradient(1px 1px at 32% 72%, rgba(255,255,255,.6), transparent),
    radial-gradient(1.4px 1.4px at 58% 12%, rgba(255,255,255,.7), transparent),
    radial-gradient(1px 1px at 76% 64%, rgba(255,255,255,.55), transparent),
    radial-gradient(1.2px 1.2px at 90% 30%, rgba(255,255,255,.7), transparent),
    radial-gradient(1px 1px at 45% 45%, rgba(255,255,255,.4), transparent);
  animation: twinkle 6s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .45; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .stars { animation: none; } }

/* ---------- 通用 ---------- */
a { color: var(--crimson); text-decoration: none; }
a:hover { color: var(--crimson-hi); }
h1, h2, h3 { margin: 0; font-weight: 600; }
.serif { font-family: var(--serif); }
.muted { color: var(--text-sub); }
.hint { color: var(--text-hint); font-size: 12px; }
.mono { font-family: Consolas, "Cascadia Mono", monospace; letter-spacing: .02em; }
.hidden { display: none !important; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.spaced { letter-spacing: .28em; text-transform: uppercase; font-size: 11px; }

.glass {
  background: var(--glass);
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card { padding: 22px 24px; }
.card-title { display: flex; align-items: baseline; gap: 10px; margin-bottom: 16px; }
.card-title h3 { font-size: 16px; }
.card-title .hint { margin-left: auto; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  padding: 14px clamp(16px, 4vw, 48px);
  color: #fff;
}
.topbar.solid {
  background: rgba(35, 33, 47, .45);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; }
.brand:hover { color: #fff; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .35);
}
.brand-name { font-family: var(--serif); font-size: 19px; letter-spacing: .2em; }
.topbar nav { display: flex; gap: 6px; margin-left: auto; align-items: center; }
.topbar nav a {
  color: rgba(255, 255, 255, .85); padding: 7px 14px; border-radius: 999px; font-size: 13px;
}
.topbar nav a:hover, .topbar nav a.active { background: rgba(255, 255, 255, .14); color: #fff; }
.top-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,.7); }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; color: var(--text-sub); letter-spacing: .05em; }
.input, select.input, textarea.input {
  width: 100%;
  padding: 11px 14px;
  font: inherit; color: var(--text);
  background: rgba(255, 255, 255, .72);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
textarea.input { resize: vertical; min-height: 120px; line-height: 1.6; }
.input:focus { border-color: rgba(179, 36, 59, .5); box-shadow: 0 0 0 3px var(--crimson-soft); background: #fff; }
.input.code { font-family: Consolas, monospace; letter-spacing: .08em; text-transform: uppercase; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; color: var(--text-sub); }
.check input { accent-color: var(--crimson); width: 16px; height: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px;
  font: inherit; font-weight: 600; letter-spacing: .06em;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  cursor: pointer; white-space: nowrap;
  transition: background .2s, transform .1s, box-shadow .2s, opacity .2s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--crimson); color: #fff; box-shadow: 0 8px 20px -10px rgba(179, 36, 59, .8); }
.btn-primary:hover:not(:disabled) { background: var(--crimson-hi); }
.btn-ghost { background: rgba(255, 255, 255, .6); color: var(--text); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { background: #fff; }
.btn-azure { background: var(--azure); color: #fff; }
.btn-danger { background: transparent; color: var(--crimson); border-color: rgba(179, 36, 59, .35); }
.btn-danger:hover:not(:disabled) { background: var(--crimson-soft); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 9px; }
.btn-block { width: 100%; padding: 12px; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--crimson); cursor: pointer; }

/* ---------- 标签 / 徽章 ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--azure-soft); color: var(--azure);
}
.pill.ok { background: rgba(63, 156, 116, .13); color: var(--ok); }
.pill.bad { background: var(--crimson-soft); color: var(--crimson); }
.pill.warn { background: rgba(194, 138, 44, .14); color: var(--warn); }
.pill.gray { background: rgba(60, 58, 81, .08); color: var(--text-sub); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- 标签页 ---------- */
.tabs { display: flex; gap: 4px; padding: 4px; background: rgba(60, 58, 81, .07); border-radius: 14px; }
.tab {
  flex: 1; padding: 9px 12px; border: 0; background: none; cursor: pointer;
  font: inherit; color: var(--text-sub); border-radius: 10px; font-weight: 600; letter-spacing: .1em;
}
.tab.active { background: #fff; color: var(--crimson); box-shadow: 0 2px 8px rgba(30, 28, 42, .08); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-weight: 600; color: var(--text-sub); font-size: 12px; letter-spacing: .05em;
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.table .pill { white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgba(255, 255, 255, .45); }
.table .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.empty { text-align: center; color: var(--text-hint); padding: 36px 0 !important; }
.avatar-sm { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; vertical-align: middle; background: #eee; }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 14px; color: var(--text-sub); font-size: 12px; }

/* ---------- 弹窗 / 提示 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center; padding: 16px;
  background: rgba(20, 18, 30, .45);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  animation: fade .2s;
}
.modal { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--glass-strong); }
.modal-head { display: flex; align-items: center; padding: 18px 22px 0; }
.modal-head h3 { font-size: 17px; font-family: var(--serif); letter-spacing: .1em; }
.modal-close { margin-left: auto; background: none; border: 0; font-size: 22px; line-height: 1; color: var(--text-hint); cursor: pointer; }
.modal-body { padding: 16px 22px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 0 22px 20px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.toast-box { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  padding: 10px 18px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--glass-strong); color: var(--text); box-shadow: var(--shadow);
  border: 1px solid var(--glass-border);
  animation: toast-in .25s ease-out;
}
.toast.ok { color: var(--ok); }
.toast.err { color: var(--crimson); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.msg { font-size: 13px; min-height: 20px; margin: -4px 0 10px; }
.msg.err { color: var(--crimson); }
.msg.ok { color: var(--ok); }

/* ---------- 首页 ---------- */
.landing {
  min-height: calc(100vh - 64px);
  display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: clamp(20px, 4vw, 56px);
  align-items: center;
  padding: 24px clamp(16px, 5vw, 72px) 48px;
}
.hero { color: #fff; max-width: 560px; }
.hero .kicker { opacity: .8; margin-bottom: 18px; display: flex; align-items: center; gap: 12px; }
.hero .kicker::before { content: ""; width: 36px; height: 1px; background: rgba(255, 255, 255, .6); }
.hero h1 { font-family: var(--serif); font-size: clamp(40px, 6vw, 76px); letter-spacing: .18em; line-height: 1.15; text-shadow: 0 6px 30px rgba(0, 0, 0, .35); }
.hero .sub { font-family: var(--serif); font-size: clamp(16px, 1.6vw, 20px); margin: 18px 0 30px; letter-spacing: .2em; opacity: .92; text-shadow: 0 2px 12px rgba(0, 0, 0, .4); }

.notice-board { padding: 18px 20px; max-width: 520px; }
.notice-board .card-title { margin-bottom: 10px; }
.notice-list { display: flex; flex-direction: column; gap: 2px; max-height: 300px; overflow: auto; }
.notice {
  display: block; width: 100%; text-align: left; font: inherit; color: inherit;
  padding: 10px 12px; border-radius: 12px; border: 0; background: none; cursor: pointer;
}
.notice:hover { background: rgba(255, 255, 255, .55); }
.notice-head { display: flex; align-items: center; gap: 8px; }
.notice-title { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notice-date { color: var(--text-hint); font-size: 12px; flex: none; }
.notice-preview { color: var(--text-sub); font-size: 12.5px; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.55; }
.pin { font-size: 11px; color: var(--crimson); background: var(--crimson-soft); padding: 1px 7px; border-radius: 6px; flex: none; }
.notice-full { white-space: pre-wrap; line-height: 1.8; color: var(--text); }

.auth-panel { padding: 26px 28px 22px; }
.auth-panel .tabs { margin-bottom: 22px; }
.auth-panel h2 { font-family: var(--serif); font-size: 22px; letter-spacing: .14em; margin-bottom: 4px; }
.auth-panel .lead { color: var(--text-sub); font-size: 13px; margin: 0 0 20px; }
.card-types { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 14px; }
.card-types span { font-size: 11px; padding: 2px 8px; border-radius: 6px; background: var(--azure-soft); color: var(--azure); }

@media (max-width: 900px) {
  .landing { grid-template-columns: 1fr; align-items: start; }
  .hero { order: 0; }
  .auth-panel { order: 1; }
  .notice-board { max-width: none; }
}

/* ---------- 个人中心 ---------- */
.page { max-width: 1120px; margin: 0 auto; padding: 8px clamp(16px, 4vw, 32px) 56px; }
.profile-hero {
  position: relative;
  display: flex; align-items: flex-end; gap: 26px; flex-wrap: wrap;
  padding: 120px 4px 26px; color: #fff;
}
.avatar-ring { position: relative; flex: none; }
.avatar-ring img {
  width: 116px; height: 116px; border-radius: 50%; object-fit: cover; display: block;
  border: 4px solid #fff; background: #ddd;
  box-shadow: 0 0 0 3px var(--crimson), 0 18px 40px -12px rgba(0, 0, 0, .6);
}
.avatar-ring .moon {
  position: absolute; right: -2px; top: 4px; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; background: #fff; color: var(--crimson); box-shadow: 0 4px 10px rgba(0,0,0,.2);
}
.profile-meta { flex: 1; min-width: 220px; }
.profile-meta h1 { font-family: var(--serif); font-size: 34px; letter-spacing: .12em; text-shadow: 0 4px 20px rgba(0, 0, 0, .4); }
.profile-meta .row { margin-top: 10px; }
.profile-meta .uid { opacity: .85; font-size: 13px; letter-spacing: .1em; text-shadow: 0 1px 8px rgba(0, 0, 0, .6); }
.profile-meta .pill { backdrop-filter: blur(8px); background: rgba(255, 255, 255, .85); }
.profile-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-glass { background: rgba(255, 255, 255, .18); color: #fff; border: 1px solid rgba(255, 255, 255, .4); backdrop-filter: blur(8px); }
.btn-glass:hover:not(:disabled) { background: rgba(255, 255, 255, .3); }

.stat-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; padding: 4px; margin-bottom: 22px; }
.stat { padding: 16px 20px; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat .label { font-size: 12px; color: var(--text-sub); letter-spacing: .1em; }
.stat .value { font-size: 20px; font-weight: 700; margin-top: 6px; font-family: var(--serif); }
.stat .value.crimson { color: var(--crimson); }
@media (max-width: 640px) {
  .stat-strip { grid-template-columns: 1fr; }
  .stat + .stat { border-left: 0; border-top: 1px solid var(--line); }
}

.user-tabs { margin-bottom: 18px; max-width: 640px; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: var(--shadow); }
.grid-2 { display: grid; grid-template-columns: 1fr 1.4fr; gap: 20px; align-items: start; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

.plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-bottom: 16px; }
.plan {
  position: relative; text-align: left; font: inherit; color: inherit; cursor: pointer;
  padding: 14px 14px 12px; border-radius: 14px; background: rgba(255, 255, 255, .62);
  border: 1.5px solid var(--line); transition: border-color .2s, transform .15s, box-shadow .2s;
}
.plan:hover { transform: translateY(-2px); }
.plan.selected { border-color: var(--crimson); box-shadow: 0 0 0 3px var(--crimson-soft); background: #fff; }
.plan .name { font-weight: 700; letter-spacing: .08em; }
.plan .days { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.plan .price { margin-top: 10px; font-family: var(--serif); font-size: 22px; color: var(--crimson); font-weight: 700; }
.plan .price small { font-size: 12px; margin-right: 2px; }
.methods { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.method {
  display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 12px; cursor: pointer;
  border: 1.5px solid var(--line); background: rgba(255,255,255,.6); font-weight: 600;
}
.method input { accent-color: var(--crimson); }
.method:has(input:checked) { border-color: var(--crimson); background: #fff; }

.kv { display: grid; grid-template-columns: 90px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--text-sub); }
.kv dd { margin: 0; font-weight: 600; word-break: break-all; }
.pay-box { text-align: center; padding: 18px; border-radius: 14px; background: rgba(60, 58, 81, .05); margin-top: 14px; color: var(--text-sub); line-height: 1.7; }
.pay-box img { width: 180px; height: 180px; }

.steps { margin: 0; padding-left: 20px; line-height: 2; color: var(--text-sub); }
.steps b { color: var(--text); }
kbd { font-family: Consolas, monospace; font-size: 12px; padding: 1px 6px; border-radius: 5px; background: #fff; border: 1px solid var(--line); box-shadow: 0 1px 0 var(--line); }

/* ---------- 后台 ---------- */
.admin { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.admin-side {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px;
  padding: 22px 14px; color: #fff;
  background: rgba(30, 28, 42, .62);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-right: 1px solid rgba(255, 255, 255, .08);
}
.admin-side .brand { padding: 0 8px 18px; }
.admin-side .tagline { font-size: 11px; opacity: .55; letter-spacing: .3em; padding: 0 10px 14px; }
.side-link {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px;
  color: rgba(255, 255, 255, .78); background: none; border: 0; font: inherit; text-align: left; cursor: pointer;
}
.side-link svg { width: 17px; height: 17px; flex: none; }
.side-link:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.side-link.active { background: rgba(255, 255, 255, .92); color: var(--crimson); font-weight: 600; }
.admin-side .foot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.admin-main { padding: 26px clamp(16px, 3vw, 36px) 48px; min-width: 0; }
.admin-head { display: flex; align-items: flex-end; gap: 12px; color: #fff; margin-bottom: 20px; flex-wrap: wrap; }
.admin-head h2 { font-family: var(--serif); font-size: 26px; letter-spacing: .14em; text-shadow: 0 3px 16px rgba(0,0,0,.4); }
.admin-head .muted { color: rgba(255, 255, 255, .7); }
.admin .glass { background: var(--glass-strong); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.tile { padding: 18px 20px; }
.tile .label { font-size: 12px; color: var(--text-sub); letter-spacing: .08em; }
.tile .value { font-family: var(--serif); font-size: 28px; font-weight: 700; margin-top: 8px; }
.tile .value.crimson { color: var(--crimson); }
.tile .value.azure { color: var(--azure); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .input { width: auto; min-width: 140px; padding: 8px 12px; }
.codes-out { font-family: Consolas, monospace; font-size: 13px; min-height: 220px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }

.menu-btn { display: none; }
@media (max-width: 860px) {
  .admin { grid-template-columns: 1fr; }
  .admin-side { position: fixed; z-index: 50; left: 0; width: 240px; transform: translateX(-100%); transition: transform .25s; }
  .admin-side.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .form-grid { grid-template-columns: 1fr; }
}
