* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #ffe6ef; touch-action: none; user-select: none; -webkit-user-select: none;
  font-family: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, sans-serif; color: #5b3a63; }
canvas#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud { position: fixed; top: max(14px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; z-index: 5; width: min(560px, 94vw); }
.pill { background: #fff; border-radius: 999px; padding: 7px 14px; font-weight: 800; font-size: 15px; white-space: nowrap;
  box-shadow: 0 4px 0 #f3b6cb, 0 8px 18px rgba(214, 90, 140, .18); }
#timer { min-width: 58px; text-align: center; }
#timer.warn { color: #ff4d7d; animation: beat .5s infinite alternate; }
#bar { position: relative; flex: 1; height: 26px; background: #fff; border-radius: 999px; overflow: hidden;
  box-shadow: 0 4px 0 #f3b6cb, 0 8px 18px rgba(214, 90, 140, .18), inset 0 2px 4px rgba(0,0,0,.06); }
#barFill { position: absolute; inset: 3px auto 3px 3px; width: 0; border-radius: 999px; transition: width .25s ease-out;
  background: repeating-linear-gradient(-45deg, #ff7aa8 0 10px, #ff9cc0 10px 20px);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.45); animation: stripes 1s linear infinite; }
#barText { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 14px;
  color: #6b3c6f; text-shadow: 0 1px 0 #fff, 0 -1px 0 #fff, 1px 0 0 #fff, -1px 0 0 #fff; }
.mark { position: absolute; top: 4px; bottom: 4px; width: 2px; background: rgba(150, 90, 140, .25); border-radius: 2px; }
@keyframes stripes { to { background-position: 28px 0; } }
@keyframes beat { to { transform: scale(1.12); } }

#hint { position: fixed; bottom: max(28px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 5;
  background: rgba(255,255,255,.85); padding: 9px 18px; border-radius: 999px; font-weight: 700; font-size: 14px; animation: hintPulse 1.4s ease-in-out infinite; }
@keyframes hintPulse { 50% { transform: translateX(-50%) scale(1.06); } }

/* ---------- 摇杆 ---------- */
#joy { position: fixed; width: 110px; height: 110px; margin: -55px 0 0 -55px; border-radius: 50%; z-index: 4; pointer-events: none;
  background: rgba(255,255,255,.28); border: 3px solid rgba(255,255,255,.7); }
#knob { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #ffc2d8 60%, #ff8fb6); box-shadow: 0 4px 10px rgba(200,60,120,.35); }

/* ---------- 飘字 ---------- */
#floats { position: fixed; inset: 0; pointer-events: none; z-index: 6; }
.float { position: absolute; transform: translate(-50%, -50%); font-weight: 900; font-size: 22px; color: #fff; white-space: nowrap;
  text-shadow: 0 2px 0 var(--c, #ff6f9f), 0 -2px 0 var(--c, #ff6f9f), 2px 0 0 var(--c, #ff6f9f), -2px 0 0 var(--c, #ff6f9f), 0 6px 10px rgba(0,0,0,.18);
  animation: floatUp .9s cubic-bezier(.2,.9,.3,1) forwards; }
.float.big { font-size: 34px; animation-duration: 1.3s; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.4); } 18% { opacity: 1; transform: translate(-50%, -90%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -260%) scale(.9); } }
#combo { position: fixed; top: 22%; left: 50%; transform: translateX(-50%); z-index: 6; pointer-events: none; font-size: 44px; font-weight: 900;
  color: #fff; opacity: 0; white-space: nowrap; letter-spacing: 2px;
  text-shadow: 0 3px 0 #ff5f95, 0 -3px 0 #ff5f95, 3px 0 0 #ff5f95, -3px 0 0 #ff5f95, 0 10px 18px rgba(255, 80, 140, .4); }
#combo.show { animation: comboPop .9s ease-out forwards; }
@keyframes comboPop { 0% { opacity: 0; transform: translateX(-50%) scale(.3) rotate(-8deg); } 20% { opacity: 1; transform: translateX(-50%) scale(1.2) rotate(3deg); }
  35% { transform: translateX(-50%) scale(1) rotate(0); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateX(-50%) translateY(-20px); } }

