/* 涂鸦风主题：牛皮纸底色 + 手绘线条感 + 不规则边框 */
:root{
  --paper: #f5efdc;
  --ink: #2b2b2b;
  --accent: #e0654f;
  --green: #6fae5e;
  --line: #3a3a3a;
}
*{ box-sizing: border-box; }
html,body{ margin:0; height:100%; }
body{
  font-family:"ZCOOL KuaiLe","Patrick Hand",cursive,"PingFang SC",sans-serif;
  background:var(--paper);
  color:var(--ink);
  /* 笔记本网格质感 */
  background-image:
    linear-gradient(rgba(0,0,0,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,.04) 1px, transparent 1px);
  background-size: 28px 28px;
  display:flex; align-items:center; justify-content:center;
  overflow:hidden;
}
#app{ width:min(880px,96vw); }
.screen{ display:flex; flex-direction:column; align-items:center; gap:18px; padding:24px; }
.hidden{ display:none !important; }

.title{
  font-size:54px; margin:8px 0 0; letter-spacing:2px;
  text-shadow:2px 2px 0 rgba(0,0,0,.12);
  transform:rotate(-1.2deg);
}
.title.sm{ font-size:38px; }
.subtitle{ margin:-6px 0 4px; opacity:.6; }

/* 手绘按钮：不规则描边 + 偏移阴影 */
.doodle-btn{
  font-family:inherit; font-size:20px; cursor:pointer;
  padding:10px 22px; color:var(--ink);
  background:#fff; border:3px solid var(--line);
  border-radius:14px 10px 16px 9px;
  box-shadow:3px 4px 0 rgba(0,0,0,.18);
  transition:transform .08s, box-shadow .08s;
}
.doodle-btn:hover{ transform:translate(-1px,-1px); box-shadow:4px 5px 0 rgba(0,0,0,.2); }
.doodle-btn:active{ transform:translate(2px,3px); box-shadow:1px 1px 0 rgba(0,0,0,.2); }
.doodle-btn.ghost{ background:transparent; }
.doodle-btn.primary{ background:var(--green); color:#fff; }

/* 关卡卡片 */
.level-list{ display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:14px; width:100%; }
.level-card{
  border:3px solid var(--line); border-radius:16px 12px 18px 10px;
  padding:14px; background:#fff; cursor:pointer; position:relative;
  box-shadow:3px 4px 0 rgba(0,0,0,.15);
  background-image:repeating-linear-gradient(45deg, rgba(0,0,0,.02) 0 6px, transparent 6px 12px);
}
.level-card:hover{ transform:translate(-1px,-2px); }
.level-card.selected{ outline:3px dashed var(--green); }
.level-card.locked{ opacity:.55; cursor:not-allowed; filter:grayscale(.4); }
.level-card .num{ font-size:14px; opacity:.5; }
.level-card .name{ font-size:22px; margin:4px 0; }
.level-card .desc{ font-size:14px; opacity:.7; }
.level-card .lock{ position:absolute; top:8px; right:10px; font-size:18px; }

.menu-actions{ display:flex; gap:14px; }

/* 战斗画布 */
.battle-wrap{ position:relative; }
#game{
  width:min(800px,94vw); height:auto; display:block;
  background:#fbf7ea; border:4px solid var(--line);
  border-radius:10px; box-shadow:4px 6px 0 rgba(0,0,0,.18);
}
.battle-hint{ text-align:center; opacity:.5; margin-top:8px; }

/* 升级界面 */
.coins{ font-size:22px; }
.upgrade-list{ display:flex; flex-direction:column; gap:12px; width:100%; max-width:480px; }
.upg-row{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  border:3px solid var(--line); border-radius:14px 10px 16px 9px;
  padding:12px 16px; background:#fff;
}
.upg-row .info .u-name{ font-size:20px; }
.upg-row .info .u-desc{ font-size:13px; opacity:.6; }
.upg-row .lv{ font-size:13px; opacity:.7; }

