:root {
  --bg: #0a0a0f;
  --surface: #121218;
  --surface-2: #1a1a22;
  --line: #262630;
  --line-2: #35353f;
  --text: #ececf0;
  --muted: #9a9aaa;
  --dim: #66667a;
  --accent: #d42b3c;
  --accent-soft: #3a1520;
  --link: #f05a68;
  --gold: #e3b14b;
  --up: #ef5361;
  --down: #20b47a;
  --warn: #e39a32;
  --danger: #ef5361;
  --ok: #20b47a;
  --num: "DIN Alternate", "Bahnschrift", "Roboto", "Segoe UI", sans-serif;
  --cn: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}
:root[data-up="green"] { --up: #20b47a; --down: #ef5361; }

* { box-sizing: border-box; }
/* 滚动条位置一直留着：长页面和短页面来回切换时内容不会左右跳 */
html { background: var(--bg); -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font: 14px/1.6 var(--cn);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
/* 手机点按时不出灰色高亮块 */
a, button, .row, summary { -webkit-tap-highlight-color: transparent; }
a { color: var(--link); text-decoration: none; transition: color .12s; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-weight: 600; }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.up { color: var(--up); }
.down { color: var(--down); }
.hidden { display: none !important; }

/* 顶栏 */
.topbar { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 20; }
.topbar .wrap { display: flex; align-items: center; height: 54px; gap: 24px; }
.brand { display: flex; align-items: center; flex: none; }
.brand:hover { text-decoration: none; }
.ec-logo { height: 26px; width: auto; display: block; }
.nav { display: flex; gap: 6px; margin-left: auto; height: 100%; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { display: flex; align-items: center; color: var(--muted); border-bottom: 2px solid transparent; transition: color .12s; padding: 0 8px; white-space: nowrap; font-size: 13px; }
.nav a:hover { color: var(--text); text-decoration: none; }
.nav a.on { color: var(--text); border-bottom-color: var(--accent); }

/* 通用 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--accent); background: var(--accent); color: #fff;
  border-radius: 8px; padding: 8px 16px; font: 600 14px/1.2 var(--cn); cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn { transition: filter .12s, background .12s; }
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; border-color: var(--line-2); color: var(--text); }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #1a1405; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.panel, .card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.card { padding: 20px; margin-bottom: 16px; }
.card h3 { margin: 0 0 14px; font-size: 16px; display: flex; align-items: center; gap: 10px; }
.tag { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 12px; line-height: 20px; white-space: nowrap; }
.tag.copy { color: var(--gold); padding: 0; }
.tag.demo { color: var(--link); border: 1px solid var(--line-2); }
.tag.ok { color: var(--ok); } .tag.ne { color: var(--dim); } .tag.warn { color: var(--warn); } .tag.el, .tag.fl, .tag.dq { color: var(--danger); }
.notice { padding: 10px 12px; border-radius: 8px; font-size: 13px; background: var(--surface-2); border-left: 3px solid var(--warn); margin-bottom: 12px; }
.notice.info { border-left-color: var(--accent); }
.notice.bad { border-left-color: var(--danger); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 99; padding: 10px 16px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--line-2); font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100% - 32px); }
.toast.on { opacity: 1; }
.toast.bad { border-color: var(--danger); }
.spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--muted); display: inline-block; vertical-align: -1px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.page-title { font-size: 20px; margin: 24px 0 16px; }
.sec-title { display: flex; align-items: baseline; gap: 12px; margin: 24px 0 16px; }
.sec-title h2 { margin: 0; font-size: 20px; }

/* 赛季信息条 */
.season { display: flex; align-items: center; gap: 32px; padding: 20px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.season h1 { margin: 0; font-size: 20px; }
.season .sub { color: var(--muted); font-size: 13px; }
.facts { display: flex; gap: 32px; margin: 0 0 0 auto; }
.facts dt { color: var(--muted); font-size: 12px; }
.facts dd { margin: 0; font: 600 18px/1.3 var(--num); font-variant-numeric: tabular-nums; }
.facts dd.gold { color: var(--gold); }

/* 首页布局 */
.home { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; padding: 20px 0 40px; align-items: start; }
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--line); margin-bottom: 4px; min-height: 41px; }
.tabs button { border: 0; background: none; color: var(--muted); font: 14px/1 var(--cn); padding: 12px 0; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tabs button small { color: var(--dim); margin-left: 4px; font-family: var(--num); }
.tabs .right { margin-left: auto; }
.board-bar { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; font-size: 12px; color: var(--dim); }

/* 排行榜 */
.thead, .row { display: grid; grid-template-columns: 52px minmax(0, 1fr) 90px 110px 90px 72px; align-items: center; gap: 12px; padding: 0 12px; }
.thead { height: 36px; font-size: 12px; color: var(--dim); border-bottom: 1px solid var(--line); }
.row { height: 48px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .1s; }
.row:hover { background: var(--surface); }
.row > * { pointer-events: none; }
.r { text-align: right; }
.row .rk { font: 600 15px/1 var(--num); color: var(--muted); }
.row .rk.top { color: var(--gold); }
.row .nk { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row .nk b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .ac { color: var(--dim); font-family: var(--num); font-size: 13px; }
.row .ret { font: 600 16px/1 var(--num); font-variant-numeric: tabular-nums; }
.row .dd { font-family: var(--num); color: var(--muted); font-variant-numeric: tabular-nums; }
.row .st { font-size: 12px; text-align: right; }
.row.out { opacity: .5; }
.st-warn { color: var(--warn); } .st-ne { color: var(--dim); } .st-el, .st-fl, .st-dq { color: var(--danger); }
.empty { padding: 48px 0; text-align: center; color: var(--muted); }
.board-note { font-size: 12px; color: var(--dim); padding: 14px 0; line-height: 1.7; }

/* 侧栏 */
.aside { display: grid; gap: 16px; }
.aside .card { padding: 16px; margin: 0; }
.aside h3 { font-size: 14px; margin: 0 0 10px; justify-content: space-between; }
.aside h3 span { font-weight: 400; font-size: 12px; color: var(--dim); }
.kv-list { list-style: none; margin: 0; padding: 0; }
.kv-list li { min-width: 0; display: flex; align-items: baseline; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13px; }
.kv-list li:first-child { border-top: 0; }
.kv-list .k { color: var(--muted); width: 52px; flex: none; }
.kv-list .v { margin-left: auto; font-family: var(--num); }
.kv-list b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 详情 */
.drawer-mask { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .2s; }
.drawer-mask.on { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100%); z-index: 41; background: var(--surface); border-left: 1px solid var(--line);
  transform: translateX(100%); transition: transform .25s ease; overflow-y: auto; padding: 20px; }
.drawer.on { transform: none; }
.drawer .x { position: absolute; top: 14px; right: 14px; border: 0; background: none; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; }
.drawer h3 { margin: 0; font-size: 18px; }
.drawer .big { font: 600 32px/1.2 var(--num); margin: 14px 0 2px; }
.stats4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin: 16px 0; }
.stats4 div { background: var(--surface); padding: 10px 12px; }
.stats4 small { display: block; color: var(--muted); font-size: 12px; }
.stats4 b { font: 600 15px/1.4 var(--num); }
.curve { width: 100%; height: 140px; display: block; }
.drawer h4 { margin: 20px 0 8px; font-size: 13px; color: var(--muted); font-weight: 400; }
table.mini { width: 100%; border-collapse: collapse; font-size: 13px; }
table.mini th { text-align: left; color: var(--dim); font-weight: 400; padding: 6px 4px; border-bottom: 1px solid var(--line); }
table.mini td { padding: 7px 4px; border-bottom: 1px solid var(--line); font-family: var(--num); }

/* 表单 */
.field { display: grid; gap: 5px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--muted); }
.field .hint { font-size: 12px; color: var(--dim); }
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg); color: var(--text); font: 14px/1.4 var(--cn); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
select option { background: var(--surface); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; align-items: start; }
input[type=text], input[type=password], input[type=number], input[type=date], select { height: 40px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; margin: 6px 0; cursor: pointer; color: var(--muted); }
.check input { margin-top: 3px; accent-color: var(--accent); }

