:root {
  --orange: #FF8A3D;
  --orange-deep: #1FED71;
  --orange-soft: #FFD8BC;
  --cream: #FFF8F0;
  --paper: #FFFCF7;
  --bg: #FFF2E5;
  --ink: #1E3F2B;
  --ink-soft: #376D4D;
  --muted: #6BA484;
  --line: #C3EFD8;
  --green: #7F47B9;
  --green-deep: #572585;
  --shadow-soft: 0 12px 26px rgba(134, 72, 33, .12);
  --shadow-card: 0 16px 34px rgba(134, 72, 33, .15);
}

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

html {
  min-height: 100%;
  background: #F8EBDE;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  background:
    radial-gradient(circle at 7% -4%, rgba(255, 207, 164, .88) 0, rgba(255, 207, 164, 0) 39%),
    radial-gradient(circle at 98% 14%, rgba(255, 177, 130, .55) 0, rgba(255, 177, 130, 0) 33%),
    radial-gradient(circle at 50% 106%, rgba(255, 212, 176, .72) 0, rgba(255, 212, 176, 0) 47%),
    linear-gradient(180deg, #FFF9F2 0%, #FFF3E8 48%, #FBEBDD 100%);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(167, 108, 67, .28) 0.7px, transparent 0.7px);
  background-size: 23px 23px;
  opacity: .13;
  mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .55) 55%, transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .55) 55%, transparent 100%);
}

body::after {
  content: "";
  position: fixed;
  width: 360px;
  height: 360px;
  right: -190px;
  top: 22%;
  border: 38px solid rgba(255, 255, 255, .3);
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

body.sheet-open {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

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

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(255, 138, 61, .55);
  outline-offset: 2px;
}

img {
  display: block;
}

[hidden] {
  display: none !important;
}

.game {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 10px 16px 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px calc(env(safe-area-inset-bottom, 0px) + 12px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---------- 顶部玩家条 ---------- */
.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
}

.player-card {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 4px 11px 4px 4px;
  border-radius: 999px;
  background: rgba(255, 253, 249, .72);
  border: 1px solid rgba(255, 255, 255, .92);
  box-shadow: 0 6px 16px rgba(129, 79, 43, .09);
  text-align: left;
  transition: transform .14s ease, background .14s ease;
}

.player-card:active {
  transform: scale(.98);
  background: rgba(255, 248, 239, .95);
}

.avatar-slot {
  width: 39px;
  height: 39px;
  flex: 0 0 39px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  background: linear-gradient(145deg, #FFE4C4, #F7A55E);
  box-shadow: 0 0 0 2px #FFFDF8, 0 3px 8px rgba(122, 65, 30, .17);
}

.avatar-slot img,
.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.player-name {
  display: block;
  max-width: 124px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13.5px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: .01em;
  color: #1D3E2A;
}

.player-sub {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  line-height: 1.2;
  color: #64A27F;
  white-space: nowrap;
}

.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #7568BA;
  box-shadow: 0 0 0 2px rgba(104, 186, 114, .16);
}

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

.coin-pill {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px 0 5px;
  border-radius: 999px;
  background: #FFF3DF;
  border: 1px solid #FFD5AC;
  box-shadow: 0 3px 0 #AFF4D4, 0 6px 12px rgba(158, 94, 44, .08);
  color: #1F9759;
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.coin-ico {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #FFDE79 0%, #FFB83F 54%, #2AEB98 100%);
  box-shadow: inset 0 -2px 0 rgba(164, 91, 8, .25), 0 2px 5px rgba(196, 119, 29, .24);
}

.coin-ico > span {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: #FFF4C7;
  box-shadow: inset 0 0 0 2px #2ADFA6;
}

.round-btn {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 252, 247, .82);
  border: 1px solid rgba(255, 255, 255, .95);
  box-shadow: 0 4px 11px rgba(129, 79, 43, .1);
  color: #398A5D;
  transition: transform .14s ease, background .14s ease;
}

.round-btn:active {
  transform: scale(.92);
  background: #FFF0E1;
}

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

/* ---------- 关卡进度 ---------- */
.progress-row {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 24px;
  padding: 0 2px;
}

.level-tag {
  display: flex;
  align-items: baseline;
  gap: 2px;
  flex: 0 0 auto;
  height: 23px;
  padding: 0 8px;
  border-radius: 8px;
  background: #1E3E2B;
  color: #FFF6E9;
  font-size: 9px;
  font-weight: 600;
  line-height: 23px;
  box-shadow: 0 3px 0 #ADD9C2;
}

.level-tag strong {
  font-size: 13px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: .02em;
}

.level-total {
  opacity: .62;
  font-size: 9px;
}

.progress-track {
  flex: 1;
  height: 7px;
  border-radius: 999px;
  overflow: hidden;
  background: #C5F0D9;
  box-shadow: inset 0 1px 2px rgba(111, 66, 38, .09);
}

#progressFill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #FFB05A 0%, #FF8A3D 55%, #22F27A 100%);
  box-shadow: 0 0 9px rgba(255, 138, 61, .55);
  transition: width .55s cubic-bezier(.22, .8, .2, 1);
}

.streak-tag {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
  color: #2AA66B;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.streak-tag .mp-icon {
  width: 15px;
  height: 15px;
  color: #32F092;
}

/* ---------- 主画面 ---------- */
.stage-card {
  position: relative;
  flex: 0 0 auto;
  padding: 8px 8px 0;
  border-radius: 25px;
  background: linear-gradient(180deg, #FFFDF9, #FFF9F1);
  border: 1px solid rgba(255, 255, 255, .96);
  box-shadow: var(--shadow-card), inset 0 1px 0 #FFFFFF;
}

.scene-frame {
  position: relative;
  height: clamp(194px, 30.5vh, 254px);
  height: clamp(194px, 30.5dvh, 254px);
  border-radius: 19px;
  overflow: hidden;
  background: linear-gradient(145deg, #F8D7B7, #7FF1B6);
  box-shadow: inset 0 -8px 18px rgba(94, 52, 25, .09);
}

.scene-svg {
  display: block;
  width: 100%;
  height: 100%;
  animation: sceneIn .52s cubic-bezier(.22, .8, .2, 1);
}

.scene-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .32),
    inset 0 -22px 34px rgba(72, 40, 22, .09);
}

.scene-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: rgba(90, 53, 33, .32);
  font-size: 84px;
  font-weight: 900;
}

