:root { --ink: #1a1030; --warm: #ffb54a; --gold: #ffd36b; --cream: #fff4e0; --night: #0a0e22; }
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: var(--night); color: var(--cream);
  font-family: "Fredoka", "Nunito", "Segoe UI", system-ui, sans-serif; -webkit-user-select: none; user-select: none; touch-action: none; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* 卡通 UI：粗描边、圆角、厚阴影 */
.bar { height: 14px; border-radius: 8px; background: #241a3d; border: 3px solid var(--ink); overflow: hidden; box-shadow: 0 3px 0 var(--ink); }
.bar > div { height: 100%; width: 0; background: linear-gradient(#ffe38a, #ffb54a); transition: width .12s; }
.bar.red > div { background: linear-gradient(#ff8a7a, #e0453a); }

#hud { position: fixed; inset: 0; pointer-events: none; }
.top { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 12px; right: 12px; display: flex; flex-direction: column; gap: 8px; }
.xp { display: flex; align-items: center; gap: 8px; }
.xp .bar { flex: 1; }
#lv { font-weight: 900; font-size: 18px; color: var(--gold); -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
.row { display: flex; align-items: center; gap: 12px; }
.hp { width: 120px; }
#timer { flex: 1; text-align: center; font-weight: 900; font-size: 22px; -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
.kills { font-weight: 900; font-size: 18px; -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }

.combo { position: absolute; right: 16px; top: 92px; font-weight: 900; font-size: 34px; color: var(--cream);
  -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill; animation: pop .25s ease-out; transform-origin: right center; }
.combo.c1 { color: var(--gold); font-size: 40px; }
.combo.c2 { color: #ff9a4a; font-size: 48px; }
.combo.c3 { color: #ff5a7a; font-size: 56px; }
@keyframes pop { from { transform: scale(1.5); } to { transform: scale(1); } }

#ultBtn { position: absolute; right: 18px; bottom: max(28px, env(safe-area-inset-bottom)); width: 84px; height: 84px; border-radius: 50%;
  pointer-events: auto; border: 4px solid var(--ink); color: var(--cream); font-weight: 900; font-size: 15px; line-height: 1.15;
  background: conic-gradient(#ffb54a calc(var(--p, 0) * 1%), #2a2046 0); box-shadow: 0 5px 0 var(--ink); cursor: pointer; }
#ultBtn span { display: grid; place-items: center; position: absolute; inset: 7px; border-radius: 50%; background: #3b2a66; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; }
#ultBtn.ready { animation: ready 0.8s ease-in-out infinite; }
#ultBtn.ready span { background: #ff8a3a; }
@keyframes ready { 50% { transform: scale(1.08); box-shadow: 0 5px 0 var(--ink), 0 0 26px #ffb54a; } }
#gear { position: absolute; left: 12px; bottom: max(28px, env(safe-area-inset-bottom)); width: 42px; height: 42px; border-radius: 12px; pointer-events: auto;
  background: #2a2046; border: 3px solid var(--ink); color: var(--cream); font-size: 22px; box-shadow: 0 3px 0 var(--ink); }
#fps { position: absolute; left: 64px; bottom: max(38px, env(safe-area-inset-bottom)); font-size: 12px; opacity: .6; }
#settings { position: fixed; left: 12px; bottom: 84px; background: #241a3d; border: 3px solid var(--ink); border-radius: 14px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px; font-weight: 700; box-shadow: 0 4px 0 var(--ink); }

#numbers { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.dmg { position: absolute; left: 0; top: 0; display: none; font-weight: 900; font-size: 20px; color: #fff;
  -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; will-change: transform; }
.dmg.crit { color: var(--gold); font-size: 30px; }

#vignette { position: fixed; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(255, 40, 40, .55) 100%); }
#vignette.hit { animation: hurt .45s ease-out; }
@keyframes hurt { from { opacity: 1; } to { opacity: 0; } }

/* 大招冲击帧：高对比 + 速度线 */
#impact { position: fixed; inset: 0; pointer-events: none; display: grid; place-items: center; }
#impact .lines { position: absolute; inset: -20%; background: repeating-conic-gradient(from 0deg, #fff4e0 0deg 2deg, transparent 2deg 9deg),
  radial-gradient(circle, #1a1030 18%, #ff8a3a 60%); mix-blend-mode: normal; }
#impact .txt { position: relative; font-weight: 900; font-size: 56px; color: var(--gold); -webkit-text-stroke: 10px var(--ink); paint-order: stroke fill; transform: rotate(-6deg); }
#impact.go .lines { animation: impact .42s steps(1) forwards, spin .42s linear; }
#impact.go .txt { animation: slam .42s ease-out forwards; }
@keyframes impact { 0% { opacity: 1; filter: invert(0); } 12% { filter: invert(1); } 24% { filter: invert(0); opacity: .85; } 60% { opacity: .4; } 100% { opacity: 0; } }
@keyframes spin { to { transform: rotate(8deg) scale(1.1); } }
@keyframes slam { 0% { transform: scale(2.4) rotate(-6deg); opacity: 0; } 20% { transform: scale(1) rotate(-6deg); opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(1.1) rotate(-6deg); } }

#joy { position: fixed; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; border: 4px solid rgba(255, 244, 224, .35);
  background: rgba(26, 16, 48, .35); pointer-events: none; }
#joyKnob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%;
  background: rgba(255, 213, 140, .8); border: 4px solid var(--ink); }

#levelup, #title, #dead { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: radial-gradient(circle, rgba(26, 16, 48, .55), rgba(10, 8, 24, .88)); padding: 20px; text-align: center; }
[hidden] { display: none !important; }
h1 { font-size: 48px; font-weight: 900; color: var(--gold); -webkit-text-stroke: 10px var(--ink); paint-order: stroke fill; }
h2 { font-size: 30px; font-weight: 900; color: var(--gold); -webkit-text-stroke: 8px var(--ink); paint-order: stroke fill; }
.hint { opacity: .75; font-size: 14px; max-width: 320px; }
#title button, #dead button, #win button { font: inherit; font-weight: 900; font-size: 22px; padding: 12px 34px; border-radius: 16px; border: 4px solid var(--ink);
  background: var(--warm); color: var(--ink); box-shadow: 0 5px 0 var(--ink); cursor: pointer; }
#cards { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.card { position: relative; width: 150px; min-height: 200px; padding: 16px 10px; border-radius: 18px; border: 4px solid var(--ink); background: #fff4e0; color: var(--ink);
  font: inherit; display: flex; flex-direction: column; align-items: center; gap: 8px; box-shadow: 0 6px 0 var(--ink); cursor: pointer;
  animation: deal .35s cubic-bezier(.2, 1.6, .5, 1) both; }
.card.rare { background: linear-gradient(#e6f0ff, #b9ccff); box-shadow: 0 6px 0 var(--ink), 0 0 22px #7fa8ff; }
.card:hover { transform: translateY(-6px); }
.card .ic { font-size: 44px; }
.card .nm { font-weight: 900; font-size: 20px; }
.card .ds { font-size: 14px; font-weight: 700; }
.card .rk { margin-top: auto; font-size: 12px; font-weight: 900; opacity: .6; }
.card kbd { position: absolute; top: 6px; left: 8px; font-size: 11px; opacity: .45; }
@keyframes deal { from { transform: translateY(60px) rotate(-8deg) scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 520px) { .card { width: 30vw; min-height: 170px; padding: 12px 6px; } .card .nm { font-size: 16px; } .card .ic { font-size: 36px; } }

.st { font-size: 13px; opacity: .8; }
#styleBtns { display: flex; gap: 6px; }
#styleBtns button { font: inherit; font-weight: 800; font-size: 13px; padding: 5px 9px; border-radius: 10px; border: 3px solid var(--ink); background: #3b2a66; color: var(--cream); cursor: pointer; }
#styleBtns button.on { background: var(--warm); color: var(--ink); }
.dmg { font-size: 17px; }

/* ---------- Starlit Eve ---------- */
#timerBox { flex: 1; text-align: center; font-weight: 700; font-size: 16px; -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
#timerBox b { font-size: 22px; color: #fff; }
#timerBox .moon { color: var(--gold); }
#timerBox.soon b { color: #ffd36b; animation: pop .5s ease-out infinite alternate; }
#title.keyart { background: #0a0e22 url(assets/img/keyart-wide.jpg) center / cover no-repeat; justify-content: space-between; padding: 6vh 20px 7vh; }
@media (max-aspect-ratio: 1/1) { #title.keyart { background-image: url(assets/img/keyart-tall.jpg); } }
.logo h1 { font-size: clamp(46px, 9vw, 96px); letter-spacing: 1px; color: #ffe6a8; -webkit-text-stroke: 12px #1a1030; paint-order: stroke fill;
  text-shadow: 0 6px 0 #1a1030, 0 0 40px rgba(255, 190, 90, .6); }
.logo .sub { font-weight: 700; font-size: clamp(16px, 2.4vw, 24px); color: #fff; -webkit-text-stroke: 6px #1a1030; paint-order: stroke fill; }
.bottom { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.bottom .hint { background: rgba(10, 8, 24, .55); padding: 8px 14px; border-radius: 12px; }
#title button, #dead button, #win button { font-family: inherit; font-weight: 700; background: linear-gradient(#ff6a5a, #d8343a); color: #fff;
  -webkit-text-stroke: 5px #1a1030; paint-order: stroke fill; }
.card { overflow: hidden; }
.card .ribbon { position: absolute; left: 50%; top: 0; bottom: 0; width: 14px; margin-left: -7px; background: rgba(216, 52, 58, .18); }
.card img.ic { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 3px solid var(--ink); position: relative; }
.card .nm, .card .ds, .card .rk { position: relative; }
.card.rare { background: linear-gradient(#fff6d6, #ffd98a); box-shadow: 0 6px 0 var(--ink), 0 0 26px #ffc94a; }
#win { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: #0a0e22; }
#win img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .9; }
#win .winbox { position: relative; margin-top: auto; margin-bottom: 7vh; display: flex; flex-direction: column; align-items: center; gap: 12px;
  background: rgba(10, 8, 24, .6); padding: 18px 26px; border-radius: 20px; border: 4px solid var(--ink); text-align: center; }

/* ---------- v3：选择界面、首领血条、武器栏、节拍、提示 ---------- */
#select { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px;
  background: radial-gradient(circle at 50% 30%, rgba(40, 30, 80, .75), rgba(8, 8, 24, .95)); overflow-y: auto; }
#select h2 { font-size: 24px; }
.picks { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; max-width: 980px; }
.pick { position: relative; width: 190px; padding: 10px; border-radius: 18px; border: 4px solid var(--ink); background: #2a2046; color: var(--cream); font: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 5px; box-shadow: 0 5px 0 var(--ink); cursor: pointer; text-align: center; transition: transform .12s; }
.pick img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; border: 3px solid var(--ink); }
.pick.lvl { width: 250px; } .pick.lvl img { aspect-ratio: 16/9; }
.pick b { font-size: 18px; } .pick small { font-size: 12px; opacity: .85; line-height: 1.25; } .pick small.w { opacity: .65; }
.pick .role { font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
.pick.on { background: #5a3a8a; transform: translateY(-4px); box-shadow: 0 9px 0 var(--ink), 0 0 24px rgba(255, 200, 90, .6); border-color: #ffd36b; }
.pick.locked { filter: grayscale(.9) brightness(.55); cursor: not-allowed; }
.pick em { position: absolute; top: 40%; left: 8px; right: 8px; font-style: normal; font-weight: 700; background: rgba(10, 8, 24, .85); border-radius: 10px; padding: 6px; }
.pick .done { position: absolute; top: 16px; right: 16px; font-weight: 700; font-size: 12px; background: #ffd36b; color: var(--ink); padding: 2px 8px; border-radius: 999px; }
#go, .btns button { font-family: inherit; font-weight: 700; font-size: 22px; padding: 12px 34px; border-radius: 16px; border: 4px solid var(--ink);
  background: linear-gradient(#ff6a5a, #d8343a); color: #fff; -webkit-text-stroke: 5px #1a1030; paint-order: stroke fill; box-shadow: 0 5px 0 var(--ink); cursor: pointer; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.btns button.alt { background: linear-gradient(#6a5aa8, #3b2a66); font-size: 18px; }
#bossBar { position: absolute; top: 86px; left: 50%; width: min(520px, 80vw); transform: translateX(-50%); text-align: center; }
#bossBar b { font-size: 18px; color: #ffb4c8; -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; }
.bar.boss { height: 18px; } .bar.boss > div { background: linear-gradient(#ff8ab0, #d8346a); }
#slots { position: absolute; left: 64px; bottom: max(26px, env(safe-area-inset-bottom)); display: flex; gap: 5px; align-items: flex-end; flex-wrap: wrap; max-width: calc(100vw - 180px); }
.slot { position: relative; width: 42px; height: 42px; border-radius: 50%; border: 3px solid var(--ink); background: #241a3d; box-shadow: 0 3px 0 var(--ink); }
.slot.small { width: 30px; height: 30px; }
.slot img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.slot i { position: absolute; right: -4px; bottom: -4px; font-style: normal; font-weight: 700; font-size: 12px; background: #ffd36b; color: var(--ink); border-radius: 8px; padding: 0 4px; border: 2px solid var(--ink); }
.slot.empty { opacity: .35; }
#fps { bottom: 4px !important; left: 64px !important; }
#toast { position: fixed; top: 150px; left: 50%; transform: translateX(-50%); max-width: 90vw; text-align: center; font-weight: 700; font-size: 18px;
  background: rgba(20, 12, 40, .85); border: 3px solid #ffd36b; border-radius: 14px; padding: 8px 16px; pointer-events: none; }
#toast.in { animation: toastIn .3s ease-out; }
@keyframes toastIn { from { transform: translate(-50%, -12px) scale(.9); opacity: 0; } }
#stacks { position: absolute; left: 50%; bottom: 128px; transform: translateX(-50%); font-size: 22px; color: #c8b4ff; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; letter-spacing: 2px; }
#beat { position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%); display: flex; gap: 8px; }
#beat i { width: 14px; height: 14px; border-radius: 50%; background: #3b2a66; border: 3px solid var(--ink); }
#beat i.lit { background: #ffd36b; transform: scale(1.3); }
#beat i:last-child.lit { background: #ff7a3a; transform: scale(1.6); }
.card .lvl { position: relative; font-size: 12px; font-weight: 700; color: #7a3a2a; }
.card.neww { background: linear-gradient(#f0fff0, #c8f0d0); }

/* ---------- v4：主菜单、工坊、奖杯树、打印工作室、结算 ---------- */
#menu { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 5vh 16px;
  background: #0a0e22 url(assets/img/keyart-wide.jpg) center / cover no-repeat; }
@media (max-aspect-ratio: 1/1) { #menu { background-image: url(assets/img/keyart-tall.jpg); } }
.menubox { display: flex; flex-direction: column; gap: 10px; align-items: stretch; width: min(360px, 92vw); background: rgba(10, 8, 24, .72); padding: 16px; border-radius: 20px; border: 4px solid var(--ink); }
.menubox button, .panel button.back, .sbar button.back, #select .back { font-family: inherit; font-weight: 700; font-size: 18px; padding: 10px 14px; border-radius: 14px; border: 4px solid var(--ink);
  background: linear-gradient(#6a5aa8, #3b2a66); color: #fff; box-shadow: 0 4px 0 var(--ink); cursor: pointer; text-align: left; }
.menubox button small { display: block; font-size: 12px; opacity: .75; font-weight: 500; }
.menubox button.big { font-size: 24px; text-align: center; background: linear-gradient(#ff6a5a, #d8343a); -webkit-text-stroke: 5px #1a1030; paint-order: stroke fill; }
.wallet { font-weight: 700; font-size: 20px; color: #ffe38a; text-align: center; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; }
.panel { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 24px 16px; overflow-y: auto;
  background: radial-gradient(circle at 50% 30%, rgba(40, 30, 80, .92), rgba(8, 8, 24, .98)); }
#shopList { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 10px; width: min(960px, 100%); }
.upg { display: flex; align-items: center; gap: 10px; background: #2a2046; border: 3px solid var(--ink); border-radius: 16px; padding: 10px; box-shadow: 0 4px 0 var(--ink); }
.upg img { width: 56px; height: 56px; border-radius: 50%; border: 3px solid var(--ink); }
.upg .info { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.upg small { opacity: .8; }
.pips { display: flex; gap: 4px; }
.pips i { width: 14px; height: 8px; border-radius: 4px; background: #3b2a66; border: 2px solid var(--ink); }
.pips i.on { background: #ffd36b; }
.upg button { font-family: inherit; font-weight: 700; font-size: 16px; padding: 8px 12px; border-radius: 12px; border: 3px solid var(--ink); background: #ffd36b; color: var(--ink); cursor: pointer; min-width: 78px; }
.upg button:disabled { background: #5a4a7a; color: #aaa; cursor: not-allowed; }
.upg.maxed { opacity: .75; }
.xtree { position: relative; width: min(420px, 88vw); aspect-ratio: 0.85; }
.xtree::before { content: ""; position: absolute; left: 8%; right: 8%; top: 8%; bottom: 10%; background: linear-gradient(#2f8a5a, #1f5a3c); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.xtree::after { content: ""; position: absolute; left: 44%; right: 44%; bottom: 2%; height: 9%; background: #6b4428; border: 3px solid var(--ink); }
.xtree .star { position: absolute; left: 50%; top: 0; transform: translate(-50%, -40%); font-size: 56px; color: #ffd34a; -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; text-shadow: 0 0 20px #ffc02a; z-index: 2; }
#ornaments { position: absolute; inset: 0; }
.bauble { position: absolute; width: 34px; height: 34px; margin: -17px; border-radius: 50%; border: 3px solid var(--ink); background: #1a3a2a; opacity: .5; cursor: pointer; }
.bauble.on { background: radial-gradient(circle at 35% 30%, #fff 0 12%, var(--c) 14%); opacity: 1; box-shadow: 0 0 14px var(--c); }
#trophyStats { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
#trophyStats span { background: #2a2046; border: 3px solid var(--ink); border-radius: 12px; padding: 6px 10px; font-weight: 700; }
#studio { position: fixed; inset: 0; pointer-events: none; }
#studio .spanel { position: absolute; left: 12px; top: 12px; bottom: 12px; width: min(300px, 44vw); overflow-y: auto; pointer-events: auto; background: rgba(10, 8, 24, .82); border: 4px solid var(--ink); border-radius: 18px; padding: 12px; }
#studio .spanel h2 { font-size: 20px; }
#studio h4 { margin: 10px 0 4px; color: #ffd36b; }
.sitem { display: block; width: 100%; text-align: left; font: inherit; font-weight: 700; padding: 7px 10px; margin: 3px 0; border-radius: 10px; border: 3px solid var(--ink); background: #2a2046; color: var(--cream); cursor: pointer; }
.sitem.on { background: #ffd36b; color: var(--ink); }
.sitem.locked { opacity: .45; cursor: not-allowed; }
#studio .sbar { position: absolute; right: 12px; bottom: 12px; width: min(420px, 52vw); pointer-events: auto; background: rgba(10, 8, 24, .85); border: 4px solid var(--ink); border-radius: 18px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
#studio .sbar b { font-size: 22px; color: #ffe38a; }
#studio .sbar small { opacity: .75; }
#studio .sbar .btns button { font-size: 15px; padding: 9px 12px; -webkit-text-stroke: 0; }
@media (max-aspect-ratio: 1/1) { #studio .spanel { right: 12px; width: auto; bottom: 46%; } #studio .sbar { left: 12px; width: auto; } }
.summary { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.nightstars span { font-size: 34px; color: #4a3a6a; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; }
.nightstars span.on { color: #ffd34a; }
.nightstars small { display: block; opacity: .7; }
.gain { font-size: 22px; font-weight: 700; color: #ffe38a; }
.gain small { color: var(--cream); opacity: .7; font-size: 13px; }
.achs { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.orn { background: #2f8a5a; border: 3px solid var(--ink); border-radius: 999px; padding: 4px 10px; font-weight: 700; }
.newprint { background: #3b2a66; border-radius: 12px; padding: 6px 10px; font-weight: 700; }
#reroll { font-family: inherit; font-weight: 700; font-size: 16px; padding: 8px 18px; border-radius: 12px; border: 3px solid var(--ink); background: #ffd36b; color: var(--ink); cursor: pointer; box-shadow: 0 4px 0 var(--ink); }
#levelCards { max-width: 1100px; }
.pick.lvl { width: 220px; }
#dead, #win .winbox { max-height: 96vh; overflow-y: auto; }

/* ---------- v5：暂停、提示、进化横幅、闪光 ---------- */
#pauseBtn { position: absolute; right: 16px; top: 132px; width: 42px; height: 42px; border-radius: 12px; pointer-events: auto; background: #2a2046; border: 3px solid var(--ink); color: var(--cream); font-size: 16px; font-weight: 700; box-shadow: 0 3px 0 var(--ink); cursor: pointer; }
#pause { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(8, 6, 20, .72); padding: 16px; }
.pbox { width: min(820px, 96vw); max-height: 92vh; overflow-y: auto; background: #1f1838; border: 4px solid var(--ink); border-radius: 20px; padding: 18px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 8px 0 var(--ink); }
.pcols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }
@media (max-width: 640px) { .pcols { grid-template-columns: 1fr; } }
.pbox h4 { color: #ffd36b; margin-bottom: 6px; }
.brow { display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; margin-bottom: 6px; }
.brow img { grid-row: span 2; width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--ink); }
.brow.small img { width: 30px; height: 30px; } .brow small { opacity: .75; font-size: 12px; }
.psettings { display: flex; flex-direction: column; gap: 10px; font-weight: 700; }
.psettings label { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.psettings select { font: inherit; border-radius: 8px; padding: 2px 6px; }
#hint { position: fixed; left: 50%; bottom: 150px; transform: translateX(-50%); max-width: min(560px, 90vw); text-align: center; font-weight: 700; font-size: 17px;
  background: #fff4e0; color: var(--ink); border: 4px solid var(--ink); border-radius: 16px; padding: 10px 16px; box-shadow: 0 5px 0 var(--ink); pointer-events: none; }
#hint.in { animation: toastIn .35s ease-out; }
#flash { position: fixed; inset: 0; background: #fff6d8; opacity: 0; pointer-events: none; }
#evoBanner { position: fixed; left: 50%; top: 32%; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 14px; padding: 14px 22px; border-radius: 22px;
  background: linear-gradient(#ffe38a, #ffb04a); border: 5px solid var(--ink); box-shadow: 0 8px 0 var(--ink), 0 0 60px #ffd34a; color: var(--ink); pointer-events: none; }
#evoBanner img { width: 76px; height: 76px; border-radius: 50%; border: 4px solid var(--ink); }
#evoBanner span { display: block; font-weight: 700; font-size: 14px; letter-spacing: 3px; }
#evoBanner b { display: block; font-size: 30px; } #evoBanner small { font-weight: 700; }
#evoBanner.go { animation: evoIn 2.4s ease-out forwards; }
@keyframes evoIn { 0% { transform: translate(-50%, -50%) scale(2.5) rotate(-8deg); opacity: 0; } 12% { transform: translate(-50%, -50%) scale(1) rotate(0); opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60%) scale(.95); } }
.slot.evo { border-color: #ffd34a; box-shadow: 0 3px 0 var(--ink), 0 0 14px #ffd34a; }
.slot.ready { animation: ready 0.8s ease-in-out infinite; }
.card em.evo { display: block; font-style: normal; font-size: 11px; color: #a0561a; margin-top: 4px; }
body.nonum #numbers { display: none; }

/* ---------- v5.1：一屏布局，选关横向滑动 ---------- */
#select { justify-content: center; gap: clamp(4px, 1.4vh, 12px); padding: clamp(8px, 2vh, 16px) 0; overflow: hidden; }
#select h2 { font-size: clamp(17px, 3.2vh, 24px); }
#select .pick { gap: clamp(2px, .5vh, 5px); padding: clamp(6px, 1vh, 10px); }
#heroCards { flex-wrap: nowrap; }
#heroCards .pick { width: clamp(150px, 24vh, 210px); }
#heroCards .pick img { height: clamp(70px, 17vh, 170px); width: auto; max-width: 100%; aspect-ratio: 1; }
#select .pick b { font-size: clamp(14px, 2.4vh, 18px); } #select .pick small { font-size: clamp(10px, 1.6vh, 12px); }
.strip { position: relative; width: 100%; display: flex; align-items: center; }
.picks.row { flex-wrap: nowrap; justify-content: flex-start; max-width: none; width: 100%; overflow-x: auto; overflow-y: visible; scroll-snap-type: x proximity;
  padding: 10px max(56px, calc(50vw - 590px)) 14px; scrollbar-width: none; cursor: grab; }
.picks.row::-webkit-scrollbar { display: none; }
.picks.row .pick { flex: 0 0 auto; scroll-snap-align: center; }
#levelCards .pick.lvl { width: clamp(170px, 30vh, 250px); }
#levelCards .pick img { user-select: none; -webkit-user-drag: none; pointer-events: none; }
.strip:not(.over) .picks.row { justify-content: center; }
.sarrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 44px; height: 64px; border-radius: 14px; border: 4px solid var(--ink); background: #ffd36b; color: var(--ink);
  font: 700 34px/1 inherit; cursor: pointer; box-shadow: 0 4px 0 var(--ink); display: none; }
.strip.over .sarrow { display: block; } .sarrow.l { left: 8px; } .sarrow.r { right: 8px; }
.sarrow:disabled { opacity: .25; cursor: default; }
#select .btns button, #select #go { padding: clamp(6px, 1.2vh, 12px) 30px; font-size: clamp(17px, 2.8vh, 22px); }
#devNote { margin: 0; }
#levelCards { max-width: none; }
.sarrow { font-family: inherit; font-size: 34px; font-weight: 700; line-height: 1; padding: 0 0 4px; }
.panel { justify-content: center; gap: clamp(6px, 1.4vh, 12px); padding: clamp(10px, 2.5vh, 24px) 16px; }
.xtree { height: clamp(170px, calc(100vh - 290px), 494px); width: auto; aspect-ratio: .85; }
.xtree .star { font-size: clamp(34px, 6vh, 56px); }
.bauble { width: clamp(22px, 4.2vh, 34px); height: clamp(22px, 4.2vh, 34px); margin: clamp(-17px, -2.1vh, -11px); }
#studioList { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
#studioList h4 { grid-column: 1 / -1; }
#studio h4 { margin: 6px 0 0; }
.sitem { margin: 0; padding: clamp(3px, .7vh, 7px) 8px; font-size: clamp(12px, 1.9vh, 15px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-height: 560px) {
  .panel > .hint:first-of-type, #studio .spanel > .hint { display: none; }
  .panel h2, #studio .spanel h2 { font-size: 18px; }
  .upg { padding: 5px 8px; } .upg img { width: 38px; height: 38px; } .upg small { font-size: 11px; }
  #shopList { gap: 6px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .panel button.back { padding: 6px 12px; font-size: 15px; }
  #trophyStats span { padding: 3px 8px; font-size: 12px; }
  #select { gap: 2px; }
  #select h2 { font-size: 15px; }
  #heroCards .pick small, #levelCards .pick small { display: none; }
  #heroCards .pick { width: 130px; } #heroCards .pick img { height: 60px; }
  #levelCards .pick.lvl { width: 170px; }
  .picks.row { padding-top: 6px; padding-bottom: 8px; }
  #studioList { grid-template-columns: 1fr 1fr 1fr; }
}
@media (max-height: 760px) { #studio .spanel > .hint { font-size: 12px; margin: 0; } #studio h4 { margin-top: 3px; } }
@media (max-height: 560px) { #studio .spanel { padding: 8px; } #studio h4 { font-size: 12px; margin: 0; } .sitem { padding: 2px 6px; font-size: 11px; border-width: 2px; } }
@media (max-height: 800px) { #studio .spanel > .hint { display: none; } }

/* ---------- v7：连击里程碑 ---------- */
#comboPop { position: fixed; left: 50%; top: 36%; transform: translate(-50%, -50%); pointer-events: none; text-align: center; font-weight: 700; font-size: clamp(40px, 8vh, 72px); color: #ffd34a;
  -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill; text-shadow: 0 0 28px rgba(255, 190, 60, .8); z-index: 6; line-height: 1; }
#comboPop small { display: block; font-size: .5em; color: #fff; margin-top: 4px; }
#comboPop.go { animation: comboPop 1.4s ease-out forwards; }
@keyframes comboPop { 0% { transform: translate(-50%, -50%) scale(.3) rotate(-8deg); opacity: 0; } 12% { transform: translate(-50%, -50%) scale(1.25) rotate(3deg); opacity: 1; }
  24% { transform: translate(-50%, -50%) scale(1) rotate(0); } 75% { opacity: 1; } 100% { transform: translate(-50%, -80%) scale(.95); opacity: 0; } }
#studio .spanel { width: min(400px, 46vw); }
#studioList { grid-template-columns: 1fr 1fr 1fr; }
@media (max-height: 560px) { #studioList { grid-template-columns: repeat(4, 1fr); } #studio .spanel { width: min(440px, 52vw); } }
@media (max-height: 560px) { #studio .spanel h2 { font-size: 14px; margin: 0 0 2px; } #studioList { gap: 3px; } #studio h4 { font-size: 11px; } }

/* ---------- v8：金币、圣诞商店、冲刺按钮、4 张卡 ---------- */
img.coin { width: 1em; height: 1em; vertical-align: -0.15em; border-radius: 50%; }
.kills.gold img { width: 18px; height: 18px; vertical-align: -3px; border-radius: 50%; }
.kills.gold { color: #ffd34a; }
.kills.gold.bump { animation: goldBump .25s ease-out; }
@keyframes goldBump { 50% { transform: scale(1.25); } }
.goldgain { color: #ffd34a; } .goldgain img { width: 24px; height: 24px; vertical-align: -4px; border-radius: 50%; }
#dashBtn { position: absolute; right: 118px; bottom: 26px; width: 64px; height: 64px; border-radius: 50%; border: 4px solid var(--ink); background: #ff6a7a; pointer-events: auto; cursor: pointer;
  box-shadow: 0 4px 0 var(--ink); padding: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; }
#dashBtn img { width: 100%; height: 100%; object-fit: cover; }
#dashBtn span { position: absolute; bottom: 4px; left: 0; right: 0; text-align: center; font-weight: 700; font-size: 11px; color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; }
#dashBtn.cool { filter: grayscale(.8) brightness(.6); }
#armory { justify-content: center; }
#armList { display: flex; flex-direction: column; gap: clamp(6px, 1.2vh, 12px); width: min(1180px, 100%); }
.arow { display: flex; align-items: center; gap: 10px; }
.arow .slot { flex: 0 0 74px; text-align: right; color: #ffd36b; font-size: 15px; }
.aitems { flex: 1; display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; padding: 4px 2px 8px; }
.aitems::-webkit-scrollbar { display: none; }
.aitem { flex: 1 0 200px; display: flex; align-items: center; gap: 8px; background: #2a2046; border: 3px solid var(--ink); border-radius: 16px; padding: clamp(5px, 1vh, 9px) 9px; box-shadow: 0 4px 0 var(--ink); }
.aitem > img { width: clamp(38px, 7vh, 60px); height: clamp(38px, 7vh, 60px); border-radius: 50%; border: 3px solid var(--ink); flex: none; }
.aitem .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.aitem .info b { font-size: clamp(13px, 2vh, 16px); } .aitem .info small { font-size: clamp(10px, 1.6vh, 12px); opacity: .8; line-height: 1.2; }
.aitem button { flex: none; font-family: inherit; font-weight: 700; font-size: 14px; padding: 7px 10px; border-radius: 12px; border: 3px solid var(--ink); background: #ffd36b; color: var(--ink); cursor: pointer; white-space: nowrap; }
.aitem button img.coin { margin-right: 3px; }
.aitem button:disabled { background: #5a4a7a; color: #bbb; cursor: not-allowed; }
.aitem.own button { background: #7ad0ff; }
.aitem.on { background: #3f5a3a; border-color: #9aff8a; box-shadow: 0 4px 0 var(--ink), 0 0 16px rgba(150, 255, 130, .45); }
.aitem.on button { background: #9aff8a; }
.aitem.bought { animation: bought .5s ease-out; }
@keyframes bought { 30% { transform: scale(1.08); box-shadow: 0 0 30px #ffd34a; } }
#cards { flex-wrap: nowrap; }
@media (max-width: 760px) { #cards { flex-wrap: wrap; max-width: 96vw; } .card { width: 44vw; min-height: 150px; } }
@media (max-height: 560px) { .card { min-height: 0; padding: 10px 6px; } .card .ds { font-size: 12px; } .arow .slot { flex-basis: 52px; font-size: 12px; } .aitem { flex-basis: 170px; } }
.aitem { flex: 1 0 250px; }
.aitems { mask-image: linear-gradient(90deg, #000 92%, transparent); }
.arow:not(:last-child) .aitems { mask-image: none; }
@media (max-height: 560px) { #armory .wallet small { display: none; } #armory .wallet { font-size: 16px; } #armList { gap: 2px; } .aitems { padding: 2px 2px 5px; } .aitem { padding: 3px 8px; } .aitem button { padding: 5px 8px; font-size: 12px; } }
.arow .slot { background: none; box-shadow: none; }

/* PLAY GRID 排行榜提交区块 */
.pg-submit { display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(420px, 92vw); padding: 10px 12px; border-radius: 14px;
  background: rgba(10, 14, 34, .72); border: 2px solid rgba(255, 255, 255, .18); color: #fff; font-size: 14px; }
.pg-submit[hidden] { display: none; }
.pg-row { display: flex; gap: 8px; width: 100%; }
.pg-row input { flex: 1; min-width: 0; font: inherit; font-size: 16px; padding: 8px 12px; border-radius: 10px; border: 2px solid rgba(255, 255, 255, .3); background: rgba(255, 255, 255, .92); color: #1b1636; }
#dead .pg-submit button, #win .pg-submit button { font-size: 16px; padding: 8px 16px; border-radius: 10px; border-width: 3px; -webkit-text-stroke: 0; }
.pg-status { min-height: 1.2em; font-size: 13px; opacity: .9; }
.pg-status a { color: #ffd76a; }
.pg-board { width: 100%; display: flex; flex-direction: column; gap: 2px; }
.pg-board .board-row { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 8px; padding: 3px 8px; border-radius: 8px; background: rgba(255, 255, 255, .07); }
.pg-board .board-row:nth-child(n+6) { display: none; }
.pg-board .board-rank { color: #ffd76a; font-weight: 700; }
.pg-board .board-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-board .board-meta { font-size: 11px; opacity: .7; }
.pg-board .board-score { font-weight: 700; }
.pg-board .board-empty { opacity: .7; font-size: 13px; }
