*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --orange: #FF8A3D;
  --orange-deep: #E86A12;
  --orange-dark: #B84B07;
  --cream: #FFF7EA;
  --ink: #4C2A16;
  --muted: #A07153;
  --board-size: clamp(228px, min(94vw, 400px, calc(100dvh - 334px)), 400px);
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  background:
    radial-gradient(circle at 18% 5%, rgba(255, 255, 255, .92), rgba(255, 255, 255, 0) 27%),
    radial-gradient(circle at 88% 13%, rgba(255, 138, 61, .2), transparent 31%),
    linear-gradient(180deg, #FFD8A5 0%, #FFF0DB 36%, #FFE6C8 68%, #FFD5AA 100%);
  color: var(--ink);
  font-family: ui-rounded, -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button {
  border: 0;
  margin: 0;
  padding: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 3px solid #7A3A0E;
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ---------- 背景氛围 ---------- */

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.sun {
  position: absolute;
  top: -120px;
  right: -70px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, #FFF3C4 0%, #FFDC88 38%, rgba(255, 214, 130, 0) 70%);
  opacity: .9;
}

.cloud {
  position: absolute;
  height: 38px;
  width: 112px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .5);
  filter: blur(.4px);
  animation: cloudDrift 16s ease-in-out infinite alternate;
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  background: inherit;
  border-radius: 50%;
}

.cloud::before {
  width: 54px;
  height: 54px;
  left: 18px;
  bottom: 4px;
}

.cloud::after {
  width: 38px;
  height: 38px;
  right: 16px;
  bottom: 8px;
}

.cloud-a {
  top: 104px;
  left: -34px;
  opacity: .52;
}

.cloud-b {
  top: 188px;
  right: -46px;
  transform: scale(.72);
  opacity: .38;
  animation-delay: -6s;
}

.cloud-c {
  top: 350px;
  left: 58%;
  transform: scale(.52);
  opacity: .3;
  animation-delay: -11s;
}

.hill {
  position: absolute;
  bottom: -190px;
  border-radius: 50%;
}

.hill-a {
  width: 460px;
  height: 360px;
  left: -150px;
  background: linear-gradient(180deg, rgba(255, 184, 115, .8), rgba(255, 158, 81, .8));
}

.hill-b {
  width: 400px;
  height: 310px;
  right: -160px;
  background: linear-gradient(180deg, rgba(255, 202, 143, .85), rgba(255, 174, 101, .85));
}

.spark {
  position: absolute;
  width: 10px;
  height: 10px;
  background: rgba(255, 255, 255, .88);
  clip-path: polygon(50% 0%, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0% 50%, 39% 39%);
  animation: twinkle 3.6s ease-in-out infinite;
}

.spark-a {
  top: 146px;
  left: 11%;
}

.spark-b {
  top: 70px;
  right: 22%;
  animation-delay: -1.2s;
  transform: scale(.7);
}

.spark-c {
  top: 300px;
  right: 9%;
  animation-delay: -2.3s;
  transform: scale(1.2);
}

/* ---------- 主容器：竖屏铺满，无标题栏 ---------- */

.app {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  justify-content: center;
}

.game-shell {
  width: 100%;
  max-width: 440px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding:
    calc(env(safe-area-inset-top, 0px) + 8px)
    14px
    calc(env(safe-area-inset-bottom, 0px) + 10px);
  display: flex;
  flex-direction: column;
}

/* ---------- 顶部 HUD ---------- */

.hud-top {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
}

.level-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #FFA65C, #FF7A1E);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .01em;
  text-shadow: 0 1px 0 rgba(120, 50, 0, .22);
  box-shadow: 0 3px 0 #C95308, 0 5px 12px rgba(200, 90, 10, .22);
}

.level-chip .mp-icon {
  width: 16px;
  height: 16px;
}

.best-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .7);
  border: 1.5px solid rgba(255, 255, 255, .92);
  font-size: 12px;
  font-weight: 700;
  color: #9A6B4C;
  box-shadow: 0 2px 0 rgba(200, 130, 70, .14);
}

.best-chip .mp-icon {
  width: 16px;
  height: 16px;
  color: #F3A712;
}

.best-chip strong {
  color: #6B3A1C;
  font-weight: 900;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.icon-btn {
  margin-left: auto;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .72);
  border: 1.5px solid rgba(255, 255, 255, .92);
  box-shadow: 0 2px 0 rgba(200, 130, 70, .18);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9A5A2E;
}

