/* ============================================================
   games.css — 所有小游戏与小程序共用样式（微信风）
   主绿 #07C160 / 己方 #95EC69 / 底 #EDEDED / 白底卡片
   仅新增，不修改任何已有文件。
   ============================================================ */

/* ---------- 通用页面骨架 ---------- */
.gm-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #EDEDED;
  overflow: hidden;
  font-family: var(--wx-font);
}
.gm-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 12px 18px;
  box-sizing: border-box;
}
.gm-body.nopad { padding: 0; }

/* 导航栏微调：游戏/小程序统一白底 */
.gm-navbar {
  height: var(--wx-navbar-h);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex: none;
  border-bottom: .5px solid var(--wx-line);
  font-size: 17px;
  font-weight: 600;
}
.gm-navbar .nav-left,
.gm-navbar .nav-right {
  position: absolute;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  font-size: 15px;
  font-weight: 400;
  color: var(--wx-text-main);
  cursor: pointer;
}
.gm-navbar .nav-left { left: 12px; color: var(--wx-green); }
.gm-navbar .nav-right { right: 12px; color: var(--wx-green); }
.gm-navbar .nav-title {
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 通用卡片 / 面板 ---------- */
.gm-card {
  background: #fff;
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
  margin-bottom: 10px;
}
.gm-row {
  display: flex;
  align-items: center;
}
.gm-row.between { justify-content: space-between; }
.gm-row.center { justify-content: center; }
.gm-grow { flex: 1; }

/* 分数/数据小胶囊 */
.gm-pill {
  background: #F2F2F2;
  border-radius: 8px;
  padding: 6px 10px;
  min-width: 64px;
  text-align: center;
}
.gm-pill .pill-label {
  font-size: 11px;
  color: var(--wx-text-sub);
}
.gm-pill .pill-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--wx-text-main);
  line-height: 1.2;
}
.gm-pill.green { background: rgba(7, 193, 96, .12); }
.gm-pill.green .pill-value { color: var(--wx-green); }
.gm-pill.red .pill-value { color: var(--wx-red); }

/* 主操作按钮（微信绿） */
.gm-btn {
  display: inline-block;
  padding: 9px 18px;
  background: var(--wx-green);
  color: #fff;
  border-radius: 6px;
  font-size: 15px;
  border: none;
  cursor: pointer;
  text-align: center;
}
.gm-btn:active { background: var(--wx-green-dark); }
.gm-btn.ghost {
  background: #fff;
  color: var(--wx-text-main);
  border: .5px solid var(--wx-line);
}
.gm-btn.danger { background: var(--wx-red); }
.gm-btn.block { display: block; width: 100%; }

/* 分段选择器（难度/城市 tab） */
.gm-seg {
  display: flex;
  background: #E4E4E4;
  border-radius: 8px;
  padding: 2px;
  margin-bottom: 10px;
}
.gm-seg .seg-item {
  flex: 1;
  text-align: center;
  font-size: 14px;
  padding: 6px 0;
  border-radius: 6px;
  color: var(--wx-text-sub);
  cursor: pointer;
  transition: all .18s;
}
.gm-seg .seg-item.on {
  background: #fff;
  color: var(--wx-text-main);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}

/* ============================================================
   贪吃蛇 snake
   ============================================================ */
