/* 象棋三国志 强度排行。只用系统字体，不引外部资源（国内要能打开）。 */
:root {
  --paper: #f4ecdc;
  --paper-2: #ebe0c9;
  --card: #fbf7ee;
  --ink: #2a211b;
  --ink-2: #5b4d40;
  --ink-3: #8a7a68;
  --line: #d8c9ac;
  --seal: #b8322a;
  --seal-dark: #8f241e;
  --gold: #b88a2e;
  --t0: #e8534a;   /* 夯 红 */
  --t1: #f29a3f;   /* 顶级 橙 */
  --t2: #f4d35e;   /* 人上人 黄 */
  --t3: #efe3c6;   /* NPC 浅米 */
  --t4: #ffffff;   /* 拉 白 */
  --r0: #8d9a86; --r1: #4d84b8; --r2: #8a5cb5; --r3: #c9962b; --r4: #b8322a;
  --shadow: 0 1px 2px rgba(60, 40, 20, .12), 0 4px 14px rgba(60, 40, 20, .08);
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", serif;
  --tile: 76px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 15px; line-height: 1.6;
}
a { color: var(--seal); }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* 顶栏 */
.top { border-bottom: 1px solid var(--line); background: var(--paper-2); }
.top .wrap { display: flex; align-items: center; gap: 12px; height: 52px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-family: var(--serif); font-weight: 700; font-size: 18px; }
.brand .piece { width: 30px; height: 30px; font-size: 16px; }
.top nav { margin-left: auto; display: flex; gap: 14px; font-size: 14px; }
.top nav a { color: var(--ink-2); text-decoration: none; }
.top nav a:hover { color: var(--seal); }

/* 棋子圆（品牌和无立绘的占位） */
.piece {
  display: inline-grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fffaf0, #f1dfba 70%);
  border: 2px solid var(--seal); color: var(--seal);
  font-family: var(--serif); font-weight: 700; box-shadow: inset 0 0 0 3px #fffaf0, inset 0 0 0 4px rgba(184, 50, 42, .35);
}

/* 首页 */
.hero { padding: 40px 0 24px; text-align: center; }
.hero h1 { font-family: var(--serif); font-size: 40px; margin: 0; letter-spacing: 4px; }
.hero p { color: var(--ink-2); margin: 10px auto 18px; max-width: 34em; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--seal); background: var(--seal); color: #fff; text-decoration: none;
  padding: 9px 20px; border-radius: 6px; font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { background: var(--seal-dark); }
.btn.ghost { background: transparent; color: var(--seal); }
.btn.ghost:hover { background: rgba(184, 50, 42, .08); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.section-title { font-family: var(--serif); font-size: 22px; margin: 28px 0 12px; }
.boards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-bottom: 40px; }
.board-card {
  display: block; background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px; color: var(--ink); text-decoration: none; box-shadow: var(--shadow); transition: transform .12s;
}
.board-card:hover { transform: translateY(-2px); border-color: var(--seal); }
.board-card h3 { margin: 0; font-family: var(--serif); font-size: 20px; }
.board-card .sub { color: var(--ink-3); font-size: 13px; margin: 2px 0 10px; }
.board-card .faces { display: flex; }
.board-card .faces img, .board-card .faces .piece { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--card); margin-right: -8px; background: var(--paper-2); object-fit: cover; }
.board-card .faces .piece { font-size: 16px; }
.board-card .count { color: var(--ink-2); font-size: 13px; margin-top: 10px; }
.foot { border-top: 1px solid var(--line); color: var(--ink-3); font-size: 13px; padding: 18px 0 28px; text-align: center; }

