*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{height:100%}
body{
  margin:0;padding:8px;
  background:radial-gradient(circle at 50% 0%,#1e3326,#0e1712 70%);
  color:#e8f2e6;
  font-family:-apple-system,BlinkMacSystemFont,"PingFang SC","Microsoft YaHei",sans-serif;
  display:flex;align-items:center;justify-content:center;
  user-select:none;-webkit-user-select:none;overscroll-behavior:none;
  overflow:hidden;
}
#app{
  width:100%;max-width:1120px;height:100%;
  display:flex;flex-direction:column;gap:6px;
}

#topbar{display:flex;gap:8px;align-items:stretch;flex:0 0 auto}

#sunbox{
  flex:0 0 auto;display:flex;align-items:center;gap:4px;
  padding:6px 10px;border-radius:12px;
  background:linear-gradient(#3b2f14,#241d0c);
  border:2px solid #a8862f;
  font-weight:700;font-size:17px;color:#ffd75e;
  min-width:78px;justify-content:center;
}
#sunbox .ic{font-size:16px;filter:drop-shadow(0 0 6px #ffd75e88)}

#cards{display:flex;gap:6px;flex:1 1 auto;overflow-x:auto;padding-bottom:2px;scrollbar-width:none}
#cards::-webkit-scrollbar{display:none}

.card{
  position:relative;flex:0 0 auto;width:62px;
  padding:4px 2px 3px;border-radius:10px;overflow:hidden;
  background:linear-gradient(#33502f,#1f2f1d);
  border:2px solid #4d7a45;color:#dff0d8;
  font:inherit;line-height:1.1;cursor:pointer;
  display:flex;flex-direction:column;align-items:center;gap:1px;
  transition:transform .08s ease,border-color .1s ease;
}
.card:active{transform:scale(.95)}
.card .ico{font-size:18px;line-height:1.1}
.card .nm{font-size:10px;opacity:.9;white-space:nowrap}
.card .cost{font-size:11px;color:#ffd75e;font-weight:700}
.card .cdmask{
  position:absolute;left:0;bottom:0;width:100%;height:0;
  background:rgba(4,10,6,.68);pointer-events:none;
  transition:height .1s linear;
}
.card.sel{border-color:#ffe066;box-shadow:0 0 0 2px #ffe06666,0 0 14px #ffe06655}
.card.off{filter:grayscale(.75) brightness(.62)}
#shovel,#speed,#fs{
  flex:0 0 auto;width:52px;border-radius:10px;
  background:linear-gradient(#3a3326,#25201a);
  border:2px solid #6b5a3a;color:#e8dcc0;
  font-size:21px;line-height:1;cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  transition:.15s;
}
#shovel.sel,#speed.act{
  border-color:#ffe066;
  box-shadow:0 0 0 2px #ffe06666,0 0 14px #ffe06655;
  background:linear-gradient(#5c4a20,#3a2f16);
}
#speed{font-size:15px;font-weight:700;letter-spacing:-.5px}
#fs{font-size:19px}
#fs.sel{border-color:#ffe066}
.card.no{animation:no .3s ease}
@keyframes no{0%,100%{transform:translateX(0)}25%{transform:translateX(-4px)}75%{transform:translateX(4px)}}

#stage{
  flex:1 1 auto;min-height:0;
  display:flex;align-items:center;justify-content:center;
  border-radius:14px;overflow:hidden;
  box-shadow:0 10px 30px rgba(0,0,0,.45),0 0 0 2px #2d4a2e inset;
  background:#243b25;
}
canvas{
  display:block;max-width:100%;max-height:100%;
  width:auto;height:auto;touch-action:none;border-radius:10px;
}

#hint{
  display:flex;gap:12px;align-items:center;flex:0 0 auto;
  font-size:12px;color:#9fb79b;flex-wrap:wrap;
}
#hint .tip{margin-left:auto;opacity:.7}
#kills,#wave{font-weight:700;color:#cfe3c9}

#rot{display:none}

/* 浏览器不支持强制横屏时，把整个界面在屏幕里转过来 */
body.ls #app{
  position:fixed;top:50%;left:50%;
  width:100vh;height:100vw;max-width:none;
  transform:translate(-50%,-50%) rotate(90deg);
  transform-origin:center center;
}
body.ls #rot{display:none}
body.ls{overscroll-behavior:none}

#overlay{
  position:fixed;inset:0;display:flex;align-items:center;justify-content:center;
  background:rgba(6,12,8,.78);backdrop-filter:blur(3px);z-index:10;padding:16px;
}
#overlay.hidden{display:none}
#overlay .panel{
  width:100%;max-width:340px;text-align:center;
  background:linear-gradient(#2b4430,#182618);
  border:2px solid #4d7a45;border-radius:18px;padding:22px 18px;
  box-shadow:0 18px 50px rgba(0,0,0,.6);
}
#overlay h1{font-size:19px;margin:0 0 10px;color:#ffb4a8}
#overlay p{margin:0 0 18px;font-size:13px;color:#b7ccb2;line-height:1.7}
#again{
  padding:11px 26px;border-radius:12px;border:none;cursor:pointer;
  background:linear-gradient(#5cb84a,#3e8a31);color:#fff;
  font:inherit;font-weight:700;font-size:15px;
  box-shadow:0 6px 0 #2a5f22;
}
#again:active{transform:translateY(3px);box-shadow:0 3px 0 #2a5f22}

/* 竖着拿手机时提示转过来 */
@media (orientation:portrait){
  #rot{
    display:block;flex:0 0 auto;text-align:center;width:100%;
    font:inherit;font-size:12px;color:#ffd75e;cursor:pointer;
    background:rgba(255,215,94,.12);
    border:1px dashed rgba(255,215,94,.45);
    border-radius:10px;padding:6px 8px;
  }
}

@media (max-width:480px){
  body{padding:6px}
  .card{width:52px}
  .card .ico{font-size:15px}
  .card .nm{font-size:9px}
  .card .cost{font-size:10px}
  #sunbox{font-size:15px;min-width:64px;padding:5px 8px}
  #hint{font-size:11px;gap:8px}
  #hint .tip{margin-left:0;flex:1 1 100%}
}

#stage{position:relative}
#pause{font-size:17px}
#pauseMask{
  position:absolute;inset:0;z-index:6;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;
  background:rgba(8,20,10,.6);color:#eaf5e4;
  font-size:22px;font-weight:800;letter-spacing:2px;cursor:pointer;
}
#pauseMask span{font-size:12px;font-weight:400;opacity:.75;letter-spacing:0}
#pauseMask.hidden{display:none}
