/* games.css — 小游戏四页（/games/*）共用样式
   依赖 styles.css 的主题变量（--primary-color / --bg-color / --text-color / --shadow-color），
   深色模式自动跟随 body.dark。games.css 独立于 gallery.css：瀑布流样式与游戏无关，不引。 */

/* ===== 页头（覆盖 styles.css 的 position:fixed，游戏页改粘性；
     2026-09-22 全站统一白底毛玻璃 + 细底边框，与首页/档案馆等顶栏同款） ===== */
.game-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px) saturate(1.5);
  -webkit-backdrop-filter: blur(12px) saturate(1.5);
  color: var(--text-color);
  border-bottom: 1px solid rgba(77, 107, 254, 0.14);
  box-shadow: 0 1px 12px rgba(23, 35, 80, 0.06);
  box-sizing: border-box;
}

body.dark .game-header {
  background: rgba(28, 30, 38, 0.82);
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: none;
}

.gh-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.gh-back {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 14px;
  white-space: nowrap;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(77, 107, 254, 0.1);
  transition: background 0.18s ease;
}

.gh-back:hover {
  background: rgba(77, 107, 254, 0.2);
}

body.dark .gh-back {
  background: rgba(93, 121, 255, 0.2);
}

body.dark .gh-back:hover {
  background: rgba(93, 121, 255, 0.32);
}

.gh-brand {
  color: var(--text-color);
  text-decoration: none;
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
}

/* 面包屑分隔（梗鲸 / 页名，2026-09-22） */
.gh-sep {
  opacity: 0.3;
  font-size: 13px;
}

.gh-title {
  font-size: 14px;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gh-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.game-header button {
  background: none;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  display: flex;
  padding: 4px;
  border-radius: 6px;
}

.game-header button:hover {
  background: rgba(77, 107, 254, 0.12);
}

body.dark .game-header button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.game-header button img {
  width: 24px;
  height: 24px;
  display: block;
  filter: invert(1); /* 白色 SVG 在白底顶栏反成深色；深色顶栏还原 */
  opacity: 0.75;
}

body.dark .game-header button img {
  filter: none;
  opacity: 0.9;
}

/* 页头静音开关（SVG 图标，同主题切换的反色待遇；默认静音见 game-common soundEnabled） */

/* 语言切换：游戏页单 URL，切换即重载，select 比菜单轻量 */
.gh-lang {
  background: rgba(77, 107, 254, 0.1);
  color: var(--text-color);
  border: none;
  border-radius: 6px;
  padding: 5px 6px;
  font-size: 13px;
  cursor: pointer;
}

body.dark .gh-lang {
  background: rgba(255, 255, 255, 0.1);
}

.gh-lang option {
  color: #1e232c;
  background: #fff;
}

/* ===== 主体布局 ===== */
.game-main {
  width: 100%;
  max-width: 700px; /* 容纳放大后的棋盘（.g-board 620px + 左右内边距） */
  margin: 0 auto;
  padding: 18px 14px 40px;
  box-sizing: border-box;
}

.game-main h1,
.game-main h2 {
  margin: 0 0 4px;
  font-size: 22px;
}

.game-desc {
  margin: 0 0 14px;
  font-size: 14px;
  opacity: 0.75;
  line-height: 1.5;
}

/* ===== HUD 与工具条 ===== */
.game-hud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.hud-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 16px;
  background: rgba(77, 107, 254, 0.08);
  font-size: 13px;
}

.hud-chip b {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.hud-chip.warn b {
  color: #e5484d;
}

.game-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.g-btn {
  background: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: 16px;
  padding: 8px 18px;
  font-size: 14px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
  /* Q 弹（2026-09-22）：overshoot 回弹曲线，游戏按钮本就该弹 */
  transition: background 0.2s, transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.g-btn:hover:not(:disabled) {
  background: var(--primary-color-dark);
}

.g-btn:active:not(:disabled) {
  transform: scale(0.92);
  transition-duration: 0.08s;
}

.g-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.g-btn.ghost {
  background: transparent;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}

.g-btn.ghost:hover:not(:disabled) {
  background: rgba(77, 107, 254, 0.1);
}

.g-select {
  padding: 7px 10px;
  border-radius: 14px;
  border: 1px solid rgba(128, 128, 128, 0.35);
  background: var(--bg-color);
  color: var(--text-color);
  font-size: 14px;
  cursor: pointer;
}

/* ===== 棋盘通用 ===== */
.g-board-wrap {
  position: relative;
  margin: 0 auto;
}

.g-board {
  display: grid;
  gap: 4px;
  width: 100%;
  /* 牌面可读性：520 → 620（8 列格 61px → 74px），用户反馈过小图伤眼 */
  max-width: min(94vw, 620px);
  margin: 0 auto;
  position: relative; /* 得分气泡 / 连击横幅 / 连线层的定位基准 */
}

/* 消消乐格子：棋盘网格单元，宝石元素填充其内 */
.g-m3-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
}

.g-tile {
  position: relative;
  border: none;
  padding: 0;
  background: rgba(128, 128, 128, 0.12);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1 / 1;
  transition: transform 0.12s, box-shadow 0.12s;
}

.g-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none; /* 点击始终落在 tile 上，不与图片交互 */
}

.g-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 3px 10px var(--shadow-color);
}

.g-tile.selected {
  outline: 3px solid var(--primary-color);
  outline-offset: -3px;
  transform: scale(0.94);
}

.g-tile.hint-pulse {
  animation: gHintPulse 0.6s ease-in-out 3;
}

@keyframes gHintPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(77, 107, 254, 0); }
  50% { box-shadow: 0 0 0 4px rgba(77, 107, 254, 0.85); }
}

.g-tile.empty {
  background: transparent;
  cursor: default;
  pointer-events: none;
}

.g-tile.removing {
  animation: gTileOut 0.32s ease-in forwards;
  pointer-events: none;
}

@keyframes gTileOut {
  40% { transform: scale(1.12); }
  100% { transform: scale(0); opacity: 0; }
}

/* ===== 连连看连线层 ===== */
.g-llk-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
  overflow: visible; /* 外圈通道的连线超出 svg 矩形，也要画出来 */
}

.g-llk-lines polyline {
  fill: none;
  stroke: #4d6bfe;
  stroke-width: 0.14;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 0.1px rgba(77, 107, 254, 0.6));
  animation: gLineFade 0.4s ease-out forwards;
}

