/* =====================================================================
   帮成语找朋友 · 棋盘、字牌、难度选择
   ===================================================================== */

/* ============================ 难度选择（封面） ============================ */

/* 两个模式排成一行，省下高度给开始按钮 */
.mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
/* 三种模式：保持 3 列横排。
   曾试过小屏折成 1 列，结果多占两行，414×736 / 360×640 / 320×568
   的开始按钮全被顶出首屏。所以小屏改为压缩 3 列：只留模式名、
   隐藏说明、缩小字号与内边距。 */
.mode-toggle--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mode-toggle--three .mode { min-width: 0; }
.mode-toggle--three .mode__name {
  white-space: normal;
  line-height: 1.15;
  font-size: 0.92em;
}
@media (max-width: 560px) {
  .mode-toggle--three { gap: 5px; }
  .mode-toggle--three .mode {
    min-height: 42px;
    padding: 5px 5px;
    align-items: center;
    text-align: center;
  }
  .mode-toggle--three .mode__name { font-size: 12px; }
  .mode-toggle--three .mode__note { display: none; }
}

.mode {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
  min-height: 52px;
  padding: 8px 11px;
  text-align: left;
  background: var(--paper-warm);
  border: 2.5px solid var(--paper-deep);
  border-radius: 14px;
  transition: transform var(--dur-fast) var(--ease-bounce),
              box-shadow var(--dur-fast),
              border-color var(--dur-fast),
              background var(--dur-fast);
  touch-action: manipulation;
}
.mode[aria-checked="true"] {
  background: #FFF4DD;
  border-color: var(--ink);
  box-shadow: 0 3px 0 var(--ink), 0 6px 12px rgba(90, 74, 58, 0.12);
  transform: translateY(-1px);
}
@media (hover: hover) {
  .mode:hover { border-color: var(--ink-soft); transform: translateY(-2px); }
}

.mode__name {
  font-family: var(--font-hand);
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
  white-space: nowrap;
}
.mode[aria-checked="true"] .mode__name { color: var(--pumpkin-deep); }

.mode__note {
  font-size: 11px;
  color: var(--ink-soft);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* 模式与难度同卡时，难度列表离模式行近一点 */
.setup__block .diff-list { margin-top: 2px; }

/* ============================ 棋盘 ============================ */

.hm-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;   /* 顺序指示条绝对定位的参照 */
  width: min(100%, 660px);
  padding: clamp(7px, 1.6vmin, 14px);
  background: var(--paper-warm);
  border: 3px solid var(--ink);
  border-radius: clamp(18px, 3.2vmin, 28px);
  box-shadow: 0 7px 0 var(--paper-deep), 0 9px 0 var(--ink), var(--shadow-card);
  -webkit-user-select: none;
  user-select: none;
}

.hm-board {
  /* flex 项默认收缩：体积被内容撑开过之后，主尺寸不会自己退回内容尺寸，
     棋盘会被压成一条。设成不收缩，尺寸只由网格与宽高比决定。
     也不居中：垂直居中会让行盒比棋盘高、上方多出空白，看起来像整体下沉。 */
  flex: 0 0 auto;
  align-self: flex-start;
  --cols: 4;
  --rows: 4;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows), minmax(0, 1fr));
  gap: clamp(4px, 0.9vmin, 9px);
  width: 100%;
  aspect-ratio: calc(var(--cols) / var(--rows));
}

/* —— 字牌 —— */
.hm-tile {
  position: relative;
  display: block;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: none;
  background: none;
  border-radius: clamp(9px, 2.2vmin, 16px);
  container-type: size;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease-bounce), opacity var(--dur) var(--ease-soft);
}

