/* ★ hidden 属性在作者样式面前不设防：UA 那条 [hidden]{display:none}
     会被任何 display: 声明盖掉。本仓库已经吃过一次亏（2026-10-20 贪吃蛇的
     「幽灵按钮」）。所以第一行就写 !important，别删。
     ⚠️ 特别注意：下面 .overlay { display:flex } 和 .screen { display:flex }
        都会盖掉 UA 那条 —— 所以「结算面板隐藏时还挡着点击」就是这里来的。 */
[hidden] { display: none !important; }
/* JS 里用的是 classList.add('hidden')，所以这条也得有 */
.hidden { display: none !important; }

/* ★ 浅色系 —— 和另外四款游戏统一（HXT 2026-10-27 要求）。
 *
 * 本仓库已有的配色分工：
 *   合成 = 蜜黄 #EF9F27 · 消消乐 = 天蓝 #4a90d9 · 贪吃蛇 = 草绿 #7cc45a
 *   · 跳一跳 = 可可棕 #A9774C
 * 俄罗斯方块占**紫色**这一档（唯一没被占的那个），底色沿用全站的米色 #F7F4EE。
 *
 * ⚠️ 深色那版（--night:#232846）已经废弃。HXT 的原话是「深色一股 AI 感」——
 *   深蓝底 + 荧光黄确实是 AI 生成游戏的默认长相，和这个站的手作气质不搭。 */
:root {
  --ink: #2C2C2A;
  --ink2: #5F5E5A;
  --ink3: #8A8880;
  --bg: #F7F4EE;
  --card: #FFFFFF;
  --line: #E7E2D6;

  /* 本作主色：紫 */
  --violet: #7B6BC4;
  --violet-d: #5E4CA0;
  --violet-tint: #EFEBFA;

  /* 沿用全站的蜜黄做强调（和跳一跳同一支） */
  --honey: #EF9F27;
  --honey-d: #BA7517;
  --honey-tint: #FDF3E2;

  /* 棋盘：浅紫底 + 略深的格子线 */
  --board-bg: #F2EEFB;
  --board-bg2: #E8E2F7;
  --board-line: rgba(123, 107, 196, 0.16);
  --board-frame: rgba(123, 107, 196, 0.34);

  --r: 18px;
  --pad: 10px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
    "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
  /* ★ 棋盘上要滑动/点按，别让浏览器当成滚动 */
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.app {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 8px
           calc(env(safe-area-inset-bottom, 0px) + 8px);
}

.screen {
  width: 100%;
  max-width: 460px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ══════════════ 首页 ══════════════ */

.screen-home {
  justify-content: center;
  gap: 14px;
  text-align: center;
}

.home-back {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  left: 12px;
  color: var(--ink2);
  font-size: 13px;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 10px;
}
.home-back:hover { background: var(--card); }

.title-block h1 {
  margin: 0;
  font-size: 27px;
  font-weight: 700;
  letter-spacing: 1px;
}
.subtitle {
  margin: 6px 0 0;
  font-size: 13.5px;
  color: var(--ink2);
}

.home-best {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 20px;
  border-radius: 999px;
  background: var(--violet-tint);
  font-size: 12.5px;
  color: var(--ink2);
}
.home-best b { font-size: 20px; color: var(--violet-d); }

.hint-card {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--r);
  background: var(--card);
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--ink2);
  text-align: left;
}
.hint-card p { margin: 0; }
.hint-card b { color: var(--violet-d); }

.big-btn {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 14px;
  background: var(--violet);
  color: #FFFFFF;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--violet-d);
  transition: transform .08s, box-shadow .08s;
}
.big-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--violet-d); }

.foot {
  margin: 0;
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink3);
}

/* ══════════════ 游戏页 ══════════════ */

/* ★ 整个游戏界面跟棋盘同宽 —— JS 在 relayout() 里把宽度写死到
   .topbar / #hud / .previews / .controls / .hint 上。
   所以这里**不能**写 width:100%（那会铺满屏宽，棋盘显得又小又散）。 */
.screen-game {
  gap: 6px;
  justify-content: flex-start;
}

/* ★ 棋盘吃掉所有剩余高度：flex:1 + min-height:0 是关键，
     没有 min-height:0 的话 flex 子项不会缩到内容以下，
     棋盘就会把控制条顶出屏幕（症状：底部按钮看不见）。 */
