/* 趣味连连看 · 卡通暖橙风格 */
:root {
  --orange: #FF8A3D;
  --orange-deep: #E96B19;
  --orange-soft: #FFE6D2;
  --cream: #FFF8EF;
  --ink: #4A3526;
  --muted: #A18873;
  --card: #FFFDF9;
  --line: #F2E2D3;
  --green: #4CB963;
  --red: #F05B52;
  --board-pad: 8px;
  --shadow-soft: 0 12px 30px rgba(171, 101, 43, 0.12);
}

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

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  color: var(--ink);
  background: #FBEFE1;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  overscroll-behavior: none;
}

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

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  opacity: 0;
}

.screen.is-active {
  display: flex;
  opacity: 1;
  animation: screenIn 0.28s ease both;
}

.mp-icon {
  flex: 0 0 auto;
}

/* ============ 开始界面 ============ */
.home {
  align-items: center;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 18px 22px;
  padding: calc(env(safe-area-inset-top) + 14px) 18px calc(env(safe-area-inset-bottom) + 22px);
  background:
    radial-gradient(100% 48% at 108% 0%, rgba(255, 205, 158, 0.78) 0%, rgba(255, 205, 158, 0) 62%),
    radial-gradient(90% 42% at -12% 24%, rgba(255, 226, 190, 0.9) 0%, rgba(255, 226, 190, 0) 58%),
    linear-gradient(180deg, #FFF6EA 0%, #FFF1E0 52%, #FFE8D1 100%);
}

.home::before,
.home::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

.home::before {
  width: 250px;
  height: 250px;
  top: -110px;
  right: -90px;
  background: radial-gradient(circle, rgba(255, 190, 130, 0.55) 0%, rgba(255, 190, 130, 0) 70%);
}

.home::after {
  width: 280px;
  height: 280px;
  bottom: -150px;
  left: -120px;
  background: radial-gradient(circle, rgba(255, 204, 160, 0.45) 0%, rgba(255, 204, 160, 0) 70%);
}

.home > * {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
}

.home-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.home-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  color: #99663B;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 4px 14px rgba(171, 101, 43, 0.08);
}

.home-badge .mp-icon {
  width: 16px;
  height: 16px;
  color: #F5A623;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.94);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  color: #B5763F;
  box-shadow: 0 4px 12px rgba(171, 101, 43, 0.1);
  transition: transform 0.12s ease, background 0.12s ease;
}

.icon-btn:active {
  transform: scale(0.93);
  background: #FFF0E1;
}

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

.icon-btn-sm {
  width: 38px;
  height: 38px;
}

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

.home-hero {
  position: relative;
  padding: 24px 0 4px;
  text-align: center;
}

.home-hero::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 46%;
  width: 310px;
  height: 250px;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse, rgba(255, 197, 135, 0.38) 0%, rgba(255, 197, 135, 0) 68%);
  pointer-events: none;
  z-index: -1;
}

.tile-cluster {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 58px;
  margin: 0 0 12px;
}

.cluster-tile {
  display: grid;
  place-items: center;
  width: 47px;
  height: 47px;
  margin: 0 -2px;
  border: 2px solid #FFFFFF;
  border-radius: 14px;
  box-shadow: 0 5px 0 var(--cluster-edge, #EFD3B8), 0 9px 16px rgba(170, 95, 35, 0.14);
  animation: bob 3.6s ease-in-out infinite;
}

.cluster-tile .mp-icon {
  width: 25px;
  height: 25px;
}

.cluster-tile.c1 {
  z-index: 2;
  color: #F0702A;
  background: #FFE9D8;
  --cluster-edge: #F5CFB0;
  transform: rotate(-13deg);
}

.cluster-tile.c2 {
  z-index: 3;
  color: #E05786;
  background: #FFE6EF;
  --cluster-edge: #F4C9D8;
  transform: rotate(-4deg) translateY(-4px);
  animation-delay: 0.25s;
}

.cluster-tile.c3 {
  z-index: 4;
  color: #D99A00;
  background: #FFF5CC;
  --cluster-edge: #EBD79B;
  transform: rotate(5deg);
  animation-delay: 0.5s;
}

.cluster-tile.c4 {
  z-index: 2;
  color: #3E9B58;
  background: #E5F6E6;
  --cluster-edge: #C8E5CC;
  transform: rotate(14deg) translateY(-2px);
  animation-delay: 0.75s;
}

.eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 0 8px;
  color: #BE8A5B;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.eyebrow span {
  display: block;
  width: 18px;
  height: 1px;
  background: #E7B98E;
}

