:root {
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --pill: rgba(22, 26, 56, 0.66);
  --ink: #1d2340;
  --green: #3ccf5a;
  --green-d: #23963a;
  --yellow: #ffcf33;
  --yellow-d: #d79b00;
  --purple: #7b4dff;
  --red: #ff4d4d;
  --font: "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden;
  background: #9fe2f7; font-family: var(--font); color: #fff;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  overscroll-behavior: none;
}
#app { position: fixed; inset: 0; }
#c { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#touch { position: absolute; inset: 0; z-index: 1; touch-action: none; }
#labels { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
#hud { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
#hud button, #hud .clickable { pointer-events: auto; }
.hidden { display: none !important; }

/* ---------- 摇杆 ---------- */
#joy {
  position: absolute; left: 0; top: 0; width: 120px; height: 120px; z-index: 4; pointer-events: none;
  border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,0.18) 0 55%, rgba(255,255,255,0.08) 56%);
  border: 3px solid rgba(255,255,255,0.55); opacity: 0; transition: opacity .15s;
}
#knob {
  position: absolute; left: 34px; top: 34px; width: 46px; height: 46px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffff, #c8f7ff 60%, #8de0f0);
  box-shadow: 0 3px 8px rgba(0,0,0,0.3);
}

/* ---------- 顶部 ---------- */
#lvl {
  position: absolute; top: calc(var(--sat) + 10px); left: calc(var(--sal) + 10px);
  display: flex; align-items: center; gap: 0;
}
.badge {
  position: relative; z-index: 1; width: 50px; height: 50px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #b394ff, #6a3df0 70%);
  border: 3px solid #fff; box-shadow: 0 3px 0 rgba(0,0,0,0.25);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
}
.badge small { font-size: 10px; font-weight: 800; opacity: .9; }
.badge span { font-size: 20px; font-weight: 900; }
.xpbar {
  position: relative; margin-left: -12px; width: 150px; height: 22px; border-radius: 0 12px 12px 0;
  background: var(--pill); overflow: hidden; border: 2px solid rgba(255,255,255,0.85); border-left: none;
}
.xpbar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, #7cf06a, #c3fa5a); transition: width .3s; }
.xpbar span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; text-shadow: 0 1px 2px rgba(0,0,0,.6); padding-left: 10px; }

#res {
  position: absolute; top: calc(var(--sat) + 12px); left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px; flex-wrap: nowrap;
}
.pill {
  display: flex; align-items: center; gap: 5px; padding: 4px 11px 4px 6px; border-radius: 999px;
  background: var(--pill); font-weight: 900; font-size: 15px; min-width: 62px;
  box-shadow: 0 2px 0 rgba(0,0,0,0.2); transition: transform .12s;
}
.pill svg { width: 22px; height: 22px; flex: none; }
.pill.bump { transform: scale(1.15); }
.pill.coin { background: rgba(120, 72, 0, 0.66); }

.icon-btn {
  position: absolute; top: calc(var(--sat) + 10px); right: calc(var(--sar) + 10px);
  width: 42px; height: 42px; border-radius: 12px; border: none; background: var(--pill);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 3px 0 rgba(0,0,0,0.25);
}