@keyframes sceneIn {
  from { opacity: .3; transform: scale(1.025); }
  to { opacity: 1; transform: scale(1); }
}

.stage-badges {
  position: absolute;
  z-index: 2;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.badge-soft {
  background: rgba(255, 252, 246, .86);
  color: #22B562;
  border: 1px solid rgba(255, 255, 255, .96);
  box-shadow: 0 4px 10px rgba(92, 54, 29, .1);
}

.badge-paper {
  background: rgba(55, 35, 25, .66);
  color: #FFF8EC;
  border: 1px solid rgba(255, 255, 255, .18);
  box-shadow: 0 4px 10px rgba(92, 54, 29, .12);
}

.scene-caption {
  height: 31px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #619E7C;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .04em;
}

.caption-dash {
  width: 17px;
  height: 1px;
  background: linear-gradient(90deg, rgba(218, 180, 151, 0), #9AD8B6);
}

.caption-dash:last-child {
  background: linear-gradient(90deg, #9AD8B6, rgba(218, 180, 151, 0));
}

/* ---------- 答案槽 ---------- */
.answer-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
}

.answer-slots {
  width: 100%;
  max-width: 360px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.slot {
  position: relative;
  height: 54px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: rgba(255, 252, 247, .82);
  border: 1.5px solid #BEECD4;
  box-shadow: 0 3px 0 #B5E6CC, inset 0 1px 0 rgba(255, 255, 255, .9);
  color: var(--ink);
  font-size: 25px;
  font-weight: 900;
  line-height: 1;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.slot.empty::after {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #B5E5CB;
}

.slot.filled {
  background: #FFF2E3;
  border-color: #FFC28B;
  box-shadow: 0 3px 0 #F6B77D, inset 0 1px 0 #FFF9F0;
  animation: slotPop .19s cubic-bezier(.2, .9, .3, 1.4);
}

.slot.revealed {
  color: #20C264;
  background: linear-gradient(180deg, #FFF8EC, #FFE9D2);
  border-color: #FFA75D;
}

.slot.revealed::before {
  content: "";
  position: absolute;
  top: 5px;
  right: 6px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #FF9B4A;
  box-shadow: 0 0 0 3px rgba(255, 155, 74, .14);
}

.slot.solved {
  color: var(--green-deep);
  background: #E9F8EE;
  border-color: #9D83CF;
  box-shadow: 0 3px 0 #B7A6DE, inset 0 1px 0 #FFFFFF;
}

@keyframes slotPop {
  0% { transform: scale(.8); }
  70% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

.answer-slots.shake {
  animation: answerShake .46s cubic-bezier(.36, .07, .19, .97);
}

@keyframes answerShake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}

.answer-tip {
  min-height: 15px;
  margin: 0;
  padding: 0 8px;
  text-align: center;
  font-size: 10.5px;
  line-height: 1.45;
  color: #70A687;
  transition: color .2s ease;
}

.answer-tip.clue {
  color: #2BA95C;
  font-weight: 700;
  padding: 2px 10px;
  background: rgba(255, 239, 220, .78);
  border-radius: 999px;
}

/* ---------- 候选字 ---------- */
.bank-block {
  display: flex;
  justify-content: center;
  flex: 0 0 auto;
  margin-top: 1px;
}

.char-bank {
  width: 100%;
  max-width: 360px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.char-tile {
  position: relative;
  height: clamp(44px, 6.4vh, 54px);
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #FFFDF9;
  border: 1px solid #C5F0D9;
  box-shadow: 0 3px 0 #B8E6CE, 0 7px 12px rgba(129, 78, 41, .06);
  color: #224A31;
  font-size: 23px;
  font-weight: 700;
  line-height: 1;
  transition: transform .12s ease, box-shadow .12s ease, opacity .18s ease, background .12s ease;
}

.char-tile::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .7);
  pointer-events: none;
}

.char-tile:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #B8E6CE;
  background: #FFF7EC;
}

.char-tile.used {
  opacity: .18;
  transform: scale(.92);
  pointer-events: none;
  box-shadow: none;
}

.bank-block.coach .char-tile:first-child {
  animation: tileCoach 1.6s ease-in-out 4;
}

@keyframes tileCoach {
  0%, 100% { box-shadow: 0 3px 0 #B8E6CE, 0 7px 12px rgba(129, 78, 41, .06); }
  50% { box-shadow: 0 0 0 4px rgba(255, 138, 61, .17), 0 3px 0 #B8E6CE; }
}

/* ---------- 底部操作 ---------- */
.game-actions {
  display: grid;
  grid-template-columns: 1.32fr 1fr .9fr;
  gap: 8px;
  margin-top: auto;
  padding-top: 7px;
  flex: 0 0 auto;
}

.action-btn {
  height: 48px;
  min-width: 0;
  padding: 0 8px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: #FFFDF9;
  border: 1px solid #C2EED7;
  box-shadow: 0 4px 0 #B3E3CA;
  color: #387853;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  transition: transform .13s ease, box-shadow .13s ease;
}

.action-btn .mp-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}

.action-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #B3E3CA;
}

.action-primary {
  color: #FFFFFF;
  background: linear-gradient(135deg, #FFA55B 0%, #FF8436 48%, #F87526 100%);
  border-color: #2FF180;
  box-shadow: 0 4px 0 #1DD968, 0 9px 18px rgba(237, 106, 31, .2);
  text-shadow: 0 1px 0 rgba(157, 71, 16, .15);
}

.action-primary:active {
  box-shadow: 0 1px 0 #1DD968;
}

.price {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .2);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0;
}

.price-coin {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #FFE28A;
  border: 1px solid #2FE5AD;
}

/* ---------- 提示 ---------- */
.toast {
  position: fixed;
  z-index: 130;
  left: 50%;
  top: calc(env(safe-area-inset-top, 0px) + 62px);
  max-width: 84vw;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(55, 34, 23, .93);
  box-shadow: 0 8px 20px rgba(62, 38, 22, .2);
  color: #FFF8ED;
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -8px) scale(.96);
  transition: opacity .18s ease, transform .18s ease;
}

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

/* ---------- 彩纸 ---------- */
.fx {
  position: fixed;
  inset: 0;
  z-index: 125;
  overflow: hidden;
  pointer-events: none;
}

.confetti {
  position: absolute;
  top: -16px;
  width: 8px;
  height: 12px;
  border-radius: 3px;
  opacity: .95;
  animation: confettiFall 1.9s cubic-bezier(.2, .55, .4, 1) forwards;
}

@keyframes confettiFall {
  0% { transform: translate3d(0, -20px, 0) rotate(0); opacity: 1; }
  100% { transform: translate3d(var(--drift, 20px), 105vh, 0) rotate(620deg); opacity: .15; }
}

/* ---------- 弹层 ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(53, 33, 22, .46);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}

.sheet-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.sheet {
  position: fixed;
  z-index: 70;
  left: 0;
  right: 0;
  bottom: 0;
  width: min(100%, 460px);
  max-height: 92vh;
  max-height: 92dvh;
  margin: 0 auto;
  padding: 9px 20px 18px;
  padding: 9px 20px calc(18px + env(safe-area-inset-bottom, 0px));
  border-radius: 28px 28px 0 0;
  background:
    radial-gradient(circle at 88% 0%, rgba(255, 211, 170, .55) 0, rgba(255, 211, 170, 0) 42%),
    linear-gradient(180deg, #FFFDF8 0%, #FFF8EF 100%);
  box-shadow: 0 -18px 44px rgba(76, 41, 21, .2);
  transform: translateY(105%);
  visibility: hidden;
  transition: transform .4s cubic-bezier(.22, .82, .18, 1), visibility 0s linear .4s;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sheet.open {
  transform: translateY(0);
  visibility: visible;
  transition: transform .4s cubic-bezier(.22, .82, .18, 1), visibility 0s;
}

.sheet-handle {
  width: 42px;
  height: 5px;
  margin: 1px auto 15px;
  border-radius: 999px;
  background: #BAE7D0;
}

.success-head {
  display: flex;
  align-items: center;
  gap: 11px;
}

.success-seal {
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #FFFFFF;
  background: linear-gradient(145deg, #946BCF, #6B35A9);
  box-shadow: 0 5px 0 #572A8E, 0 10px 20px rgba(51, 169, 103, .24);
}

.success-seal .mp-icon {
  width: 27px;
  height: 27px;
}

.eyebrow {
  margin: 0 0 2px;
  color: #5BB07F;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .09em;
}

.success-head h2,
.profile-head h2 {
  margin: 0;
  color: #1C3D29;
  font-size: 21px;
  line-height: 1.2;
  font-weight: 900;
  letter-spacing: -.02em;
}

.profile-head h2 {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.reward-badge {
  margin-left: auto;
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px 5px 5px;
  border-radius: 12px;
  background: #FFF0D8;
  border: 1px solid #FFD19A;
  color: #1FA55C;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 2px 0 #A6F3D4;
}

.success-sheet.open .reward-badge {
  animation: rewardPop .45s .15s both cubic-bezier(.2, .9, .3, 1.4);
}

.reward-badge .coin-ico {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

.reward-badge .coin-ico > span {
  width: 7px;
  height: 7px;
}

@keyframes rewardPop {
  from { opacity: 0; transform: scale(.7) rotate(-5deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}

.answer-reveal {
  text-align: center;
  padding: 12px 0 12px;
}

.answer-reveal h3 {
  margin: 0;
  color: #183824;
  font-size: clamp(32px, 10vw, 40px);
  line-height: 1.15;
  font-weight: 900;
  letter-spacing: .13em;
  text-indent: .13em;
}

.answer-reveal p {
  margin: 5px 0 0;
  color: #70B08B;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
  letter-spacing: .08em;
}

.meaning-card {
  padding: 12px 14px;
  border-radius: 17px;
  background: #FFF5E8;
  border: 1px solid #C5F1DE;
  color: #285A3C;
  font-size: 12.5px;
  line-height: 1.68;
}

.meaning-card p {
  margin: 0;
}

.meaning-card .source {
  margin-top: 6px;
  color: #71AF8C;
  font-size: 10px;
  letter-spacing: .02em;
}

.success-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 0 12px;
  color: #65A17F;
  font-size: 10.5px;
  font-weight: 600;
}

.sheet-actions {
  display: flex;
  gap: 8px;
}

.next-btn {
  flex: 1;
  min-width: 0;
  height: 50px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #FFFFFF;
  background: linear-gradient(135deg, #FFA65B 0%, #FF8436 48%, #F87526 100%);
  box-shadow: 0 5px 0 #1DD968, 0 10px 20px rgba(237, 106, 31, .22);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: .04em;
  text-shadow: 0 1px 0 rgba(157, 71, 16, .14);
  transition: transform .13s ease, box-shadow .13s ease;
}

.next-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #1DD968;
}

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

.mini-share {
  width: 52px;
  height: 50px;
  flex: 0 0 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: #FFF9F0;
  border: 1px solid #C1ECD6;
  box-shadow: 0 4px 0 #B3E3CA;
  color: #3E7E59;
}

.mini-share:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #B3E3CA;
}

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

/* ---------- 玩家档案 ---------- */
.profile-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.profile-avatar {
  width: 62px;
  height: 62px;
  flex: 0 0 62px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(145deg, #FFE4C4, #F7A55E);
  box-shadow: 0 0 0 3px #FFFDF8, 0 6px 14px rgba(122, 65, 30, .16);
}

.profile-intro {
  min-width: 0;
  flex: 1;
}

.profile-hint {
  margin: 3px 0 0;
  color: #6DA686;
  font-size: 10px;
  line-height: 1.35;
}

.profile-close {
  width: 34px;
  height: 34px;
  min-width: 34px;
  align-self: flex-start;
}

.profile-close .mp-icon {
  width: 18px;
  height: 18px;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 10px 0;
  border-radius: 17px;
  background: #FFF5E8;
  border: 1px solid #C8F2DF;
}

.profile-stats > div {
  position: relative;
  text-align: center;
}

.profile-stats > div + div::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: #C1EED9;
}

.profile-stats strong {
  display: block;
  color: #1D402B;
  font-size: 20px;
  line-height: 1.1;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.profile-stats span {
  display: block;
  margin-top: 3px;
  color: #65A17F;
  font-size: 9.5px;
  font-weight: 600;
}

.nickname-label {
  display: block;
  margin: 15px 0 6px;
  color: #65A17F;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .04em;
}

.nickname-row {
  display: flex;
  gap: 8px;
}

#nicknameInput {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 13px;
  border-radius: 13px;
  border: 1px solid #C0EBD5;
  background: #FFFDF9;
  color: #1F3F2C;
  font-size: 14px;
  font-weight: 600;
  outline: none;
  box-shadow: inset 0 2px 4px rgba(111, 71, 43, .04);
}

#nicknameInput::placeholder {
  color: #8CC0A4;
  font-weight: 400;
}

#saveName {
  height: 44px;
  padding: 0 17px;
  border-radius: 13px;
  background: #1E3E2B;
  color: #FFF8ED;
  font-size: 12.5px;
  font-weight: 800;
  box-shadow: 0 3px 0 #A4CDB7;
  transition: transform .13s ease;
}