.logo {
  position: relative;
  margin: 0;
  color: #FFF9F1;
  font-size: clamp(39px, 12.2vw, 54px);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 0.015em;
  text-shadow:
    -2px -2px 0 #ED7A24,
    2px -2px 0 #ED7A24,
    -2px 2px 0 #ED7A24,
    2px 2px 0 #ED7A24,
    0 3px 0 #ED7A24,
    0 7px 0 #E06A16,
    0 11px 0 #CF5D0D,
    0 17px 24px rgba(196, 88, 12, 0.26);
}

.tagline {
  margin: 20px 0 0;
  color: #8C6A4F;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.6;
}

.btn-start {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  max-width: 360px;
  height: 62px;
  margin: 20px auto 0;
  border: 2px solid #FFBC7C;
  border-radius: 22px;
  background: linear-gradient(180deg, #FFA552 0%, #FF7A1F 100%);
  color: #FFFFFF;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 0 rgba(196, 85, 7, 0.35);
  box-shadow: 0 6px 0 #D96116, 0 14px 26px rgba(224, 105, 22, 0.32), inset 0 2px 0 rgba(255, 255, 255, 0.45);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn-start::after {
  content: "";
  position: absolute;
  inset: 2px 2px auto;
  height: 42%;
  border-radius: 18px 18px 40% 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.btn-start {
  position: relative;
  overflow: hidden;
}

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

.btn-start:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #D96116, 0 6px 12px rgba(224, 105, 22, 0.26);
}

.home-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 100%;
  max-width: 420px;
  margin: 18px auto 0;
  padding: 10px 0;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 19px;
  background: rgba(255, 255, 255, 0.5);
}

.stat {
  position: relative;
  text-align: center;
}

.stat + .stat::before {
  content: "";
  position: absolute;
  left: 0;
  top: 16%;
  width: 1px;
  height: 68%;
  background: rgba(213, 172, 134, 0.42);
}

.stat b {
  display: block;
  color: #6A452A;
  font-size: 18px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat span {
  display: block;
  margin-top: 3px;
  color: #A98A6F;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.rules-card {
  width: 100%;
  max-width: 420px;
  margin: 18px auto 0;
  padding: 16px 16px 14px;
  border: 1px solid rgba(255, 255, 255, 0.96);
  border-radius: 24px;
  background: rgba(255, 252, 247, 0.86);
  box-shadow: var(--shadow-soft);
}

.rules-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 3px;
}

.rules-head h2 {
  margin: 0;
  color: #5A3C26;
  font-size: 15px;
  font-weight: 900;
}

.rules-head span {
  color: #B69B84;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.rule {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 0;
}

.rule + .rule {
  border-top: 1px dashed #F1E3D5;
}

.rule-num {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 27px;
  height: 27px;
  border-radius: 9px;
  background: #FFE8D5;
  color: #E8701E;
  font-size: 12px;
  font-weight: 900;
}

.rule-text b {
  display: block;
  color: #5D402B;
  font-size: 13.5px;
  font-weight: 800;
  line-height: 1.3;
}

.rule-text small {
  display: block;
  margin-top: 2px;
  color: #A28A76;
  font-size: 11px;
  line-height: 1.4;
}

