:root{font-family:Inter,"Noto Sans TC",system-ui,sans-serif;color-scheme:dark;--ink:#f5fff9;--deep:#052c2d;--panel:rgba(4,43,42,.94);--mint:#72f1c5;--gold:#ffd76b;--blue:#77bfff}*{box-sizing:border-box}html,body{margin:0;min-height:100%;background:#031d20;color:var(--ink);-webkit-text-size-adjust:100%;text-size-adjust:100%}button,select{font:inherit}button{cursor:pointer}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}[hidden]{display:none!important}.main-group{width:min(100%,980px);margin:0 auto}.main-screen{min-height:min(780px,100svh);display:grid;grid-template-rows:72px 1fr;gap:14px;padding:16px;background:linear-gradient(rgba(2,28,30,.18),rgba(2,28,30,.78)),url('../../assets/animal-2048-background.webp') center/cover}.main-header{display:grid;grid-template-columns:76px minmax(0,1fr) 136px;align-items:center;gap:10px;padding:8px 10px;border:1px solid rgba(141,255,221,.4);border-radius:22px;background:rgba(2,27,30,.9)}.main-header>strong{text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:25px}.main-return{width:56px;height:56px;border-radius:15px;background:#fff;display:grid;grid-template-columns:1fr 24px;place-items:center;color:#1378a7;text-decoration:none;font-size:28px;font-weight:900}.main-return img{width:22px;height:22px;object-fit:contain}.locale-control select{width:100%;min-height:44px;border-radius:12px;background:#123f40;color:#fff;border:1px solid #4c8984;padding:0 8px}.main-hero{display:grid;grid-template-columns:minmax(300px,1fr) minmax(280px,.8fr);align-items:center;gap:24px;padding:20px;border:1px solid rgba(145,255,224,.28);border-radius:28px;background:rgba(4,39,39,.74);backdrop-filter:blur(10px)}.main-poster{width:100%;aspect-ratio:1;object-fit:cover;border-radius:24px;box-shadow:0 18px 60px #001a1acc}.main-copy{display:grid;gap:14px}.main-copy small{color:#8effd9;font-weight:900}.main-copy h1{font-size:clamp(38px,6vw,68px);line-height:1;margin:0}.main-copy p{font-size:19px;line-height:1.5;margin:0}.main-progress{padding:14px;border-radius:16px;background:rgba(2,22,26,.84);color:#baffea;font-weight:800}.primary-action{min-height:58px;border:0;border-radius:16px;background:linear-gradient(#ffe98e,#ffc73f);color:#302600;font-weight:1000;font-size:19px;box-shadow:0 7px 0 #a96f00}.game-page-info{width:100%}body[data-screen="stage"] .main-group,body[data-screen="battle"] .main-group{display:none}

.stage-screen,.battle-screen{position:fixed;inset:0;background:#031d20}.stage-screen{display:grid;grid-template-rows:minmax(0,1fr) 56px}.stage-canvas,.battle-canvas{position:relative;width:100%;height:100%;min-height:0;overflow:hidden;background:linear-gradient(rgba(2,31,32,.55),rgba(2,31,32,.78)),url('../../assets/animal-2048-background.webp') center/cover}.stage-header{position:absolute;z-index:3;left:18px;right:18px;top:18px;height:84px;display:grid;grid-template-columns:60px minmax(0,1fr) 72px;align-items:center;gap:12px;padding:10px 14px;border:1px solid rgba(121,250,210,.45);border-radius:22px;background:rgba(3,40,40,.94)}.stage-header button,.battle-header>button{width:52px;height:52px;border-radius:14px;border:1px solid #7afad5;background:#fff;color:#117baa;font-size:28px;font-weight:900}.stage-header div{display:grid;gap:3px;min-width:0}.stage-header strong{font-size:24px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.stage-header span{color:#a9e9d5;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.stage-header img{width:70px;height:70px;object-fit:contain}.chapter-panel{position:absolute;left:24px;right:24px;top:120px;min-height:96px;padding:14px 18px;border-radius:18px;background:rgba(4,49,44,.92);border:1px solid rgba(255,226,105,.5);display:grid;gap:4px}.chapter-panel small{color:#ffe275;font-weight:900}.chapter-panel strong{font-size:22px}.chapter-panel p{margin:0;color:#d0eee4}.stage-rail{position:absolute;left:18px;right:18px;bottom:18px;height:330px;display:flex;gap:18px;align-items:center;overflow-x:auto;overflow-y:hidden;padding:28px calc(50% - 132px);scroll-snap-type:x mandatory;touch-action:pan-x}.stage-card{flex:0 0 264px;height:208px;scroll-snap-align:center;border-radius:24px;border:2px solid rgba(149,255,220,.36);background:linear-gradient(rgba(2,45,42,.54),rgba(2,30,33,.96)),url('../../assets/animal-2048-cover.webp') center/cover;color:white;padding:16px;text-align:left;display:grid;grid-template-rows:auto 1fr auto;box-shadow:0 18px 40px #001a1a80}.stage-card.selected{border-color:#65ffd0;box-shadow:0 0 0 5px rgba(85,255,200,.2),0 0 25px #65ffd088,0 18px 40px #001a1a}.stage-card.locked{filter:saturate(.25) brightness(.56)}.stage-card strong{font-size:32px}.stage-card span{font-weight:800}.stage-card small{display:flex;justify-content:space-between;color:#caffed}.stage-ad-reserve,.battle-ad-reserve{height:56px;min-height:56px;background:#071a2b;border-top:1px solid #264b55;pointer-events:none}

.battle-screen{display:grid;grid-template-rows:minmax(0,1fr) 56px}.battle-canvas{display:grid;grid-template-rows:82px 48px minmax(0,1fr) 62px 74px;gap:8px;padding:10px}.battle-header{display:grid;grid-template-columns:56px minmax(0,1fr) 84px 98px;align-items:center;gap:10px;padding:8px 12px;border:1px solid rgba(118,249,211,.38);border-radius:18px;background:rgba(2,34,36,.94)}.battle-progress{display:grid;gap:2px;min-width:0}.battle-progress span{font-weight:900;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.battle-progress strong{color:#ffe47a;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.battle-stat{text-align:center;display:grid;min-width:0}.battle-stat small{color:#9cded0}.battle-stat strong{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.objective-row{display:flex;align-items:center;justify-content:center;padding:8px 14px;border-radius:14px;background:rgba(5,56,49,.94);font-weight:800;color:#d8fff2;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.board-zone{position:relative;min-height:0;display:grid;place-items:center;overflow:hidden;border:1px solid rgba(145,255,218,.4);border-radius:24px;background:rgba(1,24,26,.72)}.game-board{width:min(100%,580px);max-height:100%;aspect-ratio:1;display:grid;grid-template-columns:repeat(4,1fr);grid-template-rows:repeat(4,1fr);gap:10px;padding:10px;border:4px solid #78946d;border-radius:24px;background:rgba(33,57,46,.94);touch-action:none;user-select:none;outline:none;box-shadow:0 18px 42px #00191699}.grid-cell{position:relative;min-width:0;min-height:0;border-radius:16px;background:rgba(210,219,185,.16);border:1px solid rgba(222,244,203,.18);overflow:hidden}.grid-cell.is-blocked{background:linear-gradient(145deg,#50675e,#2b413d);border:2px solid #71877b}.grid-cell.is-blocked::after{content:"";position:absolute;inset:18%;background:url('../../assets/animal-merge-token-1.png') center/contain no-repeat;filter:grayscale(1) brightness(.55);opacity:.42}.tile{position:absolute;inset:4px;display:grid;place-items:center;border-radius:14px;background:linear-gradient(145deg,#f6e8b8,#cba964);box-shadow:inset 0 -5px 0 rgba(80,44,7,.2),0 5px 10px #0018}.tile img{width:84%;height:84%;object-fit:contain;filter:drop-shadow(0 4px 4px #0007)}.tile .tile-value{position:absolute;right:4px;bottom:3px;min-width:30px;padding:2px 5px;border-radius:999px;background:#061f22e8;color:#fff4a8;font-size:12px;font-weight:1000;text-align:center}.tile[data-level="1"],.tile[data-level="2"]{background:linear-gradient(145deg,#e9f5d7,#acd68d)}.tile[data-level="3"],.tile[data-level="4"]{background:linear-gradient(145deg,#c5f4e5,#62c5ab)}.tile[data-level="5"],.tile[data-level="6"]{background:linear-gradient(145deg,#cddfff,#75a7e8)}.tile[data-level="7"],.tile[data-level="8"]{background:linear-gradient(145deg,#f8d4ff,#bd73d1)}.tile[data-level="9"],.tile[data-level="10"],.tile[data-level="11"]{background:linear-gradient(145deg,#fff0a5,#e59b25);box-shadow:inset 0 -5px 0 #8b4b17,0 0 18px #ffd75a88}.tile.is-merged{z-index:2;animation:mergePop .34s ease-out}.tile.is-merged::after{content:"";position:absolute;inset:-4px;border:3px solid #fff6a8;border-radius:inherit;pointer-events:none;animation:mergeRing .34s ease-out both}.move-feedback{position:absolute;top:10px;left:50%;transform:translateX(-50%);max-width:calc(100% - 24px);padding:6px 12px;border-radius:999px;background:#041e21e8;color:#fff4a8;font-weight:900;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;pointer-events:none}.move-feedback:empty{display:none}@keyframes mergePop{0%{transform:scale(.88);filter:brightness(1.45)}55%{transform:scale(1.16);filter:brightness(1.2)}100%{transform:scale(1);filter:brightness(1)}}@keyframes mergeRing{0%{opacity:1;transform:scale(.72)}100%{opacity:0;transform:scale(1.12)}}.battle-actions{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}.battle-actions button,.direction-pad button,.result-actions button,.leave-card button{border:1px solid #67e9c4;border-radius:14px;background:#104c4a;color:#fff;font-weight:900}.battle-actions button:disabled{opacity:.42}.direction-pad{display:grid;grid-template-columns:repeat(4,64px);gap:12px;justify-content:center}.direction-pad button{height:64px;font-size:29px;background:#0b3f43}.direction-pad button:active{background:#1b7269}.result-overlay,.leave-overlay,.tutorial-overlay{position:absolute;inset:0;z-index:10;display:grid;place-items:center;padding:18px;background:rgba(0,20,23,.82)}.result-card,.leave-card,.tutorial-card{width:min(620px,100%);max-height:100%;overflow:auto;padding:22px;border-radius:26px;background:linear-gradient(145deg,#0b5550,#052e36);border:2px solid #6ff4cf;text-align:center;display:grid;gap:12px}.result-card>img,.tutorial-card>img{width:106px;height:106px;object-fit:contain;margin:-10px auto -14px}.result-card h2,.result-card p,.leave-card h2,.leave-card p,.tutorial-card h2{margin:0}.result-stars{font-size:38px;color:#ffd963;letter-spacing:8px}.skill-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}.skill-grid>div{padding:10px;border-radius:14px;background:#073c3c;display:grid;gap:4px}.skill-grid small{color:#9fe5d2}.result-actions{display:grid;grid-template-columns:1fr 1fr 1.2fr;gap:10px;min-height:58px}.result-actions .primary-action{color:#2d2500;background:linear-gradient(#ffe888,#ffc638);border-color:#ffe169}.leave-card{width:min(460px,100%)}.leave-card>div{display:grid;grid-template-columns:1fr 1fr;gap:10px}.leave-card .primary-action{color:#2d2500;background:linear-gradient(#ffe888,#ffc638)}.tutorial-overlay{position:fixed;z-index:30}.tutorial-card{position:relative;width:min(520px,100%);text-align:left}.tutorial-card h2{text-align:center}.tutorial-card li{margin:8px 0}.tutorial-card>button:first-child{position:absolute;right:12px;top:12px;width:42px;height:42px;border-radius:50%;border:0;background:#fff;color:#12616a;font-size:24px}.tutorial-card .primary-action{width:100%}

@media(max-width:700px){.main-screen{padding:8px;grid-template-rows:68px auto}.main-header{grid-template-columns:62px minmax(0,1fr) 112px;padding:6px}.main-return{width:52px;height:52px}.main-hero{grid-template-columns:1fr;padding:12px;gap:12px}.main-poster{width:min(100%,340px);margin:auto}.main-copy{gap:9px}.main-copy h1{font-size:36px}.main-copy p{font-size:16px}.stage-header{left:8px;right:8px;top:8px}.chapter-panel{left:10px;right:10px;top:108px}.stage-rail{left:4px;right:4px;bottom:8px;height:300px}.battle-canvas{grid-template-rows:72px 46px minmax(0,1fr) 56px 68px;padding:6px;gap:6px}.battle-header{grid-template-columns:50px minmax(0,1fr) 62px 78px;padding:5px}.battle-header>button{width:46px;height:46px}.battle-stat small{font-size:11px}.game-board{gap:6px;padding:6px;border-width:3px;border-radius:18px}.grid-cell{border-radius:12px}.tile{inset:3px;border-radius:10px}.tile .tile-value{font-size:11px;min-width:26px}.direction-pad{grid-template-columns:repeat(4,58px);gap:10px}.direction-pad button{height:58px}.result-card{padding:16px}.skill-grid{grid-template-columns:1fr}.result-actions{grid-template-columns:1fr 1fr}.result-actions .primary-action{grid-column:1/-1}}
@media(max-height:480px) and (orientation:landscape){.main-screen{height:100svh;min-height:0;grid-template-rows:58px minmax(0,1fr);gap:6px;padding:6px}.main-header{grid-template-columns:62px minmax(0,1fr) 132px;padding:3px 8px;border-radius:16px}.main-header>strong{font-size:21px}.main-return{width:48px;height:48px}.locale-control select{min-height:40px}.main-hero{min-height:0;grid-template-columns:minmax(250px,38%) minmax(0,1fr);gap:12px;padding:8px 12px;border-radius:20px}.main-poster{width:auto;height:100%;max-height:300px;aspect-ratio:1;margin:auto}.main-copy{gap:5px}.main-copy h1{font-size:30px;line-height:1.05}.main-copy p{font-size:14px;line-height:1.25}.main-progress{padding:7px 10px}.main-copy .primary-action{min-height:44px;font-size:17px;box-shadow:0 4px 0 #a96f00}.stage-header{height:64px;grid-template-columns:48px 1fr 54px}.stage-header button{width:44px;height:44px}.stage-header img{width:52px;height:52px}.chapter-panel{top:78px;left:8px;right:auto;width:36%;min-height:80px;padding:9px}.stage-rail{left:38%;top:76px;bottom:4px;height:auto;padding-block:8px}.stage-card{height:180px}.battle-canvas{grid-template-columns:minmax(0,1fr) 224px;grid-template-rows:58px 42px minmax(0,1fr);grid-template-areas:"head head" "objective side" "board side";gap:4px;padding:4px}.battle-header{grid-area:head}.objective-row{grid-area:objective}.board-zone{grid-area:board}.battle-actions{grid-area:side;grid-template-columns:1fr;align-self:start}.direction-pad{grid-area:side;grid-template-columns:repeat(2,64px);align-self:end}.direction-pad button{height:54px}.game-board{height:100%;width:auto}.result-card{width:min(760px,96%);grid-template-columns:110px 1fr;grid-template-areas:"img title" "img stars" "text skills" "best actions";gap:6px;padding:10px}.result-card>img{grid-area:img}.result-card h2{grid-area:title}.result-stars{grid-area:stars}.result-card>p:not(.best-text){grid-area:text}.skill-grid{grid-area:skills;grid-template-columns:repeat(3,1fr)}.best-text{grid-area:best}.result-actions{grid-area:actions}}
.stage-screen,.battle-screen{left:0;right:0;width:100%;transform:none}.stage-screen{display:block;grid-template-rows:none}.battle-canvas{width:min(100%,920px);justify-self:center}.tutorial-overlay{right:0;bottom:56px;left:0;width:100%;transform:none;z-index:60!important}.stage-card strong{font-size:27px;line-height:1.08;overflow-wrap:anywhere}.grid-cell.is-blocked::after{inset:10%;background-image:url('../../assets/animal-bubble-safari-blockers.webp');background-size:400% 100%;background-position:left center;filter:none;opacity:.9}:is(button,select,a,.game-board):focus-visible{outline:3px solid #fff27a;outline-offset:3px}
.stage-card.infinite-stage-card{border-color:#ffd970;background:linear-gradient(145deg,rgba(7,75,65,.62),rgba(20,27,45,.96)),url('../../assets/animal-2048-cover.webp') center/cover}.stage-card.infinite-stage-card>small span:last-child{font-size:28px;color:#ffe27a}.stage-card.infinite-stage-card>strong{color:#fff0a0}.tile.is-legendary{background:linear-gradient(145deg,#fff0a5,#e59b25);box-shadow:inset 0 -5px 0 #8b4b17,0 0 18px #ffd75a88}
.board-zone{container-type:size}.game-board{width:min(100cqw,100cqh,580px);height:min(100cqw,100cqh,580px);max-height:none}
.grid-cell.has-moving-tile{overflow:visible;z-index:4}.tile.is-moving{z-index:5;will-change:transform;pointer-events:none}
@media(min-width:701px) and (min-height:481px){.battle-canvas{grid-template-columns:minmax(0,1fr) auto;grid-template-rows:82px 48px minmax(0,1fr) 74px;grid-template-areas:"head head" "objective objective" "board board" "actions directions"}.battle-header{grid-area:head}.objective-row{grid-area:objective}.board-zone{grid-area:board}.battle-actions{grid-area:actions}.direction-pad{grid-area:directions;align-self:stretch;align-items:center}}
body[data-screen="stage"] .sound-toggle,body[data-screen="battle"] .sound-toggle{display:none!important}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important}}
.stage-canvas{isolation:isolate;background:linear-gradient(rgba(2,19,31,.78),rgba(2,19,31,.94)),url('../../assets/animal-2048-background.webp') center/cover no-repeat}.stage-canvas::before{content:"";position:absolute;z-index:0;left:50%;top:270px;width:min(72%,560px);aspect-ratio:1;transform:translateX(-50%);background:url('../../assets/animal-2048-cover.webp') center/contain no-repeat;opacity:.2;filter:saturate(.82) contrast(.92);mask-image:radial-gradient(ellipse at center,#000 48%,transparent 76%);pointer-events:none}.wp-stage-art-shell .stage-header{position:absolute;width:auto}.stage-mode-tabs{position:absolute;z-index:4;left:24px;right:24px;top:116px;height:48px;display:grid;grid-template-columns:1fr 1fr;gap:8px;padding:4px;border:1px solid rgba(121,250,210,.4);border-radius:15px;background:rgba(3,28,35,.9)}.stage-mode-tabs button{width:100%;height:100%;min-width:0;min-height:0!important;border:0;border-radius:11px;background:transparent;color:#bcd8d2;font-size:17px;font-weight:900}.stage-mode-tabs button[aria-pressed="true"]{color:#10251f;background:linear-gradient(180deg,#fff09a,#ffc94f);box-shadow:0 0 16px rgba(255,219,92,.42)}.chapter-panel{z-index:2;top:178px;background:rgba(4,49,44,.9)}.stage-rail{z-index:2;bottom:72px}.stage-screen[data-mode="challenge"] .stage-rail{overflow:hidden}
@media(max-width:700px){.stage-mode-tabs{left:10px;right:10px;top:100px;height:46px}.chapter-panel{top:154px}.stage-canvas::before{top:238px;width:min(88%,500px);opacity:.18}.stage-rail{bottom:62px}}
@media(max-height:480px) and (orientation:landscape){.stage-header{left:18px;right:18px;top:18px;width:auto;height:84px;grid-template-columns:60px minmax(0,1fr) 72px;transform:translateX(calc((100% - 1000px)/2))}.stage-header button{width:52px;height:52px}.stage-header img{width:70px;height:70px}.stage-mode-tabs{left:24px;right:24px;top:116px;width:auto;height:48px;transform:translateX(calc((100% - 1000px)/2))}.stage-mode-tabs button{font-size:17px}.chapter-panel{left:24px;right:24px;top:178px;width:auto;min-height:96px;padding:14px 18px;transform:translateX(calc((100% - 1000px)/2))}.stage-rail{left:18px;right:18px;top:auto;bottom:18px;width:auto;height:330px;padding:28px calc(50% - 132px);transform:translateX(calc((100% - 1000px)/2))}.stage-card{height:208px}}

/* Keep the only visible board plate square and aligned to the 4 x 4 grid. */
.board-zone{overflow:visible;border:0;border-radius:0;background:transparent}
.game-board{grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:repeat(4,minmax(0,1fr))}

/* Phone Result keeps every decision, including Next Stage, above the reserve. */
@media(max-width:700px){.result-card{padding:12px;gap:8px;overflow:hidden}.result-card>img{width:78px;height:78px;margin:-4px auto -8px}.result-stars{font-size:32px;line-height:1}.skill-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}.skill-grid>div{padding:7px 4px}.result-actions{grid-template-columns:1fr .8fr 1.15fr;gap:6px;min-height:50px}.result-actions .primary-action{grid-column:auto}.result-actions button{min-width:0;padding-inline:4px;font-size:15px}}