.hm-tile__face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  /* 底色与边框画在按钮本身上（见 buildBoard 的 el.style.background）：
     牌面只做高光 / 按下 / 消失这些装饰，阴影不会互相打架，
     也不会出现「按钮和牌面错位、点到缝里没反应」的情况 */
  border: none;
  border-radius: inherit;
  background: transparent;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.10);
  transition: box-shadow var(--dur-fast), transform var(--dur-fast) var(--ease-bounce);
  overflow: hidden;
}

/* 墨色描边：用一整圈 box-shadow 画在外盒上，随按钮一起铺满整格 */
.hm-tile::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 clamp(2px, 1.6cqmin, 3px) var(--ink), 0 3px 0 rgba(90, 74, 58, 0.38);
  pointer-events: none;
}

.hm-tile__ch {
  font-family: "Kaiti SC", Kaiti, STKaiti, "Songti SC", serif;
  font-size: min(58cqh, 58cqw, 78px);
  font-weight: 700;
  line-height: 1;
  color: var(--ink-tile);
  transform: translateY(4%);
}

/* 位置号：点进来的字标出它在成语里的位置 1/2/3/4，一眼看出还差哪个字 */
.hm-tile.is-picked::after {
  content: attr(data-seat);
  position: absolute;
  left: clamp(2px, 6cqh, 7px);
  top: clamp(2px, 6cqh, 7px);
  min-width: 1.5em;
  padding: 0 clamp(2px, 4cqw, 5px);
  border-radius: 999px;
  background: var(--pumpkin);
  color: #fff;
  font-family: var(--font-num);
  font-size: min(13cqh, 13cqw, 13px);
  font-weight: 800;
  line-height: 1.45;
  text-align: center;
  box-shadow: 0 1.5px 0 var(--ink);
  z-index: 2;
}
.hm-tile[data-seat="1"]::after { background: var(--pumpkin); }
.hm-tile[data-seat="2"]::after { background: #6FAFD8; }
.hm-tile[data-seat="3"]::after { background: #7CC398; }
.hm-tile[data-seat="4"]::after { background: var(--cherry-deep); }
.hm-tile[data-seat]::after { pointer-events: none; }

/* 已坐下的牌保持高亮但不再抖，避免误以为又点了一次 */
.hm-tile.is-picked .hm-tile__ch { transform: translateY(-6%); }

/* 选中：抬起 + 牌角标出它在成语里的位置 */
.hm-tile.is-picked { z-index: 3; transform: translateY(-3px) scale(1.04); }
.hm-tile.is-picked {
  background: #FFF6E2 !important;
  box-shadow: 0 0 0 3px var(--pumpkin);
}
/* 选中时字往上收一点，给左上角的位置号留出空 */
.hm-tile.is-picked .hm-tile__ch { font-size: min(50cqh, 50cqw, 78px); }
.hm-tile.is-picked .hm-tile__ch { transform: translateY(-6%); }

/* 提示：两张一起闪一圈 */
/* 提示：整桌一起呼吸。用轮廓 + 抬升 + 光晕三重叠加，
   在彩色牌面和各种屏幕上都能一眼看见（原来只有一圈细描边，几乎不可见）。 */
.hm-tile.is-hint {
  z-index: 4;
  animation: hmHintLift 1.1s var(--ease-soft) infinite;
}
.hm-tile.is-hint .hm-tile__face {
  outline: 4px solid var(--pumpkin);
  outline-offset: 1px;
  box-shadow:
    inset 0 -4px 0 rgba(0, 0, 0, 0.10),
    0 0 0 7px rgba(245, 213, 71, 0.55),
    0 4px 0 rgba(90, 74, 58, 0.38);
}
/* 已经坐下的牌：换一种颜色，和「还差哪几个」区分开 */
.hm-tile.is-hint-starter {
  box-shadow: 0 0 0 4px var(--pumpkin);
  animation: hmHintLift 1.1s var(--ease-soft) infinite;
}

.hm-tile.is-hint-seated .hm-tile__face {
  outline-color: #4E9A6E;
  box-shadow:
    inset 0 -4px 0 rgba(0, 0, 0, 0.10),
    0 0 0 7px rgba(124, 195, 152, 0.55),
    0 4px 0 rgba(90, 74, 58, 0.38);
}
@keyframes hmHintLift {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-6px) scale(1.04); }
}