/* 榜单页 */
.board-head { padding: 22px 0 6px; }
.board-head h1 { margin: 0; font-family: var(--serif); font-size: 28px; }
.board-head .sub { color: var(--ink-3); font-size: 13px; }
.tabs { display: flex; gap: 6px; margin: 14px 0 12px; border-bottom: 1px solid var(--line); }
.tabs button {
  border: 0; background: none; font: inherit; font-size: 16px; padding: 8px 14px; cursor: pointer; color: var(--ink-2);
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tabs button.on { color: var(--seal); border-bottom-color: var(--seal); font-weight: 700; }
.hint { color: var(--ink-2); font-size: 13px; margin: 0 0 10px; }
.notice { background: #fff6e0; border: 1px solid #e9cf8f; border-radius: 8px; padding: 10px 12px; margin: 0 0 12px; font-size: 14px; }

/* 档位表 */
.tierlist { border: 2px solid var(--ink); border-radius: 6px; overflow: hidden; background: #2a211b; }
.tier { display: flex; min-height: calc(var(--tile) + 32px); border-top: 2px solid var(--ink); background: #fffdf8; }
.tier:first-child { border-top: 0; }
.tier-label {
  flex: 0 0 84px; display: grid; place-items: center; text-align: center;
  font-family: var(--serif); font-weight: 800; font-size: 22px; color: #2a211b; border-right: 2px solid var(--ink);
  user-select: none;
}
.tier-label small { display: block; font-family: var(--sans); font-weight: 400; font-size: 11px; color: rgba(42, 33, 27, .65); }
.t0 .tier-label { background: var(--t0); color: #fff; }
.t0 .tier-label small { color: rgba(255, 255, 255, .8); }
.t1 .tier-label { background: var(--t1); }
.t2 .tier-label { background: var(--t2); }
.t3 .tier-label { background: var(--t3); }
.t4 .tier-label { background: var(--t4); }
.tn .tier-label { background: #ddd3c2; font-size: 15px; }
.zone { flex: 1; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px; padding: 6px; min-height: 100%; }
.zone.over { background: #fff1d1; }
.pickable .zone { cursor: pointer; }
.pool-wrap { margin-top: 14px; }
.pool-wrap h3 { font-size: 15px; margin: 0 0 6px; color: var(--ink-2); font-weight: 600; }
.pool { background: var(--card); border: 1px dashed var(--line); border-radius: 8px; min-height: calc(var(--tile) + 40px); }

/* 头像格 */
.tile {
  position: relative; width: var(--tile); flex: 0 0 var(--tile); text-align: center; cursor: grab;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: pan-y;
}
.tile .face {
  display: block; width: var(--tile); height: var(--tile); border-radius: 6px; overflow: hidden;
  border: 2px solid var(--rc, var(--r0)); background: linear-gradient(160deg, #fffaf0, #eadbbb);
}
.tile .face img { width: 100%; height: 100%; display: block; pointer-events: none; }
.tile .face .piece { width: 74%; height: 74%; margin: 13%; font-size: calc(var(--tile) * .34); }
.tile .nm { display: block; font-size: 12px; line-height: 1.25; margin-top: 2px; color: var(--ink); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tile.sel .face { outline: 3px solid var(--seal); outline-offset: 1px; }
.tile.ghost { opacity: .3; }
.tile .badge {
  position: absolute; left: 2px; right: 2px; top: calc(var(--tile) - 20px); display: flex; justify-content: space-between;
  font-size: 11px; line-height: 16px; pointer-events: none;
}
.tile .badge span { background: rgba(42, 33, 27, .82); color: #fff; border-radius: 3px; padding: 0 4px; }
.tile .rank { position: absolute; left: 2px; top: 2px; background: var(--seal); color: #fff; font-size: 11px; line-height: 16px; border-radius: 3px; padding: 0 4px; pointer-events: none; }
.r0 { --rc: var(--r0); } .r1 { --rc: var(--r1); } .r2 { --rc: var(--r2); } .r3 { --rc: var(--r3); } .r4 { --rc: var(--r4); }
.drag-float { position: fixed; z-index: 50; pointer-events: none; transform: translate(-50%, -60%) scale(1.08); filter: drop-shadow(0 6px 12px rgba(0, 0, 0, .3)); }

/* 底部操作 */
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 16px 0; }
.actions .grow { flex: 1; color: var(--ink-3); font-size: 13px; }
.selbar {
  position: sticky; bottom: 0; z-index: 20; background: var(--ink); color: #fff; border-radius: 10px 10px 0 0;
  padding: 10px 14px; display: none; align-items: center; gap: 10px; font-size: 14px;
}
.selbar.show { display: flex; flex-direction: column; align-items: stretch; }
.selrow { display: flex; align-items: center; gap: 8px; }
.selbar button { background: none; border: 1px solid rgba(255, 255, 255, .5); color: #fff; border-radius: 5px; padding: 4px 10px; font: inherit; cursor: pointer; }
.selbar .grow { flex: 1; }
.selrow.put { margin-top: 8px; gap: 6px; }
.selrow.put button { flex: 1; border: 0; color: #2a211b; font-weight: 700; padding: 8px 0; }
.selrow.put button.back { background: #ddd3c2; flex: 0 0 auto; padding: 8px 10px; font-weight: 400; }

/* 我的排行（截图卡） */
.mine-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px; box-shadow: var(--shadow); margin: 6px 0 18px; }
.mine-card h2 { font-family: var(--serif); margin: 0 0 10px; font-size: 20px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.mine-card h2 small { font-family: var(--sans); font-size: 12px; color: var(--ink-3); font-weight: 400; }
.mine-card .tile { cursor: default; }

/* 详情弹窗 */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(30, 20, 12, .55); display: none; align-items: flex-end; justify-content: center; }
.modal.show { display: flex; }
.sheet { background: var(--card); width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; border-radius: 14px 14px 0 0; padding: 18px 18px 24px; }
@media (min-width: 640px) { .modal { align-items: center; } .sheet { border-radius: 14px; } }
.sheet .hd { display: flex; gap: 14px; align-items: center; }
.sheet .hd .face { width: 88px; height: 88px; flex: 0 0 88px; border-radius: 8px; overflow: hidden; border: 2px solid var(--rc, var(--r0)); background: linear-gradient(160deg, #fffaf0, #eadbbb); }
.sheet .hd .face img { width: 100%; height: 100%; }
.sheet .hd .face .piece { width: 74%; height: 74%; margin: 13%; font-size: 30px; }
.sheet h2 { margin: 0; font-family: var(--serif); font-size: 24px; }
.sheet .meta { color: var(--ink-3); font-size: 13px; }
.sheet .close { margin-left: auto; align-self: flex-start; border: 0; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--ink-3); }
.bars { margin: 14px 0 6px; }
.bar { display: grid; grid-template-columns: 54px 1fr 70px; align-items: center; gap: 8px; font-size: 13px; margin: 4px 0; }
.bar .lab { font-weight: 700; text-align: center; border-radius: 4px; padding: 1px 0; border: 1px solid var(--line); }
.bar .track { height: 14px; background: var(--paper-2); border-radius: 7px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--seal); }
.bar .num { color: var(--ink-2); text-align: right; }
.skills { margin-top: 12px; border-top: 1px solid var(--line); }
.skill { padding: 10px 0; border-bottom: 1px solid var(--line); }
.skill b { font-size: 15px; }
.skill .tag { display: inline-block; font-size: 11px; border-radius: 3px; padding: 0 5px; margin-left: 6px; vertical-align: 1px; background: var(--paper-2); color: var(--ink-2); }
.skill .tag.a { background: var(--seal); color: #fff; }
.skill p { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; white-space: pre-line; }

.empty { color: var(--ink-3); padding: 24px 0; text-align: center; }

@media (max-width: 600px) {
  :root { --tile: 60px; }
  .hero h1 { font-size: 32px; }
  .tier-label { flex-basis: 56px; font-size: 17px; }
  .tier-label small { font-size: 10px; }
  .tile .nm { font-size: 11px; }
  .actions .grow { flex-basis: 100%; }
  .top nav { gap: 10px; font-size: 13px; }
}
