/* 开心消消乐4 — 竖屏三消 */
:root {
  --orange: #FF8A3D;
  --orange-deep: #E96218;
  --orange-soft: #FFB56F;
  --cream: #FFF9EE;
  --cream-2: #FFF1DA;
  --ink: #4A250B;
  --ink-2: #8E5A32;
  --ink-3: #B7865C;
  --line: rgba(175, 103, 42, 0.18);
  --shadow: 0 16px 40px rgba(135, 61, 12, 0.22);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: #FFB56F;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  overscroll-behavior: none;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
}

button, input { font: inherit; color: inherit; }
button { -webkit-user-select: none; user-select: none; cursor: pointer; }
button:focus-visible, input:focus-visible {
  outline: 3px solid rgba(255, 138, 61, 0.55);
  outline-offset: 2px;
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

/* ---------- 背景与页面骨架 ---------- */
.app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: var(--safe-top);
}

.bg-art {
  position: fixed;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}

.bg-wash {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(120% 55% at 50% 0%, rgba(255, 249, 232, 0.5), rgba(255, 249, 232, 0) 62%),
    linear-gradient(180deg, rgba(255, 244, 220, 0.16) 0%, rgba(255, 244, 220, 0) 38%, rgba(175, 74, 12, 0.13) 100%);
}

/* ---------- 顶部玩家条 ---------- */
.hud {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 472px;
  margin: 0 auto;
  padding: 8px 16px 4px;
}

.player {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
  height: 56px;
  padding: 7px 10px 7px 7px;
  border: 1.5px solid rgba(255, 255, 255, 0.82);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 253, 245, 0.92), rgba(255, 240, 217, 0.84));
  box-shadow: 0 8px 22px rgba(145, 66, 15, 0.16), inset 0 1px 0 #fff;
  text-align: left;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.player:active { transform: scale(0.975); box-shadow: 0 4px 12px rgba(145, 66, 15, 0.14); }

.avatar {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  background: #FFE3BC;
  box-shadow: 0 0 0 2px #fff, 0 4px 10px rgba(150, 70, 15, 0.18);
}
.avatar svg, .avatar img { width: 100%; height: 100%; display: block; object-fit: cover; }

