/* ============================================================
   萌宠叠叠消 · 卡通手绘风
   主色 #FF8A3D / 奶油卡片 / 薄荷与蜜桃背景
   ============================================================ */

:root {
  --orange: #FF8A3D;
  --orange-d: #E96A17;
  --orange-l: #FFB067;
  --peach: #FFE2C2;
  --ink: #4B2A16;
  --ink-2: #7E5C44;
  --muted: #A88A72;
  --cream: #FFF8EE;
  --cream-2: #FFF1DD;
  --line: #F0D3B3;
  --mint: #5FC9B2;
  --yellow: #FFC94A;
  --pink: #FF9FB2;
  --blue: #7FB2E5;
  --purple: #B49CEB;
}

* { box-sizing: border-box; }

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

body {
  background: linear-gradient(180deg, #C7EEE7 0%, #E9F8EE 28%, #FFF2DA 58%, #FFDFB9 100%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  display: flex;
  justify-content: center;
  touch-action: manipulation;
  overscroll-behavior: none;
}

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

button:focus { outline: none; }
input { -webkit-user-select: text; user-select: text; }
button:focus-visible { outline: 2px solid rgba(255, 138, 61, .65); outline-offset: 2px; }

/* ---------- 背景装饰 ---------- */
.bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.bg-sun {
  position: absolute;
  top: -80px;
  right: -60px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 248, 210, .95) 0%, rgba(255, 240, 190, .4) 48%, rgba(255, 240, 190, 0) 70%);
}
.bg-cloud {
  position: absolute;
  background: rgba(255, 255, 255, .72);
  border-radius: 999px;
  filter: blur(1px);
}
.bg-cloud::before,
.bg-cloud::after {
  content: "";
  position: absolute;
  background: inherit;
  border-radius: 50%;
}
.bg-cloud.c1 { width: 120px; height: 34px; left: -30px; top: 14%; opacity: .75; }
.bg-cloud.c1::before { width: 52px; height: 52px; left: 18px; top: -24px; }
.bg-cloud.c1::after { width: 38px; height: 38px; right: 18px; top: -14px; }
.bg-cloud.c2 { width: 88px; height: 26px; right: -20px; top: 33%; opacity: .55; }
.bg-cloud.c2::before { width: 42px; height: 42px; left: 14px; top: -20px; }
.bg-cloud.c2::after { width: 30px; height: 30px; right: 12px; top: -10px; }
.bg-paw {
  position: absolute;
  width: 44px;
  height: 44px;
  opacity: .12;
  background-color: #C77B3E;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cellipse cx='32' cy='42' rx='14' ry='12'/%3E%3Cellipse cx='15' cy='25' rx='6.5' ry='8' transform='rotate(-24 15 25)'/%3E%3Cellipse cx='49' cy='25' rx='6.5' ry='8' transform='rotate(24 49 25)'/%3E%3Cellipse cx='26' cy='15' rx='5.5' ry='7' transform='rotate(-8 26 15)'/%3E%3Cellipse cx='38' cy='15' rx='5.5' ry='7' transform='rotate(8 38 15)'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cellipse cx='32' cy='42' rx='14' ry='12'/%3E%3Cellipse cx='15' cy='25' rx='6.5' ry='8' transform='rotate(-24 15 25)'/%3E%3Cellipse cx='49' cy='25' rx='6.5' ry='8' transform='rotate(24 49 25)'/%3E%3Cellipse cx='26' cy='15' rx='5.5' ry='7' transform='rotate(-8 26 15)'/%3E%3Cellipse cx='38' cy='15' rx='5.5' ry='7' transform='rotate(8 38 15)'/%3E%3C/svg%3E") center / contain no-repeat;
}
.bg-paw.p1 { left: 4%; bottom: 16%; transform: rotate(-16deg); }
.bg-paw.p2 { right: 6%; bottom: 28%; transform: rotate(18deg); width: 32px; height: 32px; opacity: .09; }
.bg-paw.p3 { left: 8%; top: 30%; transform: rotate(10deg); width: 26px; height: 26px; opacity: .08; }

/* ---------- 主容器 ---------- */
.app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 500px;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: calc(env(safe-area-inset-top) + 8px) 16px calc(env(safe-area-inset-bottom) + 8px);
}

/* ---------- 玩家 / 顶部 HUD ---------- */
.hud {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.player {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  max-width: 72%;
  padding: 5px 14px 5px 5px;
  border-radius: 20px;
  background: rgba(255, 252, 247, .8);
  border: 1.5px solid rgba(255, 255, 255, .95);
  box-shadow: 0 4px 12px rgba(140, 80, 30, .12);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: transform .12s ease;
}
.player:active { transform: scale(.97); }
.avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(circle at 50% 32%, #FFF6E8, #FFDDB8);
  border: 2px solid #fff;
  box-shadow: 0 2px 5px rgba(150, 90, 40, .15);
}
.avatar svg, .avatar img { width: 100%; height: 100%; display: block; object-fit: cover; }
.avatar svg { width: 88%; height: 88%; margin: 0 auto; }
.avatar.big { width: 60px; height: 60px; }
.pmeta { display: flex; flex-direction: column; min-width: 0; text-align: left; }
.pmeta b {
  font-size: 13px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: .2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 132px;
}
.pmeta small { font-size: 10px; color: var(--muted); margin-top: 2px; white-space: nowrap; }
.hud-actions { display: flex; gap: 8px; }
.icon-btn {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: rgba(255, 252, 247, .84);
  border: 1.5px solid rgba(255, 255, 255, .95);
  box-shadow: 0 3px 9px rgba(140, 80, 30, .12);
  color: var(--orange-d);
  transition: transform .12s ease, background .15s;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.icon-btn .mp-icon { width: 23px; height: 23px; }
.icon-btn:active { transform: scale(.92); background: #FFF0DC; }

/* ---------- 关卡状态条 ---------- */
.status-strip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 16px;
  background: rgba(255, 252, 247, .74);
  border: 1px solid rgba(255, 255, 255, .92);
  box-shadow: 0 2px 8px rgba(140, 80, 30, .08);
}
.mode-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 11px;
  background: #fff;
  border: 1px solid #FFD9B5;
  color: var(--orange-d);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  flex: 0 0 auto;
  transition: transform .12s;
}
.mode-pill:active { transform: scale(.95); }
.mode-pill .mp-icon { width: 15px; height: 15px; }
.mode-pill .chev { width: 13px; height: 13px; opacity: .55; margin-left: 1px; }
.progress { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; }
.progress-track {
  flex: 1;
  min-width: 20px;
  height: 8px;
  border-radius: 99px;
  background: #F0DFC9;
  box-shadow: inset 0 1px 2px rgba(140, 80, 30, .14);
  overflow: hidden;
}
.progress-track i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, #FFC06D, #FF8A3D);
  box-shadow: 0 0 6px rgba(255, 138, 61, .55);
  transition: width .32s cubic-bezier(.2, .8, .3, 1);
}
.progress-text { font-size: 10px; font-weight: 800; color: var(--ink-2); min-width: 32px; text-align: right; font-variant-numeric: tabular-nums; }
.clock { display: flex; align-items: center; gap: 3px; color: var(--ink-2); font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.clock .mp-icon { width: 14px; height: 14px; color: var(--orange); }

/* ---------- 牌桌 ---------- */
.board {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 540px;
  border-radius: 26px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18px 18px, rgba(255, 138, 61, .075) 2.2px, rgba(255, 138, 61, 0) 2.7px) 0 0 / 36px 36px,
    radial-gradient(120% 80% at 50% 8%, #FFFCF4 0%, #FFF2DC 52%, #FFE6C6 100%);
  border: 1.5px solid rgba(255, 255, 255, .95);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, .95),
    inset 0 -10px 24px rgba(220, 150, 80, .1),
    0 10px 26px rgba(170, 95, 40, .14);
}
.board-ring {
  position: absolute;
  inset: 8px;
  border-radius: 20px;
  border: 1.5px dashed rgba(255, 138, 61, .16);
  pointer-events: none;
}
.board::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 26px;
  width: 260px;
  height: 26px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse, rgba(190, 110, 50, .18), rgba(190, 110, 50, 0) 70%);
  filter: blur(3px);
  pointer-events: none;
}
.stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 360px;
  height: 384px;
  transform: translate(-50%, -50%) scale(1);
  transform-origin: center center;
  z-index: 2;
}

