/* ============================================================
 * 迷你工具站 · H5 小游戏公共样式
 * 结构：设计令牌 → 页面外框 → 控件 → 浮层/动效
 * 每个游戏页只保留自己棋盘区的样式，chrome 统一走这里
 * ============================================================ */
:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --ink: #1e293b;
  --ink_2: #64748b;
  --line: #e2e8f0;
  --accent: #4f46e5;
  --accent_soft: #eef2ff;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .06);
  --page_w: 620px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ---------- 顶部导航（吸顶玻璃条） ---------- */
.top_bar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 10px max(16px, calc((100% - var(--page_w)) / 2));
  background: rgba(255, 255, 255, .8);
  background: color-mix(in srgb, var(--card) 82%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.back_btn {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12.5px; font-weight: 600; color: var(--ink);
  background: var(--card); border: 1px solid var(--line);
  padding: 5px 14px; border-radius: 999px; box-shadow: var(--shadow);
  transition: color .15s, border-color .15s;
}
.back_btn:hover, .back_btn:focus-visible { color: var(--accent); border-color: var(--accent); outline: none; }
.top_nav { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.top_nav a { font-size: 12.5px; font-weight: 600; color: var(--ink_2); transition: color .15s; }
.top_nav a:hover, .top_nav a:focus-visible { color: var(--accent); outline: none; }
@media (max-width: 420px) { .top_nav { gap: 12px; } }

/* ---------- 主体 ---------- */
.main {
  flex: 1; width: 100%; max-width: var(--page_w);
  margin: 0 auto; padding: 6px 16px 24px;
  /* 内容在视口内垂直居中，避免宽屏上下大片留白 */
  display: flex; flex-direction: column; justify-content: center;
}
.head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.head h1 { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.head h1 em { font-style: normal; color: var(--accent); }
.head .sub { width: 100%; font-size: 12.5px; color: var(--ink_2); }

/* ---------- 计分 ---------- */
.scores { display: flex; align-items: center; gap: 8px; }
.score_box {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 4px 14px; text-align: center; min-width: 72px;
  box-shadow: var(--shadow);
}
.score_box b {
  display: block; font-size: 19px; line-height: 1.3;
  font-variant-numeric: tabular-nums;
}
.score_box span { font-size: 10.5px; color: var(--ink_2); }

/* ---------- 工具行 ---------- */
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.tip_txt { font-size: 12.5px; color: var(--ink_2); margin-right: auto; }

/* ---------- 按钮 ---------- */
.btn {
  border: none; cursor: pointer; font-family: inherit;
  font-size: 13px; font-weight: 700; color: #fff;
  background: var(--accent); padding: 8px 15px; border-radius: 8px;
  transition: filter .15s, transform .1s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.96); }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn_ghost { background: var(--card); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow); }
.btn_prop { background: var(--card); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow); }
.btn[disabled], .btn_prop[disabled] { opacity: .42; cursor: not-allowed; transform: none; filter: none; }

/* ---------- 浮层 ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 90; border-radius: var(--radius);
  background: rgba(248, 250, 253, .88); backdrop-filter: blur(3px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; opacity: 0; pointer-events: none; transition: opacity .25s;
}
.overlay.show { opacity: 1; pointer-events: auto; }
.overlay h2 { font-size: 28px; font-weight: 800; }
.overlay p { font-size: 13.5px; color: var(--ink_2); }
.overlay .btns { display: flex; gap: 10px; }

/* ---------- 飘分动效 ---------- */
.merge_fx {
  position: absolute; pointer-events: none; z-index: 20;
  transform: translate(-50%, -50%);
  font-size: 17px; font-weight: 800; color: var(--accent);
  text-shadow: 0 1px 0 #fff; white-space: nowrap;
  animation: fx_up .6s ease-out forwards;
}
@keyframes fx_up { from { opacity: 1; } to { opacity: 0; translate: 0 -34px; } }

/* ---------- 说明 ---------- */
.note {
  max-width: var(--page_w); margin: 16px auto 0;
  font-size: 12px; color: var(--ink_2); line-height: 1.8;
}
kbd {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 4px; padding: 0 5px; font-family: inherit;
}

/* ---------- SEO 正文与游戏互链 ---------- */
.seo_section {
  margin-top: 18px; padding: 16px 18px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.seo_section h2 { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.seo_section p { font-size: 12.5px; color: var(--ink_2); line-height: 1.85; }
.more_games { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.more_games a {
  font-size: 12px; padding: 4px 13px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink_2);
  transition: color .15s, border-color .15s;
}
.more_games a:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- 排行榜 ---------- */
.leaderboard {
  width: 100%; margin: 18px auto 0; padding: 16px;
  background: color-mix(in srgb, var(--card) 94%, transparent);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.leader_head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.leader_head h2 { font-size: 16px; line-height: 1.4; }
.leader_head p { margin-top: 2px; color: var(--ink_2); font-size: 11.5px; }
.leader_count { flex: none; padding: 3px 8px; border-radius: 999px; background: var(--accent_soft); color: var(--accent); font-size: 10.5px; font-weight: 700; }
.leader_status { margin-top: 10px; color: var(--ink_2); font-size: 11.5px; }
.leader_list { list-style: none; display: grid; gap: 5px; margin-top: 10px; }
.leader_row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 31px; padding: 4px 8px; border-radius: 7px; background: var(--bg); font-size: 12.5px; }
.leader_top3 { background: var(--accent_soft); }
.leader_rank { color: var(--ink_2); text-align: center; font-variant-numeric: tabular-nums; }
.leader_top3 .leader_rank { color: var(--accent); }
.leader_player { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leader_score { color: var(--accent); font-variant-numeric: tabular-nums; }
.leader_empty { padding: 14px 8px 4px; color: var(--ink_2); text-align: center; font-size: 12px; }
@media (max-height: 760px) {
  .main { justify-content: flex-start; }
}