/* ★ 棋盘自己就是 canvas 那么大，居中交给它。
   这里**刻意不写 flex:1**：高度已经由 JS 按 innerHeight 减好了，
   stage 再 flex:1 会跟「棋盘反过来撑 stage」形成循环（量一次缩一次）。 */
.stage {
  position: relative;      /* ★ 暂存按钮绝对定位的参照 */
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  /* ★ 棋盘上要拖动/点按，别让它触发滚动或缩放 */
  touch-action: none;
}


/* 数据格基础形制（顶栏里在用，别删） */
.hud-cell {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 3px 2px;
  border-radius: 9px;
  background: var(--card);
  line-height: 1.1;
}
.hud-cell span { font-size: 10px; color: var(--ink3); line-height: 1.2; }
.hud-cell b { font-size: 15px; color: var(--violet-d); line-height: 1.15; }
/* ══════════════ 顶栏（一行搞定）══════════════
   ★★ 2026-10-28 照「俄罗斯奶块」的形制收成一行：
        ←返回 | 得分 | 最佳 | 等级 | 下一个预览 | ⋯
      奶块没有独立的 HUD 行 —— 竖屏里高度就是棋盘大小的唯一瓶颈，
      多一行 HUD 等于白扔 40px（棋盘少一排）。
      低频操作（暂存/音效/排行榜/重开/玩法）全收进「⋯」菜单。 */
.topbar {
  display: flex;
  gap: 5px;
  align-items: stretch;
  justify-content: space-between;
  height: 46px;
}

/* 顶栏里的数据格：竖直居中、不要底衬（顶栏本身就是一条） */
.topbar .hud-cell {
  /* ★ 0.82 而不是 1：数据格只有 1~2 个字（"得分"/"0"），用不满，
     让出来的宽度给预览格 —— 预览里要横着放下 4 格宽的 I 型方块。 */
  flex: 0.82 1 0;
  justify-content: center;
  padding: 0;
  background: none;
  gap: 0;
}
/* 预览格（暂存 / 下一个）
 * ★★ 2026-10-28 修的真机 bug：「字两行 + 图案特别小」。
 *   原来写的是 flex:1.35，和三个数据格挤在同一行 —— 真机 390 屏上每格只有
 *   61px 宽，「下一个」三个字（29px）+ padding 一挤就换行，canvas 再被
 *   HEIGHT 压到 32px 高，方块就缩成小点。
 *   修法：① 给足宽度（1.55 份）② 字**强制一行**（white-space:nowrap）
 *        ③ canvas 用固定高度撑满剩余空间，不再 width:100% 被动挤压。 */
.topbar .hud-cell-prev {
  flex: 1.55 1 0;
  justify-content: center;
  gap: 0;
  background: var(--card);
  border-radius: 10px;
  padding: 2px 4px 3px;
  overflow: hidden;
}
.topbar .hud-cell-prev span {
  font-size: 9px;
  line-height: 1.1;
  white-space: nowrap;       /* ★ 绝不换行 */
  display: block;
}
.topbar .hud-cell-prev canvas {
  display: block;
  margin: 0 auto;
  /* 高度锁死 26px：顶栏 46 - padding 5 - 字 10 ≈ 30，留一点余量。
     宽度由 JS 按 3.2:1 的比例写（比格子窄一点没关系，但不能溢出）。 */
  /* 高度给足 28px：顶栏 46 - 上下 padding 5 - 字 11 = 30，留 2px 余量。
     ★ 方块认得出来靠的就是这个高度（数字小 = 认不出「下一个」是什么形状）。 */
  height: 28px !important;
  width: auto !important;
  max-width: 100%;
}
/* 暂存格：顶栏里的一个按钮（只在困难模式显示）。
   ★ 复用 .hud-cell-prev 的排版，这里只补「它是个按钮」的那点特化。 */
.hold-cell {
  border: 0;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .08s, opacity .15s;
}
.hold-cell:active { transform: scale(.94); }
/* 没东西可暂存时淡下去 —— 一眼知道「现在按了也没用」 */
.hold-cell.is-empty { opacity: 0.42; }
.topbar .hud-cell span { font-size: 9.5px; }
.topbar .hud-cell b { font-size: 17px; }

