/* =====================================================================
   帮古诗找朋友 · 诗笺棋盘
   - 棋盘的造型是一张「诗笺」：米色纸面、淡淡的竖行格线、四角压角
   - 字牌按书写顺序排：一句一行，从左到右
   - 一句点齐后这一行的牌转成竹青色，并亮出「一句」小印
   - 整首拼完，全诗一起亮出来（里程碑式反馈）
   ===================================================================== */

/* ============================ 棋盘外壳 ============================ */

.poem-shell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 760px);
  padding: clamp(8px, 1.7vmin, 16px);
  background:
    /* 极淡的竖行格线：像信笺，也帮玩家把「一句」和「一列」对上 */
    repeating-linear-gradient(90deg,
      transparent 0,
      transparent calc(100% / var(--cols, 5) - 1px),
      rgba(90, 74, 58, 0.055) calc(100% / var(--cols, 5) - 1px),
      rgba(90, 74, 58, 0.055) calc(100% / var(--cols, 5))),
    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;
}

/* 诗笺四角的压角：很小的装饰，不参与命中 */
.poem-shell::before,
.poem-shell::after {
  content: '';
  position: absolute;
  width: clamp(14px, 2.4vmin, 22px);
  height: clamp(14px, 2.4vmin, 22px);
  border: 2.5px solid rgba(90, 74, 58, 0.28);
  border-radius: 4px;
  pointer-events: none;
}
.poem-shell::before {
  left: clamp(6px, 1.2vmin, 11px);
  top: clamp(6px, 1.2vmin, 11px);
  border-right: none;
  border-bottom: none;
}
.poem-shell::after {
  right: clamp(6px, 1.2vmin, 11px);
  bottom: clamp(6px, 1.2vmin, 11px);
  border-left: none;
  border-top: none;
}

.poem-board {
  flex: 0 0 auto;
  align-self: flex-start;
  --cols: 5;
  --rows: 4;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows), minmax(0, 1fr));
  gap: clamp(3px, 0.8vmin, 8px);
  width: 100%;
  aspect-ratio: calc(var(--cols) / var(--rows));
}

/* ============================ 字牌 ============================ */

.poem-tile {
  position: relative;
  display: block;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: none;
  background: none;
  border-radius: clamp(8px, 1.9vmin, 14px);
  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);
}

.poem-tile__face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  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;
}

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

.poem-tile__ch {
  font-family: "Kaiti SC", Kaiti, STKaiti, "Songti SC", "Noto Serif SC", serif;
  font-size: min(62cqh, 62cqw, 86px);
  font-weight: 700;
  line-height: 1;
  color: var(--ink-tile);
  transform: translateY(3%);
}

/* 位置号：点进来的字标出它在这一句里的位置，一眼看出还差哪个字 */
.poem-tile.is-seated::after, .poem-tile.is-placed::after {
  content: attr(data-seat);
  position: absolute;
  left: clamp(2px, 5cqh, 6px);
  top: clamp(2px, 5cqh, 6px);
  min-width: 1.4em;
  padding: 0 clamp(2px, 3.5cqw, 5px);
  border-radius: 999px;
  background: var(--mint-deep);
  color: #fff;
  font-family: var(--font-num);
  font-size: min(12cqh, 12cqw, 12px);
  font-weight: 800;
  line-height: 1.45;
  text-align: center;
  box-shadow: 0 1.5px 0 var(--ink);
  z-index: 2;
  pointer-events: none;
}

/* 已坐下：抬高、描一圈竹青，字略收一点给位置号让位 */
.poem-tile.is-seated,
.poem-tile.is-placed {
  z-index: 3;
  transform: translateY(-3px) scale(1.03);
  background: #FDF6E4 !important;
  box-shadow: 0 0 0 3px var(--mint-deep);
}
.poem-tile.is-seated .poem-tile__ch,
.poem-tile.is-placed .poem-tile__ch { font-size: min(54cqh, 54cqw, 86px); transform: translateY(-5%); }