@media (prefers-reduced-motion: reduce) {
  .hm-tile.is-hint { animation: none; }
}

/* 选错：抖一下再复原 */
.hm-tile.is-wrong {
  background: #FBE3E8 !important;
  animation: hmShake 0.4s var(--ease-soft);
}
@keyframes hmShake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-4px); }
  50%      { transform: translateX(4px); }
  75%      { transform: translateX(-2px); }
}

/* 配对成功：淡出并让位 */
.hm-tile.is-gone {
  pointer-events: none;
  animation: hmGone 0.42s var(--ease-soft) forwards;
  animation-delay: var(--pop-delay, 0s);
}
@keyframes hmGone {
  0%   { opacity: 1; transform: scale(1.06); }
  55%  { opacity: 1; transform: scale(1.12); }
  100% { opacity: 0; transform: scale(0.72); }
}
/* 消掉的格子留一枚浅浅的虚线空位，像被收拾干净的桌面，
   而不是一个突兀的洞；也方便小朋友记住这里已经找过了 */
.hm-tile.is-gone .hm-tile__face {
  box-shadow: none;
  border-color: transparent;
  background: transparent;
}
.hm-tile.is-gone .hm-tile__face::before {
  content: "";
  position: absolute;
  inset: 12%;
  border: 2px dashed rgba(90, 74, 58, 0.16);
  border-radius: inherit;
  background: rgba(90, 74, 58, 0.03);
}
.hm-tile.is-gone .hm-tile__ch { opacity: 0; }

/* 已消牌必须绝对隐藏，不能只靠动画的 forwards 终态：
   连续消除时新动画的 animation-delay 会打断上一次动画，
   牌停在动画初始帧（opacity:1），结算时字集体「回魂」。
   所以直接静态隐藏，动画只负责消失过程，隐藏由这条规则兜底。 */
.hm-tile.is-gone {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none;
}

/* 全部消完：棋盘轻轻跳一下 */
/* 只让还在盘上的牌欢呼。曾用 .hm-board.is-cleared .hm-tile，
   会覆盖 .hm-tile.is-gone 的淡出动画（forwards 的 opacity:0 被顶掉），
   已消掉的牌在结算时带着字母集体「回魂」。 */
