/* ============================================================
   新增四个游戏的外壳样式（乒乓 / 贪吃蛇 / 记忆翻牌 / 你画我猜）
   颜色与 styles.css 的深空霓虹主题保持一致
   ============================================================ */

/* 大厅卡片：没有封面图时用渐变 + 字形兜底 */
.game-art {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 56px;
  box-sizing: border-box;
}
.art-glyph {
  font-size: 52px;
  line-height: 1;
  opacity: 0.92;
  text-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}
.stat-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}
.stat-streak {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  color: #ffcf6b;
  background: rgba(255, 176, 32, 0.14);
  vertical-align: middle;
}

/* ------------------------------ 通用外壳 */
.gx {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  box-sizing: border-box;
}
.gx-top {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 10px;
}
.gx-side { display: flex; flex-direction: column; min-width: 56px; }
.gx-side.r { align-items: flex-end; }
.gx-tag { font-size: 10px; letter-spacing: 1px; color: #77839c; }
.gx-score { font-size: 24px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.gx-score.p1 { color: #3ea6ff; text-shadow: 0 0 16px rgba(62, 166, 255, 0.5); }
.gx-score.p2 { color: #ff5c7c; text-shadow: 0 0 16px rgba(255, 92, 124, 0.5); }
.gx-mid { flex: 1; display: flex; flex-direction: column; align-items: center; }
.gx-sub { font-size: 11px; color: #ffb020; letter-spacing: 1px; font-weight: 600; }
.gx-sub2 { font-size: 10px; color: #6b7691; margin-top: 2px; }

.gx-field {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gx-box {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.07);
}
.gx-box canvas { display: block; width: 100%; height: 100%; }

.gx-mask {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 84%;
  max-width: 340px;
  padding: 20px 16px;
  border-radius: 16px;
  background: rgba(10, 15, 26, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  z-index: 3;
}
.gx-mask[hidden] { display: none; }
.gx-mask h3 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: 1px; }
.gx-mask p { margin: 6px 0 0; font-size: 11px; color: #93a0ba; line-height: 1.6; }
.gx-btn {
  margin-top: 14px;
  height: 38px;
  padding: 0 26px;
  border: 0;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: #08111f;
  background: linear-gradient(135deg, #6ea8ff, #4f7cff 55%, #7c5cff);
  box-shadow: 0 6px 16px rgba(79, 124, 255, 0.36);
  cursor: pointer;
}
.gx-btn:active { transform: scale(0.97); }

.gx-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px 0;
}
.gx-tools { display: flex; gap: 7px; }
.gx-tool {
  padding: 5px 13px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: #9aa7c2;
  font-size: 11px;
  cursor: pointer;
}
.gx-tool:active { opacity: 0.7; }
.gx-total { font-size: 11px; color: #6b7691; font-variant-numeric: tabular-nums; }

/* ------------------------------ 乒乓 */
.pg-divider {
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.16), transparent);
  pointer-events: none;
}
#pg-box { touch-action: none; }

/* ------------------------------ 贪吃蛇 */
.snk-controls {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 8px 6px 0;
}
.snk-padwrap { display: flex; flex-direction: column; align-items: center; }
.snk-label { font-size: 9px; letter-spacing: 1px; color: #77839c; margin-bottom: 5px; }
.snk-label.d1 { color: #86c8ff; }
.snk-label.d2 { color: #ff9db1; }
.snk-mid { display: flex; flex-direction: column; align-items: center; gap: 5px; }

.dpad-h5 {
  width: 96px; height: 96px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.07), rgba(255,255,255,0.02));
  border: 1px solid rgba(255, 255, 255, 0.08);
  touch-action: none;
  user-select: none;
}
.dpad-h5 i {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-style: normal;
  color: #8b98b4;
  border-radius: 8px;
  cursor: pointer;
}
.dpad-h5 i:active { background: rgba(255, 255, 255, 0.12); color: #fff; }
.dpad-h5 .u { grid-area: 1 / 2 / 2 / 3; }
.dpad-h5 .l { grid-area: 2 / 1 / 3 / 2; }
.dpad-h5 .c { grid-area: 2 / 2 / 3 / 3; }
.dpad-h5 .r { grid-area: 2 / 3 / 3 / 4; }
.dpad-h5 .d { grid-area: 3 / 2 / 4 / 3; }

.snk-rounds { display: flex; gap: 3px; }
.snk-pip { width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.12); }
.snk-pip.on.d1 { background: #3ea6ff; box-shadow: 0 0 8px rgba(62, 166, 255, 0.8); }
.snk-pip.on.d2 { background: #ff5c7c; box-shadow: 0 0 8px rgba(255, 92, 124, 0.8); }

/* ------------------------------ 记忆翻牌 */
.mem-top {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 4px 14px;
}
.mem-player {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: all 0.25s ease;
}
.mem-player.act { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.14); }
.mem-player .dot { width: 8px; height: 8px; border-radius: 50%; opacity: 0.35; }
.mem-player.act .dot { opacity: 1; }
.mem-player .dot.d1 { background: #3ea6ff; box-shadow: 0 0 12px rgba(62, 166, 255, 0.9); }
.mem-player .dot.d2 { background: #ff5c7c; box-shadow: 0 0 12px rgba(255, 92, 124, 0.9); }
.mem-player .nm { font-size: 10px; color: #77839c; letter-spacing: 1px; }
.mem-player .sc { font-size: 22px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.mem-player .sc.p1 { color: #86c8ff; }
.mem-player .sc.p2 { color: #ff9db1; }
.mem-center { display: flex; flex-direction: column; align-items: center; }
.mem-turn { font-size: 12px; font-weight: 600; color: #dbe4f7; }
.mem-turn.done { color: #ffb020; }
.mem-prog { font-size: 10px; color: #6b7691; margin-top: 2px; }

.mem-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 1fr;
  gap: 9px;
  padding: 2px;
}
.mem-card {
  position: relative;
  perspective: 600px;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.mem-card:active { transform: scale(0.97); }
.mem-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.42s cubic-bezier(0.22, 0.9, 0.24, 1);
}
.mem-card.flip .mem-inner { transform: rotateY(180deg); }
.mem-face {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.mem-back {
  background: linear-gradient(150deg, rgba(110, 168, 255, 0.16), rgba(124, 92, 255, 0.12));
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.24);
  font-size: 20px;
  font-weight: 800;
}
.mem-front {
  transform: rotateY(180deg);
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 30px;
}
.mem-card.matched .mem-front {
  background: linear-gradient(150deg, rgba(52, 211, 153, 0.22), rgba(52, 211, 153, 0.08));
  border-color: rgba(52, 211, 153, 0.45);
  box-shadow: 0 0 16px rgba(52, 211, 153, 0.22);
}
.mem-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px 0;
  font-size: 10px;
  color: #6b7691;
}

/* ------------------------------ 你画我猜 */
.dg-top {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 4px 10px;
}
.dg-mid { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 0 10px; }
.dg-round { font-size: 10px; color: #93a0ba; letter-spacing: 1px; }
.dg-timer { width: 100%; max-width: 180px; height: 4px; border-radius: 999px; background: rgba(255,255,255,0.1); margin-top: 5px; overflow: hidden; }
.dg-bar { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #34d399, #22d3ee); transition: width 0.2s linear; }
.dg-bar.urgent { background: linear-gradient(90deg, #ff8fa5, #ff5c7c); }
.dg-clock { font-size: 12px; color: #dbe4f7; margin-top: 3px; font-variant-numeric: tabular-nums; }
.dg-clock.urgent { color: #ff8fa5; }

#dg-box { background: #0e1524; touch-action: none; }
.dg-word { font-size: 34px; font-weight: 800; letter-spacing: 6px; color: #ffd579; margin: 10px 0 0; }
.dg-answer { font-size: 15px; font-weight: 700; color: #ffd579; letter-spacing: 2px; margin-top: 6px; }
.dg-hit { color: #34d399; }
.dg-miss { color: #ff8fa5; }

.dg-hintbar { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 8px 6px 0; }
.dg-hint { font-size: 12px; color: #93a0ba; letter-spacing: 3px; }
.dg-skip {
  font-size: 10px;
  color: #ffb020;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 176, 32, 0.4);
  background: rgba(255, 176, 32, 0.1);
  cursor: pointer;
}

.dg-tools { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; padding: 8px 2px 0; }
.dg-color {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14);
  cursor: pointer;
}
.dg-color.on { border-color: #fff; transform: scale(1.12); }
.dg-colors { display: flex; gap: 7px; margin-right: auto; }
.dg-act {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10px;
  color: #9aa7c2;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
}
.dg-act.on { color: #08111f; background: #ffb020; border-color: transparent; font-weight: 700; }

.dg-ask {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 5px 5px 5px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.dg-ask input {
  flex: 1;
  min-width: 0;
  height: 32px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #e9eefb;
  font-size: 13px;
}
.dg-ask input::placeholder { color: #5f6a83; }
.dg-send {
  width: 54px; height: 32px;
  border: 0;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: #08111f;
  background: linear-gradient(135deg, #6ea8ff, #4f7cff);
  cursor: pointer;
}
.dg-send.off { opacity: 0.35; }
