* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #14304a; color: #f2f8ff; font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; touch-action: none; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
#stage { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; height: 100dvh; overflow: hidden; transform-origin: 0 0; --u: 1px; }
#gl { position: absolute; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ---------- HUD ---------- */
#hud { position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; }
#hud button { pointer-events: auto; }
#hud-tl { position: absolute; left: 10px; left: max(10px, env(safe-area-inset-left)); top: 12px; display: flex; flex-direction: column; gap: 5px; padding: 6px 10px; border-radius: 10px; background: rgba(10, 28, 46, .55); }
#hpbox { display: flex; align-items: center; gap: 6px; font-size: 12px; text-shadow: 0 1px 2px #000; }
#hpbox .hpbar { width: 130px; height: 11px; background: rgba(0, 0, 0, .55); border: 1px solid rgba(255, 255, 255, .4); border-radius: 6px; overflow: hidden; }
#hp-fill { display: block; height: 100%; width: 100%; background: linear-gradient(#7ae0ff, #2a8ae8); transition: width .1s; }
#hpbox.low #hp-fill { background: linear-gradient(#ff8a6a, #e0301a); animation: pulse .5s infinite alternate; }
#stat { font-size: 14px; text-shadow: 0 1px 2px #000; white-space: nowrap; }
#stat b { color: #ffd860; font-size: 17px; }
#stat small { font-size: 11px; opacity: .75; }
#hud-tc { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 3px; text-shadow: 0 2px 4px #000; }
#timer { font-size: 26px; font-weight: 900; letter-spacing: 2px; line-height: 1.1; font-variant-numeric: tabular-nums; }
#timer.low { color: #ff7a5a; animation: pulse .5s infinite alternate; }
#progbox { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; }
#progbox .track { width: min(300px, 32vw); height: 12px; background: rgba(0, 0, 0, .55); border: 1px solid rgba(255, 255, 255, .5); border-radius: 6px; overflow: hidden; }
#prog-fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ffb030, #ffe060); }
#progbox.chew .track { border-color: #ff5a4a; box-shadow: 0 0 8px #ff3a2a; }
#chew-warn { font-size: 13px; font-weight: 800; color: #ff7a6a; animation: pulse .4s infinite alternate; }
#bossbar { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #e090ff; font-weight: 800; }
#bossbar .track { width: min(280px, 30vw); height: 11px; background: rgba(0, 0, 0, .6); border: 1px solid #c060ff; border-radius: 6px; overflow: hidden; }
#boss-fill { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #6a1aa8, #d060ff); }
#hud-tr { position: absolute; right: 10px; right: max(10px, env(safe-area-inset-right)); top: 12px; display: flex; gap: 8px; }
#hud-tr button { min-height: 38px; padding: 4px 10px; font-size: 14px; background: rgba(10, 28, 46, .8); border: 1px solid rgba(140, 200, 255, .6); border-radius: 8px; }
#demo-tag { position: absolute; left: 10px; left: max(10px, env(safe-area-inset-left)); top: 78px; padding: 2px 10px; border-radius: 10px; background: rgba(0, 0, 0, .5); color: #9fe8a0; font-size: 12px; }
#cross { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border: 2px solid rgba(255, 255, 255, .8); border-radius: 50%; box-shadow: 0 0 2px #000; }
#vignette { position: absolute; top: 0; right: 0; bottom: 0; left: 0; box-shadow: inset 0 0 90px 30px rgba(220, 40, 20, .65); opacity: 0; }
#vignette.on { animation: hurt .45s ease-out; }
@keyframes hurt { 0% { opacity: 1; } 100% { opacity: 0; } }
@keyframes pulse { from { filter: brightness(1); } to { filter: brightness(1.5); } }
#banner { position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%); font-size: 38px; font-weight: 900; color: #ffe060; text-shadow: 0 3px 0 #1a4a7a, 0 6px 14px #000; white-space: nowrap; animation: ban 2s ease-out; }
@keyframes ban { 0% { opacity: 0; transform: translate(-50%, -50%) scale(1.4); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
#toast { position: absolute; left: 50%; bottom: 84px; transform: translateX(-50%); max-width: min(620px, 52%); padding: 6px 14px; background: rgba(10, 28, 46, .9); border-radius: 10px; font-size: 14px; line-height: 1.5; text-align: center; }
#keys-hint { position: absolute; left: 10px; left: max(10px, env(safe-area-inset-left)); bottom: 10px; font-size: 12px; color: rgba(255, 255, 255, .85); text-shadow: 0 1px 2px #000; line-height: 1.5; padding: 4px 8px; border-radius: 8px; background: rgba(10, 28, 46, .4); }

/* 动作按钮：电脑上是右下角一排带键位的方块，手机上是右下角一圈圆按钮 */
#acts { position: absolute; right: 14px; right: max(14px, env(safe-area-inset-right)); bottom: 14px; display: flex; gap: 8px; }
.act { position: relative; min-width: 84px; height: 60px; padding: 4px 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: 10px; border: 2px solid rgba(160, 210, 255, .8); background: rgba(10, 28, 46, .78); color: #fff; text-shadow: 0 1px 2px #000; }
.act b { font-size: 16px; line-height: 1.1; }
.act small { font-size: 11px; color: #ffd860; line-height: 1.2; }
.act.down { background: rgba(120, 190, 255, .45); }
.act.dim { opacity: .55; }
#b-flood { background: linear-gradient(0deg, rgba(255, 200, 60, .55) var(--m, 0%), rgba(10, 28, 46, .78) 0); }
#b-flood.ready { border-color: #ffe060; box-shadow: 0 0 14px #ffc020; animation: pulse .45s infinite alternate; }
#b-rally.on { background: rgba(255, 200, 60, .6); border-color: #ffe060; }
#b-tail { background: linear-gradient(0deg, rgba(255, 255, 255, .25) var(--cd, 100%), rgba(10, 28, 46, .78) 0); }
.kb { position: absolute; right: 4px; top: 3px; font-size: 10px; line-height: 14px; padding: 0 4px; border-radius: 4px; background: #000; color: #ffd860; font-style: normal; }

#touch { display: none; }
body.touch-mode #touch { display: block; }
#joy { position: absolute; left: 40px; top: 200px; width: calc(132 * var(--u)); height: calc(132 * var(--u)); border-radius: 50%; border: 2px solid rgba(255, 255, 255, .6); background: rgba(0, 0, 0, .12); pointer-events: none; opacity: .75; }
#joy.on { opacity: 1; }
#joy-knob { position: absolute; left: 50%; top: 50%; width: calc(56 * var(--u)); height: calc(56 * var(--u)); margin: calc(-28 * var(--u)) 0 0 calc(-28 * var(--u)); border-radius: 50%; background: rgba(255, 255, 255, .45); border: 2px solid #fff; pointer-events: none; }
body.touch-mode #acts { position: absolute; top: 0; right: 0; bottom: 0; left: 0; right: 0; bottom: 0; display: block; pointer-events: none; }
body.touch-mode .act { position: absolute; min-width: 0; padding: 0; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .92); box-shadow: 0 0 0 1px rgba(0, 0, 0, .45); pointer-events: auto; }
body.touch-mode .act b { font-size: calc(16 * var(--u)); }
body.touch-mode .act small { font-size: calc(10 * var(--u)); }
body.touch-mode #b-tail { right: calc(30 * var(--u)); bottom: calc(34 * var(--u)); width: calc(92 * var(--u)); height: calc(92 * var(--u)); border-width: 4px; }
body.touch-mode #b-tail b { font-size: calc(20 * var(--u)); }
body.touch-mode #b-summon { right: calc(136 * var(--u)); bottom: calc(30 * var(--u)); width: calc(70 * var(--u)); height: calc(70 * var(--u)); }
body.touch-mode #b-flood { right: calc(36 * var(--u)); bottom: calc(140 * var(--u)); width: calc(70 * var(--u)); height: calc(70 * var(--u)); }
body.touch-mode #b-rally { right: calc(132 * var(--u)); bottom: calc(112 * var(--u)); width: calc(62 * var(--u)); height: calc(62 * var(--u)); }
body.touch-mode #keys-hint { display: none; }
body.touch-mode .kb { display: none; }
body.touch-mode #toast { bottom: 12px; font-size: 13px; max-width: 44%; }
body.touch-mode #banner { font-size: 28px; }
body.touch-mode #hud-tr button { min-height: 36px; padding: 4px 8px; font-size: 13px; }

/* ---------- 菜单与面板 ---------- */
.overlay { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: flex; align-items: flex-start; justify-content: center; padding: 12px; overflow-y: auto; }
#menu { background: linear-gradient(90deg, rgba(10, 30, 50, .88) 0%, rgba(10, 30, 50, .5) 50%, rgba(10, 30, 50, 0)); justify-content: flex-start; padding-left: max(5vw, 16px); }
.overlay.dim { background: rgba(6, 18, 30, .66); z-index: 6; }
.menu-box { width: min(400px, 94%); margin: auto 0; }
#panel .menu-box { width: min(620px, 96%); margin: auto; padding: 16px 18px; background: rgba(16, 40, 64, .97); border: 2px solid #4a9ae0; border-radius: 12px; text-align: center; }
h1 { font-size: 48px; line-height: 1.1; margin: 4px 0; color: #ffd860; letter-spacing: 4px; text-shadow: 0 3px 0 #1a5a9a, 0 6px 16px #000; }
h1 small { display: block; font-size: 18px; letter-spacing: 8px; color: #bfe4ff; text-shadow: 0 2px 6px #000; }
h2 { font-size: 24px; margin-bottom: 8px; color: #ffd860; }
.sub { color: #e4f2ff; font-size: 15px; line-height: 1.5; text-shadow: 0 1px 3px #000; }
.best { margin: 6px 0 8px; color: #bfe0ff; font-size: 13px; min-height: 18px; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; justify-content: center; }
.btns.col { flex-direction: column; align-items: stretch; }
.row2 { display: flex; gap: 8px; }
.row2 button { flex: 1; }
.btns button { min-width: 100px; min-height: 44px; padding: 8px 16px; font-size: 16px; background: rgba(18, 46, 72, .94); border: 1px solid #5aa0e0; border-radius: 8px; }
.btns button small { display: block; font-size: 12px; font-weight: 400; opacity: .85; margin-top: 2px; }
.btns button.primary { background: linear-gradient(#ffb030, #e07a10); border-color: #ffe080; font-weight: 800; font-size: 18px; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.btns button:disabled { opacity: .45; cursor: default; }
.btns button:hover:not(:disabled), .btns button:focus-visible { border-color: #ffe060; outline: none; box-shadow: 0 0 0 2px rgba(255, 224, 96, .45); }
.menu-promo { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.fd-promo-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 6px 14px; border-radius: 18px; border: 0; font-size: 14px; font-weight: 700; text-decoration: none; }
.fd-follow { background: #fb7299; color: #fff; }
.fd-share { background: #00aeec; color: #fff; }
.fd-more { background: #f0a020; color: #fff; }
.foot { margin-top: 10px; font-size: 12px; color: #a8c8e8; }
.hint { margin-top: 6px; font-size: 13px; color: #c4dcf0; line-height: 1.5; }
.set { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0; font-size: 15px; text-align: left; }
.seg { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.seg button, button.small { padding: 6px 12px; min-height: 36px; border: 1px solid #5aa0e0; border-radius: 6px; background: rgba(18, 46, 72, .94); font-size: 14px; }
.seg button.on { background: #e08a18; border-color: #ffe080; }
.set input[type=range] { width: 150px; }
.help { text-align: left; font-size: 14px; line-height: 1.6; }
.help h3 { margin: 10px 0 2px; color: #ffd860; font-size: 16px; }
.levels { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.lv { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; border: 2px solid #3a7ab8; background: rgba(20, 50, 80, .95); font-size: 13px; line-height: 1.45; text-align: left; }
.lv:hover:not(:disabled), .lv:focus-visible { border-color: #ffe060; outline: none; }
.lv .ln { font-size: 18px; color: #fff; }
.lv .ls { font-size: 18px; color: #ffd040; letter-spacing: 2px; }
.lv .lt { color: #d4e8fa; }
.lv .lm { color: #9fc8ec; font-size: 12px; }
.lv .lock { color: #ffb08a; }
.lv.on { border-color: #ffe060; }
.lv:disabled { opacity: .55; cursor: default; }
.stars { font-size: 44px; color: #ffd040; letter-spacing: 6px; text-shadow: 0 2px 8px rgba(0, 0, 0, .6); line-height: 1.2; }
.conds { list-style: none; font-size: 14px; line-height: 1.8; }
.conds b { color: #ffd860; }
.big { font-size: 28px; font-weight: 900; color: #ffe060; margin: 4px 0; }
.newrec { font-size: 16px; color: #ff9a5a; }
.reward { margin: 6px 0; font-size: 17px; font-weight: 700; color: #a8f08a; }

#loading { position: absolute; top: 0; right: 0; bottom: 0; left: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: #14304a; z-index: 9; }
.ld-title { font-size: 42px; font-weight: 900; color: #ffd860; letter-spacing: 6px; }
#ld-text { color: #bfe0ff; }
#ld-retry { padding: 8px 18px; border-radius: 6px; border: 1px solid #ffd060; background: #1e5a8a; }
@media (max-height: 430px) {
  h1 { font-size: 34px; } h1 small { font-size: 15px; }
  .sub { font-size: 13px; } .btns { gap: 6px; margin-top: 6px; } .btns button { min-height: 40px; padding: 6px 12px; font-size: 15px; }
  .btns button.primary { font-size: 16px; } .menu-promo { margin-top: 8px; } .foot { display: none; }
  #panel .menu-box { padding: 10px 14px; } .stars { font-size: 34px; }
  #timer { font-size: 22px; }
}
/* 抓鱼模式入口 */
.btns button.catch-btn { background: linear-gradient(#2a9ad8, #1a68a8); border-color: #9ae0ff; font-weight: 800; font-size: 17px; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.lv.lv-catch { border-color: #6ad0ff; background: rgba(16, 70, 110, .95); }
.lv.lv-endless { border-color: #c060ff; background: rgba(60, 24, 92, .95); }
.lv .new { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 4px; background: #ff5a3a; color: #fff; font-size: 11px; vertical-align: middle; }
