:root {
  --brand: #FF8A3D;
  --brand-deep: #E96F1E;
  --brand-soft: #FFE2CC;
  --ink: #33241A;
  --ink-2: #7A6556;
  --ink-3: #A89685;
  --cream: #FFF9F0;
  --card: #FFFDF8;
  --line: #F0DFCC;
  --ok: #2F9E6A;
  --bad: #EF5A4C;
  --shadow: 0 10px 24px rgba(140, 90, 40, .16);
}

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

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

button {
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}

.stage {
  position: relative;
  display: block;
  width: 100%;
  max-width: 600px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 86% 4%, rgba(255, 190, 130, .55) 0 12%, transparent 40%),
    radial-gradient(circle at 8% 12%, rgba(255, 220, 185, .8) 0 10%, transparent 38%),
    linear-gradient(180deg, #FFF1E1 0%, #FBE3CB 58%, #F4D6B6 100%);
}

/* 首页与游戏两个视图 */
.game-view {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .34s ease, visibility .34s ease;
}

.stage.playing .game-view {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.home-view {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  background: #BFD9F2;
  opacity: 1;
  visibility: visible;
  transition: opacity .34s ease, transform .34s ease, visibility .34s ease;
}

.stage.playing .home-view {
  opacity: 0;
  visibility: hidden;
  transform: scale(1.035);
  pointer-events: none;
}

.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .45;
  background-image:
    radial-gradient(rgba(233, 111, 30, .14) 1.2px, transparent 1.3px);
  background-size: 18px 18px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 46%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 46%);
}

/* ---------- 顶部信息 ---------- */
.hud {
  position: relative;
  z-index: 6;
  flex: 0 0 auto;
  padding: calc(env(safe-area-inset-top) + 8px) 14px 0;
}

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

.player-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  max-width: 47%;
  height: 38px;
  padding: 3px 11px 3px 4px;
  border-radius: 19px;
  background: rgba(255, 253, 248, .92);
  border: 1px solid rgba(255, 255, 255, .95);
  box-shadow: 0 4px 12px rgba(150, 100, 50, .13);
}

.avatar {
  position: relative;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(160deg, #FFC08A, var(--brand));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .55);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar .mp-icon {
  font-size: 17px;
}

.player-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
}

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

.chip {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 34px;
  padding: 0 10px;
  border-radius: 17px;
  background: rgba(255, 253, 248, .94);
  border: 1px solid rgba(255, 255, 255, .95);
  box-shadow: 0 4px 12px rgba(150, 100, 50, .13);
  font-size: 13px;
  font-weight: 900;
  color: var(--ink);
  white-space: nowrap;
}

.chip .mp-icon {
  font-size: 16px;
  color: var(--brand-deep);
}

.chip small {
  font-size: 10px;
  font-weight: 800;
  color: var(--ink-3);
}

.chip-time {
  color: #D9600F;
}

.chip-time.warn {
  color: #fff;
  background: var(--bad);
  border-color: rgba(255, 255, 255, .7);
  animation: warnPulse .85s ease-in-out infinite;
}

.chip-time.warn .mp-icon,
.chip-time.warn small {
  color: #fff;
}

@keyframes warnPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 4px 12px rgba(150, 100, 50, .13); }
  50% { transform: scale(1.06); box-shadow: 0 4px 18px rgba(239, 90, 76, .5); }
}

/* ---------- 进度 ---------- */
.progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 9px 2px 0;
}

.progress-track {
  flex: 1 1 auto;
  height: 9px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, .72);
  border: 1px solid rgba(255, 255, 255, .85);
  box-shadow: inset 0 1px 3px rgba(150, 100, 50, .17);
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, #FFC07E, var(--brand));
  box-shadow: 0 0 8px rgba(255, 138, 61, .55);
  transition: width .34s cubic-bezier(.2, .9, .3, 1);
}

.progress-label {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 800;
  color: var(--ink-2);
  letter-spacing: .02em;
  white-space: nowrap;
}

/* ---------- 目标清单 ---------- */
.target-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  margin-top: 8px;
}

