/* 中国跳棋 · 样式：深色扁平 + 轻微玻璃感，手机竖屏优先 */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%; overflow: hidden;
  background: #0a0e14;
  color: #e8eef7;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
  touch-action: manipulation;
  user-select: none; -webkit-user-select: none;
}
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(120% 90% at 50% -10%, #17222f 0%, #0b1017 55%, #070a0f 100%);
}
#app {
  position: relative; height: 100%; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ---------- 顶部状态栏 ---------- */
#hud {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px 4px;
}
.pcard {
  position: relative; flex: 1 1 0; min-width: 0;
  display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto;
  gap: 2px 7px; align-items: center;
  padding: 7px 9px; border-radius: 13px;
  background: rgba(255,255,255,0.045);
  border: 1px solid rgba(255,255,255,0.07);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.pcard .dot { grid-row: 1 / span 2; width: 12px; height: 12px; border-radius: 50%; display: block; }
.dot0 { background: #ff5d5d; box-shadow: 0 0 8px rgba(255,93,93,0.6); }
.dot1 { background: #4d9bff; box-shadow: 0 0 8px rgba(77,155,255,0.6); }
.pcard .pinfo { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.pcard .pname { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .pcount { font-size: 12px; color: #8fa2ba; }
.pcard .ptime { grid-row: 1 / span 2; font-size: 15px; font-variant-numeric: tabular-nums; color: #cfe0f5; }
.pcard .pbar { grid-column: 2 / span 2; height: 4px; border-radius: 3px; background: rgba(255,255,255,0.09); overflow: hidden; }
.pcard .pbar i { display: block; height: 100%; width: 0%; border-radius: 3px; background: linear-gradient(90deg, #4d9bff, #7bd0ff); transition: width .25s ease; }
#card0 .pbar i { background: linear-gradient(90deg, #ff7b7b, #ffb4b4); }
#card0.active { border-color: rgba(255,93,93,0.55); box-shadow: 0 0 0 1px rgba(255,93,93,0.25), 0 6px 22px -12px rgba(255,93,93,0.8); }
#card1.active { border-color: rgba(77,155,255,0.55); box-shadow: 0 0 0 1px rgba(77,155,255,0.25), 0 6px 22px -12px rgba(77,155,255,0.8); }
.pcard.winner { border-color: rgba(255,255,255,0.5); }
#turnWrap { flex: 0 0 auto; text-align: center; padding: 0 2px; }
#turnText { font-size: 12px; color: #93a6bf; white-space: nowrap; }

/* ---------- 棋盘 ---------- */
#wrap { position: relative; flex: 1 1 auto; min-height: 0; }
#board { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#toast {
  position: absolute; left: 50%; bottom: 14px; transform: translate(-50%, 8px);
  max-width: 86%; padding: 8px 14px; border-radius: 999px;
  background: rgba(12,17,24,0.92); border: 1px solid rgba(255,255,255,0.1);
  font-size: 13px; color: #dbe6f5; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 底部按钮 ---------- */
#bar {
  display: flex; gap: 6px; padding: 6px 10px 10px;
}
#bar button {
  flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 50px; padding: 6px 2px;
  border-radius: 13px; border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.05); color: #cbd8ea;
  font-size: 11px; font-family: inherit; cursor: pointer;
  transition: background .18s, border-color .18s, transform .1s;
}
#bar button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#bar button:active { transform: scale(0.96); }
#bar button.on { color: #7bd0ff; border-color: rgba(123,208,255,0.4); background: rgba(77,155,255,0.12); }
#bar button.off { color: #6b7b90; }
#bar button.armed { color: #ffb4b4; border-color: rgba(255,93,93,0.5); background: rgba(255,93,93,0.12); }

/* ---------- 弹层 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  padding: 18px calc(16px + env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
  background: rgba(6,9,13,0.72);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.overlay.hide, .sheet.hide { display: none; }
.panel {
  width: 100%; max-width: 420px; max-height: 92vh; overflow: auto;
  padding: 20px 18px; border-radius: 22px;
  background: linear-gradient(180deg, rgba(24,33,45,0.98), rgba(14,20,28,0.98));
  border: 1px solid rgba(255,255,255,0.09);
  box-shadow: 0 24px 60px -20px rgba(0,0,0,0.9);
}
.panel.center { text-align: center; }
.logo {
  margin: 2px 0 6px; font-size: 25px; font-weight: 700; letter-spacing: 2px; text-align: center;
  background: linear-gradient(100deg, #ff8f8f, #7bd0ff 60%, #b9a2ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sub { margin: 0 0 16px; font-size: 12.5px; line-height: 1.6; color: #93a6bf; text-align: center; }
.row { margin-bottom: 13px; }
.rowlabel { display: block; margin-bottom: 7px; font-size: 12px; color: #8fa2ba; }
.chips { display: flex; gap: 7px; }
.chip {
  flex: 1 1 0; padding: 10px 4px; border-radius: 11px; cursor: pointer;
  border: 1px solid rgba(255,255,255,0.09); background: rgba(255,255,255,0.045);
  color: #c3d2e6; font-size: 13px; font-family: inherit;
  transition: all .18s;
}
.chip.on { border-color: rgba(123,208,255,0.65); background: rgba(77,155,255,0.18); color: #eaf4ff; box-shadow: 0 0 0 1px rgba(123,208,255,0.2) inset; }
.primary {
  width: 100%; margin-top: 6px; padding: 15px; border-radius: 15px; cursor: pointer;
  border: 0; color: #06131f; font-size: 16px; font-weight: 700; font-family: inherit;
  background: linear-gradient(100deg, #7bd0ff, #4d9bff 55%, #a58cff);
  box-shadow: 0 12px 30px -14px rgba(77,155,255,0.9);
}
.primary:active { transform: scale(0.985); }
.btnrow { display: flex; gap: 8px; margin-top: 10px; }
.ghost {
  flex: 1 1 0; padding: 12px 8px; border-radius: 13px; cursor: pointer;
  border: 1px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.05);
  color: #c3d2e6; font-size: 13px; font-family: inherit;
}
.ghost.wide { width: 100%; margin-top: 10px; flex: none; }
.ghost:active { transform: scale(0.985); }
.stats { margin: 14px 0 0; font-size: 11.5px; color: #7d8ea6; text-align: center; }
.settle-title { margin: 6px 0 10px; font-size: 30px; font-weight: 800; letter-spacing: 2px; }
.settle-title.win { color: #7bd0ff; text-shadow: 0 0 24px rgba(123,208,255,0.4); }
.settle-title.lose { color: #ff8f8f; text-shadow: 0 0 24px rgba(255,143,143,0.35); }
.settle-title.draw { color: #d8c58a; }

/* ---------- 底部抽屉 ---------- */
.sheet { position: fixed; inset: 0; z-index: 30; display: flex; align-items: flex-end; background: rgba(6,9,13,0.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.sheetbox {
  width: 100%; max-height: 86vh; display: flex; flex-direction: column;
  border-radius: 22px 22px 0 0; border-top: 1px solid rgba(255,255,255,0.1);
  background: linear-gradient(180deg, #16202c, #0d131a);
  padding-bottom: calc(env(safe-area-inset-bottom));
  animation: up .22s ease;
}
@keyframes up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheethead { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 10px; }
.sheethead h3 { margin: 0; font-size: 17px; }
.close { padding: 8px 16px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.06); color: #cfe0f5; font-size: 13px; font-family: inherit; }
.sheetbody { padding: 4px 18px 22px; overflow: auto; -webkit-overflow-scrolling: touch; }
.rules { margin: 0 0 14px; padding-left: 20px; font-size: 13.5px; line-height: 1.85; color: #c3d2e6; }
.rules ul { margin: 6px 0; padding-left: 18px; }
.rules b { color: #eaf4ff; }
.sheetbody h4 { margin: 18px 0 8px; font-size: 14px; color: #eaf4ff; }
.sheetbody p { margin: 0 0 10px; font-size: 13.5px; line-height: 1.8; color: #c3d2e6; }
.srow {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 2px; border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 13.5px; color: #dbe6f5;
}
.srow em { font-style: normal; color: #7bd0ff; }
.srow input[type=checkbox] {
  appearance: none; -webkit-appearance: none; position: relative;
  width: 50px; height: 30px; border-radius: 999px; flex: none;
  background: rgba(255,255,255,0.14); transition: background .2s; cursor: pointer;
}
.srow input[type=checkbox]::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px;
  border-radius: 50%; background: #fff; transition: transform .2s;
}
.srow input[type=checkbox]:checked { background: linear-gradient(100deg, #7bd0ff, #4d9bff); }
.srow input[type=checkbox]:checked::after { transform: translateX(20px); }
.srow select {
  padding: 9px 12px; border-radius: 10px; font-size: 13px; font-family: inherit;
  border: 1px solid rgba(255,255,255,0.12); background: #121a24; color: #dbe6f5;
}

/* ---------- 小屏 / 横屏适配 ---------- */
@media (max-height: 560px) {
  .pcard { padding: 5px 7px; border-radius: 11px; }
  .pcard .pname { font-size: 12px; }
  .pcard .ptime { font-size: 13px; }
  #bar button { min-height: 42px; font-size: 10px; }
  #bar button svg { width: 18px; height: 18px; }
  .logo { font-size: 21px; }
  .panel { padding: 16px 14px; }
}
@media (min-width: 760px) {
  #hud { max-width: 760px; width: 100%; margin: 0 auto; }
  #bar { max-width: 760px; width: 100%; margin: 0 auto; }
}
/* ================= 顶部卡片：名称 + 计时 + 进度 + 进营/步数 ================= */
.pcard {
  display: flex; flex-direction: column; gap: 5px;
  padding: 7px 9px; border-radius: 13px;
}
.pcard .ptop { display: flex; align-items: center; gap: 6px; }
.pcard .ptop .pname { flex: 1 1 auto; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .ptop .ptime { flex: none; font-size: 14px; font-variant-numeric: tabular-nums; color: #cfe0f5; }
.pcard .pbar { height: 4px; border-radius: 3px; background: rgba(255,255,255,0.09); overflow: hidden; }
.pcard .pbot { display: flex; align-items: baseline; justify-content: space-between; font-size: 11px; color: #8fa2ba; }
.pcard .pbot .pmoves { color: #a9bdd6; font-variant-numeric: tabular-nums; }
.pcard .dot { width: 12px; height: 12px; border-radius: 50%; display: block; flex: none; }

/* 中间：回合提示 + 本局计时器 */
#turnWrap { display: flex; flex-direction: column; align-items: center; gap: 2px; }
#matchClock { font-size: 11px; color: #6f8098; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* 人数选择里的"即将开放" */
.chip.soon { opacity: 0.55; border-style: dashed; }
.chip.soon.on { opacity: 0.75; }
.soonbadge {
  display: block; margin-top: 3px; font-size: 9px; font-weight: 400;
  color: #f5c542; letter-spacing: 0.5px;
}

/* 结算页：手数 / 用时 */
.scorebox { display: flex; gap: 10px; margin: 14px 0 2px; }
.scorebox > div {
  flex: 1 1 0; padding: 12px 6px; border-radius: 14px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08);
}
.scorebox span { display: block; font-size: 22px; font-weight: 700; color: #eaf4ff; font-variant-numeric: tabular-nums; }
.scorebox em { display: block; margin-top: 3px; font-style: normal; font-size: 11px; color: #8fa2ba; }
.newrec { min-height: 18px; margin: 12px 0 0; font-size: 13px; font-weight: 600; color: #f5c542; }

/* 排行榜 */
.ranklist { margin: 8px 0 6px; }
.rankrow {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; margin-bottom: 6px; border-radius: 11px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.07);
  font-size: 13px;
}
.rankrow .rk {
  flex: none; width: 22px; height: 22px; line-height: 22px; text-align: center;
  border-radius: 50%; background: rgba(255,255,255,0.1); font-size: 12px; color: #cfdcee;
}
.rankrow.gold .rk { background: linear-gradient(160deg,#ffe27a,#e8a90c); color: #4a3400; font-weight: 700; }
.rankrow.silver .rk { background: linear-gradient(160deg,#e8eef7,#a9b6c7); color: #333d4a; font-weight: 700; }
.rankrow.bronze .rk { background: linear-gradient(160deg,#f0bc8a,#b5713a); color: #402305; font-weight: 700; }
.rankrow .rw { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rankrow .rw em { font-style: normal; margin-left: 6px; font-size: 11px; color: #7d8ea6; }
.rankrow .rs, .rankrow .rt { flex: none; font-size: 12px; color: #9db0c7; font-variant-numeric: tabular-nums; }
.rankrow .rs b, .rankrow .rt b { color: #7bd0ff; font-size: 14px; }
.rankempty { padding: 14px 4px; font-size: 12.5px; color: #7d8ea6; text-align: center; }
.sheetbody h4 { margin-top: 16px; }
.sheetbody h4:first-child { margin-top: 4px; }

/* ================= 联机对战 ================= */
.hintline { margin-top: -8px; font-size: 11.5px; color: #7d8ea6; }
#netStatus { font-size: 10.5px; color: #7d8ea6; white-space: nowrap; min-height: 13px; }
#netStatus.warn { color: #f5a742; }
#netStatus.bad { color: #ff8f8f; }
.joinrow { display: flex; gap: 8px; }
.joinrow input {
  flex: 1 1 auto; min-width: 0; padding: 12px 14px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12); background: #121a24; color: #eaf4ff;
  font-size: 16px; letter-spacing: 3px; text-transform: uppercase; font-family: inherit;
}
.joinrow input::placeholder { color: #5c6b80; letter-spacing: 0; font-size: 13px; }
.joinrow .ghost { flex: 0 0 auto; padding: 12px 18px; }
.codebox {
  margin: 6px 0 14px; padding: 16px; border-radius: 16px; text-align: center;
  background: rgba(255,255,255,0.05); border: 1px dashed rgba(123,208,255,0.45);
}
.codebox span {
  font-size: 30px; font-weight: 700; letter-spacing: 8px; color: #7bd0ff;
  font-variant-numeric: tabular-nums;
}
.linkbox {
  padding: 12px 14px; margin: 4px 0 10px; border-radius: 12px;
  background: #101821; border: 1px solid rgba(255,255,255,0.1);
  font-size: 12.5px; color: #9fd4ff; word-break: break-all; line-height: 1.6;
}

/* ================= 工具定位 / 培训平台入口 / 版权备案 ================= */
.tool-tag {
  margin: -4px 0 10px; text-align: center;
  font-size: 11.5px; letter-spacing: 0.5px; color: #7bd0ff;
}
.promo {
  margin: 14px 0 12px; padding: 13px 14px; border-radius: 16px;
  background: linear-gradient(135deg, rgba(123,208,255,0.12), rgba(165,140,255,0.10));
  border: 1px solid rgba(123,208,255,0.28);
}
.promo-t { font-size: 13.5px; font-weight: 700; color: #eaf4ff; }
.promo-s { margin-top: 4px; font-size: 11.5px; line-height: 1.6; color: #a9c4dd; }
.promo-btn {
  margin-top: 10px; width: 100%; padding: 11px; border-radius: 12px; cursor: pointer;
  border: 1px solid rgba(123,208,255,0.5); background: rgba(77,155,255,0.18);
  color: #eaf4ff; font-size: 13px; font-weight: 600; font-family: inherit;
}
.promo-btn:active { transform: scale(0.985); }

.sitefoot {
  margin-top: 16px; padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.07);
  text-align: center;
}
.sitefoot p { margin: 3px 0; font-size: 10.5px; line-height: 1.7; color: #6e7f95; }
.sitefoot a { color: #7f9ab5; text-decoration: none; }
.sitefoot a:active { color: #7bd0ff; }
.sitefoot .sep { margin: 0 6px; color: #46566a; }
.sitefoot .addr { color: #5c6b80; }
