:root {
  --bg: #14100b;
  --bg-2: #1c1510;
  --card: #221a11;
  --card-2: #2c2216;
  --amber: #d2933f;
  --amber-soft: #f0c07a;
  --cream: #f3e7d2;
  --whiskey: #b5712a;
  --text: #f1e7d7;
  --muted: #a08a6d;
  --line: rgba(210, 147, 63, 0.22);
  --line-strong: rgba(210, 147, 63, 0.5);
  --radius: 12px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  --serif: Georgia, "Times New Roman", "Songti SC", "STSong", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(circle at 18% -8%, rgba(210, 147, 63, 0.20), transparent 46%),
    radial-gradient(circle at 88% 6%, rgba(181, 113, 42, 0.14), transparent 42%),
    linear-gradient(180deg, #14100b 0%, #0e0b07 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

#app { max-width: 560px; margin: 0 auto; padding: 0 14px calc(40px + env(safe-area-inset-bottom)); }

/* ---------- 通用 ---------- */
.card {
  background: linear-gradient(180deg, var(--card) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.gap8 { gap: 8px; }
.gap12 { gap: 12px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.amber { color: var(--amber-soft); }
.center { text-align: center; }
.serif { font-family: var(--serif); }

.eyebrow {
  font-family: var(--serif);
  font-size: 11px; letter-spacing: 3.5px; text-transform: uppercase;
  color: var(--amber); opacity: .9;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--card-2); color: var(--text);
  border-radius: 10px; padding: 10px 14px; font-size: 14px; cursor: pointer;
  font-family: inherit; transition: transform .08s ease, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--amber-soft) 0%, var(--whiskey) 100%);
  color: #221705; font-weight: 700; border-color: transparent;
  font-family: var(--serif); letter-spacing: 1px;
}
.btn-danger { background: rgba(183, 74, 51, .18); color: #e29079; border-color: rgba(183, 74, 51, .38); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }

input, select, textarea {
  width: 100%; background: #171108; border: 1px solid var(--line);
  color: var(--text); border-radius: 10px; padding: 10px 12px;
  font-size: 15px; font-family: inherit; outline: none;
}
input:focus, textarea:focus { border-color: var(--line-strong); }
input[type="number"] { -moz-appearance: textfield; }
.field { margin-bottom: 12px; }
.field > label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 7px 15px; border-radius: 999px;
  background: var(--card-2); border: 1px solid var(--line);
  color: var(--muted); font-size: 13.5px; cursor: pointer; white-space: nowrap;
  font-family: var(--serif); letter-spacing: .5px;
}
.chip.active {
  background: linear-gradient(135deg, rgba(240,192,122,.9), rgba(181,113,42,.85));
  color: #241805; border-color: transparent; font-weight: 700;
}

.divider { height: 1px; background: var(--line); margin: 12px 0; }
.ornament {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  color: var(--amber); opacity: .65; margin: 10px 0;
}
.ornament::before, .ornament::after {
  content: ''; height: 1px; flex: 1;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
}

/* ---------- 榜单头部 ---------- */
.hero { padding: 20px 10px 12px; text-align: center; }
.hero .suit { font-size: 15px; letter-spacing: 10px; color: var(--amber); opacity: .8; }
.hero h1 {
  margin: 8px 0 4px; font-family: var(--serif); font-size: 27px; font-weight: 700;
  letter-spacing: 3px;
  background: linear-gradient(180deg, #fff6e6 0%, var(--amber-soft) 55%, var(--whiskey) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .en { font-family: var(--serif); font-size: 10.5px; letter-spacing: 4px; color: var(--muted); text-transform: uppercase; }
.hero .season { color: var(--amber); font-size: 13px; font-family: var(--serif); letter-spacing: 1px; margin-top: 6px; }
.live-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: #6fbf8b; margin-right: 5px; vertical-align: 1px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-bottom: 14px; }
.stat {
  background: linear-gradient(180deg, var(--card) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 4px; text-align: center;
}
.stat .v { font-family: var(--serif); font-size: 21px; font-weight: 700; color: var(--amber-soft); line-height: 1.2; }
.stat .k { font-size: 11px; color: var(--muted); margin-top: 1px; letter-spacing: .5px; }

/* ---------- 周期切换 ---------- */
.period { display: flex; gap: 6px; background: var(--card-2); border: 1px solid var(--line); border-radius: 10px; padding: 4px; margin-bottom: 10px; }
.period div {
  flex: 1; text-align: center; padding: 8px 0; border-radius: 7px; cursor: pointer;
  font-family: var(--serif); font-size: 14px; letter-spacing: 1px; color: var(--muted);
}
.period div.on {
  background: linear-gradient(135deg, rgba(240,192,122,.92), rgba(181,113,42,.85));
  color: #241805; font-weight: 700;
}

.datenav { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 10px; }
.datenav .lbl { font-family: var(--serif); font-size: 14.5px; letter-spacing: 1.5px; color: var(--cream); }
.datenav .nav { display: flex; gap: 8px; }
.datenav .nav button {
  background: var(--card-2); border: 1px solid var(--line); color: var(--amber-soft);
  width: 30px; height: 28px; border-radius: 7px; cursor: pointer; font-size: 14px; font-family: var(--serif);
}
.datenav .nav button:disabled { opacity: .3; }

/* ---------- 排行榜 ---------- */
.rank-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px; border-radius: 11px;
  background: linear-gradient(100deg, var(--card) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line); margin-bottom: 8px;
  position: relative; overflow: hidden;
}
.rank-item.top1 { border-color: rgba(240, 192, 122, .55); background: linear-gradient(100deg, rgba(210,147,63,.18), var(--card) 62%); }
.rank-item.top2 { border-color: rgba(200, 205, 212, .34); background: linear-gradient(100deg, rgba(200,205,212,.12), var(--card) 62%); }
.rank-item.top3 { border-color: rgba(183, 122, 74, .38); background: linear-gradient(100deg, rgba(183,122,74,.14), var(--card) 62%); }

.badge {
  flex: 0 0 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 700; font-size: 15px;
  background: var(--card-2); color: var(--muted); border: 1px solid var(--line);
}
.badge.g1 { background: radial-gradient(circle at 32% 28%, #fff0cf, #d9a94f 55%, #9c6f21); color: #2a1c05; border-color: rgba(255,232,180,.55); box-shadow: 0 0 10px rgba(217,169,79,.35); }
.badge.g2 { background: radial-gradient(circle at 32% 28%, #f4f6f8, #b9c0c8 55%, #7d858d); color: #23272b; border-color: rgba(230,235,240,.5); }
.badge.g3 { background: radial-gradient(circle at 32% 28%, #e9bd93, #b07540 55%, #7d4a22); color: #2b1708; border-color: rgba(226,180,140,.5); }

.avatar {
  flex: 0 0 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 16px; font-weight: 700; color: #1c1206;
  border: 1px solid rgba(240, 192, 122, .35);
}
.pname { font-size: 15.5px; font-weight: 600; color: var(--cream); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pmeta { font-size: 11.5px; color: var(--muted); margin-top: 1px; font-family: var(--serif); letter-spacing: .3px; }
.pscore { text-align: right; flex: 0 0 auto; }
.pscore .n { font-family: var(--serif); font-size: 21px; font-weight: 700; color: var(--amber-soft); line-height: 1.1; }
.pscore .u { font-size: 9.5px; color: var(--muted); letter-spacing: 2px; text-transform: uppercase; }

.spark { display: flex; align-items: flex-end; gap: 2px; height: 16px; margin-top: 3px; justify-content: flex-end; }
.spark i { display: block; width: 4px; border-radius: 1px; background: rgba(210,147,63,.3); }
.spark i.pos { background: rgba(240,192,122,.9); }

.empty { text-align: center; color: var(--muted); padding: 34px 10px; font-size: 14px; }
.empty .big { font-family: var(--serif); font-size: 34px; opacity: .3; display: block; margin-bottom: 8px; }

/* ---------- 记录 ---------- */
.match-day { margin-bottom: 10px; }
.match-day .d { font-family: var(--serif); font-size: 12px; color: var(--amber); letter-spacing: 1px; margin: 10px 2px 6px; }
.match-line {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 11px; margin-bottom: 6px;
}
.mini-rank { flex: 0 0 22px; text-align: center; font-weight: 700; font-size: 13px; color: var(--muted); font-family: var(--serif); }
.mini-rank.r1 { color: var(--amber-soft); }

/* ---------- 管理端 ---------- */
.admin-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 4px 12px; }
.admin-head h2 { margin: 0; font-size: 17px; font-family: var(--serif); letter-spacing: 1px; color: var(--cream); }
.admin-head .store {
  font-family: var(--serif); font-size: 11px; letter-spacing: 2px;
  color: var(--amber); border: 1px solid var(--line-strong);
  padding: 3px 9px; border-radius: 999px;
}
.tabs { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }

.login-wrap { max-width: 340px; margin: 12vh auto 0; }
.login-logo { font-size: 40px; text-align: center; margin-bottom: 4px; }
.login-title {
  font-family: var(--serif); font-size: 19px; text-align: center;
  letter-spacing: 4px; color: var(--cream); margin-bottom: 2px;
}
.store-pick { display: flex; flex-direction: column; gap: 8px; }
.store-opt {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; cursor: pointer;
}
.store-opt.on { border-color: var(--line-strong); background: linear-gradient(100deg, rgba(210,147,63,.16), var(--card) 70%); }
.store-opt .nm { font-family: var(--serif); font-size: 16px; letter-spacing: 1px; color: var(--cream); }
.store-opt .en { font-size: 10px; letter-spacing: 2px; color: var(--muted); text-transform: uppercase; }

.player-row {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: 10px;
  background: var(--card); border: 1px solid var(--line); margin-bottom: 7px;
}
.player-row.off { opacity: .45; }
.sw {
  flex: 0 0 30px; height: 30px; border-radius: 8px;
  background: var(--card-2); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--muted); cursor: pointer;
}
.sw.on { background: rgba(210,147,63,.22); border-color: var(--line-strong); color: var(--amber-soft); }

.qr-box { text-align: center; padding: 16px 12px; }
.qr-box img { width: 190px; height: 190px; background: #fff; border-radius: 8px; padding: 7px; }
.qr-label { margin-top: 10px; font-size: 13.5px; font-family: var(--serif); letter-spacing: 1px; }
.qr-url { font-size: 11px; color: var(--muted); word-break: break-all; margin-top: 4px; }

.toast {
  position: fixed; left: 50%; bottom: 42px; transform: translateX(-50%) translateY(14px);
  background: rgba(30, 22, 13, .97); border: 1px solid var(--line-strong);
  color: var(--cream); padding: 10px 18px; border-radius: 999px; font-size: 13.5px;
  opacity: 0; pointer-events: none; transition: all .22s ease; z-index: 99; white-space: nowrap;
  box-shadow: var(--shadow); max-width: 88vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.footer { text-align: center; color: var(--muted); font-size: 11.5px; padding: 14px 10px 4px; }

.switch-line { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; }

.wx-tip {
  background: rgba(210, 147, 63, .1); border: 1px dashed var(--line-strong);
  border-radius: 10px; padding: 10px 12px; font-size: 12px; color: var(--amber-soft); line-height: 1.6;
}

/* 自定义弹窗（替代原生 confirm / prompt） */
.modal-mask {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 200;
  background: rgba(0, 0, 0, .66);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  width: 100%; max-width: 330px;
  background: linear-gradient(180deg, var(--card) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line-strong); border-radius: 14px;
  padding: 18px 16px 16px; box-shadow: var(--shadow);
}
.modal-t {
  font-family: var(--serif); font-size: 16.5px; letter-spacing: 1px;
  color: var(--cream); text-align: center; margin-bottom: 8px;
}
.modal-d { font-size: 13.5px; color: var(--muted); line-height: 1.75; text-align: center; margin-bottom: 14px; }
.modal-d b { color: #e29079; }
.modal-input { margin-bottom: 14px; }
.modal-btns { display: flex; gap: 10px; }
.modal-btns .btn { flex: 1; }