.hm-board.is-cleared .hm-tile:not(.is-gone) { animation: hmCheer 0.5s var(--ease-bounce); }
.hm-board.is-bump { animation: hmBump 0.36s var(--ease-soft); }
@keyframes hmBump {
  0%, 100% { transform: translateY(0); }
  40%      { transform: translateY(3px); }
}
@keyframes hmCheer {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

/* 键盘可达性：只在键盘聚焦时显示描边 */
.hm-tile:focus-visible .hm-tile__face {
  outline: 3px dashed var(--pumpkin);
  outline-offset: 2px;
}

@media (hover: hover) {
  .hm-tile:not(.is-gone):hover .hm-tile__face { transform: translateY(-2px); }
}

/* —— 配对规则条：常驻在棋盘下方，随模式改写 —— */
.hm-rule {
  /* 下方信息区（提示卡 / 反馈 / 说明 / 规则）一律占满整行：
     模板里给 .stage 子元素的布局规则会把它们挤成几十像素宽 */
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 6px 10px;
  max-width: min(100%, 560px);
  border: 2px dashed rgba(90, 74, 58, 0.22);
  min-height: 1.5em;
  border-radius: 10px;
  background: rgba(255, 253, 247, 0.72);
  font-family: var(--font-hand);
  font-size: var(--fs-xs);
  line-height: 1.5;
  color: var(--ink-soft);
  text-align: center;
}
.hm-rule b { color: var(--pumpkin-deep); }

/* 还没轮到显示规则时只占位，不画虚线框 */
.hm-rule.is-empty {
  border-color: transparent;
  background: transparent;
}

/* —— 反馈文字 —— */
.hm-feedback {
  width: 100%;
  box-sizing: border-box;
  min-height: 1.5em;
  margin: 0;
  font-family: var(--font-hand);
  font-size: var(--fs-sm);
  line-height: 1.45;
  text-align: center;
  color: var(--ink-soft);
  transition: color var(--dur-fast);
}
.hm-feedback.is-ok { color: #4E9A6E; }
.hm-feedback.is-no { color: #C4576C; }
.hm-feedback.is-hint { color: var(--pumpkin-deep); font-weight: 700; }

/* ============================ 封面：窄屏压缩 ============================ */
/* 模式一行 + 难度三行 + 开始按钮，比模板游戏多一块，
   所以窄屏要把插画、标题、间距各让一点，保证「开始游戏」在首屏。 */

@media (max-width: 760px) {
  .screen--start .setup { gap: 9px; }
  .screen--start .setup__block { gap: 8px; padding: 11px; }
  .screen--start .mode { min-height: 46px; padding: 6px 10px; }
  .screen--start .diff-list { gap: 7px; }
  .screen--start .diff { min-height: 52px; padding: 6px 10px; }
  .screen--start .btn--lg { min-height: 58px; }
  .screen--start .fineprint { display: none; }
  /* 模式说明在窄屏并入名字行，省一行高度 */
  .screen--start .mode-toggle { gap: 7px; }
}

@media (max-width: 760px) and (max-height: 780px) {
  .screen--start .hero__card { width: min(150px, 34vw); padding: 10px; }
  .screen--start .start-grid { gap: 12px; }
}

/* 桌面矮屏：右侧数据条与操作栏贴顶，不额外下移 */
@media (min-width: 860px) and (max-height: 660px) {
  .side-card__head { display: none; }
}

@media (max-width: 400px) {
  .screen--start .hero__card { width: min(130px, 32vw); padding: 8px; border-radius: 22px; }
  .screen--start .mode { min-height: 42px; padding: 5px 8px; }
  .screen--start .mode__note { display: none; }
  .screen--start .diff { min-height: 46px; padding: 5px 8px; gap: 8px; }
  .screen--start .diff__mini { width: 30px; height: 30px; }
  .screen--start .setup__block { padding: 9px; gap: 6px; }
}

/* 小屏手机（320×568 / 360×640）：再收一档，保证开始按钮和底部留白 */
@media (max-width: 400px) and (max-height: 700px) {
  .screen--start { padding-top: 8px; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .start-grid { gap: 9px; }
  .screen--start .hero__card { width: min(112px, 30vw); padding: 7px; border-radius: 18px; }
  .screen--start .app-title { font-size: clamp(28px, 9vw, 36px); }
  .screen--start .subtitle { margin-top: 0; font-size: var(--fs-sm); }
  .screen--start .setup { gap: 7px; }
  .screen--start .setup__block { padding: 8px; gap: 5px; }
  .screen--start .diff-list { gap: 5px; }
  .screen--start .diff { min-height: 44px; padding: 4px 8px; }
  .screen--start .btn--lg { min-height: 52px; font-size: var(--fs-md); }
}

/* 矮横屏（含手机横屏、568×320）：插画与标题并排，设置占右侧 */
@media (max-height: 480px) and (orientation: landscape) {
  .screen--start { padding-top: 6px; padding-bottom: 4px; }
  .start-grid { gap: 14px; grid-template-columns: minmax(0, 0.8fr) minmax(320px, 1fr); align-items: center; }
  .screen--start .hero__card { width: min(130px, 22vw); padding: 8px; border-radius: 20px; }
  .screen--start .app-title { font-size: clamp(24px, 4.4vh, 32px); }
  .screen--start .subtitle { display: none; }
  .screen--start .setup { gap: 5px; }
  .screen--start .setup__block { padding: 7px; gap: 5px; }
  .screen--start .mode { min-height: 34px; padding: 3px 8px; }
  .screen--start .mode__note { display: none; }
  .screen--start .diff-list { gap: 4px; }
  .screen--start .diff { min-height: 34px; padding: 3px 8px; }
  .screen--start .diff__mini { width: 24px; height: 24px; }
  .screen--start .diff__meta { display: none; }
  .screen--start .btn--lg { min-height: 38px; padding: 5px 14px; font-size: var(--fs-sm); }
  .screen--start .eyebrow,
  .screen--start .fineprint { display: none; }
  .screen--start .setup__label-note { display: none; }
}

/* ============================ 游戏页：矮屏压缩 ============================ */

/* 桌面 / 平板横屏但高度不够（1024×600、800×600 一类）：
   棋盘要留够尺寸，先从数据卡、操作栏、说明文字身上省高度。 */
@media (max-height: 780px) {
  .stats { margin-top: 0; }
  .stage__caption { display: none; }
  .hint--play { display: none; }
  .side-card { gap: 9px; padding: 11px; }
  .side-actions .btn { min-height: 44px; font-size: var(--fs-sm); }
  .hm-feedback { font-size: var(--fs-xs); min-height: 1.2em; }
}

@media (max-height: 660px) {
  .screen--play { padding-top: 4px; padding-bottom: 10px; }
  .stat { padding: 3px 5px 4px; border-width: 2.5px; }
  .stat__label { font-size: 11px; }
  .stat__value { font-size: 19px; }
  .side-card { gap: 7px; padding: 8px 9px; border-width: 2.5px; }
  .side-card__head { display: none; }
  .seg { padding: 3px; }
  .seg__btn { min-height: 38px; font-size: var(--fs-xs); }
  .side-actions .btn { min-height: 38px; padding: 5px 8px; font-size: var(--fs-xs); border-width: 2px; }
  .hm-feedback { display: none; }
  .stage { gap: 6px; }
  /* 规则条不隐藏：它是玩法本身，只压缩留白与字号 */
  .hm-rule { padding: 3px 8px; font-size: 11px; line-height: 1.4; border-width: 1.5px; }
}

/* 宽而矮（800×600 一类）：改成左右两列，操作栏搬到右侧，
   棋盘能把整个高度吃满，不再被上下两块挤成一小块。 */
@media (min-width: 700px) and (max-width: 859px) and (max-height: 700px) {
  .play-grid {
    flex: 1;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) 232px;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      "stage stats"
      "stage side";
    gap: 6px 14px;
  }
  .stage { gap: 6px; }
  .stats { gap: 6px; }
  .side { gap: 6px; }
  .side-card { padding: 8px 9px; gap: 7px; }
  .seg__btn { min-height: 36px; }
  .side-actions { grid-template-columns: 1fr; gap: 6px; }
  .side-actions .btn { min-height: 38px; }
}

/* 单列 + 矮屏：操作栏压成一行两键，给棋盘腾出空间 */
@media (max-width: 859px) and (max-height: 700px) {
  .screen--play { padding: 4px 12px max(8px, env(safe-area-inset-bottom)); }
  .play-grid { gap: 8px; }
  .stats { gap: 6px; }
  .stat { padding: 4px 5px 5px; }
  .stat__value { font-size: 20px; }
  .side-card { padding: 8px 9px; gap: 7px; }
  .side-card__head { display: none; }
  .seg { padding: 3px; }
  .seg__btn { min-height: 38px; font-size: var(--fs-xs); }
  .side-actions { gap: 6px; }
  .side-actions .btn { min-height: 40px; padding: 5px 8px; font-size: var(--fs-sm); }
}

/* 庆祝弹窗里跨行的「最佳记录」占满整行 */
.celeb__stat--wide {
  flex: 1 1 100%;
  margin-top: 10px;
  min-width: 0 !important;
}

/* 入场动画里的 translateY 会把内容顶出视口，
   游戏页这类满屏页面改成只淡入、不位移，避免出现 8px 的纵向滚动。 */
.screen--play.view-enter { animation: hmFadeIn var(--dur) var(--ease-soft) both; }
@keyframes hmFadeIn {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}

/* ============================ 响应式 ============================ */

@media (max-width: 760px) {
  .hm-shell { box-shadow: 0 5px 0 var(--paper-deep), 0 7px 0 var(--ink), var(--shadow-soft); }
  .hm-tile__ch { font-size: min(56cqh, 56cqw, 60px); }
  .hm-feedback { font-size: var(--fs-sm); }
}

@media (max-width: 400px) {
  .mode { min-height: 48px; padding: 6px 9px; }
  .mode__name { font-size: 15px; }
  .mode__note { font-size: 10px; }
}

/* 矮横屏：封面收一收，保证开始按钮在首屏 */
@media (max-height: 620px) and (orientation: landscape) {
  .mode { min-height: 44px; padding: 5px 9px; }
  .mode__note { display: none; }
}

/* 顶栏品牌名：5 个字比模板更长，窄屏缩一档避免「成语找…」截断 */
@media (max-width: 640px) {
  .brand__name { font-size: 16px; letter-spacing: 0; }
}
@media (max-width: 430px) {
  .brand { gap: 6px; }
  .brand__name { font-size: 15px; }
  .brand__logo { width: 36px; height: 36px; font-size: 13px; }
}
@media (max-width: 380px) {
  .brand__name { font-size: 14px; }
}

/* 极矮横屏（568×320 一类）：规则条必须保留，用最小字号压成两行。
   放在文件最后，确保覆盖上面所有 max-height 规则。 */
@media (max-height: 380px) {
  .hm-rule {
    margin-top: 2px;
    padding: 2px 6px;
    font-size: 10px;
    line-height: 1.3;
    border-width: 1.5px;
    border-radius: 8px;
    text-align: left;
  }
  /* 棋盘已到最小尺寸：规则条压在棋盘下沿之外，靠 flex 底部对齐，
     并用 padding 给棋盘让出位置，避免遮住最下面一排字 */
  .stage { position: relative; padding-bottom: 0; }
  .hm-rule {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 3.2em;
    overflow: hidden;
  }
  /* 棋盘底边让位：宽度收一点，让规则条贴在它下方 */
  .hm-shell { margin-bottom: 26px; }
}

/* =====================================================================
   成语弹出：拼成一条成语时的整词亮相
   （牌面结构与普通字牌一致，这里只管弹出体）
   ===================================================================== */

/* 拼成一条成语时的弹出：整条成语 */
.hm-spell-pop {
  position: absolute;
  left: 50%;
  top: 42%;
  z-index: 20;
  transform: translate(-50%, -50%);
  padding: 8px 20px 12px;
  border: 3px solid var(--ink);
  border-radius: var(--r-md);
  background: var(--sunny);
  box-shadow: 0 5px 0 var(--ink), 0 12px 24px rgba(90, 74, 58, 0.25);
  font-family: "PF Pinyin Sans", var(--font-num);
  font-size: clamp(28px, 5vmin, 44px);
  font-weight: 400;
  line-height: 1.1;
  color: var(--ink);
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
  animation: spellPop 0.9s var(--ease-bounce) forwards;
}
.hm-spell-pop small {
  display: block;
  margin-top: 2px;
  font-family: "Kaiti SC", Kaiti, serif;
  font-size: 0.55em;
  font-weight: 700;
  color: var(--ink-soft);
}
@keyframes spellPop {
  0%   { opacity: 0; transform: translate(-50%, -30%) scale(0.6) rotate(-5deg); }
  30%  { opacity: 1; transform: translate(-50%, -50%) scale(1.1) rotate(2deg); }
  65%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -70%) scale(0.95); }
}

/* 矮横屏终极收紧（放着最后保证优先级） */
@media (max-height: 360px) and (orientation: landscape) {
  .screen--start { padding-top: 4px !important; padding-bottom: 2px !important; }
  .screen--start .hero__card { width: min(80px, 15vw) !important; padding: 4px !important; }
  .start-grid { gap: 6px !important; }
  .screen--start .setup { gap: 3px !important; }
  .screen--start .setup__block { padding: 5px !important; gap: 3px !important; }
  .screen--start .mode-toggle--three .mode { min-height: 28px !important; padding: 2px !important; }
  .screen--start .diff { min-height: 28px !important; padding: 2px 8px !important; }
  .screen--start .btn--lg { min-height: 30px !important; padding: 3px 14px !important; }
  .screen--start .app-title { font-size: 24px !important; }
}

/* =====================================================================
   帮成语找朋友 · 成语提示卡与结算回顾
   ===================================================================== */

/* =====================================================================
   棋盘下方：成语提示卡 ○言九鼎 + 反馈 + 盘面说明
   ===================================================================== */

.idiom-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  max-width: min(100%, 560px);
  margin: 0 auto;
}