/* ---------- 卡牌 ---------- */
.tile {
  position: absolute;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 13px;
  transition: transform .12s ease;
  will-change: transform;
}
.tile-inner {
  position: absolute;
  inset: 0;
  display: block;
  border-radius: 13px;
  overflow: hidden;
  background: linear-gradient(165deg, #FFFDF8 0%, #FFF5E6 58%, #FFEBD2 100%);
  border: 1.5px solid #fff;
  box-shadow:
    0 2.5px 0 #E9C097,
    0 5px 9px rgba(130, 70, 25, .17),
    inset 0 1px 0 rgba(255, 255, 255, .95);
  transition: filter .2s ease, box-shadow .2s ease, transform .12s ease;
}
.tile .sheen {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 38%, var(--halo) 0%, rgba(255, 255, 255, 0) 66%);
  opacity: .9;
  pointer-events: none;
}
.tile-art {
  position: absolute;
  left: 50%;
  top: 52%;
  width: 84%;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 1px 0 rgba(120, 60, 20, .14));
  pointer-events: none;
}
.tile-art svg { display: block; width: 100%; height: auto; }
.tile::before {
  content: "";
  position: absolute;
  left: 12%;
  top: 6%;
  width: 34%;
  height: 8%;
  border-radius: 99px;
  background: rgba(255, 255, 255, .9);
  filter: blur(.4px);
  z-index: 3;
  opacity: .85;
  pointer-events: none;
}
.tile:active .tile-inner { transform: scale(.93); }
.tile.blocked .tile-inner {
  filter: brightness(.84) saturate(.88);
  box-shadow: 0 2.5px 0 #D9AE83, 0 4px 7px rgba(120, 65, 25, .16);
}
.tile.blocked::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 13px;
  background: rgba(86, 48, 22, .17);
  box-shadow: inset 0 0 0 1.5px rgba(120, 70, 30, .12);
  z-index: 4;
  pointer-events: none;
}
.lock-badge {
  position: absolute;
  right: 2px;
  bottom: 2px;
  z-index: 6;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(69, 40, 20, .7);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
  pointer-events: none;
}
.lock-badge .mp-icon { width: 10px; height: 10px; color: #FFE6C4; }
.tile.lifted .tile-inner {
  box-shadow:
    0 2.5px 0 #E9C097,
    0 8px 14px rgba(130, 70, 25, .28),
    0 0 0 2px rgba(255, 138, 61, .62);
}
.tile.lifted::before { opacity: 1; background: #FFF6D6; }
.tile.shake { animation: tileShake .38s ease; z-index: 800 !important; }
@keyframes tileShake {
  0%, 100% { transform: translateX(0) rotate(0); }
  18% { transform: translateX(-4px) rotate(-2.5deg); }
  38% { transform: translateX(4px) rotate(2.5deg); }
  58% { transform: translateX(-3px) rotate(-1.6deg); }
  78% { transform: translateX(2px) rotate(1deg); }
}
.stage.shuffling .tile { animation: shuffleWiggle .42s ease-in-out; }
.stage.shuffling .tile:nth-child(3n) { animation-delay: .04s; }
.stage.shuffling .tile:nth-child(3n+1) { animation-delay: .09s; }
@keyframes shuffleWiggle {
  0%, 100% { transform: translateY(0) rotate(0); }
  30% { transform: translateY(-3px) rotate(-3deg); }
  60% { transform: translateY(2px) rotate(3deg); }
}

.board-tip {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 1200;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 99px;
  background: rgba(75, 42, 22, .74);
  color: #FFF8EE;
  font-size: 11px;
  letter-spacing: .2px;
  white-space: nowrap;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  pointer-events: none;
  transition: opacity .3s ease, transform .3s ease;
}
.board-tip .mp-icon { width: 14px; height: 14px; color: var(--yellow); }
.board-tip.hide { opacity: 0; transform: translate(-50%, 8px); }

/* ---------- 卡槽 ---------- */
.tray-wrap {
  flex: 0 0 auto;
  margin-top: auto;
  transition: filter .2s;
}
.tray-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 5px 5px;
  font-size: 11px;
  color: var(--ink-2);
}
.tray-title { font-weight: 800; letter-spacing: .2px; }
.tray-title b { color: var(--orange-d); font-size: 15px; font-weight: 900; margin: 0 1px; }
.tray-title em { font-style: normal; color: var(--muted); font-weight: 700; }
.tray-hint { font-size: 10px; color: var(--muted); transition: color .2s; }
.tray-hint.alert { color: #E24E3A; font-weight: 800; }
.tray {
  padding: 7px;
  border-radius: 20px;
  background: linear-gradient(180deg, #FFEBD1 0%, #FFDDB6 100%);
  border: 2px solid #F5C896;
  box-shadow:
    inset 0 2px 6px rgba(170, 100, 30, .15),
    inset 0 -1px 0 rgba(255, 255, 255, .6),
    0 4px 0 rgba(255, 255, 255, .45);
}
.tray-wrap.warn .tray {
  border-color: #F2A65A;
  box-shadow: inset 0 2px 6px rgba(170, 100, 30, .15), 0 0 0 2px rgba(255, 138, 61, .22), 0 4px 0 rgba(255, 255, 255, .45);
}
.tray-wrap.danger .tray {
  border-color: #E8654B;
  box-shadow: inset 0 2px 6px rgba(170, 100, 30, .15), 0 0 0 2px rgba(232, 101, 75, .3), 0 4px 0 rgba(255, 255, 255, .45);
  animation: dangerPulse 1s ease-in-out infinite;
}
@keyframes dangerPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.008); }
}
.slots {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}
.slot {
  position: relative;
  aspect-ratio: 54 / 66;
  min-height: 42px;
  border-radius: 10px;
  background: rgba(187, 126, 66, .1);
  border: 1.5px dashed rgba(184, 124, 64, .32);
  box-shadow: inset 0 2px 4px rgba(150, 85, 30, .13);
  transition: background .2s, border-color .2s;
}
.slot.empty .slot-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: rgba(176, 118, 62, .32);
}
.slot.filled {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.mini {
  position: absolute;
  inset: 0;
  display: block;
  border-radius: 9px;
  overflow: hidden;
  background: linear-gradient(165deg, #FFFDF8 0%, #FFF5E6 60%, #FFEBD2 100%);
  border: 1px solid #fff;
  box-shadow: 0 1.5px 0 #E4B98E, 0 3px 5px rgba(130, 70, 25, .16);
}
.mini .sheen {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 38%, var(--halo) 0%, rgba(255, 255, 255, 0) 68%);
}
.mini-art {
  position: absolute;
  left: 50%;
  top: 52%;
  width: 88%;
  transform: translate(-50%, -50%);
}
.mini-art svg { display: block; width: 100%; height: auto; }
.slot.enter .mini { animation: slotIn .24s cubic-bezier(.2, .9, .3, 1.4); }
@keyframes slotIn {
  0% { transform: scale(.6); opacity: .3; }
  70% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.slot.matched .mini { animation: matchPop .3s ease forwards; }
@keyframes matchPop {
  0% { transform: scale(1); }
  35% { transform: scale(1.14) rotate(-3deg); box-shadow: 0 0 14px rgba(255, 180, 60, .9); }
  100% { transform: scale(.2) rotate(8deg); opacity: 0; }
}

/* ---------- 道具 ---------- */
.props {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}
.prop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 60px;
  border-radius: 18px;
  background: linear-gradient(180deg, #FFFDF8, #FFF1DE);
  border: 1.5px solid #fff;
  box-shadow: 0 3px 0 #E9C49B, 0 6px 12px rgba(150, 80, 30, .1);
  transition: transform .12s ease, box-shadow .12s ease, opacity .2s;
}
.prop:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #E9C49B; }
.prop:disabled { opacity: .46; filter: saturate(.7); }
.prop-icon {
  width: 27px;
  height: 27px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 2px 0 rgba(120, 60, 20, .16);
}
.prop-icon .mp-icon { width: 17px; height: 17px; }
.p-undo { background: linear-gradient(180deg, #FFB067, #FF8A3D); }
.p-extract { background: linear-gradient(180deg, #7FDECB, #4FC0A8); }
.p-shuffle { background: linear-gradient(180deg, #C9B7F6, #A98BE8); }
.prop-label { font-size: 11px; font-weight: 800; color: var(--ink); letter-spacing: .3px; }
.prop-count {
  position: absolute;
  top: -7px;
  right: -3px;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--ink);
  border: 2px solid var(--cream);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.prop.empty .prop-count { background: #B9A28E; }

/* ---------- 通用弹层 ---------- */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(60, 32, 15, .4);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: fadeIn .18s ease;
}
.scrim[hidden] { display: none; }
.sheet {
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  max-height: 88dvh;
  overflow-y: auto;
  border-radius: 26px 26px 0 0;
  padding: 15px 18px calc(18px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #FFFCF6 0%, #FFF4E4 100%);
  box-shadow: 0 -12px 40px rgba(90, 45, 15, .22);
  animation: sheetUp .3s cubic-bezier(.2, .85, .3, 1);
  overscroll-behavior: contain;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetUp { from { transform: translateY(46px); opacity: .5; } to { transform: translateY(0); opacity: 1; } }

.scrim-dialog {
  align-items: center;
  padding: 22px;
  z-index: 2100;
  background: rgba(55, 28, 12, .48);
}
.dialog {
  position: relative;
  width: 100%;
  max-width: 360px;
  border-radius: 28px;
  overflow: hidden;
  background: linear-gradient(180deg, #FFFDF8 0%, #FFF3E1 100%);
  box-shadow: 0 22px 56px rgba(80, 40, 10, .3), inset 0 1px 0 #fff;
  animation: popIn .32s cubic-bezier(.2, .9, .3, 1.18);
}
@keyframes popIn { from { transform: scale(.88); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.dialog::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -86px;
  width: 260px;
  height: 190px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, #FFE7C6 0%, rgba(255, 231, 198, .5) 55%, rgba(255, 231, 198, 0) 72%);
  pointer-events: none;
}
.dialog-body {
  position: relative;
  z-index: 1;
  padding: 20px 20px 18px;
  text-align: center;
}
.result-pet {
  width: 102px;
  height: 102px;
  margin: 0 auto 2px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 38%, #FFF9EE, #FFE2BF);
  box-shadow: inset 0 -4px 0 rgba(226, 172, 118, .35), 0 8px 18px rgba(160, 90, 30, .16);
}
.result-pet svg { width: 82%; height: 82%; display: block; }
.sad-pet { background: radial-gradient(circle at 50% 38%, #F7F1EA, #E7D6C4); }
.result-stars { display: flex; justify-content: center; gap: 4px; margin: 4px 0 2px; }
.result-stars .star { width: 24px; height: 24px; color: #E9D7BE; filter: drop-shadow(0 1px 0 #fff); }
.result-stars .star.on { color: #FFC331; filter: drop-shadow(0 2px 3px rgba(240, 160, 20, .35)); animation: starPop .45s cubic-bezier(.2, .9, .3, 1.4) both; }
.result-stars .star.on:nth-child(2) { animation-delay: .1s; }
.result-stars .star.on:nth-child(3) { animation-delay: .2s; }
@keyframes starPop { from { transform: scale(0) rotate(-40deg); } to { transform: scale(1) rotate(0); } }
.dialog h2 {
  margin: 4px 0 2px;
  font-size: 24px;
  letter-spacing: .5px;
  color: var(--ink);
  font-weight: 900;
}
.result-sub { margin: 4px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 16px 0 6px;
  padding: 12px 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, .72);
  border: 1px solid #F5E4CE;
}
.result-stats > div { display: flex; flex-direction: column; gap: 3px; }
.result-stats > div + div { border-left: 1px dashed #EFDCC2; }
.result-stats b { font-size: 17px; font-weight: 900; color: var(--ink); font-variant-numeric: tabular-nums; }
.result-stats span { font-size: 10px; color: var(--muted); }
.submit-line { min-height: 16px; margin-top: 6px; font-size: 11px; color: var(--muted); }
.submit-line .ok { color: #2E9B79; font-weight: 800; }
.submit-line .warn-text { color: #D9822B; }
.dialog-actions { display: flex; gap: 10px; margin-top: 14px; }
.dialog-actions .btn { flex: 1; }
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-2);
  opacity: .85;
  padding: 5px 8px;
}
.text-link .mp-icon { width: 15px; height: 15px; color: var(--orange); }

/* ---------- 按钮 ---------- */
.btn {
  height: 48px;
  padding: 0 18px;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: .4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform .12s ease, box-shadow .12s ease, background .15s;
}
.btn .mp-icon { width: 19px; height: 19px; }
.btn.primary {
  color: #fff;
  background: linear-gradient(180deg, #FFA65E 0%, #FF7C28 100%);
  box-shadow: 0 4px 0 #D85B11, 0 8px 16px rgba(240, 120, 40, .26);
  text-shadow: 0 1px 0 rgba(150, 60, 0, .18);
}
.btn.primary:active { transform: translateY(3px); box-shadow: 0 1px 0 #D85B11; }
.btn.ghost {
  color: var(--ink);
  background: #FFFDF8;
  border: 1.5px solid #F0D3B3;
  box-shadow: 0 3px 0 #EAD3B8;
}
.btn.ghost:active { transform: translateY(3px); box-shadow: 0 0 0 #EAD3B8; }
.btn.wide { width: 100%; }
.sheet-actions { margin-top: 16px; }
.tiny-note { margin: 9px 0 0; text-align: center; font-size: 10px; color: var(--muted); }

/* ---------- 弹层标题 ---------- */
.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.sheet-head h2 { margin: 0; font-size: 21px; font-weight: 900; letter-spacing: .3px; color: var(--ink); }
.sheet-head p { margin: 4px 0 0; font-size: 11px; color: var(--muted); line-height: 1.5; }
.close-btn {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid #F0DCC5;
  color: #9A7A60;
  box-shadow: 0 2px 5px rgba(140, 80, 30, .07);
}
.close-btn .mp-icon { width: 18px; height: 18px; }
.close-btn:active { transform: scale(.92); background: #FFF4E4; }

/* ---------- 模式选择 ---------- */
.mode-list { display: flex; flex-direction: column; gap: 10px; }
.mode-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px;
  border-radius: 19px;
  text-align: left;
  background: #fff;
  border: 1.5px solid #F5E3CC;
  box-shadow: 0 3px 9px rgba(150, 85, 30, .06);
  transition: transform .12s, border-color .15s;
}
.mode-card:active { transform: scale(.985); }
.mode-card.current { border-color: #FFC58E; background: linear-gradient(135deg, #FFFCF6, #FFF0DC); box-shadow: 0 3px 9px rgba(240, 140, 50, .12), inset 0 0 0 1px rgba(255, 190, 125, .35); }
.mode-emoji {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .09);
}
.mode-emoji .mp-icon { width: 26px; height: 26px; }
.mode-emoji.classic { background: linear-gradient(160deg, #FFBE74, #FF8A3D); }
.mode-emoji.hell { background: linear-gradient(160deg, #FF9E8A, #EE5A44); }
.mode-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.mode-info b { font-size: 15px; font-weight: 900; color: var(--ink); }
.mode-info small { font-size: 10.5px; color: var(--muted); line-height: 1.4; }
.mode-tag {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 9px;
  background: #FFF2DF;
  border: 1px solid #FFDDB6;
  color: var(--orange-d);
  font-size: 10px;
  font-weight: 800;
}
.mode-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 13px;
  padding: 9px 11px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .6);
  border: 1px dashed #EFDAC0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}
.mode-note .mp-icon { width: 14px; height: 14px; flex: 0 0 auto; color: #DDB07D; margin-top: 1px; }

/* ---------- 排行榜 ---------- */
.lb-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 10px;
  color: var(--muted);
}
.lb-caption .mp-icon { width: 14px; height: 14px; color: #D9B187; }
.lb-me {
  padding: 10px 12px;
  margin-bottom: 10px;
  border-radius: 16px;
  background: linear-gradient(135deg, #FFF4DE, #FFE5C2);
  border: 1.5px solid #FFD19A;
  box-shadow: 0 3px 8px rgba(230, 150, 60, .1);
}
.lb-me-badge {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-bottom: 5px;
  font-size: 10px;
  font-weight: 800;
  color: var(--orange-d);
}
.lb-me-badge .mp-icon { width: 13px; height: 13px; color: #F5A623; }
.lb-me-row { display: flex; align-items: center; gap: 8px; }
.lb-me-row b { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 800; color: var(--ink); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-time { font-size: 14px; font-weight: 900; color: var(--orange-d); font-variant-numeric: tabular-nums; }
.lb-props { padding: 2px 6px; border-radius: 7px; background: #fff; font-size: 9px; color: var(--muted); }
.lb-list {
  max-height: 40vh;
  max-height: 40dvh;
  overflow-y: auto;
  padding: 4px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .56);
  border: 1px solid rgba(245, 227, 204, .8);
  overscroll-behavior: contain;
}
.lb-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border-radius: 12px;
}
.lb-row + .lb-row { border-top: 1px dashed #F2E0C9; }
.lb-row.mine { background: #FFF4E1; }
.rank {
  width: 22px;
  flex: 0 0 auto;
  text-align: center;
  font-size: 12px;
  font-weight: 900;
  color: #B59B84;
  font-variant-numeric: tabular-nums;
}
.rank.r1 { color: #F0A11C; font-size: 15px; }
.rank.r2 { color: #9AA8B5; font-size: 14px; }
.rank.r3 { color: #C98552; font-size: 14px; }
.lb-ava {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #FFF2DF;
  border: 1.5px solid #fff;
  box-shadow: 0 1px 3px rgba(150, 90, 40, .12);
}
.lb-ava svg { width: 86%; height: 86%; }
.lb-name { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 700; color: var(--ink); text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-score { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; min-width: 55px; }
.lb-score b { font-size: 12.5px; font-weight: 900; color: var(--ink); font-variant-numeric: tabular-nums; }
.lb-score small { font-size: 9px; color: var(--muted); }
.lb-loading { padding: 30px 10px; text-align: center; }
.lb-loading p { margin: 8px 0 0; font-size: 11px; color: var(--muted); }
.paw-loading { display: inline-block; width: 52px; height: 52px; animation: pawBounce 1s ease-in-out infinite; }
.paw-loading svg { width: 100%; height: 100%; }
@keyframes pawBounce { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-7px) rotate(4deg); } }
.lb-empty { padding: 30px 16px; text-align: center; }
.lb-empty .empty-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 10px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #FFF0DB;
  color: #E8B87F;
}
.lb-empty .empty-icon .mp-icon { width: 26px; height: 26px; }
.lb-empty b { display: block; font-size: 13px; color: var(--ink); }
.lb-empty p { margin: 5px 0 0; font-size: 10.5px; color: var(--muted); }
.net-warn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 4px 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #FFF6E8;
  border: 1px dashed #F0D6B8;
  color: #B08054;
  font-size: 10px;
}
.net-warn .mp-icon { width: 14px; height: 14px; flex: 0 0 auto; }

/* ---------- 设置 ---------- */
.menu-list { display: flex; flex-direction: column; gap: 8px; }
.menu-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 16px;
  text-align: left;
  background: #fff;
  border: 1px solid #F6E7D3;
  box-shadow: 0 2px 6px rgba(150, 90, 40, .05);
  transition: transform .12s, background .15s;
}
.menu-row:active { transform: scale(.99); background: #FFF8EE; }
.menu-ico {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .08);
}
.menu-ico .mp-icon { width: 20px; height: 20px; }
.menu-ico.orange { background: linear-gradient(160deg, #FFB771, #FF8A3D); }
.menu-ico.mint { background: linear-gradient(160deg, #8AE3D1, #55C3AC); }
.menu-ico.yellow { background: linear-gradient(160deg, #FFDA7C, #FFBB33); }
.menu-ico.blue { background: linear-gradient(160deg, #9CC6ED, #6FA8DD); }
.menu-ico.pink { background: linear-gradient(160deg, #FFB7C4, #FF8CA1); }
.menu-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.menu-txt b { font-size: 13px; font-weight: 800; color: var(--ink); }
.menu-txt small { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-val { flex: 0 0 auto; font-size: 12px; font-weight: 900; color: var(--orange-d); }
.menu-row .chev { width: 18px; height: 18px; color: #CBB197; flex: 0 0 auto; }
.menu-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 18px;
  color: #B79E87;
  font-size: 10px;
}
.logo-paw { width: 22px; height: 22px; opacity: .85; }
.logo-paw svg { width: 100%; height: 100%; }

/* ---------- 玩法 ---------- */
.rules { display: flex; flex-direction: column; gap: 9px; }
.rule { display: flex; gap: 10px; padding: 10px 12px; border-radius: 14px; background: #fff; border: 1px solid #F6E7D3; }
.rule-num {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #FFEBD4;
  color: var(--orange-d);
  font-size: 12px;
  font-weight: 900;
}
.rule b { font-size: 13px; font-weight: 800; color: var(--ink); }
.rule p { margin: 3px 0 0; font-size: 10.5px; line-height: 1.55; color: var(--muted); }
.prop-guide { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.pg-item { padding: 10px 7px; border-radius: 14px; background: #fff; border: 1px solid #F6E7D3; text-align: center; }
.pg-item .prop-icon { margin: 0 auto 6px; width: 30px; height: 30px; }
.pg-item .prop-icon .mp-icon { width: 18px; height: 18px; }
.pg-item b { font-size: 12px; color: var(--ink); }
.pg-item p { margin: 3px 0 0; font-size: 9px; line-height: 1.5; color: var(--muted); }

/* ---------- 资料 ---------- */
.profile-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid #F6E7D3;
}
.profile-top b { font-size: 16px; font-weight: 900; color: var(--ink); }
.profile-top p { margin: 3px 0 0; font-size: 10.5px; color: var(--muted); }
.field {
  display: block;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #F6E7D3;
}
.field span { display: block; margin-bottom: 4px; font-size: 10px; color: var(--muted); }
.field input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  font-family: inherit;
  padding: 2px 0;
}
.field input::placeholder { color: #C9B39E; font-weight: 500; }
.field-label { margin: 14px 2px 8px; font-size: 11px; font-weight: 800; color: var(--ink-2); }
.pet-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.pet-choice {
  padding: 4px 2px 3px;
  border-radius: 13px;
  background: #fff;
  border: 2px solid transparent;
  box-shadow: 0 2px 5px rgba(150, 90, 40, .06);
  transition: transform .12s, border-color .15s, background .15s;
}
.pet-choice:active { transform: scale(.94); }
.pet-choice svg { display: block; width: 100%; height: auto; }
.pet-choice em { display: block; margin-top: 1px; font-style: normal; font-size: 8.5px; color: var(--muted); }
.pet-choice.active { border-color: var(--orange); background: #FFF5E8; box-shadow: 0 2px 8px rgba(255, 138, 61, .18); }

/* ---------- 飘字 / 特效 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28% + env(safe-area-inset-bottom));
  z-index: 4000;
  max-width: 82vw;
  padding: 9px 16px;
  border-radius: 99px;
  background: rgba(66, 38, 20, .88);
  color: #FFF9EF;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.fx-layer { position: fixed; inset: 0; z-index: 3000; pointer-events: none; overflow: hidden; }
.fly-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .5), 0 3px 8px rgba(120, 60, 20, .25);
  transition: transform .34s cubic-bezier(.3, .7, .3, 1), opacity .34s ease;
}
.spark {
  position: absolute;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  animation: sparkFly .62s ease-out forwards;
  box-shadow: 0 1px 3px rgba(120, 60, 20, .2);
}
@keyframes sparkFly {
  0% { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; }
}

.confetti { position: absolute; inset: 0; z-index: 2; overflow: hidden; pointer-events: none; }
.confetti i {
  position: absolute;
  top: -14px;
  width: 7px;
  height: 11px;
  border-radius: 2px;
  opacity: .95;
  animation: confettiFall 2.3s linear infinite;
}
@keyframes confettiFall {
  0% { transform: translateY(-10px) rotate(0); opacity: 1; }
  100% { transform: translateY(420px) rotate(540deg); opacity: 0; }
}

body.locked .app { pointer-events: none; }

/* ---------- 发牌 / 提示 / 连消 ---------- */
.tile.dealing { animation: tileDeal .42s cubic-bezier(.18, .9, .3, 1.18) both; }
@keyframes tileDeal {
  0% { opacity: 0; transform: translateY(-16px) scale(.72) rotate(-5deg); }
  68% { opacity: 1; transform: translateY(2px) scale(1.04) rotate(1deg); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}
.tile.hint .tile-inner {
  animation: hintPulse 1s ease-in-out 2;
  box-shadow:
    0 2.5px 0 #E9C097,
    0 0 0 3px rgba(255, 138, 61, .55),
    0 0 20px rgba(255, 176, 80, .8);
}
@keyframes hintPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
.combo {
  position: absolute;
  left: 50%;
  top: 34%;
  z-index: 1400;
  transform: translate(-50%, 0) scale(.6);
  padding: 7px 18px;
  border-radius: 99px;
  background: linear-gradient(135deg, #FFD25E, #FF8A3D);
  border: 2px solid rgba(255, 255, 255, .92);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 1px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 6px 16px rgba(220, 100, 20, .32), inset 0 -2px 0 rgba(190, 80, 10, .25);
  text-shadow: 0 1px 0 rgba(160, 70, 10, .3);
}
.combo.show { animation: comboPop 1.05s cubic-bezier(.2, .9, .3, 1.2) both; }
@keyframes comboPop {
  0% { opacity: 0; transform: translate(-50%, 16px) scale(.5) rotate(-6deg); }
  22% { opacity: 1; transform: translate(-50%, 0) scale(1.06) rotate(1deg); }
  70% { opacity: 1; transform: translate(-50%, -4px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -22px) scale(.96); }
}
.deal-loading {
  position: absolute;
  inset: 0;
  z-index: 1300;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: rgba(255, 249, 238, .72);
  color: var(--muted);
  font-size: 11px;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.deal-loading.show { display: flex; }
.dl-paw {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid #FFD9B5;
  border-top-color: var(--orange);
  animation: dlSpin .8s linear infinite;
}
@keyframes dlSpin { to { transform: rotate(360deg); } }
.noscript {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 30px;
  background: #FFF8EE;
  color: #6B452B;
  font-size: 14px;
  line-height: 1.7;
  text-align: center;
}

/* ---------- 小屏适配 ---------- */
@media (max-height: 720px) {
  .app { gap: 6px; padding-top: calc(env(safe-area-inset-top) + 6px); padding-bottom: calc(env(safe-area-inset-bottom) + 6px); }
  .avatar { width: 36px; height: 36px; }
  .player { padding: 4px 11px 4px 4px; border-radius: 18px; }
  .pmeta b { font-size: 12px; }
  .icon-btn { width: 38px; height: 38px; border-radius: 13px; }
  .board { border-radius: 22px; }
  .tray-head { padding-bottom: 4px; }
  .prop { height: 54px; border-radius: 16px; }
  .prop-icon { width: 24px; height: 24px; }
  .prop-label { font-size: 10px; }
  .board-tip { bottom: 8px; }
}
@media (max-height: 650px) {
  .status-strip { padding: 4px 7px; }
  .board { max-height: none; }
  .tray-hint { display: none; }
  .prop { height: 50px; }
  .prop-label { display: none; }
  .prop { gap: 0; }
}

/* 宽屏时做一个居中的手机画布 */
@media (min-width: 700px) {
  .app {
    max-width: 460px;
    height: min(100vh, 940px);
    margin: auto 0;
    padding-left: 16px;
    padding-right: 16px;
    border-radius: 34px;
  }
  .scrim { align-items: center; }
  .sheet { max-width: 430px; border-radius: 28px; margin-bottom: 20px; }
  .scrim-dialog { padding: 24px; }
}

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

/* ============================================================
   首页 / 广告补给 / 启动兜底（待实现功能补丁）
   ============================================================ */

/* ---------- 首页 ---------- */
.home {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: flex;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 80% 0%, rgba(255, 214, 156, .9) 0%, rgba(255, 214, 156, 0) 52%),
    radial-gradient(100% 70% at 0% 12%, rgba(150, 224, 208, .55) 0%, rgba(150, 224, 208, 0) 55%),
    linear-gradient(180deg, #C7EEE7 0%, #F1F9EA 24%, #FFF2DA 58%, #FFDFB9 100%);
}
.home[hidden] { display: none !important; }
.home-open .app { pointer-events: none; }
.home-scroll {
  width: 100%;
  max-width: 500px;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 26px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.home-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.home-player {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  max-width: 70%;
  padding: 5px 13px 5px 5px;
  border-radius: 20px;
  background: rgba(255, 252, 247, .82);
  border: 1.5px solid rgba(255, 255, 255, .95);
  box-shadow: 0 4px 14px rgba(140, 80, 30, .13);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: transform .12s ease;
}
.home-player:active { transform: scale(.97); }
.home-avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(circle at 50% 32%, #FFF6E8, #FFDDB8);
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(150, 90, 40, .16);
}
.home-avatar svg, .home-avatar img { width: 100%; height: 100%; display: block; object-fit: cover; }
.home-avatar svg { width: 88%; height: 88%; margin: 0 auto; }
.home-user { display: flex; flex-direction: column; min-width: 0; text-align: left; }
.home-user b {
  font-size: 13.5px;
  line-height: 1.15;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}
.home-user small { font-size: 10px; color: var(--muted); margin-top: 2px; white-space: nowrap; }
.home-actions { display: flex; gap: 8px; flex: 0 0 auto; }

.home-hero {
  position: relative;
  min-height: 184px;
  border-radius: 28px;
  overflow: hidden;
  padding: 17px 16px;
  background:
    radial-gradient(90% 120% at 100% 10%, rgba(255, 255, 255, .55) 0%, rgba(255, 255, 255, 0) 52%),
    linear-gradient(135deg, #FFC77F 0%, #FF9A4B 48%, #FF7E2E 100%);
  border: 1.5px solid rgba(255, 255, 255, .85);
  box-shadow: 0 12px 26px rgba(210, 105, 35, .24), inset 0 1px 0 rgba(255, 255, 255, .8);
}
.home-hero::before,
.home-hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.home-hero::before {
  width: 150px;
  height: 150px;
  right: -36px;
  top: -54px;
  background: rgba(255, 255, 255, .17);
}
.home-hero::after {
  width: 90px;
  height: 90px;
  left: -26px;
  bottom: -40px;
  background: rgba(131, 61, 16, .12);
}
.hero-copy { position: relative; z-index: 2; width: 63%; }
.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .28);
  border: 1px solid rgba(255, 255, 255, .45);
  color: #5B2A0E;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .4px;
  white-space: nowrap;
}
.hero-kicker .mp-icon { width: 12px; height: 12px; }
.home-hero h1 {
  margin: 9px 0 3px;
  font-size: 29px;
  line-height: 1.12;
  font-weight: 900;
  letter-spacing: .5px;
  color: #4A240D;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .3);
}
.home-hero p {
  margin: 0 0 12px;
  max-width: 205px;
  font-size: 11px;
  line-height: 1.55;
  color: #6D3A17;
}
.hero-play {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 38px;
  padding: 0 14px;
  border-radius: 13px;
  background: linear-gradient(180deg, #5A321B 0%, #40210E 100%);
  color: #FFF6E7;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .3px;
  box-shadow: 0 3px 0 #2E1608, 0 7px 14px rgba(80, 40, 12, .25);
  transition: transform .12s ease, box-shadow .12s ease;
}
.hero-play .mp-icon { width: 16px; height: 16px; color: #FFC777; }
.hero-play:active { transform: translateY(3px); box-shadow: 0 0 0 #2E1608; }
.hero-stack {
  position: absolute;
  right: -2px;
  bottom: 2px;
  width: 150px;
  height: 154px;
  z-index: 1;
  pointer-events: none;
}
.hs-card {
  position: absolute;
  width: 76px;
  height: 92px;
  border-radius: 15px;
  background: linear-gradient(165deg, #FFFDF8, #FFEBD2);
  border: 2px solid rgba(255, 255, 255, .95);
  box-shadow: 0 4px 0 #D99A5F, 0 9px 16px rgba(100, 45, 10, .24);
  display: grid;
  place-items: center;
  padding: 4px;
  overflow: hidden;
}
.hs-card::after {
  content: "";
  position: absolute;
  left: 12%;
  top: 5%;
  width: 30%;
  height: 7%;
  border-radius: 99px;
  background: rgba(255, 255, 255, .9);
}
.hs-card svg { width: 100%; height: auto; display: block; }
.hs-card.c1 { left: 0; top: 40px; transform: rotate(-13deg); z-index: 1; }
.hs-card.c2 { left: 37px; top: 14px; transform: rotate(2deg); z-index: 2; }
.hs-card.c3 { left: 73px; top: 40px; transform: rotate(13deg); z-index: 3; }

.home-stat {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 10px 0;
  border-radius: 18px;
  background: rgba(255, 252, 247, .8);
  border: 1px solid rgba(255, 255, 255, .95);
  box-shadow: 0 4px 12px rgba(140, 80, 30, .09);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.home-stat > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
  padding: 0 4px;
}
.home-stat > div + div { border-left: 1px dashed rgba(190, 150, 110, .3); }
.home-stat b {
  font-size: 14px;
  font-weight: 900;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.home-stat span { font-size: 9px; color: var(--muted); white-space: nowrap; }

.home-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 5px 0;
}
.home-section-title b { font-size: 13px; font-weight: 900; color: var(--ink); letter-spacing: .2px; }
.home-section-title span { font-size: 9px; color: var(--muted); }

.home-mode {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 78px;
  padding: 12px;
  border-radius: 20px;
  text-align: left;
  background: #FFFDF8;
  border: 1.5px solid #F6E3CC;
  box-shadow: 0 4px 12px rgba(150, 85, 30, .09);
  transition: transform .12s ease, box-shadow .12s ease;
}
.home-mode:active { transform: scale(.985); box-shadow: 0 2px 6px rgba(150, 85, 30, .08); }
.hm-icon {
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .09), 0 4px 8px rgba(150, 80, 20, .12);
}
.hm-icon .mp-icon { width: 27px; height: 27px; }
.home-mode.classic .hm-icon { background: linear-gradient(160deg, #FFBE74, #FF8A3D); }
.home-mode.hell .hm-icon { background: linear-gradient(160deg, #FF9E8A, #EE5A44); }
.hm-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.hm-copy b { font-size: 16px; font-weight: 900; color: var(--ink); letter-spacing: .2px; }
.hm-copy small { font-size: 10.5px; color: var(--muted); line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-go {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #FFF2DF;
  color: var(--orange-d);
}
.hm-go .mp-icon { width: 18px; height: 18px; }

.home-rank {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 13px;
  border-radius: 20px;
  background:
    radial-gradient(120% 160% at 100% 0%, rgba(255, 199, 119, .35) 0%, rgba(255, 199, 119, 0) 55%),
    linear-gradient(135deg, #5A321B 0%, #7B421D 58%, #8A4A20 100%);
  border: 1.5px solid rgba(255, 214, 160, .4);
  box-shadow: 0 7px 18px rgba(90, 45, 15, .24), inset 0 1px 0 rgba(255, 230, 190, .18);
  text-align: left;
  transition: transform .12s ease;
}
.home-rank:active { transform: scale(.985); }
.hr-ico {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #5A321B;
  background: linear-gradient(160deg, #FFE08B, #FFC03F);
  box-shadow: inset 0 -3px 0 rgba(170, 100, 20, .18);
}
.hr-ico .mp-icon { width: 24px; height: 24px; }
.hr-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.hr-copy b { font-size: 14px; font-weight: 900; color: #FFF4DF; letter-spacing: .2px; }
.hr-copy small { font-size: 10px; color: rgba(255, 229, 190, .72); }
.hr-arrow { color: rgba(255, 229, 190, .7); flex: 0 0 auto; }
.hr-arrow .mp-icon { width: 19px; height: 19px; }
.home-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 0 2px;
  color: #B3967D;
  font-size: 9.5px;
}
.home-foot .mp-icon { width: 13px; height: 13px; }

/* ---------- 广告补给入口 ---------- */
.ad-supply {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: 0 0 auto;
  height: 24px;
  padding: 0 8px;
  border-radius: 99px;
  background: #FFFDF8;
  border: 1px solid #FFD1A3;
  color: var(--orange-d);
  font-size: 9.5px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(190, 110, 40, .12);
  transition: transform .12s ease;
}
.ad-supply .mp-icon { width: 12px; height: 12px; color: #FF7A2E; }
.ad-supply:active { transform: scale(.95); }
.ad-supply[hidden] { display: none !important; }
.tray-hint { flex: 1; min-width: 0; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 激励视频 ---------- */
.ad-scrim {
  position: fixed;
  inset: 0;
  z-index: 3100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(38, 20, 10, .7);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: fadeIn .18s ease;
}
.ad-scrim[hidden] { display: none !important; }
.ad-card {
  width: 100%;
  max-width: 360px;
  padding: 16px;
  border-radius: 26px;
  background: linear-gradient(180deg, #FFFDF8 0%, #FFF1DC 100%);
  box-shadow: 0 24px 60px rgba(60, 28, 8, .38), inset 0 1px 0 #fff;
  animation: popIn .3s cubic-bezier(.2, .9, .3, 1.16);
}
.ad-screen {
  position: relative;
  min-height: 212px;
  border-radius: 19px;
  padding: 18px 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background:
    radial-gradient(80% 90% at 50% 0%, rgba(255, 170, 90, .28) 0%, rgba(255, 170, 90, 0) 62%),
    linear-gradient(160deg, #2B1A12 0%, #4A2A18 56%, #6A3A1D 100%);
  color: #FFF8EE;
}
.ad-screen::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -46px;
  width: 180px;
  height: 100px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(255, 170, 90, .16);
  filter: blur(10px);
  pointer-events: none;
}
.ad-play {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  margin-bottom: 2px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(160deg, #FFB35E, #FF7C28);
  border: 2px solid rgba(255, 255, 255, .55);
  box-shadow: 0 5px 16px rgba(255, 120, 30, .38), inset 0 -3px 0 rgba(170, 70, 10, .25);
}
.ad-play .mp-icon { width: 30px; height: 30px; margin-left: 2px; }
.ad-kicker { font-size: 8.5px; letter-spacing: 2.4px; color: #FFC987; font-weight: 800; }
.ad-screen b { font-size: 17px; font-weight: 900; letter-spacing: .3px; text-align: center; }
.ad-screen #adDesc { max-width: 250px; font-size: 10.5px; line-height: 1.55; color: rgba(255, 239, 215, .78); text-align: center; }
.ad-progress {
  width: 82%;
  height: 5px;
  margin-top: 9px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .17);
  overflow: hidden;
}
.ad-progress i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #FFC25F, #FF8A3D);
  box-shadow: 0 0 8px rgba(255, 160, 70, .6);
  transition: width .9s linear;
}
.ad-screen.host .ad-progress i { width: 38%; animation: adIndeterminate 1.1s ease-in-out infinite; }
@keyframes adIndeterminate {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(310%); }
}
#adCountdown { margin-top: 1px; font-size: 10px; font-weight: 700; color: #FFD9A8; font-variant-numeric: tabular-nums; }
.ad-note { margin: 9px 2px 0; font-size: 9.5px; line-height: 1.5; color: var(--muted); text-align: center; }
.ad-card .btn { height: 42px; margin-top: 10px; font-size: 13px; }

/* ---------- 启动兜底 ---------- */
.boot-splash {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background:
    radial-gradient(90% 70% at 50% 20%, #FFF8E8 0%, rgba(255, 248, 232, 0) 70%),
    linear-gradient(180deg, #C7EEE7 0%, #FFF2DA 64%, #FFDFB9 100%);
}
.boot-splash[hidden] { display: none !important; }
.boot-cards { position: relative; width: 90px; height: 76px; margin-bottom: 3px; }
.boot-cards span {
  position: absolute;
  left: 14px;
  top: 12px;
  width: 58px;
  height: 70px;
  border-radius: 12px;
  background: linear-gradient(165deg, #FFFDF8, #FFEBD2);
  border: 2px solid #fff;
  box-shadow: 0 4px 0 #E2AD78, 0 8px 14px rgba(140, 80, 30, .18);
  animation: bootDeal 1.05s ease-in-out infinite;
}
.boot-cards span::after {
  content: "";
  position: absolute;
  left: 18%;
  top: 12%;
  width: 44%;
  height: 18%;
  border-radius: 50%;
  background: #FFC58C;
}
.boot-cards span:nth-child(1) { transform: rotate(-16deg) translateX(-18px); animation-delay: 0s; }
.boot-cards span:nth-child(2) { transform: translateY(-6px); z-index: 2; animation-delay: .12s; }
.boot-cards span:nth-child(3) { transform: rotate(16deg) translateX(18px); animation-delay: .24s; }
@keyframes bootDeal {
  0%, 100% { margin-top: 0; }
  50% { margin-top: -7px; }
}
.boot-splash b { font-size: 20px; font-weight: 900; color: var(--ink); letter-spacing: .5px; }
.boot-splash small { font-size: 11px; color: var(--muted); }
.boot-reload {
  margin-top: 4px;
  height: 36px;
  padding: 0 18px;
  border-radius: 12px;
  background: var(--orange);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 3px 0 #D85B11;
}

/* 牌面萌宠放大 + 压住状态更明显 */
.tile-art { width: 94%; top: 53%; }
.mini-art { width: 96%; top: 53%; }
.tile .sheen { opacity: .62; }
.tile.blocked .tile-inner { filter: brightness(.66) saturate(.72); }
.tile.blocked::after {
  background: rgba(42, 22, 8, .34);
  box-shadow: inset 0 0 0 2px rgba(54, 28, 10, .22);
}
.tile.blocked .lock-badge { background: rgba(50, 25, 8, .88); }

@media (max-height: 700px) {
  .home-scroll { gap: 8px; padding-top: calc(env(safe-area-inset-top) + 8px); padding-bottom: calc(env(safe-area-inset-bottom) + 18px); }
  .home-hero { min-height: 158px; padding: 13px 14px; }
  .home-hero h1 { font-size: 25px; margin-top: 7px; }
  .home-hero p { font-size: 10.5px; margin-bottom: 9px; }
  .hero-play { height: 34px; font-size: 11px; }
  .hero-stack { transform: scale(.86); transform-origin: right bottom; right: 0; bottom: -2px; }
  .home-stat { padding: 8px 0; }
  .home-mode { min-height: 68px; padding: 10px 11px; }
  .hm-icon { width: 44px; height: 44px; border-radius: 14px; }
  .hm-copy b { font-size: 15px; }
  .home-rank { padding: 11px; }
  .home-section-title { padding-top: 0; }
}
@media (max-height: 620px) {
  .home-hero { min-height: 142px; }
  .home-hero p { display: none; }
  .home-hero h1 { font-size: 23px; }
  .hero-stack { transform: scale(.74); }
  .home-stat span { font-size: 8.5px; }
}
@media (max-width: 350px) {
  .home-hero h1 { font-size: 25px; }
  .home-hero p { max-width: 160px; }
  .hero-copy { width: 66%; }
  .hero-stack { transform: scale(.82); transform-origin: right bottom; }
  .home-user b { max-width: 120px; }
}

/* 广告复活按钮 / 结算链接 / 补给禁用态 */
.btn.ad-revive {
  margin-top: 12px;
  height: 46px;
  color: #fff;
  background: linear-gradient(180deg, #8BE1CD 0%, #48BFA5 100%);
  box-shadow: 0 4px 0 #2F9A82, 0 8px 16px rgba(60, 175, 150, .24);
  font-size: 13.5px;
  letter-spacing: .2px;
}
.btn.ad-revive .mp-icon { width: 18px; height: 18px; color: #FFF8E9; }
.btn.ad-revive:active { transform: translateY(3px); box-shadow: 0 1px 0 #2F9A82; }
.dialog-links {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2px 12px;
  margin-top: 5px;
}
.dialog-links .text-link { margin-top: 7px; }
.ad-supply:disabled { opacity: .5; filter: saturate(.7); }


/* Server-managed AdPopup */
.ad-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(38, 25, 16, .62);
  overscroll-behavior: contain;
}
.ad-popup-overlay[hidden] { display: none; }
.ad-popup {
  position: relative;
  width: min(100%, 380px);
  max-height: min(82dvh, 680px);
  overflow: auto;
  padding: 24px 20px 20px;
  border: 2px solid #fff;
  border-radius: 20px;
  background: #FFF8EE;
  box-shadow: 0 18px 54px rgba(35, 22, 12, .34);
  text-align: center;
}
.ad-popup-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #FFE7D1;
  color: #7E4325;
  font-size: 30px;
  line-height: 1;
}
.ad-popup-image-wrap { margin: 22px -4px 14px; }
.ad-popup-image-wrap[hidden] { display: none; }
.ad-popup-image { display: block; width: 100%; max-height: 42dvh; object-fit: contain; border-radius: 12px; }
.ad-popup h2 { margin: 12px 36px 8px; color: #4B2A16; font-size: 21px; line-height: 1.35; }
.ad-popup-content { margin: 0; color: #76543D; font-size: 15px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.ad-popup-link { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; margin-top: 18px; padding: 0 22px; border-radius: 14px; background: #FF8A3D; color: #fff; font-weight: 800; text-decoration: none; }
.ad-popup-link[hidden] { display: none; }
