:root {
  --pink: #fb7299;
  --pink-dark: #e8567f;
  --pink-soft: #ffd9e4;
  --blue: #00a1d6;
  --purple: #7c5cff;
  --bg: #f2f4fa;
  --card: #ffffff;
  --text: #1b2130;
  --muted: #78849c;
  --line: #e7ebf4;
  --ok: #12b76a;
  --warn: #f79009;
  --err: #f04438;
  --radius: 18px;
  --radius-sm: 11px;
  --shadow-sm: 0 2px 8px rgba(27, 33, 48, .05);
  --shadow: 0 10px 30px rgba(27, 33, 48, .08);
  --shadow-lg: 0 18px 50px rgba(27, 33, 48, .13);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
  --grad: linear-gradient(135deg, #fb7299 0%, #ff8fab 45%, #ffa8c5 100%);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  padding: 0;
  color: var(--text);
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  background-image:
    radial-gradient(900px 420px at 12% -8%, rgba(251, 114, 153, .16), transparent 60%),
    radial-gradient(760px 380px at 92% 2%, rgba(124, 92, 255, .13), transparent 62%),
    radial-gradient(680px 360px at 50% 100%, rgba(0, 161, 214, .09), transparent 62%);
  background-attachment: fixed;
  min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; transition: opacity .15s; }
a:hover { text-decoration: underline; }

.wrap { max-width: 760px; margin: 0 auto; padding: 26px 16px 64px; }
.wrap.wide { max-width: 1200px; }

.card {
  position: relative;
  background: var(--card);
  border: 1px solid rgba(231, 235, 244, .9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
  margin-bottom: 18px;
}
.card::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--grad);
  opacity: 0;
  transition: opacity .25s;
}
.card:hover::before { opacity: .75; }