.target-chip {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  height: 47px;
  padding: 4px 2px;
  border-radius: 12px;
  background: rgba(255, 253, 248, .94);
  border: 1.5px solid rgba(255, 255, 255, .95);
  box-shadow: 0 3px 9px rgba(150, 100, 50, .12);
  transition: background .2s, border-color .2s, transform .2s;
}

.tc-ico {
  width: 21px;
  height: 21px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-deep);
  transition: background .2s, color .2s;
}

.tc-ico .mp-icon {
  font-size: 13px;
}

.tc-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  line-height: 1.1;
  font-weight: 800;
  color: var(--ink-2);
}

.target-chip.done {
  background: #E9F8F0;
  border-color: #BEEBD4;
}

.target-chip.done .tc-ico {
  background: #CFF1E0;
  color: var(--ok);
}

.target-chip.done .tc-name {
  color: var(--ok);
  text-decoration: line-through;
}

.target-chip.chip-pulse {
  animation: chipPulse .9s ease-in-out infinite;
}

@keyframes chipPulse {
  0%, 100% { transform: translateY(0); box-shadow: 0 3px 9px rgba(150, 100, 50, .12); }
  50% { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(255, 138, 61, .35); }
}

/* ---------- 场景 ---------- */
.scene {
  position: relative;
  z-index: 3;
  flex: 1 1 auto;
  min-height: 250px;
  margin: 10px 12px 0;
  overflow: hidden;
  border-radius: 24px;
  border: 2px solid rgba(255, 255, 255, .92);
  background: linear-gradient(180deg, #FFE7CF 0%, #F8CDA6 100%);
  box-shadow: 0 14px 30px rgba(140, 90, 40, .2), inset 0 0 0 1px rgba(255, 138, 61, .08);
  isolation: isolate;
  touch-action: manipulation;
}

.scene-art {
  position: absolute;
  display: block;
  max-width: none;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  opacity: 0;
  transition: opacity .35s ease;
}

.scene.art-ready .scene-art {
  opacity: 1;
}

.scene-shade {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 240, 220, .1) 0%, transparent 16%, transparent 78%, rgba(80, 40, 10, .18) 100%);
  box-shadow: inset 0 0 42px rgba(120, 70, 30, .12);
}

.hotspots,
.fx-layer {
  position: absolute;
  inset: 0;
}

.hotspots {
  z-index: 4;
}

.fx-layer {
  z-index: 6;
  overflow: hidden;
  pointer-events: none;
}

.hotspot {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .12s ease;
}

.hotspot:active {
  transform: scale(.94);
}

.hotspot .spot-ico {
  display: none;
}

.hotspot .wipe {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .9);
  background: rgba(255, 250, 242, .56);
  box-shadow: 0 4px 16px rgba(255, 255, 255, .42), inset 0 0 20px rgba(255, 255, 255, .8);
  -webkit-backdrop-filter: blur(5px) saturate(.85);
  backdrop-filter: blur(5px) saturate(.85);
  opacity: 0;
  transform: scale(.55);
  transition: opacity .28s ease, transform .32s cubic-bezier(.2, 1.3, .4, 1);
}

.hotspot .wipe .mp-icon {
  font-size: 22px;
  color: var(--brand-deep);
  opacity: 0;
  transform: scale(.4);
  transition: opacity .2s ease .1s, transform .26s cubic-bezier(.2, 1.4, .4, 1) .1s;
  filter: drop-shadow(0 1px 0 #fff);
}

.hotspot.found {
  pointer-events: none;
}

.hotspot.found .wipe {
  opacity: 1;
  transform: scale(1);
}

.hotspot.found .wipe .mp-icon {
  opacity: 1;
  transform: scale(1);
}

.hotspot.hint::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .95);
  box-shadow: 0 0 0 4px rgba(255, 138, 61, .5), 0 0 20px rgba(255, 138, 61, .75);
  animation: hintRing .95s ease-in-out infinite;
  pointer-events: none;
}

@keyframes hintRing {
  0%, 100% { transform: scale(.96); opacity: .95; }
  50% { transform: scale(1.08); opacity: .55; }
}

.hotspot.miss::before {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 3px solid rgba(239, 90, 76, .92);
  box-shadow: 0 0 16px rgba(239, 90, 76, .55);
  animation: missRing .38s ease-out forwards;
  pointer-events: none;
}