/* 凑齐一句：整组一起消掉（和成语版「四个字凑齐就消失」一致）
   消散动画只负责过程，隐藏由后面的静态规则兜底：
   连续消句时新动画的 animation-delay 会打断上一次动画，
   牌会停在动画初始帧（opacity:1），结算时字集体「回魂」。 */
.poem-tile.is-gone {
  pointer-events: none;
  animation: poemGone 0.42s var(--ease-soft) forwards;
  animation-delay: var(--pop-delay, 0s);
}
@keyframes poemGone {
  0%   { opacity: 1; transform: scale(1.06); }
  55%  { opacity: 1; transform: scale(1.12); }
  100% { opacity: 0; transform: scale(0.72); }
}

/* 消掉的格子留一枚浅浅的虚线空位，像被收拾干净的桌面，
   而不是一个突兀的洞；也方便小朋友记住这里已经找过了 */
.poem-tile.is-gone .poem-tile__face {
  box-shadow: none;
  border-color: transparent;
  background: transparent;
}
.poem-tile.is-gone .poem-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);
}
.poem-tile.is-gone .poem-tile__ch { opacity: 0; }

/* 已消牌必须绝对隐藏，不能只靠动画的 forwards 终态
   （见上面注释：连续消句会打断动画）。 */
.poem-tile.is-gone {
  opacity: 0 !important;
  visibility: hidden !important;
}

/* 提示：整句一起呼吸 */
.poem-tile.is-hint {
  z-index: 4;
  animation: poemHintLift 1.1s var(--ease-soft) infinite;
}
.poem-tile.is-hint .poem-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.34);
}
/* 提示里「该点的这一张」再重一档 */
.poem-tile.is-hint-next .poem-tile__face {
  outline-color: var(--pumpkin-deep);
  box-shadow:
    inset 0 -4px 0 rgba(0, 0, 0, 0.10),
    0 0 0 8px rgba(224, 122, 63, 0.4),
    0 4px 0 rgba(90, 74, 58, 0.34);
}
@keyframes poemHintLift {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-6px) scale(1.03); }
}
@media (prefers-reduced-motion: reduce) {
  .poem-tile.is-hint { animation: none; }
}

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

.poem-tile:focus-visible .poem-tile__face {
  outline: 3px dashed var(--pumpkin);
  outline-offset: 2px;
}
@media (hover: hover) {
  .poem-tile:not(.is-gone):hover .poem-tile__face { transform: translateY(-2px); }
}

/* 全诗拼完：还在盘上的牌一起欢呼 */
.poem-board.is-cleared .poem-tile { animation: poemCheer 0.6s var(--ease-bounce); }
.poem-board.is-bump { animation: poemBump 0.36s var(--ease-soft); }
@keyframes poemBump {
  0%, 100% { transform: translateY(0); }
  40%      { transform: translateY(3px); }
}
@keyframes poemCheer {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-7px); }
}

/* 消除时在棋盘中央亮出整句 */
.poem-line-pop {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 20;
  transform: translate(-50%, -50%);
  padding: 8px 22px 10px;
  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: "Kaiti SC", Kaiti, STKaiti, serif;
  font-size: clamp(22px, 4vmin, 40px);
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
  animation: poemLinePop 1.05s var(--ease-bounce) forwards;
}
@keyframes poemLinePop {
  0%   { opacity: 0; transform: translate(-50%, -40%) scale(0.6) rotate(-4deg); }
  26%  { opacity: 1; transform: translate(-50%, -50%) scale(1.08) rotate(1.5deg); }
  60%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -62%) scale(0.96); }
}

/* ============================ 诗题 ============================ */

.poem-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 4px 10px;
  margin: 0;
  max-width: min(100%, 760px);
  text-align: center;
}
.poem-head__title {
  font-family: "Kaiti SC", Kaiti, STKaiti, serif;
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: .04em;
}
.poem-head__meta {
  font-family: var(--font-hand);
  font-size: var(--fs-xs);
  color: var(--ink-soft);
}

/* ============================ 句子提示卡 ============================ */

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

