:root {
  --bg: #0b1020;
  --ink: #e8eefc;
  --muted: #93a2c9;
  --accent: #5ad1ff;
  --accent2: #ffd166;
  --danger: #ff5c7a;
  --hp: #ff5c7a;
  --ok: #6ee7a0;
  --panel: rgba(18, 26, 48, .92);
  --line: rgba(120, 160, 230, .22);
}

* { box-sizing: border-box; margin: 0; padding: 0 }
html, body { height: 100%; overflow: hidden; background: var(--bg); }
/* 手机浏览器地址栏会遮住 fixed 底部，dvh 按可视高度算；老浏览器自动忽略这行 */
@supports (height: 100dvh) {
  html, body { height: 100dvh }
}
body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, system-ui, sans-serif;
  color: var(--ink);
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  /* 只有画布要 none；写在这里会把大厅面板的原生滚动一起禁掉 */
  touch-action: manipulation;
}

#app { position: fixed; inset: 0; height: 100dvh; overflow: hidden }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none }

.hidden { display: none !important }

/* ---------------- HUD ---------------- */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 5 }

.hud-top {
  position: absolute; top: 0; left: 0; right: 0;
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px;
  align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) calc(14px + env(safe-area-inset-right)) 10px calc(14px + env(safe-area-inset-left));
}