@keyframes missRing {
  0% { transform: scale(.8); opacity: 1; }
  100% { transform: scale(1.12); opacity: 0; }
}

.hotspot.pop::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 3px solid rgba(255, 138, 61, .9);
  animation: popRing .5s ease-out forwards;
  pointer-events: none;
}

@keyframes popRing {
  0% { transform: scale(.8); opacity: 1; }
  100% { transform: scale(1.65); opacity: 0; }
}

/* 图片加载失败时的降级：用图标摆成可玩的小场景 */
.scene.no-art {
  background:
    radial-gradient(circle at 50% 10%, rgba(255, 255, 255, .7) 0 26%, transparent 60%),
    linear-gradient(180deg, #FFEBD6 0%, #F8D3AF 62%, #E9BE95 100%);
}

.scene.no-art .scene-art {
  display: none;
}

.scene.no-art .hotspot .spot-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, .9);
  background: radial-gradient(circle at 34% 28%, #FFF 0%, #FFF4E8 58%, #FFE2C8 100%);
  box-shadow: 0 4px 10px rgba(150, 100, 50, .2);
  color: var(--brand-deep);
}

.scene.no-art .hotspot .spot-ico .mp-icon {
  font-size: 24px;
}

.scene.no-art .hotspot .wipe {
  opacity: 0 !important;
}

/* ---------- 场景提示 ---------- */
.scene-tip {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 24px);
  padding: 7px 12px;
  border-radius: 20px;
  background: rgba(51, 36, 26, .74);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity .3s ease, transform .3s ease;
  pointer-events: none;
}

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

.scene-tip .mp-icon {
  flex: 0 0 auto;
  font-size: 14px;
  color: #FFC07E;
}

/* ---------- 底部 ---------- */
.bottom-bar {
  position: relative;
  z-index: 6;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
}

.combo-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  padding: 0 12px;
  border-radius: 18px;
  background: rgba(255, 253, 248, .94);
  border: 1px solid rgba(255, 255, 255, .95);
  box-shadow: 0 4px 12px rgba(150, 100, 50, .13);
  font-size: 12px;
  font-weight: 900;
  color: var(--ink-2);
  transition: transform .18s ease, color .18s ease, background .18s ease;
}

.combo-pill .mp-icon {
  font-size: 15px;
  color: var(--brand);
}

.combo-pill.hot {
  color: var(--brand-deep);
  background: #FFF1E2;
  border-color: #FFD2AE;
  transform: scale(1.04);
}

.hint-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 22px;
  background: linear-gradient(180deg, #FFA45F, var(--brand));
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(232, 111, 34, .34);
  cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease, opacity .2s ease;
}

.hint-btn .mp-icon {
  font-size: 17px;
}

.hint-btn em {
  min-width: 19px;
  height: 19px;
  padding: 0 4px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .28);
  font-style: normal;
  font-size: 11px;
  line-height: 19px;
  text-align: center;
}

.hint-btn:active {
  transform: scale(.95);
  box-shadow: 0 3px 10px rgba(232, 111, 34, .3);
}

.hint-btn:disabled {
  opacity: .45;
  box-shadow: none;
}

/* ---------- 飘字与粒子 ---------- */
.float-text {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, -50%);
  color: var(--ok);
  font-size: 16px;
  font-weight: 900;
  white-space: nowrap;
  text-shadow: 0 2px 0 #fff, 0 0 10px rgba(255, 255, 255, .95);
  animation: floatUp .9s ease-out forwards;
  pointer-events: none;
}

.float-text.bad {
  color: var(--bad);
}

@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(.7); }
  22% { opacity: 1; transform: translate(-50%, -62%) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -155%) scale(1); }
}

.spark {
  position: absolute;
  z-index: 1;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: sparkOut .58s ease-out forwards;
  pointer-events: none;
}

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

.ripple {
  position: absolute;
  width: 38px;
  height: 38px;
  margin: -19px 0 0 -19px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .8);
  background: rgba(255, 255, 255, .18);
  animation: rippleOut .42s ease-out forwards;
  pointer-events: none;
}

@keyframes rippleOut {
  0% { opacity: .9; transform: scale(.4); }
  100% { opacity: 0; transform: scale(1.4); }
}