.line-card {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: clamp(3px, 0.8vmin, 6px);
  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);
}
/* 尚未开局：卡片照常占住高度（visibility 隐藏而非 display:none），
   棋盘尺寸从开局起就按「有提示框」算好，点牌后不再跳动 */
.line-card.is-off { visibility: hidden; }
.line-card.is-full {
  background: #FFF4DD;
  border-color: var(--mint-deep);
}
.line-card__no {
  flex: 0 0 auto;
  font-family: var(--font-hand);
  font-size: var(--fs-xs);
  color: var(--ink-soft);
  white-space: nowrap;
}
.line-card__mask {
  /* 占满「第 N 句」标签之外的全部宽度：五个字 / 七个字都摊开，
     格子宽高比接近正方形，字才不像挤在一条缝里 */
  flex: 1 1 auto;
  display: flex;
  flex-wrap: nowrap;
  justify-content: stretch;
  gap: clamp(3px, 0.8vmin, 6px);
  min-width: 0;
  overflow: hidden;
}

.line-card__ch {
  flex: 1 1 0;
  min-width: 0;
  display: inline-grid;
  place-items: center;
  box-sizing: border-box;
  height: clamp(32px, 7.2vmin, 52px);
  border-radius: 10px;
  border: 2px dashed rgba(90, 74, 58, 0.28);
  background: rgba(255, 253, 247, 0.7);
  font-family: "Kaiti SC", Kaiti, STKaiti, serif;
  font-size: clamp(18px, 3.9vmin, 30px);
  font-weight: 700;
  color: var(--ink-faint);
}
.line-card__ch.is-filled {
  border: 2px solid var(--ink);
  border-style: solid;
  background: #DCEEE1;
  color: #35684A;
  box-shadow: 0 2px 0 rgba(90, 74, 58, 0.22);
}
.line-card__ch.is-next {
  border-color: var(--pumpkin);
  background: #FFF3E4;
  color: var(--pumpkin-deep);
}
.line-card__ch.is-filled + .line-card__ch { gap: 0; }

/* ============================ 反馈与规则 ============================ */

