/* 月面情绪棋 — 月下绘本界面语言。展示字体：马善政毛笔（标题）+ 霞鹜文楷
   （正文），本地 woff2 按游戏字符集子集化。夜金雕花面板 + 立体按钮 +
   宝石徽记。零外网请求。字体 URL 带版本号——子集随文案重建时递增，
   避免被 immutable 缓存钉住旧字形。 */

@font-face {
  font-family: 'Kai';
  src: url('assets/fonts/kai.woff2?v=20260723') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap; /* swap 只会落在 loading 占位文案上 */
}

@font-face {
  font-family: 'Brush';
  src: url('assets/fonts/brush.woff2?v=20260723') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --font: 'Kai', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-display: 'Brush', 'Kai', serif;
  --gold: #ffd76a;
  --gold-hi: #ffe9a8;
  --gold-lo: #e0a92c;
  --gold-dim: rgba(255, 215, 106, 0.28);
  --gold-line: rgba(255, 215, 106, 0.34);
  --ink: rgba(10, 13, 32, 0.78);
  --ink-deep: #0d1230;
  --text: #f2ecda;
  --text-dim: #a8a2b8;
  --joy: #ffb84d;
  --rage: #ff5d5d;
  --sorrow: #7db6ff;
  --calm: #8ef0c9;
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--ink-deep);
  color: var(--text);
  font-family: var(--font);
  user-select: none;
  touch-action: none;
}
button, input { font-family: var(--font); }

#scene { position: fixed; inset: 0; display: block; }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
#hud button, #hud input, #hud [data-slot], #hud [data-bench], #hud .trait-row { pointer-events: auto; }
.hud-region { position: absolute; }

/* ---------- 夜金框语言 ---------- */
/* 深靛玻璃底 + 金线边 + 内投影 + 顶部一缕月光 */
.nightpanel, .chip, .shop-card, .bench-slot, .trait-row, .ovapanel, #codexPanel,
#tutBubble, #toast, #sellZone, .codex-card, #overlayPanel, #lbBoard li, #dailyLbBoard li, #pvpLbBoard li, #pvpBoardBody li, #nameRow input {
  background: linear-gradient(180deg, rgba(38, 46, 92, 0.34), rgba(14, 17, 40, 0.0) 34%),
              linear-gradient(180deg, rgba(23, 28, 62, 0.92), rgba(11, 14, 34, 0.94));
  border: 1px solid var(--gold-line);
  box-shadow: inset 0 1px 0 rgba(255, 232, 168, 0.14),
              inset 0 -1px 0 rgba(4, 5, 14, 0.55),
              0 8px 22px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}

/* 重要面板四角小星（金色 L 角饰） */
#overlayPanel, #codexPanel, .ovapanel, #tutBubble { position: relative; }
#overlayPanel::before, #codexPanel::before, .ovapanel::before, #tutBubble::before {
  content: ""; position: absolute; inset: 5px; pointer-events: none;
  background:
    linear-gradient(rgba(255, 215, 106, 0.75), rgba(255, 215, 106, 0.75)) top left / 11px 1px,
    linear-gradient(rgba(255, 215, 106, 0.75), rgba(255, 215, 106, 0.75)) top left / 1px 11px,
    linear-gradient(rgba(255, 215, 106, 0.75), rgba(255, 215, 106, 0.75)) top right / 11px 1px,
    linear-gradient(rgba(255, 215, 106, 0.75), rgba(255, 215, 106, 0.75)) top right / 1px 11px,
    linear-gradient(rgba(255, 215, 106, 0.75), rgba(255, 215, 106, 0.75)) bottom left / 11px 1px,
    linear-gradient(rgba(255, 215, 106, 0.75), rgba(255, 215, 106, 0.75)) bottom left / 1px 11px,
    linear-gradient(rgba(255, 215, 106, 0.75), rgba(255, 215, 106, 0.75)) bottom right / 11px 1px,
    linear-gradient(rgba(255, 215, 106, 0.75), rgba(255, 215, 106, 0.75)) bottom right / 1px 11px;
  background-repeat: no-repeat;
}

/* ---------- phase visibility ---------- */
#topbar, #traitPanel, #prepHud, #battleHud, #title, #overlayRoot, #loading { display: none; }
.ph-prep #topbar, .ph-battle #topbar, .ph-overlay #topbar { display: flex; }
.ph-prep #traitPanel, .ph-battle #traitPanel { display: flex; }
.ph-prep #prepHud { display: block; }
.ph-battle #battleHud { display: flex; }
.ph-title #title { display: flex; }
.ph-overlay #overlayRoot, .ph-end #overlayRoot { display: flex; }
.ph-loading #loading { display: flex; }

/* ---------- chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 13px; border-radius: 999px;
  font-size: 14px; letter-spacing: 0.08em; color: var(--text);
  white-space: nowrap;
}
.chip b { color: var(--gold); }
.chip s { text-decoration: none; color: var(--text-dim); font-size: 12px; }
.spacer { flex: 1; }

/* ---------- 立体游戏按钮 ---------- */
.btn {
  appearance: none;
  border: 1px solid var(--gold-line);
  border-radius: 12px;
  background: linear-gradient(180deg, #33407a, #20295a 55%, #1a2148);
  color: var(--text);
  padding: 10px 22px;
  font-size: 15px; letter-spacing: 0.16em;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(7, 10, 26, 0.95),
              inset 0 1px 0 rgba(255, 255, 255, 0.14),
              0 0 0 rgba(255, 215, 106, 0);
  transition: transform 0.08s, box-shadow 0.12s, filter 0.12s;
}
.btn:hover {
  filter: brightness(1.14);
  box-shadow: 0 3px 0 rgba(7, 10, 26, 0.95),
              inset 0 1px 0 rgba(255, 255, 255, 0.2),
              0 0 16px rgba(255, 215, 106, 0.3);
}
.btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(7, 10, 26, 0.95),
              inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.btn:disabled { opacity: 0.4; cursor: default; filter: none; box-shadow: 0 3px 0 rgba(7, 10, 26, 0.95); }
.btn.primary {
  border-color: #f5ca6a;
  color: #261a03; font-weight: 400;
  background: linear-gradient(180deg, #ffeaa9, #f5c04c 52%, #dfa02a);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  box-shadow: 0 4px 0 #8a5c0e,
              inset 0 2px 0 rgba(255, 255, 255, 0.55),
              0 0 20px rgba(255, 215, 106, 0.35);
}
.btn.primary:hover { filter: brightness(1.07); box-shadow: 0 4px 0 #8a5c0e, inset 0 2px 0 rgba(255,255,255,.6), 0 0 26px rgba(255, 215, 106, 0.5); }
.btn.primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #8a5c0e, inset 0 2px 0 rgba(255,255,255,.35); }
.btn.big { font-size: 20px; padding: 14px 46px; border-radius: 15px; min-height: 48px; }
.btn.small { font-size: 13px; padding: 8px 14px; border-radius: 10px; letter-spacing: 0.12em; }
.btn.ghost { background: linear-gradient(180deg, rgba(38, 46, 92, 0.75), rgba(16, 20, 46, 0.85)); }
.btn i {
  font-style: normal; margin-left: 8px; color: var(--gold);
  font-size: 12px;
}
.btn.primary i { color: #77540b; }
.btn.on {
  background: linear-gradient(180deg, #ffeaa9, #f5c04c 52%, #dfa02a);
  color: #261a03; border-color: #f5ca6a;
  box-shadow: inset 0 2px 6px rgba(122, 74, 10, 0.45);
}

/* 连排分段控件 */
#speedGroup {
  display: inline-flex; border: 1px solid var(--gold-line); border-radius: 12px;
  overflow: hidden; background: rgba(14, 18, 42, 0.8);
  box-shadow: inset 0 1px 0 rgba(255, 232, 168, 0.1), 0 3px 0 rgba(7, 10, 26, 0.8);
}
#speedGroup .btn {
  border: none; border-radius: 0; background: transparent;
  box-shadow: none; filter: none;
  border-left: 1px solid rgba(255, 215, 106, 0.16);
}
#speedGroup .btn:first-child { border-left: none; }
#speedGroup .btn.on {
  background: linear-gradient(180deg, #ffeaa9, #f5c04c 55%, #dfa02a);
  color: #261a03;
}

/* ---------- topbar ---------- */
#topbar {
  top: 10px; left: 12px; right: 12px;
  align-items: center; gap: 8px;
  pointer-events: none;
}
#goldBox .coin-dot, .shop-card .cost::before, .ova-coin {
  width: 13px; height: 13px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 34% 28%, #fff6cf, #f5c04c 58%, #c07f16 96%);
  border: 2px dashed rgba(122, 74, 10, 0.65);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.7), 0 0 8px rgba(255, 215, 106, 0.6);
}
#hearts { display: inline-flex; gap: 3px; align-items: center; padding-left: 4px; }
.hp-heart { width: 19px; height: 17px; position: relative; display: inline-block; }
.hp-heart u {
  position: absolute; inset: 0; display: block;
  -webkit-mask: var(--heart-mask) center / contain no-repeat;
  mask: var(--heart-mask) center / contain no-repeat;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(120, 30, 46, 0.25));
}
.hp-heart u::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: var(--fill, 100%);
  background: linear-gradient(180deg, #ffb9c2 0%, #ff5d6c 42%, #d92b48 100%);
}
#hearts.flash .hp-heart { animation: heartthump 0.55s ease; }
@keyframes heartthump {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(1.32); }
  55% { transform: scale(0.94); }
}
/* win-heal: brief green glow pulse on the heart bar */
#hearts.heal-flash .hp-heart { animation: healglow 0.5s ease; }
@keyframes healglow {
  0%, 100% { filter: none; }
  40% { filter: drop-shadow(0 0 6px rgba(125, 255, 176, 0.95)) brightness(1.25); }
}
#hearts em { font-style: normal; font-size: 12px; color: var(--text-dim); margin-left: 4px; }