/* ---------- 弹层 ---------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: calc(env(safe-area-inset-top) + 18px) 20px calc(env(safe-area-inset-bottom) + 18px);
  background: rgba(58, 38, 24, .4);
  -webkit-backdrop-filter: blur(9px) saturate(.9);
  backdrop-filter: blur(9px) saturate(.9);
  transition: opacity .28s ease, visibility .28s ease;
}

.overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.card {
  position: relative;
  width: 100%;
  max-width: 352px;
  margin: auto;
  padding: 24px 20px 20px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, .95);
  background: linear-gradient(180deg, #FFFDF8 0%, #FFF7EC 100%);
  box-shadow: 0 24px 50px rgba(70, 40, 16, .34), inset 0 1px 0 #fff;
  text-align: center;
  animation: cardIn .38s cubic-bezier(.2, .9, .3, 1);
}

@keyframes cardIn {
  0% { opacity: 0; transform: translateY(18px) scale(.94); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.card-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: -2px auto 12px;
  border-radius: 21px;
  color: #fff;
  background: linear-gradient(160deg, #FFB26E, var(--brand));
  box-shadow: 0 10px 22px rgba(232, 111, 34, .4), inset 0 2px 0 rgba(255, 255, 255, .48);
  transform: rotate(-4deg);
}

.card-badge .mp-icon {
  font-size: 33px;
  transform: rotate(4deg);
}

.card-badge.cool {
  background: linear-gradient(160deg, #B9C6D2, #8C9CAB);
  box-shadow: 0 10px 22px rgba(80, 100, 120, .32), inset 0 2px 0 rgba(255, 255, 255, .48);
}

.card-title {
  margin: 0;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: .02em;
  color: var(--ink);
}

.card-lead {
  margin: 8px 0 0;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--ink-2);
}

.rule-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 16px 0 0;
  text-align: left;
}

.rule {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  background: #FFF4E7;
  border: 1px solid #F7E1CB;
}

.rule-ico {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #fff;
  color: var(--brand);
  box-shadow: 0 2px 6px rgba(150, 100, 50, .12);
}

.rule-ico .mp-icon {
  font-size: 17px;
}

.rule b {
  display: block;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
  color: var(--ink);
}

.rule span {
  display: block;
  margin-top: 1px;
  font-size: 10.5px;
  line-height: 1.35;
  color: var(--ink-3);
}

.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 52px;
  margin-top: 18px;
  border: 0;
  border-radius: 26px;
  background: linear-gradient(180deg, #FFA45F, var(--brand));
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: .04em;
  box-shadow: 0 10px 22px rgba(232, 111, 34, .38);
  cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease;
}

.cta .mp-icon {
  font-size: 22px;
}

.cta:active {
  transform: scale(.96);
  box-shadow: 0 4px 12px rgba(232, 111, 34, .32);
}

.best-line {
  margin: 10px 0 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
}

.best-line b {
  font-size: 13px;
  color: var(--brand-deep);
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.score-cell {
  padding: 10px 3px;
  border-radius: 14px;
  background: #FFF4E7;
  border: 1px solid #F7E1CB;
}

.score-num {
  font-size: 18px;
  font-weight: 900;
  color: var(--brand-deep);
  white-space: nowrap;
}

.score-cap {
  margin-top: 2px;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-3);
}

/* ---------- 小屏适配 ---------- */
@media (max-height: 660px) {
  .hud { padding-top: calc(env(safe-area-inset-top) + 5px); }
  .progress-row { margin-top: 6px; }
  .target-bar { margin-top: 6px; }
  .target-chip { height: 43px; }
  .scene { margin-top: 7px; min-height: 210px; }
  .bottom-bar { padding-top: 7px; padding-bottom: calc(7px + env(safe-area-inset-bottom)); }
  .card { padding: 18px 16px 16px; border-radius: 24px; }
  .card-badge { width: 54px; height: 54px; border-radius: 18px; margin-bottom: 9px; }
  .card-badge .mp-icon { font-size: 28px; }
  .card-title { font-size: 23px; }
  .card-lead { margin-top: 6px; font-size: 12px; }
  .rule-list { margin-top: 12px; gap: 6px; }
  .rule { padding: 7px 9px; }
  .cta { height: 48px; margin-top: 14px; }
  .score-grid { margin-top: 12px; }
}

