:root {
  --bg: #060911;
  --bg2: #0b1224;
  --line: rgba(120, 180, 255, 0.16);
  --ink: #e8f1ff;
  --dim: #7d8aa8;
  --cyan: #4be3ff;
  --violet: #b489ff;
  --gold: #ffcf5c;
  --rose: #ff5f8f;
  --mint: #7ef0d0;
  --hud-h: 54px;
  --hand-h: 96px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}

#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  background:
    radial-gradient(120% 70% at 50% -10%, #16224a 0%, rgba(6, 9, 17, 0) 62%),
    radial-gradient(90% 60% at 50% 110%, #1a1030 0%, rgba(6, 9, 17, 0) 60%),
    var(--bg);
}

/* ---------- HUD ---------- */
#hud {
  flex: 0 0 auto;
  height: var(--hud-h);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(18, 28, 52, 0.92), rgba(9, 13, 24, 0.72));
  backdrop-filter: blur(6px);
}

.hud-cell {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 3px 2px;
  border-radius: 9px;
  background: rgba(120, 170, 255, 0.06);
  border: 1px solid rgba(120, 170, 255, 0.1);
}
.hud-cell em {
  font-style: normal;
  font-size: 10px;
  letter-spacing: .12em;
  color: var(--dim);
}
.hud-cell b {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  color: var(--ink);
}
.hud-cell.energy b { color: var(--gold); display: inline-block; }
.hud-cell.energy b.pop { animation: energyPop .28s ease-out; }
@keyframes energyPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.2); color: #fff6c8; }
  100% { transform: scale(1); }
}
.hud-cell.hp b { color: var(--mint); }
.hud-cell.hp.low b { color: var(--rose); }
.hud-cell.season { flex: 0 0 auto; min-width: 46px; }
.hud-cell.season b { font-size: 13px; letter-spacing: .04em; }

/* 季节更替横幅 */
.season-banner {
  position: absolute; left: 0; right: 0; top: 16%; z-index: 6;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  opacity: 0; transform: scale(.86); pointer-events: none;
  transition: opacity .3s ease, transform .34s cubic-bezier(.2, 1.5, .4, 1);
  text-shadow: 0 4px 20px rgba(0, 0, 0, .7);
}
.season-banner.show { opacity: 1; transform: scale(1); }
.season-banner i { font-style: normal; font-size: 30px; line-height: 1; }
.season-banner b { font-size: 19px; letter-spacing: .18em; }
.season-banner span { font-size: 11px; letter-spacing: .06em; opacity: .88; }

.hud-btns { display: flex; gap: 5px; }
.mini {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(120, 180, 255, 0.24);
  background: rgba(120, 180, 255, 0.08);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
}
.mini:active { transform: scale(0.94); background: rgba(120, 180, 255, 0.2); }

/* ---------- 海克斯条 ---------- */
#hexbar {
  flex: 0 0 auto;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