@keyframes gLineFade {
  0% { opacity: 0; }
  25% { opacity: 1; }
  100% { opacity: 0; }
}

/* ===== 翻牌记忆 ===== */
.g-card {
  position: relative;
  border: none;
  padding: 0;
  background: none;
  cursor: pointer;
  aspect-ratio: 1 / 1;
  perspective: 600px;
  min-height: 0; /* 同 .gp-item：防 grid 内容最小尺寸撑破 1:1 */
  min-width: 0;
}

.g-card-inner {
  /* 绝对定位锚满卡牌：button 内 height:100% 百分比链不可靠，与 .gp-item img 同理 */
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform 0.4s;
  border-radius: 8px;
}

.g-card.flipped .g-card-inner,
.g-card.matched .g-card-inner {
  transform: rotateY(180deg);
}

.g-card-face {
  position: absolute;
  inset: 0;
  border-radius: 8px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 牌背：品牌蓝 + 鲸 emoji，四张脸里唯一不用图片的面 */
.g-card-back {
  background: var(--primary-color);
  color: #fff;
  font-size: clamp(18px, 5vw, 30px);
}

.g-card-front {
  transform: rotateY(180deg);
  background: rgba(128, 128, 128, 0.1);
}

.g-card-front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.g-card.matched {
  cursor: default;
}

.g-card.matched .g-card-front {
  outline: 3px solid rgba(46, 160, 67, 0.9);
  outline-offset: -3px;
}

.g-card.matched .g-card-inner {
  animation: gMatched 0.5s ease;
}

@keyframes gMatched {
  0%, 100% { transform: rotateY(180deg) scale(1); }
  50% { transform: rotateY(180deg) scale(1.08); }
}

/* ===== 消消乐 ===== */
.g-m3-board {
  gap: 3px;
  touch-action: manipulation; /* 阻止双击缩放干扰连点 */
}

.gem {
  position: relative;
  width: 100%;
  height: 100%;
}

.gem img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.gem.selected {
  transform: scale(0.88);
  outline: 3px solid #fff;
  outline-offset: -3px;
  border-radius: 8px;
}

/* 特殊牌角标：图片牌面没有宝石那种整块变色，用角标区分 */
.gem-badge {
  position: absolute;
  right: 1px;
  bottom: 1px;
  min-width: 16px;
  height: 16px;
  padding: 0 2px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 11px;
  line-height: 16px;
  text-align: center;
}

/* 彩虹牌：不吃图片，渐变底 + 🌈，全色通吃 */
.gem.rainbow-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(18px, 6vw, 30px);
  background: conic-gradient(#ff6b6b, #ffd93d, #6bcb77, #4d96ff, #9b5de5, #ff6b6b);
  border-radius: 8px;
}

.gem.gem-matched {
  animation: gGemHit 0.32s ease-in forwards;
}

@keyframes gGemHit {
  0% { transform: scale(1); }
  40% { transform: scale(1.15); filter: brightness(1.4); }
  100% { transform: scale(0); opacity: 0; }
}

.gem.gem-invalid {
  animation: gGemShake 0.35s ease;
}

@keyframes gGemShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8%); }
  75% { transform: translateX(8%); }
}

.gem.gem-new {
  animation: gGemDrop 0.32s ease-out;
}

@keyframes gGemDrop {
  0% { transform: translateY(-60%); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.gem.gem-hint {
  animation: gHintPulse 0.6s ease-in-out 3;
}

/* 得分气泡 */
.score-bubble {
  position: absolute;
  z-index: 6;
  color: var(--primary-color);
  font-size: 14px;
  font-weight: 700;
  pointer-events: none;
  animation: gBubbleUp 0.95s ease-out forwards;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

body.dark .score-bubble {
  color: #8fa6ff;
  text-shadow: none;
}

@keyframes gBubbleUp {
  0% { transform: translateY(0); opacity: 0; }
  25% { opacity: 1; }
  100% { transform: translateY(-34px); opacity: 0; }
}

/* 连击横幅 */
.combo-banner {
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 7;
  padding: 6px 18px;
  border-radius: 18px;
  background: rgba(77, 107, 254, 0.92);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  pointer-events: none;
  animation: gComboIn 0.85s ease-out forwards;
}

@keyframes gComboIn {
  0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0; }
  30% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

/* ===== 结算浮层（game-common 动态生成 #gj-overlay） ===== */
.g-overlay {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  padding: 20px;
}

.g-overlay.visible {
  display: flex;
}

.g-box {
  background: var(--bg-color);
  color: var(--text-color);
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  padding: 26px 28px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  animation: gBoxIn 0.25s ease-out;
}

@keyframes gBoxIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.g-box h3 {
  margin: 0 0 12px;
  font-size: 22px;
}

.g-box h3.win {
  color: #2ea043;
}

.g-box h3.lose {
  color: #e5484d;
}

.g-box .g-lines {
  margin: 0 0 18px;
  font-size: 15px;
  line-height: 1.9;
}

.g-box .g-lines .record {
  color: #e5484d;
  font-weight: 700;
}

.g-box .g-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== 加载态 / 出错态 ===== */
.g-state {
  text-align: center;
  padding: 48px 0;
  color: var(--text-color);
  font-size: 15px;
}

.g-state::before {
  content: "";
  display: block;
  margin: 0 auto 14px;
  border: 4px solid var(--primary-color);
  border-top-color: transparent;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  animation: spin 1s linear infinite; /* spin 关键帧来自 styles.css */
}

.g-state.error::before {
  display: none;
}

.g-state .g-retry-link {
  color: var(--primary-color);
  cursor: pointer;
  text-decoration: underline;
}

/* ===== Toast ===== */
.g-toast {
  position: fixed;
  left: 50%;
  bottom: 10vh;
  transform: translateX(-50%);
  z-index: 2000;
  max-width: 86vw;
  padding: 10px 20px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 14px;
  text-align: center;
  animation: gToastIn 0.25s ease-out;
}

@keyframes gToastIn {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ===== 合集页（/games） ===== */
/* 2026-09-22 拉宽：1280 容器 + auto-fill ≥248px，宽屏 4 列 / 平板 3 列 / 手机 1 列 */
.games-hub .game-main {
  max-width: 1280px;
}

.hub-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 16px;
  width: 100%; /* styles.css 的 main{align-items:center} 会让子块 shrink-to-fit，auto-fill 必须铺满容器才按容器宽算列数 */
  box-sizing: border-box;
}

/* 副标题下的工具条：静音提示 + 换一批 */
.hub-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -2px 0 18px;
  width: 100%;
  box-sizing: border-box;
}

.hub-hint {
  font-size: 12.5px;
  opacity: 0.6;
}

#hub-shuffle {
  padding: 7px 14px;
  font-size: 13px;
}

/* 老板键按钮（公文包图标，样式沿用主题/音量图标的反色待遇） */
#gj-boss img {
  width: 20px;
  height: 20px;
}