@media (max-height: 570px) {
  .card-badge { display: none; }
  .rule-list { margin-top: 10px; }
  .overlay { align-items: flex-start; }
  .card { margin: auto; }
}

@media (min-width: 480px) {
  .scene { margin-left: 16px; margin-right: 16px; }
  .hud { padding-left: 16px; padding-right: 16px; }
  .player-pill { max-width: 40%; }
}

@media (min-width: 601px) {
  body { background: #E9D2BB; }
  .stage { box-shadow: 0 0 70px rgba(90, 50, 20, .24); }
}

/* =====================================================
   首页：成品图 + 可点开始 + 玩家资料 + 底部玩法卡
   ===================================================== */
.home-view {
  --blue: #2B5F9E;
  --blue-deep: #1E4472;
  --gold: #FFC13B;
  --cream: #FFF8EA;
}

.home-art-wrap {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  background:
    radial-gradient(circle at 72% 18%, #FFF4D8 0 8%, transparent 38%),
    radial-gradient(circle at 18% 28%, #FFD9A8 0 10%, transparent 44%),
    linear-gradient(180deg, #A9CFF0 0%, #D9EDFC 42%, #F6E2C8 72%, #F0D0A8 100%);
}

.home-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  opacity: 0;
  transition: opacity .55s ease;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.home-view.art-ready .home-art {
  opacity: 1;
}

.home-view.no-art .home-art {
  display: none;
}

.home-view.no-art .home-art-wrap::before {
  content: "";
  position: absolute;
  left: -10%;
  top: 36%;
  width: 120%;
  height: 62%;
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, .5), transparent 62%);
}

.home-view.no-art .home-art-wrap::after {
  content: "";
  position: absolute;
  right: -8%;
  top: 9%;
  width: 46%;
  height: 46%;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #FFF7E8, #FFE0AE 60%, transparent 72%);
  opacity: .8;
}

.home-scrim {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  height: calc(env(safe-area-inset-top) + 128px);
  pointer-events: none;
  background: linear-gradient(180deg, rgba(18, 47, 84, .62) 0%, rgba(18, 47, 84, .27) 52%, rgba(18, 47, 84, 0) 100%);
  -webkit-backdrop-filter: blur(7px) saturate(.92);
  backdrop-filter: blur(7px) saturate(.92);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 52%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 52%, transparent 100%);
}

.home-view::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 46%, transparent 54%, rgba(16, 38, 64, .2) 100%);
}

/* 顶部玩家资料 */
.home-top {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 8px);
  left: 14px;
  right: 14px;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
}

.home-player {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 64%;
  height: 42px;
  padding: 3px 10px 3px 4px;
  border-radius: 21px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(233, 244, 255, .95));
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(43, 95, 158, .16), 0 6px 16px rgba(12, 34, 60, .24);
}

.home-player .avatar {
  width: 34px;
  height: 34px;
  background: linear-gradient(160deg, #FFD98A, #FF9A3D);
  box-shadow: inset 0 0 0 2px #fff, 0 0 0 2px #FFC94A;
}

.home-player .avatar .mp-icon {
  width: 18px;
  height: 18px;
}

.home-player .player-name {
  font-size: 12.5px;
  color: var(--blue-deep);
}

.home-best {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  padding-left: 9px;
  border-left: 1.5px solid rgba(43, 95, 158, .14);
  white-space: nowrap;
}

.best-coin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #FFE99A, #FFB31F 72%);
  box-shadow: inset 0 0 0 2px rgba(255, 247, 200, .85), 0 2px 5px rgba(150, 80, 0, .25);
}

.best-coin .mp-icon {
  width: 17px;
  height: 17px;
  color: #8A4B00;
}

.best-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
}

.best-cap {
  font-size: 8px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: .03em;
  color: #6B87A5;
}

.home-best b {
  display: inline-block;
  font-size: 14px;
  line-height: 1;
  font-weight: 900;
  color: var(--blue-deep);
}

.home-best b.bump {
  animation: bestPop .5s cubic-bezier(.2, 1.4, .4, 1);
}