.poem-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);
}
.poem-feedback.is-ok { color: #4E9A6E; }
.poem-feedback.is-no { color: #C4576C; }
.poem-feedback.is-hint { color: var(--pumpkin-deep); font-weight: 700; }

.poem-rule {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 6px 10px;
  max-width: min(100%, 760px);
  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;
}
.poem-rule b { color: var(--pumpkin-deep); }
.poem-rule[hidden] { display: none; }

/* ============================ 全诗进度（侧栏） ============================ */

.line-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.line-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border: 2px solid rgba(90, 74, 58, 0.16);
  border-radius: 10px;
  background: rgba(255, 253, 247, 0.6);
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.line-item__no {
  font-family: var(--font-num);
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-faint);
}
.line-item__text {
  min-width: 0;
  font-family: "Kaiti SC", Kaiti, STKaiti, serif;
  font-size: var(--fs-sm);
  color: var(--ink-faint);
  letter-spacing: .06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 正在拼的这一句：换成深墨 */
.line-item.is-current {
  border-color: var(--pumpkin);
  background: #FFF3E4;
}
.line-item.is-current .line-item__text { color: var(--ink); }
.line-item.is-current .line-item__no { color: var(--pumpkin-deep); }
/* 拼好的这一句：竹青 */
.line-item.is-done {
  border-color: #4E9A6E;
  background: #DCEEE1;
}
.line-item.is-done .line-item__text { color: #35684A; }
.line-item.is-done .line-item__no { color: #35684A; }
/* 还没轮到的句子不剧透正文，只显示字数 */
.line-item:not(.is-done):not(.is-current) .line-item__text { opacity: .55; }

/* 窄屏进度点：一行小圆点，替代整张句子列表 */
.line-pips {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 2px 0;
}
.line-pip {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(90, 74, 58, 0.24);
  background: rgba(255, 253, 247, 0.7);
  transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast);
}
.line-pip.is-current {
  border-color: var(--pumpkin);
  background: #FFF3E4;
  transform: scale(1.18);
}
.line-pip.is-done {
  border-color: #4E9A6E;
  background: #7CC398;
}

/* ============================ 结算：全诗回顾 ============================ */

.review__poem {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 253, 247, 0.75);
  border: 2px dashed rgba(90, 74, 58, 0.2);
  font-family: "Kaiti SC", Kaiti, STKaiti, serif;
  font-size: var(--fs-sm);
  line-height: 1.85;
  color: var(--ink);
  text-align: center;
  letter-spacing: .04em;
}
.review__poem b { color: #35684A; }

/* ============================ 响应式：棋盘优先 ============================ */

@media (max-width: 859px) {
  /* 单列时操作面板在棋盘下方：句子列表换成一行进度点，把高度让给棋盘 */
  .line-list { display: none; }
  .line-pips { display: flex; }
  /* 面板压成「一行进度点 + 一行按钮」 */
  .side-card { padding: 8px 10px; gap: 7px; }
  .side-card__head { display: none; }
  .seg { padding: 3px; }
  .seg__btn { min-height: 38px; font-size: var(--fs-xs); }
  .side-actions .btn { min-height: 42px; padding: 6px 8px; font-size: var(--fs-xs); }
  .hint--play { display: none; }
}

@media (max-width: 760px) {
  /* 窄屏：反馈并入规则条，单独的反馈行收掉 */
  .poem-feedback { display: none; }
  .poem-rule__inline { display: inline; }
  .poem-rule__inline.is-ok { color: #4E9A6E; }
  .poem-rule__inline.is-no { color: #C4576C; }
  .poem-rule__inline.is-hint { color: var(--pumpkin-deep); font-weight: 700; }
  /* 规则条在窄屏压成两行：它是说明，不该跟棋盘抢高度 */
  .poem-rule {
    padding: 4px 8px;
    font-size: 11px;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }
  .poem-shell { box-shadow: 0 5px 0 var(--paper-deep), 0 7px 0 var(--ink), var(--shadow-soft); }
  .poem-tile__ch { font-size: min(58cqh, 58cqw, 64px); }
  .poem-feedback { font-size: var(--fs-sm); }
  .poem-head__title { font-size: var(--fs-md); }
}

@media (max-width: 400px) {
  .poem-head__title { font-size: var(--fs-md); }
  .poem-head__meta { font-size: 11px; }
  .line-card__ch { height: clamp(28px, 7.2vw, 38px); }
}

/* 矮屏：先把诗题、说明、反馈这些「可省的字」收掉，棋盘不吃亏 */
@media (max-height: 820px) {
  .poem-rule { font-size: 11px; padding: 4px 8px; }
  .poem-feedback { font-size: var(--fs-xs); min-height: 1.2em; }
  .poem-head__meta { display: none; }
  /* 侧栏句子列表在矮屏会顶出版心：压成紧凑两行式，超出的可内部滚动 */
  .line-list { gap: 3px; max-height: 40vh; overflow: auto; }
  .line-item { padding: 2px 7px; }
}

@media (max-height: 660px) {
  .poem-head { display: none; }
  .poem-feedback { display: none; }
  .poem-rule { padding: 3px 8px; font-size: 11px; line-height: 1.4; border-width: 1.5px; }
  .line-card__ch { height: clamp(24px, 4.6vmin, 32px); font-size: clamp(14px, 2.8vmin, 19px); }
  .stage { gap: 5px; }
}

/* 矮横屏：规则条压成一行（内容仍完整，超出用省略号），把高度还给棋盘 */
@media (max-height: 560px) and (orientation: landscape) {
  .poem-rule {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 3px 8px;
    font-size: 10.5px;
    line-height: 1.4;
    min-height: 0;
  }
}

/* 极矮横屏（568×320 一类）：规则条收起，页面留白压到最小 */
@media (max-height: 380px) {
  .screen--play { padding-top: 2px; padding-bottom: 2px; }
  .play-grid { gap: 6px; }
  .poem-feedback { display: none; }
  /* 提示卡与规则条：极矮时把规则条收进「玩法说明」，只留提示卡 */
  .line-panel { gap: 2px; }
  .line-card { padding: 2px 5px; border-width: 2px; border-radius: 9px; }
  .line-card__ch { height: 20px; font-size: 13px; }
  .poem-rule { display: none; }
  .side-card { padding: 5px 6px; gap: 4px; border-width: 2px; }
  .side-actions .btn { min-height: 30px; font-size: 11px; }
  .seg__btn { min-height: 30px; font-size: 11px; }
  .stats { gap: 4px; }
  .stat { padding: 2px 4px 3px; border-width: 2px; }
  .stat__value { font-size: 16px; }
  .stat__label { font-size: 10px; }
}
@media (max-height: 380px) {
  .poem-rule {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    margin-top: 2px;
    padding: 2px 6px;
    font-size: 10px;
    line-height: 1.3;
    border-width: 1.5px;
    border-radius: 8px;
  }
  .stage { position: relative; }
  .poem-shell { margin-bottom: 24px; }
}

/* =====================================================================
   封面：诗笺风格的插画与标题
   ===================================================================== */

.hero__art svg { overflow: visible; display: block; width: 100%; height: auto; }
/* 插画本身按内容比例（132×124）铺满卡片内部；卡片的尺寸由各断点决定 */
.hero__card { aspect-ratio: 132 / 124; }
.hero__card .hero__art { width: 100%; height: auto; }

@media (max-width: 760px) {
  /* 插画是封面唯一的「玩法示意」：手机上要给到能看清字的尺寸 */
  .screen--start .hero__card { width: min(250px, 62vw); }
  .screen--start .setup { gap: 9px; }
  .screen--start .setup__block { gap: 8px; padding: 11px; }
  .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; }
}

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

@media (max-width: 400px) {
  .screen--start .hero__card { width: min(190px, 50vw); padding: 8px; border-radius: 22px; }
  .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; }
}

@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(140px, 38vw); padding: 7px; border-radius: 18px; }
  .screen--start .app-title { font-size: clamp(27px, 8.6vw, 35px); }
  .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: 40px; padding: 3px 8px; }
  .screen--start .diff__name { font-size: 15px; }
  .screen--start .btn--lg { min-height: 48px; font-size: var(--fs-md); }
  /* 640 高的机器：把「共 N 首」那行收掉，只留难度名与尺寸 */
  .screen--start .diff__meta { display: none; }
}