.hub-card {
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-color);
  /* 2026-09-22 实体感：顶部内高光 + 极淡描边 */
  border: 1px solid rgba(30, 42, 80, 0.09);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 2px 12px rgba(23, 35, 80, 0.08);
  text-decoration: none;
  color: var(--text-color);
  transition: transform 0.15s, box-shadow 0.15s;
}

body.dark .hub-card {
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 2px 12px rgba(0, 0, 0, 0.4);
}

.hub-card:hover {
  transform: translateY(-3px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 8px 24px rgba(23, 35, 80, 0.16);
}

.hub-card .hc-thumbs {
  display: flex;
  height: 88px;
  background: rgba(77, 107, 254, 0.1);
}

.hub-card .hc-thumbs span {
  flex: 1;
  overflow: hidden;
}

.hub-card .hc-thumbs img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

/* 悬停轻微放大 = 整卡「游乐园橱窗」感（整卡本就是 <a>，全卡可点） */
.hub-card:hover .hc-thumbs img {
  transform: scale(1.06);
}

.hub-card .hc-body {
  padding: 11px 13px 13px;
}

.hub-card h2,
.hub-card h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

/* 徽章 + 历史最佳一行：帮选择、给重玩动力 */
.hub-card .hc-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 20px;
  margin: 0 0 6px;
}

.hc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.hc-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(77, 107, 254, 0.08);
  color: var(--primary-color);
  white-space: nowrap;
}

body.dark .hc-tag {
  background: rgba(93, 121, 255, 0.16);
}

.hc-best {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-color);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.hub-card p {
  margin: 0 0 10px;
  font-size: 12.5px;
  line-height: 1.5;
  opacity: 0.75;
}

.hub-card .g-btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border-radius: 14px;
  padding: 5px 14px;
  font-size: 12.5px;
}

.hub-card .g-btn b {
  font-weight: 700;
}

.hub-footer-link {
  text-align: center;
  margin-top: 26px;
}

.hub-footer-link a {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 14px;
}

/* ===== 老板键伪装屏（乐园页彩蛋：Esc / 点按钮进入，Esc / 点屏幕退出） ===== */
#boss-screen {
  position: fixed;
  inset: 0;
  z-index: 4000;
  background: #0f6cbd; /* Windows 更新蓝 */
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 24px;
  text-align: center;
}

#boss-screen[hidden] {
  display: none;
}

#boss-screen h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 0.5px;
}

#boss-screen p {
  margin: 0;
  font-size: 15px;
  opacity: 0.9;
}

.bs-dots {
  position: relative;
  width: 60px;
  height: 60px;
}

.bs-dots i {
  position: absolute;
  inset: 0;
  animation: bsSpin 1.8s cubic-bezier(0.55, 0.15, 0.45, 0.85) infinite;
}

.bs-dots i::after {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  border-radius: 50%;
  background: #fff;
}

.bs-dots i:nth-child(2) { animation-delay: 0.15s; }
.bs-dots i:nth-child(3) { animation-delay: 0.3s; }
.bs-dots i:nth-child(4) { animation-delay: 0.45s; }
.bs-dots i:nth-child(5) { animation-delay: 0.6s; }
.bs-dots i:nth-child(6) { animation-delay: 0.75s; }

@keyframes bsSpin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .bs-dots i { animation: none; }
}

/* ===== 十五拼图 ===== */
/* 棋盘覆盖 .g-board 的 grid 布局：拼图块绝对定位，靠 transform 平移产生滑动动画 */
.g-puzzle-board {
  display: block;
  background: rgba(128, 128, 128, 0.12);
  border-radius: 10px;
  aspect-ratio: 1 / 1;
}

.g-ptile {
  position: absolute;
  top: 0;
  left: 0;
  box-sizing: border-box;
  border: 2px solid var(--bg-color); /* 缝隙感：边框用页面底色 */
  border-radius: 8px;
  background-repeat: no-repeat;
  padding: 0;
  cursor: pointer;
  transition: transform 0.16s ease;
  overflow: hidden;
}

.g-ptile:hover {
  filter: brightness(1.08);
}

/* 打乱定位期间禁用滑动动画：块瞬移到位，否则开局会整盘“飞”一次 */
.g-puzzle-board.scrambling .g-ptile {
  transition: none;
}

.g-p-num {
  display: inline-block;
  margin: 3px;
  padding: 0 5px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 11px;
  line-height: 16px;
}

.g-ptile.correct .g-p-num {
  background: #2ea043;
}

.g-puzzle-ref {
  text-align: center;
  margin: 0 0 10px;
  font-size: 12px;
  opacity: 0.75;
  cursor: pointer; /* 参考图本身也是选图入口 */
}

/* ===== 选图器（十五拼图） ===== */
.g-picker {
  position: fixed;
  inset: 0;
  z-index: 1600;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  padding: 16px;
}

.g-picker.open {
  display: flex;
}

.gp-box {
  background: var(--bg-color);
  color: var(--text-color);
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  width: min(92vw, 560px);
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: gBoxIn 0.25s ease-out;
}

.gp-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  font-weight: 700;
  border-bottom: 1px solid rgba(128, 128, 128, 0.2);
}

.gp-close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: var(--text-color);
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 6px;
}

.gp-close:hover {
  background: rgba(128, 128, 128, 0.15);
}

.gp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  /* 行高兜底：gp-box 是 max-height 受限的 flex 列容器，Chromium 对这种容器内
     overflow-y:auto 的 grid 不把 aspect-ratio 传输高度计入 auto 行，行会塌成
     边框高（~4px）导致图片整片层叠；min 92px 与列 minmax 对称，保证格子至少正方 */
  grid-auto-rows: minmax(92px, auto);
  gap: 8px;
  padding: 12px;
  overflow-y: auto;
}

