:root {
  /* 配色取自品牌拼图 logo：深海军蓝 / 中蓝 / 活力橙 */
  --navy: #1f4467;
  --blue: #2e6da4;
  --blue-3: #4a8ec2;
  --orange: #ed7d31;
  --orange-soft: #f0965a;
  --brand: var(--blue);
  --brand-2: var(--navy);
  --ink: #233242;
  --muted: #7d8b9a;
  --line: #e2e7ee;
  --bg: #f3f5f8;
  --card: #ffffff;
  --ok-bg: #e6f6ee;
  --ok: #1b7f43;
  --err-bg: #fdeaea;
  --err: #c0392b;
  --shadow-sm: 0 2px 8px rgba(31, 68, 103, .08);
  --shadow: 0 12px 32px rgba(31, 68, 103, .14);
  --radius: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(46, 109, 164, .14), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(237, 125, 49, .08), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}

/* 品牌头图（渐变 hero banner：海军蓝 → 中蓝） */
.brand-header {
  position: relative;
  text-align: center;
  padding: 30px 16px 26px;
  color: #fff;
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 70%, var(--blue-3) 120%);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.brand-header::after {
  content: "";
  position: absolute;
  right: -40px; top: -40px;
  width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%);
  border-radius: 50%;
}
.brand-header .logo {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 4px;
  text-shadow: 0 2px 10px rgba(0,0,0,.12);
}
.brand-header .sub {
  font-size: 13px;
  margin-top: 8px;
  opacity: .92;
  letter-spacing: 2px;
}

/* 页面顶部广告图（3:1，整张可替换；无图自动隐藏） */
.page-banner {
  display: none;
  width: 100%;
  aspect-ratio: 3 / 1;
  overflow: hidden;
  background: var(--navy);
  line-height: 0;
}
.page-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 18px 16px 40px;
  animation: rise .4s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* 表单 */
form .field { margin-bottom: 14px; }
form label {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  color: #47586b;
  font-weight: 600;
}
form label a { color: var(--orange); text-decoration: none; font-weight: 700; }
form label .req { color: var(--orange); }
form input, form textarea, form select {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 15px;
  background: #fff;
  color: var(--ink);
  transition: border-color .2s, box-shadow .2s;
}
form input:focus, form textarea:focus, form select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(46, 109, 164, .14);
}
form textarea { resize: vertical; }

.btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #e8702a, var(--orange) 55%, var(--orange-soft));
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(237, 125, 49, .35);
  transition: transform .12s ease, box-shadow .2s ease, filter .2s;
}
.btn:hover { filter: brightness(1.06); box-shadow: 0 10px 26px rgba(237, 125, 49, .42); }
.btn:active { transform: translateY(1px) scale(.99); }

/* 顶部分段导航（pill 风格，吸顶） */
.page-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 6px;
  max-width: 480px;
  margin: 0 auto;
  padding: 8px 10px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.page-nav .nav-item {
  flex: 1;
  text-align: center;
  padding: 9px 4px;
  font-size: 13px;
  color: #64748b;
  text-decoration: none;
  border-radius: 999px;
  transition: background .2s, color .2s;
}
.page-nav .nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, var(--navy), var(--blue));
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