.rule-note {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: #FFF0DF;
  color: #BB6820;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}

.rule-note-soft {
  background: #FFF6E8;
  color: #A5794A;
}

.rule-note-soft .mp-icon {
  color: #F2A44E;
}

.rule-note .mp-icon {
  width: 15px;
  height: 15px;
  color: #F08A2E;
}

.home-foot {
  margin: 13px auto 0;
  color: #B0947C;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: center;
}

/* ============ 游戏界面 ============ */
.game {
  align-items: center;
  overflow: hidden;
  padding: 10px 16px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px calc(env(safe-area-inset-bottom) + 10px);
  background:
    radial-gradient(100% 36% at 50% 0%, rgba(255, 217, 182, 0.95) 0%, rgba(255, 217, 182, 0) 70%),
    radial-gradient(70% 30% at 100% 60%, rgba(255, 218, 184, 0.55) 0%, rgba(255, 218, 184, 0) 70%),
    linear-gradient(180deg, #FFF6EA 0%, #FFF0DF 58%, #FFE7D1 100%);
}

.game::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 36%;
  width: 120vw;
  height: 52vh;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse, rgba(255, 196, 138, 0.22) 0%, rgba(255, 196, 138, 0) 70%);
  pointer-events: none;
}

.game > * {
  position: relative;
  z-index: 1;
}

.game-hud {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.level-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  flex: 0 0 auto;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.96);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
  color: #98745A;
  font-size: 10px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(171, 101, 43, 0.08);
}

.level-chip b {
  color: #E8701E;
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
}

.level-chip em {
  margin-left: 3px;
  padding: 2px 5px;
  border-radius: 6px;
  background: #FFF2E4;
  color: #B59176;
  font-size: 9px;
  font-style: normal;
  font-weight: 700;
}

.score-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 92px;
  justify-content: center;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.96);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
  color: #B18459;
  font-size: 10px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(171, 101, 43, 0.08);
  transition: transform 0.12s ease;
}

.score-chip.bump {
  animation: scoreBump 0.32s ease;
}

.score-chip .mp-icon {
  width: 15px;
  height: 15px;
  color: #F5A623;
}