@keyframes bestPop {
  0% { transform: scale(1); }
  45% { transform: scale(1.35); color: #E96F1E; }
  100% { transform: scale(1); }
}

.sound-btn {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(233, 244, 255, .95));
  box-shadow: 0 0 0 2px rgba(43, 95, 158, .16), 0 6px 16px rgba(12, 34, 60, .24);
  color: var(--blue);
  cursor: pointer;
  transition: transform .14s ease;
}

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

.sound-btn:active {
  transform: scale(.9);
}

/* 标题牌 */
.title-plaque {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 50px);
  left: 14px;
  z-index: 11;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 50%;
  height: 96px;
  padding: 9px 10px;
  border: 3px solid #fff;
  border-radius: 18px 22px 20px 16px;
  background: linear-gradient(180deg, #FFFDF4 0%, #FFF0CC 100%);
  box-shadow: 0 5px 0 rgba(202, 139, 52, .42), 0 14px 26px rgba(16, 38, 68, .28), inset 0 2px 0 #fff;
  transform: rotate(-2deg);
  transform-origin: left top;
}

.plaque-ico {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(30px, 8.6vw, 40px);
  height: clamp(30px, 8.6vw, 40px);
  border-radius: 12px;
  background: linear-gradient(160deg, #5A97D6, #2B5F9E);
  box-shadow: 0 3px 0 #1B426E, inset 0 1px 0 rgba(255, 255, 255, .45);
  color: #fff;
  transform: rotate(3deg);
}

.plaque-ico .mp-icon {
  width: 58%;
  height: 58%;
}

.plaque-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.plaque-text h1 {
  margin: 0;
  font-size: clamp(17px, 5.6vw, 26px);
  line-height: 1.05;
  font-weight: 900;
  letter-spacing: .01em;
  color: #2B5F9E;
  text-shadow: 0 1px 0 #fff, 0 3px 0 rgba(43, 95, 158, .16);
  white-space: nowrap;
}

.plaque-text p {
  margin: 3px 0 0;
  font-size: clamp(8px, 2.35vw, 11px);
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: .06em;
  color: #B27C3D;
  white-space: nowrap;
}

.plaque-tag {
  position: absolute;
  right: 9px;
  bottom: -13px;
  padding: 3px 8px;
  border: 2px solid #fff;
  border-radius: 9px;
  background: linear-gradient(180deg, #FFB24D, #FF8A3D);
  box-shadow: 0 3px 6px rgba(120, 60, 0, .28);
  color: #fff;
  font-size: 10px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: .02em;
  transform: rotate(3deg);
}

/* 开始按钮：真实点击热区正好盖住成品图里的黄色按钮 */
.home-cta {
  position: absolute;
  left: 5%;
  top: 66.4%;
  z-index: 8;
  width: 90%;
  height: 11.2%;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.home-cta .cta-glow {
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: 0 0 0 2px rgba(255, 231, 139, .72), 0 0 22px 7px rgba(255, 176, 54, .48);
  animation: ctaGlow 2.7s ease-in-out infinite;
}

.home-cta .cta-shine {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

.home-cta .cta-shine::after {
  content: "";
  position: absolute;
  top: -35%;
  left: -70%;
  width: 36%;
  height: 170%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .75), rgba(255, 255, 255, 0));
  transform: rotate(16deg);
  animation: ctaShine 3.8s ease-in-out infinite;
  mix-blend-mode: screen;
}

.home-cta::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 50% 42%, rgba(255, 255, 255, .32), transparent 62%);
  opacity: 0;
  transition: opacity .12s ease;
  pointer-events: none;
}

.home-cta:active::after,
.home-cta.is-pressed::after {
  opacity: 1;
}

.home-cta .cta-fallback {
  display: none;
}

.home-view.no-art .home-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #FFD35A, #FF9A24);
  border: 3px solid #FFE9A8;
  box-shadow: 0 8px 0 #C46A00, 0 16px 30px rgba(120, 60, 0, .4);
}

.home-view.no-art .home-cta .cta-fallback {
  display: block;
  color: #6B3600;
  font-size: clamp(20px, 6vw, 30px);
  font-weight: 900;
  letter-spacing: .08em;
  text-shadow: 0 2px 0 #FFF2B8;
}