.snake-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px;
  background: #0F1720;
  flex: 1;
}
.snake-canvas {
  background: #14202E;
  border-radius: 8px;
  touch-action: none;
  max-width: 100%;
}
.snake-hud {
  width: 100%;
  display: flex;
  justify-content: space-around;
  margin-bottom: 10px;
}
.snake-overlay {
  position: absolute;
  inset: 44px 0 0 0;
  background: rgba(15, 23, 32, .88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
  color: #fff;
}
.snake-overlay.hidden { display: none; }
.snake-overlay .ov-title { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.snake-overlay .ov-score { font-size: 16px; color: #9ADAB0; margin-bottom: 18px; }

/* 方向控制盘（触屏辅助） */
.snake-pad {
  display: grid;
  grid-template-columns: repeat(3, 54px);
  grid-template-rows: repeat(3, 54px);
  gap: 6px;
  margin-top: 12px;
}
.snake-pad .pad-btn {
  background: #1E2D3D;
  color: #9ADAB0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  user-select: none;
}
.snake-pad .pad-btn:active { background: var(--wx-green); color: #fff; }

/* ============================================================
   翻牌记忆 memory
   ============================================================ */
.mem-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 4px;
}
.mem-card {
  aspect-ratio: 1 / 1;
  perspective: 600px;
  cursor: pointer;
}
.mem-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform .35s;
  transform-style: preserve-3d;
}
.mem-card.flip .mem-card-inner { transform: rotateY(180deg); }
.mem-card .face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
}
.mem-card .face.back {
  background: linear-gradient(135deg, #07C160, #06AD56);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
}
.mem-card .face.front {
  background: #fff;
  transform: rotateY(180deg);
  box-shadow: inset 0 0 0 1px var(--wx-line);
}
.mem-card.done .face.front {
  background: rgba(149, 236, 105, .35);
}
.mem-card.done { cursor: default; }

/* ============================================================
   扫雷 minesweeper
   ============================================================ */
.ms-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px;
}
.ms-board {
  display: grid;
  gap: 2px;
  background: #D6D6D6;
  padding: 4px;
  border-radius: 6px;
  touch-action: manipulation;
  user-select: none;
}
.ms-cell {
  width: 30px;
  height: 30px;
  background: #E8E8E8;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.ms-cell.open { background: #fff; cursor: default; }
.ms-cell.mine { background: #FFD6D6; }
.ms-cell.flag { color: var(--wx-red); }
.ms-num-1 { color: #1A6DFF; }
.ms-num-2 { color: #07C160; }
.ms-num-3 { color: #FA5151; }
.ms-num-4 { color: #7B2D8E; }
.ms-num-5 { color: #8B4513; }
.ms-num-6 { color: #008B8B; }
.ms-num-7 { color: #000; }
.ms-num-8 { color: #666; }
.ms-face { font-size: 22px; }

/* ============================================================
   打地鼠 whack
   ============================================================ */
.whack-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 6px;
}
.whack-hole {
  aspect-ratio: 1 / 1;
  background: #8D5524;
  border-radius: 50% 50% 12px 12px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 -6px 8px rgba(0, 0, 0, .25);
}
.whack-mole {
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: -100%;
  height: 88%;
  background: radial-gradient(circle at 50% 35%, #B07A4A, #7A4A22);
  border-radius: 50% 50% 40% 40%;
  transition: bottom .12s ease-out;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
}
.whack-hole.up .whack-mole { bottom: 6%; }
.whack-hole.hit { background: #6B3E1A; }

/* ============================================================
   天气 weather
   ============================================================ */
.wx-now {
  background: linear-gradient(135deg, #3D8BFF, #64C7FF);
  color: #fff;
  border-radius: 12px;
  padding: 18px 16px;
  margin-bottom: 10px;
}
.wx-now .wx-city { font-size: 16px; opacity: .9; }
.wx-now .wx-temp { font-size: 56px; font-weight: 200; line-height: 1; margin: 6px 0; }
.wx-now .wx-desc { font-size: 15px; opacity: .95; }
.wx-now .wx-meta { display: flex; gap: 18px; margin-top: 10px; font-size: 13px; opacity: .92; }
.wx-7day { display: flex; flex-direction: column; }
.wx-day {
  display: flex;
  align-items: center;
  padding: 8px 0;
  border-bottom: .5px solid var(--wx-line-soft);
  font-size: 14px;
}
.wx-day:last-child { border-bottom: none; }
.wx-day .d-name { width: 46px; color: var(--wx-text-main); }
.wx-day .d-icon { width: 30px; text-align: center; }
.wx-day .d-range { flex: 1; text-align: right; color: var(--wx-text-sub); }
.wx-city-list { display: flex; flex-wrap: wrap; gap: 8px; }
.wx-city-chip {
  padding: 6px 14px;
  background: #fff;
  border-radius: 16px;
  font-size: 14px;
  border: .5px solid var(--wx-line);
  cursor: pointer;
}
.wx-city-chip.on { background: var(--wx-green); color: #fff; border-color: var(--wx-green); }

/* ============================================================
   微信运动 steps
   ============================================================ */
.steps-hero {
  background: linear-gradient(135deg, #07C160, #06AD56);
  color: #fff;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  margin-bottom: 10px;
}
.steps-hero .steps-num { font-size: 44px; font-weight: 700; line-height: 1; }
.steps-hero .steps-label { font-size: 13px; opacity: .9; margin-top: 4px; }
.steps-rank-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: .5px solid var(--wx-line-soft);
}
.steps-rank-item:last-child { border-bottom: none; }
.steps-rank-item .rank-no {
  width: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--wx-text-sub);
}
.steps-rank-item .rank-no.top1 { color: #F7B500; font-weight: 700; }
.steps-rank-item .rank-no.top2 { color: #9AA0A6; font-weight: 700; }
.steps-rank-item .rank-no.top3 { color: #CD7F32; font-weight: 700; }
.steps-rank-item .rank-name { flex: 1; font-size: 15px; }
.steps-rank-item .rank-steps { font-size: 14px; color: var(--wx-text-sub); }
.steps-like {
  color: var(--wx-text-faint);
  font-size: 18px;
  padding: 4px 6px;
  cursor: pointer;
}
.steps-like.liked { color: var(--wx-red); }

/* ============================================================
   备忘录 memo
   ============================================================ */
.memo-search {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 8px;
  padding: 7px 12px;
  margin-bottom: 10px;
}
.memo-search input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  background: transparent;
}
.memo-item {
  background: #fff;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  position: relative;
}
.memo-item.done .memo-title { text-decoration: line-through; color: var(--wx-text-faint); }
.memo-item .memo-title { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.memo-item .memo-content {
  font-size: 14px;
  color: var(--wx-text-sub);
  white-space: pre-wrap;
  word-break: break-word;
}
.memo-item .memo-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--wx-text-faint);
}
.memo-tag {
  background: rgba(7, 193, 96, .12);
  color: var(--wx-green);
  padding: 1px 8px;
  border-radius: 10px;
}
.memo-check {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid #C7C7CC;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  color: #fff;
}
.memo-item.done .memo-check {
  background: var(--wx-green);
  border-color: var(--wx-green);
}
.memo-fab {
  position: absolute;
  right: 16px;
  bottom: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--wx-green);
  color: #fff;
  font-size: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(7, 193, 96, .4);
  cursor: pointer;
}

/* ============================================================
   计算器 calc
   ============================================================ */
.calc-screen {
  background: #111;
  color: #fff;
  border-radius: 10px;
  padding: 18px 16px;
  text-align: right;
  margin-bottom: 10px;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.calc-screen .calc-expr { font-size: 15px; color: #888; min-height: 20px; word-break: break-all; }
.calc-screen .calc-result { font-size: 40px; font-weight: 300; word-break: break-all; line-height: 1.1; }
.calc-keypad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.calc-key {
  height: 60px;
  border-radius: 10px;
  background: #fff;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}
.calc-key:active { background: #D9D9D9; }
.calc-key.op { background: #F2F2F2; color: var(--wx-green); }
.calc-key.fn { background: #E4E4E4; color: #333; font-size: 20px; }
.calc-key.eq { background: var(--wx-green); color: #fff; }
.calc-key.zero { grid-column: span 2; }

/* ============================================================
   表情商店 sticker
   ============================================================ */
.sticker-pack {
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
}
.sticker-pack .pack-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.sticker-pack .pack-cover {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: linear-gradient(135deg, #FFD86B, #FF9A6B);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}
.sticker-pack .pack-name { font-size: 16px; font-weight: 600; }
.sticker-pack .pack-author { font-size: 12px; color: var(--wx-text-sub); }
.sticker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.sticker-cell {
  aspect-ratio: 1 / 1;
  background: #F7F7F7;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.sticker-cell svg { width: 72%; height: 72%; }
.sticker-dl {
  margin-left: auto;
  padding: 5px 14px;
  border-radius: 14px;
  background: rgba(7, 193, 96, .12);
  color: var(--wx-green);
  font-size: 13px;
  cursor: pointer;
}
.sticker-dl.done { background: #F2F2F2; color: var(--wx-text-faint); }

/* ============================================================
   小程序集合页 minigrid
   ============================================================ */
.mg-group-title {
  padding: 14px 16px 6px;
  font-size: 14px;
  color: var(--wx-text-sub);
}
.mg-grid {
  background: #fff;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px 0;
  padding: 14px 6px;
}
.mg-entry {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.mg-entry .mg-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 26px;
}
.mg-entry .mg-label { font-size: 12px; color: var(--wx-text-main); }

/* 空状态 */
.gm-empty {
  text-align: center;
  color: var(--wx-text-faint);
  font-size: 14px;
  padding: 40px 0;
}

/* 通用动画 */
@keyframes gmPop {
  0% { transform: scale(.6); opacity: .4; }
  100% { transform: scale(1); opacity: 1; }
}
.gm-pop { animation: gmPop .18s ease; }
