:root{font-family:system-ui,-apple-system,"Microsoft YaHei",sans-serif;color:#204776;background:#c9e9ff;font-synthesis:none}*{box-sizing:border-box}body{margin:0;background:radial-gradient(ellipse at 15% 20%,#e6f7ffbb,transparent 48%),radial-gradient(ellipse at 90% 60%,#eefaffb0,transparent 50%),#c9e9ff;min-height:100svh}button,a{font:inherit;-webkit-tap-highlight-color:transparent}button{color:inherit;cursor:pointer;touch-action:manipulation}button:disabled{cursor:default;opacity:.55}button:focus-visible,a:focus-visible,canvas:focus-visible{outline:3px solid #b259cb;outline-offset:3px}[hidden]{display:none!important}#app{max-width:460px;margin:auto;padding:14px 14px max(12px,env(safe-area-inset-bottom));}header{position:relative;display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:56px}.back{display:flex;align-items:center;gap:2px;color:#234a7e;text-decoration:none;font-weight:800;font-size:15px;white-space:nowrap}.back img{width:28px;height:40px;object-fit:contain}h1{margin:0;flex:1;display:flex;justify-content:center}h1 img{width:100%;max-width:172px;height:58px;object-fit:contain}.icon{width:44px;height:44px;padding:2px;border:0;background:none;flex-shrink:0}.icon img{width:100%;height:100%;object-fit:contain}.hud{display:flex;flex-direction:column;align-items:center;gap:7px;margin:6px 0 12px;font-weight:850;font-size:21px}#level{background:#e9f7ffbf;min-width:130px;text-align:center;padding:3px 18px;border-radius:30px}.timer{display:flex;align-items:center;gap:8px;background:#f4fbff;border-radius:28px;padding:0 16px 0 0;font-size:28px;line-height:42px;letter-spacing:1px;font-variant-numeric:tabular-nums}.timer img{width:44px;height:44px;object-fit:contain}.timer.urgent{color:#ce3b61}.preview-frame,.board-wrap{position:relative;border:3px solid #f0fbff;border-radius:16px;background:#a6d8f4;box-shadow:0 3px 0 #8dbde2,0 5px 10px #3f92d133;overflow:hidden}.board-wrap canvas,.preview-frame canvas{display:block;width:100%;height:auto;aspect-ratio:1}.preview-frame canvas{image-rendering:pixelated}.preview-frame{padding:16px;background:#effaff}.preview-frame #art-name{display:block;text-align:center;font-size:20px;font-weight:800;margin-top:10px}.primary{display:block;border:2px solid #fff2a2;background:#ffe06b;color:#87500b;font-weight:900;font-size:23px;min-height:56px;border-radius:24px;padding:8px 24px;box-shadow:0 4px 0 #e8ae43}.primary:active{transform:translateY(2px);box-shadow:0 2px 0 #e8ae43}#start{margin:16px auto 12px;min-width:70%}#home-progress{text-align:center;font-size:13px;margin:14px 0 0;color:#48688e}.home-links{display:flex;justify-content:center;gap:12px;margin:14px 0}.home-links button{border:1px solid #93c5e9;background:#e7f6ff;padding:8px 14px;border-radius:20px;min-height:44px}#status{font-size:12px;min-height:18px;margin:8px 0;text-align:center;color:#48698e}#tray{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:6px 4px;padding:10px 9px;background:#e3f4ff;border:2px solid #f0fbff;border-radius:16px;box-shadow:0 3px 0 #9bcbe9}#tray button{padding:0;border:0;background:none;aspect-ratio:1;position:relative;min-width:0}#tray button canvas{display:block;width:100%;height:100%}#tray button:hover{transform:translateY(-2px)}#tray button:focus-visible{outline-offset:0}.tools{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;margin:20px 0 14px}.tools button{min-width:0;position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:8px 2px 7px;border:2px solid #f0fbff;background:#e6f6ff;border-radius:18px;box-shadow:0 3px 0 #99c9eb;min-height:78px;font-size:clamp(11px,3.1vw,15px);font-weight:850;white-space:nowrap}.tools button.active{border-color:#ffcb41;background:#fff3bf}.tools img{width:48px;height:48px;object-fit:contain}.tools b{position:absolute;right:-3px;top:-10px;min-width:24px;height:24px;border:2px solid #ddffdf;border-radius:14px;background:#57b84e;color:#fff;line-height:20px;font-size:13px;padding:0 3px}#pause-cover{position:absolute;inset:0;background:#d4ebffdd;display:flex;align-items:center;justify-content:center;backdrop-filter:blur(4px)}.ad-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:15px 0 8px}.ad{display:grid;grid-template-columns:1fr auto;gap:3px;min-width:0;text-decoration:none;padding:10px;background:#e1e5ff;border:2px solid #f5fbff;border-radius:14px;box-shadow:0 3px 0 #a3c9eb;color:#254b80}.ad:nth-child(2){background:#fff1df}.ad strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px}.ad small{grid-row:2;font:11px Arial,sans-serif;color:#657e9b;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ad em{grid-column:2;grid-row:1/3;align-self:center;font-size:10px;font-style:normal;padding:2px 4px;border-radius:6px;color:#fff;background:#9291ef}#ad-top .ad{grid-template-columns:auto 1fr auto;align-items:center;background:#dcefff;margin-bottom:14px;padding:10px;gap:9px}#ad-top .ad strong{font-size:21px}#ad-top .ad small{grid-column:2;grid-row:1;font-size:12px;border-left:1px solid #8fb3d5;padding-left:8px}#ad-top .ad em{grid-column:3;grid-row:1;background:#489cf2}footer{text-align:center;margin-top:15px;font-weight:800;letter-spacing:2px;color:#5c98c8;font-size:14px}dialog{border:2px solid #e5f7ff;border-radius:24px;padding:0;background:#f0f9ff;color:#204776;max-width:min(420px,calc(100vw - 24px));width:100%;max-height:85svh;box-shadow:0 8px 40px #20477650}dialog::backdrop{background:#193b6588}.panel-content{padding:24px 20px;position:relative}.close{position:absolute;right:10px;top:8px;width:36px;height:36px;border:0;border-radius:50%;background:#d9edff;font-size:26px}.panel-content h2{margin:0 24px 16px 0;font-size:22px}#panel-body{font-size:14px;line-height:1.75}#panel-body p{margin:10px 0}#panel-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:18px}#panel-actions button{min-height:44px;padding:9px 16px;border:1px solid #9bc4e7;border-radius:16px;background:#dfefff;font-weight:750}#panel-actions button.primary{background:#ffe06b;color:#87500b;font-size:17px;border-color:#fff2a2}.album-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}.album-grid button{min-width:0;padding:4px;border:1px solid #bdd7ee;background:#fff;border-radius:10px;font-size:10px}.album-grid img{width:100%;image-rendering:pixelated}.album-grid button:disabled{opacity:.45}.setting{display:flex;justify-content:space-between;align-items:center;gap:12px;margin:14px 0}.setting input{width:22px;height:22px}#storage-warning{font-size:12px;color:#a33150;text-align:center}@media(min-width:800px){#app{padding-top:24px}}@media(max-width:350px){#app{padding:10px}.back{font-size:12px}h1 img{max-width:145px}.tools{gap:6px}#ad-top .ad strong{font-size:18px}.ad strong{font-size:12px}#tray{gap:5px 2px}}@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;animation:none!important;transition:none!important}}
/* Visible viewport layout: Safari toolbar space is excluded by visualViewport.height. */
#transfers{position:fixed;inset:0;width:100%;height:100%;pointer-events:none;z-index:150}#tray-label{display:flex;justify-content:space-between;font-size:11px;line-height:16px;color:#4d7196;margin:0 2px 3px}#tray button[data-color="-1"]{background:#bfd9e9;box-shadow:inset 0 2px 3px #719bbf65;border-radius:5px}#tray button canvas{pointer-events:none}body[data-screen="battle"] #app{padding:6px 10px max(12px,env(safe-area-inset-bottom));max-width:460px}body[data-screen="battle"] header{min-height:40px;height:40px}body[data-screen="battle"] h1 img{height:40px;max-width:150px}body[data-screen="battle"] .icon{width:38px;height:38px}body[data-screen="battle"] .hud{flex-direction:row;justify-content:space-between;margin:2px 0 6px;gap:8px;font-size:17px;height:32px}body[data-screen="battle"] #level{min-width:94px;padding:2px 12px}body[data-screen="battle"] .timer{font-size:23px;line-height:30px;padding-right:10px}body[data-screen="battle"] .timer img{width:32px;height:32px}body[data-screen="battle"] #ad-top .ad{min-height:32px;padding:5px 8px;margin-bottom:6px;border-radius:10px}body[data-screen="battle"] #ad-top .ad strong{font-size:16px}body[data-screen="battle"] #ad-top .ad small{font-size:11px}body[data-screen="battle"] .board-wrap{width:var(--board-size,280px);max-width:100%;margin:auto;border-radius:10px;touch-action:manipulation}body[data-screen="battle"] #status{margin:4px 0;min-height:16px;line-height:16px;font-size:11px}body[data-screen="battle"] #tray{gap:4px 3px;padding:6px 8px;border-radius:11px}body[data-screen="battle"] #tray button{height:19px;aspect-ratio:auto}body[data-screen="battle"] #tray button canvas{width:19px;height:19px;max-width:100%;margin:auto}body[data-screen="battle"] .tools{margin:13px 0 5px;gap:6px}body[data-screen="battle"] .tools button{min-height:57px;padding:3px 1px 4px;border-radius:12px;font-size:12px}body[data-screen="battle"] .tools img{width:34px;height:34px}body[data-screen="battle"] .tools b{top:-9px;right:0;height:20px;min-width:20px;line-height:16px;font-size:11px}body[data-screen="battle"] .ad-row{gap:6px;margin:6px 0 4px}body[data-screen="battle"] .ad-row .ad{padding:5px 7px;border-radius:9px;min-height:39px}body[data-screen="battle"] .ad strong{font-size:12px}body[data-screen="battle"] .ad small{font-size:10px}body[data-screen="battle"] footer{font-size:10px;line-height:14px;margin-top:4px}#battle{min-width:0}body{overflow-y:auto}body[data-screen="battle"] #app{min-height:var(--app-height,100dvh)}@media(max-height:500px) and (orientation:landscape){body[data-screen="battle"] #app{max-width:420px}body[data-screen="battle"] .board-wrap{width:220px}}

.tools button[data-locked="true"] img{filter:grayscale(1);opacity:.5}.tools button[data-locked="true"] span{font-size:10px}

#cancel-selection{font:inherit;color:#315c87;border:1px solid #92bddb;background:#ffffffd9;border-radius:7px;padding:0 5px;cursor:pointer}#tray button[data-selected="true"] canvas{transform:translateY(-5px);filter:drop-shadow(0 4px 2px #315c8780)}#tray button[data-selected="true"]{outline:1px solid #fff;outline-offset:1px}

#tray button[data-color="-1"]{background:linear-gradient(145deg,#92b7cc,#c3deeb);box-shadow:inset 2px 3px 5px #476a8a66,inset -1px -1px 1px #f5fcffb3}

#board,#tray button,.tools button,#start,#resume,#cancel-selection{touch-action:manipulation;-webkit-tap-highlight-color:transparent}button:active{filter:brightness(.96)}

body[data-screen="home"] #app{padding:6px 10px max(16px,env(safe-area-inset-bottom));min-height:var(--app-height,100dvh)}
body[data-screen="home"] header{min-height:40px;height:40px}body[data-screen="home"] h1 img{height:40px;max-width:150px}body[data-screen="home"] .icon{width:38px;height:38px}
body[data-screen="home"] .hud{flex-direction:row;justify-content:space-between;margin:2px 0 6px;gap:8px;font-size:17px;height:32px}body[data-screen="home"] #level{min-width:94px;padding:2px 12px}body[data-screen="home"] .timer{font-size:23px;line-height:30px;padding-right:10px}body[data-screen="home"] .timer img{width:32px;height:32px}
body[data-screen="home"] #ad-top .ad{min-height:32px;padding:5px 8px;margin-bottom:6px;border-radius:10px}body[data-screen="home"] #ad-top .ad strong{font-size:16px}body[data-screen="home"] #ad-top .ad small{font-size:11px}
body[data-screen="home"] .preview-frame{padding:8px}body[data-screen="home"] .preview-frame canvas{width:var(--preview-size,240px);height:var(--preview-size,240px);max-width:100%;margin:auto}body[data-screen="home"] .preview-frame #art-name{font-size:16px;line-height:20px;margin-top:6px}
body[data-screen="home"] #home-progress{font-size:12px;line-height:16px;margin:8px 0 0}body[data-screen="home"] #start{min-height:48px;font-size:21px;margin:8px auto 6px;padding:6px 22px}body[data-screen="home"] .home-links{gap:12px;margin:6px 0}body[data-screen="home"] .home-links button{min-height:44px;padding:6px 14px}
body[data-screen="home"] .ad-row{gap:6px;margin:6px 0 4px}body[data-screen="home"] .ad-row .ad{padding:5px 7px;border-radius:9px;min-height:39px}body[data-screen="home"] .ad strong{font-size:12px}body[data-screen="home"] .ad small{font-size:10px}body[data-screen="home"] footer{font-size:10px;line-height:14px;margin-top:4px}

#panel[data-kind="victory"]{width:min(414px,calc(100vw - 12px));max-width:calc(100vw - 12px);max-height:calc(var(--app-height,100dvh) - 16px);border:0;background:transparent;box-shadow:none;overflow:auto;border-radius:0;scrollbar-width:none;--victory-art-size:218px}
#panel[data-kind="victory"] .panel-content{padding:112px 25px 30px;background:url("assets/victory-cloud-panel.d5fea775744b.png") center bottom/100% calc(100% - 54px) no-repeat;text-align:center;isolation:isolate}
#panel[data-kind="victory"] .victory-mascots{position:absolute;z-index:-1;top:0;left:4%;width:92%;height:128px;object-fit:contain;pointer-events:none}
#panel[data-kind="victory"] #panel-title{font-size:clamp(21px,6.1vw,26px);line-height:1.25;margin:0 12px 10px;color:#164274;font-weight:950;-webkit-text-stroke:4px #fff;paint-order:stroke fill;text-shadow:0 3px 0 #b7dcf8}
#panel[data-kind="victory"] #panel-body{line-height:1.35;font-size:14px}
#panel[data-kind="victory"] .victory-art-wrap{width:var(--victory-art-size);height:var(--victory-art-size);max-width:100%;margin:0 auto 7px;background:url("assets/victory-cloud-panel.d5fea775744b.png") center bottom/100% 24% no-repeat}
#panel[data-kind="victory"] #victory-art{display:block;width:100%;height:100%}
#panel[data-kind="victory"] .victory-art-name{font-size:clamp(18px,5.6vw,23px);line-height:1.25;margin:5px 0 7px;font-weight:900;color:#194777;overflow-wrap:anywhere}
#panel[data-kind="victory"] .victory-status{font-size:13px;line-height:18px;margin:0;color:#315d8c}
#panel[data-kind="victory"] #panel-actions{display:flex;flex-direction:column;align-items:center;gap:11px;margin-top:15px}
#panel[data-kind="victory"] #panel-actions button{min-height:44px;width:76%;max-width:260px;border:2px solid #f1fbff;border-radius:28px;color:#214e80;background:#d5edff;box-shadow:0 3px 0 #94bddd;font-size:18px;font-weight:850;padding:7px 12px;touch-action:manipulation}
#panel[data-kind="victory"] #panel-actions button.primary{width:92%;max-width:310px;min-height:49px;background:#ffe16b;border-color:#fff6bf;color:#194475;font-size:23px;box-shadow:0 4px 0 #e7ad34}
#panel[data-kind="victory"] .close{right:13px;top:84px;width:39px;height:39px;background:#dff2ff;color:#1d4c7d;border:3px solid #fff;font-size:30px;line-height:30px;box-shadow:0 0 0 3px #acd4f1;z-index:2}
@media(max-height:620px){#panel[data-kind="victory"] .panel-content{padding-top:93px;padding-bottom:22px}#panel[data-kind="victory"] .victory-mascots{height:109px}#panel[data-kind="victory"] .close{top:67px}#panel[data-kind="victory"] #panel-title{font-size:21px;margin-bottom:7px}#panel[data-kind="victory"] .victory-art-name{font-size:18px}#panel[data-kind="victory"] #panel-actions{gap:8px;margin-top:10px}}

#panel[data-kind="victory"]{--victory-art-size:168px}#panel[data-kind="victory"] .panel-content{background-size:104% calc(120% - 65px);background-position:center calc(100% + 34px)}

/* Follow the subject silhouette instead of framing it as a rectangular board. */
.board-wrap{border:0;border-radius:0;background:transparent;box-shadow:none;overflow:visible}#tray button{border-radius:50%}#tray button[data-color="-1"]{background:radial-gradient(circle at 65% 75%,#d5eaf4,#90b2c6);box-shadow:inset 1px 2px 4px #476a8a66,inset -1px -1px 1px #f5fcffb3}

#tray button[data-color="-1"]{border-radius:50%;background:none;box-shadow:none}

/* Stable touch geometry during consecutive selection / reserve / drop inputs. */
#board,#tray{touch-action:none}#tray button{height:32px}#tray button canvas{width:26px;height:26px;max-width:100%;margin:auto}#status{height:30px;min-height:30px;display:flex;align-items:center;justify-content:center;overflow:hidden}#tray-label{height:24px;min-height:24px;align-items:center}#cancel-selection{height:22px;min-height:0}

/* Neutral reference-style reserve, with rounded-square touch indicators. */
#tray{background:#f5f5f6;border-color:#fff;box-shadow:0 3px 0 #c4d2dd}#tray button,#tray button[data-color="-1"]{border-radius:9px}

/* Keep a finger-sized neutral gap between the sponsor and board hit areas. */
body[data-screen="battle"] #ad-top:not(:empty){padding-bottom:18px}
body[data-screen="home"] #ad-top:not(:empty){padding-bottom:10px}
@media(max-height:620px){
 body[data-screen="battle"] .hud{margin:0 0 2px}
 body[data-screen="battle"] .tools{margin:10px 0 3px}
 body[data-screen="battle"] .tools button{min-height:54px;padding:2px 1px 3px}
 body[data-screen="battle"] .ad-row{margin:2px 0 1px}
 body[data-screen="battle"] .ad-row .ad{min-height:37px}
 body[data-screen="battle"] footer{margin-top:0}
}

/* Camera controls; sponsors and game controls keep their own hit areas. */
body[data-screen="battle"] .board-wrap{overflow:visible;touch-action:none;isolation:auto}#board{touch-action:none;cursor:grab;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}#board[data-dragging="true"]{cursor:grabbing}.board-tools{display:flex;align-items:center;justify-content:space-between;gap:6px;min-height:32px;margin:4px 0 1px;color:#4d7196;font-size:10px;white-space:nowrap}.board-tools>div{display:flex;align-items:center;gap:4px}.board-tools button{height:30px;min-width:32px;padding:0 6px;border:1px solid #a4cbe3;border-radius:10px;background:#edf8ff;font-size:17px;line-height:28px;touch-action:manipulation}.board-tools #zoom-reset{font-size:10px;min-width:77px;font-weight:750}#tray button[data-selected="true"]{outline:none}#tray button[data-selected="true"] canvas{filter:drop-shadow(0 4px 1px #57434e80)}
@media(max-height:620px){.board-tools{min-height:26px;margin:2px 0 0}.board-tools button{height:26px;line-height:24px}}

#tray button[data-selected="true"]::before{content:"";position:absolute;left:calc(50% - 8px);top:calc(50% - 8px);width:16px;height:17px;background:var(--lift-shadow);border-radius:6px}#tray button canvas{position:relative}

/* The picture is one continuous viewport layer, including beyond its fit-to-view area. */
body[data-screen="battle"] .board-wrap{height:var(--board-size,280px);overflow:visible;isolation:auto;pointer-events:none;border-radius:0}body[data-screen="battle"] .board-wrap #board{display:block;position:fixed;inset:0;z-index:0;width:100vw;height:var(--app-height,100dvh);max-width:none;aspect-ratio:auto;pointer-events:auto}body[data-screen="battle"] :is(header,.hud,#ad-top,.board-tools,#status,#tray-label,#tray,.tools,#ad-bottom,footer){position:relative;z-index:2}body[data-screen="battle"] #pause-cover{position:fixed;z-index:3;inset:0;pointer-events:auto}body[data-screen="battle"] .board-tools>span,body[data-screen="battle"] #status,body[data-screen="battle"] #tray-label{color:#204776;text-shadow:0 1px 2px #fff,0 -1px 2px #fff,1px 0 2px #fff,-1px 0 2px #fff}body[data-screen="battle"] #transfers{z-index:1}