.xp-bar {
  position: relative; height: 20px; border-radius: 10px;
  background: rgba(10, 16, 32, .7); border: 1px solid var(--line);
  overflow: hidden; min-width: 120px;
}
.xp-fill {
  position: absolute; inset: 0; width: 0%;
  background: linear-gradient(90deg, #2f7dff, #5ad1ff);
  transition: width .12s linear;
}
.bar-label {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; letter-spacing: .5px;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
}

.hud-center { text-align: center; line-height: 1.15 }
.wave-label { font-size: 12px; color: var(--accent2); letter-spacing: 1px }
.timer { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums }

.hud-stats { display: flex; gap: 14px; justify-content: flex-end; align-items: center }
.stat { display: flex; align-items: center; gap: 5px; font-size: 14px; font-weight: 700 }
.ico { width: 12px; height: 12px; border-radius: 3px; display: inline-block }
.ico-kill { background: #ff8fa3; transform: rotate(45deg) }
.ico-coin { background: var(--accent2); border-radius: 50% }
.ico-hp { background: var(--hp); border-radius: 50% }

.hp-bar {
  position: absolute; top: calc(52px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  width: min(320px, 46vw); height: 14px; border-radius: 8px;
  background: rgba(10, 16, 32, .7); border: 1px solid var(--line); overflow: hidden;
}
.hp-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #ff4d6d, #ff9aa8) }
.hp-fill.low { animation: pulse .7s infinite alternate }
@keyframes pulse { to { opacity: .45 } }

.build {
  position: absolute; right: calc(12px + env(safe-area-inset-right));
  top: calc(96px + env(safe-area-inset-top));
  display: flex; flex-direction: column; gap: 6px; align-items: flex-end;
}
.chip {
  display: flex; align-items: center; gap: 6px;
  background: rgba(14, 22, 42, .8); border: 1px solid var(--line);
  border-radius: 20px; padding: 4px 10px 4px 6px; font-size: 12px;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50% }
.chip .lvl { color: var(--accent2); font-weight: 800 }

.hint {
  position: absolute; bottom: calc(10px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  font-size: 11px; color: var(--muted); text-align: center;
  width: max-content; max-width: min(560px, 62vw);
}

/* ---------------- 摇杆（跟随手指浮动） ---------------- */
#stick {
  position: absolute; left: 0; top: 0; width: min(150px, 42vw); height: min(150px, 42vw);
  transform: translate(-50%, -50%); z-index: 6; pointer-events: none;
  transition: opacity .14s ease;
}
#stick.idle { opacity: 0 }
.stick-base, .stick-knob {
  position: absolute; border-radius: 50%;
  left: 50%; top: 50%; transform: translate(-50%, -50%);
}
.stick-base { width: 42%; height: 42%; border: 2px solid rgba(140,180,250,.45); background: rgba(20,32,60,.42) }
.stick-knob { width: 18%; height: 18%; background: rgba(140,190,255,.75) }

/* ---------------- 战斗内暂停键（触屏可见） ---------------- */
.pause-btn {
  position: absolute; right: calc(12px + env(safe-area-inset-right));
  bottom: calc(14px + env(safe-area-inset-bottom));
  width: 52px; height: 52px; border-radius: 50%;
  pointer-events: auto; cursor: pointer; font-family: inherit;
  display: grid; place-items: center;
  background: rgba(14, 22, 42, .8); border: 1px solid var(--line);
  color: var(--ink); font-size: 15px; font-weight: 900; letter-spacing: 1px;
  -webkit-tap-highlight-color: transparent;
}
.pause-btn:active { transform: scale(.92); background: rgba(40, 62, 108, .9) }

/* ---------------- 弹层 ---------------- */
.overlay {
  position: absolute; inset: 0; z-index: 20;
  display: grid; place-items: center; padding: 18px;
  background: rgba(6, 9, 20, .78); backdrop-filter: blur(6px);
}
.panel {
  width: min(760px, 100%); max-height: 100%; overflow: auto;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 22px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
}
.panel.small { width: min(420px, 100%); text-align: center }
.panel h1 { font-size: 34px; letter-spacing: 3px; text-align: center; color: var(--accent) }
.panel h2 { font-size: 19px; text-align: center; margin-bottom: 16px; letter-spacing: 1px }
.sub { color: var(--muted); font-size: 13px; line-height: 1.8; text-align: center; margin: 10px 0 }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px }
@media (max-width: 620px) { .cards { grid-template-columns: 1fr } }

.card {
  pointer-events: auto; cursor: pointer; text-align: left;
  background: rgba(12, 20, 40, .9); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px; color: var(--ink);
  transition: transform .12s, border-color .12s, box-shadow .12s;
  font-family: inherit;
}
.card:hover, .card:focus-visible { transform: translateY(-4px); border-color: var(--accent); box-shadow: 0 10px 26px rgba(90, 209, 255, .18) }
.card .kind { font-size: 10px; letter-spacing: 1px; color: var(--muted); text-transform: uppercase }
.card .row { display: flex; align-items: center; gap: 8px; margin: 6px 0 }
.card .glyph {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: grid; place-items: center; font-size: 15px; font-weight: 800;
  background: rgba(90, 209, 255, .16); color: var(--accent);
  border: 1px solid rgba(90, 209, 255, .35);
}
.card .name { font-size: 15px; font-weight: 800 }
.card .lvlnow { font-size: 11px; color: var(--accent2); margin-left: auto }
.card .desc { font-size: 12px; color: var(--muted); line-height: 1.6 }
.card.rare { border-color: rgba(255, 209, 102, .5) }
.card.rare .glyph { background: rgba(255, 209, 102, .16); color: var(--accent2); border-color: rgba(255,209,102,.45) }
.card.evo { border-color: rgba(110, 231, 160, .55) }
.card.evo .glyph { background: rgba(110, 231, 160, .16); color: var(--ok); border-color: rgba(110,231,160,.45) }

.panel-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px }
.panel-actions.column { flex-direction: column }
.btn {
  pointer-events: auto; cursor: pointer; font-family: inherit;
  padding: 11px 22px; border-radius: 12px; font-size: 14px; font-weight: 700;
  border: 1px solid var(--line); background: rgba(30, 42, 72, .9); color: var(--ink);
}
.btn:hover { filter: brightness(1.15) }
.btn.primary { background: linear-gradient(180deg, #2f7dff, #1b4fd0); border-color: #4d8bff }
.btn.ghost { background: transparent }
.btn.big { padding: 15px 40px; font-size: 17px; letter-spacing: 2px }
.cost { color: var(--accent2) }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 16px; margin: 12px 0 }
.stat-grid div { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding-bottom: 4px }
.stat-grid b { color: var(--ink) }

.toast {
  position: absolute; left: 50%; top: 22%; transform: translateX(-50%);
  font-size: 15px; font-weight: 800; letter-spacing: 2px; color: var(--accent2);
  text-shadow: 0 2px 12px rgba(0,0,0,.7); z-index: 12; pointer-events: none;
  animation: toast 1.6s ease forwards;
}
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 10px) } 20% { opacity: 1 } 100% { opacity: 0; transform: translate(-50%, -18px) } }

/* ---------------- 钻石 ---------------- */
.dia {
  width: 13px; height: 13px; display: inline-block; border-radius: 3px;
  background: linear-gradient(135deg, #9fe0ff, #4f8dff);
  transform: rotate(45deg); box-shadow: 0 0 8px rgba(90, 180, 255, .55);
  margin-right: 5px;
}
.dia-sm { width: 10px; height: 10px; box-shadow: none }

.note { text-align: center; font-size: 12px; color: var(--muted); margin-top: 12px; min-height: 16px }
.note:empty { display: none }

/* ---------------- 宽面板 / 商城 ---------------- */
.panel.wide { width: min(920px, 100%) }
.shop-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px }
.shop-head h2 { margin: 0; flex: 1; text-align: left }
.wallet { display: flex; align-items: center; font-size: 14px; color: var(--accent) }
.wallet b { font-size: 17px; margin: 0 2px }

.tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap }
.tab {
  pointer-events: auto; cursor: pointer; font-family: inherit;
  padding: 8px 18px; border-radius: 20px; font-size: 13px; font-weight: 700;
  background: rgba(12, 20, 40, .8); border: 1px solid var(--line); color: var(--muted);
}
.tab.active { background: linear-gradient(180deg, #2f7dff, #1b4fd0); color: #fff; border-color: #4d8bff }

.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px }
.goods {
  background: rgba(12, 20, 40, .9); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 8px;
}
.goods.inuse { border-color: rgba(110, 231, 160, .55) }
.goods-glyph {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  font-size: 18px; font-weight: 800; color: #fff; border: 1px solid var(--line);
}
.goods-name { font-size: 15px; font-weight: 800 }
.goods-desc { font-size: 12px; color: var(--muted); line-height: 1.6; flex: 1 }
.goods-tips { color: #7f8fb5; font-size: 11px }
.goods-btn { width: 100%; padding: 9px 10px; font-size: 12px }
.btn.accent { background: linear-gradient(180deg, #34c47c, #1c8f5a); border-color: #4ddc94 }
.btn.small { padding: 7px 14px; font-size: 12px }
.btn[disabled] { opacity: .45; cursor: default; filter: none }
.shop-note { margin-top: 14px; font-size: 12px; color: var(--muted); text-align: center; line-height: 1.7 }

/* ---------------- 支付 ---------------- */
.packs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 6px 0 14px }
.pack {
  pointer-events: auto; cursor: pointer; position: relative; font-family: inherit;
  background: rgba(12, 20, 40, .9); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 10px; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.pack.sel { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(90, 209, 255, .4) inset }
.pack b { font-size: 20px; color: var(--accent) }
.pack-name { font-size: 11px; color: var(--muted) }
.pack-price { font-size: 14px; font-weight: 800; color: var(--accent2) }
.pack-tag {
  position: absolute; top: -7px; right: 8px; font-size: 10px; font-weight: 800;
  background: var(--accent2); color: #1a1200; border-radius: 8px; padding: 2px 7px;
}
.pay-state {
  font-size: 12px; color: var(--muted); line-height: 1.8; text-align: left;
  background: rgba(6, 9, 20, .6); border: 1px dashed var(--line);
  border-radius: 12px; padding: 12px; min-height: 46px;
}
.pay-state b { color: var(--accent2) }

/* ---------------- 结算钻石 ---------------- */
.settle-dia {
  text-align: center; font-size: 14px; margin: 4px 0 10px; color: var(--muted);
  background: rgba(90, 180, 255, .08); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px;
}
.settle-dia b { color: var(--accent); font-size: 19px }
.pay-break { display: block; font-size: 11px; color: #7f8fb5; margin-top: 4px }

/* ---------------- 玩法说明 ---------------- */
.how-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px }
.how-block { background: rgba(12, 20, 40, .7); border: 1px solid var(--line); border-radius: 12px; padding: 14px }
.how-block h3 { font-size: 14px; color: var(--accent); margin-bottom: 6px }
.how-block p { font-size: 12px; color: var(--muted); line-height: 1.85 }

@media (max-width: 700px) {
  .how-grid, .packs { grid-template-columns: 1fr }
  .shop-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) }
  .panel { padding: 16px }
  .shop-head h2 { font-size: 16px }
}

/* ---------------- 大厅 ---------------- */
.lobby {
  position: absolute; inset: 0; z-index: 20;
  display: grid; gap: 8px;
  grid-template-areas: "head" "nav" "stage" "panel" "start" "log";
  grid-template-rows: auto auto 1fr auto auto auto;
  padding: calc(10px + env(safe-area-inset-top)) 12px calc(10px + env(safe-area-inset-bottom));
  pointer-events: none;
}
.lobby > * { pointer-events: auto }

.lb-head { grid-area: head; display: flex; justify-content: space-between; align-items: center; gap: 10px }
.lb-me {
  display: flex; align-items: center; gap: 8px; flex: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: 30px; padding: 4px 14px 4px 4px;
}
.lb-avatar {
  width: 40px; height: 40px; flex: none; border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 50% 38%, #1d2d52, #0a1122); border: 1px solid var(--line);
}
.lb-avatar canvas { width: 40px; height: 40px; display: block }
.lb-id { display: flex; flex-direction: column; line-height: 1.15 }
.lb-name { font-size: 11px; color: var(--muted) }
.lb-lv { font-size: 15px; font-weight: 800; color: var(--accent2) }
.lb-wallet { display: flex; gap: 6px }
.wal {
  display: flex; align-items: center; gap: 5px; font-size: 14px; font-weight: 800;
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 5px 12px;
}
.cry {
  width: 12px; height: 12px; flex: none; display: inline-block;
  background: linear-gradient(135deg, #92f0a8, #2f9d63); border-radius: 3px; transform: rotate(45deg);
}

.lb-nav { grid-area: nav; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none }
.lb-nav::-webkit-scrollbar { display: none }
.lb-tab {
  pointer-events: auto; cursor: pointer; font-family: inherit; flex: 1 0 auto; min-width: 54px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: rgba(14, 22, 42, .74); border: 1px solid var(--line); border-radius: 12px;
  padding: 6px 6px; color: var(--muted); font-size: 11px;
}
.lb-tab .lb-ic {
  width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center;
  background: rgba(90, 209, 255, .14); color: var(--accent); font-size: 12px; font-weight: 800;
}
.lb-tab.active { color: var(--ink); border-color: var(--accent); background: rgba(28, 54, 94, .82) }
.lb-tab.active .lb-ic { background: var(--accent); color: #06121f }

.lb-stage {
  grid-area: stage; display: flex; flex-direction: column; align-items: center;
  justify-content: flex-start; padding-top: 3%; text-align: center; pointer-events: none;
}
.lb-title { font-size: clamp(26px, 7vw, 44px); letter-spacing: 6px; color: var(--accent); text-shadow: 0 0 22px rgba(90, 209, 255, .45) }
.lb-sub { font-size: 10px; letter-spacing: 3px; color: var(--muted); margin-top: 3px }
.lb-best { margin-top: 8px; font-size: 12px; color: var(--accent2) }

.lb-panel {
  grid-area: panel; max-height: 40vh; overflow: auto; -webkit-overflow-scrolling: touch;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 12px;
}
.p-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 15px; font-weight: 800; margin-bottom: 10px }
.p-sub { font-size: 11px; font-weight: 400; color: var(--muted); margin-right: auto }

.task { background: rgba(12, 20, 40, .6); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; margin-bottom: 8px }
.task.done { border-color: rgba(110, 231, 160, .5) }
.task-top { display: flex; justify-content: space-between; font-size: 13px }
.task-rw { display: flex; align-items: center; gap: 5px; color: #92f0a8; font-weight: 800; font-size: 12px }
.task-desc { font-size: 11px; color: var(--muted); margin: 2px 0 6px }
.task-bar { height: 6px; border-radius: 4px; background: rgba(10, 16, 32, .85); overflow: hidden }
.task-bar i { display: block; height: 100%; background: linear-gradient(90deg, #2f7dff, #5ad1ff) }
.task-bot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 11px; color: var(--muted) }
.task-ok { color: var(--ok) }

.s-group { font-size: 11px; color: var(--accent2); letter-spacing: 1px; margin: 10px 0 6px }
.s-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px }
.scard { background: rgba(12, 20, 40, .8); border: 1px solid var(--line); border-radius: 12px; padding: 8px; text-align: center }
.scard.inuse { border-color: var(--ok) }
.skin-prev { width: 64px; height: 64px; display: block; margin: 0 auto }
.sname { font-size: 13px; font-weight: 800 }
.sdesc { font-size: 10px; color: var(--muted); line-height: 1.5; min-height: 28px; margin: 2px 0 6px }

.life { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); margin-bottom: 10px }
.life b { color: var(--ink); margin-left: 4px }
.empty { font-size: 12px; color: var(--muted); text-align: center; padding: 18px 0 }
.h-table { display: grid; gap: 2px }
.h-row {
  display: grid; gap: 6px; align-items: center; font-size: 11px; color: var(--muted);
  grid-template-columns: 68px 1fr 54px 44px 50px 78px 38px;
  border-bottom: 1px dashed var(--line); padding: 5px 0;
}
.h-row.win { color: var(--ink) }
.h-res { text-align: right }
.h-row.win .h-res { color: var(--ok) }
.h-rw { display: flex; align-items: center; gap: 3px }

.mcard {
  display: flex; flex-direction: column; gap: 3px; cursor: pointer;
  background: rgba(12, 20, 40, .8); border: 1px solid var(--line); border-radius: 12px; padding: 10px;
}
.mcard.inuse { border-color: var(--accent); background: rgba(24, 48, 82, .8) }
.mcard[data-lock] { opacity: .5; cursor: not-allowed }
.mname { font-size: 14px; font-weight: 800 }
.mdesc { font-size: 11px; color: var(--muted); line-height: 1.5 }
.mchip { width: 100%; height: 32px; border-radius: 8px; border: 1px solid var(--line) }

.lb-start-wrap { grid-area: start; display: flex; gap: 8px; justify-content: center; align-items: center }
.lb-start-wrap .btn { flex: 1 1 auto; max-width: 280px }
.lb-log { grid-area: log; display: flex; flex-direction: column; gap: 2px; font-size: 10px; color: var(--muted); max-height: 46px; overflow: hidden }
.lb-logline { opacity: .75 }

/* ---------------- 皮肤获得展示 ---------------- */
#reveal { z-index: 30 }
.reveal-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px }
#revealCanvas { width: min(340px, 74vw); height: auto }
.reveal-name { font-size: 25px; font-weight: 800; letter-spacing: 4px; color: var(--accent2); text-shadow: 0 0 18px rgba(255, 209, 102, .45) }
.reveal-kind { font-size: 11px; color: var(--muted); letter-spacing: 2px; margin-bottom: 8px }

@media (min-width: 860px) {
  .lobby {
    grid-template-columns: 1fr minmax(330px, 430px);
    grid-template-rows: auto auto 1fr auto auto;
    grid-template-areas:
      "head  head"
      "nav   nav"
      "stage panel"
      "start panel"
      "log   log";
  }
  .lb-panel { max-height: none }
}

/* ============================================================
   糖果大厅 v2：更软配色、圆润、弹跳动效（覆盖上面的大厅样式）
   只在 #title 大厅生效，战斗 HUD 保持深色高对比，不影响可读性。
   ============================================================ */
:root {
  --candy1: #ffd166;   /* 焦糖黄 */
  --candy2: #ff8fc0;   /* 泡泡粉 */
  --candy3: #7fe3c0;   /* 薄荷绿 */
  --candy4: #9ecbff;   /* 奶蓝 */
  --glass: rgba(255, 255, 255, .12);
  --glass2: rgba(255, 255, 255, .2);
  --glass-line: rgba(255, 255, 255, .28);
  --ink-candy: #fff7fb;
}

/* 大厅背景：星空糖果渐变 + 漂浮装饰 */
.lobby {
  background: linear-gradient(168deg, #241a4d 0%, #3b2a6e 32%, #6a3d8f 62%, #b8589f 86%, #e07a95 100%);
  gap: 10px;
}
.lb-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0 }
.lobby > *:not(.lb-bg) { position: relative; z-index: 1 }
.lb-cloud {
  position: absolute; border-radius: 50%; filter: blur(22px); opacity: .3;
  background: radial-gradient(circle at 40% 40%, #fff, rgba(255, 200, 240, 0));
  animation: drift 26s ease-in-out infinite alternate;
}
.lb-cloud.c1 { width: 46vw; height: 46vw; left: -12vw; top: 6%; background: radial-gradient(circle at 40% 40%, #9ecbff, rgba(158,203,255,0)) }
.lb-cloud.c2 { width: 38vw; height: 38vw; right: -8vw; top: 26%; animation-duration: 34s; background: radial-gradient(circle at 40% 40%, #ff9fd0, rgba(255,159,208,0)) }
.lb-cloud.c3 { width: 52vw; height: 52vw; left: 18vw; bottom: -18vw; animation-duration: 40s; background: radial-gradient(circle at 40% 40%, #a8f0d6, rgba(168,240,214,0)) }
@keyframes drift { to { transform: translate3d(6vw, -3vh, 0) scale(1.12) } }
.lb-bubble {
  position: absolute; bottom: -8%; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, rgba(255,255,255,.85), rgba(255,255,255,.12) 55%, rgba(255,255,255,0));
  border: 1px solid rgba(255, 255, 255, .3);
  animation: rise 15s linear infinite;
}
.lb-bubble.b1 { width: 26px; height: 26px; left: 8% }
.lb-bubble.b2 { width: 15px; height: 15px; left: 34%; animation-duration: 11s; animation-delay: -3s }
.lb-bubble.b3 { width: 34px; height: 34px; left: 66%; animation-duration: 19s; animation-delay: -8s }
.lb-bubble.b4 { width: 19px; height: 19px; left: 88%; animation-duration: 13s; animation-delay: -5s }
@keyframes rise { 0% { transform: translateY(0) scale(.7); opacity: 0 } 12% { opacity: .75 } 100% { transform: translateY(-112vh) scale(1.15); opacity: 0 } }
.lb-star {
  position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 8px 2px rgba(255, 255, 255, .55); animation: twinkle 3.2s ease-in-out infinite;
}
.lb-star.s1 { left: 12%; top: 18% }
.lb-star.s2 { left: 26%; top: 9%; animation-delay: -.7s }
.lb-star.s3 { left: 58%; top: 13%; animation-delay: -1.4s }
.lb-star.s4 { left: 78%; top: 7%; animation-delay: -2.1s }
.lb-star.s5 { left: 92%; top: 22%; animation-delay: -2.7s }
@keyframes twinkle { 0%, 100% { opacity: .25; transform: scale(.8) } 50% { opacity: 1; transform: scale(1.5) } }

/* 顶部：昵称 + 钱包，圆鼓鼓的胶囊 */
.lb-me { background: var(--glass); border: 1px solid var(--glass-line); border-radius: 999px; box-shadow: 0 6px 18px rgba(40, 20, 70, .3) }
.lb-avatar { background: radial-gradient(circle at 42% 34%, #fff6, #ffffff14); border-color: var(--glass-line) }
.lb-name { font-size: 11px; color: var(--ink-candy); cursor: pointer }
.lb-name:hover { color: var(--candy1) }
.lb-lv { color: var(--candy1) }
.wal { background: var(--glass); border: 1px solid var(--glass-line); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25) }
.wal b { color: #fff }

/* 导航：小饼干按钮，按下会弹一下 */
.lb-tab {
  background: var(--glass); border: 1px solid var(--glass-line); border-radius: 16px;
  color: var(--ink-candy); box-shadow: 0 4px 0 rgba(60, 30, 90, .35);
  transition: transform .12s, box-shadow .12s, background .12s;
}
.lb-tab .lb-ic { background: rgba(255, 255, 255, .18); color: #fff; border-radius: 10px }
.lb-tab.active { background: linear-gradient(180deg, #ffe3a8, #ffb85c); border-color: #ffd08a; color: #4a2a10; box-shadow: 0 4px 0 #c97f2b }
.lb-tab.active .lb-ic { background: #fff3; color: #4a2a10 }
.lb-tab:hover { transform: translateY(-2px) }
.lb-tab:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(60, 30, 90, .35) }

/* 舞台：吉祥物 + 糖果标题 */
.lb-mascot { position: relative; width: 108px; height: 108px; margin-bottom: -6px }
#lbMascot { width: 108px; height: 108px; animation: bob 2.8s ease-in-out infinite }
.lb-shadow {
  position: absolute; left: 50%; bottom: 2px; width: 62px; height: 12px; transform: translateX(-50%);
  background: radial-gradient(ellipse, rgba(30, 12, 50, .5), rgba(30, 12, 50, 0) 70%);
  animation: bobShadow 2.8s ease-in-out infinite;
}
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-3deg) } 50% { transform: translateY(-9px) rotate(3deg) } }
@keyframes bobShadow { 0%, 100% { transform: translateX(-50%) scale(1); opacity: .55 } 50% { transform: translateX(-50%) scale(.78); opacity: .3 } }
.lb-title {
  font-weight: 900; letter-spacing: 8px; color: #fff;
  background: linear-gradient(180deg, #fff 20%, #ffe6a8 60%, #ff9fd0);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  text-shadow: none; filter: drop-shadow(0 4px 0 rgba(60, 24, 90, .45));
  animation: wiggle 4.6s ease-in-out infinite;
}
@keyframes wiggle { 0%, 100% { transform: rotate(-1.4deg) } 50% { transform: rotate(1.4deg) translateY(-2px) } }
.lb-sub { color: #f3d9ff; opacity: .85 }
.lb-best { color: var(--candy1) }
.lb-opens { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 10px }
.op {
  font-size: 11px; color: var(--ink-candy); padding: 4px 10px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--glass-line);
}
.op b { color: var(--candy1); font-size: 13px; margin: 0 2px; font-variant-numeric: tabular-nums }
.op.flash { animation: opPop .6s ease }
@keyframes opPop { 40% { transform: scale(1.16); background: rgba(255, 209, 102, .4) } }

/* 面板：磨砂糖盒 */
.lb-panel { background: rgba(28, 18, 56, .5); border: 1px solid var(--glass-line); border-radius: 22px; box-shadow: 0 10px 30px rgba(30, 12, 60, .35) }
.p-head { color: #fff }
.p-sub { color: #e3ccff }
.task, .scard, .mcard, .how-block, .goods {
  background: var(--glass); border: 1px solid var(--glass-line); border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18);
}
.task:hover, .scard:hover, .mcard:hover { transform: translateY(-2px); border-color: rgba(255, 255, 255, .45) }
.task-bar i { background: linear-gradient(90deg, #ffd166, #ff8fc0) }
.scard.inuse, .goods.inuse { border-color: var(--candy3); background: rgba(127, 227, 192, .18) }
.mcard.inuse { border-color: var(--candy1); background: rgba(255, 209, 102, .18) }
.sname, .mname, .goods-name { color: #fff }
.sdesc, .mdesc, .goods-desc, .task-desc { color: #e8d8ff }
.life, .h-row, .lb-log { color: #dcc7f5 }
.life b, .h-row.win { color: #fff }
.h-row { border-bottom: 1px dashed rgba(255, 255, 255, .18) }
.empty { color: #e0caff }

/* 糖果按钮：底部硬阴影 + 按下回弹 */
.btn {
  border: none; border-radius: 16px; color: #3a1f08; font-weight: 900; letter-spacing: .5px;
  background: linear-gradient(180deg, #fff0c4, #ffd383); box-shadow: 0 4px 0 #cf9a3f;
  transition: transform .1s, box-shadow .1s, filter .1s;
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px) }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #cf9a3f }
.btn.primary { background: linear-gradient(180deg, #ffe08a, #ffb03f); box-shadow: 0 5px 0 #c9791f }
.btn.accent { background: linear-gradient(180deg, #b6f4d5, #63d6a4); box-shadow: 0 5px 0 #2f8f66; color: #0e3323 }
.btn.ghost { background: rgba(255, 255, 255, .14); color: var(--ink-candy); box-shadow: 0 4px 0 rgba(60, 30, 90, .4); border: 1px solid var(--glass-line) }
.btn[disabled] { background: rgba(255, 255, 255, .16); color: #cbb8e6; box-shadow: none }
.btn.big { padding: 16px 46px; font-size: 19px; letter-spacing: 4px; border-radius: 22px; animation: heartbeat 2.4s ease-in-out infinite }
@keyframes heartbeat { 0%, 100% { transform: scale(1) } 12% { transform: scale(1.045) } 24% { transform: scale(1) } }
.lb-start-wrap .btn.big { flex: 0 1 auto }

/* 弹层面板也换成糖盒 */
.panel { background: rgba(34, 22, 62, .94); border: 1px solid var(--glass-line); border-radius: 24px }
.card { background: var(--glass); border: 1px solid var(--glass-line) }
.overlay { background: rgba(22, 12, 44, .76) }

/* ---------------- 签到条 ---------------- */
.sign { display: flex; gap: 5px; margin-bottom: 10px; flex-wrap: wrap }
.sign-day {
  flex: 1 1 0; min-width: 38px; text-align: center; font-size: 10px; color: #e8d8ff;
  background: var(--glass); border: 1px solid var(--glass-line); border-radius: 12px; padding: 5px 2px;
}
.sign-day b { display: block; font-size: 12px; color: var(--candy1) }
.sign-day.done { background: rgba(127, 227, 192, .22); border-color: var(--candy3); color: #0e3323 }
.sign-day.done b { color: #eafff5 }
.sign-day.now { border-color: var(--candy1); animation: opPop 1.2s ease-in-out infinite }
.sign-in { width: 100%; margin-top: 2px }

/* ---------------- 成就 ---------------- */
.ach {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 6px;
  background: var(--glass); border: 1px solid var(--glass-line); border-radius: 14px;
}
.ach.done { border-color: var(--candy3); background: rgba(127, 227, 192, .16) }
.ach.claimed { opacity: .5 }
.ach-t { font-size: 13px; font-weight: 800; color: #fff }
.ach-d { font-size: 11px; color: #e0caff }
.ach-main { flex: 1; display: flex; flex-direction: column; gap: 2px }
.ach-rw { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; color: #92f0a8 }

/* ---------------- 扭蛋机 ---------------- */
.gacha { display: flex; flex-direction: column; gap: 10px; align-items: center }
.gacha-machine {
  position: relative; width: min(220px, 62vw); aspect-ratio: 1 / 1; border-radius: 50% 50% 42% 42%;
  background: radial-gradient(circle at 34% 26%, rgba(255,255,255,.55), rgba(255,255,255,.06) 60%), linear-gradient(180deg, #ff9fd0, #b7589f);
  border: 2px solid rgba(255, 255, 255, .5); overflow: hidden;
}
.gacha-machine.shake { animation: gshake .5s ease }
@keyframes gshake { 0%, 100% { transform: rotate(0) } 20% { transform: rotate(-5deg) translateX(-3px) } 60% { transform: rotate(5deg) translateX(3px) } }
.gacha-ball {
  position: absolute; border-radius: 50%; background: radial-gradient(circle at 32% 28%, #fff, #ffd166 70%);
  box-shadow: inset -3px -4px 0 rgba(0, 0, 0, .12); animation: ballFloat 3.4s ease-in-out infinite;
}
@keyframes ballFloat { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-7px) } }
.gacha-note { font-size: 11px; color: #e0caff; text-align: center; line-height: 1.7 }
.gacha-log { font-size: 12px; color: #fff; text-align: center; min-height: 18px }
.pity-bar { width: 100%; height: 8px; border-radius: 6px; background: rgba(20, 12, 40, .6); overflow: hidden }
.pity-bar i { display: block; height: 100%; background: linear-gradient(90deg, #7fe3c0, #ffd166) }

/* ---------------- 设置 ---------------- */
.set-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px dashed rgba(255, 255, 255, .16); font-size: 13px; color: #fff }
.set-row:last-child { border-bottom: none }
.set-row .set-desc { font-size: 11px; color: #e0caff; margin-top: 2px }
.set-main { flex: 1 }
.switch {
  pointer-events: auto; cursor: pointer; font-family: inherit; flex: none;
  width: 54px; height: 28px; border-radius: 999px; border: 1px solid var(--glass-line);
  background: rgba(20, 12, 40, .55); position: relative; color: inherit; font-size: 0;
}
.switch i { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #cbb8e6; transition: left .16s, background .16s }
.switch.on { background: linear-gradient(90deg, #7fe3c0, #4bc08a) }
.switch.on i { left: 29px; background: #fff }
.nick-input {
  pointer-events: auto; font-family: inherit; width: 130px; padding: 8px 10px; font-size: 13px;
  border-radius: 12px; border: 1px solid var(--glass-line); background: rgba(20, 12, 40, .6); color: #fff;
}

.mcard .ob-tip { color: #ffd88a; font-size: 10.5px }

@media (prefers-reduced-motion: reduce) {
  .lb-bubble, .lb-cloud, .lb-star, .lb-title, .btn.big, #lbMascot, .lb-shadow, .gacha-ball, .gacha-machine.shake { animation: none }
}

/* ============================================================
   手机竖屏 + 触控：44px 以上可点区域、刘海安全区、面板能滑动
   ============================================================ */
.lb-panel, .overlay { touch-action: pan-y }
.lb-nav { touch-action: pan-x }
.switch, .lb-tab, .btn, .goods, .mcard, .scard { touch-action: manipulation }

@media (max-width: 760px), (orientation: portrait) {
  /* 战斗 HUD：竖屏宽度紧，字号与条宽收一档 */
  .timer { font-size: 18px }
  .wave-label { font-size: 11px }
  .hud-stats { gap: 8px }
  .stat { font-size: 12px }
  .xp-bar { min-width: 88px; height: 18px }
  .hp-bar { top: calc(46px + env(safe-area-inset-top)); width: min(300px, 60vw); height: 12px }
  .build { top: calc(64px + env(safe-area-inset-top)); gap: 4px }
  .chip { font-size: 11px; padding: 3px 8px 3px 5px }
  .hint { max-width: min(420px, 60vw); font-size: 10.5px }
  .pause-btn { width: 56px; height: 56px; font-size: 16px }

  /* 手指点得动：所有主要按钮高度不小于 44px */
  .lb-tab { min-height: 46px; padding: 7px 8px }
  .btn { min-height: 44px }
  .btn.small { min-height: 40px; padding: 9px 14px }
  .wal { padding: 8px 12px }
  .switch { min-width: 52px }

  /* 大厅：竖屏留给面板更多高度，舞台缩小让位 */
  .lobby { gap: 6px }
  .lb-stage { padding-top: 0 }
  .lb-mascot, #lbMascot { width: 84px; height: 84px }
  .lb-title { letter-spacing: 5px }
  .lb-panel { max-height: 46vh }
  .lb-log { max-height: 32px }
  .panel-actions { flex-direction: column }
  .panel-actions .btn { width: 100% }
  .panel-actions.column { flex-direction: column }
  .cards { gap: 8px }
}

/* 横屏手机：高度很矮，能省则省 */
@media (max-height: 520px) {
  .lb-mascot, #lbMascot { width: 62px; height: 62px }
  .lb-title { font-size: 22px; letter-spacing: 4px }
  .lb-opens { margin-top: 4px }
  .lb-panel { max-height: 44vh }
  .lb-log { display: none }
  #stick { width: min(130px, 30vh); height: min(130px, 30vh) }
}