#hexbar::-webkit-scrollbar { display: none; }
.hexbar-tip {
  font-size: 10px;
  letter-spacing: .18em;
  color: rgba(140, 160, 200, 0.5);
  flex: 0 0 auto;
}
.hex-chip {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  animation: chipIn .35s ease-out;
  border: 1px solid rgba(255, 255, 255, 0.14);
}
@keyframes chipIn { from { transform: scale(0.2) rotate(-30deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 战场 ---------- */
#stageWrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
#stage {
  display: block;
  touch-action: none;
  max-width: 100%;
  max-height: 100%;
}

.wave-tip {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%) scale(0.8);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: .16em;
  color: var(--ink);
  text-shadow: 0 0 18px rgba(75, 227, 255, 0.85), 0 0 42px rgba(75, 227, 255, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.wave-tip.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* ---------- 手牌 ---------- */
#hand {
  flex: 0 0 auto;
  height: var(--hand-h);
  display: flex;
  gap: 7px;
  padding: 7px 10px calc(7px + env(safe-area-inset-bottom));
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  scroll-snap-type: x proximity;
  border-top: 1px solid var(--line);
  background: linear-gradient(0deg, rgba(14, 20, 38, 0.96), rgba(9, 13, 24, 0.7));
}
#hand::-webkit-scrollbar { display: none; }

.card {
  position: relative;
  flex: 0 0 auto;
  width: 62px;
  scroll-snap-align: center;
  border: 1px solid rgba(120, 180, 255, 0.2);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(34, 48, 84, 0.9), rgba(14, 20, 36, 0.95));
  color: var(--ink);
  padding: 3px 2px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  overflow: hidden;
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.card .thumb { width: 40px; height: 40px; display: block; }
.card .cname {
  font-size: 10.5px;
  line-height: 1.15;
  color: #c8d8f5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.card .cost {
  position: absolute;
  right: 3px;
  top: 3px;
  font-size: 10.5px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 6px;
  background: rgba(255, 207, 92, 0.16);
  color: var(--gold);
  border: 1px solid rgba(255, 207, 92, 0.3);
}
.card .cdmask {
  position: absolute;
  inset: 0;
  background: rgba(4, 7, 14, 0.72);
  pointer-events: none;
  transform-origin: bottom;
  transform: scaleY(0);
  transition: transform .1s linear;
}
.card.sel {
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan), 0 0 16px rgba(75, 227, 255, 0.5);
  transform: translateY(-4px);
}
.card.poor { opacity: 0.55; }
.card:disabled { cursor: default; }
/* 选中/按下都有过渡，不再硬跳 */
.card {
  transition: transform .16s cubic-bezier(.2, .9, .3, 1.2),
              border-color .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.card:active { transform: translateY(-2px) scale(.96); }

/* ---------- 通用按钮 / 弹层 ---------- */
.btn {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(120, 180, 255, 0.28);
  background: rgba(120, 180, 255, 0.1);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .06em;
  cursor: pointer;
  margin-top: 8px;
}
.btn.primary {
  background: linear-gradient(180deg, #3fd2ff, #1a7fd4);
  border-color: rgba(150, 240, 255, 0.6);
  color: #04121f;
  box-shadow: 0 6px 20px rgba(40, 180, 255, 0.35);
}
.btn.primary:disabled { filter: grayscale(0.7) brightness(0.7); box-shadow: none; }
.btn.ghost { background: rgba(255, 255, 255, 0.04); }
.btn.big { padding: 15px; font-size: 16px; }
/* 出售二次确认态 */
#btnSell.confirming {
  background: rgba(255, 95, 143, 0.18);
  border-color: rgba(255, 95, 143, 0.7);
  color: #ffc2d2;
  animation: sellPulse .6s ease-in-out infinite alternate;
}
@keyframes sellPulse {
  from { box-shadow: 0 0 0 rgba(255, 95, 143, 0); }
  to { box-shadow: 0 0 16px rgba(255, 95, 143, 0.55); }
}
.btn:active { transform: scale(0.98); }

.overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(3, 6, 12, 0.78);
  backdrop-filter: blur(9px);
  z-index: 20;
}
.overlay.show { display: flex; animation: fadeIn .18s ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
/* 守卫详情这类轻遮罩：战场保持可见，只轻压一层 */
.overlay.light {
  background: rgba(3, 6, 12, 0.16);
  backdrop-filter: none;
}
/* 面板进出：轻微上浮 + 回弹，避免硬切 */
.overlay.show .panel { animation: panelIn .26s cubic-bezier(.2, .9, .3, 1.15); }
@keyframes panelIn {
  from { opacity: 0; transform: translateY(16px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 拖拽时跟随手指的守卫残影 */
#dragGhost {
  position: fixed;
  left: 0;
  top: 0;
  width: 88px;
  height: 88px;
  z-index: 45;
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s ease-out;
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, .55));
  will-change: transform;
}
#dragGhost.on { opacity: .92; }
#dragGhost img,
#dragGhost canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: ghostBob .7s ease-in-out infinite alternate;
}
@keyframes ghostBob {
  from { transform: translateY(-2px) scale(.99); }
  to { transform: translateY(2px) scale(1.01); }
}

/* 光能不足 / 位置非法时卡片抖一下 */
.card.shake { animation: cardShake .32s cubic-bezier(.36, .07, .19, .97); }

/* ---------------- 波间补给站 ---------------- */
#supply {
  position: fixed; left: 50%; bottom: 12px;
  transform: translate(-50%, 150%);
  width: min(560px, calc(100% - 20px));
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(24, 36, 66, .97), rgba(10, 16, 30, .97));
  border: 1px solid rgba(255, 224, 102, .35);
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .5), 0 0 18px rgba(255, 200, 80, .08);
  transition: transform .28s cubic-bezier(.34, 1.3, .5, 1);
  z-index: 6;
}
#supply.show { transform: translate(-50%, 0); }
#supply > b {
  display: block; font-size: 12px; letter-spacing: .06em;
  color: #ffe066; margin-bottom: 8px; text-align: center;
}
.sup-row { display: flex; gap: 8px; }
.sup-btn {
  flex: 1; display: flex; flex-direction: column; gap: 3px;
  padding: 10px 8px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(140, 180, 240, .3);
  border-radius: 10px;
  color: #fff; font: inherit; text-align: left;
  cursor: pointer; transition: border-color .15s, background .15s, transform .12s;
}
.sup-btn:hover { border-color: rgba(255, 224, 102, .7); background: rgba(255, 224, 102, .08); transform: translateY(-2px); }
.sup-btn.poor { opacity: .45; cursor: not-allowed; }
.sup-btn.poor:hover { border-color: rgba(140, 180, 240, .3); background: rgba(255, 255, 255, .05); transform: none; }
.sup-btn b { font-size: 12px; color: #fff; }
.sup-btn i { font-style: normal; font-size: 10.5px; line-height: 1.35; color: #a9bdd9; }
.sup-btn span { font-size: 11px; color: #ffe066; margin-top: auto; }
@media (max-width: 640px) {
  .sup-row { flex-direction: column; }
  .sup-btn { flex-direction: row; align-items: baseline; gap: 6px; }
  .sup-btn span { margin: 0 0 0 auto; }
}

/* 菜单 · 今日突变预告 */
.mut-chip {
  margin: 10px 0 0; padding: 8px 12px;
  font-size: 11.5px; line-height: 1.5;
  color: #ffd98a; text-align: left;
  background: rgba(255, 200, 80, .07);
  border: 1px dashed rgba(255, 200, 80, .35);
  border-radius: 10px;
}
@keyframes cardShake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px); }
}