/* ---------------- 用户页头部 ---------------- */
.hero { text-align: center; padding: 34px 26px 30px; overflow: hidden; }
.hero::before { opacity: 1; }
.hero::after {
  content: "";
  position: absolute; left: 50%; top: -120px; width: 340px; height: 340px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(251, 114, 153, .18), transparent 68%);
  pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero img.avatar {
  width: 84px; height: 84px; border-radius: 50%;
  object-fit: cover; border: 3px solid #fff;
  box-shadow: 0 0 0 3px rgba(251, 114, 153, .28), 0 10px 24px rgba(251, 114, 153, .3);
  margin-bottom: 12px;
  background: #fff;
}
.hero h1 {
  font-size: 23px; margin: 8px 0 10px; letter-spacing: .2px;
  background: linear-gradient(120deg, #2b3145, #6b5b8f 60%, #c2557c);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .sub { color: var(--muted); font-size: 14px; }
.hero .sub b { color: var(--text); }
.hero .badge {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 12px; padding: 5px 14px;
  background: rgba(251, 114, 153, .1);
  border: 1px solid rgba(251, 114, 153, .22);
  color: var(--pink-dark); border-radius: 999px; font-size: 13px; font-weight: 600;
}

.notice {
  position: relative;
  background: linear-gradient(180deg, #fffdf5, #fff8e6);
  border: 1px solid #ffe3ab; color: #8a5a00;
  border-radius: 14px; padding: 14px 16px 14px 42px;
  font-size: 14px; margin-bottom: 18px; white-space: pre-wrap;
  box-shadow: var(--shadow-sm);
}
.notice::before {
  content: "📢"; position: absolute; left: 14px; top: 12px; font-size: 16px;
}

/* ---------------- 表单 ---------------- */
label.field { display: block; margin-bottom: 9px; font-weight: 600; font-size: 14px; }

input[type=text], input[type=password], input[type=number], input[type=datetime-local],
textarea, select {
  width: 100%; padding: 13px 15px; font-size: 15px;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: #fbfcff; color: var(--text); font-family: inherit;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
input::placeholder, textarea::placeholder { color: #a9b2c5; }
textarea { font-family: var(--mono); font-size: 13px; min-height: 118px; resize: vertical; line-height: 1.6; }
select { cursor: pointer; }
input:hover, textarea:hover, select:hover { border-color: #cfd7e8; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--pink);
  box-shadow: 0 0 0 4px rgba(251, 114, 153, .14);
  background: #fff;
}
input:disabled, textarea:disabled, select:disabled { background: #f4f6fb; color: var(--muted); }

button {
  font-family: inherit; font-size: 15px; font-weight: 600;
  border: none; border-radius: var(--radius-sm); padding: 13px 22px;
  background: var(--grad); color: #fff; cursor: pointer;
  box-shadow: 0 6px 16px rgba(251, 114, 153, .28);
  transition: transform .12s, box-shadow .18s, filter .18s, background .18s;
}
button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(251, 114, 153, .34); filter: brightness(1.03); }
button:active:not(:disabled) { transform: translateY(0) scale(.995); box-shadow: 0 4px 12px rgba(251, 114, 153, .25); }
button:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
button.ghost {
  background: #f1f4fa; color: #47536b; box-shadow: none; border: 1px solid #e3e8f2;
}
button.ghost:hover:not(:disabled) { background: #e8edf7; box-shadow: var(--shadow-sm); filter: none; }
button.blue { background: linear-gradient(135deg, #00a1d6, #38bdf8); box-shadow: 0 6px 16px rgba(0, 161, 214, .28); }
button.blue:hover:not(:disabled) { box-shadow: 0 10px 22px rgba(0, 161, 214, .34); }
button.danger { background: linear-gradient(135deg, #f04438, #fb7185); box-shadow: 0 6px 16px rgba(240, 68, 56, .26); }
button.danger:hover:not(:disabled) { box-shadow: 0 10px 22px rgba(240, 68, 56, .32); }
button.small { padding: 7px 13px; font-size: 13px; border-radius: 9px; box-shadow: none; }
button.small:hover:not(:disabled) { box-shadow: var(--shadow-sm); }
button.block { width: 100%; padding: 15px; font-size: 16px; letter-spacing: .5px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 auto; }
.row.tight { gap: 6px; }

.hint { color: var(--muted); font-size: 13px; margin-top: 10px; line-height: 1.7; }
.steps { margin: 16px 0 0; padding: 0; list-style: none; counter-reset: step; }
.steps li {
  position: relative; padding-left: 32px; margin: 9px 0;
  color: var(--muted); font-size: 14px;
}
.steps li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 2px;
  width: 21px; height: 21px; border-radius: 50%;
  background: rgba(251, 114, 153, .12); color: var(--pink-dark);
  font-size: 12px; font-weight: 700; line-height: 21px; text-align: center;
}

.spinner {
  display: inline-block; width: 15px; height: 15px; vertical-align: -2px;
  border: 2px solid rgba(255, 255, 255, .38); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite; margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- 结果区 ---------------- */
.result { margin-top: 20px; animation: riseIn .32s cubic-bezier(.22, .8, .3, 1) both; }
@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.result .box {
  border-radius: 16px; padding: 20px;
  border: 1px solid var(--line); background: #fff;
  box-shadow: var(--shadow-sm);
}
.result .box.ok { background: linear-gradient(180deg, #f2fdf7, #e9fbf1); border-color: #a9f0c6; --notch: #eafbf2; }
.result .box.warn { background: linear-gradient(180deg, #fffcf3, #fff8e8); border-color: #ffe0a3; --notch: #fff8e8; }
.result .box.err { background: linear-gradient(180deg, #fff5f4, #fef1f0); border-color: #fbc9c5; --notch: #fef1f0; }
.result .box.info { background: linear-gradient(180deg, #f3f9ff, #eaf4ff); border-color: #bcdcff; --notch: #eaf4ff; }
.result h3 { margin: 0 0 10px; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.result p { margin: 7px 0; font-size: 14px; }

/* 卡密做成票券样式 */
.codebox {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin: 14px 0; padding: 20px 18px;
  background: linear-gradient(135deg, #1c2438 0%, #0e1626 100%);
  color: #7dd3fc; border-radius: 14px;
  border: 1.5px dashed rgba(125, 211, 252, .5);
  font-family: var(--mono); font-size: 21px; font-weight: 600;
  letter-spacing: 1.5px; word-break: break-all; text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 8px 22px rgba(14, 22, 38, .18);
}
.codebox::before, .codebox::after {
  content: ""; position: absolute; top: 50%; width: 16px; height: 16px;
  border-radius: 50%; background: var(--notch, #fff);
  transform: translateY(-50%);
}
.codebox::before { left: -9px; }
.codebox::after { right: -9px; }
.codebox.masked { color: #97a6bd; font-size: 19px; }

/* 领卡页两栏布局：左侧内容 + 右侧广告栏（配了广告才变两栏） */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
.col-main { min-width: 0; }
.col-ad { min-width: 0; }
@media (min-width: 900px) {
  .layout.has-ad { grid-template-columns: minmax(0, 1fr) 252px; }
  .col-ad { position: sticky; top: 18px; }
}
body.has-ad .wrap { max-width: 1030px; }

.ad-card {
  display: block; text-decoration: none; color: inherit;
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 11px; box-shadow: var(--shadow-sm);
  transition: transform .16s, box-shadow .18s, border-color .18s;
}
.ad-card:hover {
  transform: translateY(-2px); box-shadow: var(--shadow);
  border-color: var(--pink-soft); text-decoration: none;
}
.ad-card img {
  display: block; width: 100%; height: auto; border-radius: 11px; background: #f4f6fb;
}
.ad-card .ad-title {
  margin: 10px 3px 0; font-size: 14px; font-weight: 700; text-align: center;
}
.ad-card .ad-note {
  margin: 4px 3px 2px; font-size: 12.5px; color: var(--muted);
  text-align: center; line-height: 1.55;
}
.ad-card .ad-tag {
  display: block; margin: 9px auto 2px; width: fit-content;
  font-size: 11px; color: #a9b3c6; letter-spacing: .6px;
}

footer.site { text-align: center; color: var(--muted); font-size: 13px; padding: 10px 16px 44px; }

/* ---------------- 管理后台 ---------------- */
.topbar {
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar .inner {
  max-width: 1200px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.topbar .brand { font-weight: 800; font-size: 16px; margin-right: auto; letter-spacing: .2px; }
.tabs {
  display: flex; gap: 3px; flex-wrap: wrap;
  background: #eef1f8; padding: 4px; border-radius: 12px;
}
.tabs button {
  background: transparent; color: #5c6980; font-weight: 600; box-shadow: none;
  padding: 8px 15px; border-radius: 9px; font-size: 14px;
}
.tabs button:hover:not(:disabled) { background: rgba(255, 255, 255, .7); transform: none; box-shadow: none; filter: none; }
.tabs button.active {
  background: #fff; color: var(--pink-dark);
  box-shadow: 0 2px 8px rgba(27, 33, 48, .1);
}

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(172px, 1fr)); gap: 14px; }
.stat {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, #fff 0%, #fbfcff 100%);
  border: 1px solid var(--line); border-radius: 15px; padding: 17px 18px;
  box-shadow: var(--shadow-sm);
  transition: transform .16s, box-shadow .18s;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--grad);
}
.stat.green::after { background: linear-gradient(180deg, #12b76a, #5ee9a4); }
.stat.red::after { background: linear-gradient(180deg, #f04438, #fb8a80); }
.stat.orange::after { background: linear-gradient(180deg, #f79009, #fdc16b); }
.stat.blue::after { background: linear-gradient(180deg, #00a1d6, #6dd5f5); }
.stat .k { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat .v { font-size: 26px; font-weight: 800; margin-top: 5px; word-break: break-all; letter-spacing: -.3px; }

table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th {
  color: var(--muted); font-weight: 600; font-size: 12.5px;
  background: #f7f9fd; letter-spacing: .3px;
  position: sticky; top: 0;
}
th:first-child { border-top-left-radius: 10px; }
th:last-child { border-top-right-radius: 10px; }
tbody tr { transition: background .12s; }
tbody tr:nth-child(even) { background: #fcfdff; }
tbody tr:hover { background: #f4f8ff; }
tbody tr:last-child td { border-bottom: none; }
td.mono, th.mono { font-family: var(--mono); font-size: 13px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }

.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.pill.ok { background: #e7faf0; color: #04784f; }
.pill.bad { background: #fdeceb; color: #b42318; }
.pill.warn { background: #fff6e5; color: #b54708; }
.pill.mute { background: #f1f3f8; color: #566175; }

pre.raw {
  background: linear-gradient(150deg, #131b2c, #0d1421); color: #c7d3e4;
  padding: 16px; border-radius: 12px; overflow: auto;
  font-size: 12px; line-height: 1.6; max-height: 420px;
  font-family: var(--mono); white-space: pre-wrap; word-break: break-all;
  border: 1px solid #202b41;
}

.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.form-row { margin-bottom: 16px; }
.form-row .desc { color: var(--muted); font-size: 13px; margin-top: 7px; line-height: 1.65; }
.checkbox { display: flex; align-items: flex-start; gap: 9px; font-size: 14px; }
.checkbox input { width: auto; margin-top: 3px; accent-color: var(--pink); }
h2.section { font-size: 17.5px; margin: 0 0 5px; letter-spacing: .2px; }
p.section-desc { color: var(--muted); font-size: 13px; margin: 0 0 18px; line-height: 1.75; }

/* 广告设置里的图片预览 */
.ad-preview {
  margin-top: 12px; display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap;
}
.ad-preview img {
  width: 150px; border-radius: 12px; border: 1px solid var(--line);
  background: #f6f8fc; box-shadow: var(--shadow-sm);
}
.ad-preview .meta { font-size: 13px; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(8px);
  background: rgba(23, 28, 41, .95); color: #fff;
  padding: 12px 22px; border-radius: 12px; font-size: 14px; z-index: 99;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .28); max-width: 90vw;
  opacity: 0; pointer-events: none;
  transition: opacity .22s, transform .22s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { background: linear-gradient(135deg, #0b7a4d, #12a866); }
.toast.err { background: linear-gradient(135deg, #96231b, #c0332a); }

.login-wrap { max-width: 400px; margin: 11vh auto; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.nowrap { white-space: nowrap; }

@media (max-width: 560px) {
  .wrap { padding: 16px 12px 48px; }
  .card { padding: 20px 17px; border-radius: 15px; }
  .hero { padding: 26px 17px 24px; }
  .hero h1 { font-size: 20px; }
  .codebox { font-size: 17px; letter-spacing: 1px; padding: 17px 14px; }
  .stat .v { font-size: 22px; }
  .tabs { width: 100%; overflow-x: auto; }
}