#bossPips { gap: 5px; }
#bossPips .bp {
  font-style: normal; width: 21px; height: 21px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--text-dim);
  border: 1px solid rgba(167, 178, 220, 0.3); background: rgba(255, 255, 255, 0.05);
}
#bossPips .bp.done { color: rgba(255, 215, 106, 0.6); border-color: var(--gold-dim); }
#bossPips .bp.now {
  color: #261a03; border-color: #f5ca6a;
  background: radial-gradient(circle at 35% 28%, #fff0bd, #e2a32b 78%);
  box-shadow: 0 0 12px rgba(255, 215, 106, 0.65);
}

/* ---------- trait panel ---------- */
#traitPanel {
  left: 12px; top: 64px;
  flex-direction: column; gap: 6px;
  width: 140px;
}
.trait-row {
  display: grid; grid-template-columns: 12px auto 1fr auto auto; align-items: center; gap: 8px;
  padding: 7px 11px; border-radius: 12px;
  cursor: pointer;
}
.trait-row .dot { width: 10px; height: 10px; border-radius: 50%; position: relative; box-shadow: 0 0 9px currentColor; }
.trait-row .dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.85), transparent 55%);
}
.trait-row .tname { font-size: 16px; }
.trait-row .tcount { font-size: 12px; color: var(--text-dim); }
.trait-row .pips { display: inline-flex; gap: 5px; }
.trait-row .pip {
  width: 9px; height: 9px; transform: rotate(45deg); border-radius: 1.5px;
  border: 1px solid var(--gold-line); background: transparent;
}
.trait-row[data-lv="1"] { border-color: var(--gold-dim); }
.trait-row[data-lv="2"] { border-color: var(--gold); box-shadow: 0 0 16px rgba(255, 215, 106, 0.18), inset 0 1px 0 rgba(255, 232, 168, 0.2); }
.trait-row .tdesc {
  grid-column: 1 / -1; display: none;
  font-size: 11px; line-height: 1.7; color: var(--text-dim);
  border-top: 1px dashed rgba(255, 255, 255, 0.09); padding-top: 6px; margin-top: 2px;
  white-space: normal;
}
.trait-row.expanded .tdesc { display: block; }
.trait-row .tdesc b { color: var(--text); }

/* ---------- prep ---------- */
#prepHud { left: 0; right: 0; bottom: 0; display: none; }

#benchWrap {
  position: absolute; left: 0; right: 0; margin: 0 auto; width: fit-content;
  bottom: 272px; display: flex; align-items: center; gap: 12px;
}
#benchChips {
  position: fixed; left: 12px; bottom: 12px;
  display: flex; align-items: center; gap: 6px;
}
#benchChips .chip { transform: none; }
#streakChip {
  border-color: rgba(255, 157, 106, 0.55); color: #ffb38a;
  background: rgba(60, 26, 16, 0.5);
  text-shadow: 0 0 8px rgba(255, 128, 64, 0.5);
}
#streakChip.lose {
  border-color: rgba(140, 160, 255, 0.5); color: #a9b8ff;
  background: rgba(24, 30, 70, 0.55);
  text-shadow: 0 0 8px rgba(120, 140, 255, 0.5);
}
#benchChips #btnReportPrep { padding: 5px 10px; font-size: 11px; letter-spacing: 0.08em; }
#bench { display: flex; gap: 8px; }
.bench-slot {
  width: 66px; height: 66px; border-radius: 15px;
  position: relative; display: flex; align-items: center; justify-content: center;
  border-style: dashed; border-color: rgba(167, 178, 220, 0.32);
}
.bench-slot.fill { border-style: solid; border-color: var(--gold-line); cursor: grab; }
.bench-slot.drop-ok { border-color: var(--gold); box-shadow: 0 0 14px rgba(255, 215, 106, 0.4); }
.bench-slot.sel { border-color: var(--gold); box-shadow: 0 0 16px rgba(255, 215, 106, 0.55); }
.bench-slot img { width: 52px; height: 52px; object-fit: contain; pointer-events: none; }
.bench-slot .pips { position: absolute; bottom: 3px; left: 0; right: 0; display: flex; gap: 3px; justify-content: center; }
.bench-slot .pip {
  width: 6px; height: 6px; transform: rotate(45deg); border-radius: 1px;
  background: linear-gradient(135deg, #ffe9a8, #e0a92c);
  box-shadow: 0 0 5px rgba(255, 215, 106, 0.8);
}
/* 4★ miracle tier: rainbow-gold pips, clearly beyond a plain fourth dot */
.bench-slot .pips.star4 .pip {
  background: linear-gradient(135deg, #ffe9a8, #ff9de2 48%, #8ef0c9);
  box-shadow: 0 0 7px rgba(255, 157, 226, 0.95);
}
.bench-slot .emo { position: absolute; top: 0; left: 0; right: 0; height: 3px; border-radius: 15px 15px 0 0; }
.bench-slot.merge3 { animation: benchpop 0.55s ease; }
@keyframes benchpop {
  0% { transform: scale(1); } 35% { transform: scale(1.35); } 100% { transform: scale(1); }
}

#sellZone {
  position: absolute; right: 18px; bottom: 188px;
  padding: 10px 18px; border-radius: 13px;
  background: linear-gradient(180deg, rgba(84, 26, 40, 0.85), rgba(44, 13, 24, 0.9));
  border: 1px dashed rgba(255, 120, 140, 0.55);
  color: #ffc3cc; font-size: 14px; letter-spacing: 0.14em;
  opacity: 0; pointer-events: none !important; transition: opacity 0.15s;
}
#sellZone.show { opacity: 1; pointer-events: auto !important; }
#sellZone.drop-ok {
  border-style: solid;
  box-shadow: 0 0 18px rgba(255, 93, 93, 0.45);
}

#btnLock { white-space: nowrap; display: inline-flex; align-items: center; }
/* css padlock glyph (no emoji) */
#btnLock .lock-ico {
  position: relative; display: inline-block; width: 9px; height: 8px; margin-right: 5px;
  border: 1.5px solid currentColor; border-radius: 2px; box-sizing: border-box;
}
#btnLock .lock-ico::before {
  content: ""; position: absolute; left: 1px; top: -6px; width: 5px; height: 6px;
  border: 1.5px solid currentColor; border-bottom: none; border-radius: 4px 4px 0 0;
  box-sizing: border-box;
}

#shopBar {
  position: absolute; left: 0; right: 0; bottom: 8px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
#shopPanel {
  display: flex; align-items: flex-end; gap: 14px;
  transform: translateY(115%);
  opacity: 0; visibility: hidden;
  transition: transform 0.24s ease, opacity 0.2s ease, visibility 0.24s;
}
.shop-open #shopPanel {
  transform: translateY(0);
  opacity: 1; visibility: visible;
}
#shop { display: flex; gap: 12px; }
#btnBattle { min-width: 108px; }
#btnRecruit { position: relative; }
.shop-open #btnRecruit { border-color: var(--gold); box-shadow: 0 0 14px rgba(255, 215, 106, 0.35), 0 3px 0 rgba(7, 10, 26, 0.95); }

/* quit confirm + under-filled battle confirm share the night-gold modal */
#quitModal, #warModal {
  position: fixed; inset: 0; z-index: 56; display: none;
  align-items: center; justify-content: center;
  background: rgba(5, 7, 18, 0.5);
}
#quitModal.show, #warModal.show { display: flex; }
#quitPanel, #warPanel {
  min-width: 300px; padding: 22px 26px; border-radius: 15px;
  background: linear-gradient(180deg, rgba(38, 46, 92, 0.34), rgba(14, 17, 40, 0) 34%), linear-gradient(180deg, rgba(23, 28, 62, 0.94), rgba(11, 14, 34, 0.96));
  border: 1px solid var(--gold-line);
  box-shadow: inset 0 1px 0 rgba(255, 232, 168, 0.14), 0 16px 48px rgba(0, 0, 0, 0.55);
  text-align: center; font-size: 15px; line-height: 1.8;
}
#quitBtns, #warBtns { display: flex; gap: 12px; justify-content: center; margin-top: 14px; }

body.arm-recall #scene, body.arm-place #scene { cursor: crosshair; }

.shop-card {
  width: 126px; border-radius: 16px; overflow: hidden;
  cursor: grab; position: relative;
  transition: transform 0.12s, box-shadow 0.12s, opacity 0.12s, filter 0.12s;
}
.shop-card:hover {
  transform: translateY(-4px);
  filter: brightness(1.1);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45), 0 0 18px rgba(255, 215, 106, 0.2);
}
.shop-card.empty { opacity: 0.25; cursor: default; }
.shop-card.empty:hover { transform: none; filter: none; box-shadow: inherit; }
.shop-card.sel { border-color: var(--gold); box-shadow: 0 0 18px rgba(255, 215, 106, 0.55); }
.shop-card .emo { height: 4px; }
.shop-card .pic { display: flex; justify-content: center; padding: 9px 0 2px; }
.shop-card img { width: 80px; height: 80px; object-fit: contain; pointer-events: none; }
.shop-card .uname { text-align: center; font-size: 16px; letter-spacing: 0.08em; }
.shop-card .uemo { text-align: center; font-size: 12px; color: var(--text-dim); padding-top: 2px; letter-spacing: 0.1em; }
.shop-card .cost {
  display: flex; justify-content: center; align-items: center; gap: 6px;
  padding: 6px 0 9px; font-size: 15px; color: var(--gold);
}
.shop-card .cost::before { content: ""; width: 11px; height: 11px; border-width: 1.5px; }
.shop-card.sold { opacity: 0.18; pointer-events: none; }