.home-view.no-art .home-cta .cta-glow,
.home-view.no-art .home-cta .cta-shine {
  display: none;
}

@keyframes ctaGlow {
  0%, 100% { opacity: .7; transform: scale(.995); }
  50% { opacity: 1; transform: scale(1.012); }
}

@keyframes ctaShine {
  0%, 55% { left: -70%; }
  85%, 100% { left: 130%; }
}

/* 底部玩法面板，盖住成品图里原有的导航图标 */
.home-dock {
  position: absolute;
  left: 0;
  right: 0;
  top: 79%;
  bottom: 0;
  z-index: 9;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  padding: 8px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 3px solid rgba(255, 255, 255, .98);
  border-radius: 26px 26px 0 0;
  background: linear-gradient(180deg, #FFF9EC 0%, #FFEFD3 100%);
  box-shadow: 0 -12px 30px rgba(20, 40, 70, .25), inset 0 2px 0 #fff;
}

.home-dock::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .3;
  background-image: radial-gradient(rgba(233, 140, 61, .2) 1px, transparent 1.2px);
  background-size: 14px 14px;
}

.dock-handle {
  flex: 0 0 auto;
  width: 44px;
  height: 5px;
  margin: 0 auto 6px;
  border-radius: 3px;
  background: #E7C79C;
  opacity: .85;
}

.dock-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 18px;
  padding: 0 2px;
  margin-bottom: 5px;
}

.dock-title {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: .04em;
  color: #5A3A22;
  white-space: nowrap;
}

.dock-title .mp-icon {
  width: 16px;
  height: 16px;
  color: #FF8A3D;
}

.dock-sub {
  flex: 1 1 auto;
  overflow: hidden;
  text-align: right;
  font-size: 9.5px;
  font-weight: 700;
  color: #A5896C;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.rule-grid {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.rule-card {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  min-height: 46px;
  padding: 7px 8px;
  border: 1px solid rgba(255, 255, 255, .98);
  border-radius: 13px;
  background: rgba(255, 255, 255, .8);
  box-shadow: 0 3px 8px rgba(150, 100, 50, .08), inset 0 1px 0 #fff;
}

.rule-card > div {
  min-width: 0;
}

.rule-ico {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
}

.rule-ico .mp-icon {
  width: 18px;
  height: 18px;
}