#saveName:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #A4CDB7;
}

.avatar-picker {
  margin-top: 14px;
}

.avatar-picker p {
  margin: 0 0 8px;
  color: #65A17F;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .04em;
}

#avatarOptions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.avatar-choice {
  width: 48px;
  height: 48px;
  padding: 3px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: border-color .15s ease, transform .15s ease;
}

.avatar-choice .cat-avatar {
  border-radius: 50%;
  overflow: hidden;
}

.avatar-choice.active {
  border-color: #FF8A3D;
  transform: translateY(-2px);
}

.profile-share {
  width: 100%;
  height: 46px;
  margin-top: 15px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: #FFF3E3;
  border: 1px solid #BCF1D8;
  color: #368E5D;
  font-size: 12.5px;
  font-weight: 800;
  box-shadow: 0 3px 0 #B8E8CF;
}

.profile-share:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #B8E8CF;
}

.profile-share .mp-icon {
  width: 17px;
  height: 17px;
}

.profile-tip {
  margin: 10px 0 0;
  color: #81B297;
  font-size: 9px;
  line-height: 1.55;
  text-align: center;
}

/* ---------- 手绘猫头像 ---------- */
.cat-avatar {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(145deg, #FFD9AD 0%, #F7A762 100%);
}

.cat-avatar.v1 {
  background: linear-gradient(145deg, #CDEEDC 0%, #A779C9 100%);
}

.cat-avatar.v2 {
  background: linear-gradient(145deg, #E1D7FA 0%, #E1AD91 100%);
}

.cat-avatar.v3 {
  background: linear-gradient(145deg, #D7ECFC 0%, #E582BA 100%);
}

.cat-avatar.v4 {
  background: linear-gradient(145deg, #FFD9E2 0%, #B3F3A1 100%);
}

.cat-ear {
  position: absolute;
  top: 8%;
  left: 10%;
  z-index: 1;
  width: 33%;
  height: 34%;
  border-radius: 48% 48% 14% 14%;
  background: #F8E7D3;
  transform: rotate(-21deg);
}

.cat-ear.r {
  left: auto;
  right: 10%;
  transform: rotate(21deg);
}

.cat-ear::after {
  content: "";
  position: absolute;
  left: 25%;
  top: 22%;
  width: 50%;
  height: 50%;
  border-radius: inherit;
  background: #A9F1B7;
}

.cat-face {
  position: absolute;
  left: 12%;
  top: 22%;
  z-index: 2;
  width: 76%;
  height: 70%;
  border-radius: 47% 47% 45% 45%;
  background: #FFF4E4;
  box-shadow: inset 0 -4px 0 rgba(228, 162, 112, .19);
}

.cat-eye {
  position: absolute;
  top: 41%;
  width: 8%;
  height: 12%;
  border-radius: 50%;
  background: #214A31;
}

.cat-eye.l { left: 26%; }
.cat-eye.r { right: 26%; }
.cat-eye::after {
  content: "";
  position: absolute;
  left: 18%;
  top: 10%;
  width: 38%;
  height: 38%;
  border-radius: 50%;
  background: #FFFFFF;
}

.cat-nose {
  position: absolute;
  left: 46%;
  top: 56%;
  width: 8%;
  height: 6%;
  border-radius: 60% 60% 50% 50%;
  background: #79D890;
}

.cat-mouth {
  position: absolute;
  left: 38%;
  top: 62%;
  width: 24%;
  height: 10%;
  border-bottom: 1.5px solid #448A5C;
  border-radius: 0 0 50% 50%;
}

.cat-blush {
  position: absolute;
  top: 55%;
  width: 13%;
  height: 7%;
  border-radius: 50%;
  background: rgba(240, 145, 133, .36);
}

.cat-blush.l { left: 12%; }
.cat-blush.r { right: 12%; }

/* ---------- 小屏适配 ---------- */
@media (max-height: 740px) {
  .game {
    gap: 6px;
    padding-top: 6px;
    padding-bottom: 7px;
    padding-top: calc(env(safe-area-inset-top, 0px) + 6px);
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 7px);
  }

  .hud { min-height: 40px; }

  .scene-frame { height: clamp(158px, 27.5vh, 210px); height: clamp(158px, 27.5dvh, 210px); }

  .stage-card { border-radius: 22px; padding: 6px 6px 0; }

  .scene-caption { height: 26px; }

  .slot { height: 47px; border-radius: 13px; font-size: 22px; }

  .char-tile { height: clamp(40px, 6.2vh, 48px); font-size: 21px; }

  .game-actions { padding-top: 4px; }

  .action-btn { height: 43px; font-size: 11.5px; }

  .action-btn .mp-icon { width: 15px; height: 15px; flex-basis: 15px; }

  .answer-tip { font-size: 10px; }
}

@media (max-width: 360px) {
  .game { padding-left: 12px; padding-right: 12px; }

  .player-name { max-width: 96px; font-size: 12.5px; }

  .player-sub { font-size: 9px; }

  .avatar-slot { width: 36px; height: 36px; flex-basis: 36px; }

  .coin-pill { height: 34px; padding-right: 8px; font-size: 12px; }

  .coin-ico { width: 24px; height: 24px; flex-basis: 24px; }

  .round-btn { width: 35px; height: 35px; min-width: 35px; }

  .action-btn { gap: 3px; padding: 0 5px; }

  .action-btn span:not(.price) { font-size: 10.5px; }

  .price { font-size: 8px; padding: 0 4px; }
}

@media (min-width: 600px) {
  .game {
    margin-top: 18px;
    margin-bottom: 18px;
    min-height: calc(100dvh - 36px);
    padding: 18px 20px 18px;
    border-radius: 34px;
    background: rgba(255, 252, 247, .54);
    box-shadow: 0 30px 70px rgba(111, 66, 36, .16), inset 0 1px 0 #FFFFFF;
    border: 1px solid rgba(255, 255, 255, .85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .scene-frame { height: clamp(230px, 34vh, 280px); height: clamp(230px, 34dvh, 280px); }
}

@media (min-width: 900px) and (min-height: 760px) {
  .game { margin-top: 26px; margin-bottom: 26px; min-height: calc(100dvh - 52px); }
}

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