/* 结算弹层 */
.overlay{
  position:fixed; inset:0; background:rgba(0,0,0,.35);
  display:flex; align-items:center; justify-content:center; z-index:9;
}
.result-card{
  background:var(--paper); border:4px solid var(--line);
  border-radius:18px 14px 20px 12px; padding:28px 34px; text-align:center;
  box-shadow:5px 7px 0 rgba(0,0,0,.25); min-width:280px;
}
.result-card h2{ font-size:34px; margin:0 0 8px; }
.result-card p{ font-size:18px; margin:0 0 18px; opacity:.8; }

/* ---------- 移动端触屏控件（摇杆 + 换弹/跳/开火 按钮，对齐参考截图） ---------- */
.battle-wrap canvas{ max-width:100%; touch-action:none;
  user-select:none; -webkit-user-select:none; -webkit-touch-callout:none; }   /* 防安卓长按弹菜单/放大镜 */
#joy-zone{ position:absolute; left:0; top:0; bottom:0; width:45%; z-index:5; touch-action:none; }
#joy-zone.off{ pointer-events:none; }
#joy-base{ position:absolute; width:124px; height:124px; margin:-62px 0 0 -62px; border:3px solid rgba(60,50,40,.55); border-radius:50%; background:rgba(255,255,255,.14); }
#joy-knob{ position:absolute; left:50%; top:50%; width:56px; height:56px; margin:-28px 0 0 -28px; border:3px solid rgba(60,50,40,.7); border-radius:50%; background:rgba(240,236,224,.7); }
.touch-btn{ position:absolute; z-index:6; width:74px; height:74px; border-radius:50%; border:3px solid rgba(60,50,40,.7); background:rgba(250,247,238,.55); color:#3c3228; font-family:"ZCOOL KuaiLe","PingFang SC",sans-serif; font-size:18px; touch-action:none; user-select:none; -webkit-user-select:none; -webkit-tap-highlight-color:transparent; cursor:pointer; }
.touch-btn:active{ background:rgba(240,236,224,.85); }
#btn-fire{ right:5%; bottom:14%; width:92px; height:92px; font-size:22px; }
#btn-jump{ right:24%; bottom:40%; }
#btn-reload{ right:6%; top:12%; }
#btn-weapon{ right:6%; top:24%; }
#btn-aim{ right:6%; top:36%; background:rgba(120,200,180,.55); }

/* 竖屏提示遮罩（仅在窄屏竖屏出现） */
.rotate-tip{ display:none; position:fixed; inset:0; z-index:9999; background:var(--paper);
  flex-direction:column; align-items:center; justify-content:center; text-align:center; padding:24px; }
.rotate-tip svg{ width:96px; height:96px; margin-bottom:18px; animation:rt-rot 1.8s ease-in-out infinite; }
@keyframes rt-rot{ 0%,45%{ transform:rotate(0); } 55%,100%{ transform:rotate(90deg); } }
.rotate-tip .rt-title{ font-size:30px; margin:0 0 8px; }
.rotate-tip .rt-sub{ font-size:17px; opacity:.6; margin:0; }

/* 窄屏竖屏：仅在「战斗中」才挡住画面强制横屏；菜单/升级界面仍可正常竖屏浏览 */
@media (max-width: 860px) and (orientation: portrait){
  body.in-battle .rotate-tip{ display:flex; }
  body.in-battle #app{ display:none !important; }
}
.rotate-tip .doodle-btn{ margin-top:20px; }
/* 用户点了「仍要竖屏游玩」：永久放开封锁（上面那条带 !important，故这里也要 !important 抵消） */
body.no-rotate-tip .rotate-tip{ display:none !important; }
body.no-rotate-tip #app{ display:block !important; }

/* 窄屏横屏：画布铺满整个视口，控件叠在上层 */
@media (max-width: 960px) and (orientation: landscape){
  html,body{ height:100%; overflow:hidden; }
  #app{ width:100vw; height:100vh; height:100dvh; }
  #screen-battle{ padding:0; gap:0; }
  /* 用 dvh：安卓地址栏收放时 100vh 会超出可视区，导致画面底部被截 */
  .battle-wrap{ width:100vw; height:100vh; height:100dvh; display:flex; align-items:center; justify-content:center; }
  #game{ width:auto; height:100vh; height:100dvh; max-width:100vw; border-width:0; border-radius:0; box-shadow:none; }
  .battle-hint{ display:none; }
  #joy-zone{ width:42%; }
}