@media (min-width: 1025px) and (min-aspect-ratio: 1/1) {
  /* bottom-center horizontal layout: shop panel row above, 收起/历练/开战
     in their own centered row below — nothing near the publisher's corner */
  #prepBtns {
    position: static;
    display: flex; flex-direction: row; align-items: center; justify-content: center;
    gap: 10px;
    width: auto; padding-bottom: 0;
  }
  #prepBtns .btn.small { font-size: 11.5px; padding: 6px 7px; }
  #prepBtns .btn.primary {
    font-size: 14px; padding: 9px 8px; min-height: 38px;
    letter-spacing: 0.08em;
  }
  #prepBtns .btn.primary.longlabel { font-size: 12px; letter-spacing: 0.04em; padding: 8px 8px; min-width: 0; }
  #xpBar { width: 70px; }
}
#xpWrap { display: flex; flex-direction: column; align-items: center; gap: 4px; }
#xpBar {
  width: 84px; height: 6px; border-radius: 3px;
  background: rgba(255, 255, 255, 0.1); overflow: hidden;
  border: 1px solid rgba(167, 196, 255, 0.25);
}
#xpBar u { display: block; height: 100%; background: linear-gradient(90deg, #7db6ff, #cfe9ff); width: 0%; }
#xpSub { font-size: 10px; color: var(--text-dim); letter-spacing: 0.05em; white-space: nowrap; }

/* ---------- battle hud ---------- */
#battleHud {
  left: 12px; right: 12px; bottom: 56px;
  align-items: center; gap: 8px;
  justify-content: flex-start;
}
#battleHud .spacer { flex: 1; display: block; }

/* ---------- title ---------- */
#title {
  inset: 0; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; text-align: center;
}
#title h1 {
  font-family: var(--font-display);
  font-size: clamp(64px, 9vw, 128px);
  letter-spacing: 0.14em; text-indent: -0.06em;
  line-height: 1.3;
  background: linear-gradient(180deg, #fff7d6 12%, #ffe9a8 34%, #ffd76a 52%, #d99a26 78%, #a86e10 96%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 14px rgba(255, 215, 106, 0.4)) drop-shadow(0 0 42px rgba(255, 215, 106, 0.22));
}
#inscription {
  font-size: clamp(13px, 1.6vw, 17px); letter-spacing: 0.42em; text-indent: 0.2em;
  color: rgba(226, 222, 240, 0.68);
}
#titleBtns { display: flex; gap: 18px; margin-top: 26px; }
#titleSub { display: flex; gap: 12px; }

/* ---------- overlay / panels ---------- */
#overlayRoot {
  inset: 0; display: none; align-items: center; justify-content: center;
  background: rgba(5, 7, 18, 0.42);
  pointer-events: auto; z-index: 50;
}
#overlayPanel {
  min-width: 340px; max-width: min(500px, 92vw);
  max-height: 86vh; overflow-y: auto;
  padding: 28px 32px; border-radius: 18px;
  box-shadow: 0 20px 64px rgba(0, 0, 0, 0.6), 0 0 44px rgba(255, 215, 106, 0.08);
  text-align: center;
}
#overlayPanel h2 {
  font-family: var(--font-display);
  font-size: 40px; letter-spacing: 0.12em; text-indent: 0.04em;
  line-height: 1.35;
  background: linear-gradient(180deg, #fff3cf 25%, #ffd76a 60%, #d99a26 92%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 1px 8px rgba(255, 215, 106, 0.3));
  margin-bottom: 6px;
}
#overlayPanel h2.dim { background: linear-gradient(180deg, #cfd4e8 30%, #9aa3c7 70%, #7781a5 95%); -webkit-background-clip: text; background-clip: text; }
#overlayPanel .sub { font-size: 13px; color: var(--text-dim); letter-spacing: 0.14em; margin-bottom: 16px; }
#overlayPanel .lines { margin: 12px 0 18px; display: flex; flex-direction: column; gap: 8px; }
#overlayPanel .line { display: flex; justify-content: space-between; gap: 24px; font-size: 15px; }
#overlayPanel .line s { text-decoration: none; color: var(--text-dim); }
#overlayPanel .line b { color: var(--gold); }
#overlayPanel .line.hurt b { color: #ff8d9a; }
#overlayPanel .line.hurt.heavy b { color: #ff5d6c; font-size: 17px; text-shadow: 0 0 10px rgba(255, 93, 108, 0.5); }
#overlayPanel .line.heal b { color: #7dffb0; }
#overlayPanel .line.heal s::before {
  content: ""; display: inline-block; width: 11px; height: 10px;
  margin-right: 5px; vertical-align: -1px; background: #7dffb0;
  -webkit-mask: var(--heart-mask) center / contain no-repeat;
  mask: var(--heart-mask) center / contain no-repeat;
}
#overlayPanel .line.total { border-top: 1px dashed rgba(255, 215, 106, 0.28); padding-top: 10px; font-size: 17px; }
#overlayPanel .btns { display: flex; gap: 12px; justify-content: center; margin-top: 8px; flex-wrap: wrap; }

#nameRow { display: flex; gap: 8px; justify-content: center; margin: 6px 0 14px; }
#nameRow input {
  width: 172px; padding: 10px 13px; border-radius: 11px;
  color: var(--text); font-size: 14px; letter-spacing: 0.1em;
  outline: none;
}
#nameRow input:focus { border-color: var(--gold); box-shadow: 0 0 12px rgba(255, 215, 106, 0.25); }

#lbBoard { margin-top: 10px; text-align: left; }
#lbBoard h3 {
  font-size: 13px; letter-spacing: 0.3em; color: var(--text-dim);
  text-align: center; margin-bottom: 10px;
}
#lbBoard ul, #dailyLbBoard ul, #pvpLbBoard ul, #pvpBoardBody ul { list-style: none; display: flex; flex-direction: column; gap: 5px; }
#lbBoard li, #dailyLbBoard li, #pvpLbBoard li, #pvpBoardBody li {
  display: grid; grid-template-columns: 30px 1fr auto auto; gap: 10px;
  font-size: 13px; padding: 7px 11px; border-radius: 10px;
}
#lbBoard li.me, #dailyLbBoard li.me, #pvpLbBoard li.me, #pvpBoardBody li.me { border-color: var(--gold); box-shadow: 0 0 12px rgba(255, 215, 106, 0.2); }
#lbBoard li .rk, #dailyLbBoard li .rk, #pvpLbBoard li .rk, #pvpBoardBody li .rk { color: var(--gold); }
#lbBoard li .rd, #dailyLbBoard li .rd, #pvpLbBoard li .rd, #pvpBoardBody li .rd { color: var(--text-dim); font-size: 12px; }
#lbBoard .lb-note, #dailyLbBoard .lb-note, #pvpLbBoard .lb-note, #pvpBoardBody .lb-note { text-align: center; font-size: 11px; color: var(--text-dim); margin-top: 8px; letter-spacing: 0.08em; }
.lb-err { text-align: center; font-size: 12px; color: #ff9d7a; margin-top: 6px; min-height: 1em; }

/* ---------- misc ---------- */
#muteWrap {
  display: flex; align-items: center; gap: 8px;
  pointer-events: auto;
}
/* title + end screens: only the volume controls and the account chip show
   from the topbar strip */
.ph-title #topbar, .ph-end #topbar { display: flex; }
.ph-title #topbar > *:not(#muteWrap):not(#accountBox),
.ph-end #topbar > *:not(#muteWrap):not(#accountBox) { display: none; }
.ph-title #muteWrap, .ph-end #muteWrap { margin-left: auto; }
#muteBtn { min-width: 40px; }
#muteBtn svg { display: block; width: 17px; height: 17px; margin: 0 auto; }
#volRange { width: 74px; accent-color: var(--gold); cursor: pointer; background: transparent; }

#toast {
  position: absolute; left: 50%; bottom: 310px; transform: translateX(-50%);
  padding: 8px 20px; border-radius: 999px;
  color: #ffd9de; font-size: 14px; letter-spacing: 0.14em;
  border-color: rgba(255, 120, 140, 0.5);
  opacity: 0; transition: opacity 0.18s; pointer-events: none;
  white-space: nowrap;
}
#toast.show { opacity: 1; }

#dragGhost {
  position: fixed; width: 64px; height: 64px; object-fit: contain;
  pointer-events: none; z-index: 99; opacity: 0.92;
  margin: -32px 0 0 -32px; display: none;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.5));
}

#loading {
  inset: 0; align-items: center; justify-content: center;
  font-size: 20px; letter-spacing: 0.5em; text-indent: 0.5em;
  color: rgba(226, 222, 240, 0.55);
  animation: breathe 2.2s ease-in-out infinite;
}
@keyframes breathe { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }

/* ---------- P0-1 unit detail panel ---------- */
.ovapanel {
  position: fixed; z-index: 70; width: 272px;
  padding: 14px 16px 12px; border-radius: 15px;
  box-shadow: inset 0 1px 0 rgba(255, 232, 168, 0.14), 0 14px 44px rgba(0, 0, 0, 0.55), 0 0 26px rgba(255, 215, 106, 0.1);
  pointer-events: none; font-size: 13px;
  /* boss cards (stars + stats + multi ability lines) scroll inside 80vh
     instead of overflowing the viewport — slim night-gold scrollbar */
  max-height: 80vh; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--gold-dim) transparent;
}
.ovapanel::-webkit-scrollbar { width: 6px; }
.ovapanel::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 3px; }
.ovapanel::-webkit-scrollbar-track { background: transparent; }
.ovapanel button { pointer-events: auto; }
/* pinned panels are interactive cards: consume clicks on the card body so
   they never leak through to the board/bench below (hover cards stay none) */
.ovapanel.pinned { pointer-events: auto; }
.ovapanel .ova-head { display: flex; gap: 12px; align-items: center; }
.ovapanel .ova-head img { width: 64px; height: 64px; object-fit: contain; flex: none; }
.ovapanel .ova-title { flex: 1; min-width: 0; }
.ovapanel .ova-title b { font-size: 17px; letter-spacing: 0.08em; display: block; }
.ovapanel .ova-line { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 12px; color: var(--text-dim); }
.ovapanel .ova-live { display: block; margin-top: 3px; font-size: 11px; color: var(--gold); letter-spacing: 0.14em; }
.ova-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; position: relative; box-shadow: 0 0 7px currentColor; }
.ova-dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.85), transparent 55%);
}
.ova-coin { width: 10px; height: 10px; border-width: 1.5px; }
.ova-close {
  align-self: flex-start; flex: none; width: 26px; height: 26px;
  border-radius: 8px; border: 1px solid var(--gold-dim);
  background: linear-gradient(180deg, #2c3566, #1a2148); color: var(--text-dim);
  font-size: 15px; line-height: 1; cursor: pointer;
  box-shadow: 0 2px 0 rgba(7, 10, 26, 0.9);
}
.ova-close:hover { color: var(--gold); border-color: var(--gold); }
.ovapanel .ova-swap { margin: 10px 0 0; }
/* enemy tier switch: text buttons with the reference night in the label,
   current tier night-gold — replaces the cramped diamond pips on enemy cards */
.ovapanel .ova-tiers { display: flex; gap: 7px; flex-wrap: wrap; }
.ovapanel .ova-tier {
  appearance: none; cursor: pointer;
  font-size: 10.5px; letter-spacing: 0.02em; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--gold-line); background: rgba(14, 18, 42, 0.8); color: var(--text-dim);
}
.ovapanel .ova-tier.on {
  background: linear-gradient(180deg, #ffeaa9, #f5c04c 55%, #dfa02a);
  color: #261a03; border-color: #f5ca6a;
}
.ova-stars { display: inline-flex; gap: 9px; }
.ova-star {
  width: 14px; height: 14px; transform: rotate(45deg);
  border: 1.5px solid var(--gold-line); background: transparent;
  cursor: pointer; padding: 0; border-radius: 2.5px;
}
.ova-star.on {
  background: linear-gradient(135deg, #ffe9a8, #e0a92c);
  border-color: #f5ca6a; box-shadow: 0 0 8px rgba(255, 215, 106, 0.75);
}
.ova-star.dim { background: rgba(255, 255, 255, 0.06); cursor: default; box-shadow: none; }
.ovapanel .ova-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  margin-top: 10px; padding: 8px 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.09);
  border-bottom: 1px dashed rgba(255, 255, 255, 0.09);
}
.ovapanel .ova-stats span { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ovapanel .ova-stats s { text-decoration: none; font-size: 10px; color: var(--text-dim); letter-spacing: 0.14em; }
.ovapanel .ova-stats b { font-size: 15px; color: var(--gold); }
.ovapanel .ova-stats b.small { font-size: 11px; color: var(--text); }
.ovapanel .ova-ab { margin-top: 8px; }
.ovapanel .ova-ab p { font-size: 12px; line-height: 1.75; }
.ovapanel .ova-ab p.blurb { color: var(--text-dim); }
.ovapanel.enemy .ova-stats b { color: #ff9aa6; }
.ovapanel .ova-bosstag {
  color: #ff9aa6; font-size: 10px; letter-spacing: 0.08em;
  border: 1px solid rgba(255, 109, 122, 0.5); border-radius: 999px; padding: 1px 8px;
}
.ovapanel .ova-bossstar { color: var(--gold); letter-spacing: 1px; }
.ovapanel .ova-abline { color: #8fb4e8; font-size: 12px; line-height: 1.55; margin: 2px 0; }

/* ---------- status keywords & tooltip ---------- */
/* colored status word inside card copy; --stc is the status color (STATUSES) */
.stt {
  color: var(--stc); font-weight: 600; cursor: help;
  border-bottom: 1px dashed var(--stc);
}
.sttip {
  position: fixed; z-index: 90; max-width: 240px; pointer-events: none;
  padding: 8px 12px 9px; border-radius: 10px;
  background: linear-gradient(180deg, #232a52, #141a3c);
  border: 1px solid var(--gold-line);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  font-size: 12px;
}
.sttip b { font-size: 13px; letter-spacing: 0.1em; }
.sttip i { font-style: normal; font-size: 10px; color: var(--text-dim); margin-left: 7px; letter-spacing: 0.1em; }
.sttip p { margin-top: 4px; font-size: 11px; line-height: 1.65; color: var(--text); }
/* codex 状态 tab: name chip + effect line */
#codexBody .codex-statuses { display: flex; flex-direction: column; gap: 2px; }
#codexBody .strow { display: flex; gap: 12px; align-items: baseline; padding: 3px 0; }
#codexBody .strow .stt-name { flex: none; min-width: 44px; font-size: 13px; text-align: center; color: var(--stc); font-weight: 600; }
#codexBody .strow p { flex: 1; font-size: 11.5px; line-height: 1.65; color: var(--text-dim); }

/* ---------- P0-2 codex ---------- */
#codexRoot {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5, 7, 18, 0.55);
}
#codexPanel {
  width: min(720px, 94vw); max-height: 84vh; overflow-y: auto; overflow-x: hidden;
  padding: 20px 24px 24px; border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 232, 168, 0.14), 0 20px 64px rgba(0, 0, 0, 0.6);
}
#codexHead { display: flex; align-items: center; gap: 0; margin-bottom: 14px; border-radius: 12px; }
#codexHead .codex-tab {
  appearance: none; border: 1px solid var(--gold-line); border-left: none;
  background: rgba(14, 18, 42, 0.8); color: var(--text-dim);
  font-size: 14px; letter-spacing: 0.16em;
  padding: 9px 20px; cursor: pointer;
}
#codexHead .codex-tab:first-of-type { border-radius: 12px 0 0 12px; border-left: 1px solid var(--gold-line); }
/* last TAB (not the 合上 button, which is the true :last-of-type) gets the right radius */
#codexHead .codex-tab:nth-last-of-type(2) { border-radius: 0 12px 12px 0; }
#codexHead .codex-tab.on {
  background: linear-gradient(180deg, #ffeaa9, #f5c04c 55%, #dfa02a);
  color: #261a03; border-color: #f5ca6a;
}
#codexHead .spacer { min-width: 12px; }
#codexBody section { margin-bottom: 14px; }
#codexBody h4 {
  font-size: 12px; letter-spacing: 0.32em; color: var(--text-dim);
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1); padding-bottom: 5px; margin-bottom: 8px;
}
.codex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.codex-card {
  display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto;
  align-items: center; column-gap: 9px; padding: 8px 10px; border-radius: 12px;
  border-color: rgba(167, 178, 220, 0.18);
  cursor: pointer;
  transition: filter 0.12s, box-shadow 0.12s;
}
.codex-card:hover { filter: brightness(1.12); border-color: var(--gold-dim); box-shadow: 0 0 14px rgba(255, 215, 106, 0.14); }
.codex-card img { grid-row: 1 / -1; width: 44px; height: 44px; object-fit: contain; }
.codex-card b { font-size: 14px; letter-spacing: 0.06em; }
.codex-card .cc-line { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-dim); }
.codex-card .cc-desc { font-size: 10px; color: var(--text-dim); line-height: 1.45; opacity: 0.85; }
#codexBody .codex-note { font-size: 10px; color: var(--text-dim); margin: -4px 0 8px; opacity: 0.8; }
/* enemy tab: 3 cols on desktop, 2 on tablet, 1 on phone; compact cards with
   the description spanning the card width, night chip prominent top-right.
   minmax(0, 1fr) so tracks never outgrow the panel on min-content pressure
   (boss beads + night chips wrap inside the card instead) */
#codexBody .enemy-grid { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 700px) {
  #codexBody .enemy-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  #codexBody .enemy-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.codex-card.enemy { padding: 7px 9px; }