/* 极窄竖屏（320×568 / 320×480）：封面再收紧一档，保证开始按钮在首屏 */
@media (max-width: 340px) and (orientation: portrait) {
  .screen--start { padding-top: 6px; padding-bottom: 8px; }
  .start-grid { gap: 8px; }
  .screen--start .hero__card { width: min(150px, 46vw); padding: 6px; border-radius: 16px; }
  .screen--start .app-title { font-size: clamp(24px, 8.4vw, 30px); }
  .screen--start .subtitle { display: none; }
  .screen--start .eyebrow { display: none; }
  .screen--start .setup { gap: 6px; }
  .screen--start .setup__label-note { display: none; }
  .screen--start .setup__block { padding: 7px; gap: 5px; }
  .screen--start .diff { min-height: 40px; padding: 4px 7px; }
  .screen--start .diff__meta { display: none; }
  .screen--start .diff__name small { display: block; }
  .screen--start .btn--lg { min-height: 46px; font-size: var(--fs-sm); }
  .screen--start .hint,
  .screen--start .fineprint { display: none; }
}

@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(190px, 26vw); 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 .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; }
}

@media (max-height: 360px) and (orientation: landscape) {
  .screen--start { padding-top: 4px !important; padding-bottom: 2px !important; }
  .screen--start .hero__card { width: min(132px, 19vw) !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 .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; }
}

/* 顶栏品牌名：6 个字比模板更长，窄屏缩一档避免截断 */
@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; }
}
