/* =========================================================
   2048 猫爪版 · 独立样式（不依赖主页 style.css）
   改 --accent 等变量即可换主题；瓷砖用粉 / 蓝猫爪配色
   ========================================================= */

:root {
  --bg-1: #eef7ff;
  --bg-2: #d9ecfb;
  --card: #ffffff;
  --ink: #1d3a52;
  --ink-soft: #5a7d99;
  --accent: #2f9bd8;
  --accent-2: #57c2f5;
  --border: #cfe6f7;
  --radius: 16px;
  --shadow: 0 6px 20px rgba(47, 155, 216, 0.14);
  --shadow-hover: 0 10px 28px rgba(47, 155, 216, 0.24);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: linear-gradient(160deg, var(--bg-1), var(--bg-2));
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ===== 按钮 ===== */
.btn {
  border: none;
  border-radius: 10px;
  padding: 7px 14px;
  font-size: 13px;
  background: #e3eef7;
  color: var(--ink);
  transition: transform .12s ease, background .2s ease;
}
.btn:active { transform: scale(.96); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ===== 游戏页通用 ===== */
.game-page { max-width: 900px; margin: 0 auto; padding: 20px 16px 48px; }
.game-header { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.back-link { color: var(--accent); font-size: 14px; }
.back-link:hover { text-decoration: underline; }
.game-title { font-size: 26px; }
.game-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

/* ===== 2048 ===== */
.g2048-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.g2048-scores { display: flex; gap: 10px; }
.g2048-score-box {
  background: #eaf6ff;
  border-radius: 10px;
  padding: 5px 14px;
  text-align: center;
  min-width: 76px;
}
.g2048-score-box span { display: block; font-size: 11px; color: var(--ink-soft); }
.g2048-score-box b { font-size: 18px; color: var(--accent); }
.g2048-actions { display: flex; gap: 8px; }
.g2048-hint {
  text-align: center;
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 12px;
}

.g2048-board-wrap {
  position: relative;
  max-width: 460px;
  margin: 0 auto;
}

.g2048-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 10px;
  background: #cfe6f7;
  border-radius: 16px;
  touch-action: none;
}

.g2048-cell {
  position: relative;
  border-radius: 10px;
  background: #e3f0fa;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: clamp(18px, 5.5vw, 32px);
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overflow: hidden;
}

/* 每块瓷砖左上角的小猫爪水印 */
.g2048-cell.filled::after {
  content: "🐾";
  position: absolute;
  top: 3px;
  left: 5px;
  font-size: 9px;
  opacity: .28;
  pointer-events: none;
}

.t2 { background: #ffe3ee; color: #b23a5f; }
.t4 { background: #ffd0e2; color: #a52a55; }
.t8 { background: #ffb3cf; color: #fff; }
.t16 { background: #ff94bd; color: #fff; }
.t32 { background: #ff77ab; color: #fff; }
.t64 { background: #ff5a97; color: #fff; }
.t128 { background: #a5dcf7; color: #fff; }
.t256 { background: #78c9f0; color: #fff; }
.t512 { background: #4fb6e8; color: #fff; }
.t1024 { background: #2f9bd8; color: #fff; }
.t2048 { background: linear-gradient(135deg, #ff5a97, #2f9bd8); color: #fff; }

/* 结束 / 通关遮罩 */
.g2048-overlay {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .82);
  border-radius: 16px;
  z-index: 5;
}
.g2048-overlay.show { display: flex; }
.g2048-overlay-inner { text-align: center; padding: 20px; }
.g2048-overlay-inner p:first-child {
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 6px;
}
.g2048-overlay-inner p {
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 16px;
}

/* ===== 响应式（手机） ===== */
@media (max-width: 640px) {
  .game-page { padding: 16px 10px 40px; }
  .game-panel { padding: 12px; }
  .game-title { font-size: 22px; }
  .g2048-top { justify-content: center; }
  .g2048-board { gap: 7px; padding: 7px; }
}