.codex-card.enemy .cc-desc {
  grid-column: 1 / -1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.codex-card .cc-stat {
  grid-column: 2; font-size: 10px; color: var(--text-dim); letter-spacing: 0.04em;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.codex-card .cc-stat s { text-decoration: none; color: var(--gold); letter-spacing: 1px; }
/* minion star-tier switcher + boss tag */
.codex-card .cc-starsel { grid-column: 2; display: flex; gap: 3px; }
.codex-card .cc-starsel u {
  cursor: pointer; font-size: 9px; padding: 0 5px; border-radius: 999px;
  border: 1px solid var(--gold-line); color: var(--text-dim); line-height: 1.5;
}
.codex-card .cc-starsel u.on { color: #261a03; background: linear-gradient(180deg, #ffeaa9, #f5c04c); border-color: #f5ca6a; }
.codex-card .cc-stat em { font-style: normal; font-size: 9px; color: var(--text-dim); margin-right: 6px; }
.codex-card .cc-bosstag {
  font-style: normal; font-size: 9px; color: #ff9aa6; margin-left: 6px;
  border: 1px solid rgba(255, 109, 122, 0.5); border-radius: 999px; padding: 0 6px;
}
/* data-driven ability line(s) under the flavor desc: cold blue, stays compact */
.codex-card .cc-ab {
  grid-column: 1 / -1; font-size: 10px; line-height: 1.5;
  color: #8fb4e8; letter-spacing: 0.02em;
}
.codex-card .cc-night {
  justify-self: end; align-self: start; font-style: normal; white-space: nowrap;
  font-size: 10px; letter-spacing: 0.06em; color: var(--gold);
  border: 1px solid var(--gold-line); border-radius: 999px; padding: 1px 8px;
  background: rgba(255, 215, 106, 0.08);
}

/* ---------- P0-3 tutorial ---------- */
#tutRoot { position: fixed; inset: 0; z-index: 30; }
#tutRoot.blocking { pointer-events: auto; }
#tutRoot.pass { pointer-events: none; }
#tutSpot {
  position: absolute; border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(4, 6, 16, 0.72), 0 0 26px rgba(255, 215, 106, 0.4);
  outline: 2px solid rgba(255, 215, 106, 0.9);
  transition: all 0.22s ease;
}
#tutSpot.none { outline: none; box-shadow: 0 0 0 9999px rgba(4, 6, 16, 0.72); }
#tutBubble {
  position: absolute; max-width: 300px; z-index: 33;
  padding: 15px 17px 13px; border-radius: 15px;
  font-size: 14px; line-height: 1.9;
  pointer-events: auto;
}
#tutBubble .tut-skip {
  position: absolute; top: 7px; right: 11px;
  border: none; background: none; color: var(--text-dim);
  font-size: 11px; letter-spacing: 0.12em; cursor: pointer;
}
#tutBubble .tut-skip:hover { color: var(--gold); }
#tutBubble .tut-actions { margin-top: 10px; display: flex; gap: 10px; }
#tutBubble .tut-hint { margin-top: 6px; font-size: 11px; color: var(--text-dim); letter-spacing: 0.08em; }
.tut-raise { position: relative; z-index: 32 !important; }

/* ---------- portrait / small screens ---------- */
@media (max-width: 760px), (max-aspect-ratio: 1/1) {
  #topbar { gap: 5px; flex-wrap: wrap; }
  .chip { font-size: 11px; padding: 5px 10px; }
  #traitPanel {
    top: 88px; left: 8px; right: 8px; width: auto;
    flex-direction: row; overflow-x: auto; gap: 5px;
    scrollbar-width: none;
  }
  .trait-row { grid-template-columns: 10px 16px auto auto; padding: 6px 9px; gap: 5px; flex: 0 0 auto; }
  .trait-row .tdesc { display: none !important; }
  .trait-row .tname { font-size: 14px; }
  #benchWrap { bottom: 258px; gap: 8px; }
  .bench-slot { width: 50px; height: 50px; border-radius: 12px; }
  .bench-slot img { width: 40px; height: 40px; }
  #benchChips { position: absolute; left: 0; top: -50px; bottom: auto; }
  #sellZone { bottom: 246px; right: 8px; padding: 8px 13px; font-size: 12px; }
  #shopBar { flex-direction: column; align-items: center; gap: 8px; bottom: 6px; }
  .shop-card { width: 112px; }
  .shop-card img { width: 58px; height: 58px; }
  .shop-card .uname { font-size: 13px; }
  .shop-card .uemo { font-size: 10px; }
  .shop-card .cost { font-size: 13px; }
  #prepBtns {
    position: static; display: flex; flex-direction: row; align-items: center;
    align-self: flex-start; width: auto; gap: 4px; margin-left: 4px;
  }
  #prepBtns .btn.small { font-size: 11px; padding: 6px 7px; }
  #prepBtns .btn.primary { font-size: 11.5px; padding: 7px 9px; min-width: 72px; letter-spacing: 0.06em; }
  /* touch devices: hide keyboard hints, keeps the group inside the badge zone */
  #prepBtns .btn i { display: none; }
  #xpBar { width: 52px; }
  #xpSub { font-size: 9px; }
  /* speed controls move above the bottom row: bottom-right stays badge-clear */
  #speedGroup { position: absolute; left: 12px; bottom: 56px; }
  .btn.big { font-size: 17px; padding: 12px 32px; min-height: 44px; }
  #volRange { width: 56px; }
  #toast { bottom: 372px; }
  #overlayPanel { padding: 20px 18px; }
  #overlayPanel h2 { font-size: 30px; }
  .ovapanel { width: 248px; }
  #codexPanel { width: 96vw; max-height: 80vh; padding: 14px 14px 16px; }
  .codex-grid { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); }
  #tutBubble { max-width: 262px; }
}

/* ---------- touch tweaks for panel ---------- */
@media (max-width: 760px), (max-aspect-ratio: 1/1) {
  .ova-close { width: 30px; height: 30px; }
}