.score-chip b {
  color: #5D402B;
  font-size: 17px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.combo-tag {
  display: none;
  margin-left: 2px;
  padding: 2px 5px;
  border-radius: 6px;
  background: #FFE4C6;
  color: #E0661A;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.combo-tag.show {
  display: inline-block;
  animation: tagPop 0.26s ease;
}

.timer-line {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
}

.timer-line > .mp-icon {
  width: 15px;
  height: 15px;
  color: #B07C50;
}

.timer-track {
  flex: 1;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #F2DFCC;
  box-shadow: inset 0 1px 2px rgba(150, 95, 50, 0.12);
}

.timer-fill {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #FFB35F 0%, #FF8A3D 100%);
  box-shadow: 0 0 8px rgba(255, 138, 61, 0.4);
  transition: width 0.2s linear, background 0.2s ease;
}

.timer-fill.low {
  background: linear-gradient(90deg, #FF9A82 0%, #F05046 100%);
  animation: lowPulse 0.8s ease-in-out infinite alternate;
}

.timer-text {
  flex: 0 0 auto;
  min-width: 42px;
  color: #7B5A3F;
  font-size: 12px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-align: right;
  letter-spacing: 0.02em;
}

.remain-text {
  flex: 0 0 auto;
  color: #A88A70;
  font-size: 9.5px;
  font-weight: 700;
  white-space: nowrap;
}

.remain-text b {
  color: #E8701E;
  font-size: 12px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.timer-text.low {
  color: #D9483F;
}

.board-shell {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 500px;
  min-height: 0;
  padding: 24px 12px 10px;
}

.board {
  position: relative;
  width: min(100%, 60vh, 460px);
  aspect-ratio: 1 / 1;
  padding: var(--board-pad);
  border: 3px solid #FFE0C2;
  border-radius: 24px;
  background: linear-gradient(180deg, #FFFAF2 0%, #FFF1DF 100%);
  box-shadow:
    0 10px 0 #F0D2B5,
    0 20px 30px rgba(171, 101, 43, 0.16),
    inset 0 2px 0 #FFFFFF;
}

.board.intro {
  animation: boardIn 0.42s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}

.board-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--cols, 6), 1fr);
  gap: clamp(3px, 1.2vw, 6px);
  width: 100%;
  height: 100%;
}

.cell {
  position: relative;
  min-width: 0;
  aspect-ratio: 1 / 1;
}

.tile {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.94);
  border-radius: clamp(8px, 2.5vw, 13px);
  background: var(--tile-bg, #FFF0E3);
  color: var(--tile-fg, #F0702A);
  box-shadow:
    0 3px 0 var(--tile-edge, #F7D3B6),
    0 5px 9px rgba(120, 70, 30, 0.1),
    inset 0 2px 0 rgba(255, 255, 255, 0.72);
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
  will-change: transform;
}

.tile::after {
  content: "";
  position: absolute;
  inset: 2px 2px auto;
  height: 38%;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.tile .mp-icon {
  width: 58%;
  height: 58%;
  max-width: 33px;
  max-height: 33px;
  pointer-events: none;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.55));
}

.tile:active {
  transform: translateY(2px);
  box-shadow:
    0 1px 0 var(--tile-edge, #F7D3B6),
    0 3px 6px rgba(120, 70, 30, 0.1),
    inset 0 2px 0 rgba(255, 255, 255, 0.72);
}

.tile.selected {
  z-index: 4;
  border-color: #FF8A3D;
  box-shadow:
    0 0 0 3px rgba(255, 138, 61, 0.36),
    0 4px 0 var(--tile-edge, #F7D3B6),
    0 9px 16px rgba(226, 105, 24, 0.28);
  animation: selectedBreath 0.72s ease-in-out infinite alternate;
}

.tile.hinted {
  z-index: 3;
  animation: hintPulse 0.62s ease-in-out infinite alternate;
}

.tile.clearing {
  z-index: 5;
  pointer-events: none;
  animation: tilePop 0.28s ease-out forwards;
}

.tile.shake {
  animation: tileShake 0.34s ease;
}

.board-grid.shuffling .tile {
  animation: tileFlip 0.36s ease;
}

.line-layer {
  position: absolute;
  left: var(--board-pad);
  top: var(--board-pad);
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  overflow: visible;
  pointer-events: none;
  z-index: 8;
  opacity: 1;
  transition: opacity 0.18s ease;
}

.line-layer .path-halo {
  fill: none;
  stroke: #FFFFFF;
  stroke-width: 9;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.95;
}

.line-layer .path-core {
  fill: none;
  stroke: #FF7A1F;
  stroke-width: 4.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 4px rgba(224, 100, 20, 0.35));
}

.line-layer .path-dot {
  fill: #FFFFFF;
  stroke: #FF7A1F;
  stroke-width: 2.5;
}

.gain-pop {
  position: absolute;
  z-index: 12;
  transform: translate(-50%, -50%);
  color: #E8671A;
  font-size: 19px;
  font-weight: 900;
  pointer-events: none;
  text-shadow: 0 2px 0 #FFFFFF, 0 0 12px #FFFFFF;
  animation: gainUp 0.75s ease-out forwards;
}

.game-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  width: 100%;
  max-width: 480px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 10px 12px;
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.82);
  text-align: left;
  box-shadow: 0 5px 0 #EFD4BA, 0 9px 16px rgba(171, 101, 43, 0.09);
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.15s ease;
}

.action-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #EFD4BA, 0 4px 9px rgba(171, 101, 43, 0.08);
}

.action-btn.is-empty {
  opacity: 0.48;
  filter: saturate(0.45);
}

.action-btn:disabled {
  opacity: 0.42;
  pointer-events: none;
}

.action-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: #FFF0E1;
  color: #EF7A25;
}

.action-icon .mp-icon {
  width: 20px;
  height: 20px;
}