/* ---------- 任务 ---------- */
#quest {
  position: absolute; top: calc(var(--sat) + 70px); left: calc(var(--sal) + 10px); width: 250px;
  background: rgba(255,255,255,0.93); color: var(--ink); border-radius: 14px; padding: 8px 12px 10px;
  box-shadow: 0 4px 0 rgba(0,0,0,0.15); border-left: 6px solid var(--yellow);
  transition: transform .25s, opacity .25s;
}
#quest.done { transform: scale(1.06); border-left-color: var(--green); }
.qhead { display: flex; justify-content: space-between; font-size: 11px; font-weight: 800; color: #7a7f99; letter-spacing: .5px; }
#qReward { color: #c98a00; display: flex; align-items: center; gap: 2px; }
#qReward svg { width: 14px; height: 14px; }
#qText { font-size: 14.5px; font-weight: 800; margin: 3px 0 6px; line-height: 1.3; }
.qbar { height: 8px; border-radius: 6px; background: #e6e8f0; overflow: hidden; }
.qbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #ffcf33, #ff9f1a); border-radius: 6px; transition: width .3s; }

#side { position: absolute; top: calc(var(--sat) + 62px); right: calc(var(--sar) + 10px); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
#mini { width: 132px; height: 132px; border-radius: 16px; border: 3px solid rgba(255,255,255,0.85); background: rgba(20,24,48,0.55); box-shadow: 0 3px 0 rgba(0,0,0,0.2); }
#wanted { display: flex; gap: 2px; padding: 3px 8px; border-radius: 999px; background: var(--pill); min-height: 26px; align-items: center; }
#wanted svg { width: 18px; height: 18px; }
#wanted.flash { animation: wflash .5s infinite alternate; }
@keyframes wflash { from { background: rgba(200,20,20,.75); } to { background: rgba(20,40,200,.75); } }

/* ---------- 底部 ---------- */
#bottom {
  position: absolute; bottom: calc(var(--sab) + 16px); left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
#hp { width: 180px; height: 10px; border-radius: 6px; background: rgba(0,0,0,0.45); overflow: hidden; border: 2px solid rgba(255,255,255,0.8); opacity: 0; transition: opacity .3s; }
#hp.show { opacity: 1; }
#hp i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ff4d4d, #ff8a65); transition: width .15s; }
#cargo {
  display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px; border-radius: 999px;
  background: var(--pill); box-shadow: 0 3px 0 rgba(0,0,0,0.25);
}
#cargo .ic svg { width: 30px; height: 30px; display: block; }
#cargo .bar { width: 170px; height: 18px; border-radius: 10px; background: rgba(255,255,255,0.18); overflow: hidden; border: 2px solid rgba(255,255,255,0.75); }
#cargo .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #4fe3c1, #63e6be); transition: width .15s; }
#cargo b { font-size: 17px; font-weight: 900; min-width: 64px; text-align: right; }
#cargo.full .bar i { background: linear-gradient(90deg, #ff4d4d, #ff8787); }
#cargo.full { animation: shake .35s infinite; background: rgba(160, 20, 30, 0.8); }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }

.btn {
  font-family: var(--font); font-weight: 900; color: #fff; border: none; cursor: pointer;
  border-radius: 14px; padding: 10px 18px; font-size: 16px; letter-spacing: 1px;
  text-shadow: 0 2px 0 rgba(0,0,0,0.25); transition: transform .08s, filter .15s;
  position: relative;
}
.btn:active { transform: translateY(3px); }
.btn-green { background: linear-gradient(#64e979, #34c552); box-shadow: 0 5px 0 var(--green-d), 0 7px 12px rgba(0,0,0,.25); }
.btn-yellow { background: linear-gradient(#ffe066, #ffbf1a); box-shadow: 0 5px 0 var(--yellow-d), 0 7px 12px rgba(0,0,0,.25); color: #5a3a00; text-shadow: 0 1px 0 rgba(255,255,255,.5); }
.btn-purple { background: linear-gradient(#a084ff, #7048e8); box-shadow: 0 5px 0 #4b2bb0, 0 7px 12px rgba(0,0,0,.25); }
.btn-gray { background: linear-gradient(#c3c8d6, #9aa1b5); box-shadow: 0 5px 0 #707792; }
.btn-red { background: linear-gradient(#ff7b7b, #f03e3e); box-shadow: 0 5px 0 #b02525; }
.btn[disabled] { filter: grayscale(0.85) brightness(0.95); cursor: default; }
.btn.big { font-size: 22px; padding: 14px 40px; border-radius: 18px; }

#btnUp {
  position: absolute; left: calc(var(--sal) + 14px); bottom: calc(var(--sab) + 18px);
  display: flex; flex-direction: column; align-items: center; gap: 0; padding: 8px 14px 6px; font-size: 14px;
}
#btnUp .up-ic svg { width: 30px; height: 30px; display: block; }
.dot { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; background: var(--red); border: 3px solid #fff; animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.25); } }

#ctxBtn {
  position: absolute; bottom: calc(var(--sab) + 104px); left: 50%; transform: translateX(-50%);
  font-size: 17px; padding: 12px 24px; white-space: nowrap; animation: bob 1.2s ease-in-out infinite;
}
@keyframes bob { 50% { margin-bottom: 4px; } }

#abil {
  position: absolute; right: calc(var(--sar) + 14px); bottom: calc(var(--sab) + 16px);
  display: flex; gap: 12px; align-items: flex-end;
}
.ab {
  position: relative; width: 70px; height: 70px; border-radius: 50%; border: 4px solid #fff; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #7fe3ff, #2c8fd6 75%); box-shadow: 0 4px 0 rgba(0,0,0,.3);
  padding: 0; overflow: hidden;
}
#ab_ufo { background: radial-gradient(circle at 35% 30%, #c3a6ff, #7048e8 75%); }
.ab .ico { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.ab .ico svg { width: 44px; height: 44px; }
.ab .cdmask { position: absolute; inset: 0; background: conic-gradient(rgba(10,15,35,0.72) var(--p, 0%), transparent 0); }
.ab .cdtxt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 900; text-shadow: 0 2px 3px rgba(0,0,0,.6); }
.ab .lock { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; flex-direction: column; background: rgba(20,24,48,0.72); font-weight: 900; font-size: 12px; line-height: 1.1; }
.ab.locked .lock { display: flex; }
.ab .key { position: absolute; bottom: 2px; right: 50%; transform: translateX(50%); font-size: 10px; font-weight: 900; background: rgba(0,0,0,.35); border-radius: 6px; padding: 0 5px; }
.touch .ab .key { display: none; }
.ab.ready { animation: ready 1.4s infinite; }
.ab.active { box-shadow: 0 0 0 5px rgba(255, 230, 102, .8), 0 4px 0 rgba(0,0,0,.3); }
@keyframes ready { 0%,100% { box-shadow: 0 4px 0 rgba(0,0,0,.3), 0 0 0 0 rgba(255,255,255,.6); } 50% { box-shadow: 0 4px 0 rgba(0,0,0,.3), 0 0 0 8px rgba(255,255,255,0); } }

/* ---------- 提示 ---------- */
#toasts { position: absolute; top: 34%; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; width: 92%; }
.toast {
  font-weight: 900; font-size: 19px; padding: 8px 18px; border-radius: 14px; background: rgba(20,24,48,0.78);
  text-align: center; animation: toastIn .25s ease-out, toastOut .4s ease-in forwards; animation-delay: 0s, var(--d, 1.8s);
}
.toast.red { background: rgba(190, 30, 40, 0.88); }
.toast.green { background: rgba(30, 150, 70, 0.9); }
.toast.purple { background: rgba(100, 60, 220, 0.9); }
@keyframes toastIn { from { transform: scale(.6); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(-14px); opacity: 0; } }
#banner {
  position: absolute; top: 22%; left: 0; right: 0; text-align: center; font-size: 46px; font-weight: 900; letter-spacing: 2px;
  color: #fff; text-shadow: 2px 0 0 #6a3df0, -2px 0 0 #6a3df0, 0 2px 0 #6a3df0, 0 -2px 0 #6a3df0, 0 5px 0 #4b2bb0, 0 10px 20px rgba(0,0,0,.3);
  opacity: 0; pointer-events: none;
}
#banner.show { animation: banner 1.8s ease-out forwards; }
#banner small { display: block; font-size: 18px; -webkit-text-stroke: 0; text-shadow: 0 2px 4px rgba(0,0,0,.5); letter-spacing: 0; margin-top: 4px; }
@keyframes banner { 0% { opacity: 0; transform: scale(.4); } 15% { opacity: 1; transform: scale(1.12); } 25% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-20px); } }
#vignette { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 120px rgba(255,0,0,0.0); transition: box-shadow .2s; }
#vignette.hurt { box-shadow: inset 0 0 120px rgba(255,0,0,0.55); }

/* ---------- 场景标签 ---------- */
.wl svg, .toast svg, .desc svg, .ft svg { width: 18px; height: 18px; vertical-align: -4px; flex: none; }
.wl {
  position: absolute; left: 0; top: 0; white-space: nowrap; font-weight: 900; font-size: 13px;
  padding: 4px 10px; border-radius: 12px; background: rgba(22,26,56,0.75); color: #fff;
  display: flex; align-items: center; gap: 6px; will-change: transform; box-shadow: 0 2px 0 rgba(0,0,0,.25);
}
.wl .chips { display: flex; gap: 6px; }
.wl .chip { display: flex; align-items: center; gap: 2px; font-size: 12px; }
.wl .chip svg { width: 16px; height: 16px; }
.wl .chip.ok { color: #8dff9c; }
.wl.lock { background: rgba(160, 30, 140, 0.82); font-size: 14px; }
.wl.base { background: rgba(112, 72, 232, 0.88); }
.wl.ufo { background: rgba(22, 120, 100, 0.88); flex-direction: column; gap: 2px; }
.wl.farm { background: rgba(160, 100, 20, 0.88); }
.wl.site { background: rgba(80, 80, 100, 0.85); flex-direction: column; gap: 2px; }
.wl .sub { font-size: 11px; opacity: .85; }
.ft { position: absolute; left: 0; top: 0; font-weight: 900; font-size: 16px; white-space: nowrap; text-shadow: 0 2px 0 rgba(0,0,0,.45), 0 0 6px rgba(0,0,0,.4); pointer-events: none; display: flex; align-items: center; gap: 3px; }
.ft svg { width: 18px; height: 18px; }

/* ---------- 弹窗 ---------- */
#modal { position: absolute; inset: 0; z-index: 10; background: rgba(10, 14, 35, 0.55); display: flex; align-items: center; justify-content: center; padding: calc(var(--sat) + 10px) 12px calc(var(--sab) + 10px); }
.card {
  width: 100%; max-width: 540px; max-height: 100%; display: flex; flex-direction: column;
  background: #f6f7fb; color: var(--ink); border-radius: 22px; overflow: hidden;
  box-shadow: 0 8px 0 rgba(0,0,0,0.2), 0 20px 50px rgba(0,0,0,0.35); animation: pop .22s ease-out;
}
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.card-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; background: linear-gradient(#8e6bff, #6a3df0); color: #fff; }
.card-h h2 { margin: 0; font-size: 21px; font-weight: 900; letter-spacing: 1px; }
.card-x { width: 36px; height: 36px; border-radius: 10px; border: none; background: rgba(255,255,255,.22); color: #fff; font-size: 22px; font-weight: 900; cursor: pointer; line-height: 1; }
.card-b { padding: 12px; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.tabs { display: flex; gap: 8px; padding: 10px 12px 0; }
.tab { flex: 1; padding: 9px; border-radius: 12px; border: none; font-family: var(--font); font-weight: 900; font-size: 15px; background: #e3e5f0; color: #6b7090; cursor: pointer; }
.tab.on { background: #fff; color: var(--purple); box-shadow: 0 3px 0 #d4d7e6; }
.wallet { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px 0; }
.wallet .w { display: flex; align-items: center; gap: 3px; background: #fff; border-radius: 999px; padding: 3px 9px 3px 4px; font-weight: 900; font-size: 13px; box-shadow: 0 2px 0 #dfe2ee; }
.wallet svg { width: 18px; height: 18px; }
.row { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 16px; padding: 10px; margin-bottom: 10px; box-shadow: 0 3px 0 #dfe2ee; }
.row .ri { width: 52px; height: 52px; border-radius: 14px; flex: none; display: flex; align-items: center; justify-content: center; background: linear-gradient(#efe9ff, #ddd2ff); }
.row .ri svg { width: 36px; height: 36px; }
.row .rm { flex: 1; min-width: 0; }
.row .rn { font-weight: 900; font-size: 15.5px; display: flex; align-items: baseline; gap: 6px; }
.row .rn small { font-size: 11.5px; color: #8a8fa8; font-weight: 800; }
.row .rv { font-size: 13px; font-weight: 800; color: #5b6080; margin-top: 2px; }
.row .rv b { color: #2fb344; }
.row .rc { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.row .rc span { display: flex; align-items: center; gap: 2px; font-weight: 900; font-size: 12.5px; }
.row .rc span.no { color: #f03e3e; }
.row .rc svg { width: 16px; height: 16px; }
.row .btn { padding: 9px 12px; font-size: 14px; flex: none; min-width: 66px; }
.desc { font-size: 13px; color: #6b7090; font-weight: 700; margin: 2px 2px 10px; line-height: 1.45; }
.set-row { display: flex; align-items: center; justify-content: space-between; background: #fff; border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; font-weight: 900; box-shadow: 0 3px 0 #dfe2ee; }
.toggle { width: 58px; height: 32px; border-radius: 999px; border: none; background: #cfd3e1; position: relative; cursor: pointer; transition: background .2s; }
.toggle::after { content: ''; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 2px 3px rgba(0,0,0,.2); }
.toggle.on { background: var(--green); }
.toggle.on::after { left: 30px; }
.seg { display: flex; gap: 4px; background: #e3e5f0; padding: 3px; border-radius: 10px; }
.seg button { border: none; background: transparent; padding: 6px 10px; border-radius: 8px; font-family: var(--font); font-weight: 900; color: #6b7090; cursor: pointer; }
.seg button.on { background: #fff; color: var(--purple); }
.center { text-align: center; }
.big-ic svg { width: 96px; height: 96px; }
.reward { display: inline-flex; align-items: center; gap: 6px; font-size: 26px; font-weight: 900; color: #c98a00; margin: 8px 0 14px; }
.reward svg { width: 34px; height: 34px; }

/* ---------- 开始界面 ---------- */
#start {
  position: absolute; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #74d3f5 0%, #a9ecfb 55%, #c9f7d0 100%); overflow: hidden;
}
.sky-blocks { position: absolute; inset: 0; }
.sky-blocks i { position: absolute; bottom: -10%; border-radius: 6px; opacity: .9; box-shadow: inset -6px -6px 0 rgba(0,0,0,.12); }
.start-inner { position: relative; text-align: center; padding: 20px; max-width: 560px; }
.logo { margin-bottom: 10px; }
.logo-row { display: flex; justify-content: center; gap: 4px; }
.logo-row b {
  display: inline-block; font-size: clamp(48px, 13vw, 92px); font-weight: 900; line-height: 1.05;
  text-shadow: 3px 0 0 #1d2a6b, -3px 0 0 #1d2a6b, 0 3px 0 #1d2a6b, 0 -3px 0 #1d2a6b, 2px 2px 0 #1d2a6b, -2px 2px 0 #1d2a6b, 2px -2px 0 #1d2a6b, -2px -2px 0 #1d2a6b,
    0 6px 0 #1d2a6b, 3px 6px 0 #1d2a6b, -3px 6px 0 #1d2a6b, 0 9px 0 #1d2a6b, 0 14px 18px rgba(0,0,0,.25);
  animation: hop 2.4s ease-in-out infinite;
}
.l1 { color: #ffd43b; } .l2 { color: #7cf06a; animation-delay: .15s !important; } .l3 { color: #ff8fab; animation-delay: .3s !important; }
.l4 { color: #74c0fc; animation-delay: .45s !important; } .l5 { color: #ffa94d; animation-delay: .6s !important; }
@keyframes hop { 0%, 60%, 100% { transform: translateY(0) rotate(0); } 70% { transform: translateY(-10px) rotate(-4deg); } 80% { transform: translateY(0) rotate(2deg); } }
.logo-sub { display: inline-block; margin-top: 10px; background: #1d2a6b; color: #fff; padding: 4px 16px; border-radius: 10px; font-weight: 900; letter-spacing: 4px; font-size: 15px; }
.pitch { color: #1d2a6b; font-weight: 800; font-size: 16px; line-height: 1.6; margin: 14px 0 22px; }
.start-btns { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.howto { margin-top: 22px; color: #1d2a6b; font-weight: 800; font-size: 13px; line-height: 1.7; opacity: .85; }
.howto kbd { background: #fff; border-radius: 6px; padding: 1px 6px; box-shadow: 0 2px 0 #b9c3dc; font-family: var(--font); }
.loadtxt { margin-top: 8px; color: #1d2a6b; font-weight: 800; font-size: 13px; opacity: .7; }

/* ---------- 小屏适配 ---------- */
@media (max-width: 720px) {
  #res { top: calc(var(--sat) + 66px); left: calc(var(--sal) + 10px); right: calc(var(--sar) + 10px); transform: none; justify-content: flex-start; gap: 4px; flex-wrap: wrap; }
  .pill { font-size: 13px; padding: 3px 8px 3px 4px; min-width: 0; gap: 3px; }
  .pill svg { width: 18px; height: 18px; }
  .xpbar { width: 120px; }
  #quest { top: calc(var(--sat) + 100px); width: min(62vw, 240px); padding: 6px 10px 8px; }
  #qText { font-size: 13px; }
  #side { top: calc(var(--sat) + 100px); }
  #mini { width: 96px; height: 96px; border-radius: 12px; }
  #cargo .bar { width: 110px; }
  #cargo b { font-size: 15px; min-width: 52px; }
  #bottom { bottom: calc(var(--sab) + 104px); }
  #ctxBtn { bottom: calc(var(--sab) + 172px); }
  .ab { width: 62px; height: 62px; }
  .ab .ico svg { width: 38px; height: 38px; }
  #banner { font-size: 36px; }
}
@media (max-width: 380px) {
  .pill { font-size: 12px; padding: 3px 7px 3px 3px; }
  .pill svg { width: 16px; height: 16px; }
  #cargo .bar { width: 90px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  #res { top: calc(var(--sat) + 8px); left: 50%; right: auto; transform: translateX(-50%); }
  #quest { top: calc(var(--sat) + 66px); width: 220px; }
  #side { top: calc(var(--sat) + 58px); }
  #mini { width: 88px; height: 88px; }
  #bottom { bottom: calc(var(--sab) + 10px); }
  #ctxBtn { bottom: calc(var(--sab) + 82px); }
  #banner { font-size: 34px; top: 18%; }
}

/* ================= v2：新玩法界面 ================= */
.trophy-btn { right: calc(var(--sar) + 60px); }
.trophy-btn svg { width: 26px; height: 26px; }
.trophy-btn .dot { top: -5px; right: -5px; width: 14px; height: 14px; border-width: 2px; }
#ab_hole { background: radial-gradient(circle at 35% 30%, #6b4bb8, #1d0b3a 75%); }

/* 连击 */
#combo {
  position: absolute; right: calc(var(--sar) + 16px); top: 40%; display: none; flex-direction: column; align-items: flex-end;
  text-shadow: 0 3px 0 rgba(0,0,0,.35); pointer-events: none;
}
#combo.show { display: flex; }
#combo .cn { display: flex; align-items: baseline; gap: 4px; }
#combo .cn b { font-size: 44px; font-weight: 900; line-height: 1; color: #fff; -webkit-text-stroke: 1.5px #6a3df0; }
#combo .cn b.pop { animation: cpop .18s ease-out; }
@keyframes cpop { from { transform: scale(1.35); } }
#combo .cn span { font-size: 16px; font-weight: 900; }
#combo .x { font-style: normal; font-weight: 900; font-size: 16px; padding: 2px 10px; border-radius: 999px; background: rgba(22,26,56,.7); margin-top: 2px; }
#combo .x.warm { background: #f59f00; }
#combo .x.hot { background: #f03e3e; animation: pulse .6s infinite; }
#combo .cbar { width: 96px; height: 6px; border-radius: 4px; background: rgba(0,0,0,.35); margin-top: 5px; overflow: hidden; }
#combo .cbar i { display: block; height: 100%; background: #ffe066; }

/* 事件 */
#evChip {
  position: absolute; top: calc(var(--sat) + 160px); left: calc(var(--sal) + 10px); display: flex; align-items: center; gap: 6px;
  padding: 6px 12px 6px 8px; border-radius: 999px; background: linear-gradient(90deg, #f59f00, #f76707); font-weight: 900; font-size: 14px;
  box-shadow: 0 3px 0 rgba(0,0,0,.2); animation: bob 1.4s ease-in-out infinite;
}
#evChip .evic { display: inline-flex; width: 22px; height: 22px; border-radius: 50%; background: #fff; color: #f76707; align-items: center; justify-content: center; font-size: 13px; }
#evChip b { background: rgba(0,0,0,.25); padding: 1px 7px; border-radius: 8px; }

/* Boss 血条 */
#bossbar { position: absolute; top: calc(var(--sat) + 58px); left: 50%; transform: translateX(-50%); width: min(76vw, 440px); text-align: center; }
#bossbar .bn { font-weight: 900; font-size: 15px; letter-spacing: 1px; text-shadow: 0 2px 0 rgba(0,0,0,.4); }
#bossbar .bb { height: 16px; border-radius: 9px; background: rgba(0,0,0,.5); border: 2px solid #fff; overflow: hidden; margin-top: 3px; }
#bossbar .bb i { display: block; height: 100%; background: linear-gradient(90deg, #ff2d2d, #ff922b); transition: width .2s; }
#bossbar .bs { font-size: 12px; font-weight: 800; margin-top: 3px; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
body.bossfight #quest, body.bossfight #evChip { display: none; }

/* 挑战 HUD */
#chalHud { display: none; position: absolute; top: calc(var(--sat) + 10px); left: 50%; transform: translateX(-50%); align-items: center; gap: 10px; }
body.chal #chalHud { display: flex; }
#chalHud .ct { font-size: 30px; font-weight: 900; padding: 4px 16px; border-radius: 14px; background: var(--pill); min-width: 96px; text-align: center; }
#chalHud .ct.low { background: rgba(220, 30, 40, .85); animation: pulse .5s infinite; }
#chalHud .cs { display: flex; flex-direction: column; align-items: center; padding: 4px 14px; border-radius: 14px; background: rgba(120, 72, 0, .72); }
#chalHud .cs small { font-size: 11px; font-weight: 800; opacity: .85; }
#chalHud .cs b { font-size: 22px; font-weight: 900; line-height: 1.1; }
#chalHud .btn { padding: 7px 12px; font-size: 13px; }
#chalHud > * { flex: none; white-space: nowrap; }
body.chal #lvl, body.chal #res, body.chal #quest, body.chal #cargo, body.chal #btnUp, body.chal #wanted,
body.chal #hp, body.chal #btnTrophy, body.chal #ctxBtn { display: none !important; }

/* 成就 & 衣橱 */
.row.ach .ri { background: linear-gradient(#eceef4, #dfe2ec); filter: grayscale(1); opacity: .7; }
.row.ach.done .ri { background: linear-gradient(#fff4c2, #ffe066); filter: none; opacity: 1; }
.row.ach.done { box-shadow: 0 3px 0 #f2d675; }
.okc { color: #2fb344 !important; }
.pbar { height: 7px; border-radius: 5px; background: #e6e8f0; overflow: hidden; margin-top: 5px; }
.pbar i { display: block; height: 100%; background: linear-gradient(90deg, #a084ff, #7048e8); }
.unl { color: #7048e8; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.tile {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px 10px; border-radius: 16px; border: 3px solid transparent;
  background: #fff; box-shadow: 0 3px 0 #dfe2ee; cursor: pointer; font-family: var(--font); color: var(--ink);
}
.tile b { font-size: 14px; font-weight: 900; }
.tile small { font-size: 12px; font-weight: 800; color: #8a8fa8; display: flex; align-items: center; gap: 2px; }
.tile small svg { width: 15px; height: 15px; }
.tile.cur { border-color: #7048e8; }
.tile.cur small { color: #7048e8; }
.tile.own small { color: #2fb344; }
.tile.armed { border-color: #f59f00; }
.tile.armed small { color: #f59f00; }
.tile:not(.own) .sw { opacity: .55; }
.sw { width: 52px; height: 52px; border-radius: 14px; box-shadow: inset -6px -6px 0 rgba(0,0,0,.15); display: flex; align-items: center; justify-content: center; }
.sw.rb { background: conic-gradient(#ff6b6b, #ffd43b, #69db7c, #4dabf7, #9775fa, #ff6b6b) !important; }
.sw.hatsw { background: #eef0f6; box-shadow: none; font-weight: 900; color: #8a8fa8; }
.sw.hatsw svg { width: 36px; height: 36px; }

/* 挑战结果 */
.score-big { font-size: 52px; font-weight: 900; color: #f76707; line-height: 1.1; margin-top: 4px; }
.newbest { display: inline-block; background: #f03e3e; color: #fff; font-weight: 900; padding: 2px 12px; border-radius: 999px; margin: 4px 0; animation: pulse 1s infinite; }
.name-row { display: flex; gap: 8px; margin: 8px 0 4px; }
.name-row input {
  flex: 1; min-width: 0; font-family: var(--font); font-size: 16px; font-weight: 800; padding: 10px 12px; border-radius: 12px;
  border: 2px solid #d4d7e6; background: #fff; color: var(--ink); user-select: text; -webkit-user-select: text; touch-action: auto;
}
.name-row .btn { padding: 9px 14px; font-size: 14px; }
.lbtabs { padding: 8px 0 6px; }
.lb { background: #fff; border-radius: 14px; padding: 6px; min-height: 80px; max-height: 38vh; overflow-y: auto; box-shadow: 0 3px 0 #dfe2ee; touch-action: pan-y; }
.lr { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; font-weight: 800; }
.lr:nth-child(odd) { background: #f6f7fb; }
.lr .rk { width: 28px; height: 28px; border-radius: 50%; background: #e3e5f0; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 13px; flex: none; }
.lr.top1 .rk { background: #ffd43b; } .lr.top2 .rk { background: #ced4da; } .lr.top3 .rk { background: #f0a76a; }
.lr .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lr b { color: #f76707; }
.lr.me { background: #efe9ff !important; outline: 2px solid #a084ff; }
.btn-row { display: flex; gap: 12px; justify-content: center; margin: 14px 0 6px; }

.start-btns .btn-yellow { font-size: 17px; padding: 11px 26px; }

@media (max-width: 720px) {
  .trophy-btn { right: calc(var(--sar) + 58px); }
  #evChip { top: calc(var(--sat) + 190px); font-size: 13px; }
  #bossbar { top: calc(var(--sat) + 104px); left: calc(var(--sal) + 10px); transform: none; width: calc(100vw - 150px); text-align: left; }
  #chalHud { gap: 6px; }
  #chalHud .cs { padding: 3px 10px; }
  #chalHud .cs b { font-size: 18px; }
  #combo { top: 46%; }
  #combo .cn b { font-size: 36px; }
  .ab { width: 56px; height: 56px; }
  .ab .ico svg { width: 34px; height: 34px; }
  #abil { gap: 8px; }
  #chalHud .ct { font-size: 24px; min-width: 80px; }
  .score-big { font-size: 42px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  #evChip { top: calc(var(--sat) + 150px); }
  #bossbar { top: calc(var(--sat) + 50px); }
}