.gp-item {
  position: relative;
  border: 2px solid transparent;
  border-radius: 10px;
  overflow: hidden;
  padding: 0;
  background: rgba(128, 128, 128, 0.1);
  cursor: pointer;
  aspect-ratio: 1 / 1;
  /* grid 子项默认 min-height:auto 会被内容撑高，显式放开才能保住 1:1 */
  min-height: 0;
  min-width: 0;
}

.gp-item img {
  /* 绝对定位脱离内容流：button 内部百分比高度解析不可靠（height:100% 失效回退
     原图自然高度，长图会把格子撑成长条），锚定格子四边 + cover 裁切才稳定 */
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gp-item:hover {
  border-color: rgba(77, 107, 254, 0.5);
}

.gp-item.current {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(77, 107, 254, 0.35);
}

/* ===== 游戏页页脚（轻量文字版，不用首页的色带页脚） ===== */

.g-puzzle-ref img {
  display: block;
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  margin: 4px auto 0;
}

/* ===== 游戏页页脚（轻量文字版，不用首页的色带页脚） ===== */
.game-footer {
  width: 100%; /* body 是 align-items:center 的 flex 列，不铺满会缩成内容宽 */
  margin-top: auto; /* 内容不足一屏时贴底，避免页脚下方留大白 */
  padding: 14px 10px 20px;
  text-align: center;
  font-size: 12px;
  opacity: 0.65;
  box-sizing: border-box;
}

.game-footer a {
  color: var(--text-color);
}

body.dark .game-footer a {
  color: #8fa6ff;
}

/* ===== 深色模式补丁（大部分由变量自动覆盖，这里处理写死的浅色） ===== */
body.dark .hud-chip {
  background: rgba(255, 255, 255, 0.08);
}

body.dark .g-card-front {
  background: rgba(255, 255, 255, 0.06);
}

body.dark .g-select {
  background: #2d2d2d;
}

@media (max-width: 480px) {
  .game-main {
    padding: 14px 10px 32px;
  }

  .g-board {
    gap: 3px;
  }

  .hud-chip {
    padding: 4px 10px;
    font-size: 12px;
  }
}

/* ===== 拼豆图纸（/games/beads） ===== */
.beads-canvas {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 8px;
  box-shadow: 0 2px 10px var(--shadow-color);
  /* 竖向手势留给页面滚动（移动端画布很高），点按/横向拖动改色 */
  touch-action: pan-y;
  cursor: crosshair;
}

.beads-tools {
  display: flex;
  gap: 8px;
  margin: 14px 0 4px;
  align-items: flex-start;
}

.bt-eraser {
  flex: none;
  padding: 0 12px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(128, 128, 128, 0.4);
  background: var(--bg-color);
  color: var(--text-color);
  cursor: pointer;
  font-size: 13px;
}

.bt-eraser.sel,
.bt-swatch.sel {
  outline: 2px solid var(--primary-color);
  outline-offset: 1px;
}

.bt-strip {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  overflow-x: auto;
  padding: 2px;
  flex: 1;
  min-width: 0;
}

.bt-swatch {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  cursor: pointer;
  padding: 0;
}

.bt-swatch:hover {
  transform: scale(1.12);
}

.beads-tip {
  font-size: 12px;
  opacity: 0.7;
  margin: 2px 0 10px;
}

.beads-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
  max-height: 118px;
  overflow-y: auto;
}

.bc-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  padding: 2px 8px 2px 3px;
  border-radius: 20px;
  background: rgba(128, 128, 128, 0.1);
}

.bc-chip i {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.bc-chip b {
  font-weight: 600;
  opacity: 0.8;
}

body.dark .bc-chip {
  background: rgba(255, 255, 255, 0.08);
}

body.dark .bt-eraser {
  background: #2d2d2d;
}

/* ===== 鲸了个鲸（叠层三消 /games/stack） ===== */
.wh-board {
  position: relative;
  width: min(94vw, 560px); /* 460 → 560：单卡 71px → 86px，牌面更易辨认 */
  margin: 0 auto;
  background: rgba(128, 128, 128, 0.12);
  border-radius: 12px;
}

.wh-tile {
  position: absolute;
  border: none;
  padding: 0;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  background-color: rgba(128, 128, 128, 0.3);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: transform 0.12s, filter 0.15s, opacity 0.2s;
}

/* 被上层压住：压暗且禁点 */
.wh-tile.blocked {
  filter: brightness(0.5) saturate(0.6);
  cursor: default;
}

.wh-tile:not(.blocked):hover {
  transform: scale(1.07);
}

/* 点进卡槽：缩小退场 */
.wh-tile.picked {
  transform: scale(0.2);
  opacity: 0;
  pointer-events: none;
}

.wh-hold {
  display: none;
  justify-content: center;
  align-items: center;
  gap: 4px;
  margin: 10px auto 0;
  width: min(94vw, 560px);
}

.wh-hold.show {
  display: flex;
}

.wh-hold-label {
  font-size: 12px;
  opacity: 0.7;
  margin-right: 6px;
  white-space: nowrap;
}

.wh-hold .wh-chip {
  flex: none;
  width: 46px;
  max-width: 46px;
}

.wh-slot {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin: 12px auto 0;
  padding: 8px;
  width: min(94vw, 560px);
  box-sizing: border-box;
  background: rgba(128, 128, 128, 0.15);
  border-radius: 12px;
  min-height: 64px;
}

.wh-slot.full {
  outline: 2px solid #e5484d;
}

.wh-cell {
  flex: 1;
  max-width: 64px;
  aspect-ratio: 1;
  border-radius: 8px;
  background: rgba(128, 128, 128, 0.12);
}

.wh-chip {
  flex: 1;
  max-width: 64px;
  aspect-ratio: 1;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  animation: whIn 0.18s ease-out;
}

.wh-chip.clearing {
  animation: whClear 0.26s ease-in forwards;
}

@keyframes whIn {
  from {
    transform: translateY(14px) scale(0.6);
    opacity: 0;
  }
}

@keyframes whClear {
  to {
    transform: scale(0);
    opacity: 0;
  }
}

/* ===== 桌宠（/games/pet）===== */
/* 宠物本体渲染样式（#pet-root/.pet-video/.pet-hit/.pet-bubble/Q 弹）由 public/deskpet.js 注入，双页共用；
   这里只放页面级样式：主区留白、点播面板、降级说明、署名、合集页卡片缩略 */

/* 页面侧：提示 / 点播面板 / 降级说明 / 署名 */
.pet-main {
  max-width: 640px;
  padding-bottom: 40vh; /* 给贴地行走的宠物留出视觉空间 */
}

.pet-hint {
  font-size: 13px;
  opacity: 0.65;
  margin: 4px 0 22px;
}

.pet-picker-label {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.8;
  margin: 0 0 8px;
}

.pet-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pet-chip {
  border: 1px solid var(--shadow-color);
  border-radius: 999px;
  background: var(--bg-color);
  color: var(--text-color);
  font-size: 13px;
  padding: 6px 14px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}

.pet-chip:hover {
  transform: translateY(-2px);
  background: rgba(77, 107, 254, 0.12);
}

/* 分类随机按钮与招牌动作区分开一层视觉 */
.pet-chip.cat {
  background: rgba(77, 107, 254, 0.1);
  border-color: rgba(77, 107, 254, 0.35);
}

.pet-unsupported {
  padding: 14px 16px;
  border-radius: 10px;
  background: rgba(255, 165, 0, 0.1);
  border: 1px solid rgba(255, 165, 0, 0.35);
  font-size: 14px;
  line-height: 1.6;
}

.pet-credit {
  font-size: 12px;
  opacity: 0.55;
  line-height: 1.7;
  margin-top: 26px;
}

.pet-credit a {
  color: var(--primary-color);
  margin-left: 6px;
}

/* 合集页桌宠卡缩略：不用表情包图池，鲸鱼渐变 + emoji 自成一格 */
.hub-card .hc-thumbs.pet-card-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  background: linear-gradient(135deg, rgba(77, 107, 254, 0.16), rgba(126, 217, 255, 0.22));
}