.idiom-card {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  padding: 4px 8px;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 3px 0 var(--paper-deep), 0 5px 0 var(--ink);
}
.idiom-card[hidden] { display: none; }
/* 尚未开局：卡片照常占住高度（visibility 隐藏而非 display:none），
   棋盘尺寸从开局起就按「有提示框」算好，点牌后不再跳动 */
.idiom-card.is-off { visibility: hidden; }
.idiom-card.is-full {
  background: #FFF4DD;
  border-color: var(--pumpkin-deep);
}

.idiom-card.is-empty {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.idiom-card__mask {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 6px;
  width: 100%;
  overflow: hidden;
}

.idiom-card__ch {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  box-sizing: border-box;
  width: calc((100% - 18px) / 4);
  max-width: clamp(34px, 8vmin, 46px);
  height: clamp(32px, 8vmin, 44px);
  padding: 0;
  margin: 0;
  font-family: "Kaiti SC", Kaiti, STKaiti, "Songti SC", serif;
  font-size: clamp(20px, 4.8vmin, 28px);
  font-weight: 700;
  line-height: 1;
  overflow: hidden;
  color: var(--ink-faint);
  background: var(--paper-warm);
  border: 2px dashed var(--paper-deep);
  border-radius: 10px;
}
.idiom-card__ch.is-filled {
  color: var(--ink);
  background: #FFF4DD;
  border: 2px solid var(--ink);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.08);
}