.who { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.who .name {
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #572B0C;
}
.who .best { max-width: 100%; font-size: 10.5px; color: #A56D43; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who .best b { color: #E96218; font-weight: 800; font-variant-numeric: tabular-nums; }

.player .edit-dot {
  position: absolute;
  left: 34px;
  bottom: 4px;
  width: 15px;
  height: 15px;
  padding: 2px;
  border-radius: 50%;
  background: #FFF8EA;
  color: #D08340;
  box-shadow: 0 1px 4px rgba(130, 60, 12, 0.22);
}

.hud-right { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }

.coin-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 34px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(255, 252, 242, 0.86);
  border: 1.5px solid rgba(255, 255, 255, 0.86);
  box-shadow: 0 4px 12px rgba(145, 66, 15, 0.12);
  color: #B46216;
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.coin-chip .mp-icon { width: 15px; height: 15px; color: #FF9B2E; }
.coin-chip b { font-weight: 900; }

.hud-btn {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.84);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 253, 245, 0.92), rgba(255, 238, 212, 0.84));
  box-shadow: 0 6px 16px rgba(145, 66, 15, 0.14), inset 0 1px 0 #fff;
  color: #8A4A19;
  transition: transform 0.12s ease, background 0.12s ease;
}
.hud-btn .mp-icon { width: 19px; height: 19px; color: #E97626; }
.hud-btn span { font-size: 9px; font-weight: 800; letter-spacing: 0.02em; }
.hud-btn:active { transform: scale(0.94); background: #FFE6C6; }
.task-badge {
  position: absolute;
  top: -5px;
  right: -4px;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, #FFA950, #F06C1B);
  color: #fff;
  font-style: normal;
  font-size: 9px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(160, 60, 5, 0.32);
}
.task-badge.all-done { background: linear-gradient(180deg, #8ADF84, #42B85E); }

/* ---------- 主棋盘 ---------- */
.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  flex: 1 0 auto;
  padding: 4px 16px 0;
}

.game-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  padding: 14px 14px 10px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 28px;
  background: linear-gradient(180deg, #FFFDF7 0%, #FFF8EA 54%, #FFF1DC 100%);
  box-shadow: 0 22px 48px rgba(125, 52, 8, 0.26), 0 3px 0 rgba(255, 255, 255, 0.9) inset;
}
.game-card::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(217, 145, 81, 0.16);
  border-radius: 23px;
  pointer-events: none;
}

.game-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding: 1px 4px 8px;
}

.eyebrow {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #B07B52;
}

.score-line { display: flex; align-items: center; gap: 7px; margin-top: 1px; min-height: 36px; }
.score-line b {
  font-size: 38px;
  line-height: 0.92;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: #E96218;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 0 #fff, 0 5px 10px rgba(210, 103, 27, 0.18);
  transition: transform 0.12s ease;
}
.score-line b.bump { animation: scoreBump 0.24s ease; }

.combo-pill {
  display: none;
  align-items: center;
  height: 21px;
  padding: 0 7px;
  border-radius: 999px;
  background: linear-gradient(180deg, #FFA94E, #F26E1B);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 3px 8px rgba(190, 75, 8, 0.28);
}
.combo-pill.show { display: inline-flex; animation: comboPop 0.28s cubic-bezier(0.2, 1.4, 0.4, 1); }

.time-box { flex: 0 0 auto; text-align: right; padding-bottom: 1px; }
.time-label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #B07B52;
}
.time-label .mp-icon { width: 12px; height: 12px; color: #D58B4A; }
.time-box b {
  display: block;
  margin-top: 2px;
  font-size: 24px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0.01em;
  color: #572B0C;
  font-variant-numeric: tabular-nums;
}
.time-box.urgent b { color: #E0392E; animation: urgentPulse 0.9s ease-in-out infinite; }

.time-track {
  height: 7px;
  margin: 0 4px 11px;
  border-radius: 999px;
  background: #FFE3C2;
  box-shadow: inset 0 1px 2px rgba(160, 88, 32, 0.2);
  overflow: hidden;
}
.time-track span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #FFC15C, #FF932E 55%, #FF6D24);
  box-shadow: 0 0 8px rgba(255, 138, 61, 0.5);
  transition: width 0.2s linear;
}
.time-track.urgent span { background: linear-gradient(90deg, #FF9C7C, #F04437); }

/* 棋盘本体 */
.board {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 8px;
  border-radius: 22px;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(255, 244, 222, 0.5), rgba(255, 244, 222, 0) 60%),
    linear-gradient(180deg, #F7D5AA, #EFB87F);
  box-shadow:
    inset 0 3px 10px rgba(146, 75, 22, 0.22),
    inset 0 -2px 0 rgba(255, 255, 255, 0.38),
    0 6px 16px rgba(143, 70, 18, 0.14);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
}

@supports not (aspect-ratio: 1 / 1) {
  .board { height: auto; }
  .board::after { content: ""; display: block; padding-top: 100%; }
}

.cells, .tiles, .fx {
  position: absolute;
  inset: 8px;
}
.cells {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(181, 102, 40, 0.12);
}
.cell { position: relative; padding: 2px; }
.cell::after {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 9px;
  background: rgba(255, 247, 231, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), inset 0 -1px 0 rgba(171, 95, 35, 0.1);
}
.cell.alt::after { background: rgba(255, 238, 211, 0.44); }

.tiles { z-index: 2; }
.fx { z-index: 6; pointer-events: none; overflow: hidden; border-radius: 14px; }

.tile {
  position: absolute;
  top: 0;
  left: 0;
  width: 12.5%;
  height: 12.5%;
  padding: 2.5px;
  transform: translate(calc(var(--c) * 100%), calc(var(--r) * 100%));
  transition: transform 0.17s cubic-bezier(0.25, 0.85, 0.35, 1);
  will-change: transform;
}
.tile-inner {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 31%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.34));
  box-shadow:
    0 2px 3px rgba(121, 57, 12, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.15s ease;
}
.tile-base {
  position: absolute;
  inset: 6%;
  border-radius: 32%;
  background: var(--tint, radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.46), rgba(255, 255, 255, 0) 72%));
}
.tile svg.candy {
  position: relative;
  width: 82%;
  height: 82%;
  display: block;
  filter: drop-shadow(0 2px 1.5px rgba(105, 47, 8, 0.26));
  transition: transform 0.12s ease;
}

.tile[data-type="0"] .tile-inner { background: linear-gradient(180deg, #FFF2F1, #FFD9D8); }
.tile[data-type="1"] .tile-inner { background: linear-gradient(180deg, #FFF7E8, #FFE2BD); }
.tile[data-type="2"] .tile-inner { background: linear-gradient(180deg, #FFFCE9, #FFEFB0); }
.tile[data-type="3"] .tile-inner { background: linear-gradient(180deg, #F1FBEE, #D5F0CF); }
.tile[data-type="4"] .tile-inner { background: linear-gradient(180deg, #EEF8FF, #CCE7FB); }
.tile[data-type="5"] .tile-inner { background: linear-gradient(180deg, #F7F1FF, #E1D2FA); }

.tile.is-selected { z-index: 4; }
.tile.is-selected .tile-inner {
  transform: scale(1.07);
  box-shadow:
    0 0 0 2.5px #FF8A3D,
    0 0 0 6px rgba(255, 255, 255, 0.85),
    0 7px 14px rgba(140, 62, 10, 0.3);
}
.tile.is-selected .tile-inner::after {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 36%;
  border: 2px solid rgba(255, 138, 61, 0.45);
  animation: selectRing 1s ease-out infinite;
}

.tile.is-invalid { animation: tileShake 0.3s ease; }
.tile.is-hint .tile-inner { animation: hintBounce 0.72s cubic-bezier(0.3, 1.4, 0.5, 1) infinite; }
.tile.deal .tile-inner {
  animation: tileDeal 0.34s cubic-bezier(0.2, 1.3, 0.4, 1) both;
  animation-delay: calc((var(--r) + var(--c)) * 13ms);
}
.tile.is-clearing { z-index: 5; }
.tile.is-clearing .tile-inner { animation: tilePop 0.26s ease forwards; }
.tile.is-clearing svg.candy { animation: candyPop 0.26s ease forwards; }

.float-score {
  position: absolute;
  z-index: 3;
  transform: translate(-50%, -50%);
  color: #FFFDF4;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.01em;
  text-shadow: 0 2px 0 #C95414, 0 4px 8px rgba(120, 45, 5, 0.35);
  animation: floatScore 0.86s ease-out forwards;
  pointer-events: none;
  white-space: nowrap;
}
.float-score.big { font-size: 18px; }

.combo-burst {
  position: absolute;
  left: 50%;
  top: 38%;
  z-index: 4;
  transform: translate(-50%, -50%);
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #FFB158, #F36A17);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.06em;
  box-shadow: 0 6px 0 #C0510E, 0 10px 22px rgba(160, 62, 5, 0.32);
  animation: comboBurst 0.95s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
  pointer-events: none;
  white-space: nowrap;
}

.spark {
  position: absolute;
  z-index: 3;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sc, #FFD45E);
  transform: translate(-50%, -50%);
  animation: sparkFly 0.48s ease-out forwards;
  pointer-events: none;
}

/* 棋盘上的开始 / 结束层 */
.board-overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10px;
  border-radius: 22px;
  background: rgba(96, 44, 8, 0.16);
  backdrop-filter: blur(2.5px);
  -webkit-backdrop-filter: blur(2.5px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scrollbar-width: none;
  animation: overlayIn 0.24s ease;
}
.board-overlay::-webkit-scrollbar { display: none; }

.start-card {
  flex: 0 0 auto;
  width: 94%;
  max-width: 330px;
  margin: auto;
  padding: 15px 14px 16px;
  text-align: center;
  border: 1.5px solid rgba(255, 255, 255, 0.92);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 253, 247, 0.98), rgba(255, 243, 224, 0.98));
  box-shadow: 0 18px 38px rgba(104, 44, 6, 0.26), inset 0 1px 0 #fff;
}
.logo {
  display: block;
  width: 92%;
  max-width: 312px;
  height: auto;
  margin: 0 auto 6px;
  filter: drop-shadow(0 6px 10px rgba(160, 70, 12, 0.16));
}
.start-card .lead {
  margin: 0 auto 12px;
  max-width: 250px;
  color: #8A4E24;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.55;
}
.feature-chips {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 15px;
}
.feature-chips span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 25px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(216, 143, 78, 0.22);
  color: #A26433;
  font-size: 10.5px;
  font-weight: 700;
}
.feature-chips .mp-icon { width: 13px; height: 13px; color: #EF852F; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  padding: 0 22px;
  border: 0;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.02em;
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.1s ease;
}
.btn .mp-icon { width: 19px; height: 19px; }
.btn.primary {
  color: #fff;
  background: linear-gradient(180deg, #FFB257 0%, #FF8A3D 46%, #F3701D 100%);
  box-shadow: 0 6px 0 #C95710, 0 12px 20px rgba(188, 75, 9, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.46);
  text-shadow: 0 1px 0 rgba(157, 55, 3, 0.3);
}
.btn.primary:active { transform: translateY(4px); box-shadow: 0 2px 0 #C95710, 0 5px 10px rgba(188, 75, 9, 0.24); }
.btn.big { min-width: 176px; height: 50px; font-size: 17px; border-radius: 18px; }
.btn.ghost {
  color: #9A5B2B;
  background: #FFF6E6;
  border: 1.5px solid #EBC79D;
  box-shadow: 0 4px 0 rgba(197, 133, 73, 0.18);
}
.btn.ghost:active { transform: translateY(2px); box-shadow: none; }
.btn:disabled { filter: grayscale(0.25); opacity: 0.55; pointer-events: none; }

.end-overlay { background: rgba(96, 44, 8, 0.18); }
.end-card {
  flex: 0 0 auto;
  width: 94%;
  max-width: 306px;
  margin: auto;
  padding: 14px 14px 12px;
  text-align: center;
  border: 1.5px solid rgba(255, 255, 255, 0.92);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 253, 247, 0.98), rgba(255, 242, 222, 0.98));
  box-shadow: 0 18px 38px rgba(104, 44, 6, 0.26), inset 0 1px 0 #fff;
}
.end-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin-bottom: 3px;
  border-radius: 14px;
  background: linear-gradient(180deg, #FFE2AF, #FFC46B);
  color: #D06515;
  box-shadow: 0 5px 12px rgba(170, 82, 16, 0.18), inset 0 1px 0 #fff;
}
.end-badge .mp-icon { width: 23px; height: 23px; }
.end-badge.record { background: linear-gradient(180deg, #FFF3B8, #FFCF47); color: #C07800; }
.end-card h2 {
  margin: 3px 0 1px;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #5A2B0B;
}
.end-reason { margin: 0 0 8px; color: #A7744C; font-size: 11.5px; font-weight: 600; }
.result-score {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 7px 12px 8px;
  border-radius: 16px;
  background: linear-gradient(180deg, #FFFDF6, #FFF0D8);
  border: 1.5px solid rgba(235, 173, 111, 0.38);
  box-shadow: inset 0 1px 0 #fff;
}
.result-score span { font-size: 10.5px; font-weight: 700; color: #AC774D; letter-spacing: 0.1em; }
.result-score b {
  font-size: 34px;
  line-height: 1.05;
  color: #E96218;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.record-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin: 7px auto 0;
  height: 23px;
  padding: 0 9px;
  border-radius: 999px;
  background: linear-gradient(180deg, #FFD978, #FFB62F);
  color: #8A4A00;
  font-size: 10.5px;
  font-weight: 900;
  box-shadow: 0 3px 8px rgba(205, 126, 8, 0.24);
}
.record-chip .mp-icon { width: 13px; height: 13px; }
.result-best { margin: 7px 0 9px; font-size: 11px; color: #A7744C; }
.result-best b { color: #7C4317; font-weight: 800; }
.end-card .btn.primary { width: 100%; max-width: 230px; height: 44px; }
.text-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 7px;
  padding: 4px 8px;
  border: 0;
  background: transparent;
  color: #B06D3A;
  font-size: 11px;
  font-weight: 700;
}
.text-btn .mp-icon { width: 14px; height: 14px; }
.text-btn:active { opacity: 0.65; }

.game-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 6px 5px 0;
  color: #9E6E47;
  font-size: 11px;
  font-weight: 600;
}
.hint-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #FF8A3D;
  box-shadow: 0 0 0 4px rgba(255, 138, 61, 0.16);
  animation: hintPulse 2s ease-in-out infinite;
}
.foot-combo { margin-left: auto; color: #E96218; font-weight: 800; }



/* 今日任务条：不抢棋盘焦点，只做一次进度提醒 */
.daily-strip {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  max-width: 440px;
  min-height: 58px;
  margin-top: 12px;
  padding: 8px 10px 8px 9px;
  border: 1.5px solid rgba(255, 255, 255, 0.8);
  border-radius: 19px;
  background: linear-gradient(180deg, rgba(255, 253, 246, 0.9), rgba(255, 240, 218, 0.82));
  box-shadow: 0 10px 24px rgba(137, 62, 13, 0.16), inset 0 1px 0 #fff;
  text-align: left;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.12s ease, background 0.12s ease;
}
.daily-strip:active { transform: scale(0.985); background: #FFEFD7; }
.daily-ico {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(180deg, #FFE6B8, #FFD08A);
  color: #D06A13;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.daily-ico .mp-icon { width: 20px; height: 20px; }
.daily-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.daily-title { font-size: 12.5px; font-weight: 800; color: #5A2F0F; }
.daily-title b { color: #E96218; font-size: 11.5px; font-weight: 900; margin-left: 2px; }
.daily-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  color: #A07450;
  font-weight: 600;
}
.daily-reward {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 0 7px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 232, 195, 0.85);
  color: #C07120;
  font-size: 9.5px;
  font-weight: 800;
  white-space: nowrap;
}
.daily-reward .mp-icon { width: 12px; height: 12px; color: #F49A22; }
.daily-strip .daily-arrow { flex: 0 0 auto; width: 16px; height: 16px; color: #C7986E; }
.safe-foot { flex: 0 0 auto; height: calc(6px + var(--safe-bottom)); }

/* ---------- 底部弹层 ---------- */
.sheet-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s ease;
}
.sheet-layer.is-open { opacity: 1; pointer-events: auto; }

.scrim {
  position: absolute;
  inset: 0;
  background: rgba(74, 34, 6, 0.4);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.sheet {
  position: absolute;
  left: 50%;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(100%, 480px);
  max-height: 83vh;
  max-height: 83dvh;
  padding: 7px 18px calc(16px + var(--safe-bottom));
  border-radius: 28px 28px 0 0;
  background: linear-gradient(180deg, #FFFDF6, #FFF6E8);
  box-shadow: 0 -18px 44px rgba(93, 39, 4, 0.28);
  transform: translate(-50%, 102%);
  transition: transform 0.32s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.sheet-layer.is-open .sheet { transform: translate(-50%, 0); }

.sheet-grip {
  flex: 0 0 auto;
  width: 38px;
  height: 4px;
  margin: 0 auto 8px;
  border-radius: 999px;
  background: #E8C9A4;
}
.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 1px 1px 10px;
}
.sheet-head h2 { margin: 0; font-size: 21px; font-weight: 900; letter-spacing: 0.01em; color: #4A250B; }
.sheet-head p { margin: 3px 0 0; font-size: 11px; color: #A87850; font-weight: 600; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1.5px solid #EFD4B4;
  border-radius: 50%;
  background: #FFF8EA;
  color: #A9713F;
}
.icon-btn .mp-icon { width: 18px; height: 18px; }
.icon-btn:active { background: #FFEAC9; transform: scale(0.94); }

.rank-list, .task-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.rank-list::-webkit-scrollbar, .task-list::-webkit-scrollbar { display: none; }

.rank-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  margin-bottom: 8px;
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.72);
  border: 1.5px solid rgba(232, 197, 156, 0.5);
  box-shadow: 0 3px 9px rgba(147, 83, 30, 0.06);
}
.rank-row.top-1 { background: linear-gradient(100deg, #FFF6CF, #FFF0C0); border-color: #F1CF70; }
.rank-row.top-2 { background: linear-gradient(100deg, #F6F7F9, #EDF0F4); border-color: #D8DEE6; }
.rank-row.top-3 { background: linear-gradient(100deg, #FFF0E2, #FFE7D0); border-color: #EDC8A4; }
.rank-row.me {
  border-color: #FF9D52;
  box-shadow: 0 0 0 2px rgba(255, 138, 61, 0.22), 0 5px 14px rgba(164, 82, 21, 0.12);
}

.rank-no {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 27px;
  height: 27px;
  border-radius: 10px;
  color: #A4764D;
  font-size: 13px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.rank-no .mp-icon { width: 24px; height: 24px; }
.rank-row.top-1 .rank-no { color: #D79900; }
.rank-row.top-2 .rank-no { color: #92A1B4; }
.rank-row.top-3 .rank-no { color: #C98246; }

.rank-ava {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 39px;
  height: 39px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(145deg, var(--av1, #FFC07C), var(--av2, #F07A2A));
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  text-shadow: 0 1px 2px rgba(120, 45, 5, 0.24);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8), 0 3px 7px rgba(132, 64, 15, 0.18);
}
.rank-ava.has-face { background: #FFF3DE; }
.rank-ava svg, .rank-ava img { width: 100%; height: 100%; display: block; object-fit: cover; }
.rank-info { flex: 1 1 auto; min-width: 0; }
.rank-info b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 800;
  color: #59300F;
}
.rank-info span { display: block; margin-top: 1px; font-size: 10px; color: #A87B55; }
.rank-info .me-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 6px;
  background: #FF8A3D;
  color: #fff;
  font-size: 8.5px;
  font-style: normal;
  font-weight: 800;
  vertical-align: 1px;
}
.rank-score {
  flex: 0 0 auto;
  text-align: right;
  color: #E96218;
  font-size: 17px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.rank-score small { display: block; color: #B58963; font-size: 8.5px; font-weight: 700; letter-spacing: 0.04em; }

.rank-foot {
  flex: 0 0 auto;
  margin-top: 4px;
  padding: 11px 14px;
  border-radius: 16px;
  background: #FFF1DC;
  border: 1.5px solid rgba(235, 173, 111, 0.35);
  color: #9A653B;
  font-size: 11.5px;
  font-weight: 700;
  text-align: center;
}
.rank-foot b { color: #E96218; font-size: 15px; font-weight: 900; }
.rank-empty { padding: 24px 10px; text-align: center; color: #A87B55; font-size: 12px; }

/* 每日任务 */
.task-card {
  position: relative;
  padding: 12px 13px;
  margin-bottom: 10px;
  border-radius: 19px;
  background: rgba(255, 255, 255, 0.78);
  border: 1.5px solid rgba(232, 197, 156, 0.55);
  box-shadow: 0 4px 12px rgba(147, 83, 30, 0.06);
}
.task-card.done { border-color: #FFC989; background: linear-gradient(180deg, #FFFDF7, #FFF4DF); }
.task-card.claimed { opacity: 0.72; }
.task-top { display: flex; align-items: center; gap: 9px; }
.task-ico {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 37px;
  height: 37px;
  border-radius: 13px;
  background: linear-gradient(180deg, #FFE7BE, #FFD08A);
  color: #D46F17;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}
.task-ico .mp-icon { width: 20px; height: 20px; }
.task-info { flex: 1 1 auto; min-width: 0; }
.task-info b { display: block; font-size: 13.5px; font-weight: 800; color: #5A2F0F; line-height: 1.35; }
.task-info span { display: block; margin-top: 2px; font-size: 10px; color: #A87B55; }
.task-reward {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: #E96218;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}
.task-reward .mp-icon { width: 14px; height: 14px; color: #FFA12E; }

.task-progress { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.task-bar {
  flex: 1 1 auto;
  height: 7px;
  border-radius: 999px;
  background: #FFE5C7;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(160, 88, 32, 0.12);
}
.task-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #FFC15C, #FF8A3D);
  transition: width 0.3s ease;
}
.task-count { flex: 0 0 auto; min-width: 48px; text-align: right; font-size: 10px; color: #A87B55; font-weight: 700; font-variant-numeric: tabular-nums; }

.claim-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  min-width: 68px;
  padding: 0 9px;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(180deg, #FFB257, #F47C22);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  box-shadow: 0 3px 0 #C95812;
}
.claim-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #C95812; }
.claim-btn.done {
  background: #F2E2CC;
  color: #A97E56;
  box-shadow: none;
  pointer-events: none;
}
.claim-btn.wait { background: #F7E7D2; color: #B08962; box-shadow: none; pointer-events: none; }

.task-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 4px 0;
  border-top: 1px dashed rgba(196, 141, 86, 0.25);
  margin-top: 3px;
  font-size: 11px;
  color: #9A653B;
  font-weight: 700;
}
.task-foot-left { display: flex; align-items: center; gap: 5px; }
.task-foot-left b { color: #E96218; font-size: 15px; font-weight: 900; font-variant-numeric: tabular-nums; }
.coin-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: #FFE7BF;
  color: #E98A1B;
}
.coin-dot .mp-icon { width: 14px; height: 14px; }
.refresh-note { display: inline-flex; align-items: center; gap: 3px; color: #B18865; font-weight: 600; }
.refresh-note .mp-icon { width: 13px; height: 13px; }

/* ---------- 昵称弹窗 ---------- */
.dialog-layer {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.dialog-layer.is-open { opacity: 1; pointer-events: auto; }
.dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 340px);
  padding: 21px 20px 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, #FFFDF7, #FFF5E5);
  box-shadow: 0 24px 60px rgba(85, 36, 4, 0.34), inset 0 1px 0 #fff;
  transform: scale(0.94) translateY(8px);
  transition: transform 0.24s cubic-bezier(0.2, 1.2, 0.4, 1);
}
.dialog-layer.is-open .dialog { transform: none; }
.dialog h2 { margin: 0; font-size: 19px; font-weight: 900; color: #4A250B; }
.dialog p { margin: 4px 0 14px; font-size: 11.5px; color: #A87B55; }
.dialog input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border: 2px solid #EFD3B1;
  border-radius: 14px;
  background: #FFFDF8;
  color: #4A250B;
  font-size: 16px;
  font-weight: 700;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.dialog input:focus { border-color: #FF9B52; box-shadow: 0 0 0 4px rgba(255, 138, 61, 0.14); }
.dialog-actions { display: flex; gap: 9px; margin-top: 14px; }
.dialog-actions .btn { flex: 1 1 0; height: 42px; }

/* ---------- 提示与彩带 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-bottom));
  z-index: 90;
  max-width: 80vw;
  padding: 10px 17px;
  border-radius: 999px;
  background: rgba(73, 35, 8, 0.93);
  color: #FFF9EE;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 10px 26px rgba(50, 20, 2, 0.3);
  opacity: 0;
  transform: translate(-50%, 14px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.confetti { position: fixed; inset: 0; z-index: 80; pointer-events: none; overflow: hidden; }
.confetti i {
  position: absolute;
  top: -24px;
  width: 8px;
  height: 13px;
  border-radius: 3px;
  background: var(--cf, #FF8A3D);
  animation: confettiFall var(--dur, 1.8s) cubic-bezier(0.2, 0.6, 0.5, 1) forwards;
  animation-delay: var(--delay, 0s);
}

/* ---------- 动效 ---------- */
@keyframes scoreBump { 0% { transform: scale(1); } 38% { transform: scale(1.14); } 100% { transform: scale(1); } }
@keyframes comboPop { 0% { transform: scale(0.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes tileDeal {
  0% { transform: scale(0.5) translateY(-8px); opacity: 0; }
  60% { opacity: 1; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
@keyframes hintBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  35% { transform: translateY(-3px) scale(1.06); }
  70% { transform: translateY(0) scale(1); }
}
@keyframes coinBump { 0% { transform: scale(1); } 40% { transform: scale(1.22) rotate(-4deg); } 100% { transform: scale(1); } }
.coin-chip.bump { animation: coinBump 0.3s ease; }
@keyframes urgentPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes selectRing {
  0% { transform: scale(0.92); opacity: 0.75; }
  80%, 100% { transform: scale(1.18); opacity: 0; }
}
@keyframes tileShake {
  0%, 100% { transform: translate(calc(var(--c) * 100%), calc(var(--r) * 100%)); }
  25% { transform: translate(calc(var(--c) * 100% - 4px), calc(var(--r) * 100%)); }
  50% { transform: translate(calc(var(--c) * 100% + 4px), calc(var(--r) * 100%)); }
  75% { transform: translate(calc(var(--c) * 100% - 2px), calc(var(--r) * 100%)); }
}
@keyframes tilePop {
  0% { transform: scale(1); opacity: 1; }
  45% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.2) rotate(14deg); opacity: 0; }
}
@keyframes candyPop {
  0% { transform: scale(1) rotate(0); }
  45% { transform: scale(1.18) rotate(-8deg); }
  100% { transform: scale(0.4) rotate(12deg); opacity: 0; }
}
@keyframes floatScore {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.75); }
  18% { opacity: 1; transform: translate(-50%, -55%) scale(1.08); }
  100% { opacity: 0; transform: translate(-50%, -185%) scale(0.94); }
}
@keyframes comboBurst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5) rotate(-4deg); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1.06) rotate(1deg); }
  72% { opacity: 1; transform: translate(-50%, -58%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -95%) scale(0.9); }
}
@keyframes sparkFly {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.2); }
}
@keyframes overlayIn { from { opacity: 0; transform: scale(1.02); } to { opacity: 1; transform: none; } }
@keyframes hintPulse { 0%, 100% { box-shadow: 0 0 0 3px rgba(255, 138, 61, 0.14); } 50% { box-shadow: 0 0 0 6px rgba(255, 138, 61, 0.22); } }
@keyframes confettiFall {
  0% { transform: translate3d(0, -10px, 0) rotate(0); opacity: 1; }
  100% { transform: translate3d(var(--drift, 30px), 105vh, 0) rotate(720deg); opacity: 0.9; }
}

/* ---------- 小屏适配 ---------- */
@media (max-width: 360px) {
  .hud { padding-left: 12px; padding-right: 12px; gap: 6px; }
  .stage { padding-left: 12px; padding-right: 12px; }
  .player { height: 52px; padding-right: 8px; }
  .avatar { width: 38px; height: 38px; }
  .who .name { max-width: 70px; font-size: 13px; }
  .coin-chip { height: 32px; padding: 0 7px; font-size: 11px; }
  .daily-reward { display: none; }
  .hud-btn { width: 42px; height: 43px; }
  .hud-btn .mp-icon { width: 17px; height: 17px; }
  .hud-btn span { font-size: 8.5px; }
  .game-card { padding: 11px 11px 8px; border-radius: 24px; }
  .score-line b { font-size: 33px; }
  .time-box b { font-size: 22px; }
  .logo { max-width: 250px; }
  .start-card .lead { font-size: 11.5px; margin-bottom: 10px; }
  .feature-chips { margin-bottom: 12px; }
  .btn.big { min-width: 154px; height: 46px; font-size: 16px; }
  .end-card h2 { font-size: 21px; }
  .result-score b { font-size: 30px; }
  .end-badge { width: 37px; height: 37px; border-radius: 12px; }
  .end-card .btn.primary { height: 40px; }
}

@media (max-height: 700px) {
  .hud { padding-top: 5px; padding-bottom: 2px; }
  .daily-strip { display: none; }
  .player { height: 50px; }
  .avatar { width: 37px; height: 37px; }
  .stage { padding-top: 3px; }
  .game-card { padding-top: 10px; }
  .game-top { padding-bottom: 6px; }
  .score-line b { font-size: 32px; }
  .time-box b { font-size: 21px; }
  .time-track { margin-bottom: 8px; }
  .game-foot { min-height: 24px; padding-top: 3px; }
  .start-card .lead { margin-bottom: 8px; }
  .feature-chips { margin-bottom: 10px; }
  .btn.big { height: 44px; }
  .end-badge { display: none; }
  .end-card h2 { margin-top: 0; }
  .result-score { padding: 5px 12px 6px; }
  .result-score b { font-size: 28px; }
  .result-best { margin: 5px 0 7px; }
  .text-btn { margin-top: 4px; }
}

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