/* ---------- 浮层 ---------- */
.overlay { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  background: radial-gradient(circle at 50% 45%, rgba(255,240,246,.05) 30%, rgba(255,190,215,.45)); }
.title { display: flex; gap: 4px; }
.title span { font-size: min(18vw, 92px); font-weight: 900; color: #fff; display: inline-block; animation: bounce 1.6s ease-in-out infinite;
  text-shadow: 0 5px 0 #ff6f9f, 0 -2px 0 #ff6f9f, 4px 0 0 #ff6f9f, -4px 0 0 #ff6f9f, 0 9px 0 #d94f80, 0 18px 24px rgba(200, 60, 120, .35); }
.title span:nth-child(2) { animation-delay: .12s; text-shadow: 0 5px 0 #ffb340, 0 -2px 0 #ffb340, 4px 0 0 #ffb340, -4px 0 0 #ffb340, 0 9px 0 #e08f1c, 0 18px 24px rgba(200,120,30,.35); }
.title span:nth-child(3) { animation-delay: .24s; text-shadow: 0 5px 0 #4fcfa7, 0 -2px 0 #4fcfa7, 4px 0 0 #4fcfa7, -4px 0 0 #4fcfa7, 0 9px 0 #2fa883, 0 18px 24px rgba(40,150,120,.35); }
.title span:nth-child(4) { animation-delay: .36s; text-shadow: 0 5px 0 #9a7dff, 0 -2px 0 #9a7dff, 4px 0 0 #9a7dff, -4px 0 0 #9a7dff, 0 9px 0 #7556e0, 0 18px 24px rgba(110,80,220,.35); }
@keyframes bounce { 50% { transform: translateY(-12px) rotate(-3deg); } }
.sub { font-weight: 800; font-size: 17px; background: rgba(255,255,255,.8); padding: 8px 18px; border-radius: 999px; }

.btn { font: inherit; font-size: 24px; font-weight: 900; letter-spacing: 4px; color: #fff; border: 0; cursor: pointer;
  padding: 15px 56px; border-radius: 999px; position: relative;
  background: linear-gradient(#ff9cc2, #ff6e9e); box-shadow: inset 0 -5px 0 rgba(180, 30, 90, .25), inset 0 4px 0 rgba(255,255,255,.5), 0 7px 0 #d9507f, 0 14px 24px rgba(220, 70, 130, .35);
  text-shadow: 0 2px 0 rgba(170, 30, 80, .35); transition: transform .08s; }
.btn:active { transform: translateY(5px); box-shadow: inset 0 -4px 0 rgba(180,30,90,.25), inset 0 4px 0 rgba(255,255,255,.5), 0 2px 0 #d9507f, 0 6px 12px rgba(220,70,130,.3); }
.btn.ghost { font-size: 17px; padding: 10px 30px; background: linear-gradient(#fff, #ffe9f1); color: #c4527f; text-shadow: none;
  box-shadow: inset 0 -4px 0 rgba(200, 80, 130, .12), 0 5px 0 #f3b6cb, 0 10px 18px rgba(214, 90, 140, .18); }
#playBtn { animation: breathe 1.2s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.07); } }

.card { background: #fff; border-radius: 32px; padding: 30px 40px 28px; display: flex; flex-direction: column; align-items: center; gap: 14px;
  box-shadow: 0 10px 0 #f3b6cb, 0 24px 50px rgba(200, 60, 120, .25); animation: cardIn .45s cubic-bezier(.2,1.4,.4,1); }
@keyframes cardIn { from { transform: scale(.5); opacity: 0; } }
#resTitle { font-size: 34px; font-weight: 900; color: #ff5f95; }
#stars { display: flex; gap: 6px; }
#stars i { font-style: normal; font-size: 58px; color: #f1e3ea; text-shadow: 0 4px 0 #e5d0da; transform: scale(.6); transition: none; }
#stars i.on { color: #ffcc33; text-shadow: 0 4px 0 #f0a020, 0 0 18px rgba(255, 200, 50, .6); animation: starIn .45s cubic-bezier(.2,1.6,.4,1) forwards; }
#stars i:nth-child(2) { transform: translateY(-14px) scale(.6); }
#stars i:nth-child(2).on { animation-name: starIn2; }
@keyframes starIn { from { transform: scale(2.2) rotate(-40deg); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes starIn2 { from { transform: translateY(-14px) scale(2.2) rotate(40deg); opacity: 0; } to { transform: translateY(-14px) scale(1.15); opacity: 1; } }
#resPct { font-size: 20px; font-weight: 800; }

/* ---------- 金币 / 皮肤 ---------- */
.coinPill { position: fixed; top: max(14px, env(safe-area-inset-top)); right: 14px; }
#resGain { font-weight: 800; font-size: 15px; color: #a0668f; }
#resGain b { color: #ff5f95; font-size: 19px; }
.row { display: flex; gap: 10px; }
.skinBtn { position: relative; }
.skinBtn.dot::after { content: ''; position: absolute; top: 2px; right: 6px; width: 12px; height: 12px; border-radius: 50%;
  background: #ff3d5e; border: 2px solid #fff; animation: beat .6s infinite alternate; }

#shop { background: rgba(255, 200, 222, .25); justify-content: flex-end; padding-bottom: max(18px, env(safe-area-inset-bottom)); }
.shopCard { width: min(520px, 94vw); background: rgba(255,255,255,.94); border-radius: 30px; padding: 18px 18px 20px; display: flex; flex-direction: column; align-items: center; gap: 12px;
  box-shadow: 0 10px 0 #f3b6cb, 0 24px 50px rgba(200, 60, 120, .25); animation: cardIn .4s cubic-bezier(.2,1.3,.4,1); }
.shopHead { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 0 4px; }
.shopHead b { font-size: 22px; font-weight: 900; color: #ff5f95; }
.shopHead .pill { box-shadow: 0 3px 0 #f3b6cb; background: #fff4f8; }
#skinGrid { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 420px) { #skinGrid { grid-template-columns: repeat(3, 1fr); } }
.skin { background: #fff6fa; border-radius: 18px; padding: 10px 4px 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer;
  border: 3px solid transparent; transition: transform .1s; box-shadow: 0 3px 0 #f6d3e0; }
.skin:active { transform: scale(.95); }
.skin.on { border-color: #ff8fb8; background: #fff; }
.skin span { font-size: 13px; font-weight: 800; }
.skin b { font-size: 12px; padding: 3px 10px; border-radius: 999px; }
.skin .using { background: #ff8fb8; color: #fff; }
.skin .use { background: #ffe1ec; color: #d24f82; }
.skin .buy { background: #fff0c2; color: #b97800; }
.skin .buy.poor { background: #f1e6eb; color: #b39aa6; }
.skin.locked .pv { filter: saturate(.55) brightness(.95); }
.skin.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }
.pv { width: 54px; height: 54px; border-radius: 50%; position: relative;
  background: radial-gradient(circle at 50% 50%, var(--bot) 30%, var(--top) 95%);
  box-shadow: 0 0 0 3px var(--rim), 0 0 14px 3px var(--rim), inset 0 6px 12px rgba(0,0,0,.45); }
.pv::before { content: ''; position: absolute; inset: -3px; border-radius: 50%; padding: 3px; background: var(--ring);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.pv.stars::after { content: ''; position: absolute; inset: 8px; border-radius: 50%;
  background: radial-gradient(1.5px 1.5px at 30% 30%, #fff, transparent), radial-gradient(1.5px 1.5px at 70% 45%, #fff, transparent),
              radial-gradient(1px 1px at 45% 70%, #fff, transparent), radial-gradient(1px 1px at 60% 20%, #ffd0f0, transparent); }
.shopTip { font-size: 12px; color: #b07a9b; font-weight: 700; }