/* 电子段位牌卡片（保留类名） */
.card {
  border: 3px solid var(--blue-3);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 18px 0;
  box-shadow: var(--shadow);
}
.card-top {
  padding: 14px;
  color: #fff;
  font-weight: 700;
  letter-spacing: 2px;
  background: linear-gradient(135deg, var(--navy), var(--blue));
}
.card-body { padding: 16px; background: #fff; }
.card-rank { font-size: 22px; font-weight: 800; margin-bottom: 8px; color: var(--navy); }
.card-name, .card-serial, .card-join { font-size: 14px; color: #444; margin: 5px 0; }

/* 公告 */
.announce {
  margin-top: 18px;
  font-size: 13px;
  color: #5b6b7d;
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

/* 提示与消息 */
.msg {
  margin-top: 14px;
  font-size: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  line-height: 1.5;
}
.msg.ok { background: var(--ok-bg); color: var(--ok); border: 1px solid #bfe6cf; }
.msg.err { background: var(--err-bg); color: var(--err); border: 1px solid #f3c9c4; }
.hint {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 18px;
  text-align: center;
  line-height: 1.6;
}

/* 电子ID卡（精致渐变 + 微光） */
.id-card {
  position: relative;
  margin: 18px 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(135deg, #16314b 0%, var(--navy) 45%, var(--blue) 100%);
  color: #fff;
  text-align: center;
  box-shadow: 0 16px 36px rgba(22, 49, 75, .42);
}
.id-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.16) 50%, transparent 65%);
  background-size: 220% 100%;
  animation: shine 4.5s linear infinite;
}
@keyframes shine {
  from { background-position: 160% 0; }
  to { background-position: -60% 0; }
}
.id-card > * { position: relative; z-index: 1; }
/* 自定义底图模式：把背景换成用户设计图（frontend/assets/idcard-bg.png）。无图时自动回退蓝渐变 */
.id-card.custom-bg {
  background-image: url("../assets/idcard-bg.png");
  background-size: cover;
  background-position: center;
}
/* 底图模式下，底部文字区加极淡暗渐变，保证白字可读（很轻，不破坏设计） */
.id-card.custom-bg::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 64%;
  z-index: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,.20) 100%);
  pointer-events: none;
}
.id-card-brand {
  font-size: 12px;
  letter-spacing: 3px;
  opacity: .9;
  padding: 16px 16px 0;
  font-weight: 600;
}
.id-card-no {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: 4px;
  padding: 8px 16px 4px;
  font-family: "SF Mono", "Roboto Mono", Consolas, monospace;
  text-shadow: 0 2px 12px rgba(0,0,0,.25);
}
.id-card-meta { font-size: 13.5px; opacity: .94; margin: 3px 0; }
.id-card-note {
  margin: 14px 16px 0;
  padding: 10px 0 16px;
  font-size: 12.5px;
  border-top: 1px dashed rgba(255,255,255,.4);
}
/* 保存为图片按钮 + 生成图预览 */
.id-card-save {
  margin: 4px 16px 0;
  padding: 11px 16px;
  border: none;
  border-radius: 10px;
  background: #fff;
  color: var(--navy);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: transform .1s ease;
}
.id-card-save:active { transform: scale(.97); }
.id-card-save:disabled { opacity: .7; cursor: default; }
.id-card-img-wrap { padding: 12px 16px 0; }
.id-card-img-wrap img { width: 100%; border-radius: 12px; display: block; box-shadow: 0 6px 16px rgba(0,0,0,.25); }
.id-card-tip { display: none; font-size: 12px; color: #bfe3ff; padding: 8px 16px 16px; text-align: center; }

/* 首页入口 */
.home-lede {
  font-size: 14px;
  color: #47586b;
  margin: 4px 0 16px;
  line-height: 1.7;
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
}
.entry {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .2s ease;
}
.entry:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.entry:active { transform: translateY(0); }
.entry-icon {
  font-size: 26px;
  width: 50px; height: 50px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px;
  flex: 0 0 auto;
}
/* 三个入口图标块：蓝 / 深蓝 / 橙，呼应 logo 三块拼图 */
.entry:nth-of-type(1) .entry-icon { background: linear-gradient(135deg, rgba(46,109,164,.16), rgba(74,142,194,.22)); }
.entry:nth-of-type(2) .entry-icon { background: linear-gradient(135deg, rgba(31,68,103,.14), rgba(46,109,164,.18)); }
.entry:nth-of-type(3) .entry-icon { background: linear-gradient(135deg, rgba(237,125,49,.18), rgba(240,150,90,.26)); }
.entry-main { flex: 1; }
.entry-title { font-size: 16px; font-weight: 800; }
.entry-desc { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.entry-arrow { font-size: 22px; color: #b9c6d6; }
/* 箭头 hover 时点亮为橙色 */
.entry:hover .entry-arrow { color: var(--orange); }

/* 九段介绍 */
.rules-box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.rules-title { font-size: 15px; font-weight: 800; margin-bottom: 8px; color: var(--navy); }
.rules-text { font-size: 13.5px; color: #47586b; line-height: 1.8; }
.rules-text b { color: var(--orange); }

.rank-item {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 13px;
  box-shadow: var(--shadow-sm);
}
.rank-item.stage-1 { border-left-color: #7fb3d5; }
.rank-item.stage-2 { border-left-color: var(--blue); }
.rank-item.stage-3 { border-left-color: var(--orange); }

.rank-item-head { display: flex; align-items: center; gap: 12px; }
.rank-num {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--navy), var(--blue));
  min-width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
  box-shadow: var(--shadow-sm);
}
.rank-title { font-size: 17px; font-weight: 800; flex: 1; }
.rank-stage {
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}
.rank-stage.stage-1 { color: #2e6da4; background: #e5eff8; }
.rank-stage.stage-2 { color: #1f4467; background: #d9e6f2; }
.rank-stage.stage-3 { color: #fff; background: linear-gradient(135deg, var(--orange), var(--orange-soft)); }

.rank-slogan { font-size: 12.5px; color: var(--muted); margin: 8px 0 10px; line-height: 1.6; }
.rank-std { font-size: 13.5px; color: #44525f; line-height: 1.7; margin: 5px 0; }
.rank-std b {
  display: inline-block;
  font-size: 12px;
  color: var(--blue);
  background: rgba(46, 109, 164, .10);
  border-radius: 6px;
  padding: 1px 8px;
  margin-right: 8px;
}
.rank-emotion { font-size: 12.5px; color: #8a99a8; margin-top: 10px; font-style: italic; }

/* ---------- 会员管理后台 ---------- */
.admin-card {
  max-width: 420px;
  margin: 40px auto;
  background: #fff;
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: var(--shadow-md);
}
.admin-card h2 { margin: 0 0 6px; font-size: 20px; color: var(--navy); }
.admin-sub { font-size: 13px; color: var(--muted); margin: 0 0 18px; line-height: 1.6; }
.admin-login-form .field { margin-bottom: 12px; }
.admin-login-form input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #d9e2ec;
  border-radius: 10px;
  font-size: 15px;
  box-sizing: border-box;
}
.admin-login-form .btn { width: 100%; }

.admin-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; margin: 18px 0 14px;
}
.admin-title { font-size: 17px; font-weight: 800; color: var(--navy); }
.admin-title em { color: var(--orange); font-style: normal; }
.admin-actions { display: flex; gap: 8px; }

.admin-search {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px;
}
.admin-search .s-input {
  flex: 1 1 130px; min-width: 120px;
  padding: 10px 12px; border: 1.5px solid #d9e2ec; border-radius: 10px;
  font-size: 14px; box-sizing: border-box; background: #fff;
}

.admin-table-wrap { overflow-x: auto; border-radius: 12px; box-shadow: var(--shadow-sm); }
.admin-table {
  width: 100%; border-collapse: collapse; background: #fff;
  font-size: 13px; min-width: 640px;
}
.admin-table thead th {
  background: linear-gradient(135deg, var(--navy), var(--blue));
  color: #fff; font-weight: 700; text-align: left;
  padding: 11px 12px; white-space: nowrap;
}
.admin-table tbody td {
  padding: 10px 12px; border-bottom: 1px solid #eef2f6; color: #2c3a47;
}
.admin-table tbody tr:nth-child(even) { background: #f7fafc; }
.admin-table tbody tr:hover { background: #eef5fb; }
.admin-table .empty { text-align: center; color: var(--muted); padding: 26px 0; }

.admin-pager {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin: 14px 0 30px; color: var(--muted); font-size: 13px;
}
.btn-export { background: linear-gradient(135deg, var(--orange), var(--orange-soft)); }
.btn-ghost { background: #eef2f6; color: var(--blue); }
.btn-ghost:hover { background: #e2e9f0; }

/* 表格行可点击 */
.admin-table tbody tr.row-click { cursor: pointer; }
.admin-table tbody tr.row-click:hover { background: #e3eef9; }

/* 会员详情弹层 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(20, 40, 64, 0.46);
  display: flex; align-items: center; justify-content: center; z-index: 999;
  padding: 16px;
}
.modal-box {
  width: 100%; max-width: 460px; max-height: 86vh; overflow-y: auto;
  background: #fff; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.28);
  animation: modalIn .18s ease-out;
}
@keyframes modalIn { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid #eef2f6; font-weight: 700; color: var(--navy);
}
.modal-close {
  border: none; background: #f0f3f7; color: var(--muted); width: 30px; height: 30px;
  border-radius: 50%; font-size: 15px; cursor: pointer; line-height: 1;
}
.modal-close:hover { background: #e3e9ef; }
.modal-body { padding: 18px; }
.modal-foot { padding: 12px 18px 18px; text-align: right; }
.detail-loading { color: var(--muted); text-align: center; padding: 20px 0; }
.detail-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-bottom: 16px;
}
.detail-item { display: flex; flex-direction: column; gap: 3px; }
.detail-item label { font-size: 12px; color: var(--muted); }
.detail-item b { font-size: 15px; color: var(--navy); font-weight: 600; word-break: break-all; }
.detail-block { margin-top: 14px; }
.detail-block label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 5px; }
.detail-block p {
  margin: 0; padding: 10px 12px; background: #f7fafc; border-radius: 10px;
  font-size: 14px; line-height: 1.6; color: #2c3e50; white-space: pre-wrap; word-break: break-all;
}
@media (max-width: 360px) {
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 360px) {
  .id-card-no { font-size: 30px; }
  .brand-header .logo { font-size: 19px; }
}