.panel {
  width: 100%;
  max-width: 360px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 20px 18px;
  border-radius: 20px;
  border: 1px solid rgba(120, 180, 255, 0.22);
  background: linear-gradient(180deg, rgba(22, 33, 60, 0.98), rgba(8, 12, 22, 0.98));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  text-align: center;
}
.panel h1, .panel h2, .panel h3 { margin: 0 0 8px; }
.panel h2 { font-size: 20px; letter-spacing: .1em; }
.panel h2.danger { color: var(--rose); }
.panel p { margin: 6px 0; font-size: 12.5px; line-height: 1.65; color: #a9b8d6; }
/* 手机上面板正文与按钮放大一档，不用眯眼看 */
@media (max-width: 430px) {
  .panel p { font-size: 13.5px; line-height: 1.7; }
  .btn { font-size: 15px; }
  .rule-list p { font-size: 12.5px; }
  .ins-stats .st { font-size: 13px; }
  .ins-desc { font-size: 12px; }
  .hex-card .hx-name { font-size: 15px; }
  .hex-card .hx-desc { font-size: 12px; }
}

.title {
  font-size: 30px;
  letter-spacing: .22em;
  font-weight: 800;
  background: linear-gradient(180deg, #ffffff, #6fd8ff 60%, #3a8fe0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 26px rgba(75, 227, 255, 0.4);
}
.subtitle { font-size: 9.5px; letter-spacing: .3em; color: rgba(140, 170, 220, 0.6); margin-bottom: 14px !important; }
.rule-list { margin: 10px 0 4px; padding: 10px; border-radius: 12px; background: rgba(120, 180, 255, 0.06); border: 1px solid rgba(120, 180, 255, 0.1); text-align: left; }
.rule-list b { color: var(--gold); }
.best { font-size: 12px; color: var(--dim); margin: 12px 0 4px; }
.best b { color: var(--cyan); font-size: 15px; }

/* 海克斯卡 */
.hex-title { font-size: 21px; letter-spacing: .14em; }
.hex-sub { font-size: 11px; color: var(--dim); margin-bottom: 14px !important; }
.hex-cards { display: flex; flex-direction: column; gap: 10px; }
.hex-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  animation: hexIn .32s cubic-bezier(.2, 1.4, .5, 1) backwards;
}
.hex-card:nth-child(2) { animation-delay: .07s; }
.hex-card:nth-child(3) { animation-delay: .14s; }
@keyframes hexIn { from { opacity: 0; transform: translateY(16px) scale(.94); } to { opacity: 1; transform: none; } }
.hex-card:active { transform: scale(0.985); }
.hex-card .hx-icon { width: 46px; height: 46px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 11px; animation: hxFloat 3.4s ease-in-out infinite; }
.hex-card:nth-child(2) .hx-icon { animation-delay: .6s; }
.hex-card:nth-child(3) .hx-icon { animation-delay: 1.2s; }
@keyframes hxFloat {
  0%, 100% { transform: translateY(0) rotate(-2deg) scale(1); }
  50% { transform: translateY(-3px) rotate(2deg) scale(1.04); }
}
.hex-card { transition: transform .16s ease, box-shadow .16s ease; }
.hex-card:hover { transform: translateY(-2px); }
.hex-card .hx-body { min-width: 0; flex: 1 1 auto; }
.hex-card .hx-name { font-size: 14px; font-weight: 800; letter-spacing: .04em; }
.hex-card .hx-rarity { font-size: 9px; letter-spacing: .2em; opacity: .8; }
.hex-card .hx-desc { font-size: 11.5px; line-height: 1.5; color: #b9c8e4; margin-top: 3px; }
.hex-card.r0 { border-color: rgba(170, 195, 230, 0.4); background: linear-gradient(100deg, rgba(150, 175, 210, 0.2), rgba(20, 28, 46, 0.95)); }
.hex-card.r0 .hx-name { color: #dbe7fb; }
.hex-card.r1 { border-color: rgba(180, 137, 255, 0.55); background: linear-gradient(100deg, rgba(140, 100, 240, 0.26), rgba(22, 20, 48, 0.95)); box-shadow: 0 0 22px rgba(150, 110, 255, 0.18); }
.hex-card.r1 .hx-name { color: #d9c6ff; }
.hex-card.r2 { border-color: rgba(255, 207, 92, 0.62); background: linear-gradient(100deg, rgba(255, 190, 60, 0.24), rgba(44, 30, 16, 0.95)); box-shadow: 0 0 26px rgba(255, 190, 60, 0.22); }
.hex-card.r2 .hx-name { color: #ffe6a8; }

/* 结算 */
.stat-row { display: flex; justify-content: space-between; padding: 8px 4px; font-size: 13px; color: #a9b8d6; border-bottom: 1px dashed rgba(120, 180, 255, 0.12); }
.stat-row b { color: var(--ink); }
.hex-got { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; margin: 12px 0 2px; }

/* 守卫详情 */
.inspect-panel h3 { font-size: 17px; letter-spacing: .1em; }
.ins-art { display: grid; place-items: center; margin: 2px 0 6px; }
.ins-stats { display: flex; flex-direction: column; gap: 4px; }
.ins-stats .st { display: flex; justify-content: space-between; font-size: 12px; color: #a9b8d6; padding: 3px 6px; border-radius: 6px; background: rgba(120, 180, 255, 0.05); }
.ins-stats .st b { color: var(--ink); font-variant-numeric: tabular-nums; }
.ins-desc { font-size: 11px; color: #8c9cbd; margin-top: 8px; line-height: 1.5; }

/* 提示条 */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--hand-h) + 22px);
  transform: translate(-50%, 10px);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #06121f;
  background: linear-gradient(180deg, #8ef0ff, #37b7e6);
  box-shadow: 0 8px 24px rgba(40, 180, 255, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 30;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-height: 640px) {
  :root { --hud-h: 46px; --hand-h: 84px; }
  .card { width: 56px; }
  .card .thumb { width: 34px; height: 34px; }
  .title { font-size: 24px; }
}

/* 窄屏手机：压缩手牌，7 个守卫尽量一屏铺满，超出仍可横向滑动 */
@media (max-width: 430px) {
  :root { --hud-h: 48px; --hand-h: 88px; }
  #hexbar { height: 28px; }
  #hand { gap: 4px; padding-left: 8px; padding-right: 8px; scroll-snap-type: none; }
  .card { width: 47px; border-radius: 10px; padding: 2px 1px 1px; }
  .card .thumb { width: 32px; height: 32px; }
  .card .cname { font-size: 10px; letter-spacing: -.02em; }
  .card .cost { font-size: 9.5px; padding: 0 3px; right: 2px; top: 2px; }
  .guide img { width: 46px; height: 46px; }
  .guide { max-width: 80%; }
  .nova { right: 8px; padding: 6px 9px; }
  .nova-name { font-size: 12px; }
  .nova-sub { font-size: 10.5px; }
  .toast { font-size: 13px; }
  .hud-cell em { font-size: 9px; }
  .hud-cell b { font-size: 15px; }
}

/* 超窄屏（320~360）：卡名保底 9px，超出可滑动 */
@media (max-width: 360px) {
  #hand { gap: 3px; padding-left: 6px; padding-right: 6px; }
  .card { width: 42px; }
  .card .thumb { width: 29px; height: 29px; }
  .card .cname { font-size: 9px; }
  .card .cost { font-size: 9px; }
}

/* 横屏手机：压扁上下栏，把高度还给棋盘 */
@media (orientation: landscape) and (max-height: 520px) {
  :root { --hud-h: 38px; --hand-h: 62px; }
  #hexbar { height: 24px; }
  .title { font-size: 22px; }
  #hand { gap: 3px; padding: 3px 8px calc(3px + env(safe-area-inset-bottom)); }
  .card { width: 44px; padding: 1px; }
  .card .thumb { width: 27px; height: 27px; }
  .card .cname { font-size: 9px; }
  .guide img { width: 40px; height: 40px; }
  .guide-msg { font-size: 11px; }
}

/* ---------- 章节系统 ---------- */
.ch-list { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 4px; width: 100%; }
.ch-card {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: 14px; border: 1px solid rgba(255,255,255,.10);
  background: linear-gradient(100deg, rgba(255,255,255,.06), rgba(10,14,26,.9));
  cursor: pointer; text-align: left;
  transition: transform .15s ease, border-color .15s ease;
}
.ch-card:not(.locked):hover { transform: translateY(-2px); border-color: rgba(120,220,255,.5); }
.ch-card.locked { opacity: .45; filter: grayscale(.6); }
/* 噩梦难度开关 */
.hard-toggle { letter-spacing: .08em; }
.hard-toggle.on {
  border-color: rgba(255, 95, 143, .7);
  color: #ffb3c6;
  background: rgba(255, 95, 143, .12);
}
.hard-toggle.locked { opacity: .45; }
/* 回廊契约卡：诅咒红 / 强化绿 */
.hex-card.contract { border-color: rgba(255, 122, 89, .55); }
.contract-curse { color: #ff8a7a !important; }
.contract-boon { color: #9dffb8 !important; margin-top: 3px; }
.hex-panel .btn.ghost { margin-top: 12px; }
.ch-thumb { width: 96px; height: 64px; border-radius: 10px; flex: 0 0 auto; }
.ch-info { min-width: 0; flex: 1 1 auto; }
.ch-name { font-weight: 800; font-size: 14px; color: var(--ink); }
.ch-sub { font-size: 10.5px; color: #9fb0cf; margin-top: 2px; }
.ch-stars-mini { font-size: 12px; color: #ffcf5c; margin-top: 3px; letter-spacing: 2px; }

/* 章末结算面板 */
.chapter-panel { text-align: center; }
.ch-done-tag { font-size: 11px; letter-spacing: .3em; color: #8fd8ff; }
/* 通关解锁的新守卫横幅 */
.ch-unlock {
  display: flex; align-items: center; gap: 10px;
  width: 100%; margin: 10px 0 4px; padding: 10px 12px;
  border-radius: 14px; text-align: left;
  border: 1px solid rgba(255, 207, 92, .55);
  background: linear-gradient(140deg, rgba(255, 207, 92, .16), rgba(255, 255, 255, .03));
  box-shadow: 0 6px 22px rgba(255, 190, 60, .18);
  animation: panelIn .4s cubic-bezier(.2, .9, .3, 1.15);
}
.ch-unlock[hidden] { display: none; }
.ch-unlock-tag {
  position: absolute; transform: translateY(-34px);
  font-size: 10px; letter-spacing: .24em; color: #ffd86b; font-weight: 700;
}
.ch-unlock canvas { width: 48px; height: 48px; flex: 0 0 auto; }
.ch-unlock-info b { display: block; font-size: 14px; color: #ffe9a8; }
.ch-unlock-info i { display: block; font-size: 11px; font-style: normal; color: #c2b48a; margin-top: 2px; line-height: 1.45; }
.ch-done-name { font-size: 26px; margin: 6px 0 10px; color: var(--ink); }
.ch-stars { font-size: 34px; letter-spacing: 8px; margin-bottom: 8px; }
.ch-stars b { color: rgba(255,255,255,.16); font-weight: 400; }
.ch-stars b.on { color: #ffcf5c; text-shadow: 0 0 18px rgba(255,200,60,.65); }
.ch-done-desc { font-size: 12.5px; color: #b9c8e4; margin-bottom: 14px; line-height: 1.7; }

/* 看板娘向导 */
.menu-guide-wrap { display: flex; justify-content: center; margin-bottom: -4px; }
.menu-guide {
  width: 148px; height: auto;
  filter: drop-shadow(0 12px 26px rgba(80, 200, 255, .38));
  animation: guideBob 3.2s ease-in-out infinite;
}
@keyframes guideBob {
  0%, 100% { transform: translateY(0) rotate(-1.2deg); }
  50% { transform: translateY(-8px) rotate(1.2deg); }
}
.guide {
  position: absolute; left: 8px; bottom: 8px; z-index: 5;
  display: flex; align-items: flex-end; gap: 6px; max-width: 74%;
  opacity: 0; transform: translateY(10px);
  transition: opacity .22s ease, transform .22s ease;
  pointer-events: none;
}
.guide.show { opacity: 1; transform: none; }
.guide img {
  width: 60px; height: 60px; object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .5));
  animation: guideBob 3.6s ease-in-out infinite;
}
.guide-bubble {
  background: rgba(10, 20, 36, .93);
  border: 1px solid rgba(120, 220, 255, .45);
  color: #dff0ff; font-size: 11.5px; line-height: 1.55;
  padding: 7px 10px; border-radius: 12px; border-bottom-left-radius: 3px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .4);
}

/* 棱镜新星技能按钮 */
.nova {
  position: absolute; right: 10px; bottom: 10px; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  width: 76px; height: 76px; border-radius: 50%;
  border: 2px solid rgba(140,230,255,.75);
  background: radial-gradient(circle at 35% 30%, rgba(90,220,255,.4), rgba(15,30,55,.92));
  color: #dff6ff; cursor: pointer;
  animation: novaPulse 2.6s ease-in-out infinite;
}
.nova b { font-size: 20px; line-height: 1; }
.nova-name { font-size: 10px; font-weight: 700; }
.nova-sub { font-size: 9px; opacity: .85; }
.nova.cd { filter: grayscale(.7); opacity: .6; animation: none; }
.nova.poor { opacity: .55; }
@keyframes novaPulse {
  0%, 100% { box-shadow: 0 0 14px rgba(75,227,255,.3), inset 0 0 12px rgba(75,227,255,.2); }
  50% { box-shadow: 0 0 26px rgba(75,227,255,.55), inset 0 0 16px rgba(75,227,255,.35); }
}

/* ---------- 向导皮肤 ---------- */
.menu-say {
  min-height: 18px; margin: 2px 0 8px;
  font-size: 11.5px; line-height: 1.5; text-align: center;
  color: #bfe6ff; opacity: 0; transition: opacity .2s ease;
}
.menu-say.show { opacity: 1; }
.menu-guide { cursor: pointer; }
.skin-open { margin-top: 10px; }
/* 主菜单里的外部页面入口（外卖占卜） */
.side-link {
  display: block; margin-top: 10px; text-align: center;
  text-decoration: none; color: #9fe0ff !important;
  border-color: rgba(102, 224, 255, .35) !important;
}

/* ---------- 主菜单重排 ---------- */
.menu-panel {
  position: relative; overflow: hidden;
  max-width: 430px; padding: 26px 20px 20px;
  background:
    linear-gradient(rgba(120, 180, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 180, 255, .035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(22, 33, 60, .98), rgba(8, 12, 22, .98));
  background-size: 26px 26px, 26px 26px, 100% 100%;
}
/* 漂浮光斑：给静态面板加一点生命感 */
.menu-panel::before, .menu-panel::after {
  content: ""; position: absolute; border-radius: 50%;
  pointer-events: none; filter: blur(30px);
}
.menu-panel::before {
  width: 150px; height: 150px; left: -40px; top: 8%;
  background: rgba(80, 180, 255, .14);
  animation: floatBlob 9s ease-in-out infinite;
}
.menu-panel::after {
  width: 120px; height: 120px; right: -36px; bottom: 6%;
  background: rgba(160, 120, 255, .12);
  animation: floatBlob 11s ease-in-out infinite reverse;
}
@keyframes floatBlob {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(24px, -30px) scale(1.15); }
}
.menu-hero {
  position: relative; z-index: 1; padding: 6px 0 14px; margin-bottom: 6px;
  border-radius: 16px;
  background: radial-gradient(ellipse 70% 90% at 50% 0%, rgba(90, 180, 255, .16), transparent 70%);
}
.menu-hero .title { position: relative; z-index: 1; }
.menu-guide-wrap { position: relative; z-index: 1; }
.menu-hero .subtitle { position: relative; z-index: 1; }
.menu-panel > .ch-list, .menu-panel > .menu-row, .menu-panel > .rule-box,
.menu-panel > .best, .menu-panel > .side-links { position: relative; z-index: 1; }
.menu-hero .title { font-size: 38px; animation: titleGlow 3.2s ease-in-out infinite; }
@keyframes titleGlow {
  0%, 100% { text-shadow: 0 0 22px rgba(75, 227, 255, .35); }
  50% { text-shadow: 0 0 38px rgba(75, 227, 255, .65); }
}
.menu-guide-wrap { display: flex; justify-content: center; margin-bottom: 4px; }
.menu-guide { width: 96px; height: 96px; filter: drop-shadow(0 8px 22px rgba(80, 190, 255, .3)); }
.menu-row { display: flex; gap: 8px; margin-top: 10px; }
.menu-row .btn { flex: 1; }
.menu-row.three .btn { padding: 9px 6px; font-size: 12.5px; }

/* 规则折叠框 */
.rule-box { margin-top: 10px; border-radius: 12px; border: 1px solid rgba(120, 180, 255, .14); background: rgba(120, 180, 255, .05); }
.rule-box summary {
  list-style: none; cursor: pointer; padding: 9px 12px;
  font-size: 12.5px; color: #9fc6ee; letter-spacing: .08em;
  display: flex; align-items: center; justify-content: space-between;
}
.rule-box summary::after { content: '▾'; color: #6b87ad; transition: transform .2s; }
.rule-box[open] summary::after { transform: rotate(180deg); }
.rule-box summary::-webkit-details-marker { display: none; }
.rule-box .rule-list { margin: 0 10px 10px; }

/* 副站卡片 */
.side-links { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.side-card {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 13px; border-radius: 14px; text-decoration: none;
  background: linear-gradient(100deg, rgba(102, 224, 255, .08), rgba(102, 224, 255, .02) 60%);
  border: 1px solid rgba(102, 224, 255, .22);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.side-card:hover {
  transform: translateY(-2px);
  border-color: rgba(102, 224, 255, .55);
  box-shadow: 0 8px 22px rgba(60, 150, 255, .18);
}
.side-card .sc-icon { font-size: 22px; flex: 0 0 auto; }
.side-card .sc-body { flex: 1; text-align: left; min-width: 0; }
.side-card .sc-body b { display: block; font-size: 13.5px; color: #eaf6ff; }
.side-card .sc-body i { font-style: normal; font-size: 10.5px; color: #8fa2c4; }
.side-card .sc-arrow { color: #6fd8ff; opacity: .7; transition: transform .15s; }
.side-card:hover .sc-arrow { transform: translateX(3px); opacity: 1; }

@media (max-width: 430px) {
  .menu-panel { max-width: 100%; }
  .menu-hero .title { font-size: 30px; }
}

.skin-panel { max-width: 440px; }
.skin-title { font-size: 20px; text-align: center; color: var(--ink); }
.skin-tip { font-size: 11px; color: #93a6c8; text-align: center; margin: 4px 0 12px; }
.skin-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px; width: 100%; margin-bottom: 12px;
}
.skin-card {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 9px 6px 7px; border-radius: 14px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .1);
  background: linear-gradient(160deg, rgba(255, 255, 255, .07), rgba(10, 16, 30, .9));
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.skin-card:hover { transform: translateY(-2px); }
.skin-card img { width: 74px; height: 74px; object-fit: contain; }
.skin-card b { font-size: 12.5px; color: var(--ink); }
.skin-card i { font-size: 9.5px; font-style: normal; color: #8fa2c4; text-align: center; line-height: 1.35; }

/* 成就列表 */
.ach-list {
  display: flex; flex-direction: column; gap: 7px;
  width: 100%; margin-bottom: 12px; max-height: 52vh; overflow-y: auto;
}
.ach-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .03);
  transition: border-color .2s ease, background .2s ease;
}
.ach-item .ach-icon {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 9px;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 800;
  background: rgba(255, 255, 255, .07); color: #6d7d99;
}
.ach-item .ach-body { flex: 1 1 auto; min-width: 0; }
.ach-item .ach-name { display: block; font-size: 12.5px; font-weight: 700; color: #8b9ab5; }
.ach-item .ach-desc { display: block; font-size: 10.5px; color: #6c7a93; margin-top: 1px; }
.ach-item.on {
  border-color: rgba(255, 207, 92, .45);
  background: linear-gradient(140deg, rgba(255, 207, 92, .14), rgba(255, 255, 255, .02));
}
.ach-item.on .ach-icon {
  background: linear-gradient(160deg, #ffd86b, #e39b1f);
  color: #2a1a04;
  box-shadow: 0 4px 14px rgba(255, 190, 60, .35);
}
.ach-item.on .ach-name { color: #ffe9a8; }
.ach-item.on .ach-desc { color: #c2ab7d; }

/* 海克斯图鉴 */
.hexdex-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px; width: 100%; margin-bottom: 12px; max-height: 52vh; overflow-y: auto;
}
.hexdex-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 9px; border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .07);
  background: rgba(255, 255, 255, .02);
}
.hexdex-item canvas { width: 30px; height: 30px; flex: 0 0 auto; opacity: .18; filter: grayscale(1); }
.hexdex-item .hx-body { min-width: 0; }
.hexdex-item .hx-name { display: block; font-size: 11.5px; font-weight: 700; color: #7b8aa5; }
.hexdex-item .hx-desc {
  display: block; font-size: 9.5px; color: #5d6b84;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hexdex-item.on {
  border-color: rgba(120, 200, 255, .32);
  background: linear-gradient(140deg, rgba(90, 180, 255, .1), rgba(255, 255, 255, .02));
}
.hexdex-item.on canvas { opacity: 1; filter: none; }
.hexdex-item.on .hx-name { color: var(--ink); }
.hexdex-item.on .hx-desc { color: #9db3d4; white-space: normal; }
.skin-card.on { border-color: rgba(120, 230, 255, .78); box-shadow: 0 0 18px rgba(80, 220, 255, .35); }
.skin-card.locked { opacity: .45; filter: grayscale(.65); }