/* how-to panel bits */
.howto-line { font-size: 13px; line-height: 1.9; color: var(--text); margin-bottom: 8px; }
.howto-keys { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.howto-key {
  display: flex; align-items: center; gap: 10px; font-size: 12px;
  padding: 7px 10px; border-radius: 10px;
  border: 1px solid rgba(167, 178, 220, 0.16);
}
.howto-key b {
  min-width: 46px; text-align: center; padding: 3px 6px; border-radius: 7px;
  color: #261a03; background: linear-gradient(180deg, #ffeaa9, #f5c04c 55%, #dfa02a);
  border: 1px solid #f5ca6a; font-size: 12px;
}
.howto-key span { color: var(--text-dim); }
.ovapanel .hintline { opacity: 0.75; margin-top: 4px; }

/* tutorial: lift transformed stacking contexts (recruit panel) while raised */
.tut-raise-fix { position: relative !important; z-index: 32 !important; }

/* shop merge hints */
.shop-card .merge-badge {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  padding: 3px 8px; border-radius: 999px;
  font-size: 11px; letter-spacing: 0.08em;
  color: #261a03;
  background: linear-gradient(180deg, #ffeaa9, #f5c04c 55%, #dfa02a);
  border: 1px solid #f5ca6a;
  box-shadow: 0 0 10px rgba(255, 215, 106, 0.65);
  animation: mergepulse 1.2s ease-in-out infinite;
}
@keyframes mergepulse {
  0%, 100% { box-shadow: 0 0 6px rgba(255, 215, 106, 0.45); transform: scale(1); }
  50% { box-shadow: 0 0 16px rgba(255, 215, 106, 0.95); transform: scale(1.08); }
}
.shop-card .pair-dot {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #fff6cf, #e0a92c 85%);
  box-shadow: 0 0 6px rgba(255, 215, 106, 0.6);
}

/* digit key hint on shop cards: night-gold chip, visible only while open */
.shop-card .key-hint {
  position: absolute; top: 6px; left: 6px; z-index: 2;
  min-width: 18px; height: 18px; padding: 0 4px; box-sizing: border-box;
  display: none; align-items: center; justify-content: center;
  font-style: normal; font-size: 11px; line-height: 1; letter-spacing: 0;
  color: var(--gold); border: 1px solid var(--gold-line); border-radius: 5px;
  background: rgba(14, 18, 42, 0.88);
  box-shadow: inset 0 1px 0 rgba(255, 232, 168, 0.14);
  pointer-events: none;
}
body.shop-open .shop-card .key-hint { display: inline-flex; }

/* long battle-button labels keep the pill from blowing out */
#prepBtns .btn.primary.longlabel { font-size: 14px; letter-spacing: 0.1em; padding: 13px 20px; }
@media (max-width: 760px), (max-aspect-ratio: 1/1) {
  #prepBtns .btn.primary.longlabel { font-size: 12px; letter-spacing: 0.06em; padding: 10px 14px; min-width: 84px; }
}

#slotsChip b { color: var(--text); }
#slotsChip.full { border-color: var(--gold); }
#slotsChip.full b { color: var(--gold); text-shadow: 0 0 8px rgba(255, 215, 106, 0.7); }

/* 5-cost coin marks (legend tier) */
.shop-card .cost5 { color: #fff0bd; text-shadow: 0 0 10px rgba(255, 215, 106, 0.95); font-size: 16px; }
.shop-card .cost5::before { box-shadow: 0 0 10px rgba(255, 215, 106, 0.95); }

/* codex legend group mark */
#codexBody h4.legend { color: var(--gold); text-shadow: 0 0 8px rgba(255, 215, 106, 0.4); }
#codexBody h4.legend i {
  font-style: normal; font-size: 10px; padding: 2px 8px; margin-left: 8px;
  border-radius: 999px; color: #261a03; vertical-align: 2px;
  background: linear-gradient(180deg, #ffeaa9, #f5c04c 55%, #dfa02a);
  border: 1px solid #f5ca6a; letter-spacing: 0.2em;
}

.codex-card.cost5 { border-color: rgba(255, 215, 106, 0.45); box-shadow: 0 0 12px rgba(255, 215, 106, 0.12); }
.codex-card.cost5 .cc-line { color: var(--gold); }
.ovapanel .ova-sell { margin-top: 8px; width: 100%; }

/* battle timeout countdown, big centered brush number above the bench
   (sim-time driven; pointer-events: none so it never blocks the board) */
#btBig {
  position: fixed; left: 50%; bottom: 252px; transform: translateX(-50%);
  display: none; pointer-events: none; z-index: 20;
  font-family: "Brush", "Kai", serif; font-size: 64px; line-height: 1;
  color: var(--gold); opacity: 0.92;
  text-shadow: 0 0 18px rgba(255, 215, 106, 0.35), 0 2px 0 rgba(6, 8, 20, 0.9), 0 0 4px rgba(6, 8, 20, 0.9);
}
.ph-battle #btBig { display: block; }
#btBig.warn {
  color: #ff5d6c;
  text-shadow: 0 0 22px rgba(255, 93, 108, 0.55), 0 2px 0 rgba(6, 8, 20, 0.9);
  animation: btHeart 1s ease-in-out infinite;
}
@keyframes btHeart {
  0%, 100% { transform: translateX(-50%) scale(1); }
  15% { transform: translateX(-50%) scale(1.16); }
  30% { transform: translateX(-50%) scale(1); }
  45% { transform: translateX(-50%) scale(1.12); }
  60% { transform: translateX(-50%) scale(1); }
}
@media (max-width: 760px), (max-aspect-ratio: 1/1) {
  #btBig { bottom: 300px; font-size: 40px; }
}

/* ---------- battle report ---------- */
#reportPanel {
  position: fixed; top: 110px; right: 12px; z-index: 45;
  width: 272px; max-height: calc(100vh - 190px); overflow-y: auto;
  padding: 12px 12px; border-radius: 14px; display: none;
  background: linear-gradient(180deg, rgba(38, 46, 92, 0.36), rgba(14, 17, 40, 0) 34%), linear-gradient(180deg, rgba(23, 28, 62, 0.94), rgba(11, 14, 34, 0.96));
  border: 1px solid var(--gold-line);
  box-shadow: inset 0 1px 0 rgba(255, 232, 168, 0.14), 0 16px 48px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
#reportPanel.show { display: flex; flex-direction: column; }
/* title phase never shows the panel (state + mmt.reportOpen pref untouched —
   the next run restores per the preference) */
.ph-title #reportPanel { display: none !important; }
/* rows scroll inside #reportBody so the static column head stays pinned */
#reportBody { overflow-y: auto; min-height: 0; }
#reportPanel .rep-head-row { flex: none; }
#reportHead {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 15px; letter-spacing: 0.2em; color: var(--gold); margin-bottom: 8px;
}
.rep-row {
  display: grid; grid-template-columns: 40px 1fr; gap: 6px;
  padding: 6px 2px; border-radius: 10px; align-items: center;
}
.rep-row + .rep-row { border-top: 1px dashed rgba(255, 255, 255, 0.07); }
.rep-row.dead { opacity: 0.45; filter: saturate(0.4); }
.rep-row .ava { position: relative; width: 40px; height: 40px; }
.rep-row .ava img { width: 40px; height: 40px; object-fit: contain; }
.rep-row .ava .starp {
  position: absolute; bottom: -2px; right: -2px;
  font-size: 10px; color: var(--gold); text-shadow: 0 0 5px rgba(255, 215, 106, 0.8);
}
.rep-row .rname { font-size: 11px; letter-spacing: 0.05em; color: var(--text-dim); margin-bottom: 4px; }
.rep-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.rep-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rep-cell s { text-decoration: none; font-size: 10px; color: var(--text-dim); letter-spacing: 0.1em; }
.rep-cell b { font-size: 11px; color: var(--text); white-space: nowrap; }
.rep-cell .bar { height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.rep-cell .bar u { display: block; height: 100%; background: linear-gradient(90deg, rgba(255, 215, 106, 0.5), rgba(255, 215, 106, 0.9)); }
.rep-cell:nth-child(2) .bar u { background: linear-gradient(90deg, rgba(255, 109, 122, 0.5), rgba(255, 109, 122, 0.9)); }
.rep-cell:nth-child(3) .bar u { background: linear-gradient(90deg, rgba(142, 240, 201, 0.5), rgba(142, 240, 201, 0.9)); }
.rep-cell:nth-child(4) .bar u { background: linear-gradient(90deg, rgba(125, 182, 255, 0.5), rgba(125, 182, 255, 0.9)); }

/* settlement report table embed (also reused by the prep-phase 上夜战报) */
#overlayPanel .rep-embed { max-height: 240px; overflow-y: auto; margin-top: 6px; }
#overlayPanel .rep-embed .rep-head-row, #reportPanel .rep-head-row {
  display: grid; grid-template-columns: 40px 1fr; gap: 8px;
  font-size: 10px; letter-spacing: 0.2em; color: var(--text-dim);
  padding: 4px; border-bottom: 1px dashed rgba(255, 215, 106, 0.25);
  margin-bottom: 2px;
}
#overlayPanel .rep-embed .rep-head-row .cols, #reportPanel .rep-head-row .cols { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; text-align: center; }

/* codex traits tab */
#codexBody .codex-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  margin-right: 7px; vertical-align: -1px; box-shadow: 0 0 8px currentColor;
}
#codexBody .codex-tiers { font-size: 11px; line-height: 1.7; color: var(--text-dim); margin: 2px 0 7px; }
#codexBody .codex-tiers b { color: var(--text); }
#codexBody .codex-mems { display: flex; flex-wrap: wrap; gap: 6px; }
#codexBody .codex-mems .tmem { position: relative; display: inline-flex; width: 32px; height: 32px; cursor: pointer; }
#codexBody .codex-mems .tmem img {
  width: 32px; height: 32px; object-fit: contain; border-radius: 50%;
  background: rgba(255, 255, 255, 0.06); box-shadow: 0 0 0 1px var(--gold-dim);
}
#codexBody .codex-mems .tmem:hover img { box-shadow: 0 0 0 2px var(--gold); }
#codexBody .codex-mems .tmem i {
  position: absolute; right: -2px; bottom: -2px;
  font-style: normal; font-size: 8px; color: var(--gold);
  text-shadow: 0 0 3px rgba(255, 215, 106, 0.9);
}

/* ---------- bench 8 / shop 5 responsive ---------- */
@media (max-width: 760px), (max-aspect-ratio: 1/1) {
  #bench { flex-wrap: wrap; justify-content: center; max-width: 96vw; gap: 6px; }
  .bench-slot { width: 42px; height: 42px; border-radius: 10px; }
  .bench-slot img { width: 34px; height: 34px; }
  #benchWrap { bottom: 284px; }
  #sellZone { bottom: 292px; }
  #shop { overflow-x: auto; max-width: 96vw; padding-bottom: 4px; scrollbar-width: none; }
  .shop-card { width: 96px; flex: 0 0 auto; }
  .shop-card img { width: 48px; height: 48px; }
  #shopSide { flex-direction: row; }
  #oddsLine { font-size: 10px; }
}

/* odds line + modal */
#oddsLine {
  position: absolute; top: -34px; left: 0; cursor: pointer;
}
#oddsModal {
  position: fixed; inset: 0; z-index: 56; display: none;
  align-items: center; justify-content: center;
  background: rgba(5, 7, 18, 0.5);
}
#oddsModal.show { display: flex; }
#oddsPanel {
  min-width: 340px; padding: 16px 20px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(38, 46, 92, 0.34), rgba(14, 17, 40, 0) 34%), linear-gradient(180deg, rgba(23, 28, 62, 0.94), rgba(11, 14, 34, 0.96));
  border: 1px solid var(--gold-line);
  box-shadow: inset 0 1px 0 rgba(255, 232, 168, 0.14), 0 16px 48px rgba(0, 0, 0, 0.55);
}
#oddsHead { display: flex; align-items: center; justify-content: space-between; font-size: 14px; letter-spacing: 0.2em; color: var(--gold); margin-bottom: 10px; }
#oddsBody table { border-collapse: collapse; font-size: 12px; }
#oddsBody th, #oddsBody td { padding: 5px 10px; text-align: center; }
#oddsBody th { color: var(--text-dim); font-weight: 400; letter-spacing: 0.1em; }
#oddsBody td.cur, #oddsBody th.cur { background: rgba(255, 215, 106, 0.16); color: var(--gold); }
#oddsBody tr.cur td, #oddsBody tr.cur th { background: rgba(255, 215, 106, 0.14); }
#oddsBody tr.cur td { color: var(--gold); text-shadow: 0 0 8px rgba(255, 215, 106, 0.5); }
#oddsBody td.zero { color: rgba(168, 162, 184, 0.35); }

/* ---------- trait panel v2 (11 traits) ---------- */
.trait-row .pip.lit {
  background: linear-gradient(135deg, #ffe9a8, #e0a92c);
  border-color: #f5ca6a;
  box-shadow: 0 0 6px rgba(255, 215, 106, 0.8);
}
.trait-row.role { padding: 5px 10px; }
.trait-row.role .tname { font-size: 12px; }
.trait-row.role .tcount { font-size: 10px; }
.trait-row.role .dot { width: 8px; height: 8px; }
.trait-row.role .pip { width: 7px; height: 7px; }
.trait-row .tdesc > div { color: var(--text-dim); }
.trait-row .tdesc > div.on { color: var(--text); }
.trait-row .tdesc > div.on b { color: var(--gold); }

/* shop card trait beads */
.shop-card .uemo { display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; }
.shop-card .uemo s { text-decoration: none; }
.tbead {
  width: 7px; height: 7px; border-radius: 50%; flex: none;
  box-shadow: 0 0 5px currentColor;
}

/* detail card trait row */
.ovapanel .ova-traits { gap: 6px; flex-wrap: wrap; margin-top: 3px; }
.ovapanel .ova-trait { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text); }
.ovapanel .ova-trait .ova-dot { width: 8px; height: 8px; }

