/* ============================================================
   轻停时刻 · 游戏模式样式
   ============================================================ */

/* ---------- 发呆场景角落的游戏手柄 ---------- */

.btn-games {
  position: absolute;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 7;              /* 高于漂流瓶卡片(5)，卡片飘到角落也不会挡住按钮 */
  box-shadow: 0 4px 18px rgba(40, 50, 80, 0.18);
  transition: transform 0.25s var(--ease), background 0.3s;
  animation: padPulse 4s ease-in-out infinite;
}

.btn-games:active { transform: scale(0.9); background: rgba(255, 255, 255, 0.5); }

.btn-games svg { width: 30px; height: 30px; display: block; }

@keyframes padPulse {
  0%, 100% { box-shadow: 0 4px 18px rgba(40, 50, 80, 0.18); }
  50% { box-shadow: 0 4px 22px rgba(124, 143, 216, 0.45); }
}

/* ---------- 游戏舱（选择界面） ---------- */

#view-games { background: var(--bg); overflow-y: auto; -webkit-overflow-scrolling: touch; }

.games-inner {
  max-width: 420px;
  margin: 0 auto;
  width: 100%;
  padding: max(24px, env(safe-area-inset-top)) 22px max(44px, env(safe-area-inset-bottom));
  position: relative;
}

.games-title {
  text-align: center;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 6px;
  margin-left: 6px;
  padding-top: 6px;
}

.games-sub {
  text-align: center;
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: 2px;
  margin-top: 8px;
}

.game-grid {
  margin-top: 26px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.game-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 22px 12px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.25s var(--ease), box-shadow 0.3s;
}

.game-card:active { transform: scale(0.94); }
.game-card:hover { box-shadow: 0 16px 40px rgba(90, 90, 120, 0.16); }

.game-card-icon { width: 58px; height: 58px; display: flex; align-items: center; justify-content: center; }
.game-card-icon svg { width: 54px; height: 54px; }

.game-card-name { font-size: 15px; font-weight: 600; letter-spacing: 3px; }
.game-card-tag { font-size: 11px; color: var(--ink-soft); letter-spacing: 1px; }

/* ---------- 游戏运行视图 ---------- */

#view-game {
  background: #161B2B;
  color: #E6E4F0;
}

.game-hud {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 16px 8px;
  flex-shrink: 0;
}

.game-hud .btn-back {
  position: static;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #C7CBE0;
  flex-shrink: 0;
}

.game-title { font-size: 15px; letter-spacing: 3px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.game-score-box {
  display: flex;
  align-items: baseline;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 6px 14px;
  flex-shrink: 0;
}

.game-score-box small { font-size: 10px; color: #9aa1bd; letter-spacing: 1px; }
.game-score-box b { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #C7CBE0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-icon svg { width: 18px; height: 18px; }
.btn-icon:active { background: rgba(255, 255, 255, 0.2); }

/* 画布舞台 */

.game-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 4px 8px;
  position: relative;
}

#game-canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border-radius: 10px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.35);
  background: #101422;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

/* 触控按钮 */

.game-controls {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  padding: 12px 16px max(14px, env(safe-area-inset-bottom));
  min-height: 74px;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.ctrl-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #D9DCEC;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  transition: background 0.15s, transform 0.1s;
}

.ctrl-btn:active, .ctrl-btn.on {
  background: rgba(169, 184, 216, 0.45);
  border-color: rgba(169, 184, 216, 0.6);
  transform: scale(0.92);
}

.ctrl-btn.small { width: 52px; height: 52px; font-size: 18px; }
.ctrl-btn .lbl { font-size: 10px; letter-spacing: 1px; display: block; margin-top: 2px; }

/* 遮罩（暂停 / 结束） */

.game-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 16, 30, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}

.game-overlay.show { opacity: 1; pointer-events: auto; }

.ov-inner {
  width: min(300px, 84vw);
  text-align: center;
  background: rgba(30, 37, 60, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 26px;
  padding: 30px 22px 24px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.45);
}

.ov-title { font-size: 22px; font-weight: 500; letter-spacing: 6px; margin-left: 6px; }

.ov-sub { margin-top: 10px; font-size: 14px; color: #9aa1bd; letter-spacing: 1px; line-height: 1.8; }

.ov-score { margin-top: 8px; font-size: 34px; font-weight: 200; letter-spacing: 2px; }

.ov-btns { margin-top: 22px; display: flex; flex-direction: column; gap: 10px; }

.ov-btn {
  width: 100%;
  padding: 13px;
  border-radius: 16px;
  font-size: 15px;
  letter-spacing: 3px;
  color: #1B2030;
  background: #A9B8D8;
  transition: transform 0.2s, background 0.2s;
}

.ov-btn:active { transform: scale(0.96); background: #c3cfe9; }

.ov-btn.ghost {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #C7CBE0;
}

.ov-btn.ghost:active { background: rgba(255, 255, 255, 0.16); }

@media (max-width: 380px) {
  .ctrl-btn { width: 54px; height: 54px; }
  .game-controls { gap: 10px; }
}