/* 空格子里那个「○」在楷体里是小圆圈字形，会像一圈描边；换成普通空心符号 */
.idiom-card__ch:not(.is-filled) {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: clamp(16px, 4vmin, 22px);
  color: var(--paper-deep);
  background: rgba(255, 253, 247, 0.6);
}

/* 拼好时的即时提示（还差几个 / 下一个是什么） */
.idiom-note {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  min-height: 1.2em;
  font-family: var(--font-hand);
  font-size: var(--fs-xs);
  color: var(--ink-faint);
  text-align: center;
}



/* 结算里的成语回顾 */
.review {
  width: 100%;
  max-height: 34vh;
  overflow: auto;
  padding: 8px 10px;
  text-align: left;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 12px;
}
.review__title {
  margin: 0 0 4px;
  font-family: var(--font-hand);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--ink-soft);
}
.review__list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.review__row {
  display: grid;
  gap: 1px;
  padding-bottom: 5px;
  border-bottom: 1px dashed var(--paper-deep);
}
.review__row:last-child { border-bottom: none; padding-bottom: 0; }
.review__word {
  font-family: "Kaiti SC", Kaiti, serif;
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--pumpkin-deep);
}
.review__mean {
  font-size: var(--fs-xs);
  line-height: 1.45;
  color: var(--ink-soft);
}
.review__src {
  display: block;
  margin-top: 1px;
  font-size: 0.94em;
  color: var(--ink-faint);
}