.action-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.action-text b {
  color: #5B3D28;
  font-size: 13.5px;
  font-weight: 900;
  line-height: 1.2;
}

.action-text small {
  margin-top: 2px;
  overflow: hidden;
  color: #AB8E76;
  font-size: 9px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.game-tip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  margin: 8px 0 0;
  color: #AC8E74;
  font-size: 10px;
  font-weight: 600;
  text-align: center;
}

.game-tip .mp-icon {
  width: 13px;
  height: 13px;
  color: #C7A78B;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 104px;
  bottom: calc(env(safe-area-inset-bottom) + 104px);
  z-index: 20;
  max-width: 84vw;
  padding: 9px 15px;
  border-radius: 999px;
  background: rgba(66, 45, 30, 0.91);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  box-shadow: 0 8px 24px rgba(70, 40, 15, 0.2);
}

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

/* ============ 结算弹层 ============ */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(64, 39, 20, 0.5);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.overlay.show {
  display: flex;
  animation: fadeIn 0.2s ease both;
}

.confetti-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti {
  position: absolute;
  top: -18px;
  display: block;
  border-radius: 2px;
  opacity: 0.9;
  animation-name: confettiFall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

.result-card {
  position: relative;
  width: 100%;
  max-width: 344px;
  max-height: 90dvh;
  padding: 28px 22px 20px;
  border: 3px solid #FFFFFF;
  border-radius: 28px;
  background: linear-gradient(180deg, #FFFDF9 0%, #FFF6EA 100%);
  box-shadow: 0 24px 60px rgba(84, 45, 12, 0.35), inset 0 2px 0 #FFFFFF;
  text-align: center;
  animation: cardPop 0.38s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

.result-badge {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: -58px auto 8px;
  border: 4px solid #FFFFFF;
  border-radius: 50%;
  background: linear-gradient(180deg, #FFD98A 0%, #FFB13B 100%);
  color: #FFFFFF;
  box-shadow: 0 8px 0 #E89418, 0 12px 22px rgba(210, 120, 20, 0.3);
}

.result-badge .mp-icon {
  width: 38px;
  height: 38px;
  filter: drop-shadow(0 2px 0 rgba(180, 100, 10, 0.3));
}

.result-card.is-fail .result-badge {
  background: linear-gradient(180deg, #FFB4A8 0%, #F47564 100%);
  box-shadow: 0 8px 0 #D9584A, 0 12px 22px rgba(190, 75, 58, 0.28);
}

.result-kicker {
  margin: 2px 0 5px;
  color: #B18F74;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.result-title {
  margin: 0;
  color: #5A3820;
  font-size: 27px;
  font-weight: 900;
  line-height: 1.2;
}

.result-desc {
  margin: 8px 0 15px;
  color: #9B826D;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 17px;
  padding: 12px 5px;
  border: 1px solid #FFE2C8;
  border-radius: 18px;
  background: #FFF1E2;
}

.result-stats > div {
  position: relative;
}

.result-stats > div + div::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12%;
  width: 1px;
  height: 76%;
  background: #F1D7BD;
}

.result-stats b {
  display: block;
  color: #E8701E;
  font-size: 18px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.result-stats span {
  display: block;
  margin-top: 3px;
  color: #A88A70;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 50px;
  border: 1.5px solid #FFB97A;
  border-radius: 16px;
  background: linear-gradient(180deg, #FFA251 0%, #FF7A1F 100%);
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.03em;
  text-shadow: 0 2px 0 rgba(196, 85, 7, 0.3);
  box-shadow: 0 5px 0 #D96116, 0 10px 20px rgba(220, 100, 20, 0.28);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn-primary:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #D96116, 0 5px 12px rgba(220, 100, 20, 0.2);
}

.btn-ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  border-radius: 14px;
  color: #9A7A60;
  font-size: 13px;
  font-weight: 800;
  transition: background 0.12s ease;
}

.btn-ghost:active {
  background: #FFF0E2;
}

.new-best {
  position: absolute;
  top: 15px;
  right: -9px;
  z-index: 3;
  padding: 5px 9px;
  border-radius: 9px 9px 9px 2px;
  background: linear-gradient(180deg, #FF6E5F 0%, #ED4A3A 100%);
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
  opacity: 0;
  transform: rotate(-7deg) scale(0.75);
  box-shadow: 0 4px 10px rgba(210, 65, 50, 0.28);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.new-best.show {
  opacity: 1;
  transform: rotate(-7deg) scale(1);
  animation: bestPop 0.4s cubic-bezier(0.2, 1.5, 0.4, 1);
}

/* ============ 动画 ============ */
@keyframes screenIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes bob {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -5px; }
}

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

@keyframes tagPop {
  0% { transform: scale(0.7); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes lowPulse {
  from { box-shadow: 0 0 4px rgba(240, 80, 70, 0.25); }
  to { box-shadow: 0 0 12px rgba(240, 80, 70, 0.6); }
}

@keyframes boardIn {
  from { opacity: 0.35; }
  to { opacity: 1; }
}

@keyframes selectedBreath {
  from { transform: translateY(-2px) scale(1.02); }
  to { transform: translateY(-2px) scale(1.065); }
}

@keyframes hintPulse {
  from {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(59, 125, 216, 0.9), 0 3px 0 var(--tile-edge, #F7D3B6);
  }
  to {
    transform: scale(1.055);
    box-shadow: 0 0 0 6px rgba(59, 125, 216, 0), 0 3px 0 var(--tile-edge, #F7D3B6);
  }
}

@keyframes tilePop {
  0% { transform: scale(1); opacity: 1; }
  45% { transform: scale(1.18) rotate(4deg); opacity: 1; }
  100% { transform: scale(0.2) rotate(-12deg); opacity: 0; }
}

@keyframes tileShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px) rotate(-2deg); }
  45% { transform: translateX(4px) rotate(2deg); }
  70% { transform: translateX(-2px); }
}

@keyframes tileFlip {
  0% { transform: rotateY(0deg); }
  50% { transform: rotateY(90deg) scale(0.9); }
  100% { transform: rotateY(0deg); }
}

@keyframes drawLine {
  from { stroke-dashoffset: 100; }
  to { stroke-dashoffset: 0; }
}

@keyframes gainUp {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.8); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -165%) scale(1.1); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes cardPop {
  from { opacity: 0; transform: translateY(16px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes bestPop {
  0% { transform: rotate(-7deg) scale(0.6); }
  70% { transform: rotate(-7deg) scale(1.12); }
  100% { transform: rotate(-7deg) scale(1); }
}

@keyframes confettiFall {
  0% { opacity: 0; transform: translateY(-10px) rotate(0deg); }
  8% { opacity: 1; }
  100% { opacity: 0; transform: translateY(108vh) rotate(540deg); }
}

/* ============ 适配 ============ */
@media (max-height: 660px) {
  .home-hero {
    padding-top: 14px;
  }

  .tile-cluster {
    height: 50px;
    margin-bottom: 7px;
  }

  .cluster-tile {
    width: 41px;
    height: 41px;
  }

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

  .logo {
    font-size: clamp(35px, 10.5vw, 46px);
  }

  .tagline {
    margin-top: 14px;
    font-size: 12px;
  }

  .btn-start {
    height: 56px;
    margin-top: 15px;
    font-size: 18px;
  }

  .home-stats {
    margin-top: 14px;
  }

  .rules-card {
    margin-top: 14px;
  }

  .game-tip {
    display: none;
  }

  .board-shell {
    padding: 10px 12px 6px;
  }

  .game-actions {
    padding-bottom: 2px;
  }
}

@media (max-height: 560px) {
  .rules-card {
    display: none;
  }

  .home-foot {
    margin-top: 10px;
  }
}

@media (max-width: 350px) {
  .combo-tag {
    display: none !important;
  }
}

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