.hub-card .hc-thumbs.pet-card-thumb span {
  animation: petBob 2.6s ease-in-out infinite;
}

@keyframes petBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ===== 吃白饭之王（/games/battle：表情包 1v1 对决） ===== */

/* 视图切换：setup / battle / rank 三屏互斥 */
.bt-screen { display: none; }
.bt-screen.on { display: block; }

/* ---- 选人屏 ---- */
.bt-pools {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 14px 0 20px;
}

.bt-pool {
  border: 2px solid var(--shadow-color);
  border-radius: 14px;
  background: var(--bg-color);
  color: var(--text-color);
  padding: 14px 12px;
  cursor: pointer;
  text-align: center;
  font: inherit;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.bt-pool:hover { transform: translateY(-2px); background: rgba(77, 107, 254, 0.08); }

.bt-pool.on {
  border-color: var(--primary-color);
  background: rgba(77, 107, 254, 0.12);
}

.bt-pool-name { font-size: 15px; font-weight: 700; }
.bt-pool-count { font-size: 13px; opacity: 0.62; margin-top: 4px; }

.bt-label { font-size: 14px; font-weight: 700; margin: 4px 0 8px; }

.bt-sizes { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }

.bt-size {
  border: 1px solid var(--shadow-color);
  border-radius: 999px;
  background: var(--bg-color);
  color: var(--text-color);
  font-size: 13px;
  padding: 7px 16px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.bt-size:hover { background: rgba(77, 107, 254, 0.1); }

.bt-size.on {
  border-color: var(--primary-color);
  background: rgba(77, 107, 254, 0.16);
  font-weight: 700;
}

.bt-start-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ---- 对决屏 ---- */
.bt-toolbar {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin: 14px 0 6px;
}

.bt-round { font-size: 20px; font-weight: 800; }
.bt-matchinfo { font-size: 13px; opacity: 0.62; }
.bt-quit {
  margin-left: auto;
  border: 1px solid var(--shadow-color);
  border-radius: 8px;
  background: var(--bg-color);
  color: var(--text-color);
  font-size: 13px;
  padding: 5px 12px;
  cursor: pointer;
}
.bt-quit:hover { background: rgba(77, 107, 254, 0.1); }

.bt-hint { font-size: 13px; opacity: 0.55; margin-bottom: 10px; }

.bt-arena {
  position: relative;
  display: flex;
  gap: 14px;
  align-items: stretch;
  justify-content: center;
}

.bt-card {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  max-width: 430px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--shadow-color);
  border-radius: 16px;
  background: var(--bg-color);
  color: var(--text-color);
  padding: 14px 14px 12px;
  cursor: pointer;
  font: inherit;
  transition: transform 0.16s ease, border-color 0.16s ease, opacity 0.16s ease;
}

.bt-card:hover { transform: translateY(-3px); border-color: rgba(77, 107, 254, 0.55); }

.bt-card img {
  max-width: 100%;
  max-height: min(44vh, 380px);
  object-fit: contain;
  border-radius: 10px;
  background: rgba(77, 107, 254, 0.06);
  pointer-events: none; /* 图片点击穿透到卡片按钮，alt 文字可选中 */
}

.bt-alt {
  font-size: 13px;
  line-height: 1.5;
  opacity: 0.82;
  text-align: center;
  max-height: 3em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.bt-num {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 12px;
  text-decoration: none;
  color: var(--text-color);
  background: rgba(127, 127, 127, 0.16);
  border-radius: 6px;
  padding: 2px 8px;
  z-index: 2;
}
.bt-num:hover { background: rgba(77, 107, 254, 0.3); }

/* 胜负定格：胜者描边顶起，败者缩小褪色，弹签盖在卡上 */
.bt-card.win { border-color: #f5a623; transform: translateY(-4px) scale(1.02); }
.bt-card.lose { opacity: 0.45; transform: scale(0.96); pointer-events: none; }
.bt-card.locked { pointer-events: none; }

.bt-tag {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  font-size: 14px;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: 999px;
  color: #fff;
  animation: btTagPop 0.28s ease;
}

.bt-tag.win { background: #f5a623; box-shadow: 0 2px 10px rgba(245, 166, 35, 0.55); }
.bt-tag.lose { background: #8a93a6; }

@keyframes btTagPop {
  0% { transform: scale(0.4); opacity: 0; }
  70% { transform: scale(1.12); }
  100% { transform: scale(1); opacity: 1; }
}

/* VS 徽标：居中骑在双卡之间，窄屏退化为上下夹层 */
.bt-vs {
  align-self: center;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--primary-color);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.5px;
  box-shadow: 0 3px 12px var(--shadow-color);
  user-select: none;
}

/* ---- 全站榜 ---- */
.bt-rank-meta { font-size: 13px; opacity: 0.65; margin: 10px 0 14px; }

.bt-rank-list { display: flex; flex-direction: column; gap: 8px; }

.bt-rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--shadow-color);
  border-radius: 12px;
  background: var(--bg-color);
  padding: 8px 12px;
  text-decoration: none;
  color: var(--text-color);
}
.bt-rank-row:hover { background: rgba(77, 107, 254, 0.07); }

/* 自己投出的冠军行 */
.bt-rank-row.mine {
  border-color: rgba(245, 166, 35, 0.7);
  background: rgba(245, 166, 35, 0.08);
}

.bt-rank-num {
  flex: 0 0 34px;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  opacity: 0.75;
}

.bt-rank-row:nth-child(1) .bt-rank-num { color: #f5a623; }
.bt-rank-row:nth-child(2) .bt-rank-num { color: #9aa7bd; }
.bt-rank-row:nth-child(3) .bt-rank-num { color: #c98a5e; }

.bt-rank-row img {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(77, 107, 254, 0.06);
}

.bt-rank-main { flex: 1 1 auto; min-width: 0; }

.bt-rank-alt {
  font-size: 13px;
  line-height: 1.45;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.bt-rank-mine-tag { font-size: 11px; color: #f5a623; font-weight: 700; margin-top: 2px; }

.bt-rank-stats {
  flex: 0 0 auto;
  display: flex;
  gap: 10px;
  font-size: 12px;
  opacity: 0.8;
  text-align: right;
  white-space: nowrap;
}

.bt-rank-stats b { display: block; font-size: 14px; }

/* ---- 窄屏：双卡竖排，VS 夹中间 ---- */
@media (max-width: 640px) {
  .bt-arena { flex-direction: column; align-items: stretch; }
  .bt-card { max-width: none; }
  .bt-card img { max-height: min(30vh, 260px); }
  .bt-vs { align-self: center; }
  .bt-rank-stats { flex-direction: column; gap: 0; text-align: left; }
  .bt-rank-stats b { display: inline; font-size: 12px; }
}

/* ---- 对阵图（双翼轮次列向中央决赛收敛；舞台底板 + 金色冠军之路 + 中央光柱决赛，连接线几何依赖 .bt-match 列内均分） ---- */
.bt-bhead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.bt-bhead-main h3 { margin: 0; font-size: 17px; }
#bt-bchamp { color: #b57300; font-weight: 700; }
body.dark #bt-bchamp { color: #ffd262; }
.bt-bbtns { display: flex; gap: 8px; flex-wrap: wrap; }

/* 滚动区 breakout 出 .game-main 的 700px 限宽，宽屏尽量一眼看全对阵 */
.bt-fit {
  overflow-x: auto;
  padding-bottom: 10px;
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  box-sizing: border-box;
  display: flex;
  justify-content: safe center; /* 树比视口宽时改靠左对齐，保证左翼滚得到 */
}
/* 舞台底板：暖纸/深夜蓝 + 细点阵纹理 + 中央金色微光 */
.bt-tree {
  flex: 0 0 auto;
  width: max-content; /* 列宽恒定，不随视口拉伸（拉伸会把 cell 撑得过宽） */
  margin: 0 auto;
  display: flex;
  align-items: stretch;
  gap: 28px;
  padding: 22px 26px 24px;
  border-radius: 18px;
  position: relative;
  background:
    radial-gradient(52% 64% at 50% 40%, rgba(245, 166, 35, 0.08), transparent 72%),
    radial-gradient(rgba(127, 127, 127, 0.16) 1px, transparent 1.4px),
    var(--bt-stage, #f8f6f0);
  background-size: auto, 22px 22px, auto;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 10px 34px rgba(15, 18, 30, 0.10);
}
body.dark .bt-tree {
  --bt-stage: #151a29;
  border-color: rgba(255, 255, 255, 0.07);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.42);
}
/* 列入场动效：左翼 → 中央 → 右翼依次浮现（--i 由 JS 按列序赋值） */
.bt-tree > * {
  animation: bt-in 0.5s cubic-bezier(0.2, 0.8, 0.3, 1) both;
  animation-delay: calc(var(--i, 0) * 70ms);
}

.bt-round { flex: 1; display: flex; flex-direction: column; min-width: 184px; }
.bt-round-label {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-align: center;
  padding: 3px 14px;
  margin: 0 auto 8px;
  border-radius: 999px;
  color: var(--bt-round-label, #5c6474);
  background: rgba(127, 127, 127, 0.14);
  white-space: nowrap;
  width: max-content;
}
body.dark .bt-round-label { --bt-round-label: #97a1b6; }
.bt-round-matches { flex: 1; display: flex; flex-direction: column; }

/* 场 = 两个 slot 上下；列内均分高度（连线几何的前提） */
.bt-match {
  flex: 1;
  min-height: 42px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

/* 连接线：输出短横（::after，从场边缘到列间中线）+ 汇入竖线（::before，中线处跨子场中心） */
.bt-match.has-line::after {
  content: "";
  position: absolute;
  right: -14px;
  top: 50%;
  width: 14px;
  border-top: 2px solid var(--bt-line, rgba(127, 127, 127, 0.4));
}
.bt-match.has-line::before {
  content: "";
  position: absolute;
  right: -15px;
  top: 25%;
  height: 50%;
  border-right: 2px solid var(--bt-line, rgba(127, 127, 127, 0.4));
}
body.dark .bt-match.has-line::after,
body.dark .bt-match.has-line::before {
  --bt-line: rgba(148, 158, 178, 0.26);
}
/* 右翼镜像（.bt-center 之后的轮次列） */
.bt-center ~ .bt-round .bt-match.has-line::after {
  right: auto;
  left: -14px;
}
.bt-center ~ .bt-round .bt-match.has-line::before {
  right: auto;
  left: -15px;
  border-right: none;
  border-left: 2px solid var(--bt-line, rgba(127, 127, 127, 0.4));
}
/* 冠军路径：金色加粗 + 光晕 */
.bt-match.has-path::after {
  border-top-color: #f5a623;
  border-top-width: 3px;
  filter: drop-shadow(0 0 3px rgba(245, 166, 35, 0.55));
}
.bt-match.has-path::before {
  border-right-color: #f5a623;
  border-right-width: 3px;
  filter: drop-shadow(0 0 3px rgba(245, 166, 35, 0.55));
}
.bt-center ~ .bt-round .bt-match.has-path::before {
  border-right-color: transparent;
  border-left-color: #f5a623;
  border-left-width: 3px;
}

.bt-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--bt-cell-line, rgba(0, 0, 0, 0.12));
  border-radius: 10px;
  background: var(--bt-cell-bg, #ffffff);
  color: var(--text-color);
  padding: 4px 10px 4px 5px;
  min-height: 38px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(15, 18, 30, 0.07);
}
body.dark .bt-cell {
  --bt-cell-bg: #1d2437;
  --bt-cell-line: #2c3650;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.bt-cell img {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  object-fit: contain;
  border-radius: 6px;
  background: rgba(77, 107, 254, 0.08);
}
.bt-cell-t {
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.88;
  max-width: 140px; /* nowrap 文本必须定宽截断，否则会撑破列宽 */
}
.bt-cell.is-loser { opacity: 0.35; filter: grayscale(0.75); }
.bt-cell.on-path {
  border-color: rgba(245, 166, 35, 0.9);
  background: var(--bt-cell-path, rgba(245, 166, 35, 0.1));
  box-shadow: 0 0 0 1px rgba(245, 166, 35, 0.3), 0 3px 16px rgba(245, 166, 35, 0.2);
}
body.dark .bt-cell.on-path { --bt-cell-path: rgba(245, 166, 35, 0.13); }
.bt-cell.on-path .bt-cell-t { color: #9a6b00; font-weight: 700; opacity: 1; }
body.dark .bt-cell.on-path .bt-cell-t { color: #ffd98a; }

/* 中央列：金色光柱（全高渐变收束视线）+ 决赛并排 + 冠军 hero */
.bt-center {
  flex: 0 0 320px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 14px 12px 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(245, 166, 35, 0.05), rgba(245, 166, 35, 0.14) 45%, rgba(245, 166, 35, 0.14) 60%, rgba(245, 166, 35, 0.05));
  border-left: 1px solid rgba(245, 166, 35, 0.22);
  border-right: 1px solid rgba(245, 166, 35, 0.22);
}
.bt-center .bt-round-label {
  background: linear-gradient(135deg, #ffd25e, #f5a623);
  color: #fff;
  text-shadow: 0 1px 2px rgba(140, 84, 0, 0.35);
  box-shadow: 0 2px 10px rgba(245, 166, 35, 0.45);
  margin-bottom: 10px;
}
/* 决赛双卡左右并排（两卡中缝即两侧半决赛汇入点） */
.bt-center .bt-final { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bt-center .bt-match { flex: 0 0 auto; }
.bt-center .bt-cell { background: var(--bt-center-cell, #fff); }
body.dark .bt-center .bt-cell { --bt-center-cell: #232c44; }
.bt-center .bt-cell img { flex-basis: 36px; width: 36px; height: 36px; }
.bt-center .bt-cell-t { max-width: none; min-width: 0; flex: 1 1 0; }

/* 冠军 hero：旋转光芒 + 呼吸光晕 + 浮动皇冠 + 流光徽章 + 米饭彩纸 */
.bt-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  margin-top: 20px;
  padding: 18px 12px 16px;
  text-align: center;
  border-radius: 16px;
  background: rgba(245, 166, 35, 0.07);
  border: 1px solid rgba(245, 166, 35, 0.25);
  animation: bt-pop 0.6s cubic-bezier(0.2, 1.4, 0.4, 1) both;
  animation-delay: calc(var(--i, 0) * 70ms + 120ms);
}
.bt-hero-img { position: relative; width: 168px; height: 168px; }
.bt-hero-img::before {
  content: "";
  position: absolute;
  inset: -46px;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(245, 166, 35, 0.15) 0deg 6deg, transparent 6deg 18deg);
  -webkit-mask: radial-gradient(circle, #000 0%, transparent 68%);
  mask: radial-gradient(circle, #000 0%, transparent 68%);
  animation: bt-rays 26s linear infinite;
}
.bt-hero-img::after {
  content: "";
  position: absolute;
  inset: -18px;
  border-radius: 28px;
  background: radial-gradient(circle at 50% 50%, rgba(245, 166, 35, 0.3), transparent 70%);
  animation: bt-glow 2.8s ease-in-out infinite alternate;
}
.bt-hero-img img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border: 3px solid #f5a623;
  border-radius: 20px;
  background: rgba(77, 107, 254, 0.08);
  box-shadow: 0 0 0 5px rgba(245, 166, 35, 0.14), 0 10px 28px rgba(0, 0, 0, 0.3);
}
.bt-confetti {
  position: absolute;
  z-index: 2;
  font-size: 18px;
  opacity: 0.85;
  pointer-events: none;
  animation: bt-drift 3.4s ease-in-out infinite;
}
.bt-hero-crown {
  position: absolute;
  z-index: 2;
  top: -34px;
  right: -24px;
  font-size: 44px;
  transform: rotate(14deg);
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.3));
  animation: bt-float 2.6s ease-in-out infinite;
}
.bt-hero-badge {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #ffd25e, #f5a623);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 5px 16px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 3px 12px rgba(245, 166, 35, 0.5);
}
.bt-hero-badge::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40%;
  left: -60%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: skewX(-18deg);
  animation: bt-shine 3.2s ease-in-out infinite;
}
.bt-hero-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  max-height: 2.7em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.bt-hero-egg { font-size: 12px; opacity: 0.6; }

/* 对阵图动效 keyframes（prefers-reduced-motion 下全关） */
@keyframes bt-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes bt-pop {
  0% { opacity: 0; transform: scale(0.6); }
  70% { transform: scale(1.06); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes bt-rays { to { transform: rotate(1turn); } }
@keyframes bt-glow { from { opacity: 0.55; } to { opacity: 1; } }
@keyframes bt-float {
  0%, 100% { transform: translateY(0) rotate(14deg); }
  50% { transform: translateY(-5px) rotate(14deg); }
}
@keyframes bt-drift {
  0%, 100% { transform: translate(0, 0) rotate(-6deg); }
  50% { transform: translate(2px, -6px) rotate(8deg); }
}
@keyframes bt-shine {
  0%, 55% { left: -60%; }
  100% { left: 130%; }
}
@media (prefers-reduced-motion: reduce) {
  .bt-tree > *,
  .bt-hero,
  .bt-hero-img::before,
  .bt-hero-img::after,
  .bt-hero-crown,
  .bt-hero-badge::after,
  .bt-confetti {
    animation: none !important;
  }
}

@media (max-width: 700px) {
  .bt-tree { padding: 12px 14px 14px; gap: 18px; border-radius: 14px; }
  .bt-round { min-width: 150px; }
  .bt-cell img { flex-basis: 26px; width: 26px; height: 26px; }
  .bt-cell-t { max-width: 108px; }
  .bt-center { flex-basis: 240px; padding: 10px 8px 12px; }
  .bt-hero-img { width: 132px; height: 132px; }
}

.bt-report-line {
  font-size: 13px;
  opacity: 0.75;
  margin: 8px 0 0;
}
.bt-bactions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.bt-bactions .g-btn { flex: 1 1 180px; }

.bt-last-row { margin: 16px 0 0; }
.bt-last-row .g-btn.ghost { width: 100%; }

/* ===== 合成大鲸鱼（/games/merge）与鲸天大楼（/games/tower）共用的画布容器 ===== */
.mg-canvas,
.tw-canvas {
  display: block;
  width: 100%;
  max-width: min(94vw, 440px);
  aspect-ratio: 440 / 640;
  margin: 0 auto;
  border-radius: 16px;
  touch-action: none; /* 触屏点按即放球/放楼，禁掉滚动干扰 */
  box-shadow: 0 4px 18px var(--shadow-color);
  outline: none;
}
.mg-canvas:focus-visible,
.tw-canvas:focus-visible {
  box-shadow: 0 0 0 3px rgba(77, 107, 254, 0.45);
}

/* ===== 一锤一个大肥鱼（/games/whack）打地鼠 ===== */
.wk-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  width: 100%;
  max-width: min(94vw, 420px);
  margin: 0 auto;
  /* 锤子光标：锤头朝下正对落点（Safari 等不支持 SVG 光标时回落 pointer） */
  cursor: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='34' height='34' viewBox='0 0 34 34'><rect x='15' y='2' width='4' height='20' rx='2' fill='%23c88a4a' stroke='%236b4a12' stroke-width='1.5'/><rect x='7' y='20' width='20' height='11' rx='3' fill='%23e8b04b' stroke='%236b4a12' stroke-width='2'/></svg>") 17 31, pointer;
}

.wk-hole {
  position: relative;
  aspect-ratio: 1 / 1;
  border: none;
  padding: 0;
  border-radius: 18px;
  overflow: hidden;
  /* 洞口感：内凹径向渐变，深浅主题各自调 */
  background: radial-gradient(circle at 50% 30%, rgba(128, 128, 128, 0.22), rgba(128, 128, 128, 0.38));
  box-shadow: inset 0 6px 14px rgba(0, 0, 0, 0.28);
}

.wk-pop {
  position: absolute;
  inset: 8% 8% 0 8%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transform: translateY(105%);
  transition: transform 0.14s cubic-bezier(0.34, 1.4, 0.5, 1);
  will-change: transform;
}

.wk-pop.up { transform: translateY(6%); }
.wk-pop.down { transform: translateY(105%); transition: transform 0.12s ease-in; }

.wk-pop img {
  width: 100%;
  height: 88%;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
  transform-origin: 50% 100%;
  transition: transform 0.06s ease-out, filter 0.06s ease-out;
}

/* 命中一瞬：被锤扁 + 提亮，随退场动画一起掉回洞里 */
.wk-pop.bonk img {
  transform: scale(1.22, 0.55) translateY(14%);
  filter: brightness(1.25) saturate(1.15);
}

.wk-pop.golden img {
  outline: 3px solid #f5a623;
  outline-offset: -3px;
  filter: drop-shadow(0 0 8px rgba(245, 166, 35, 0.85));
}

/* 命中得分漂浮字 */
.wk-float {
  position: absolute;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  font-weight: 700;
  font-size: 20px;
  pointer-events: none;
  animation: wk-float-up 0.75s ease-out forwards;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  z-index: 3;
}

@keyframes wk-float-up {
  from { opacity: 1; translate: 0 0; }
  to { opacity: 0; translate: 0 -46px; }
}

/* ===== 一鲸绝尘（无尽跑酷 /games/runner） ===== */
/* 世界是 canvas；主角是叠在 canvas 上的透明 webm 视频（.rn-pet，双缓冲交叉淡化），
   定位由 game-runner.js 按逻辑坐标×scale 写 transform；Safari 降级时主角改画进 canvas */
.rn-wrap {
  position: relative;
  padding: 0;
}

.rn-canvas {
  display: block;
  width: 100%;
  max-width: min(94vw, 860px);
  aspect-ratio: 900 / 300;
  margin: 0 auto;
  border-radius: 16px;
  touch-action: none; /* 触屏点按即跳，禁掉滚动干扰 */
  box-shadow: 0 4px 18px var(--shadow-color);
  outline: none;
}

.rn-canvas:focus-visible {
  box-shadow: 0 0 0 3px rgba(77, 107, 254, 0.45);
}

.rn-pet {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none; /* 输入全部落在 canvas 上，主角纯渲染层 */
  will-change: transform;
  z-index: 2;
}

.rn-pet-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.rn-pet-video.is-front { opacity: 1; }

/* 里程碑（每 100 米）时分数弹一下 */
@keyframes rn-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.45); color: #f5a623; }
  100% { transform: scale(1); }
}

#hud-score.rn-pop {
  display: inline-block;
  animation: rn-pop 0.5s ease;
}

/* ===== 跳一鲸（蓄力跳台 /games/jump） ===== */
/* 纯 canvas 等距世界（2:1 投影），竖向 3:4 画布；蓄力条/连击/演出全在画布内，DOM 只有壳 */
.jp-wrap {
  position: relative;
  padding: 0;
}

.jp-canvas {
  display: block;
  width: 100%;
  max-width: min(94vw, 460px);
  aspect-ratio: 480 / 640;
  margin: 0 auto;
  border-radius: 16px;
  touch-action: none; /* 按住蓄力，禁掉滚动/长按菜单干扰 */
  box-shadow: 0 4px 18px var(--shadow-color);
  outline: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.jp-canvas:focus-visible {
  box-shadow: 0 0 0 3px rgba(77, 107, 254, 0.45);
}