.trait-row[data-lv="3"] { border-color: var(--gold); box-shadow: 0 0 16px rgba(255, 215, 106, 0.18), inset 0 1px 0 rgba(255, 232, 168, 0.2); }

/* ---------- mobile-first vertical layout (≤1024px or portrait) ---------- */
@media (max-width: 1024px), (max-aspect-ratio: 1/1) {
  html { height: 100dvh; }
  body { padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom) 0; }

  /* safe-area aware bars */
  #topbar { top: calc(8px + env(safe-area-inset-top)); }

  /* trait panel -> collapsible drawer, collapsed by default */
  #traitDrawerBtn {
    display: inline-flex; position: absolute; left: 8px; top: calc(52px + env(safe-area-inset-top));
    z-index: 37; pointer-events: auto; font-size: 12px; letter-spacing: 0.08em;
  }
  .ph-prep #traitPanel, .ph-battle #traitPanel { display: none; }
  #traitPanel {
    position: fixed; top: calc(84px + env(safe-area-inset-top)); left: 8px; right: 8px;
    width: auto; max-height: 58dvh; overflow-y: auto; z-index: 40;
    padding: 8px; border-radius: 14px;
    background: linear-gradient(180deg, rgba(23, 28, 62, 0.96), rgba(11, 14, 34, 0.97));
    border: 1px solid var(--gold-line);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  }
  .traits-open.ph-prep #traitPanel, .traits-open.ph-battle #traitPanel { display: flex; flex-direction: column; gap: 5px; }
  /* keep the collapsed handle visible in run phases */
  .ph-prep #traitDrawerBtn, .ph-battle #traitDrawerBtn { display: inline-flex; }
  .ph-title #traitDrawerBtn, .ph-overlay #traitDrawerBtn, .ph-end #traitDrawerBtn { display: none; }

  /* shop panel -> bottom drawer with backdrop */
  #shopBackdrop {
    position: fixed; inset: 0; z-index: 34; display: none;
    background: rgba(5, 7, 18, 0.55);
    pointer-events: none;
  }
  .shop-drawer #shopBackdrop { display: block; }
  .shop-open #shopPanel {
    position: fixed; left: 8px; right: 8px;
    bottom: calc(74px + env(safe-area-inset-bottom));
    z-index: 36; flex-direction: column; align-items: stretch; gap: 10px;
    padding: 12px 12px 10px; border-radius: 16px;
    background: linear-gradient(180deg, rgba(23, 28, 62, 0.96), rgba(11, 14, 34, 0.97));
    border: 1px solid var(--gold-line);
    box-shadow: 0 18px 54px rgba(0, 0, 0, 0.6);
  }
  .shop-open #shopPanel #oddsLine { position: static; align-self: flex-start; }
  .shop-open #shopPanel #shopSide { flex-direction: row; justify-content: center; }

  /* touch targets ≥44px */
  .btn { min-height: 44px; }
  .btn.small { font-size: 13px; padding: 10px 14px; }
  #prepBtns .btn.primary { min-height: 46px; }

  /* full-width sheets for overlays/modals */
  #overlayPanel, #codexPanel, #oddsPanel, #quitPanel {
    width: 96vw; max-width: 96vw; max-height: 86dvh;
  }
  #reportPanel { left: 8px; right: 8px; width: auto; top: calc(56px + env(safe-area-inset-top)); }
  #tutBubble { max-width: min(320px, 90vw); }
}

/* desktop keeps the drawer button hidden */
@media (min-width: 1025px) and (min-aspect-ratio: 1/1) {
  #traitDrawerBtn, #shopBackdrop { display: none; }
}

#shopBackdrop { pointer-events: none; }
@media (max-width: 1024px), (max-aspect-ratio: 1/1) {
  .shop-drawer #shopBackdrop { pointer-events: auto; }
}

@media (max-width: 1024px), (max-aspect-ratio: 1/1) {
  #prepBtns { position: relative; z-index: 37; }
}

/* trait panel: live filter (hidden rows collapse smoothly) */
.trait-row {
  overflow: hidden;
  transition: max-height 0.24s ease, opacity 0.2s ease, padding 0.24s ease, border-width 0.24s ease;
  max-height: 60px;
}
.trait-row.hide {
  max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0;
  border-width: 0; margin: 0; pointer-events: none;
}
/* inline member medallions */
/* collapsed rows show only dot/name/count/pips — the on-board medallion
   strip was dropped to keep the panel narrow (expanded rows still list
   carriers in .tsec-merged) */
.trait-row .tmembers { display: none; }
.trait-row .tmem {
  position: relative; display: inline-flex; width: 20px; height: 20px; flex: none;
}
.trait-row .tmem img {
  width: 20px; height: 20px; object-fit: contain; border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 1px var(--gold-dim);
}
.trait-row .tmem i {
  position: absolute; right: -3px; bottom: -3px;
  font-style: normal; font-size: 7px; color: var(--gold);
  text-shadow: 0 0 3px rgba(255, 215, 106, 0.9);
  transform: scaleX(0.72);
  letter-spacing: -1px;
}

/* codex card: full trait beads row (wraps if needed) */
.codex-card .cc-beads { display: inline-flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.codex-card .cc-line { gap: 5px; flex-wrap: wrap; }
/* enemy entries reuse the player skeleton: night chip in the cost slot,
   boss tag + stars in the beads slot */
.codex-card .cc-cost {
  font-style: normal; white-space: nowrap;
  font-size: 10px; letter-spacing: 0.06em; color: var(--gold);
  border: 1px solid var(--gold-line); border-radius: 999px; padding: 1px 8px;
  background: rgba(255, 215, 106, 0.08);
}
.codex-card .cc-tag-boss {
  font-style: normal; font-size: 9px; color: #ff9aa6; letter-spacing: 0.08em;
  border: 1px solid rgba(255, 109, 122, 0.55); border-radius: 999px; padding: 0 6px;
}
.codex-card .cc-bstar { font-style: normal; font-size: 10px; color: var(--gold); letter-spacing: 1px; }
.codex-card .rng { margin-left: 0; }

/* ---------- range chips (近 warm / 远 cold) ---------- */
.rng {
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  font-size: 10px; line-height: 1.5; letter-spacing: 0.04em;
  border: 1px solid transparent;
}
.rng.near { background: rgba(120, 46, 52, 0.55); border-color: rgba(255, 120, 140, 0.55); color: #ffc3cc; }
.rng.far { background: rgba(47, 74, 85, 0.55); border-color: rgba(125, 182, 255, 0.55); color: #bfe0ff; }
.ovapanel .rng { font-size: 11px; padding: 2px 8px; }

/* bench slot: range tag top-left, cost coin top-right */
.bench-slot .slot-rng {
  position: absolute; top: 2px; left: 2px; z-index: 2;
  min-width: 12px; height: 11px; padding: 0 2px; border-radius: 4px;
  font-size: 8px; line-height: 11px; text-align: center;
}
.bench-slot .slot-rng.near { background: rgba(120, 46, 52, 0.85); color: #ffc3cc; }
.bench-slot .slot-rng.far { background: rgba(47, 74, 85, 0.85); color: #bfe0ff; }
.bench-slot .slot-cost {
  position: absolute; top: 2px; right: 2px; z-index: 2;
  width: 13px; height: 13px; border-radius: 50%;
  font-size: 8.5px; line-height: 13px; text-align: center;
  color: #261a03;
  background: radial-gradient(circle at 35% 28%, #fff0bd, #f0b93e 72%);
  border: 1.5px dashed rgba(122, 74, 10, 0.6);
  box-shadow: 0 0 4px rgba(255, 215, 106, 0.55);
}

/* accordion rows */
.trait-row .txpand { grid-column: 1 / -1; display: none; }
.trait-row.expanded .txpand { display: block; }
.trait-row .tsec { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.trait-row .tsec s {
  text-decoration: none; font-size: 10px; color: var(--text-dim);
  letter-spacing: 0.14em; margin-right: 2px;
}
.trait-row .tmem.miss img { filter: grayscale(0.85) brightness(0.55); }
.trait-row .tmem { cursor: pointer; }
.trait-row .tmem:hover img { box-shadow: 0 0 0 2px var(--gold); }
.trait-row .tdesc { margin-top: 4px; }
.trait-row .tdesc > div { color: var(--text-dim); }
.trait-row .tdesc > div.on { color: var(--text); }
.trait-row .tdesc > div.on b { color: var(--gold); }

/* expanded accordion rows need real room for the txpand block */
.trait-row.expanded { max-height: 420px; overflow: visible; z-index: 6; position: relative; }

/* header inline member preview hides while a row is expanded (merged list takes over) */
.trait-row.expanded .tmembers { display: none; }
.trait-row.expanded { max-height: 480px; }

/* ---------------- account / login / replay (v2) ---------------- */

/* account chip: flows as the last topbar item (no overlap with run HUD);
   on title/end screens it stays visible next to the volume control */
#accountBox {
  position: relative; display: flex; flex-direction: column; align-items: flex-end;
  font-size: 13px;
}
#accountBox .acc {
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  max-width: 44vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#accountBox .acc img { width: 18px; height: 18px; border-radius: 50%; }
#accountMenu {
  display: none; flex-direction: column; gap: 2px; min-width: 120px;
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 44;
  padding: 6px; border-radius: 10px;
  background: linear-gradient(180deg, rgba(23, 28, 62, 0.97), rgba(11, 14, 34, 0.98));
  border: 1px solid var(--gold-line);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
}
#accountMenu.show { display: flex; }
#accountMenu button {
  background: none; border: none; color: var(--text); font: inherit;
  text-align: left; padding: 7px 10px; border-radius: 7px; cursor: pointer;
}
#accountMenu button:hover { background: rgba(255, 215, 106, 0.12); }

/* history + daily-lobby + pvp-lobby + resume-choice modals share the night-gold modal look */
#historyModal, #dailyModal, #pvpModal, #resumeModal {
  position: fixed; inset: 0; z-index: 58; display: none;
  align-items: center; justify-content: center;
  background: rgba(5, 7, 18, 0.6);
}
#historyModal.show, #dailyModal.show, #pvpModal.show, #resumeModal.show { display: flex; }
/* #hud is pointer-events:none — modal overlays must explicitly opt back in,
   or every tap falls straight through to the game behind them */
#historyModal, #dailyModal, #pvpModal, #resumeModal, #quitModal, #warModal, #oddsModal { pointer-events: auto; }
#resumeModal { z-index: 59; } /* stacks above the daily lobby */
#resumeText { color: var(--text-dim); font-size: 14px; line-height: 1.8; text-align: center; margin: 4px 0 0; }
.modal-panel .modal-btns { display: flex; justify-content: center; gap: 12px; margin-top: 14px; }

/* run-start handshake spinner */
#runLoading {
  position: fixed; inset: 0; z-index: 70; display: none;
  align-items: center; justify-content: center; flex-direction: column; gap: 14px;
  background: rgba(5, 7, 18, 0.45); pointer-events: auto;
}
#runLoading.show { display: flex; }
#runLoading i {
  width: 42px; height: 42px; border-radius: 50%;
  border: 3px solid rgba(255, 215, 106, 0.22); border-top-color: var(--gold);
  animation: rr-spin 0.9s linear infinite;
}
#runLoading span { color: var(--gold); font-size: 14px; letter-spacing: 0.3em; }
@keyframes rr-spin { to { transform: rotate(360deg); } }
.modal-panel {
  width: min(560px, 94vw); max-height: 82dvh; overflow-y: auto;
  padding: 18px 20px; border-radius: 15px;
  background: linear-gradient(180deg, rgba(38, 46, 92, 0.34), rgba(14, 17, 40, 0) 34%), linear-gradient(180deg, rgba(23, 28, 62, 0.96), rgba(11, 14, 34, 0.98));
  border: 1px solid var(--gold-line);
  box-shadow: inset 0 1px 0 rgba(255, 232, 168, 0.14), 0 16px 48px rgba(0, 0, 0, 0.55);
  font-size: 14px;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px; color: var(--gold); font-size: 15px;
}

/* 我的战绩 rows */
.hs-row {
  display: flex; gap: 12px; align-items: baseline; width: 100%;
  padding: 9px 10px; margin-bottom: 6px; border-radius: 10px; cursor: pointer;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 215, 106, 0.14);
  color: var(--text); font: inherit; text-align: left;
}
.hs-row:hover:not(:disabled) { border-color: var(--gold); background: rgba(255, 215, 106, 0.08); }
.hs-row:disabled { opacity: 0.45; cursor: default; }
.hs-row b { color: var(--gold); font-weight: 600; }
.hs-row span { color: var(--text-dim); font-size: 13px; }

