/* Merge Cats Defender - 样式 */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #17181c; }
body { font-family: 'Arial Rounded MT Bold', 'Segoe UI', Arial, sans-serif; user-select: none; }

#app { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
#stage { position: relative; width: 1024px; height: 507px; transform-origin: center center; background: #000; overflow: hidden; }

.fill { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.screen { position: absolute; inset: 0; }
.hidden { display: none !important; }

#battle { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
#loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #ffd94a; font-size: 28px; background: #17181c; z-index: 99; letter-spacing: 2px; }

img { pointer-events: none; }

/* ---------- 战斗 HUD ---------- */
#hud { z-index: 5; pointer-events: none; }
.hud-el { pointer-events: auto; }

.coin-bar { position: absolute; left: 22px; top: 14px; width: 165px; height: 56px; }
.coin-bar > img:first-child { position: absolute; inset: 0; width: 100%; height: 100%; }
.coin-ico { position: absolute; left: 2px; top: 4px; width: 40px; }
.coin-bar span { position: absolute; left: 46px; top: 14px; width: 112px; text-align: center; color: #fff; font-size: 20px; font-weight: bold; text-shadow: 0 2px 0 rgba(0,0,0,.45); }

.wave-wrap { position: absolute; right: 14px; top: 12px; display: flex; align-items: center; gap: 8px; }
.wave-bar { position: relative; width: 190px; height: 69px; }
.wave-bar > img { position: absolute; inset: 0; width: 100%; height: 100%; }
.wave-bar span { position: absolute; left: 38px; top: 20px; width: 140px; color: #fff; font-size: 18px; font-weight: bold; text-shadow: 0 2px 0 rgba(0,0,0,.4); }
.btn-img { cursor: pointer; }
.btn-img img { display: block; }
#waveSettingBtn { display: none; }

.lvl-badge { position: absolute; left: 16px; bottom: 16px; display: flex; align-items: center; background: linear-gradient(#7ec84e, #4e9a2e); border: 3px solid #2f6b1a; border-radius: 14px; padding: 6px 14px 6px 8px; gap: 8px; box-shadow: 0 3px 0 rgba(0,0,0,.35); cursor: default; }
.lvl-badge-cat { width: 52px; height: 52px; background: #3d7c22; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.lvl-badge-cat img { width: 44px; }
.lvl-badge-txt b { display: block; color: #fff; font-size: 17px; text-shadow: 0 2px 0 rgba(0,0,0,.35); }
.lvl-badge-txt span { display: flex; align-items: center; gap: 4px; color: #ffe14a; font-size: 15px; font-weight: bold; }
.lvl-badge-txt img { width: 17px; }

.repair-btn { position: absolute; left: 218px; bottom: 16px; display: flex; align-items: center; gap: 8px; background: linear-gradient(#ffd23e, #eda414); border: 3px solid #a86c0c; border-radius: 14px; padding: 8px 14px; box-shadow: 0 3px 0 rgba(0,0,0,.35); cursor: pointer; }
.repair-btn img { width: 34px; }
.repair-txt b { display: block; color: #7a4a05; font-size: 15px; }
.repair-txt span { display: flex; align-items: center; gap: 4px; color: #6b3f04; font-size: 14px; font-weight: bold; }
.repair-txt img { width: 16px; }

.addon-btns { position: absolute; right: 14px; bottom: 14px; display: flex; gap: 10px; }
.addon-btn { position: relative; width: 74px; height: 74px; background-size: 100% 100%; background-image: url('../assets/ui/yellow_box.png'); border-radius: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 3px 0 rgba(0,0,0,.35); }
.addon-btn .ab-ico { width: 46px; }
.addon-btn .ab-cnt { position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); width: 52px; }
.addon-btn .ab-cnt img { width: 100%; }
.addon-btn .ab-cnt span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; font-weight: bold; padding-bottom: 4px; }
.addon-btn.empty { filter: grayscale(1) brightness(.7); }

/* ---------- 主界面 ---------- */
#scr-landing { z-index: 8; cursor: pointer; }
#landingLogo { position: absolute; left: 50%; top: 12%; transform: translateX(-50%); width: 46%; }
#tapToPlay { position: absolute; left: 50%; top: 72%; transform: translateX(-50%); color: #fff; font-size: 24px; font-weight: bold; text-shadow: 0 2px 0 rgba(0,0,0,.5); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; transform: translateX(-50%) scale(1); } 50% { opacity: .55; transform: translateX(-50%) scale(.96); } }

/* ---------- 菜单壳 ---------- */
#scr-menu { z-index: 6; }
#scr-menu.hidden { display: none !important; }
#dailyGift { position: absolute; left: 14px; top: 10px; width: 86px; text-align: center; cursor: pointer; }
#dailyGift img { width: 78px; display: block; }
#dailyGift b { color: #fff; font-size: 12px; background: #d43b2f; border-radius: 8px; padding: 1px 6px; display: inline-block; border: 2px solid #8e1f16; }
#dailyGift b i { font-style: normal; color: #ffe14a; }

#sideBar { position: absolute; left: 24px; top: 108px; display: flex; flex-direction: column; gap: 16px; }
.side-tab { position: relative; width: 64px; height: 60px; cursor: pointer; }
.side-tab .tab-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.side-tab .tab-ico { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); width: 34px; }
.side-tab.active .tab-bg { filter: brightness(1.15) drop-shadow(0 0 6px rgba(255,255,255,.5)); }

#gemsBar { position: absolute; left: 300px; top: 14px; width: 229px; height: 62px; }
.gb-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.gb-ico { position: absolute; left: 6px; top: 8px; width: 40px; }
#gemsCount { position: absolute; left: 52px; top: 16px; width: 130px; text-align: center; color: #fff; font-size: 20px; font-weight: bold; text-shadow: 0 2px 0 rgba(0,0,0,.4); }
.gb-add { position: absolute; right: -8px; top: 6px; width: 40px; cursor: pointer; }

#ribbon { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); width: 320px; height: 96px; z-index: 3; }
#ribbon img { width: 100%; }
#ribbon span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding-top: 8px; color: #fff; font-size: 24px; font-weight: bold; text-shadow: 0 2px 0 rgba(0,0,0,.35); }

.panel { position: absolute; left: 260px; top: 118px; right: 36px; bottom: 22px; overflow: hidden; }
.scroll-y { overflow-y: auto; }

/* 可见滚动条 */
.scroll-y, #levelScroll { scrollbar-width: thin; scrollbar-color: #ffd23e rgba(0,0,0,.4); }
.scroll-y::-webkit-scrollbar, #levelScroll::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll-y::-webkit-scrollbar-track, #levelScroll::-webkit-scrollbar-track { background: rgba(0,0,0,.4); border-radius: 5px; }
.scroll-y::-webkit-scrollbar-thumb, #levelScroll::-webkit-scrollbar-thumb { background: #ffd23e; border: 2px solid rgba(0,0,0,.4); border-radius: 5px; }
.scroll-y::-webkit-scrollbar-thumb:hover, #levelScroll::-webkit-scrollbar-thumb:hover { background: #ffe97a; }

/* 关卡地图：横向滚动 */
#levelScroll { overflow-x: auto; overflow-y: hidden; }
#levelInner { position: relative; height: 100%; }
.map-img { display: block; height: 100%; width: auto; }

/* 关卡节点 */
#levelNodes { position: absolute; inset: 0; }
.lvl-node { position: absolute; width: 64px; height: 68px; transform: translate(-50%,-50%); cursor: pointer; }
.lvl-node img { width: 100%; }
.lvl-node span { position: absolute; inset: 0 0 8px 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 24px; font-weight: bold; text-shadow: 0 2px 0 rgba(0,0,0,.4); }
.lvl-node.locked span { display: none; }
.lvl-node .lock-ico { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); width: 30px; }
.lvl-node.cur { animation: nodepulse 1s infinite; }
@keyframes nodepulse { 0%,100% { transform: translate(-50%,-50%) scale(1); } 50% { transform: translate(-50%,-50%) scale(1.1); } }

/* 升级卡片 */
#catGrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; padding: 10px 14px; align-content: start; }
.cat-card { position: relative; height: 104px; }
.cat-card .cc-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.cat-card .cc-head { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); width: 76px; height: 76px; display: flex; align-items: center; justify-content: center; background: #f7ecd4; border: 3px solid #d9c9a3; border-radius: 12px; }
.cat-card .cc-head img { width: 66px; }
.cat-card .cc-mid { position: absolute; left: 94px; top: 12px; }
.cat-card .cc-mid b { color: #6b6f76; font-size: 14px; display: block; }
.cat-card .cc-mid img { width: 120px; margin-top: 4px; }
.cat-card .cc-add { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 56px; cursor: pointer; }
.cat-card .cc-add img { width: 100%; }
.cat-card.locked .cc-head { background: #4c545a; border-color: #39424a; }
.cat-card.locked .cc-head img { filter: brightness(0.15) opacity(.8); }
.cat-card .cc-lock { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); width: 52px; }
.cat-card.selected { outline: 4px solid #ffe14a; outline-offset: -2px; border-radius: 14px; }

/* 道具页 */
#addonSlots { position: absolute; left: 288px; top: 118px; width: 118px; display: flex; flex-direction: column; gap: 10px; }
.slot-item { position: relative; width: 118px; height: 112px; }
.slot-item img.slot-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.slot-item img.slot-ico { position: absolute; left: 50%; top: 42%; transform: translate(-50%,-50%); width: 60px; }
.slot-item .slot-cnt { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); width: 62px; }
.slot-item .slot-cnt img { width: 100%; }
.slot-item .slot-cnt span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: bold; font-size: 15px; }
.slot-item.locked { filter: brightness(.55); }
.slot-item .slot-lock { position: absolute; left: 50%; top: 40%; transform: translate(-50%,-50%); width: 44px; }
.slot-item .slot-price { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); color: #ffe14a; font-weight: bold; font-size: 15px; display: flex; gap: 4px; align-items: center; }
.slot-item .slot-price img { width: 20px; }

#addonList { left: 470px; display: flex; flex-direction: column; gap: 12px; padding: 10px 16px; }
.addon-row { position: relative; flex: 0 0 96px; height: 96px; }
.addon-row .ar-bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.addon-row.sel { outline: 4px solid #ffe14a; outline-offset: -2px; border-radius: 14px; }
.addon-row .ar-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 72px; }
.addon-row .ar-desc { position: absolute; left: 96px; top: 16px; width: 150px; color: #7d838c; font-size: 13px; font-weight: bold; line-height: 1.25; }
.addon-row .ar-lv { position: absolute; left: 96px; bottom: 14px; width: 64px; }
.addon-row .ar-buy { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 76px; height: 48px; cursor: pointer; }
.addon-row .ar-buy .by-bg { width: 100%; height: 100%; }
.addon-row .ar-buy .gi { position: absolute; width: 18px; height: 18px; left: 14px; top: 50%; transform: translateY(-50%); }
.addon-row .ar-buy span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding-left: 12px; color: #fff; font-weight: bold; font-size: 16px; text-shadow: 0 1px 0 rgba(0,0,0,.4); }

/* 商店页 */
#shopPanel { padding: 12px 18px; display: flex; flex-direction: column; gap: 14px; }
.shop-deals { display: flex; gap: 16px; }
.deal-green { position: relative; flex: 1; height: 104px; cursor: pointer; }
.deal-green img { width: 100%; height: 100%; }
.deal-green .dg-txt { position: absolute; left: 24px; top: 18px; color: #fff; font-weight: bold; }
.deal-green .dg-txt b { font-size: 14px; display: block; }
.deal-green .dg-txt i { font-style: normal; font-size: 24px; color: #ffe14a; }
.deal-green .dg-price { position: absolute; left: 30px; bottom: 8px; background: linear-gradient(#ffd23e,#eda414); border: 2px solid #a86c0c; border-radius: 10px; padding: 3px 16px; color: #6b3f04; font-weight: bold; font-size: 15px; }
.shop-row { display: flex; gap: 14px; justify-content: center; }
.shop-item { position: relative; width: 132px; height: 215px; cursor: pointer; }
.shop-item img { width: 100%; height: 100%; }
.shop-item .si-tag { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); color: #fff; font-size: 12px; font-weight: bold; }
.shop-item .si-gems { position: absolute; left: 0; right: 0; top: 34px; text-align: center; color: #fff; font-weight: bold; font-size: 17px; line-height: 1.2; text-shadow: 0 2px 0 rgba(0,0,0,.35); }
.shop-item .si-gems i { font-style: normal; font-size: 22px; color: #ffe14a; display: block; }
.shop-item .si-price { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); background: linear-gradient(#ffd23e,#eda414); border: 2px solid #a86c0c; border-radius: 10px; padding: 3px 12px; color: #6b3f04; font-weight: bold; font-size: 13px; }
.shop-item.blue .si-price { background: linear-gradient(#b9d9ff,#7fb3ee); border-color: #3d6ea8; color: #123a66; }

/* ---------- 弹窗 ---------- */
#popup { z-index: 20; }
.popup-mask { position: absolute; inset: 0; background: rgba(0,0,0,.62); }
.popup-body { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); text-align: center; }
.pop-strip { width: 560px; }
.pop-strip-t { position: absolute; left: 0; right: 0; top: 44%; color: #fff; font-size: 26px; text-shadow: 0 2px 0 rgba(0,0,0,.5); letter-spacing: 1px; }
.pause-round-btns { position: absolute; left: 0; right: 0; top: 0; margin-top: -32px; display: flex; justify-content: center; gap: 18px; }
.pause-round-btns .prb { width: 74px; height: 74px; cursor: pointer; }
.pause-round-btns .prb img { width: 100%; }
.pause-round-btns .prb.off img { filter: grayscale(1) brightness(.75); }
.pop-btn-row { position: absolute; left: 0; right: 0; bottom: -74px; display: flex; justify-content: center; gap: 26px; }
.btn-img.big, .btn-img.mid { position: relative; }
.btn-img.big img { width: 190px; }
.btn-img.mid img { width: 168px; }
.btn-img span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: bold; font-size: 22px; text-shadow: 0 2px 0 rgba(0,0,0,.35); }

#pop-win .pop-win-img { width: 560px; display: block; }
.win-bonus { position: absolute; left: 50%; top: 56%; transform: translate(-50%,-50%); width: 220px; }
.win-bonus img:first-child { width: 100%; }
.win-bonus .wb-coin { position: absolute; left: 26px; top: 50%; transform: translateY(-50%); width: 40px; }
.win-bonus span { position: absolute; left: 70px; right: 12px; top: 50%; transform: translateY(-50%); text-align: center; color: #fff; font-weight: bold; font-size: 26px; text-shadow: 0 2px 0 rgba(0,0,0,.4); }
.win-row { bottom: -84px; }

#pop-lose .pop-lose-img { width: 480px; display: block; }
.lose-row { bottom: -80px; }

.help-txt { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-38%); color: #eef2f5; font-size: 17px; line-height: 1.9; width: 460px; text-align: center; }

#pop-ad .ad-box { width: 320px; padding: 26px; background: #22262b; border-radius: 16px; border: 3px solid #3a4149; color: #fff; }
.ad-box b { font-size: 20px; }
.ad-bar { height: 14px; background: #11141a; border-radius: 7px; margin: 16px 0 10px; overflow: hidden; }
.ad-bar i { display: block; height: 100%; width: 0; background: #7ec84e; transition: width .95s linear; }
#adSec { color: #ffe14a; font-weight: bold; }

#toast { position: absolute; left: 50%; bottom: 70px; transform: translateX(-50%); background: rgba(20,22,26,.92); color: #ffe14a; border: 2px solid #3a4149; padding: 10px 22px; border-radius: 12px; font-size: 16px; font-weight: bold; z-index: 40; transition: opacity .3s; }