.icon-btn:active {
  transform: translateY(1px);
}

.icon-btn .mp-icon {
  width: 22px;
  height: 22px;
}

/* ---------- 分数 / 步数 ---------- */

.score-panel {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-top: 8px;
  padding: 11px 12px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255, 255, 255, .95), rgba(255, 247, 236, .95));
  border: 2px solid rgba(255, 255, 255, .96);
  box-shadow: 0 4px 0 rgba(226, 150, 83, .24), 0 12px 24px rgba(170, 89, 28, .12);
}

.score-main {
  flex: 1;
  min-width: 0;
}

.score-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.score-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .13em;
  color: #B07A55;
}

.level-target {
  font-size: 11px;
  font-weight: 700;
  color: #A07153;
  white-space: nowrap;
}

.level-target strong {
  color: var(--orange-deep);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.score-value {
  margin-top: 1px;
  font-size: 34px;
  line-height: 1.05;
  font-weight: 950;
  letter-spacing: -.03em;
  color: #5A2D13;
  font-variant-numeric: tabular-nums;
  transform-origin: left center;
}

.score-value.bump {
  animation: scoreBump .3s ease;
}

.progress-track {
  height: 8px;
  margin-top: 7px;
  border-radius: 999px;
  background: #FFE3C9;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(160, 80, 20, .14);
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #FFB15C, #FF8A3D 60%, #F46B12);
  box-shadow: 0 0 8px rgba(255, 138, 61, .55);
  transition: width .35s ease;
}

.steps-card {
  flex: 0 0 76px;
  width: 76px;
  border-radius: 17px;
  background: linear-gradient(180deg, #FFF2DF, #FFE0BC);
  border: 1.5px solid rgba(255, 255, 255, .92);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .86);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.steps-value {
  font-size: 30px;
  line-height: 1;
  font-weight: 950;
  color: var(--orange-deep);
  font-variant-numeric: tabular-nums;
  transform-origin: center;
}

.steps-value.bump {
  animation: stepBump .3s ease;
}

.steps-label {
  margin-top: 4px;
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: .04em;
}

.steps-card.low {
  background: linear-gradient(180deg, #FFE0DE, #FFC6C2);
}

.steps-card.low .steps-value {
  color: #D8342E;
  animation: heartBeat 1s ease-in-out infinite;
}

/* ---------- 棋盘 ---------- */

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

.board-wrap {
  position: relative;
  width: var(--board-size);
  aspect-ratio: 1 / 1;
  flex: 0 0 auto;
}

.board {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 3px;
  padding: 8px;
  border-radius: 26px;
  background: linear-gradient(180deg, #FFDDB8, #FFC997);
  border: 3px solid #FFF9F0;
  box-shadow:
    0 5px 0 #E89952,
    0 18px 30px rgba(146, 68, 8, .22),
    inset 0 2px 10px rgba(255, 255, 255, .65);
}

.board.tool-active .cell {
  cursor: crosshair;
}

.cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, .34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
  transition: background .15s ease;
}

.cell.alt {
  background: rgba(255, 255, 255, .18);
}

.tile {
  position: absolute;
  inset: 2px;
  border-radius: 13px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(155deg, #FFF3F4, #FFD4D9);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, .95),
    inset 0 -2px 0 rgba(0, 0, 0, .06),
    0 3px 0 var(--edge, #D95B70),
    0 5px 8px rgba(96, 42, 0, .14);
  transition: transform .12s ease, box-shadow .12s ease;
  will-change: transform;
}

.tile::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 7px;
  right: 7px;
  height: 32%;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, .7), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.cell[data-color="red"] .tile {
  --edge: #D95B70;
  background: linear-gradient(155deg, #FFF2F3, #FFD4DA);
}

.cell[data-color="blue"] .tile {
  --edge: #3B6FC4;
  background: linear-gradient(155deg, #EFF7FF, #C9DEFF);
}

.cell[data-color="green"] .tile {
  --edge: #4F9E45;
  background: linear-gradient(155deg, #F0FFED, #CFF0C8);
}

.cell[data-color="yellow"] .tile {
  --edge: #D9AC2E;
  background: linear-gradient(155deg, #FFFDF0, #FFEBA8);
}

.cell[data-color="purple"] .tile {
  --edge: #7A4CB4;
  background: linear-gradient(155deg, #F9F2FF, #E2CDF9);
}

.cell[data-color="orange"] .tile {
  --edge: #E0782D;
  background: linear-gradient(155deg, #FFF7EC, #FFD6B1);
}

.tile-art {
  display: block;
  width: 84%;
  height: 84%;
  filter: drop-shadow(0 2px 1px rgba(80, 30, 0, .18));
  pointer-events: none;
}

.cell:active .tile {
  transform: scale(.93);
}

.cell.selected .tile {
  transform: translateY(-3px) scale(1.06);
  box-shadow:
    0 0 0 2px #FFF,
    0 0 0 5px var(--orange),
    0 8px 12px rgba(130, 55, 5, .24);
}

.cell.hint .tile {
  animation: hintBounce .72s ease-in-out infinite;
  box-shadow:
    0 0 0 2px #FFF,
    0 0 0 5px #FFD166,
    0 6px 10px rgba(130, 55, 5, .2);
}

.cell.matched .tile {
  animation: tilePop .28s ease-in forwards;
}

.cell.blast .tile {
  animation: tileBlast .24s ease-out forwards;
}

.cell.invalid .tile {
  animation: tileInvalid .34s ease;
}

.cell.falling .tile {
  animation: tileDrop .3s cubic-bezier(.2, .8, .3, 1) both;
  animation-delay: var(--fall-delay, 0ms);
}

.board.shuffling .cell {
  transform: scale(.55) rotate(16deg);
  opacity: .3;
  transition: transform .2s ease, opacity .2s ease;
}

/* ---------- 特效层 ---------- */

.effect-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow: visible;
  pointer-events: none;
}

.particle {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 5px rgba(255, 255, 255, .8);
  animation: particleFly .62s ease-out forwards;
}

.score-pop {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%);
  color: #FFF;
  font-size: 20px;
  font-weight: 950;
  letter-spacing: -.02em;
  white-space: nowrap;
  text-shadow: 0 2px 0 #E45700, 0 0 12px rgba(255, 138, 61, .9);
  animation: scoreFloat .82s ease-out forwards;
}

.score-pop.combo {
  font-size: 25px;
}

.shockwave {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 42px;
  height: 42px;
  margin: -21px 0 0 -21px;
  border: 3px solid #FFD166;
  border-radius: 50%;
  animation: shockwave .5s ease-out forwards;
}

.combo-fx {
  position: absolute;
  left: 50%;
  top: 45%;
  z-index: 5;
  transform: translate(-50%, -50%) scale(.65);
  opacity: 0;
  color: #FFF;
  font-size: 34px;
  font-weight: 950;
  letter-spacing: -.03em;
  white-space: nowrap;
  pointer-events: none;
  text-shadow:
    0 3px 0 #D85300,
    0 0 18px rgba(255, 138, 61, .95),
    0 0 34px rgba(255, 210, 100, .7);
}

.combo-fx.show {
  animation: comboPop .76s cubic-bezier(.2, .9, .3, 1) both;
}

.combo-fx[data-tier="2"] {
  font-size: 38px;
  text-shadow: 0 3px 0 #C13C00, 0 0 20px rgba(255, 170, 40, .95);
}

.combo-fx[data-tier="3"] {
  font-size: 42px;
  color: #FFF7C7;
  text-shadow: 0 3px 0 #D85300, 0 0 24px rgba(255, 100, 20, .95);
}

.board-wrap.shake {
  animation: boardShake .38s ease-in-out;
}

.board-wrap.blast::after {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: 6;
  border-radius: 28px;
  background: radial-gradient(circle, rgba(255, 245, 180, .95), rgba(255, 138, 61, .28) 45%, transparent 72%);
  animation: blastFlash .34s ease-out forwards;
  pointer-events: none;
}

/* ---------- 状态文案 ---------- */

.status-line {
  min-height: 22px;
  margin: 2px 0 6px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .01em;
  color: #96613D;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
}

.status-line.flash {
  animation: statusFlash .3s ease;
}

/* ---------- 底部道具 ---------- */

.dock {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 2px;
}

.tool-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.tool-btn {
  position: relative;
  min-height: 58px;
  padding: 7px 10px 7px 8px;
  border-radius: 18px;
  background: linear-gradient(160deg, #FFFDF8, #FFF0DC);
  border: 2px solid #FFF;
  box-shadow: 0 3px 0 rgba(216, 124, 47, .35), 0 8px 16px rgba(150, 75, 20, .1);
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  color: #6B3210;
}

.tool-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(216, 124, 47, .35), 0 4px 8px rgba(150, 75, 20, .1);
}

.tool-btn.active {
  background: linear-gradient(160deg, #FFB36B, #FF7A1E);
  border-color: #FFE1C2;
  color: #FFF;
  box-shadow: 0 3px 0 #C65A0C, 0 9px 20px rgba(220, 100, 20, .3);
}

.tool-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .58);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .06);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-btn.active .tool-icon {
  background: rgba(255, 255, 255, .24);
}

.tool-icon svg {
  width: 32px;
  height: 32px;
}

.tool-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.1;
}

.tool-text b {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: .02em;
}

.tool-text small {
  margin-top: 3px;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.tool-btn.active .tool-text small {
  color: rgba(255, 255, 255, .82);
}

.badge {
  position: absolute;
  top: -7px;
  right: -3px;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 12px;
  border: 2px solid var(--cream);
  background: #4A2A18;
  color: #FFF;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .18);
}

.tool-btn.is-empty {
  opacity: .6;
}

.tool-btn.is-empty .badge {
  background: #C9A78D;
}

.aux-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.aux-btn {
  min-height: 44px;
  border-radius: 15px;
  background: rgba(255, 255, 255, .68);
  border: 2px solid rgba(255, 255, 255, .92);
  box-shadow: 0 2px 0 rgba(216, 124, 47, .2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #7A4A2A;
  font-size: 14px;
  font-weight: 900;
}

.aux-btn:active {
  transform: translateY(1px);
}

.aux-btn .mp-icon {
  width: 20px;
  height: 20px;
  color: var(--orange-deep);
}

/* ---------- 轻提示 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 146px);
  z-index: 60;
  max-width: min(86vw, 340px);
  padding: 9px 15px;
  border-radius: 999px;
  background: rgba(58, 30, 12, .88);
  color: #FFF8EE;
  font-size: 12.5px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- 结算弹层 ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  padding: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(65, 31, 8, .58);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  opacity: 0;
  transition: opacity .2s ease;
}

.modal.open .modal-backdrop {
  opacity: 1;
}

.modal-card {
  position: relative;
  width: min(89vw, 360px);
  padding: 24px 20px 20px;
  border-radius: 26px;
  border: 3px solid #FFF;
  background: linear-gradient(180deg, #FFFCF5, #FFF0DD);
  text-align: center;
  box-shadow: 0 18px 50px rgba(60, 25, 0, .4), inset 0 2px 0 #FFF;
  transform: translateY(14px) scale(.94);
  opacity: 0;
  transition: transform .26s cubic-bezier(.2, .9, .3, 1), opacity .2s ease;
  overflow: hidden;
}

.modal.open .modal-card {
  transform: none;
  opacity: 1;
}

.modal-glow {
  position: absolute;
  top: -110px;
  left: 50%;
  width: 260px;
  height: 220px;
  margin-left: -130px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 190, 90, .55), rgba(255, 190, 90, 0) 70%);
  pointer-events: none;
}

.modal-icon {
  position: relative;
  width: 58px;
  height: 58px;
  margin: 0 auto 8px;
  border-radius: 20px;
  background: linear-gradient(160deg, #FFB56D, #FF7A1E);
  box-shadow: 0 4px 0 #CE5B0B, 0 8px 18px rgba(220, 100, 20, .3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFF;
}

.modal-icon .mp-icon {
  width: 32px;
  height: 32px;
}

.modal-kicker {
  position: relative;
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: .18em;
  color: #C17A38;
}

.modal-card h2 {
  position: relative;
  margin: 5px 0 4px;
  font-size: 22px;
  font-weight: 950;
  letter-spacing: -.02em;
  color: #5A2D13;
}

.modal-card > p {
  position: relative;
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--muted);
}

.modal-stats {
  position: relative;
  margin-top: 14px;
  padding: 10px 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, .66);
  border: 1.5px solid #FFF;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.modal-stats > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.modal-stats > div + div {
  border-left: 1px solid rgba(180, 115, 55, .16);
}

.modal-stats span {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  color: #B07A55;
}

.modal-stats strong {
  font-size: 22px;
  font-weight: 950;
  color: #E26712;
  font-variant-numeric: tabular-nums;
}

.reward-row {
  position: relative;
  margin-top: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.reward-row span {
  padding: 5px 10px;
  border-radius: 999px;
  background: #FFF2D9;
  border: 1.5px solid #FFD79A;
  color: #B45A0A;
  font-size: 11.5px;
  font-weight: 900;
}

.primary-btn {
  position: relative;
  width: 100%;
  min-height: 50px;
  margin-top: 16px;
  border-radius: 17px;
  background: linear-gradient(180deg, #FFA65C, #FF7A1E);
  color: #FFF;
  font-size: 16px;
  font-weight: 950;
  letter-spacing: .02em;
  box-shadow: 0 4px 0 #C95308, 0 10px 20px rgba(220, 100, 20, .28);
  text-shadow: 0 1px 0 rgba(120, 50, 0, .2);
}

.primary-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #C95308, 0 4px 8px rgba(220, 100, 20, .2);
}

/* ---------- 动画 ---------- */

@keyframes cloudDrift {
  from { transform: translateX(-8px); }
  to { transform: translateX(18px); }
}

@keyframes twinkle {
  0%, 100% { opacity: .35; transform: scale(.7) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.15) rotate(18deg); }
}

@keyframes scoreBump {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

@keyframes stepBump {
  0% { transform: scale(1); }
  40% { transform: scale(1.28); }
  100% { transform: scale(1); }
}

@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  35% { transform: scale(1.12); }
  60% { transform: scale(1); }
}

@keyframes hintBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-4px) scale(1.05); }
}

@keyframes tilePop {
  0% { transform: scale(1) rotate(0deg); opacity: 1; filter: brightness(1); }
  38% { transform: scale(1.2) rotate(5deg); opacity: 1; filter: brightness(1.35); }
  100% { transform: scale(.18) rotate(18deg); opacity: 0; filter: brightness(1.6); }
}

@keyframes tileBlast {
  0% { transform: scale(1); opacity: 1; }
  35% { transform: scale(1.3); opacity: 1; filter: brightness(1.8); }
  100% { transform: scale(0) rotate(30deg); opacity: 0; }
}

@keyframes tileInvalid {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px) rotate(-2deg); }
  55% { transform: translateX(4px) rotate(2deg); }
  80% { transform: translateX(-2px); }
}

@keyframes tileDrop {
  0% { transform: translateY(-32px) scale(.68); opacity: 0; }
  70% { transform: translateY(2px) scale(1.02); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes particleFly {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% {
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.08);
    opacity: 0;
  }
}

@keyframes scoreFloat {
  0% { transform: translate(-50%, -50%) scale(.7); opacity: 0; }
  20% { transform: translate(-50%, -70%) scale(1.08); opacity: 1; }
  100% { transform: translate(-50%, -170%) scale(1); opacity: 0; }
}

@keyframes shockwave {
  0% { transform: scale(.2); opacity: .95; }
  100% { transform: scale(2.2); opacity: 0; }
}

@keyframes comboPop {
  0% { transform: translate(-50%, -50%) scale(.45) rotate(-7deg); opacity: 0; }
  18% { transform: translate(-50%, -50%) scale(1.16) rotate(2deg); opacity: 1; }
  50% { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
  100% { transform: translate(-50%, -75%) scale(1.14) rotate(0deg); opacity: 0; }
}

@keyframes boardShake {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  15% { transform: translate(-4px, 2px) rotate(-.5deg); }
  32% { transform: translate(4px, -2px) rotate(.5deg); }
  50% { transform: translate(-3px, 1px) rotate(-.3deg); }
  70% { transform: translate(2px, -1px) rotate(.3deg); }
  85% { transform: translate(-1px, 1px); }
}

@keyframes blastFlash {
  0% { opacity: .95; }
  100% { opacity: 0; }
}

@keyframes statusFlash {
  0% { opacity: .4; transform: translateY(2px); }
  100% { opacity: 1; transform: none; }
}

/* ---------- 小屏适配 ---------- */

@media (max-height: 700px) {
  :root {
    --board-size: clamp(220px, min(94vw, 400px, calc(100dvh - 310px)), 400px);
  }

  .score-value {
    font-size: 30px;
  }

  .tool-btn {
    min-height: 52px;
  }

  .tool-text small {
    display: none;
  }

  .aux-btn {
    min-height: 40px;
  }

  .status-line {
    margin-bottom: 4px;
  }

  .toast {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 126px);
  }
}

@media (max-width: 354px) {
  .game-shell {
    padding-left: 10px;
    padding-right: 10px;
  }

  .best-chip span {
    display: none;
  }

  .tool-text b {
    font-size: 14px;
  }

  .tool-icon {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .tool-icon svg {
    width: 28px;
    height: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