/* replay viewer nights */
.rp-night { margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px dashed rgba(255, 215, 106, 0.16); }
.rp-night:last-child { border-bottom: none; }
.rp-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rp-head b { color: var(--text); }
.rp-res.win { color: #8ef0c9; }
.rp-res.loss { color: #ff9d7a; }
.rp-meta { color: var(--text-dim); font-size: 12px; }
.rp-watch { margin-left: auto; }
.rp-ops { margin: 6px 0 0 18px; padding: 0; color: var(--text-dim); font-size: 13px; line-height: 1.7; }
.rp-noops { color: var(--text-faint, var(--text-dim)); font-size: 13px; margin: 6px 0 0; opacity: 0.7; }

/* ---------------- run-replay mode (planning-view night browser) ---------------- */
#runReplayBar, #runReplayOps { display: none; }
body.run-replay #runReplayBar {
  display: flex; align-items: center; gap: 10px;
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 46;
  padding: 8px 12px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(23, 28, 62, 0.94), rgba(11, 14, 34, 0.96));
  border: 1px solid var(--gold-line);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}
#rrNightChip b { color: var(--gold); }
#rrNightChip .rp-res.win { color: #8ef0c9; }
#rrNightChip .rp-res.loss { color: #ff9d7a; }
#rrStats { font-size: 12px; color: var(--text-dim); }
#rrStats b { color: var(--gold); }
/* read-only planning view: hide every interactive prep control. Board and
   bench stay pointer-enabled so pieces can be hovered/pinned for their
   (read-only) detail cards — all mutating ops are guarded by runReplay
   checks in main.js instead. */
body.run-replay #shopBar, body.run-replay #prepBtns, body.run-replay #sellZone,
body.run-replay #btnQuit, body.run-replay #btnCodexPrep, body.run-replay #btnRecruit { display: none !important; }
body.run-replay #waveChip, body.run-replay #slotsChip { pointer-events: none; }
@media (max-width: 1024px), (max-aspect-ratio: 1/1) {
  body.run-replay #runReplayBar { gap: 6px; padding: 6px 8px; font-size: 12px; }
}

/* leaderboard date/night nav + replay buttons */
#lbNav, #dailyLbNav, #pvpLbNav { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 4px 0 6px; font-size: 12px; }
#lbNav button, #dailyLbNav button, #pvpLbNav button {
  background: none; border: 1px solid rgba(255, 215, 106, 0.25); color: var(--text-dim);
  border-radius: 8px; padding: 2px 8px; cursor: pointer; font: inherit; font-size: 12px;
}
#lbNav button:hover:not(:disabled), #dailyLbNav button:hover:not(:disabled), #pvpLbNav button:hover:not(:disabled) { color: var(--gold); border-color: var(--gold); }
#lbNav button:disabled, #dailyLbNav button:disabled, #pvpLbNav button:disabled { opacity: 0.35; cursor: default; }
#lbDay, #dailyLbDay, #pvpLbNight { color: var(--text-dim); }
#lbList .lb-rp, #dailyLbList .lb-rp {
  background: none; border: none; color: var(--gold); cursor: pointer;
  font: inherit; font-size: 12px; padding: 0 2px; text-decoration: underline;
  text-underline-offset: 3px; opacity: 0.85;
}
#lbList .lb-rp:hover, #dailyLbList .lb-rp:hover { opacity: 1; }
#lbList li.me span:not(.rk), #dailyLbList li.me span:not(.rk), #pvpLbList li.me span:not(.rk), #pvpBoardList li.me span:not(.rk) { color: var(--gold); }

/* daily lobby modal */
#dailyRules {
  color: var(--text-dim); font-size: 13px; line-height: 1.9;
  margin: 0 0 10px; padding: 0 2px;
}
#dailyLbBoard { max-height: 46dvh; overflow-y: auto; }
#dailyPanel .modal-btns { display: flex; justify-content: center; margin-top: 14px; }

/* ---------------- 月面对战 (pvp ghost battles) ---------------- */
#pvpRules {
  color: var(--text-dim); font-size: 13px; line-height: 1.9;
  margin: 0 0 10px; padding: 0 2px;
}
#pvpLbBoard { max-height: 42dvh; overflow-y: auto; }
#pvpPanel .modal-btns { display: flex; justify-content: center; gap: 12px; margin-top: 14px; }
#pvpGuestNote { margin-bottom: 0; }

/* title buttons: three entries wrap on narrow screens */
#titleBtns { flex-wrap: wrap; justify-content: center; }

/* prep-phase 本夜排行 panel (pvp only, collapsible) */
#pvpBoard { display: none; }
body.mode-pvp.ph-prep #pvpBoard {
  display: block; position: fixed; right: 12px; top: 64px; z-index: 38;
  width: 248px; pointer-events: auto;
}
#pvpBoardToggle { width: 100%; justify-content: center; cursor: pointer; }
#pvpBoardBody {
  display: none; margin-top: 6px; padding: 8px; border-radius: 14px;
  max-height: 44dvh; overflow-y: auto;
  background: linear-gradient(180deg, rgba(23, 28, 62, 0.96), rgba(11, 14, 34, 0.97));
  border: 1px solid var(--gold-line);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
}
#pvpBoard.open #pvpBoardBody { display: block; }
#pvpBoardBody li { font-size: 12px; padding: 6px 9px; }
@media (max-width: 1024px), (max-aspect-ratio: 1/1) {
  body.mode-pvp.ph-prep #pvpBoard { right: 8px; top: calc(52px + env(safe-area-inset-top)); width: min(232px, 62vw); }
  body.mode-pvp.ph-prep #pvpBoard.under-report { display: none; } /* full-width 战报 wins the corner */
  #pvpBoardBody { max-height: 40dvh; }
}
