*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;padding:0;width:100%;height:100%;overflow:hidden;overscroll-behavior:none}
body{font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","Noto Sans CJK SC",sans-serif;color:#3a2e22;
  background:#efe6d8;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-text-size-adjust:100%}
#app{position:fixed;top:0;left:0;right:0;bottom:0;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr) auto;grid-template-areas:"hud" "stage" "bar";overflow:hidden;font-size:var(--fs,14px);
  background:
    repeating-linear-gradient(90deg,rgba(120,90,60,.045) 0,rgba(120,90,60,.045) 2px,transparent 2px,transparent 9px),
    repeating-linear-gradient(90deg,rgba(255,255,255,.18) 0,rgba(255,255,255,.18) 1px,transparent 1px,transparent 23px),
    radial-gradient(ellipse at 50% 40%,#f7f1e8 0%,#eadfcd 70%,#e0d2bb 100%)}
#stage{grid-area:stage;position:relative;min-height:0;min-width:0;touch-action:none;overflow:hidden}
#cv{position:absolute;top:0;left:0;display:block;touch-action:none;-ms-touch-action:none;cursor:default}
#hud{grid-area:hud;display:flex;align-items:center;justify-content:space-between;padding:.45em .8em .2em;flex:0 0 auto;flex-wrap:nowrap;min-width:0}
.title{display:flex;align-items:baseline;white-space:nowrap}
.logo{font-weight:800;font-size:1.15em;letter-spacing:.06em;background:linear-gradient(90deg,#1e6fd9,#e2588f);-webkit-background-clip:text;background-clip:text;color:transparent}
.ver{font-size:.68em;padding:.05em .45em;border-radius:1em;background:#3a2e22;color:#fff;opacity:.75;font-weight:600}
.lv{display:flex;align-items:baseline;white-space:nowrap}
.lv b{font-size:1.05em}
.shape{font-size:.78em;padding:.1em .5em;border-radius:.8em;background:rgba(58,46,34,.1)}
.stats{display:flex;white-space:nowrap}
.stat{display:flex;flex-direction:column;align-items:center;line-height:1.1}
.stat i{font-style:normal;font-size:.68em;opacity:.65}
.stat b{font-size:1.05em;font-variant-numeric:tabular-nums}
#bar{grid-area:bar;display:flex;justify-content:center;padding:.3em .5em .55em;flex:0 0 auto}
.btn{flex:0 1 4.6em;min-width:0;height:3.3em;border:0;border-radius:.9em;background:linear-gradient(#fffaf2,#efe2cc);color:#3a2e22;
  box-shadow:0 .18em 0 #c8b28f,0 .3em .6em rgba(80,50,20,.18);display:flex;flex-direction:column;align-items:center;justify-content:center;
  font:inherit;cursor:pointer;padding:0;touch-action:manipulation}
.btn .ic{font-size:1.25em;line-height:1.1}
.btn .tx{font-size:.74em;margin-top:.1em}
.btn:active{transform:translateY(.12em);box-shadow:0 .06em 0 #c8b28f}
.btn:disabled{opacity:.4}
.btn.hint{background:linear-gradient(#fff4c7,#ffd46b);box-shadow:0 .18em 0 #d39b1f,0 .3em .6em rgba(160,100,0,.25)}
/* 横屏：侧栏 */
#app.land{grid-template-columns:minmax(0,1fr) var(--side,170px);grid-template-rows:minmax(0,1fr) auto auto minmax(0,1fr);grid-template-areas:"stage ." "stage hud" "stage bar" "stage ."}
.land #hud{flex-direction:column;align-items:stretch;padding:0 .7em .8em 0}
.land #bar{padding:0 .7em 0 0}
.land .title,.land .lv{justify-content:center}
.land .stats{justify-content:space-around}
.land #bar{flex-wrap:wrap;justify-content:space-between}
.land .btn{flex:0 0 48%;height:3.1em;margin:0 0 .5em 0!important}
/* 浮层（不用 inset，兼容旧 iOS） */
.ov{position:absolute;top:0;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center;background:rgba(40,28,16,.45);z-index:10;padding:.8em}
.hidden{display:none!important}
.card{background:#fffaf2;border-radius:1.1em;box-shadow:0 1em 3em rgba(0,0,0,.35);padding:1em 1.2em;max-width:30em;width:100%;max-height:100%;overflow:auto;-webkit-overflow-scrolling:touch}
.card h2{margin:.1em 0 .5em;font-size:1.25em}
.rules{margin:0;padding-left:1.3em;line-height:1.55;font-size:.95em}
.rules li{margin:.25em 0}
.row{display:flex;justify-content:center;margin-top:.9em}
.big{border:0;border-radius:2em;padding:.65em 1.5em;font:inherit;font-weight:700;color:#fff;background:linear-gradient(#3d93f5,#1d6bd6);box-shadow:0 .2em 0 #134f9e;cursor:pointer}
.big.ghost{background:linear-gradient(#fff,#efe3cf);color:#3a2e22;box-shadow:0 .2em 0 #c8b28f}
.big:active{transform:translateY(.1em)}
.win{text-align:center;max-width:22em}
.winTitle{font-size:1.5em;font-weight:800;color:#1d6bd6}
.stars{font-size:2.6em;letter-spacing:.12em;margin:.15em 0;color:#d8cbb4}
.stars span{display:inline-block;transform:scale(.4);opacity:0;transition:transform .35s cubic-bezier(.3,1.8,.5,1),opacity .2s}
.stars span.on{color:#ffb820;text-shadow:0 .05em 0 #c47d00}
.stars span.show{transform:scale(1);opacity:1}
.winInfo{font-size:.95em;opacity:.8}
.levels{max-width:34em;display:flex;flex-direction:column}
.lvHead{display:flex;align-items:center;margin-bottom:.5em}
.lvHead h2{margin:0;flex:1}
.tot{color:#c47d00;font-weight:700}
.x{border:0;background:rgba(0,0,0,.08);width:2em;height:2em;border-radius:1em;font-size:1.2em;cursor:pointer;color:#3a2e22}
.lvGrid{display:grid;grid-template-columns:repeat(6,1fr);grid-gap:.45em;gap:.45em;overflow:auto;-webkit-overflow-scrolling:touch;min-height:0}
.lvBtn{border:0;border-radius:.7em;padding:.35em 0 .25em;font:inherit;background:linear-gradient(#fff,#f0e4d0);box-shadow:0 .15em 0 #c8b28f;cursor:pointer;color:#3a2e22;display:flex;flex-direction:column;align-items:center}
.lvBtn b{font-size:1.05em}
.lvBtn small{font-size:.62em;color:#d8cbb4;letter-spacing:.05em}
.lvBtn small .on{color:#ffb820}
.lvBtn.cur{outline:.15em solid #1d6bd6}
.lvBtn.locked{opacity:.45;cursor:not-allowed}
.toast{position:absolute;left:50%;top:18%;transform:translateX(-50%);background:rgba(40,28,16,.82);color:#fff;padding:.5em 1em;border-radius:2em;font-size:.9em;z-index:20;pointer-events:none;white-space:nowrap}
#fx{position:absolute;top:0;left:0;pointer-events:none;z-index:30}
#hud>*+*{margin-left:.6em}.title>*+*{margin-left:.35em}.lv>*+*{margin-left:.4em}.stats>*+*{margin-left:.7em}
#bar>.btn+.btn{margin-left:.4em}.row>*+*{margin-left:.7em}.lvHead>*+*{margin-left:.6em}
.land #hud>*+*{margin-left:0;margin-top:.55em}.land .stats>*+*{margin-left:0}
