:root{color-scheme:dark;--bg:#172033;--panel:#263452;--line:#5772aa;--gold:#ffd36b;--mint:#95f0d1;--ink:#f8fbff}*{box-sizing:border-box}html,body{margin:0;min-height:100%;background:radial-gradient(circle at 50% 0,#405a83,#172033 64%);font-family:system-ui,sans-serif;color:var(--ink)}body{display:flex;justify-content:center;padding:clamp(12px,3vw,32px)}button{font:inherit;color:inherit;border:1px solid var(--line);background:#2e4267;border-radius:14px;padding:12px 18px;cursor:pointer}button:hover,button:focus-visible{outline:3px solid var(--gold);outline-offset:2px}button:disabled{opacity:.48;cursor:not-allowed;filter:saturate(.45)}.primary{background:linear-gradient(135deg,#f7c45e,#eb895b);color:#221b1e;font-weight:800;border-color:#ffe4a0}.screen{width:min(920px,100%);min-height:calc(100vh - 64px);padding:clamp(20px,5vw,56px);background:rgba(23,32,51,.9);border:1px solid #5670a0;border-radius:24px;box-shadow:0 20px 60px #0006}.screen:not(.battle):not(.result){display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center}.screen[hidden]{display:none !important}.brand{color:var(--mint);font-size:.76rem;letter-spacing:.14em}.lede{max-width:54ch;line-height:1.55;color:#d3def2}.progress{color:var(--gold)}.primary{min-width:220px}.back{align-self:flex-start;padding:8px 12px}.stage-list{display:grid;grid-template-columns:repeat(5,1fr);gap:12px;width:100%;max-width:720px}.stage-list button{min-height:80px}.battle{padding:16px;display:flex;flex-direction:column}.battle-head{display:flex;align-items:center;justify-content:space-between;gap:10px;color:var(--gold);font-weight:800}.battle-status{text-align:center;color:#d3def2}.battle canvas{width:100%;height:auto;display:block;background:#314260;border:1px solid #6686bc;border-radius:18px}.touch-hint{text-align:center;color:#afc1df;font-size:.84rem;padding:8px}.result{align-items:center}.result-actions{display:flex;flex-wrap:wrap;gap:10px;justify-content:center}@media(max-width:560px){body{padding:0}.screen{min-height:100vh;border-radius:0;border-inline:0;padding:20px 14px}.stage-list{grid-template-columns:repeat(2,1fr)}.battle{padding:10px}.battle canvas{border-radius:12px}}

/* v6 Result envelope: keep every native destination inside the narrow portrait action surface. */
.result-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));width:100%;max-width:720px;gap:10px}
.result-actions>button{width:100%;min-width:0;min-height:48px;padding-inline:8px}
.battle canvas{touch-action:none}
@media(max-width:700px){.result-actions{grid-template-columns:1fr;max-width:360px}}

/* v11 responsive Battle envelope: the shared logical shell owns the full safe
   rectangle; this frame keeps the fixed playfield uniform inside its flexible
   scene track instead of letting a width-only canvas clip the lower arena. */
.battle.battle-screen{display:grid!important;grid-template-rows:auto auto minmax(0,1fr) auto!important;gap:8px!important;min-height:0!important;overflow:hidden;position:relative;flex-direction:initial!important;align-items:stretch!important}
.battle-screen .arena-frame{min-width:0;min-height:0;display:grid;place-items:center;overflow:hidden}
.battle-screen .arena-frame canvas{width:auto;height:auto;max-width:100%;max-height:100%;display:block}
.battle-screen>.result.screen:not([hidden]){position:absolute;inset:0;width:100%;height:100%;min-width:0;min-height:0;margin:0;padding:16px;display:flex;flex-direction:column;align-items:center;justify-content:center;z-index:2;overflow:auto}
@media(max-width:560px){.battle-screen>.result.screen:not([hidden]){padding:20px 14px}}

body.wp-stage-select-active .battle-ad-reserve{display:none !important}

/* The responsive Battle envelope uses an important grid display rule. Keep
   inactive screens out of the document flow after that envelope is applied. */
.screen[hidden]{display:none !important}

/* Keep the Battle utility in the reserved fourth header slot and large enough
   for the logical 44px interaction target at every responsive scale. */
.battle-header .battle-reset{box-sizing:border-box;width:48px;min-width:48px;height:48px;min-height:48px;max-height:48px;padding:0;border:1px solid rgba(160,234,242,.36);border-radius:12px;background:#12334d;font-size:12px;font-weight:800;white-space:nowrap;overflow:hidden}

/* v14: do not leave enabled Stage cards with a hit centre in the rail's
   clipped gutter after the shared scaler centres the final chapter. */
body[data-wp-game-id="animal-flip-foundry"] .stage-list > .wp-stage-card-clipped{visibility:hidden!important;pointer-events:none!important}