.icon-btn {
  width: 38px;
  height: 38px;
  flex: none;
  border: 0;
  border-radius: 12px;
  background: var(--card);
  color: var(--violet-d);
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--line);
  transition: transform .08s, box-shadow .08s;
  align-self: center;
}
.icon-btn:active { transform: translateY(2px); box-shadow: 0 0 0 var(--line); }
.icon-btn[aria-pressed="true"] { background: var(--violet-tint); }



.hint {
  margin: 0;
  font-size: 11.5px;
  width: auto;
  color: var(--ink3);
  text-align: center;
  min-height: 16px;
}

/* ★ 2026-10-28：五个键砍到三个之后，宽度全让给它们了。
   左右各 1 份、直落 1.6 份（直落是一局里点最多的，也最容易误触）。 */
.controls {
  display: flex;
  gap: 8px;
}
.ctl {
  flex: 1;
  min-width: 0;
  height: 58px;
  border: 0;
  border-radius: 14px;
  background: var(--violet);
  color: #FFFFFF;
  font: inherit;
  font-size: 21px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--violet-d);
  transition: transform .08s, box-shadow .08s;
  touch-action: none;
}
.ctl:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--violet-d); }
.ctl-drop {
  flex: 1.6;
  background: var(--honey);
  box-shadow: 0 4px 0 var(--honey-d);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
}
.ctl-drop span {
  display: block;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
  margin-top: -1px;
}
/* 暂存已经挪到顶栏，这个小键的样式留着给顶栏那个 ⇄ 备用 */
.ctl-hold { background: var(--violet-tint); color: var(--ink); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3); }

/* ══════════════ 结算 ══════════════ */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(44, 44, 42, 0.42);
  padding: 18px;
}
.overlay .card {
  width: min(340px, 100%);
  padding: 22px 20px 16px;
  border-radius: 22px;
  background: var(--card);
  color: var(--ink);
  text-align: center;
}
.overlay h2 { margin: 0 0 4px; font-size: 19px; font-weight: 600; }
.final-score {
  font-size: 44px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--honey-d);
  margin: 4px 0 10px;
}
.stat-row {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}
.stat {
  flex: 1;
  padding: 7px 2px;
  border-radius: 12px;
  background: var(--honey-tint);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat span { font-size: 11px; color: var(--ink3); }
.stat b { font-size: 16px; }

.text-btn {
  margin-top: 10px;
  padding: 8px 12px;
  border: 0;
  background: none;
  color: var(--ink3);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ══════════════ Toast ══════════════ */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 84px);
  transform: translateX(-50%);
  z-index: 50;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(94, 76, 160, 0.94);
  color: var(--ink);
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none;
}

/* 窄屏 */
@media (max-width: 360px) {
  .title-block h1 { font-size: 23px; }
  .ctl { height: 48px; font-size: 19px; }
  .hud-cell b { font-size: 14px; }
}

/* 矮屏（横屏 / 老设备）：把控制条和提示压缩 */
@media (max-height: 620px) {
  .hint { display: none; }
  .ctl { height: 44px; }
}

/* ══════════════ 难度选择 ══════════════ */

/* 三档难度（龟速 / 标准 / 困难）—— 三等分，窄屏也排得下 */
.mode-row {
  display: flex;
  gap: 6px;
  width: 100%;
  max-width: 320px;
}
.mode-btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 40px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink2);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;       /* 「🐢 龟速」不能折行 */
  cursor: pointer;
  transition: background-color .12s, color .12s;
}
.mode-btn[aria-pressed="true"] {
  background: var(--violet);
  border-color: transparent;
  color: #FFFFFF;
}
.mode-hint {
  margin: -6px 0 0;
  font-size: 12px;
  color: var(--ink3);
}

/* ══════════════ 首页次级按钮 ══════════════ */

.mid-row {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 320px;
}
.mid-btn {
  flex: 1;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--violet-tint);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
}
.mid-btn:active { background: var(--violet-tint); }

.link-btn {
  border: 0;
  background: none;
  color: var(--ink3);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 4px 6px;
}

/* ══════════════ 面板通用（榜单 / 玩法 / 音效 / 反馈）══════════════ */

.overlay .card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.overlay .card-head h2 { margin: 0; }

