/* 泡泡魔法夜:場地是夜晚(暗紫),介面卡片保持明亮可愛 */
:root {
  --ink: #2a1a3e; --paper: #fffdf8; --yellow: #ffd34d; --blue: #4a97dd; --purple: #9f6bff;
  --font: system-ui, -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; background: #0b0618; color: var(--ink); font-family: var(--font); -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font-family: inherit; cursor: pointer; color: var(--ink); }

/* ---------- HUD ---------- */
#hud { position: fixed; left: 0; right: 0; top: 0; z-index: 5; pointer-events: none; padding: calc(10px + var(--st)) 12px 0; }
#hud[hidden] { display: none; }
.top { display: flex; align-items: center; gap: 10px; }
.hearts { display: flex; gap: 3px; }
.hearts i { width: 22px; height: 20px; background: #4a3466; clip-path: path("M11 19 C4 13 0 10 0 5.5 C0 2.5 2.4 0 5.5 0 C7.8 0 9.6 1.3 11 3.2 C12.4 1.3 14.2 0 16.5 0 C19.6 0 22 2.5 22 5.5 C22 10 18 13 11 19 Z"); }
.hearts i.on { background: #ff5f8f; filter: drop-shadow(0 0 4px #ff8fb0); }
.mid { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
#time { font: 900 20px/1 var(--font); color: #fff; text-shadow: 0 2px 0 #2a1240, 0 0 10px #b98cff; font-variant-numeric: tabular-nums; }
.xp { position: relative; width: min(44vw, 280px); height: 16px; background: rgba(20, 8, 40, 0.75); border: 2px solid #c9a8ff; border-radius: 99px; overflow: hidden; box-shadow: 0 0 10px rgba(185, 140, 255, 0.6); }
.xp i { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, #6fe8ff, #a77dff); box-shadow: 0 0 10px #8ff0ff; transition: width 0.15s; }
.xp span { position: absolute; inset: 0; text-align: center; font: 900 11px/12px var(--font); color: #fff; text-shadow: 0 1px 0 #2a1240; }
.pill { background: rgba(20, 8, 40, 0.75); border: 2px solid #c9a8ff; border-radius: 99px; padding: 3px 10px; color: #fff; font-weight: 900; font-size: 15px; }
/* 暫停 / 離開:放左下角,和右下的聲音鈕對稱,不擋上面的愛心和計數 */
.pausebtn { position: fixed; z-index: 6; left: 12px; bottom: calc(14px + var(--sb)); width: 44px; height: 44px; border-radius: 50%; border: 2px solid #c9a8ff; background: rgba(20, 8, 40, 0.7); color: #fff; font-size: 18px; padding: 0; }
#hud[hidden] ~ .pausebtn { display: none; }
.dlg .big.quit { margin-top: 10px; background: #fff; font-size: 20px; }
/* 大冒險愛心會累積到 6 顆以上,一顆一顆排會把右邊的包走數擠出畫面:超過 5 顆改成「愛心 × 數字」 */
.hearts b { color: #fff; font-weight: 900; font-size: 17px; line-height: 20px; text-shadow: 0 2px 0 #2a1240; white-space: nowrap; }
.pill { flex-shrink: 0; }
.mute { position: fixed; z-index: 6; right: 12px; bottom: calc(14px + var(--sb)); width: 44px; height: 44px; border-radius: 50%; border: 2px solid #c9a8ff; background: rgba(20, 8, 40, 0.7); font-size: 20px; padding: 0; }
.banner { position: fixed; z-index: 7; left: 50%; top: calc(64px + var(--st)); transform: translate(-50%, -20px); opacity: 0; transition: 0.25s; pointer-events: none; white-space: nowrap;
  background: linear-gradient(180deg, #fff, #f3e9ff); border: 3px solid var(--ink); border-radius: 999px; padding: 6px 16px; font-weight: 900; font-size: 16px; box-shadow: 0 0 18px rgba(185, 140, 255, 0.8); }
.banner.show { opacity: 1; transform: translate(-50%, 0); }
.banner.boss { background: linear-gradient(180deg, #ffe680, #ffc83a); box-shadow: 0 0 24px rgba(255, 200, 60, 0.9); }
.joy { position: fixed; z-index: 4; width: 110px; height: 110px; margin: -55px 0 0 -55px; border-radius: 50%; border: 3px solid rgba(201, 168, 255, 0.7); background: rgba(160, 120, 255, 0.12); pointer-events: none; }
.joy[hidden] { display: none; }
.joy i { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #c9a8ff); box-shadow: 0 0 14px #b98cff; transform: translate(-50%, -50%); }
/* 大爆炸白光、被黏到的紅框 */
#flash { position: fixed; inset: 0; z-index: 3; pointer-events: none; background: radial-gradient(circle, rgba(255, 255, 255, 0.95), color-mix(in srgb, var(--fc, #dcb4ff) 70%, transparent) 45%, transparent 80%); opacity: 0; }
#flash.on { animation: flash 0.35s ease-out; }
@keyframes flash { 0% { opacity: var(--a, 0.6); } 100% { opacity: 0; } }
#hurtFx { position: fixed; inset: 0; z-index: 3; pointer-events: none; box-shadow: inset 0 0 90px 30px rgba(255, 60, 120, 0.85); opacity: 0; }
#hurtFx.on { animation: flash 0.6s ease-out; --a: 1; }

/* ---------- 畫面卡片 ---------- */
.screen { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: calc(16px + var(--st)) 16px calc(16px + var(--sb)); background: radial-gradient(circle at 50% 40%, rgba(60, 20, 110, 0.2), rgba(11, 6, 24, 0.55)); overflow-y: auto; }
.screen[hidden] { display: none; }
#start { align-items: flex-end; }
.card { width: min(420px, 100%); background: var(--paper); border: 4px solid var(--ink); border-radius: 28px; padding: 20px 18px 16px; box-shadow: 0 7px 0 var(--ink), 0 0 40px rgba(185, 140, 255, 0.55); text-align: center; margin: auto; overflow: hidden; }
#start .card { margin: auto auto 0; }
.tag { margin: 0 0 12px; font-weight: 800; color: #6a5a80; font-size: 15px; }
.heroes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.hero { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 9px; border: 3px solid #e3d8f2; border-radius: 16px; background: #fff; font-weight: 900; font-size: 18px; }
.hero.on { border-color: var(--ink); background: #f3e9ff; box-shadow: 0 3px 0 var(--ink); }
.face { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--ink); }
.face.t { background: #fddf22; } .face.q { background: #f4f7fb; }
.big { width: 100%; background: var(--yellow); border: 4px solid var(--ink); border-radius: 18px; padding: 13px; font-size: 24px; font-weight: 900; box-shadow: 0 3px 0 var(--ink); }
.big:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.big.alt { background: #fff; font-size: 19px; padding: 10px; }
.btns { display: grid; gap: 8px; }
.how { margin: 12px 0 4px; font-size: 14px; font-weight: 700; color: #6a5a80; line-height: 1.5; }
.best { margin: 6px 0; font-weight: 900; color: var(--purple); }
.note { margin: 6px 0 0; font-size: 11px; color: #9a8fb0; }

/* ---------- 標題字:圓體粗體、每個字微歪 ---------- */
.logo { font-family: "Chiron GoRound TC", var(--font); font-weight: 900; line-height: 1.1; margin: 0 0 8px; font-size: 44px; color: #b98cff; }
.logo span { display: inline-block; margin: 0 1px; -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill; text-shadow: 0 5px 0 var(--ink); transform: rotate(var(--r, 0deg)) translateY(var(--y, 0)); }
.logo span:nth-of-type(1) { --r: -6deg; --y: 2px; color: #8fd4ff; }
.logo span:nth-of-type(2) { --r: 4deg; --y: -3px; color: #8fd4ff; }
.logo span:nth-of-type(3) { --r: -3deg; --y: 1px; }
.logo span:nth-of-type(4) { --r: 6deg; --y: -2px; color: #d6b8ff; }
.logo span:nth-of-type(5) { --r: -4deg; --y: 2px; color: #ffd34d; }
.logo small { display: block; font-size: 0.42em; letter-spacing: 7px; margin-bottom: 2px; color: #ffd34d; -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink); }

/* ---------- 選卡:畫面變暗、三張發光的卡跳出來 ---------- */
.pick { position: fixed; inset: 0; z-index: 9; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 16px; background: radial-gradient(circle, rgba(40, 14, 80, 0.75), rgba(5, 2, 12, 0.92)); animation: fadein 0.25s both; }
.pick[hidden] { display: none; }
.pick h2 { margin: 0; color: #fff; font-size: 26px; font-weight: 900; text-shadow: 0 0 16px #b98cff, 0 3px 0 #2a1240; animation: pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) both; }
.cards { display: flex; gap: 10px; width: min(560px, 100%); }
.pc { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px 14px; border-radius: 18px; border: 3px solid var(--rc);
  background: linear-gradient(180deg, #2e1a52, #1a0e30); color: #fff; box-shadow: 0 0 18px var(--rc), inset 0 0 18px rgba(255, 255, 255, 0.08); overflow: hidden; animation: cardin 0.5s var(--d) cubic-bezier(0.3, 1.5, 0.5, 1) both; }
.pc::before { content: ""; position: absolute; inset: -40%; background: conic-gradient(from 0deg, transparent 0 70%, var(--rc) 85%, transparent 100%); animation: spin 2.4s linear infinite; opacity: 0.35; }
.pc::after { content: ""; position: absolute; inset: 3px; border-radius: 14px; background: linear-gradient(180deg, #2e1a52, #1a0e30); z-index: 0; }
.pc > * { position: relative; z-index: 1; }
.pc .rar { font-size: 11px; font-weight: 900; color: var(--rc); letter-spacing: 2px; }
.pc .ic { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 14px; font-size: 32px; background: radial-gradient(circle, rgba(255, 255, 255, 0.25), transparent 70%); border: 2px solid var(--rc); text-shadow: 0 0 12px var(--rc); }
.pc b { font-size: 16px; line-height: 1.2; }
.pc small { font-size: 12px; color: #d8c8f0; line-height: 1.35; font-weight: 700; }
.pc.r3 { box-shadow: 0 0 30px var(--rc), 0 0 60px rgba(255, 200, 60, 0.5); }
.pc:active { transform: scale(0.96); }
@keyframes cardin { from { opacity: 0; transform: translateY(40px) scale(0.6) rotate(-6deg); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { transform: scale(0.3); opacity: 0; } }
@keyframes fadein { from { opacity: 0; } }

/* ---------- 結算:光芒 + 勳章 + 緞帶(和泡泡塔防同一套) ---------- */
.endhero { position: relative; height: 236px; margin: -6px -8px 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; --c1: #ffe680; --c2: #f5b400; --glow: rgba(255, 200, 40, 0.75); }
.endhero.bronze { --c1: #ffd2a6; --c2: #cd7f32; --glow: rgba(230, 140, 60, 0.6); }
.endhero.silver { --c1: #ffffff; --c2: #9fb3c8; --glow: rgba(150, 200, 255, 0.75); }
.endhero.rainbow { --c1: #ffe1f2; --c2: #9f7bff; --glow: rgba(255, 120, 200, 0.8); }
.endhero .rays { position: absolute; left: 50%; top: 44%; width: 330px; height: 330px; margin: -165px 0 0 -165px; border-radius: 50%; background: repeating-conic-gradient(from 0deg, var(--glow) 0 7deg, transparent 7deg 22deg);
  -webkit-mask: radial-gradient(circle, #000 18%, transparent 68%); mask: radial-gradient(circle, #000 18%, transparent 68%); animation: spin 14s linear infinite, fadein 0.6s both; }
.endhero .halo { position: absolute; left: 50%; top: 44%; width: 190px; height: 190px; margin: -95px 0 0 -95px; border-radius: 50%; background: radial-gradient(circle, #fff 0 30%, var(--glow) 55%, transparent 72%); animation: halopulse 1.8s ease-in-out infinite, fadein 0.6s both; }
@keyframes halopulse { 50% { transform: scale(1.12); opacity: 0.8; } }
.endhero .badge { position: relative; isolation: isolate; width: 140px; height: 150px; margin-top: -14px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: linear-gradient(160deg, #fff 0%, var(--c1) 30%, var(--c2) 100%); animation: badgepop 0.7s 0.15s cubic-bezier(0.3, 1.6, 0.5, 1) both; }
.endhero.rainbow .badge { background: linear-gradient(160deg, #fff 0%, #ffd0e8 22%, #ffb347 42%, #8fe07a 60%, #6fc8ff 78%, #a98bff 100%); }
.endhero .badge::before { content: ""; position: absolute; inset: 9px; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: linear-gradient(180deg, #3b2a6b, #1d1244); z-index: -1; }
.endhero .badge b { font-size: 42px; font-weight: 900; color: #fff; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35), 0 0 16px var(--glow); font-variant-numeric: tabular-nums; }
.endhero .badge small { font-size: 15px; font-weight: 900; color: var(--c1); letter-spacing: 2px; margin-bottom: 4px; }
.endhero.done .badge b { animation: numglow 0.5s; }
@keyframes badgepop { from { transform: scale(0) rotate(-25deg); } }
@keyframes numglow { 40% { transform: scale(1.25); text-shadow: 0 0 30px #fff, 0 0 40px var(--glow); } }
.endhero .badge::after { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.75) 50%, transparent 65%); transform: translateX(-120%); animation: sweep 2.6s 1.2s ease-in-out infinite; }
@keyframes sweep { 35%, 100% { transform: translateX(120%); } }
.endhero .ribbon { position: relative; z-index: 2; margin-top: -16px; padding: 7px 26px 8px; font-size: 21px; font-weight: 900; color: #fff; white-space: nowrap; background: linear-gradient(180deg, #b98cff, #7a4fd8);
  border: 3px solid var(--ink); border-radius: 10px; box-shadow: 0 4px 0 var(--ink); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25); animation: ribbonin 0.55s 0.55s cubic-bezier(0.3, 1.5, 0.5, 1) both; }
.endhero.gold .ribbon { background: linear-gradient(180deg, #ffb84d, #f08a00); }
.endhero.silver .ribbon { background: linear-gradient(180deg, #7fc4ff, #3f86d8); }
.endhero.bronze .ribbon { background: linear-gradient(180deg, #e8a36a, #b9672e); }
.endhero.rainbow .ribbon { background: linear-gradient(90deg, #ff5fa8, #ffa040, #5fc070, #4aa3ff, #9f7bff); }
.endhero.record .ribbon { background: linear-gradient(90deg, #ff5fa8, #ffb800, #ff5fa8); background-size: 200% 100%; animation: ribbonin 0.55s 0.55s cubic-bezier(0.3, 1.5, 0.5, 1) both, shimmer 1.4s linear infinite; }
@keyframes ribbonin { from { transform: scale(0.2) translateY(20px); opacity: 0; } }
@keyframes shimmer { to { background-position: -200% 0; } }
.endhero .sparks { position: absolute; inset: 0; pointer-events: none; }
.endhero .sparks i { position: absolute; width: 18px; height: 18px; margin: -9px; background: #fff; clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%); animation: twinkle 1.6s var(--d) ease-in-out infinite both; }
.endhero .sparks i:nth-child(3n) { background: #ffe680; } .endhero .sparks i:nth-child(4n) { background: #d6b8ff; }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(0) rotate(0); } 50% { opacity: 1; transform: scale(var(--s)) rotate(90deg); } }
.stats { list-style: none; padding: 0; margin: 4px 0 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stats li { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 4px 7px; background: linear-gradient(180deg, #f6f0ff, #ebe0ff); border: 2.5px solid #dccbfa; border-radius: 16px; animation: tilein 0.4s var(--d) cubic-bezier(0.3, 1.5, 0.5, 1) both; }
.stats .ic { font-size: 22px; line-height: 1; }
.stats b { font-size: 24px; line-height: 1.15; color: #7a4fd8; }
.stats small { font-size: 13px; color: #6a5a80; font-weight: 800; }
@keyframes tilein { from { opacity: 0; transform: translateY(14px) scale(0.85); } }
.hot { position: relative; overflow: hidden; }
.hot::after { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.8) 50%, transparent 65%); transform: translateX(-120%); animation: sweep 2.4s 1.6s ease-in-out infinite; }

/* ---------- 第二版:武器/寶物格、大王血條、連擊、警告 ---------- */
.slots { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.slots div { display: flex; gap: 3px; }
.slots .s { position: relative; width: 30px; height: 30px; display: grid; place-items: center; font-style: normal; font-size: 17px; border-radius: 9px; background: rgba(20, 8, 40, 0.75); border: 2px solid #8fd4ff; }
.slots .s.p { width: 24px; height: 24px; font-size: 13px; border-color: #c9a8ff; border-radius: 7px; }
.slots .s.empty { border-style: dashed; border-color: rgba(201, 168, 255, 0.4); background: rgba(20, 8, 40, 0.35); }
.slots .s.evo { border-color: #ffc83a; box-shadow: 0 0 10px #ffc83a; }
.slots .s u { position: absolute; right: -4px; bottom: -5px; text-decoration: none; font: 900 10px/14px var(--font); min-width: 14px; text-align: center; border-radius: 7px; background: #fff; color: var(--ink); }
.bossbar { margin: 8px auto 0; width: min(80vw, 420px); text-align: center; color: #fff; font-weight: 900; font-size: 13px; text-shadow: 0 2px 0 #2a1240; }
.bossbar[hidden] { display: none; }
.bossbar div { height: 12px; margin-top: 3px; border-radius: 99px; background: rgba(20, 8, 40, 0.8); border: 2px solid #ffc83a; overflow: hidden; box-shadow: 0 0 12px rgba(255, 160, 60, 0.7); }
.bossbar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ff8a1f, #ffd24a); transition: width 0.2s; }
.combo { position: fixed; z-index: 6; right: 12px; top: calc(96px + var(--st)); color: #fff; font-weight: 900; font-size: 15px; text-shadow: 0 2px 0 #2a1240, 0 0 10px #ff8fd8; opacity: 0; transition: opacity 0.3s; pointer-events: none; }
.combo.show { opacity: 1; }
.combo b { font-size: 26px; color: #ffd24a; }
.combo.pop { animation: combopop 0.5s cubic-bezier(0.3, 1.8, 0.5, 1); }
@keyframes combopop { 40% { transform: scale(1.6); } }
.bosswarn { position: fixed; inset: 0; z-index: 8; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; pointer-events: none; background: radial-gradient(circle, transparent 30%, rgba(120, 20, 10, 0.55)); }
.bosswarn[hidden] { display: none; }
.bosswarn b { font-size: 26px; color: #fff; background: linear-gradient(90deg, #ff5a3a, #ffb040); padding: 8px 18px; border-radius: 12px; border: 3px solid var(--ink); }
.bosswarn small { color: #fff; font-weight: 800; text-shadow: 0 2px 0 #2a1240; }
.bosswarn.on b { animation: warn 0.6s ease-in-out 5 alternate; }
@keyframes warn { to { transform: scale(1.12); } }

/* 開始畫面 */
.perk { margin: -4px 0 10px; font-size: 13px; font-weight: 700; color: #7a4fd8; min-height: 18px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.small { border: 3px solid #e3d8f2; border-radius: 14px; background: #fff; font-weight: 900; font-size: 14px; padding: 8px 6px; }
.small:disabled { color: #a99cc0; }
.small.on { border-color: var(--ink); background: #f3e9ff; }
.how b { color: #f08a00; }

/* 選卡:等級變化、進化提示 */
.pc .nm { font-size: 16px; line-height: 1.2; }
.pc .lv { font-size: 12px; color: #cfe8ff; font-weight: 800; }
.pc .lv b { color: #ffd24a; }
.pc em { font-style: normal; font-size: 11px; font-weight: 800; color: #ffd24a; line-height: 1.3; border-top: 1px dashed rgba(255, 210, 74, 0.5); padding-top: 4px; }
.pc.r0 { --rc: #e9e3f5; }
.reroll { border: 3px solid #c9a8ff; border-radius: 999px; background: rgba(40, 20, 80, 0.85); color: #fff; font-weight: 900; font-size: 15px; padding: 8px 18px; }
.reroll[hidden] { display: none; }

/* 禮物盒 / 進化 */
.box { position: fixed; inset: 0; z-index: 9; display: flex; align-items: center; justify-content: center; padding: 16px; background: radial-gradient(circle, rgba(80, 40, 10, 0.7), rgba(5, 2, 12, 0.92)); animation: fadein 0.25s both; }
.box[hidden] { display: none; }
.boxIn { width: min(380px, 100%); text-align: center; color: #fff; }
.giftIc { font-size: 72px; animation: giftshake 0.7s ease-in-out both, giftpop 0.4s 0.7s ease-out both; filter: drop-shadow(0 0 20px #ffd24a); }
@keyframes giftshake { 20%, 60% { transform: rotate(-12deg) scale(1.05); } 40%, 80% { transform: rotate(12deg) scale(1.1); } }
@keyframes giftpop { to { transform: scale(1.4); opacity: 0.15; } }
.box h2 { margin: 0 0 12px; font-size: 26px; text-shadow: 0 0 16px #ffd24a, 0 3px 0 #2a1240; }
.box .up { display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, 0.1); border: 2px solid #ffd24a; border-radius: 14px; padding: 8px 12px; margin: 6px 0; animation: cardin 0.5s var(--d) cubic-bezier(0.3, 1.5, 0.5, 1) both; }
.box .up .ic { font-size: 28px; }
.box .hint { font-size: 13px; color: #ffe9a8; font-weight: 700; line-height: 1.5; margin: 10px 0; }
.box .big { margin-top: 12px; }
.box.evo { background: radial-gradient(circle, rgba(255, 200, 60, 0.55), rgba(40, 10, 60, 0.95)); }
.evoCard { position: relative; padding: 18px 14px; border-radius: 20px; border: 3px solid #ffc83a; background: linear-gradient(180deg, #4a2a7a, #1d1244); box-shadow: 0 0 40px #ffc83a, 0 0 80px rgba(255, 140, 220, 0.5); animation: cardin 0.7s 0.6s cubic-bezier(0.3, 1.6, 0.5, 1) both; overflow: hidden; }
.evoCard::before { content: ""; position: absolute; inset: -50%; background: repeating-conic-gradient(rgba(255, 210, 74, 0.25) 0 8deg, transparent 8deg 20deg); animation: spin 8s linear infinite; }
.evoCard > * { position: relative; }
.evoCard .ic { display: block; font-size: 64px; }
.evoCard small { display: block; color: #ffd24a; font-weight: 900; letter-spacing: 4px; }
.evoCard b { display: block; font-size: 28px; margin: 4px 0; }
.evoCard p { margin: 0; font-size: 14px; color: #f0e4ff; font-weight: 700; }

/* 結算 */
.endsub { margin: 0 0 10px; font-weight: 800; color: #6a5a80; font-size: 14px; }
.kit { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; margin: 0 0 14px; }
.kit span { font-size: 12px; font-weight: 800; padding: 3px 8px; border-radius: 99px; background: #f3ecff; border: 2px solid #e0d2f7; }
.kit span.evo { background: #fff3c4; border-color: #ffc83a; }
.endhero .badge b { font-size: 40px; }

/* 選關 */
.stages { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 8px; }
.stg { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 6px; border: 3px solid #e3d8f2; border-radius: 16px; background: #fff; }
.stg .ic { font-size: 26px; line-height: 1.1; }
.stg b { font-size: 13px; }
.stg small { font-size: 11px; color: #7a6a90; font-weight: 700; line-height: 1.3; }
.stg.on { border-color: var(--ink); background: #f3e9ff; box-shadow: 0 3px 0 var(--ink); }

/* 5 關:最後一關單獨一排 */
.stages .stg:last-child:nth-child(odd) { grid-column: 1 / -1; }
.stamps { margin: -2px 0 6px; font-size: 12px; font-weight: 800; color: #b07a00; }
/* 熄燈:整片黑,主角身邊挖一個亮圈 */
.dark { position: fixed; inset: 0; z-index: 2; pointer-events: none; background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), transparent 0, transparent 90px, rgba(4, 2, 12, 0.96) 190px); transition: opacity 0.2s; }
.dark[hidden] { display: none; }

/* ---------- 設定圖放進介面 ---------- */
.wi { width: 100%; height: 100%; object-fit: contain; display: block; }
.slots .s .wi { width: 26px; height: 26px; }
.slots .s.p .wi { width: 20px; height: 20px; }
.pc .ic .wi { width: 52px; height: 52px; }
.box .up .ic { width: 34px; height: 34px; display: inline-grid; place-items: center; }
.evoCard .ic .wi { width: 90px; height: 90px; margin: 0 auto; }
.kit span .wi { display: inline-block; width: 16px; height: 16px; vertical-align: -3px; }
.stg { position: relative; overflow: hidden; padding: 0 0 8px; }
.stg .th { width: 100%; height: 64px; object-fit: cover; display: block; margin-bottom: 4px; }
.stg .ic { position: absolute; top: 40px; left: 8px; font-size: 22px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.4)); }
#start { background: linear-gradient(180deg, rgba(11, 6, 24, 0.15), rgba(11, 6, 24, 0.55)), var(--bg, none) center / cover no-repeat; }
.warnimg { width: min(46vw, 220px); border-radius: 50%; border: 5px solid #ffc83a; box-shadow: 0 0 40px rgba(255, 160, 60, 0.9); background: #fff; animation: pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) both; }
.bossbar span { display: inline-flex; align-items: center; gap: 6px; }
.bossbar span img { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #ffc83a; background: #fff; object-fit: cover; }
/* 載入畫面:Gemini 生的全螢幕主視覺(直式手機 9:16、電腦寬版 16:9,art/splash/);圖上不放字,標題用網頁文字疊上去
   直式圖放不滿的寬螢幕(平板直放等)兩側用同一張模糊放大補滿,不留黑邊 */
.splash { position: fixed; inset: 0; z-index: 100; background: #120a2c; overflow: hidden; transition: opacity 0.5s; }
.splash.out { opacity: 0; pointer-events: none; }
.splash::before { content: ""; position: absolute; inset: -40px; background: url(img/splash.webp) center / cover; filter: blur(24px) saturate(1.1); opacity: 0.8; }
.splash .pv { position: absolute; inset: 0; margin: 0 auto; max-width: calc(100vh * 720 / 1290); container-type: size; background: url(img/splash.webp) center / cover no-repeat; box-shadow: 0 0 40px rgba(0, 0, 0, 0.5); }
.sp-t { position: absolute; left: 0; right: 0; top: calc(7cqh + var(--st, 0px)); text-align: center; font-family: "Chiron GoRound TC", var(--font); font-weight: 900; font-size: min(15cqw, 64px); line-height: 1.05; color: #ffe27a; -webkit-text-stroke: 8px #2a1a3e; paint-order: stroke fill; filter: drop-shadow(0 5px 0 #2a1a3e) drop-shadow(0 0 18px rgba(185, 140, 255, 0.9)); }
.sp-t small { display: block; font-size: 0.4em; letter-spacing: 8px; color: #d6b8ff; -webkit-text-stroke: 5px #2a1a3e; margin-bottom: 6px; }
.sp-msg { position: absolute; left: 0; right: 0; bottom: calc(6cqh + var(--sb, 0px) + 24px); text-align: center; font: 900 17px/1 var(--font); color: #fff; -webkit-text-stroke: 4px #2a1a3e; paint-order: stroke fill; }
.sp-bar { position: absolute; left: 10%; right: 10%; bottom: calc(6cqh + var(--sb, 0px)); height: 16px; border-radius: 99px; border: 3px solid #2a1a3e; background: rgba(255, 255, 255, 0.25); overflow: hidden; box-shadow: 0 0 14px rgba(185, 140, 255, 0.8); }
.sp-bar i { display: block; height: 100%; width: 10%; background: linear-gradient(90deg, #6fe8ff, #a77dff); transition: width 0.3s; }
@media (min-aspect-ratio: 1/1) {
  .splash::before { display: none; }
  .splash .pv { max-width: none; box-shadow: none; background-image: url(img/splash-wide.webp); }
  .sp-t { top: calc(4cqh + var(--st, 0px)); font-size: min(9cqh, 64px); }
  .sp-bar { left: 32%; right: 32%; }
}

/* ---------- 大招鈕:頭像 + 一圈集氣條;集滿會發光跳動 ---------- */
.ult { position: fixed; z-index: 6; right: 14px; bottom: calc(70px + var(--sb)); width: 84px; height: 84px; padding: 0; border: none; border-radius: 50%; background: conic-gradient(var(--uc, #4fc8ff) calc(var(--p, 0) * 1%), rgba(20, 8, 40, 0.75) 0); display: grid; place-items: center; touch-action: none; }
.ult img { width: 70px; height: 70px; border-radius: 50%; filter: grayscale(0.7) brightness(0.7); transition: filter 0.2s; }
.ult span { position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 11px; font-weight: 900; color: #fff; text-shadow: 0 1px 0 #2a1240, 0 0 6px var(--uc); }
.ult.ready img { filter: none; }
.ult.ready { animation: ultready 0.9s ease-in-out infinite; box-shadow: 0 0 22px var(--uc), 0 0 44px var(--uc); }
.ult.on img { filter: brightness(1.4); }
#hud[hidden] ~ .ult { display: none; }
@keyframes ultready { 50% { transform: scale(1.08); } }
/* ---------- 大字橫幅:頭像 + 斜的色帶從左邊滑進來 ---------- */
.callout { position: fixed; z-index: 8; left: 0; right: 0; top: 34%; height: 96px; pointer-events: none; display: flex; align-items: center; }
.callout[hidden] { display: none; }
.callout::before { content: ""; position: absolute; left: -10%; right: -10%; top: 14px; bottom: 14px; transform: skewY(-6deg); background: linear-gradient(90deg, transparent, var(--cc) 15%, color-mix(in srgb, var(--cc) 70%, #fff) 50%, var(--cc) 85%, transparent); box-shadow: 0 0 30px var(--cc); }
.callout img { position: relative; width: 104px; height: 104px; margin-left: 6%; border-radius: 50%; border: 4px solid #fff; box-shadow: 0 0 20px var(--cc); }
.callout b { position: relative; margin-left: 14px; font-family: "Chiron GoRound TC", var(--font); font-size: clamp(30px, 9vw, 54px); font-weight: 900; color: #fff; -webkit-text-stroke: 6px #2a1240; paint-order: stroke fill; text-shadow: 0 4px 0 #2a1240, 0 0 18px var(--cc); letter-spacing: 2px; }
.callout.on::before { animation: coband 1.5s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
.callout.on img { animation: coin 1.5s cubic-bezier(0.2, 1.3, 0.4, 1) both; }
.callout.on b { animation: cotext 1.5s cubic-bezier(0.2, 1.3, 0.4, 1) both; }
@keyframes coband { 0% { transform: skewY(-6deg) scaleX(0); opacity: 0; } 15% { transform: skewY(-6deg) scaleX(1); opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes coin { 0% { transform: translateX(-140%) rotate(-20deg); } 20% { transform: none; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateX(30%); } }
@keyframes cotext { 0% { transform: translateX(80%) scale(1.6); opacity: 0; } 22% { transform: none; opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateX(-20%); } }

/* ---------- 11/05 手機調整(照泡泡塔防)+ 大冒險 ---------- */
/* iPhone:點兩下不要放大、拖動不要捲頁 */
html, body { touch-action: manipulation; }
#start .big + .big, #campResume + .big { margin-top: 8px; }
#start .row2 { margin-top: 8px; }
/* 對話框(在 App 裡開、暫停) */
.dlg { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(11, 6, 24, 0.72); }
.dlg[hidden] { display: none; }
.dlg .card { max-width: 380px; }
.dlg h2 { margin: 6px 0 8px; font-size: 22px; }
.dlg p { font-weight: 700; line-height: 1.55; margin: 0 0 12px; }
.dlg-ic { font-size: 46px; line-height: 1; }
.iabhow { text-align: left; background: #f3e9ff; border-radius: 14px; padding: 10px 12px; margin: 10px 0; }
.iaburl { display: block; font-size: 14px; font-weight: 700; color: #2a7bb8; word-break: break-all; -webkit-user-select: all; user-select: all; }
.iabnote { margin: 10px 0 0; font-size: 13px; font-weight: 700; color: #7a4a00; background: #fff4c2; border-radius: 12px; padding: 6px 10px; }
.linkbtn { background: none; border: 0; padding: 0; color: #2a7bb8; font-weight: 900; text-decoration: underline; font-size: inherit; }
/* 回來時倒數 3、2、1 */
.countin { position: fixed; inset: 0; z-index: 39; display: grid; place-items: center; pointer-events: none; font: 900 120px/1 var(--font); color: #fff; text-shadow: 0 0 30px rgba(185, 140, 255, 0.9), 0 6px 0 var(--ink); }
.countin[hidden] { display: none; }
/* 有新版本 */
.updbar { position: fixed; z-index: 45; left: 50%; transform: translateX(-50%); bottom: calc(14px + var(--sb)); display: flex; align-items: center; gap: 8px; background: #fff; border: 3px solid var(--ink); border-radius: 999px; padding: 6px 8px 6px 14px; font-weight: 900; box-shadow: 0 3px 0 var(--ink); white-space: nowrap; }
.updbar[hidden] { display: none; }
.updbar button { border: 3px solid var(--ink); border-radius: 999px; background: var(--yellow); font: inherit; font-weight: 900; padding: 4px 12px; }
/* 排行榜 */
.board { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 5px; max-height: min(55vh, 520px); overflow-y: auto; text-align: left; }
.board[hidden] { display: none; }
.board li { display: flex; align-items: center; gap: 8px; background: #fff; border: 2.5px solid #e6dcf5; border-radius: 12px; padding: 5px 10px; font-weight: 800; }
.board li.me { background: #fff4c2; border-color: var(--ink); }
.board li.empty { justify-content: center; color: #7a6f8f; }
.board .rk { width: 26px; text-align: center; font-weight: 900; color: #8a7a55; }
.board li:nth-child(1) .rk { color: #e0a000; } .board li:nth-child(2) .rk { color: #9aa6b0; } .board li:nth-child(3) .rk { color: #c07a45; }
.board b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .st { font-size: 12px; color: #7a6f8f; }
.board .sc { font-weight: 900; color: var(--purple); }
/* 結算:總分、登上排行榜 */
.endscore { margin: 6px 0 10px; background: linear-gradient(180deg, #fff7d1, #ffe58a); border: 3px solid var(--ink); border-radius: 16px; padding: 8px 10px; font-weight: 900; }
.endscore[hidden] { display: none; }
.endscore b { display: block; font-size: 30px; color: #b04a00; }
.endscore small { display: block; font-size: 12px; color: #6a5a40; font-weight: 800; }
.endsubmit { margin: 8px 0; text-align: left; }
.endsubmit[hidden] { display: none; }
.endsubmit label { font-weight: 900; font-size: 14px; }
.namein { display: flex; gap: 6px; margin: 6px 0 8px; }
.namein input { flex: 1; min-width: 0; font: 900 18px var(--font); padding: 8px 10px; border: 3px solid var(--ink); border-radius: 12px; -webkit-user-select: text; user-select: text; }
.sendmsg { min-height: 1.2em; margin: 6px 0 0; font-weight: 800; font-size: 13px; color: #7a4a00; text-align: center; }
#next[hidden], #again[hidden] { display: none; }