.rule-ico-orange { background: #FFE7D1; color: #E96F1E; }
.rule-ico-blue { background: #E3F0FF; color: #2B6CB0; }
.rule-ico-red { background: #FFE6E2; color: #E4544A; }
.rule-ico-gold { background: #FFF1C9; color: #C08A00; }

.rule-card b {
  display: block;
  font-size: 12px;
  line-height: 1.15;
  font-weight: 900;
  color: #3B2A1D;
  white-space: nowrap;
}

.rule-card div span {
  display: block;
  margin-top: 1px;
  overflow: hidden;
  font-size: 9.5px;
  line-height: 1.1;
  font-weight: 700;
  color: #9A8069;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.home-dock.compact {
  padding: 6px 14px calc(8px + env(safe-area-inset-bottom));
}

.home-dock.compact .dock-handle {
  height: 4px;
  margin-bottom: 4px;
}

.home-dock.compact .dock-head {
  min-height: 15px;
  margin-bottom: 4px;
}

.home-dock.compact .dock-sub {
  display: none;
}

.home-dock.compact .rule-grid {
  gap: 5px;
}

.home-dock.compact .rule-card {
  min-height: 38px;
  padding: 5px 7px;
  gap: 6px;
  border-radius: 11px;
}

.home-dock.compact .rule-ico {
  width: 26px;
  height: 26px;
  border-radius: 9px;
}

.home-dock.compact .rule-ico .mp-icon {
  width: 16px;
  height: 16px;
}

.home-dock.compact .rule-card b {
  font-size: 11px;
}

.home-dock.compact .rule-card div span {
  font-size: 8.5px;
}

.home-dock.tiny {
  padding: 4px 12px calc(6px + env(safe-area-inset-bottom));
}

.home-dock.tiny .dock-handle,
.home-dock.tiny .dock-sub {
  display: none;
}

.home-dock.tiny .dock-head {
  min-height: 13px;
  margin-bottom: 3px;
}

.home-dock.tiny .dock-title {
  font-size: 11px;
}

.home-dock.tiny .rule-grid {
  gap: 4px;
}

.home-dock.tiny .rule-card {
  min-height: 32px;
  padding: 4px 6px;
  gap: 5px;
  border-radius: 9px;
}

.home-dock.tiny .rule-ico {
  width: 22px;
  height: 22px;
  border-radius: 7px;
}

.home-dock.tiny .rule-ico .mp-icon {
  width: 14px;
  height: 14px;
}

.home-dock.tiny .rule-card b {
  font-size: 10px;
}

.home-dock.tiny .rule-card div span {
  display: none;
}

/* 首页漂浮小星点 */
.home-fx {
  position: absolute;
  inset: 0;
  z-index: 7;
  overflow: hidden;
  pointer-events: none;
}

.fx-spark {
  position: absolute;
  width: 9px;
  height: 9px;
  background: #FFF0A8;
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  opacity: .8;
  filter: drop-shadow(0 0 6px rgba(255, 205, 80, .9));
  animation: twinkle 2.8s ease-in-out infinite;
}

.fx-s1 { top: 16%; left: 85%; animation-delay: .2s; }
.fx-s2 { top: 27%; left: 8%; width: 7px; height: 7px; animation-delay: 1.1s; }
.fx-s3 { top: 61%; left: 89%; width: 7px; height: 7px; animation-delay: 1.8s; }
.fx-s4 { top: 54%; left: 4%; width: 10px; height: 10px; animation-delay: .7s; }

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

/* 结算页次级按钮 */
.cta-ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 44px;
  margin-top: 9px;
  border: 1.5px solid #ECD6BE;
  border-radius: 22px;
  background: #FFF8EE;
  color: #7A6556;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .14s ease, background .14s ease;
}

.cta-ghost .mp-icon {
  width: 18px;
  height: 18px;
  color: #B07A3A;
}

.cta-ghost:active {
  transform: scale(.97);
  background: #FFF0DE;
}

.sound-btn:focus-visible,
.home-cta:focus-visible,
.cta-ghost:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

@media (max-width: 360px) {
  .home-top {
    left: 10px;
    right: 10px;
    gap: 5px;
  }

  .home-player {
    height: 40px;
    padding-right: 8px;
  }

  .home-player .player-name {
    font-size: 11.5px;
  }

  .home-player .avatar {
    width: 32px;
    height: 32px;
  }

  .home-best {
    height: 40px;
    padding-right: 7px;
  }

  .home-best b {
    font-size: 13px;
  }

  .best-coin {
    width: 26px;
    height: 26px;
  }

  .sound-btn {
    width: 40px;
    height: 40px;
  }

  .home-dock {
    padding-left: 12px;
    padding-right: 12px;
  }
}

@media (max-height: 640px) {
  .title-plaque {
    top: calc(env(safe-area-inset-top) + 48px);
  }

  .plaque-text p,
  .plaque-tag {
    display: none;
  }

  .home-dock .dock-sub {
    display: none;
  }
}

@media (min-width: 480px) {
  .home-top {
    left: 18px;
    right: 18px;
  }

  .title-plaque {
    left: 18px;
  }

}

.plaque-strip {
  display: none;
  position: absolute;
  left: 13px;
  bottom: 11px;
  align-items: center;
  gap: 3px;
  padding: 3px 7px;
  border-radius: 8px;
  background: rgba(43, 95, 158, .08);
  color: #4B7BAF;
  font-size: 8.5px;
  line-height: 1;
  font-weight: 900;
  white-space: nowrap;
}

.plaque-strip .mp-icon {
  width: 12px;
  height: 12px;
  color: #E98234;
}

.plaque-strip span {
  margin-left: 1px;
  color: #6F8EA9;
}

.title-plaque.tall .plaque-strip {
  display: flex;
}

.home-player .player-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.home-player .player-name {
  line-height: 1.05;
}

.player-sub {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 8.5px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: .02em;
  color: #7E97B0;
  white-space: nowrap;
}

.player-sub::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #4CC38A;
  box-shadow: 0 0 0 2px rgba(76, 195, 138, .16);
}