/* =====================================================================
   帮成语找朋友 · 本身是单玩法，封面比模板游戏少一块「选模式」，
   所以矮屏可以更激进地压缩插画，保证 320×568、568×320 也开始按钮首屏。
   ===================================================================== */
@media (max-width: 760px) {
  .screen--start .subtitle { font-size: var(--fs-sm); }
  .screen--start .setup__block { padding: 9px; gap: 6px; }
  .screen--start .diff { min-height: 52px; padding: 5px 10px; gap: 8px; }
  .screen--start .diff__mini { width: 32px; height: 32px; }
  .screen--start .diff__name { font-size: var(--fs-sm); }
  .screen--start .btn--lg { min-height: 52px; font-size: var(--fs-md); }
  .screen--start .hint { font-size: 12px; line-height: 1.45; }
}

@media (max-width: 760px) and (max-height: 680px) {
  .screen--start { padding-top: 6px; padding-bottom: 4px; }
  .screen--start .start-grid { gap: 9px; }
  .screen--start .hero__card { width: min(108px, 30vw); padding: 9px; border-radius: 20px; }
  .screen--start .app-title { font-size: clamp(28px, 8.6vw, 36px); }
  .screen--start .subtitle { display: none; }
  .screen--start .diff { min-height: 44px; padding: 3px 9px; }
  .screen--start .diff__mini { width: 26px; height: 26px; }
  .screen--start .diff__meta { font-size: 10px; }
  .screen--start .btn--lg { min-height: 46px; }
  .screen--start .hint { font-size: 11px; }
}