/* 报名状态 */
.status { font-size: 13px; }
.status.reviewing { color: var(--link); } .status.waiting { color: var(--warn); } .status.approved { color: var(--ok); } .status.rejected { color: var(--danger); }
.item { padding: 14px 0; border-top: 1px solid var(--line); }
.item:first-of-type { border-top: 0; padding-top: 0; }
.item .h { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.item .h b { font-family: var(--num); }
details.checks { margin-top: 8px; font-size: 13px; }
details.checks summary { cursor: pointer; color: var(--muted); }
details.checks ul { list-style: none; margin: 8px 0 0; padding: 0; }
details.checks li { padding: 3px 0; display: flex; gap: 8px; }
details.checks li i { font-style: normal; width: 14px; flex: none; }
.ck-y { color: var(--ok); } .ck-n { color: var(--danger); }
details.checks li small { color: var(--dim); margin-left: auto; text-align: right; }

.mini-facts { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 10px 0 0; }
.mini-facts dt { color: var(--dim); font-size: 12px; }
.mini-facts dd { margin: 0; font: 600 15px/1.4 var(--num); font-variant-numeric: tabular-nums; }

/* 页脚 */
footer { border-top: 1px solid var(--line); padding: 20px 0 32px; font-size: 12px; color: var(--dim); }
footer a { color: var(--muted); }

/* 管理后台用到的 */
.stat { padding: 12px 14px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); }
.stat small { display: block; color: var(--muted); font-size: 12px; }
.stat b { font: 600 20px/1.3 var(--num); }

@media (max-width: 900px) {
  .home { grid-template-columns: minmax(0, 1fr); }
  .facts { margin-left: 0; gap: 12px 24px; flex-wrap: wrap; }
  .season { gap: 16px; }
}
@media (max-width: 640px) {
  .topbar .wrap { gap: 12px; }
  .nav { gap: 16px; }
  .season > div:first-child { width: 100%; }
  .facts { width: 100%; justify-content: space-between; }
  .season .btn { width: 100%; }
  .tabs { gap: 18px; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { white-space: nowrap; }
  .thead { display: none; }
  .row { grid-template-columns: 32px minmax(0, 1fr) auto; grid-template-areas: "rk nk ret" "rk meta st"; height: auto; padding: 10px 4px; gap: 2px 10px; }
  .row .rk { grid-area: rk; align-self: start; padding-top: 3px; }
  .row .nk { grid-area: nk; }
  .row .ret { grid-area: ret; text-align: right; }
  .row .ac { display: none; }
  .row .dd { grid-area: meta; font-size: 12px; text-align: left; color: var(--dim); }
  .row .dd::before { content: "最大回撤 "; font-family: var(--cn); }
  .row .st { grid-area: st; }
  .grid2 { grid-template-columns: 1fr; }
  .drawer { top: auto; height: 86vh; width: 100%; border-left: 0; border-top: 1px solid var(--line); border-radius: 12px 12px 0 0; transform: translateY(100%); }
}