.btn-x {
  width: 32px;
  height: 32px;
  flex: none;
  border: 0;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.06);
  color: var(--ink3);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.btn-x:active { background: rgba(0, 0, 0, 0.12); }

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.card-actions > * { flex: 1 1 0; }
.mini-btn {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--honey-tint);
  color: var(--honey-d);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.mini-btn.primary { background: var(--violet); border-color: transparent; color: #FFFFFF; }

/* ══════════════ 榜单 ══════════════ */

.lb {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  text-align: left;
}
.lb-cap { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--ink2); }
.lb-row { display: flex; gap: 8px; }
.lb-nick {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}
.lb-send {
  flex: none;
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 11px;
  background: var(--violet);
  color: #FFFFFF;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.lb-send:disabled { opacity: .6; cursor: default; }
.lb-msg { margin: 7px 0 0; min-height: 16px; font-size: 12px; color: var(--ink3); }
.lb-msg.hi { color: var(--honey-d); font-weight: 600; }

.lb-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 46vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  text-align: left;
}
.lb-list li {
  display: flex;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 9px;
  font-size: 14px;
}
.lb-list li:nth-child(odd) { background: rgba(246, 213, 122, 0.28); }
.lb-list li.me { background: rgba(246, 213, 122, 0.68); font-weight: 700; }
.lb-list li.empty { color: var(--ink3); font-size: 13px; }
.lb-list li .r { width: 26px; flex: none; opacity: .55; font-style: normal; }
.lb-list li .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-list li .s { flex: none; color: var(--honey-d); font-weight: 700; }

/* ══════════════ 玩法说明 ══════════════ */

.tut-body {
  max-height: 54vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  text-align: left;
  font-size: 13px;
  line-height: 1.75;
  color: var(--ink2);
}
.tut-body h4 { margin: 12px 0 4px; font-size: 13px; color: var(--ink); }
.tut-body h4:first-child { margin-top: 0; }
.tut-body p { margin: 0 0 4px; }
.tut-body b { color: var(--ink); }

/* ══════════════ 挑音效 ══════════════ */

.sfx-cap { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--ink2); }
.sfx-warn {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--honey-tint);
  font-size: 12px;
  line-height: 1.5;
  color: var(--honey-d);
}
.sfx-pane { max-height: 46vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.rows { display: flex; flex-direction: column; gap: 6px; }
.sfx-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}
.sfx-row.on { border-color: var(--honey); background: rgba(246, 213, 122, 0.28); }
.sfx-t {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 0;
  background: none;
  padding: 0;
  text-align: left;
  font: inherit;
  cursor: pointer;
  color: inherit;
}
.sfx-t b { font-size: 13.5px; color: var(--ink); }
.sfx-t span { font-size: 11.5px; color: var(--ink3); }
.sfx-tag {
  flex: none;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  color: var(--ink3);
  background: #fff;
}
.sfx-tag.picked { color: #fff; background: var(--honey-d); border-color: transparent; font-weight: 600; }
.sfx-tag[aria-pressed="false"] { border-style: dashed; }
.sfx-grp { margin: 8px 0 2px; font-size: 11.5px; color: var(--ink3); }
.sfx-msg { margin: 8px 0 0; min-height: 16px; font-size: 12px; color: var(--ink3); }
.sfx-msg.hi { color: var(--honey-d); font-weight: 600; }

/* ══════════════ 反馈 ══════════════ */

.fb-text, .fb-contact {
  width: 100%;
  padding: 9px 11px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  -webkit-appearance: none;
}
.fb-text { resize: none; line-height: 1.5; }
/* ══════════════ 结算梗图（抄跳一跳的形制）══════════════ */

.overlay .over-card {
  width: min(340px, 92vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  text-align: center;
}
.overlay .over-body {
  padding: 14px 20px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* 梗图铺满卡片上沿，圆角跟着卡片走 */
.meme {
  flex: 0 0 auto;
  background: #EFE4D7;
  line-height: 0;
}
/* ⚠️ 这里**不能**写 `.meme[hidden]{display:none}`：
   本页统一用 `.hidden` **class** 控制显隐（见文件头的 [hidden] 规则说明），
   而 `[hidden]` 属性选择器的特异性比 `.hidden` class 高 ——
   写了这条就会「class 移掉了但属性还在」，元素永远不显示，
   而且没有任何报错（症状：结算时那块是空的）。
   跳一跳那边用的是 hidden 属性，那是另一套约定，别抄。 */
.meme.hidden { display: none; }
.meme img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 40vh;
  object-fit: cover;
  object-position: center bottom;
}