/* 矮横屏：插画与文字都缩到最小，只留难度与开始按钮 */
@media (max-height: 400px) {
  .screen--start .start-grid { gap: 10px; }
  .screen--start .hero__card { width: min(88px, 16vw); padding: 6px; border-radius: 16px; }
  .screen--start .subtitle,
  .screen--start .hint { display: none; }
  .screen--start .diff { min-height: 40px; padding: 2px 8px; }
  .screen--start .diff__mini { width: 24px; height: 24px; }
  .screen--start .btn--lg { min-height: 42px; }
}

/* 结算弹窗：默认最大宽度放不下「成语 + 释义 + 出处」三行，放宽一点 */
.modal.celeb { max-width: min(480px, 92vw); }
@media (max-height: 640px) {
  .modal.celeb { max-height: 94vh; }
}

/* 320×568 一类小屏：顶部留白与标题再收紧一点（实测差 6px 就掉出首屏） */
@media (max-width: 760px) and (max-height: 600px) {
  .screen--start { padding-top: 2px; }
  .screen--start .start-grid { gap: 6px; }
  .screen--start .app-title { font-size: 30px; }
  .screen--start .diff { min-height: 44px; }
  .screen--start .btn--lg { min-height: 48px !important; padding-top: 6px !important; padding-bottom: 6px !important; }
}

/* 「下一个该点的牌」：提示亮起时，能立刻点的那一张多一圈实线，
   其余只是淡淡标出来，玩家不用猜点哪张 */
.hm-tile.is-hint-next {
  box-shadow: 0 0 0 4px var(--pumpkin), 0 4px 0 var(--ink);
  z-index: 6;
}
/* 已经坐下的那张：就算还顶着 is-hint-next（提示刚刷），也按已入座的样子显示 */
.hm-tile.is-picked { background: #FFF6E2 !important; }

/* 下方信息区的说明文字：与规则条一样占满整行 */
.stage__caption {
  width: 100%;
  box-sizing: border-box;
  max-width: min(100%, 560px);
  margin: 0;
}
