/* 萌兽朝堂 —— 卡通明亮风格 */
:root {
  --bg1: #ffe9a8;
  --bg2: #ffc7d9;
  --ink: #3a2a1a;
  --line: #3a2a1a;
  --panel: #fffaf0;
  --muted: #8a7a6a;
  --green: #4caf50;
  --blue: #2196f3;
  --purple: #9c27b0;
  --red: #f4511e;
  --gold: #ffb300;
  --l1: #e8e8e8;
  --l2: #4caf50;
  --l3: #2196f3;
  --l4: #9c27b0;
  --l5: #ff9800;
  --r-common: #9e9e9e;
  --r-rare: #26c6da;
  --r-epic: #d81b60;
  --r-legend: #ffc107;
  --spd: 1;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  background: linear-gradient(160deg, var(--bg1), var(--bg2)) fixed;
  background-color: var(--bg1);
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; justify-content: center; margin-top: 12px; }
.row.gap { gap: 12px; }

.app { max-width: 520px; margin: 0 auto; padding: 10px 12px 24px; min-height: 100vh; min-height: 100dvh; }
.app.scr-battle { padding: 6px 8px 8px; }
.screen { display: flex; flex-direction: column; gap: 10px; }

/* ---------- 按钮 ---------- */
.btn {
  font: inherit; font-weight: 800; color: #fff; cursor: pointer;
  border: 3px solid var(--line); border-radius: 16px; padding: 10px 16px;
  background: linear-gradient(180deg, #ffa726, #fb8c00);
  box-shadow: 0 4px 0 var(--line);
  transition: transform .08s, box-shadow .08s, filter .15s;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .25);
  touch-action: manipulation;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.btn small { font-size: 12px; opacity: .9; }
.btn.big { font-size: 19px; padding: 13px 18px; }
.btn.small { font-size: 14px; padding: 6px 10px; border-radius: 12px; box-shadow: 0 3px 0 var(--line); }
.btn.tiny { font-size: 12px; padding: 3px 8px; border-width: 2px; border-radius: 10px; box-shadow: 0 2px 0 var(--line); }
.btn.green { background: linear-gradient(180deg, #81c784, #43a047); }
.btn.blue { background: linear-gradient(180deg, #64b5f6, #1e88e5); }
.btn.purple { background: linear-gradient(180deg, #ba68c8, #8e24aa); }
.btn.red { background: linear-gradient(180deg, #ff8a65, #e64a19); }
.btn.ghost { background: #fff; color: var(--ink); text-shadow: none; }
.btn.disabled, .btn:disabled { filter: grayscale(.85) brightness(.95); opacity: .6; pointer-events: none; }

.pill {
  display: inline-flex; align-items: center; gap: 4px; align-self: center;
  background: #fff; border: 3px solid var(--line); border-radius: 999px;
  padding: 3px 12px; font-weight: 800; white-space: nowrap;
}
.pill.big { font-size: 20px; padding: 6px 18px; }
.pill.gold { background: #fff3c4; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.topbar .title { font-size: 20px; font-weight: 900; text-align: center; flex: 1; }
.sect { font-weight: 900; margin-top: 6px; }

@keyframes bob { 50% { transform: translateY(-6px); } }

/* ---------- 关卡 ---------- */
.app.scr-levels {
  max-width: 1000px;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}
body:has(.scr-levels) { background: radial-gradient(ellipse at 50% 0%, #284841, #102325 72%) fixed; }
.levels { --lv-gold: #f4d390; --lv-muted: #c7cdbb; color: #fff1d5; gap: 12px; }
.lv-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; }
.lv-top h1 { margin: 0; text-align: center; font: 900 clamp(21px, 5vw, 30px)/1.2 var(--serif); }
.lv-back, .lv-balance {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 0 9px; border: 1px solid #546d60; border-radius: 10px; background: #172f2e;
  color: #f8e9c7; font: inherit; font-size: 13px; font-weight: 750; line-height: 1.15; white-space: nowrap;
}
.lv-back { justify-self: start; min-height: 44px; cursor: pointer; font-family: inherit; touch-action: manipulation; }
.lv-balance { justify-self: end; min-height: 34px; font-variant-numeric: tabular-nums; }
.lv-balance i { width: 9px; height: 9px; transform: rotate(45deg); border-radius: 2px; background: #91d9eb; box-shadow: inset -2px -2px #4ba1ba; }
.lv-chapters { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 8px; min-height: 25px; }
.lv-chapters b { color: var(--lv-gold); font-size: 14px; }
.lv-chapters small { color: var(--lv-muted); font-size: 12px; }
.lv-chapters select {
  min-height: 44px; max-width: 100%; padding: 6px 10px; border: 1px solid #7a785c; border-radius: 8px;
  color: #f3e2bd; background: #172f30; color-scheme: dark; font: inherit; font-size: 14px; cursor: pointer;
}
.lv-chapters select:focus-visible { outline: 2px solid #ffe09b; outline-offset: 2px; }
.lv-content { display: grid; gap: 14px; }
.lv-feature {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 6px;
  min-height: 176px; padding: 16px; border: 1px solid #b09162; border-radius: 16px;
  background: linear-gradient(90deg, #101e23 3%, #142829f2 39%, #152a2d28 100%),
    url("assets/home/campaign-cover.webp") center 55% / cover;
}
.lv-content[data-chapter="1"] .lv-feature {
  background-image: linear-gradient(90deg, #101d2a 3%, #172937f2 39%, #182d3d33 100%), url("assets/home/court.webp");
}
.lv-kicker { color: var(--lv-gold); font-size: 12px; font-weight: 800; }
.lv-feature h2 { margin: 0; font: 900 clamp(27px, 7.4vw, 46px)/1.12 var(--serif); color: #fff2cf; }
.lv-feature p { margin: 0; color: #e6e4d4; font-size: 13px; line-height: 1.4; }
.lv-cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 16px; min-height: 44px; margin-top: 7px;
  padding: 6px 14px; border: 1px solid #ffe5a5; border-radius: 9px; color: #342516; background: #f2cf8b;
  font: inherit; font-size: 14px; font-weight: 900; cursor: pointer; touch-action: manipulation;
}
.lv-cta:hover { background: #ffe5ad; }
.lv-stages { display: grid; gap: 7px; min-width: 0; }
.lv-section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lv-section-head h2 { margin: 0; font: 850 18px/1.25 var(--serif); }
.lv-section-head span { color: var(--lv-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.lv-progress { width: 100%; height: 5px; appearance: none; border: 0; border-radius: 999px; background: #2a443e; accent-color: #aad0ad; }
.lv-progress::-webkit-progress-bar { background: #2a443e; border-radius: inherit; }
.lv-progress::-webkit-progress-value { background: #aad0ad; border-radius: inherit; }
.lv-progress::-moz-progress-bar { background: #aad0ad; border-radius: inherit; }
.lv-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 3px; }
.lv-card {
  display: grid; justify-items: center; align-content: center; gap: 3px; min-height: 54px; padding: 5px 4px;
  color: #f8ebcf; font: inherit; background: #1b3734; border: 1px solid #547165; border-radius: 9px;
  cursor: pointer; touch-action: manipulation;
}
.levels button:focus-visible { outline: 2px solid #ffe09b; outline-offset: 2px; }
.lv-card.locked { background: #152b2c; border-color: #3d5650; color: #c5c7ad; cursor: default; }
.lv-card.current { border-color: #ecc984; background: #31493f; color: #ffdfa0; }
.lv-card.cleared { border-color: #587964; color: #c6e9cb; }
.lv-card:enabled:hover { box-shadow: inset 0 0 0 1px #f8d491; }
.lv-n { font: 900 21px/1 var(--serif); font-variant-numeric: tabular-nums; }
.lv-status { color: var(--lv-muted); font-size: 11px; line-height: 1.3; white-space: nowrap; }
.lv-card.current .lv-status { color: #ffde9b; font-weight: 800; }
.lv-card.cleared .lv-status { color: #b4d9be; }
.lv-card.boss {
  grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr) auto; align-items: center; justify-items: start;
  gap: 8px; min-height: 80px; padding: 9px 82px 9px 12px; position: relative; overflow: hidden;
  border-color: #957452; background: linear-gradient(105deg, #352d2a, #3d2b26); color: #f2d9ad; text-align: left;
}
.lv-content[data-chapter="1"] .lv-card.boss {
  border-color: #6d8792; background: linear-gradient(105deg, #283847, #233044);
}
.lv-content .lv-card.boss.current { border-color: #f7c977; }
.lv-boss-copy { display: grid; gap: 4px; }
.lv-boss-copy small { color: #e0c8a9; font-size: 11px; }
.lv-boss-copy b { font: 900 22px/1.12 var(--serif); }
.lv-boss-art { position: absolute; right: 5px; bottom: 0; pointer-events: none; }
.lv-boss-art .lv-elder { width: 72px; height: 76px; border-radius: 0; background: transparent; }
.lv-boss-art .lv-elder img { object-fit: contain; object-position: bottom; }
@media (min-width: 720px) {
  .app.scr-levels { padding-inline: 22px; padding-top: 24px; }
  .levels { gap: 16px; }
  .lv-content { grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); gap: 16px; }
  .lv-feature { padding: 24px; }
  .lv-card { min-height: 60px; }
}

/* ---------- 元老头像 ---------- */
.eimg { display: inline-block; position: relative; border-radius: 50%; overflow: hidden; background: #fff3c4; vertical-align: middle; flex: none; }
.eimg img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.eimg b { display: none; position: absolute; inset: 0; align-items: center; justify-content: center; font-size: 1.4em; }
.eimg.noimg b { display: flex; }
.eimg.small { width: 36px; height: 36px; border: 2px solid var(--line); }
.eimg.mid { width: 64px; height: 64px; border: 3px solid var(--line); font-size: 28px; }
.eimg.big { width: 170px; height: 170px; border: 4px solid #fff; font-size: 80px; box-shadow: 0 0 40px #ffd54f; }
.eimg.ava { width: 40px; height: 40px; border: 3px solid var(--line); font-size: 20px; }
.eimg.unit-img { width: 62%; height: 62%; margin-top: 4%; font-size: 6cqw; border: 2px solid rgba(0, 0, 0, .3); }
.eimg.unit-img img { object-fit: contain; }
.eimg.gc-img { width: 70%; aspect-ratio: 1; height: auto; margin: 6px auto 2px; display: block; border: 2px solid #fff; font-size: 30px; }

/* ---------- 萌兽头像 ---------- */
.beast-portrait {
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; line-height: 1; vertical-align: middle; pointer-events: none;
}
.beast-portrait img { width: 100%; height: 100%; object-fit: contain; }
.beast-portrait [hidden] { display: none; }
.tip-portrait { width: 25px; height: 25px; }

/* ---------- 卡牌稀有度 ---------- */
.rar-bg-common { --card-edge: #817566; background: linear-gradient(145deg,#fffcf5,#dddcd4); }
.rar-bg-rare { --card-edge: #407b73; background: linear-gradient(145deg,#eefef6,#a6dbce); }
.rar-bg-epic { --card-edge: #8e5c9c; background: linear-gradient(145deg,#fff2ff,#debbeb); }
.rar-bg-legend { --card-edge: #ae762f; background: linear-gradient(145deg,#fff8dd,#f4cd78); }
.rar-common { color: #757575; }
.rar-rare { color: #00838f; }
.rar-epic { color: #ad1457; }
.rar-legend { color: #e65100; }
.ec-stars { color: #ff9800; letter-spacing: 1px; }

/* ---------- 对战 HUD ---------- */
.battle { gap: 6px; }
.hud { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 3px solid var(--line); border-radius: 16px; padding: 4px 8px; }
.ava { font-size: 30px; line-height: 1; }
.hud-col { display: flex; flex-direction: column; line-height: 1.15; }
.hud-name { font-weight: 900; font-size: 13px; }
.hearts { font-size: 13px; letter-spacing: -1px; }
.hud-mid { margin-left: auto; text-align: right; font-size: 12px; display: flex; gap: 6px; align-items: center; }
.hud-bot .pill { margin-left: auto; }

/* ---------- 棋盘 ---------- */
.arena-wrap { display: flex; }
.arena {
  position: relative; container-type: size;
  /* 棋盘可横向铺开，棋子文字仍受行高约束。 */
  --arena-unit: min(1cqw, .735cqh);
  width: 100%; min-width: 0;
  border: 3px solid var(--line); border-radius: 16px; overflow: hidden;
  background: linear-gradient(180deg, #ffd6d6 0%, #ffe7e7 47%, #c8e6c9 53%, #e8f5e9 100%);
  touch-action: none;
}
.cells, .units, .fxl { position: absolute; inset: 0; }
.fxl { pointer-events: none; z-index: 5; }
.cell { position: absolute; width: 20%; height: calc(100% / 8.5); padding: 2px; }
.cell::after { content: ""; position: absolute; inset: 3px; border-radius: 10px; border: 2px dashed rgba(0, 0, 0, .12); }
.cell.mine::after { border-color: rgba(46, 125, 50, .25); background: rgba(255, 255, 255, .25); }
.cell.front::after { border-style: solid; }
.cell.hot::after { background: rgba(255, 235, 59, .5); border-color: #f9a825; }
.cell.merge::after { background: rgba(255, 152, 0, .6); border-color: #e65100; border-style: solid; box-shadow: 0 0 10px #ff9800 inset; }
.river {
  position: absolute; left: 0; right: 0; top: calc(100% * 4 / 8.5); height: calc(100% * .5 / 8.5);
  background: repeating-linear-gradient(90deg, #81d4fa 0 18px, #4fc3f7 18px 36px); border-top: 2px solid #0288d1; border-bottom: 2px solid #0288d1;
}

/* ---------- 单位 ---------- */
.unit {
  position: absolute; width: 20%; height: calc(100% / 8.5); padding: 2px; z-index: 2;
  transition: left calc(.28s / var(--spd)) ease-out, top calc(.28s / var(--spd)) ease-out, opacity .5s;
  touch-action: none;
}
.unit.draggable { cursor: grab; }
.unit.dragging { opacity: .3; }
.unit .card {
  position: relative; width: 100%; height: 100%; border-radius: 12px; border: 3px solid var(--lc, #bbb);
  background: radial-gradient(circle at 50% 35%, #fff 0 35%, var(--lb, #f0f0f0) 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .35);
}
.unit.l1 { --lc: #bdbdbd; --lb: #e8e8e8; }
.unit.l2 { --lc: #4caf50; --lb: #c8e6c9; }
.unit.l3 { --lc: #2196f3; --lb: #bbdefb; }
.unit.l4 { --lc: #9c27b0; --lb: #e1bee7; }
.unit.l5 { --lc: #ff9800; --lb: #ffe0b2; }
.unit.l5 .card { box-shadow: 0 0 8px #ff9800, 0 2px 0 rgba(0, 0, 0, .35); }
.unit.enemy .card { filter: saturate(.95); }
.unit .emo { width: 88%; height: 76%; margin-top: 1px; font-size: calc(7.2 * var(--arena-unit, 1cqw)); }
.is-battle .unit .emo { height: 88%; }
.unit .nm {
  font-size: max(9px, 2.3 * var(--arena-unit, 1cqw)); font-weight: 800; white-space: nowrap; overflow: hidden; max-width: 96%;
  position: absolute; bottom: 9%; line-height: 1.1;
}
.unit .badge {
  position: absolute; right: -2px; bottom: 26%; font-size: calc(2.4 * var(--arena-unit, 1cqw)); font-weight: 900; color: #fff;
  background: var(--lc); border: 2px solid var(--line); border-radius: 8px; padding: 0 3px; line-height: 1.25;
}
.unit.l1 .badge { color: var(--ink); }
.unit .badge.lvb { background: linear-gradient(90deg, #ff5252, #ffb300, #66bb6a, #29b6f6, #ab47bc); }
.unit .ustars { position: absolute; left: 2px; top: 0; font-size: calc(1.8 * var(--arena-unit, 1cqw)); color: #ff9800; }
.unit .bossmark { position: absolute; left: 50%; top: -9px; transform: translateX(-50%); font-size: calc(1.9 * var(--arena-unit, 1cqw)); font-weight: 900; background: #d50000; color: #fff; border-radius: 6px; padding: 0 4px; border: 2px solid var(--line); z-index: 2; }
.unit .tmpmark { position: absolute; left: 2px; top: 1px; font-size: calc(2.6 * var(--arena-unit, 1cqw)); }
.unit .bars { position: absolute; left: 6%; right: 6%; bottom: 3%; height: 6%; display: none; }
.is-battle .unit .bars { display: block; }
.is-battle .unit .nm { display: none; }
.hpb, .shb { position: absolute; left: 0; right: 0; height: 100%; background: rgba(0, 0, 0, .3); border-radius: 3px; overflow: hidden; }
.hpb i, .shb i { display: block; height: 100%; width: 100%; transition: width .15s; }
.unit.ally .hpb i { background: #43a047; }
.unit.enemy .hpb i { background: #e53935; }
.shb { background: transparent; top: -110%; height: 70%; }
.shb i { background: #e0e0e0; box-shadow: 0 0 3px #fff; width: 0; }
.unit .stx { position: absolute; top: -2px; right: 0; font-size: calc(2.4 * var(--arena-unit, 1cqw)); }
.unit.dead { opacity: 0; pointer-events: none; }
.unit.stealth { opacity: .4; }
.unit.summon .card { border-style: dashed; }
.unit.pop .card { animation: pop .35s ease-out; }
.unit.hit .card { animation: hit .2s; }
.card.lunge { animation: lunge calc(.22s / var(--spd)) ease-out; }
@keyframes pop { 0% { transform: scale(.4); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes hit { 50% { filter: brightness(1.8) saturate(.3); } }
@keyframes lunge { 50% { transform: translate(var(--lx, 0), var(--ly, 0)); } }

/* 元老：彩虹流动边框 + 等级越高光效越强 */
@property --ang { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.unit.elder .card { border: 3px solid transparent; background: radial-gradient(circle at 50% 35%, #fffdf3, #ffe9a6) padding-box, conic-gradient(from var(--ang), #ff5252, #ffb300, #ffee58, #66bb6a, #29b6f6, #7e57c2, #ec407a, #ff5252) border-box; animation: spin-ang var(--espd, 3s) linear infinite; }
.unit.elder { --glw: 2px; }
.unit.elder .card { box-shadow: 0 0 var(--glw) #ffd54f, 0 2px 0 rgba(0, 0, 0, .35); }
.unit.elder.glow1, .unit.elder.glow2 { --glw: 3px; --espd: 4s; }
.unit.elder.glow3, .unit.elder.glow4 { --glw: 6px; --espd: 3.2s; }
.unit.elder.glow5, .unit.elder.glow6 { --glw: 10px; --espd: 2.4s; }
.unit.elder.glow7, .unit.elder.glow8, .unit.elder.glow9 { --glw: 14px; --espd: 1.7s; }
.unit.elder.glow10 { --glw: 22px; --espd: 1s; }
.unit.elder.glow10 .card { box-shadow: 0 0 var(--glw) #ffd54f, 0 0 calc(var(--glw) / 2) #fff, 0 2px 0 rgba(0, 0, 0, .35); }
@keyframes spin-ang { to { --ang: 360deg; } }

/* 拖拽影子 */
.drag-ghost { position: fixed !important; z-index: 1000; pointer-events: none; transform: translate(-50%, -50%) scale(1.12); opacity: .92; container-type: normal; }
.drag-ghost .card { width: 100%; height: 100%; }
.drag-ghost .emo { font-size: 32px !important; }
.drag-ghost .nm, .drag-ghost .badge { font-size: 11px !important; }

/* ---------- 战斗特效 ---------- */
.ftxt {
  position: absolute; transform: translate(-50%, -50%); font-weight: 900; font-size: 3.4cqw; white-space: nowrap;
  -webkit-text-stroke: 2.5px rgba(0, 0, 0, .85); paint-order: stroke fill; animation: floatup .9s ease-out forwards; z-index: 6;
}
.ftxt.dmg { color: #fff; }
.ftxt.dot { color: #ffab91; font-size: 2.8cqw; }
.ftxt.crit { color: #ffeb3b; font-size: 5.4cqw; }
.ftxt.heal { color: #69f0ae; }
.ftxt.shield { color: #e3f2fd; font-size: 2.8cqw; }
.ftxt.big { font-size: 4.6cqw; }
@keyframes floatup { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.7); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -190%) scale(1); } }
.crit { animation-name: floatcrit !important; }
@keyframes floatcrit { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.5); } 20% { opacity: 1; transform: translate(-50%, -60%) scale(1.5); } 100% { opacity: 0; transform: translate(-50%, -190%) scale(1.1); } }

.proj { position: absolute; width: 2.2cqw; height: 2.2cqw; margin: -1.1cqw 0 0 -1.1cqw; border-radius: 50%; background: #fff176; border: 2px solid #f57f17; box-shadow: 0 0 6px #ffeb3b; transition: left calc(.18s / var(--spd)) linear, top calc(.18s / var(--spd)) linear; z-index: 4; }
.proj.small { width: 1.4cqw; height: 1.4cqw; margin: -.7cqw 0 0 -.7cqw; background: #b3e5fc; border-color: #0277bd; }

.skname {
  position: absolute; left: 50%; top: -14%; transform: translateX(-50%); white-space: nowrap; z-index: 7;
  font-size: 2.4cqw; font-weight: 900; color: #fff; background: rgba(103, 58, 183, .92); border: 2px solid var(--line);
  border-radius: 8px; padding: 0 5px; animation: skpop 1.1s ease-out forwards; pointer-events: none;
}
@keyframes skpop { 0% { opacity: 0; transform: translate(-50%, 6px) scale(.6); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -10px); } }
.speech {
  position: absolute; left: 50%; bottom: 104%; transform: translateX(-50%); z-index: 9; pointer-events: none;
  background: #fff; color: var(--ink); border: 3px solid var(--line); border-radius: 14px; padding: 4px 8px;
  font-size: 3cqw; font-weight: 900; white-space: nowrap; animation: speechin .25s ease-out;
}
.speech::after { content: ""; position: absolute; left: 50%; top: 100%; margin-left: -7px; border: 7px solid transparent; border-top-color: var(--line); }
.unit.enemy .speech { bottom: auto; top: 104%; }
.unit.enemy .speech::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: var(--line); }
@keyframes speechin { from { transform: translateX(-50%) scale(.3); } to { transform: translateX(-50%) scale(1); } }
.unit:has(.speech) { z-index: 8; }

.cfx { position: absolute; transform: translate(-50%, -50%); font-size: 6cqw; z-index: 5; pointer-events: none; }
.cfx.ring { width: 22cqw; height: 22cqw; border-radius: 50%; border: 4px solid #fff; animation: ring .6s ease-out forwards; display: flex; align-items: center; justify-content: center; }
.cfx.ring.big { width: 50cqw; height: 50cqw; }
.cfx.ring.red { border-color: #ff5252; }
.cfx.ring.blue { border-color: #81d4fa; }
.cfx.ring.gold { border-color: #ffd54f; box-shadow: 0 0 20px #ffd54f; }
.cfx.ring.brown { border-color: #8d6e63; }
.cfx.ring.purple { border-color: #ba68c8; }
@keyframes ring { from { transform: translate(-50%, -50%) scale(.2); opacity: 1; } to { transform: translate(-50%, -50%) scale(1); opacity: 0; } }
.cfx.zap { animation: zap .5s steps(2) forwards; }
@keyframes zap { 0%, 100% { opacity: 0; } 30%, 70% { opacity: 1; } }
.cfx.meteor { font-size: 12cqw; animation: meteor .7s ease-in forwards; }
@keyframes meteor { from { transform: translate(-150%, -250%) scale(.6); } 80% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; } to { opacity: 0; transform: translate(-50%, -50%) scale(1.6); } }
.cfx.zone { font-size: 5cqw; opacity: .8; animation: flick .4s infinite alternate; z-index: 1; }
@keyframes flick { to { transform: translate(-50%, -55%) scale(1.15); } }
.cfx.hat { font-size: 6cqw; animation: hat 1s ease-in-out infinite alternate; }
@keyframes hat { from { transform: translate(-50%, -90%); } to { transform: translate(-50%, -130%); } }

.banner {
  position: absolute; left: 6%; right: 6%; top: 40%; z-index: 20; text-align: center;
  font-size: 9cqw; font-weight: 900; color: #fff; border: 4px solid var(--line); border-radius: 20px; padding: 10px;
  -webkit-text-stroke: 2px var(--line); paint-order: stroke fill; animation: pop .4s ease-out;
}
.banner small { display: block; font-size: 3.6cqw; -webkit-text-stroke: 0; color: #fff; }
.banner.win { background: linear-gradient(180deg, #81c784, #2e7d32); }
.banner.lose { background: linear-gradient(180deg, #e57373, #c62828); }
.banner.draw { background: linear-gradient(180deg, #90a4ae, #455a64); }

.screen-fx { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.sfx { position: absolute; inset: 0; animation: sfxbg 1.8s ease-out forwards; }
.sfx.feathers { background: radial-gradient(circle, rgba(255, 255, 255, .85), rgba(255, 213, 79, .5)); }
.sfx.blessing { background: radial-gradient(circle, rgba(255, 236, 179, .8), rgba(255, 82, 82, .25)); }
.sfx.meteorRain { background: rgba(255, 112, 67, .25); }
.sfx i { position: absolute; top: -10%; font-style: normal; font-size: 34px; animation: fall 1.4s ease-in forwards; }
.sfx-title { position: absolute; left: 0; right: 0; top: 40%; text-align: center; font-size: 48px; font-weight: 900; color: #fff; -webkit-text-stroke: 3px #6d4c41; paint-order: stroke fill; animation: pop .5s ease-out; }
.sfx-title.gold { color: #ffd54f; -webkit-text-stroke-color: #b71c1c; }
@keyframes sfxbg { 0% { opacity: 0; } 15% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }
@keyframes fall { to { top: 110%; transform: rotate(320deg); } }

/* ---------- 控制栏 ---------- */
.controls { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(0,1.3fr) minmax(0,1.05fr) minmax(36px,.55fr) minmax(38px,.7fr); gap: 6px; align-items: stretch; }
.controls .btn { padding: 8px 6px; font-size: 15px; }
.controls .auto-merge { padding-inline: 2px; background: linear-gradient(#40796c,#29594f); color: #fff4d8; white-space: nowrap; }
.controls .summon small { display: block; font-size: 11px; }
.battle-guide {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px;
  padding: 6px 9px; border: 1px solid #a27a44; border-radius: 9px;
  background: #233c36; color: #fff0ce; font-size: 12px; line-height: 1.4;
}
.battle-guide > div { flex: 1 1 140px; }
.battle-guide button {
  min-height: 44px; border: 1px solid #c19a5f; border-radius: 7px; padding: 4px 9px;
  background: #ffe1a1; color: #312316; font: inherit; font-weight: 750; cursor: pointer;
}
.battle-guide #guideSkip { color: #fff0ce; background: #2b453b; }
.guide-back .cell.mine[data-line="back"] { box-shadow: inset 0 0 0 2px #ffde89; }
.trash {
  display: flex; flex-direction: column; align-items: center; justify-content: center; border: 3px dashed var(--line);
  border-radius: 16px; background: #fff; font-size: 22px; line-height: 1; transition: transform .1s, background .1s;
}
.trash small { font-size: 11px; font-weight: 800; }
.trash.hot { background: #ffcdd2; transform: scale(1.12); border-style: solid; }
.trash.disabled { opacity: .45; }

/* ---------- 浮窗 / 弹窗 / 提示 ---------- */
.tip {
  position: fixed; z-index: 900; max-width: 280px; background: #fffef8; border: 3px solid var(--line); border-radius: 14px;
  padding: 8px 10px; font-size: 13px; box-shadow: 0 6px 0 rgba(0, 0, 0, .25); pointer-events: none;
}
.tip-h { font-weight: 900; font-size: 15px; }
.tip-s { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.tip-k { margin-top: 5px; padding: 4px 6px; border-radius: 8px; background: #f5f0e6; line-height: 1.4; }
.tip-k.cur { background: #fff3c4; outline: 2px solid #ffb300; }
.tip-k.locked { opacity: .45; }
.tip-k .lock { font-size: 11px; color: #c62828; font-weight: 800; }
.tip-x { margin-top: 6px; font-size: 12px; color: #5d4037; }
.lvtag { font-size: 12px; padding: 0 5px; border-radius: 6px; border: 2px solid var(--line); color: #fff; }
.lvtag.l1 { background: #bdbdbd; color: var(--ink); }
.lvtag.l2 { background: var(--l2); }
.lvtag.l3 { background: var(--l3); }
.lvtag.l4 { background: var(--l4); }
.lvtag.l5 { background: var(--l5); }

.modal { position: fixed; inset: 0; z-index: 800; background: rgba(40, 20, 0, .5); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { background: var(--panel); border: 4px solid var(--line); border-radius: 20px; padding: 16px; width: min(440px, 100%); max-height: 88vh; overflow: auto; animation: pop .25s ease-out; }
.mtitle { font-size: 20px; font-weight: 900; text-align: center; }
.dex-head { display: flex; gap: 12px; align-items: center; }
.dex-head .mtitle { text-align: left; }
.dex-head .eimg.big { width: 110px; height: 110px; font-size: 50px; }
.dex-emo { font-size: 50px; width: 80px; height: 80px; border: 3px solid var(--line); border-radius: 16px; display: flex; align-items: center; justify-content: center; flex: none; }
.dex-line { margin: 8px 0; font-weight: 800; color: #bf360c; text-align: center; }

.toast {
  position: fixed; left: 50%; top: 14%; transform: translateX(-50%); z-index: 1100; pointer-events: none;
  background: rgba(40, 25, 10, .9); color: #fff; padding: 8px 16px; border-radius: 999px; font-weight: 800; white-space: nowrap;
}
.toast.show { animation: toastin .25s ease-out; }
@keyframes toastin { from { transform: translate(-50%, 10px); opacity: 0; } }

/* ---------- 元老登场 ---------- */
.splash { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: pointer; background: radial-gradient(circle, #fff8e1 0%, #ffca28 45%, #e65100 100%); }
.splash .rays { position: absolute; left: 50%; top: 50%; width: 220vmax; height: 220vmax; margin: -110vmax 0 0 -110vmax; background: repeating-conic-gradient(rgba(255, 255, 255, .55) 0 8deg, transparent 8deg 20deg); animation: rays 12s linear infinite; }
@keyframes rays { to { transform: rotate(360deg); } }
.splash-in { position: relative; text-align: center; color: #fff; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px; }
.splash.on .splash-in { animation: splashin .7s cubic-bezier(.2, 1.6, .4, 1); }
.splash.on::before { content: ""; position: absolute; inset: 0; background: #fff; animation: flash .7s ease-out forwards; z-index: 2; pointer-events: none; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }
@keyframes splashin { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.sp-sub { font-weight: 900; font-size: 18px; background: rgba(0, 0, 0, .3); padding: 2px 14px; border-radius: 999px; }
.sp-title { font-size: 22px; font-weight: 900; color: #b71c1c; background: #fff; padding: 2px 16px; border-radius: 10px; border: 3px solid var(--line); }
.sp-name { font-size: 44px; font-weight: 900; -webkit-text-stroke: 3px #6d2c00; paint-order: stroke fill; text-shadow: 0 4px 0 #6d2c00; }
.sp-stars { font-size: 22px; color: #fff59d; -webkit-text-stroke: 1px #6d2c00; }
.sp-line { font-size: 20px; font-weight: 900; color: var(--ink); background: #fff; border: 3px solid var(--line); border-radius: 16px; padding: 6px 14px; max-width: 90vw; }
.sp-hint { font-size: 13px; opacity: .85; animation: bob 1.6s infinite; }
.bosstag { font-size: 16px; background: #d50000; color: #fff; padding: 0 6px; border-radius: 8px; -webkit-text-stroke: 0; text-shadow: none; vertical-align: middle; }

/* ---------- 招募 ---------- */
.gacha { --brass: #e7c786; --card-back: url("assets/cards/jade-seal.webp"); gap: 12px; }
.g-banner {
  display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); align-items: center; gap: 10px;
  padding: 12px; border: 1px solid #987950; border-radius: 12px;
  color: #fff1cc; background: radial-gradient(ellipse at 70% 0%, #38554a, transparent 75%), #172c2e;
  box-shadow: inset 0 0 0 3px #d7ab651b;
}
.g-bt h2 { margin: 0 0 6px; font: 900 clamp(19px, 5.3vw, 30px)/1.12 var(--serif); }
.g-bt span { color: #ead2a6; font-size: 12px; }
.g-bt progress { display: block; width: 100%; height: 5px; margin-top: 7px; accent-color: #efc371; }
.g-elders { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.g-elder {
  display: grid; justify-items: center; gap: 2px; min-width: 0; padding: 5px 2px;
  border: 1px solid #b99865; border-radius: 8px; background: radial-gradient(ellipse at 50% 25%, #ad895749, #1a3030 72%);
  text-align: center;
}
.g-elder.is-unowned { border-color: #657370; background: #233235; }
.g-elder .g-elder-art {
  width: min(100%, 75px); height: clamp(41px, 13vw, 66px); border: 0; background: transparent; border-radius: 0;
}
.g-elder-art img { object-fit: contain; }
.g-elder strong { font-size: 12px; }
.g-elder small { color: #e8c98d; font-size: 10px; }
.g-elder.is-unowned small { color: #c4ccca; }
.g-elder.is-unowned .g-elder-art, .gacha .eimg.is-unowned, .modal .eimg.is-unowned { filter: grayscale(1); opacity: .72; }
.g-summon { display: grid; gap: 10px; min-width: 0; }
.g-stage {
  position: relative; isolation: isolate; overflow: hidden; border-radius: 18px; border: 1px solid #ad8a52;
  background:
    radial-gradient(ellipse at 50% 48%, #0f222942, #0c1c29a8 76%),
    url("assets/cards/summon-chamber.webp") center / cover, #102430;
  box-shadow: inset 0 0 0 4px #e7c78621, 0 7px 17px #0715199e;
}
.g-stage::before {
  position: absolute; content: ""; inset: 0; pointer-events: none;
  background: radial-gradient(circle, #f4dd9b 1px, transparent 1.6px) 7px 9px / 39px 37px;
  opacity: .18; mask-image: radial-gradient(ellipse at center, #0000 12%, #000 85%);
}
.g-area { position: relative; z-index: 1; min-height: 290px; display: grid; align-items: center; padding: 14px; }
.g-empty { display: grid; justify-items: center; gap: 16px; color: #ffedc5; font-size: 13px; }
.g-idle-card {
  width: 108px; aspect-ratio: 3 / 4.25; border: 1px solid #d1ae70; border-radius: 9px;
  background: var(--card-back) center / cover, #1d423e; transform: rotate(-8deg);
  box-shadow: 6px 8px 0 #142333, 10px 13px 0 #274347, 12px 16px 0 #b99458, 0 0 30px #f6ca6b4d;
}
.g-reveal-line { display: flex; min-height: 44px; align-items: center; justify-content: space-between; gap: 8px; }
.g-reveal-line:has(.g-status:empty) { display: none; }
.g-status { min-width: 0; margin: 0; color: #ffedca; font-size: 12px; font-weight: 800; overflow-wrap: anywhere; }
.g-reveal-line :is(#gAll, #gCollection) { flex: none; min-height: 44px; white-space: nowrap; border: 1px solid #ad8b55; background: #253e39; color: #ffe7b2; box-shadow: none; }
.g-reveal-line #gStart { flex: none; min-height: 44px; border: 1px solid #f8d694; border-radius: 9px; background: #f2cc87; color: #352819; text-shadow: none; box-shadow: none; }
.g-rates { color: #d6cab0; text-align: center; font-size: 12px; line-height: 1.7; }
.g-rates summary { cursor: pointer; font-weight: 700; }
.g-btns { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.g-btns .btn { display: grid; justify-items: center; gap: 2px; min-height: 54px; border: 1px solid #a7834b; border-radius: 9px; padding: 6px 5px; box-shadow: inset 0 1px #ffedc652, 0 3px 0 #423221; }
.g-btns small { display: inline-flex; align-items: center; gap: 6px; }
.g-btns small i, .beast-balance i { width: 8px; height: 8px; transform: rotate(45deg); border: 1px solid #9ff8e3; background: #67baa8; }
.g-btns .blue { background: linear-gradient(#356762,#1d4546); color: #fff4d7; }
.g-btns .purple { background: linear-gradient(#ffe8a8,#d6a853); color: #342316; text-shadow: none; }
.g-btns .welcome-ten {
  border-color: #ffe3a4; box-shadow: inset 0 1px #fff5cf, 0 3px 0 #765024, 0 0 14px #f0cb7354;
}
.g-btns .welcome-ten small { font-weight: 850; }
.is-opening .g-btns { order: -1; grid-template-columns: minmax(0, 1fr); }
.is-opening #g1 { display: none; }
.is-opening #g10 { min-height: 60px; }
.g-btns button:focus-visible, .g-reveal-line button:focus-visible, .sp-continue:focus-visible { outline: 2px solid #ffe3aa; outline-offset: 2px; }

/* Verso, portrait, identity and outcome share one card frame. */
.g-cards { display: grid; align-items: center; gap: clamp(4px,1.5vw,9px); }
.g-cards.n10 { grid-template-columns: repeat(5,minmax(0,1fr)); }
.g-cards.n1 { grid-template-columns: minmax(0,190px); justify-content: center; padding: 5px 0; }
.r-common { --foil: #9dacae; --foil-dark: #46585b; --paper: #efefdf; }
.r-rare { --foil: #72e2da; --foil-dark: #125b65; --paper: #ddf4e9; }
.r-epic { --foil: #d4a0fc; --foil-dark: #683083; --paper: #efdefa; }
.r-legend { --foil: #ffd479; --foil-dark: #82510e; --paper: #fff0c9; }
.r-mythic { --foil: #fff0ad; --foil-dark: #753354; --paper: #fbe5e5; }
.gcard {
  --reveal: 0ms; position: relative; perspective: 760px; aspect-ratio: 3 / 5;
  animation: deal-card .38s var(--deal) both cubic-bezier(.2,.8,.2,1);
}
.g-cards.n1 .gcard { aspect-ratio: 3 / 4.6; animation-name: deal-single; }
.gc-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; }
.gcard.flipped .gc-inner { transform: rotateY(180deg); animation: reveal-card .32s var(--reveal) both cubic-bezier(.23,.66,.21,1); }
.gcard.r-rare.flipped .gc-inner { animation-name: reveal-glide; animation-duration: .45s; }
.gcard.r-epic.flipped .gc-inner { animation-name: reveal-orbit; animation-duration: .58s; }
.gcard.r-legend.flipped .gc-inner { animation-name: reveal-impact; animation-duration: .67s; }
.gcard.r-mythic.flipped .gc-inner { animation-name: reveal-prism; animation-duration: .76s; }
.gc-face { position: absolute; inset: 0; border-radius: 10px; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.gc-face.back {
  border: 1px solid #bd9b66;
  background: var(--card-back) center / cover, radial-gradient(circle,#318477,#16383b 42%,#0b2633);
  box-shadow: 0 5px 12px #0b1326aa;
}
.gcard.charging { z-index: 2; }
.gcard.charging .gc-inner { animation: charge-card .58s both cubic-bezier(.2,.7,.26,1); }
.gcard.charging .back { border-color: var(--foil); box-shadow: 0 0 12px var(--foil), 0 0 34px var(--foil-dark); }
.gcard.charging .back::after {
  content: ""; position: absolute; inset: -20%; pointer-events: none;
  background: linear-gradient(119deg, transparent 36%, var(--foil) 50%, transparent 60%);
  animation: foil-pass .56s ease-out both;
}
.gc-face.front {
  transform: rotateY(180deg); border: 1px solid var(--foil-dark);
  display: grid; grid-template-rows: auto minmax(0,1fr) auto auto; justify-items: center;
  padding: 5px 3px 4px;
  background: radial-gradient(ellipse at 50% 39%, #fffdf1 9%, transparent 65%), linear-gradient(150deg, var(--paper), #fff7e3 55%, var(--paper));
  color: #29221c; box-shadow: inset 0 0 0 1px var(--foil), 0 4px 8px #080f1c88;
}
.r-mythic .gc-face.front {
  background: radial-gradient(ellipse, #fff7e6 25%, transparent 69%), linear-gradient(146deg,#f8d6a4,#faedbf,#cceee1,#dfc8f1,#f8c7d8);
}
.gc-face.front::after {
  content: ""; position: absolute; inset: 2px; border: 1px solid #ffffff93;
  border-radius: 7px; pointer-events: none;
}
.gcard:not(.r-common).flipped .front::before {
  content: ""; position: absolute; inset: -20%; z-index: 3; pointer-events: none;
  background: linear-gradient(119deg, transparent 36%, #ffffff12 43%, #fffbd4ad 50%, transparent 60%);
  animation: foil-pass .64s calc(var(--reveal) + .26s) ease-out both;
}
.gc-star {
  display: flex; align-items: center; gap: 4px; color: var(--foil-dark); font-size: clamp(9px,2vw,11px);
  font-weight: 900; line-height: 1.2; letter-spacing: .12em;
}
.gc-star::before, .gc-star::after { content: ""; width: 4px; height: 4px; background: currentColor; transform: rotate(45deg); opacity: .68; }
.gc-portrait {
  position: relative; isolation: isolate; width: 94%; height: 100%; min-height: 0; display: grid; place-items: center;
  background: radial-gradient(ellipse, var(--foil) -40%, transparent 69%);
}
.gc-portrait::before {
  content: ""; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%) rotate(45deg);
  width: 60%; aspect-ratio: 1; border-radius: 25%; border: 1px solid var(--foil-dark); opacity: .19; z-index: -1;
}
.gc-emo { width: 100%; height: 100%; min-height: 0; max-width: 156px; font-size: 30px; }
.gc-portrait .gc-img { display: block; width: 72%; max-width: 125px; margin: 0; height: auto; max-height: 100%; border-color: var(--foil-dark); }
.gc-identity {
  width: 100%; display: grid; justify-items: center; gap: 3px; padding: 4px 1px 2px;
  border-top: 1px solid var(--foil); background: #fff7e280;
}
.gc-name { max-width: 100%; text-align: center; overflow-wrap: anywhere; font-size: clamp(9px,2.3vw,12px); font-weight: 900; line-height: 1.14; }
.gc-classline { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px; }
.gc-role {
  --role-ink: #44554d;
  display: inline-flex; align-items: center; justify-content: center; padding: 1px 5px;
  border: 1px solid currentColor; border-radius: 5px; color: var(--role-ink);
  background: #fff8e2; font-size: clamp(9px,2.1vw,11px); line-height: 1.1; font-weight: 800; white-space: nowrap;
}
.gc-role[data-role="M"] { --role-ink: #883f31; }
.gc-role[data-role="R"] { --role-ink: #176369; }
.gc-role[data-role="H"] { --role-ink: #365c2a; }
.gc-role[data-role="S"], .gc-role[data-role="X"] { --role-ink: #694780; }
.gc-range { display: none; color: #594839; }
.gc-note { min-height: 11px; align-self: center; line-height: 1; }
.gc-tag { display: block; color: #60463a; font-size: clamp(8px,1.85vw,10px); font-weight: 800; white-space: nowrap; }
.gc-tag.new { color: #8b3025; }
.gc-tag.star { color: #654314; }
.g-cards.n1 .gc-face.front { padding: 14px 9px 8px; border-radius: 12px; }
.g-cards.n1 .gc-identity { padding: 8px 2px 5px; gap: 7px; }
.g-cards.n1 .gc-name { font: 900 24px/1.1 "Songti SC", STSong, serif; }
.g-cards.n1 .gc-star { font-size: 14px; gap: 8px; }
.g-cards.n1 .gc-classline { gap: 8px; }
.g-cards.n1 .gc-role { font-size: 12px; padding: 3px 7px; }
.g-cards.n1 .gc-range { display: inline; font-size: 11px; }
.g-cards.n1 .gc-note { min-height: 15px; }
.g-cards.n1 .gc-tag { font-size: 12px; }

/* Tier cues occupy the space around the card, leaving the text clear. */
.gc-burst, .g-energy, .g-energy i { pointer-events: none; position: absolute; }
.gc-burst {
  inset: -42%; z-index: 3; opacity: 0;
  background: repeating-conic-gradient(transparent 0 23deg, var(--foil) 27deg, transparent 32deg 60deg);
  mask-image: radial-gradient(circle, transparent 27%, #000 34%, #000 41%, transparent 66%);
}
.gcard.flipped .gc-burst { animation: card-sparks .68s calc(var(--reveal) + .14s) ease-out both; }
.gcard.r-common .gc-burst, .gcard.r-rare .gc-burst { display: none; }
.g-energy { left: 50%; top: 50%; width: 90%; aspect-ratio: 1; opacity: 0; transform: translate(-50%,-50%); }
.g-energy.burst { animation: energy-life .92s ease-out both; }
.g-energy i { inset: 0; display: block; opacity: 0; }
.g-energy .g-seal { border: 2px solid var(--foil); border-radius: 50%; box-shadow: 0 0 25px var(--foil), inset 0 0 25px var(--foil); }
.g-energy .g-seal::after { content: ""; position: absolute; inset: 11%; border: 1px dashed var(--foil); border-radius: inherit; }
.g-energy .g-stars {
  background: repeating-conic-gradient(from 11deg, transparent 0deg 17deg, var(--foil) 19deg 20deg, transparent 21deg 30deg);
  mask-image: radial-gradient(circle, transparent 45%, #000 48% 51%, transparent 66%);
}
.g-energy .g-rays {
  background: repeating-conic-gradient(from 8deg, transparent 0deg 19deg, var(--foil) 24deg, transparent 34deg 45deg);
  mask-image: radial-gradient(circle, transparent 27%, #000 40% 55%, transparent 70%);
}
.g-energy.r-rare .g-rays {
  inset: 15% -28%; mask-image: none;
  background: linear-gradient(143deg,transparent 44%, #79fff257 49%, #bbffed 50%, #4bcac880 51%, transparent 56%);
}
.g-energy.r-rare.burst .g-rays { animation: cyan-slice .5s ease-out both; }
.g-energy.r-epic .g-seal { inset: 15%; border-radius: 15%; }
.g-energy.r-epic.burst .g-seal { animation: violet-sigil .76s cubic-bezier(.18,.65,.18,1) both; }
.g-energy.r-epic.burst .g-stars { animation: ember-field .76s .04s ease-out both; }
.g-energy.r-legend.burst .g-seal, .g-energy.r-mythic.burst .g-seal { animation: gold-ring .82s ease-out both; }
.g-energy.r-legend.burst .g-rays, .g-energy.r-mythic.burst .g-rays { animation: ray-fan .84s both; }
.g-energy.r-legend.burst .g-stars, .g-energy.r-mythic.burst .g-stars { animation: ember-field .91s .08s ease-out both; }
.g-energy.r-mythic .g-rays { background: conic-gradient(#fff7bb,#8effe0,#9fabff,#ff9cdf,#ffc57c,#fff7bb); }
.g-energy.r-mythic .g-seal { border-style: double; border-width: 5px; }
@keyframes deal-card { from { opacity: 0; transform: translateY(29px) rotate(-8deg) scale(.83); } }
@keyframes deal-single { from { opacity: 0; transform: translateY(34px) rotate(-14deg) scale(.72); } }
@keyframes charge-card { to { transform: translateY(-5%) rotateZ(-3deg) scale(1.06); } }
@keyframes reveal-card { from { transform: rotateY(0); } }
@keyframes reveal-glide { from { transform: rotateY(0) rotateX(-16deg) translateY(4%); } 60% { transform: rotateY(205deg) rotateX(8deg) translateY(-4%); } }
@keyframes reveal-orbit { from { transform: rotateY(0) rotateZ(-7deg) translateY(-5%); } 52% { transform: rotateY(122deg) rotateZ(11deg) scale(1.1); } 78% { transform: rotateY(190deg) rotateZ(-3deg); } }
@keyframes reveal-impact { from { transform: rotateY(0) scale(1.06); } 46% { transform: rotateY(88deg) scale(.87); } 68% { transform: rotateY(188deg) translateY(-8%) scale(1.14); } }
@keyframes reveal-prism { from { transform: rotateY(0) rotateX(14deg) scale(.94); } 48% { transform: rotateY(104deg) rotateX(-24deg) scale(1.19); } 73% { transform: rotateY(195deg) rotateX(11deg) scale(1.1); } }
@keyframes foil-pass { from { opacity: 0; transform: translateX(-62%); } 28% { opacity: .78; } to { opacity: 0; transform: translateX(62%); } }
@keyframes card-sparks { from { opacity: .92; transform: scale(.46) rotate(-25deg); } to { opacity: 0; transform: scale(1.31) rotate(31deg); } }
@keyframes energy-life { 0%, 100% { opacity: 0; } 10%, 78% { opacity: 1; } }
@keyframes cyan-slice { from { opacity: .8; transform: translateX(-14%); } to { opacity: 0; transform: translateX(20%); } }
@keyframes violet-sigil { from { opacity: .98; transform: scale(.37) rotate(45deg); } to { opacity: 0; transform: scale(1.24) rotate(115deg); } }
@keyframes gold-ring { from { opacity: 1; transform: scale(.28); } to { opacity: 0; transform: scale(1.42) rotate(-26deg); } }
@keyframes ray-fan { from { opacity: .9; transform: scale(.42) rotate(-24deg); } to { opacity: 0; transform: scale(1.26) rotate(14deg); } }
@keyframes ember-field { from { opacity: 1; transform: scale(.5) rotate(9deg); } to { opacity: 0; transform: scale(1.44) rotate(-12deg); } }

.recruit-splash {
  background: radial-gradient(ellipse at 50% 43%, #4c3f6773, #14253dd8 62%, #121c2b),
    url("assets/cards/summon-chamber.webp") center / cover, #21314b;
}
.recruit-splash .rays {
  opacity: .58; background: repeating-conic-gradient(from 12deg, #ffe29968 0deg 4deg, transparent 10deg 24deg);
  mask-image: radial-gradient(circle,#000 4%,transparent 37%);
}
.recruit-splash.on::before { background: linear-gradient(120deg,#8b7bff,#ffd996); animation: recruit-flash .68s ease-out both; }
.recruit-splash .sp-orbit {
  position: absolute; left: 50%; top: 44%; width: min(83vw,480px); aspect-ratio: 1;
  border-radius: 50%; border: 2px double #ffeeae; box-shadow: 0 0 56px #eacc859c, inset 0 0 30px #bb9df480;
  animation: constellation-rise 1s both;
}
.recruit-splash .sp-orbit::before, .recruit-splash .sp-orbit::after {
  content: ""; position: absolute; inset: 10%; border: 1px dashed #ffe0aaa6; border-radius: 50%;
}
.recruit-splash .sp-orbit::after { inset: 18%; border-style: solid; border-color: #d6affb92; }
.recruit-splash .eimg.big { border-color: #ffe1a4; box-shadow: 0 0 45px #f6c572ad; }
.recruit-splash .sp-name { color: #fff5d5; }
.recruit-splash .sp-title { background: #f8db9b; color: #5b342c; border: 1px solid #c5a064; }
.sp-continue {
  min-height: 44px; margin-top: 12px; padding: 7px 20px; border: 1px solid #c5a064; border-radius: 9px;
  background: #f9df9f; color: #3b2b20; font: inherit; font-weight: 900; cursor: pointer;
}
@keyframes constellation-rise { from { opacity: 0; transform: translate(-50%,-50%) scale(.32) rotate(-30deg); } to { opacity: .78; transform: translate(-50%,-50%) scale(1) rotate(20deg); } }
@keyframes recruit-flash { from { opacity: .45; } to { opacity: 0; } }
@media (max-width: 450px) {
  .g-cards.n10 { grid-template-columns: repeat(4,minmax(0,1fr)); }
}
@media (max-width: 380px) {
  .g-banner { padding: 9px; }
  .g-area { padding: 9px; min-height: 238px; }
  .g-cards.n1 { grid-template-columns: minmax(0,166px); }
}
@media (prefers-reduced-motion: reduce) {
  .gcard, .gcard.charging .gc-inner, .gcard.flipped .gc-inner, .gcard.flipped .gc-burst,
  .g-energy.burst, .g-energy.burst i, .recruit-splash .rays, .recruit-splash.on::before,
  .recruit-splash.on .splash-in, .recruit-splash .sp-orbit { animation: none; }
  .gcard.flipped .front::before, .gcard.charging .back::after, .recruit-splash .sp-orbit { display: none; }
}

/* ---------- 结算 ---------- */
.result { align-items: center; text-align: center; padding-top: 5vh; }
.res-emo { font-size: 84px; animation: bob 2s infinite; }
.result h2 { font-size: 34px; margin: 0; -webkit-text-stroke: 2px var(--line); paint-order: stroke fill; color: #66bb6a; }
.result.lose h2 { color: #ef5350; }
.res-sub { color: var(--muted); font-weight: 700; }
.res-timeout, .res-report { width: min(100%, 380px); margin: 0; padding: 9px 12px; border: 1px solid #ac8d60; border-radius: 10px; background: #fff7e3; }
.res-timeout { font-size: 13px; }
.res-report { text-align: left; color: #312619; font-size: 13px; }
.res-report h3 { margin: 0 0 5px; font-size: 16px; }
.res-report table { width: 100%; border-collapse: collapse; }
.res-report th, .res-report td { padding: 4px 1px; border-bottom: 1px solid #e4d3ad; text-align: right; }
.res-report tbody th { text-align: left; font-weight: 600; }
.res-report td { font-variant-numeric: tabular-nums; }
.res-report p { margin: 7px 0 0; line-height: 1.45; }
.res-report .res-tip { padding: 6px 8px; border-radius: 5px; background: #e6eddc; }
.res-lines { width: min(360px, 100%); background: var(--panel); border: 3px solid var(--line); border-radius: 16px; padding: 8px 12px; }
.res-line { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dashed #d7ccc8; }
.res-line.total { border-bottom: 0; font-size: 18px; font-weight: 900; }
.res-btns { display: flex; flex-direction: column; gap: 10px; width: min(300px, 100%); }

@media (max-width: 380px) {
  .controls .btn { padding-inline: 2px; font-size: 12px; }
}

/* 设置 */
.settings-entry {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; padding: 5px 12px; border: 1px solid #92764e; border-radius: 10px;
  background: #1c3332; color: #ffebc3; font: inherit; font-size: 13px; font-weight: 750; cursor: pointer;
}
.settings-gear { color: #f2ca83; font: 20px/1 system-ui, sans-serif; }
.settings-dialog {
  width: min(350px, calc(100% - 32px)); max-height: calc(100dvh - 32px);
  padding: 14px; border: 1px solid #a78656; border-radius: 16px;
  background: linear-gradient(150deg, #2a4540, #142c2e 75%); color: #fff0d0;
  box-shadow: 0 22px 54px #051316b3;
}
.settings-dialog::backdrop { background: #081319ac; }
.settings-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 9px 4px; }
.settings-head h2 { margin: 0; font-size: 21px; }
.settings-close {
  width: 44px; height: 44px; padding: 0; border: 1px solid #738579; border-radius: 9px;
  background: #172e30; color: #ffe8b7; font: 24px/1 system-ui, sans-serif; cursor: pointer;
}
.settings-toggle {
  display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 10px; width: 100%; min-height: 51px;
  padding: 8px 10px; border: 1px solid #577269; border-radius: 9px; color: inherit; background: #172f31;
  font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.settings-toggle + .settings-toggle { margin-top: 7px; }
.settings-switch { position: relative; width: 38px; height: 22px; border: 1px solid #7b8f85; border-radius: 12px; background: #283c3c; }
.settings-switch::after { content: ""; position: absolute; inset: 3px auto auto 3px; width: 14px; height: 14px; background: #d9e1d5; border-radius: 50%; }
.settings-toggle[aria-checked="true"] .settings-switch { border-color: #edcf93; background: #e1b878; }
.settings-toggle[aria-checked="true"] .settings-switch::after { transform: translateX(16px); background: #3c3022; }
.settings-entry:focus-visible, .settings-dialog button:focus-visible { outline: 2px solid #ffe1a0; outline-offset: 2px; }
.audio-glyph { width: 17px; height: 17px; position: relative; color: #f2ca83; }
.audio-note::before, .audio-note::after, .audio-wave::before {
  content: ""; position: absolute; box-sizing: border-box;
}
.audio-note::before {
  left: 1px; bottom: 2px; width: 6px; height: 4px; border-radius: 60%; background: currentColor;
  box-shadow: 8px -2px currentColor; transform: rotate(-12deg);
}
.audio-note::after {
  left: 5px; top: 3px; width: 9px; height: 10px; border: 1.4px solid currentColor;
  border-bottom: 0; transform: skewY(-12deg);
}
.audio-wave::before {
  inset: 2px 0;
  background:
    linear-gradient(currentColor,currentColor) 0 50% / 1.5px 4px,
    linear-gradient(currentColor,currentColor) 4px 50% / 1.5px 9px,
    linear-gradient(currentColor,currentColor) 8px 50% / 1.5px 13px,
    linear-gradient(currentColor,currentColor) 12px 50% / 1.5px 8px,
    linear-gradient(currentColor,currentColor) 16px 50% / 1.5px 4px;
  background-repeat: no-repeat;
}
@media (hover: hover) {
  .settings-entry:hover, .settings-dialog button:hover { border-color: #dfb77d; background-color: #354b41; }
}

/* ---------- 萌兽页签与收藏 ---------- */
body:has(.scr-gacha) {
  position: relative; color: #f6eacb;
  background: radial-gradient(ellipse at 50% 0%, #364b40, #182f31 46%, #0c2024 88%) fixed;
}
.app.scr-gacha {
  max-width: 1080px; padding-inline: clamp(10px, 3.5vw, 24px); padding-top: max(10px, env(safe-area-inset-top));
}
.beast-header {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center;
  gap: 6px; padding: 6px 0 7px; border-bottom: 1px solid #b4955c68;
}
.beast-header h1 { margin: 0; color: #ffe8b0; font: 900 clamp(23px, 6vw, 37px)/1.1 var(--serif); white-space: nowrap; letter-spacing: .05em; }
.beast-back, .beast-balance {
  display: inline-flex; justify-content: center; align-items: center; gap: 6px; justify-self: start;
  min-width: 0; max-width: 100%; min-height: 44px; padding: 4px 8px; border: 1px solid #927750;
  border-radius: 8px; background: #152c2e; color: #ffedc5; font: inherit; font-size: 12px; font-weight: 800;
}
.beast-back { cursor: pointer; white-space: nowrap; }
.beast-balance { justify-self: end; font-variant-numeric: tabular-nums; }
.beast-balance i { flex: none; }
.beast-balance b { overflow-wrap: anywhere; }
.beast-tabs {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 12; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px;
  padding: 4px; border: 1px solid #736f55; border-radius: 12px; background: #12282b;
  box-shadow: 0 4px 9px #08161988;
}
.beast-tabs button, .collection-ownership button {
  min-height: 44px; cursor: pointer; border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: inherit; font: inherit; font-weight: 800;
}
.beast-tabs button {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 9px; min-width: 0;
  min-height: 55px; padding: 4px 9px; border-color: #5c7369; background: radial-gradient(ellipse at left, #3c52464f, transparent 80%), #1c3434;
  text-align: left; color: #e2dbc5;
}
.beast-tabs button[aria-pressed="true"] {
  color: #ffe7a9; background: radial-gradient(ellipse at 30% 0, #85674058, transparent 80%), #2b4038;
  border-color: #d4aa69; box-shadow: inset 0 -2px #d4aa69, inset 0 0 0 2px #e6c7891c;
}
.beast-tabs button > span:last-child { display: grid; gap: 2px; }
.beast-tabs b { font: 900 17px/1.1 var(--serif); letter-spacing: .1em; }
.beast-tabs small { color: #d1c6ab; font-size: 10px; line-height: 1.2; }
.beast-tab-icon { flex: none; width: 34px; height: 34px; display: grid; place-items: center; }
.beast-tab-icon .beast-tab-owl { width: 37px; height: 37px; filter: drop-shadow(0 2px 2px #071012); }
.beast-tab-icon > img { width: 25px; height: 31px; object-fit: cover; border: 1px solid #e0bc79; border-radius: 4px; transform: rotate(-9deg); }
.beast-tabs button:disabled { opacity: .5; cursor: default; }
.beast-recruit { display: grid; grid-template-columns: minmax(0, 1fr); gap: 11px; }
@media (min-width: 800px) {
  .beast-recruit { grid-template-columns: minmax(210px, .75fr) minmax(0, 2fr); align-items: start; }
  .g-banner { grid-template-columns: minmax(0, 1fr); padding: 15px; gap: 14px; }
  .g-elder { padding-block: 8px; }
  .g-elder .g-elder-art { height: 83px; }
  .g-area { min-height: 330px; }
}
/* 兽鉴殿 */
.collection-panel { display: grid; gap: 14px; color: #f4e7c7; }
.collection-sidebar { display: grid; align-content: start; gap: 8px; min-width: 0; }
.collection-summary { display: grid; gap: 8px; padding: 1px 3px; }
.collection-summary > div { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.collection-summary h2 { margin: 0; font: 900 clamp(23px,6vw,34px)/1.08 var(--serif); letter-spacing: .07em; color: #ffebba; }
.collection-summary p {
  display: flex; align-items: baseline; gap: 4px; margin: 0; color: #ccd2b9; font-size: 11px; font-weight: 700;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.collection-summary p strong { font-size: 18px; color: #ffdf9f; }
.collection-summary progress { width: 100%; height: 3px; border: 0; overflow: hidden; appearance: none; background: #101f25; color: #dfb671; }
.collection-summary progress::-webkit-progress-bar { background: #101f25; }
.collection-summary progress::-webkit-progress-value { background: linear-gradient(90deg,#8ba583,#f0c783); }
.collection-summary progress::-moz-progress-bar { background: #e7bf80; }

.collection-preview {
  --rank-accent: #b0c3b7; --rank-glow: #a1d5b927;
  position: relative; min-width: 0; overflow: hidden; border: 1px solid #b39762; border-radius: 13px;
  background: #152c2c; box-shadow: 0 8px 25px #07131776; scroll-margin-top: 54px;
}
.collection-stage-art {
  position: relative; isolation: isolate; display: grid; justify-items: center; align-items: end;
  min-height: clamp(170px,48vw,265px); padding: 8px 0 13px;
  background: radial-gradient(ellipse at 50% 43%,var(--rank-glow),#10303419 45%,#101e2491 89%),
    url("assets/home/beast-hall.webp") center 54% / cover, #243f37;
}
.collection-stage-art::before {
  content: ""; position: absolute; inset: 5px; z-index: -1; border: 1px solid #f3c98248; border-bottom: 0;
  border-radius: 9px 9px 0 0; pointer-events: none;
}
.collection-hero {
  position: relative; width: clamp(123px,38vw,207px); height: clamp(118px,38vw,204px); display: grid; place-items: center;
  animation: collection-appear .32s cubic-bezier(.2,.64,.26,1) both;
  filter: drop-shadow(0 13px 8px #14211cdb);
}
.collection-hero .collection-hero-art { width: 100%; height: 100%; }
.collection-hero .collection-hero-elder {
  width: clamp(85px,27vw,146px); height: clamp(103px,30vw,173px); border: 2px solid var(--rank-accent);
  border-radius: 43% 43% 12% 12% / 30% 30% 10% 10%; box-shadow: 0 0 22px #efdc9845;
}
.collection-stage-art.uncollected .collection-hero { opacity: .7; filter: grayscale(1) drop-shadow(0 10px 8px #14211cd1); }
.collection-stage-art.uncollected .collection-hero .is-unowned { opacity: 1; }
.collection-stage-info {
  display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; column-gap: 7px; row-gap: 5px;
  padding: 10px; background: linear-gradient(145deg,#29433a,#192f30); border-top: 1px solid #a9916278;
}
.collection-stage-heading { min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.collection-stage-heading h2 { margin: 0; color: #fff1ce; font: 900 clamp(19px,4.9vw,26px)/1.12 "Songti SC", STSong, serif; }
.collection-rarity { color: var(--rank-accent); font-size: 11px; font-weight: 800; }
.collection-stage-meta { min-width: 0; display: flex; gap: 3px 8px; flex-wrap: wrap; color: #cbd8c1; font-size: 11px; }
.collection-stage-rank { color: #ffe0a0; font-weight: 800; }
.collection-skill {
  grid-column: 2; grid-row: 1 / 3; min-height: 44px; border: 1px solid #efcf92; padding: 4px 8px; border-radius: 6px;
  background: linear-gradient(#f1d799,#c79c5b); color: #312417; font: inherit; font-size: 12px; white-space: nowrap; font-weight: 900; cursor: pointer;
}
.collection-stage-empty { padding: 9px; margin: 0; text-align: center; color: #d7c7a7; }

.collection-browser {
  min-width: 0; padding: 8px; border: 1px solid #657867; border-radius: 10px;
  background: linear-gradient(158deg,#263e36,#152d30 70%);
}
.collection-filters { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 6px; margin-bottom: 8px; }
.collection-ownership { display: grid; grid-template-columns: 1fr 1.23fr .82fr; grid-column: 1/-1; gap: 3px; border-bottom: 1px solid #53695b; }
.collection-ownership button { min-width: 0; min-height: 44px; padding: 3px 4px; font-size: 12px; color: #cbd6c4; white-space: nowrap; }
.collection-ownership button[aria-pressed="true"] { color: #ffe4ac; background: #3e493a; border-color: #8f7a55; }
.collection-tools { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 5px; }
.collection-query { position: relative; display: block; min-width: 0; }
.collection-query::before, .collection-query::after { content: ""; position: absolute; pointer-events: none; }
.collection-query::before { width: 9px; height: 9px; border: 1px solid #bcbda4; border-radius: 50%; left: 10px; top: 15px; }
.collection-query::after { width: 6px; height: 1px; background: #bcbda4; left: 18px; top: 25px; transform: rotate(45deg); }
.collection-filters :is(input,select) {
  min-width: 0; min-height: 44px; width: 100%; border: 1px solid #657767; border-radius: 7px;
  padding: 4px 5px; color: #f3e8cc; font: inherit; font-size: 12px; background: #192f31; color-scheme: dark;
}
.collection-filters #collection-query { padding-left: 28px; }
.collection-filters #collection-query::placeholder { color: #bac8b4; }
.gacha :is(.beast-back, .beast-tabs button):focus-visible,
.collection-panel :is(button,input,select):focus-visible { outline: 2px solid #ffda97; outline-offset: 2px; }
.collection-count { margin: 0 0 7px; color: #bed0bc; font-size: 12px; font-weight: 700; }
.collection-count:empty { display: none; }
.collection-group + .collection-group { margin-top: 11px; }
.collection-group h2 {
  display: flex; align-items: center; gap: 6px; margin: 0 0 5px;
  color: #e6d0a5; font: 900 16px/1.15 "Songti SC", STSong, serif; letter-spacing: .06em;
}
.collection-group h2::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg,#93826780,transparent); }
.collection-group h2 small { font: 700 11px/1.2 system-ui,sans-serif; color: #c1cebb; }
.collection-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 6px; }
.collection-card {
  --rank-accent: #aabdb0; min-width: 0; display: grid; justify-items: center; gap: 3px;
  padding: 3px 2px 4px; border: 1px solid #60786c; border-top-color: var(--rank-accent); border-radius: 7px;
  background: #1a3133; color: #f4e9d0; font: inherit; text-align: center; cursor: pointer; touch-action: manipulation;
}
.collection-card[data-rarity="rare"], .collection-preview[data-rarity="rare"] { --rank-accent: #8cd7c2; --rank-glow: #6be0be37; }
.collection-card[data-rarity="epic"], .collection-preview[data-rarity="epic"] { --rank-accent: #d8b6ee; --rank-glow: #c299f344; }
.collection-card[data-rarity="legend"], .collection-preview[data-rarity="legend"] { --rank-accent: #f5c986; --rank-glow: #ffe0a04d; }
.collection-card[data-rarity="mythic"], .collection-preview[data-rarity="mythic"] { --rank-accent: #f5bbd6; --rank-glow: #f5afd546; }
.collection-card[aria-pressed="true"] { background: #3d453a; border-color: #f2d28e; box-shadow: inset 0 0 0 1px #f7c77c6f, 0 0 8px #e9bc662f; }
.collection-portrait { position: relative; width: 100%; height: 52px; display: grid; place-items: center; border-radius: 5px; background: radial-gradient(ellipse,#eee2c85e,#ebe8b712); }
.collection-portrait .collection-art { width: 97%; height: 50px; }
.collection-portrait .collection-elder { height: 44px; width: 44px; border: 1px solid #b29b6c; }
.collection-card strong { max-width: 100%; font-size: 11px; line-height: 1.15; overflow-wrap: anywhere; }
.collection-meta { display: flex; justify-content: center; flex-wrap: wrap; gap: 2px 5px; min-width: 0; align-items: baseline; }
.collection-tile-role { color: #bdcbb9; font-size: 9px; }
.collection-stars { color: #ffe0a0; font-size: 10px; font-weight: 800; white-space: nowrap; }
.collection-stars.unraised, .collection-locked { color: #b2c4b5; font-size: 9px; white-space: nowrap; }
.collection-card.uncollected .collection-art { filter: grayscale(.9); opacity: .6; }
.collection-card.uncollected:has(.collection-elder) .collection-portrait { background: radial-gradient(ellipse, #a8b0ac3b, transparent); }
.collection-new { position: absolute; right: 2px; top: 1px; border-radius: 3px; padding: 1px 3px; color: #ffecc4; background: #8b4037; font-size: 9px; font-weight: 800; }
.collection-empty { margin: 0; padding: 17px 7px; border: 1px dashed #728474; border-radius: 6px; color: #dbe1c9; text-align: center; }
@keyframes collection-appear { from { opacity: .5; transform: translateY(8px) scale(.89); } }
@media (hover: hover) { .collection-card:hover { border-color: #eaca8b; } }
@media (max-width: 375px) {
  .collection-filters { grid-template-columns: minmax(0,1fr); }
  .collection-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (min-width: 720px) {
  .collection-panel { grid-template-columns: minmax(300px,43%) minmax(0,1fr); column-gap: 15px; }
  .collection-sidebar { position: sticky; top: 60px; align-self: start; }
  .collection-browser { padding: 12px; }
  .collection-grid { grid-template-columns: repeat(5,minmax(0,1fr)); }
  .collection-portrait { height: 62px; }
  .collection-portrait .collection-art { height: 60px; }
  .collection-card strong { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { .collection-hero { animation: none; } }

/* ---------- 主城 ---------- */
body:has(.scr-menu) {
  background: radial-gradient(ellipse at 48% 5%, #273f38, #101f22 62%, #0a1519) fixed;
}
.app.scr-menu {
  max-width: 1272px;
  padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.home { gap: 0; color: #fff1cf; }
.home button:focus-visible { outline: 2px solid #ffe5a6; outline-offset: 2px; }
.home button { touch-action: manipulation; }
.home-stage {
  position: relative; isolation: isolate; display: flex; flex-direction: column; justify-content: space-between;
  gap: 18px; min-height: clamp(418px, 70svh, 660px); padding: clamp(18px, 3.3vw, 42px);
  border: 1px solid #a48250; border-bottom: 0; border-radius: 23px 23px 0 0; overflow: hidden; background: #142a29;
}
.home-scenery { position: absolute; inset: 0 0 0 23%; z-index: -2; mask-image: linear-gradient(90deg, transparent, #000 22%); }
.home-scenery img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 56%; }
.home-stage::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(90deg, #112525 15%, #132927e8 25%, #13292735 48%, transparent 63%),
    linear-gradient(180deg, #071516af 0%, transparent 28%, transparent 63%, #0e2122e8);
}
.home-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.home-top h1 {
  align-self: center; margin: 0; color: #ffdf9a; white-space: nowrap;
  font: 900 clamp(36px, 5.3vw, 74px)/1.12 "Songti SC", STSong, "Noto Serif CJK SC", serif;
  letter-spacing: .065em; text-shadow: 0 3px #482c1e, 0 6px 18px #050c0e;
}
.home-stats { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; }
.home-stat, .home #settingsButton {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px;
  padding: 5px 10px; border: 1px solid #ad8b59; border-radius: 9px;
  color: #fff1cf; background: #122629f2; font: inherit; font-size: 13px; white-space: nowrap;
  box-shadow: inset 0 1px #ffffff14, 0 2px 6px #0a121585;
}
.home #settingsButton { font-weight: 750; }
.home #settingsButton .settings-gear { font-size: 17px; }
.home-stat b { font-variant-numeric: tabular-nums; }
.home-stat i {
  flex: none; width: 9px; height: 9px; transform: rotate(45deg); border: 1px solid #b2ffed;
  background: linear-gradient(135deg, #acffde, #64bcb2); box-shadow: 0 0 7px #a2ffe780;
}
.home-dex { cursor: pointer; }
.home-dex span { color: #e5c890; }
.home-dia > span { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.mc-campaign {
  width: min(100%, 320px); padding: 15px; align-self: flex-start; border: 1px solid #c4a16a;
  border-radius: 13px; background: linear-gradient(140deg, #233e39fa, #11282af7 75%);
  box-shadow: inset 0 0 0 3px #f7d88c12, 0 8px 23px #0512147a;
}
.mc-stage-heading { display: flex; align-items: end; justify-content: space-between; gap: 5px 10px; }
.mc-stage-heading h2 { margin: 2px 0 0; font: 900 25px/1.12 "Songti SC", STSong, serif; }
.mc-stage-heading small { color: #f5cd87; font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.mc-count { color: #e8d6b2; font-size: 11px; white-space: nowrap; }
.mc-count b { color: #ffefca; font-size: 13px; font-variant-numeric: tabular-nums; }
.mc-track {
  display: block; appearance: none; width: 100%; height: 5px; margin: 10px 0; border: 0;
  border-radius: 4px; overflow: hidden; background: #51615a; color: #e7b55c;
}
.mc-track::-webkit-progress-bar { background: #51615a; }
.mc-track::-webkit-progress-value { background: #f0c679; }
.mc-track::-moz-progress-bar { background: #f0c679; }
.mc-actions { display: flex; gap: 8px; }
.mc-actions button {
  min-height: 44px; border: 1px solid #c7a06a; border-radius: 8px; padding: 7px 12px;
  font: inherit; font-size: 13px; font-weight: 850; cursor: pointer;
}
.mc-cta {
  flex: 1; background: linear-gradient(180deg, #ffe8ae, #e6ac58); color: #302113;
  box-shadow: inset 0 1px #fff6d4, 0 2px #815834;
}
.mc-cta::after {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 9px;
  border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(-45deg);
}
.mc-select { background: #153230; color: #ffe5ad; }

.home-dock {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
  padding: 9px; border: 1px solid #a48250; border-radius: 0 0 23px 23px;
  background: linear-gradient(180deg, #293e37, #0f2428 72%); box-shadow: inset 0 1px #ffe1a646, 0 12px 30px #0711148c;
}
.home-dock .mode-card {
  --mode-color: #b8a2df; --mode-glow: #8870c744;
  display: flex; align-items: center; justify-content: center; gap: 11px; min-width: 0; min-height: 78px; padding: 6px 9px;
  border: 1px solid #567467; border-radius: 11px; background: radial-gradient(ellipse at 20% 15%, var(--mode-glow), #14292bdd 68%);
  color: #fff0cc; font: inherit; text-align: left; cursor: pointer;
}
.home-dock .mc-daily { --mode-color: #ffc0a1; --mode-glow: #ca68434d; }
.home-dock .mc-free { --mode-color: #a9ddd1; --mode-glow: #55aa974f; }
.home-dock .mc-beasts { --mode-color: #f1cf8c; --mode-glow: #c69f4c4d; }
.home-mode-icon {
  flex: none; display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--mode-color) 54%, #192a2c);
  background: radial-gradient(circle at 50% 35%, var(--mode-glow), #102123 74%);
}
.home-mode-art { width: 68px; height: 68px; margin: -6px; filter: drop-shadow(0 4px 3px #061014b8); }
.home-mode-copy { min-width: 0; display: grid; gap: 3px; }
.home-mode-copy strong { font-size: clamp(13px, 1.48vw, 18px); letter-spacing: .055em; }
.home-mode-copy small { color: var(--mode-color); font-size: 11px; }
@media (hover: hover) {
  .home-dock .mode-card:hover, .home .home-dex:hover, .home #settingsButton:hover, .mc-select:hover { border-color: #efc789; background-color: #385448; }
  .mc-cta:hover { filter: brightness(1.09); }
}
.home-dock .mode-card:active, .mc-actions button:active { transform: translateY(1px); }

@media (max-width: 640px) {
  .app.scr-menu {
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }
  .home-stage { min-height: clamp(369px, calc(100svh - 120px), min(690px, (100vw - 16px) * 1.66)); padding: 10px; border-radius: 17px 17px 0 0; }
  .home-top { flex-direction: column-reverse; align-items: stretch; gap: 12px; }
  .home-stats { flex-wrap: nowrap; gap: 5px; }
  .home-dia { margin-right: auto; }
  .home-stat, .home #settingsButton { gap: 5px; padding-inline: 7px; font-size: 12px; }
  .home-top h1 { font-size: clamp(37px, 11.4vw, 62px); text-align: center; }
  .home-scenery { inset: 0; mask-image: none; }
  .home-scenery img { object-position: 50% 50%; }
  .home-stage::before { background: linear-gradient(180deg, #09171ddb 0%, #13242524 28%, transparent 56%, #0b2124cc 100%); }
  .mc-campaign { align-self: stretch; width: 100%; padding: 10px; }
  .mc-stage-heading h2 { font-size: 20px; }
  .mc-track { margin: 7px 0; }
  .home-dock { padding: 6px; gap: 5px; border-radius: 0 0 17px 17px; }
  .home-dock .mode-card { flex-direction: column; gap: 3px; padding: 5px 1px; text-align: center; }
  .home-mode-icon { width: 40px; height: 40px; }
  .home-mode-art { width: 49px; height: 49px; margin: -5px; }
  .home-mode-copy { gap: 2px; }
  .home-mode-copy strong { font-size: clamp(11px, 3.05vw, 14px); letter-spacing: 0; }
  .home-mode-copy small { font-size: 10px; }
}
@media (max-width: 380px) and (max-height: 650px) and (orientation: portrait) {
  .mc-stage-heading > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 7px; }
  .mc-stage-heading small { font-size: 10px; letter-spacing: .04em; }
  .mc-stage-heading h2 { font-size: 18px; }
}
@media (orientation: landscape) and (max-height: 510px) {
  .app.scr-menu { padding-block: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-bottom)); }
  .home-stage { min-height: clamp(248px, calc(100svh - 110px), 390px); padding: 10px 14px; }
  .home-top { flex-direction: row; align-items: flex-start; }
  .home-top h1 { font-size: clamp(31px, 5.5vw, 43px); }
  .home-scenery { inset-inline-start: 32%; mask-image: linear-gradient(90deg, transparent, #000 22%); }
  .home-stage::before { background: linear-gradient(90deg, #112525 25%, #132927c0 34%, transparent 65%), linear-gradient(180deg, #0a1818ab, transparent 44%); }
  .mc-campaign { width: min(45%, 290px); padding: 9px; }
  .home-dock .mode-card { min-height: 66px; flex-direction: row; text-align: left; }
  .home-mode-icon { width: 42px; height: 42px; }
  .home-mode-art { width: 49px; height: 49px; margin: -4px; }
}

.mc-pagoda { position: absolute; right: 9%; bottom: 0; width: 38%; max-width: 150px; display: flex; flex-direction: column; align-items: center; opacity: .9; }
.mc-pagoda i { display: block; height: 15px; margin-top: 2px; border-radius: 3px 3px 1px 1px; background: linear-gradient(180deg, #e9cf8f, #9b7a3f); clip-path: polygon(0 100%, 9% 20%, 50% 0, 91% 20%, 100% 100%); }
.mc-pagoda i:nth-child(1) { width: 34%; height: 18px; }
.mc-pagoda i:nth-child(2) { width: 50%; }
.mc-pagoda i:nth-child(3) { width: 64%; }
.mc-pagoda i:nth-child(4) { width: 80%; }
.mc-pagoda i:nth-child(5) { width: 100%; height: 22px; background: linear-gradient(180deg, #5c4f93, #2b2650); clip-path: none; border: 1px solid #c9b8ff44; }
@keyframes mcIn { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }

/* ---------- 选阵 ---------- */
body:has(.scr-deck) { position: relative; }
.app.scr-deck { padding-bottom: 65px; }
.deck { gap: 12px; color: #342a20; }
.deck-top { display: flex; align-items: center; gap: 10px; }
.deck-top button { min-height: 44px; flex: none; color: #453227; border: 1px solid #9a7b57; box-shadow: 0 2px 0 #785b3f; }
.deck-top h1 { margin: 0; font: 900 clamp(20px,5vw,29px)/1.15 "Songti SC", STSong, serif; }
.deck-hint { padding: 8px 10px; border: 1px solid #b29972; border-radius: 9px; background: #fff6df; font-size: 12px; line-height: 1.45; color: #56483a; }
.deck-hint b { color: #3a2a1a; }
.deck-hint-tower { background: #f5edff; }
.deck-hint-daily { background: #fff1e6; }
.deck-hint-free { background: #e7f4ea; border-color: #82a191; color: #2d524a; }
.deck-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 7px; margin-bottom: 8px; }
.deck-section-head > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px; }
.deck-section-head h2 { margin: 0; font-size: 16px; font-weight: 900; }
.deck-section-head span { font-size: 11px; color: #655040; }
.deck-lineup {
  padding: 11px; border: 1px solid #9c855d; border-radius: 12px;
  background: radial-gradient(ellipse at top right, #3d5c50, #1a3434 72%); color: #fff2d7;
}
.deck-lineup .deck-section-head { align-items: center; }
.deck-lineup .deck-section-head span { color: #e5d1ac; }
.deck-auto {
  min-height: 44px; padding: 5px 12px; border: 1px solid #ffe0a1; border-radius: 8px;
  background: linear-gradient(#ffeab6,#e3b66a); color: #302418; font: inherit; font-size: 13px; font-weight: 850; cursor: pointer;
}
.deck-slots { display: grid; grid-template-columns: repeat(var(--deck-slots),minmax(0,1fr)); gap: 4px; }
.deck-slot {
  min-width: 0; min-height: 68px; display: grid; justify-items: center; align-content: center;
  gap: 1px; padding: 3px 1px 4px; border: 1px solid #7b8c75; border-radius: 8px;
  background: #162d2d; color: #fff2d7; font: inherit; font-size: 10px; line-height: 1.14;
}
button.deck-slot { cursor: pointer; }
.deck-slot span { overflow-wrap: anywhere; text-align: center; }
.deck-slot .deck-slot-art { width: min(100%,42px); height: 36px; }
.deck-slot.vacant { border-style: dashed; color: #d5bc93; align-content: center; }
.deck-slot.vacant > span { font-size: 18px; }
.deck-slot.vacant small { font-size: 10px; }
.deck-roster .deck-section-head { align-items: center; }
.deck-roster select {
  width: min(39%,123px); min-height: 44px; padding: 3px 6px; border: 1px solid #a48361; border-radius: 8px;
  background: #fffaf1; color: #3d2d25; font: inherit; font-size: 12px;
}
.deck-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; }
.deck-card {
  min-width: 0; display: grid; grid-template-rows: 1fr auto;
  border: 1px solid var(--card-edge,#a48a64); border-radius: 11px; overflow: hidden;
  box-shadow: inset 0 0 0 2px #ffffff87, 0 2px 0 #71523940;
}
.deck-card.is-picked { border: 2px solid #45765f; box-shadow: 0 2px 0 #365d48; }
.deck-card-pick {
  min-width: 0; padding: 4px 4px 6px; display: grid; justify-items: center; align-content: start; gap: 3px;
  border: 0; background: transparent; color: #332820; font: inherit; cursor: pointer;
}
.deck-card-heading { width: 100%; min-height: 17px; display: flex; justify-content: space-between; gap: 3px; align-items: center; }
.deck-rarity { color: #654537; font-size: 10px; font-weight: 900; }
.deck-picked { border-radius: 5px; padding: 2px 3px; background: #264f40; color: #fff1d7; font-size: 9px; font-weight: 800; white-space: nowrap; }
.deck-card .deck-card-art { width: min(100%,65px); height: 55px; }
.deck-card strong { min-width: 0; overflow-wrap: anywhere; text-align: center; font-size: 13px; line-height: 1.15; }
.deck-card-meta { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 2px 7px; color: #3c574a; font-size: 11px; font-weight: 800; }
.deck-star { color: #714d16; white-space: nowrap; }
.deck-restricted { color: #6e4134; font-size: 10px; font-weight: 800; }
.deck-card.is-locked .deck-card-art { filter: grayscale(.85); opacity: .57; }
.deck-skill {
  width: 100%; min-height: 44px; padding: 2px; border: 0; border-top: 1px solid #755f4947; background: #fffaf0b8;
  color: #493627; font: inherit; font-size: 12px; font-weight: 800; cursor: pointer;
}
.deck-empty { margin: 0; padding: 14px; border: 1px dashed #ac886f; border-radius: 8px; background: #fff4e0; font-size: 13px; }
.deck-launch {
  position: sticky; bottom: max(0px,env(safe-area-inset-bottom)); z-index: 10;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 8px 10px; border: 1px solid #a98c60; border-radius: 11px; color: #fff1d0;
  background: #1b3536; box-shadow: 0 -2px 12px #3d2b2536;
}
.deck-launch p { margin: 0 0 2px; font-size: 13px; }
.deck-launch strong { color: #ffdc94; font-size: 17px; }
.deck-launch small { color: #e0d3ba; font-size: 11px; }
.deck-launch-btn {
  min-height: 48px; min-width: min(39%,134px); padding: 4px 13px; font: inherit; font-size: 16px; font-weight: 900;
  border: 1px solid #ffe3a1; border-radius: 9px; color: #312416; background: linear-gradient(#ffe5a8,#d4a55d); cursor: pointer;
}
.deck-launch-btn:disabled { background: #334846; color: #bfcec1; border-color: #79918a; cursor: default; }
.deck :is(button, select, summary):focus-visible { outline: 2px solid #91622f; outline-offset: -3px; }
.deck-lineup button:focus-visible, .deck-launch button:focus-visible { outline-color: #ffe39a; outline-offset: 2px; }
@media(max-width: 445px) {
  .deck-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .deck-slots-wide { grid-template-columns: repeat(4,minmax(0,1fr)); }
}
@media(max-width: 355px) {
  .deck-lineup { padding: 8px; }
}
.dex-star { margin: 8px 0 2px; padding: 6px 10px; border-radius: 10px; background: #fff3c4; font-size: 13px; font-weight: 800; color: #6d4c00; }
.unit:not(.elder) .ustars { left: auto; right: 3px; top: 1px; }

/* ---------- 对战 HUD：爬塔 ---------- */
.hud-sub { font-size: 11px; color: var(--muted); font-weight: 700; max-width: 9.5em; line-height: 1.2; }
.tw-floor { color: #5e35b1; font-size: 14px; }
.buff-bar {
  display: flex; align-items: center; gap: 5px; overflow-x: auto; scrollbar-width: none;
  padding: 4px 8px; border: 2px solid var(--line); border-radius: 12px; background: linear-gradient(90deg, #efeaff, #fffaf0);
  min-height: 36px;
}
.buff-bar::-webkit-scrollbar { display: none; }
.tower-buff-reopen {
  order: -1; flex: none; min-height: 44px; padding: 5px 9px; border: 1px solid #f5cd88; border-radius: 8px;
  background: #f1cd8a; color: #352517; font: inherit; font-size: 12px; font-weight: 800; cursor: pointer;
}
.buff-lab { flex: none; font-size: 11px; font-weight: 900; color: #5e35b1; letter-spacing: .1em; }
.buff-empty { font-size: 11px; color: var(--muted); white-space: nowrap; }
.buff-chip {
  position: relative; flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0;
  border-radius: 8px; border: 2px solid #9e9e9e; background: #fff; font-size: 15px; cursor: pointer; line-height: 1;
}
.buff-chip.r-rare { border-color: #26a6b8; background: #e6fbff; }
.buff-chip.r-epic { border-color: #b23a86; background: #fdeaff; }
.buff-chip small {
  position: absolute; right: -5px; bottom: -5px; padding: 0 3px; border-radius: 6px; background: #3a2a1a; color: #fff;
  font-size: 9px; font-weight: 900; line-height: 13px;
}

/* 增益三选一 */
.modal-box.bp-modal {
  width: min(620px, 100%); max-height: calc(100dvh - 32px); padding: clamp(12px, 3.5vw, 22px);
  background: linear-gradient(170deg, #2d2a55, #191832); border-color: #c9b8ff; color: #f3efff;
  overscroll-behavior: contain;
}
.bp-kicker { text-align: center; color: #e6d29c; font-size: 12px; font-weight: 800; letter-spacing: .3em; }
.bp-modal .mtitle { color: #fff4d4; margin: 4px 0; font: 900 clamp(20px, 5vw, 26px)/1.2 var(--serif); }
.bp-sub { text-align: center; color: #d0cbe9; font-size: 13px; line-height: 1.45; margin: 0 0 14px; }
.bp-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.bp-card {
  --bp: #ccd9ea; --bp-top: #394a62; --bp-bottom: #263346; --bp-glow: #9fb9dc38;
  display: grid; grid-template: "icon rarity" auto "name name" auto "desc desc" 1fr / minmax(0, 1fr) auto;
  align-items: start; gap: 7px 8px; min-width: 0; min-height: 64px; padding: 12px;
  border: 1px solid var(--bp); border-radius: 12px;
  background: radial-gradient(ellipse at 0 0, var(--bp-glow), transparent 78%), linear-gradient(145deg, var(--bp-top), var(--bp-bottom));
  color: #fff6df; font: inherit; text-align: left; cursor: pointer; transition: transform .2s, box-shadow .2s;
  animation: mcIn .45s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--i, 0) * 90ms);
}
.bp-card.r-rare { --bp: #84e2cf; --bp-top: #1d554d; --bp-bottom: #103735; --bp-glow: #64e2c73e; }
.bp-card.r-epic { --bp: #f5b7f1; --bp-top: #643868; --bp-bottom: #382348; --bp-glow: #e797ee40; }
.bp-ico {
  grid-area: icon; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  font-size: 24px; background: #1016234d; border: 1px solid var(--bp);
}
.bp-name, .bp-desc { min-width: 0; white-space: normal; overflow-wrap: anywhere; word-break: normal; }
.bp-name { grid-area: name; font-size: 16px; line-height: 1.3; }
.bp-desc { grid-area: desc; color: #f3ecfa; font-size: 13px; line-height: 1.5; }
.bp-rarity {
  grid-area: rarity; justify-self: end; padding: 2px 7px; border: 1px solid currentColor; border-radius: 999px;
  background: #14142150; color: var(--bp); font-size: 11px; font-weight: 800; white-space: nowrap;
}
.bp-card:focus-visible { outline: 2px solid #ffe3a1; outline-offset: 2px; }
@media (hover: hover) { .bp-card:hover { box-shadow: inset 0 0 0 1px var(--bp); } }
@media (max-width: 540px) {
  .bp-list { grid-template-columns: minmax(0, 1fr); }
  .bp-card { grid-template: "icon name rarity" auto "icon desc desc" auto / auto minmax(0, 1fr) auto; gap: 4px 9px; padding: 9px; }
  .bp-ico { align-self: center; width: 36px; height: 36px; font-size: 20px; }
  .bp-name { align-self: center; }
}
@media (prefers-reduced-motion: reduce) { .bp-card { transition: none; } }

/* ---------- 爬塔结算 ---------- */
.tr-crest { position: relative; width: 120px; height: 104px; display: flex; justify-content: center; }
.tr-crest .mc-pagoda { position: static; width: 120px; }
.tower-result h2 { color: #7e57c2; }
.tower-result.win h2 { color: #ffb300; }
.tr-floor { font-size: 18px; font-weight: 900; }
.tr-floor b { font-size: 34px; color: #5e35b1; margin: 0 4px; }
.tr-floor small { display: block; font-size: 12px; color: var(--muted); font-weight: 700; }
.tr-buffs { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; max-width: 360px; }
.tr-buffs > span { width: 100%; font-size: 12px; font-weight: 800; color: var(--muted); }

@media (prefers-reduced-motion: reduce) { .bp-card { animation: none; } }

/* =====================================================================
   v3 界面：墨绿 + 金 国风（对战 HUD / 商店 / 羁绊 / 主帅 / 引导 / 规则 / 弹窗）
   ===================================================================== */
:root {
  --ink0: #0a1519; --ink1: #101f22; --ink2: #142a29; --ink3: #1b3533; --ink4: #24413b; --ink5: #34504a;
  --jade-line: #4f6a60; --gold-line: #a48250; --gold-line2: #c4a16a;
  --cream: #fff1cf; --cream2: #e8d6b2; --cream3: #b9c4b2; --gold-text: #f5cd87; --gold-hi: #ffdf9a;
  --cta: linear-gradient(180deg, #ffe8ae, #e6ac58); --cta-ink: #302113;
  --panel-ink: linear-gradient(150deg, #26403a, #132a2c 75%);
  --serif: "Songti SC", STSong, "Noto Serif CJK SC", "Source Han Serif SC", serif;
  --rc-common: #a3ab9f; --rc-rare: #6fd3bf; --rc-epic: #c99ae0; --rc-legend: #f2c46a;
}

/* ---------- 通用弹窗 / 浮窗（墨绿主题，修复浅色文字落在浅色底上看不清） ---------- */
.modal { background: #071216c4; }
.modal-box {
  color: var(--cream); background: var(--panel-ink); border: 1px solid var(--gold-line2); border-radius: 16px;
  box-shadow: 0 22px 54px #051316c0, inset 0 0 0 3px #f7d88c10; max-height: min(88vh, 88dvh);
}
.modal-box .mtitle { color: var(--gold-hi); font-family: var(--serif); letter-spacing: .04em; }
.modal-box .muted, .tip .muted { color: var(--cream3); }
.modal-box .rar-common, .tip .rar-common { color: var(--rc-common); }
.modal-box .rar-rare, .tip .rar-rare { color: var(--rc-rare); }
.modal-box .rar-epic, .tip .rar-epic { color: var(--rc-epic); }
.modal-box .rar-legend, .tip .rar-legend { color: var(--rc-legend); }
.modal-box .btn {
  min-height: 44px; border: 1px solid var(--gold-line2); border-radius: 10px; box-shadow: none; text-shadow: none;
  background: #153230; color: #ffe5ad; font-weight: 850;
}
.modal-box .btn.red, .modal-box .btn.primary { background: var(--cta); color: var(--cta-ink); border-color: #ffe3a1; }
.modal-box .btn:active { transform: translateY(1px); box-shadow: none; }
.modal-box .row .btn { min-width: 108px; }
.modal-box .dex-line { color: #ffc9a3; }
.modal-box .dex-star { background: #f3c8731c; color: var(--gold-hi); border: 1px solid #e6c27f55; }
.modal-box .dex-emo { border: 1px solid var(--gold-line2); border-radius: 14px; }
.modal-box .eimg.big { border: 2px solid var(--gold-line2); box-shadow: 0 0 26px #f3c87344; background: #1b3533; }
.modal-box .ec-stars, .tip .ec-stars { color: var(--gold-hi); }
.tip-k { background: #ffffff0c; border: 1px solid #ffffff10; color: #efe4c8; }
.tip-k.cur { background: #f3c8731f; outline: 1px solid #e6c27f; }
.tip-k b { color: var(--gold-hi); }
.tip-k .lock { color: #ff9f8a; }
.tip {
  color: var(--cream); background: linear-gradient(150deg, #26403a, #12282a 80%); border: 1px solid var(--gold-line2);
  border-radius: 12px; box-shadow: 0 10px 28px #051316b0;
}
.tip-h { color: var(--gold-hi); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.tip-s { color: var(--cream3); }
.tip-x { color: var(--cream2); }
.lvtag { border: 1px solid #00000055; }
.mtext { margin: 10px 0 2px; text-align: center; color: var(--cream2); font-size: 14px; line-height: 1.55; }

/* ---------- 对战页骨架：高度锁定 100dvh，棋盘自适应剩余空间 ---------- */
body:has(.scr-battle) {
  background: radial-gradient(ellipse at 50% 0%, #26403a, #0f2023 58%, #0a1519) fixed; overflow: hidden;
}
.app.scr-battle {
  max-width: none; height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; display: flex; flex-direction: column;
  padding: max(6px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
}
.battle { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; color: var(--cream); }
.battle button { font: inherit; touch-action: manipulation; }
.battle button:focus-visible { outline: 2px solid #ffe39a; outline-offset: 2px; }

/* 顶栏：对手 · 回合 · 工具 */
.bt-top {
  flex: none; display: flex; align-items: center; gap: 6px; padding: 4px 5px; min-height: 48px;
  border: 1px solid #556c60; border-radius: 12px;
  background: linear-gradient(115deg, #243e36, #142a2c 72%);
}
.bt-foe { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; }
.bt-ava {
  flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--gold-line2); background: radial-gradient(circle at 50% 35%, #3b5a50, #142a29); font-size: 20px; overflow: hidden;
}
.bt-ava .eimg { width: 100%; height: 100%; background: transparent; }
.bt-ava .eimg img { object-fit: cover; object-position: 50% 12%; }
.bt-foe-copy { min-width: 0; display: grid; gap: 1px; line-height: 1.15; }
.bt-foe-name { font-size: 13px; font-weight: 850; color: var(--cream); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bt-foe-meta { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 11px; color: var(--cream3); white-space: nowrap; }
.bt-foe-meta .hearts, .bt-me .hearts { font-size: 10px; letter-spacing: -1px; }
.bt-foe-meta .hud-sub { color: var(--cream3); overflow: hidden; text-overflow: ellipsis; }
.bt-coin { display: inline-flex; align-items: center; gap: 3px; color: var(--gold-hi); font-weight: 800; font-variant-numeric: tabular-nums; }
.bt-coin[hidden] { display: none; }
.coin {
  display: inline-block; flex: none; width: .95em; height: .95em; border-radius: 50%; vertical-align: -.12em;
  background: radial-gradient(circle at 35% 30%, #fff3c4, #f0c060 45%, #a8742c); box-shadow: inset 0 0 0 1px #7a5420aa;
}
.bt-round { flex: none; text-align: center; font-size: 10px; color: var(--cream2); line-height: 1.15; padding: 0 2px; }
.bt-round b { display: block; color: var(--gold-hi); font: 900 15px/1.15 var(--serif); letter-spacing: .03em; white-space: nowrap; }
.bt-round .tw-floor { font-size: 16px; }
.bt-tools { flex: none; display: flex; align-items: center; gap: 4px; }
.bt-tools .bt-tool {
  position: static; min-width: 40px; height: 44px; min-height: 44px; padding: 0 7px; display: inline-grid; place-items: center;
  border: 1px solid #50665e; border-radius: 8px; background: #183130; color: #ffe5ad; font-size: 13px; font-weight: 850; cursor: pointer; box-shadow: none;
}
.bt-tools .settings-gear { display: block; font-size: 18px; }
.bt-tool.help { font: 900 17px/1 var(--serif); color: var(--gold-hi); }
.bt-tool.quit { color: #ffc9b8; }
@media (hover: hover) { .bt-tools .bt-tool:hover { border-color: #efc789; background: #2a4840; } }

/* 敌方主帅小徽章（只显示冷却） */
.bt-foe-cmd { flex: none; position: relative; width: 34px; height: 34px; border-radius: 50%; padding: 2px; background: conic-gradient(#e57a62 calc(var(--p, 0) * 360deg), #3a2f2c 0); }
.bt-foe-cmd .eimg { width: 100%; height: 100%; border: 1px solid #1a1110; background: #2a2523; }
.bt-foe-cmd.ready { box-shadow: 0 0 0 1px #ffb39f, 0 0 12px #ff8a6c99; }
.bt-foe-cmd small { position: absolute; left: 50%; bottom: -5px; transform: translateX(-50%); padding: 0 3px; border-radius: 4px; background: #3a1d17; color: #ffd0c2; font-size: 8px; font-weight: 800; white-space: nowrap; }

/* 爬塔增益栏 */
.scr-battle .buff-bar { flex: none; padding: 0; border: 0; background: none; color: var(--cream2); }
.scr-battle .buff-lab { color: var(--gold-text); }
.scr-battle .buff-empty { color: var(--cream3); }
.scr-battle .buff-chip { border: 1px solid #c7a06a; background: #1b3533; color: var(--cream); box-shadow: none; }

/* ---------- 羁绊栏 ---------- */
.game-icon { display: inline-block; flex: none; width: 17px; height: 17px; object-fit: contain; vertical-align: -.25em; }
.syn {
  flex: none; display: flex; align-items: center; gap: 6px; min-height: 40px; padding: 3px 4px;
  border: 1px solid var(--jade-line); border-radius: 10px; background: #11282ae6;
}
.syn-toggle {
  flex: none; display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 0 8px;
  border: 1px solid var(--gold-line2); border-radius: 8px; background: #1d3634; color: var(--gold-hi); font-size: 12px; font-weight: 850; cursor: pointer;
}
.syn-toggle b { min-width: 16px; padding: 0 4px; border-radius: 6px; background: var(--cta); color: var(--cta-ink); font-size: 11px; text-align: center; }
.syn-toggle i { width: 6px; height: 6px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg) translate(-1px, -1px); transition: transform .15s; }
.syn[data-open="true"] .syn-toggle i { transform: rotate(-135deg); }
.syn-body { flex: 1; min-width: 0; }
.syn-list { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; overflow-x: auto; scrollbar-width: none; }
.syn-list::-webkit-scrollbar { display: none; }
.syn-empty { margin: 0; color: var(--cream3); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.syn-item {
  flex: none; display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 8px 0 5px;
  border: 1px solid #4a6158; border-radius: 15px; background: #1a3334; color: #d6dccb; font-size: 11px; white-space: nowrap; cursor: pointer;
}
.syn-ico { width: 22px; height: 22px; }
.syn-name { font-weight: 800; }
.syn-count { font-variant-numeric: tabular-nums; color: var(--cream3); }
.syn-count b { color: var(--cream); }
.syn-pips { display: none; gap: 2px; }
.syn-pips i { min-width: 15px; height: 15px; padding: 0 2px; display: grid; place-items: center; border-radius: 4px; background: #0f2224; color: #8ea398; font: 800 9px/1 system-ui, sans-serif; font-style: normal; }
.syn-pips i.on { background: var(--cta); color: var(--cta-ink); }
.syn-item.on { border-color: #9d8454; background: #333e30; color: #ffe6ae; }
.syn-item.on .syn-count { color: #f3dca8; }
.syn-item.near { border-color: #7e9a8b; }
.syn-foe { display: none; }
.syn-drawer-head { display: none; }
@media (max-width: 959px), (max-height: 559px) {
  .syn[data-open="true"] .syn-body {
    position: fixed; z-index: 30;
    inset: auto max(8px, env(safe-area-inset-right)) calc(60px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    max-height: min(39dvh, 320px, calc(100dvh - var(--syn-drawer-floor, 0px) - 60px - env(safe-area-inset-bottom)));
    padding: 0 10px 10px; border: 1px solid var(--gold-line); border-radius: 14px;
    background: #142e2e; box-shadow: 0 6px 24px #061115b3; overflow-y: auto; overscroll-behavior: contain;
  }
  .syn[data-open="true"] .syn-drawer-head {
    position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between;
    padding: 4px 0; background: #142e2e; color: var(--gold-hi); font-size: 14px;
  }
  .syn-drawer-head button {
    min-height: 44px; padding: 0 8px; border: 0; border-radius: 6px; background: #264642; color: var(--cream); cursor: pointer;
  }
  .syn[data-open="true"] .syn-list { flex-wrap: wrap; overflow: visible; }
  .syn[data-open="true"] .syn-pips { display: inline-flex; }
  .syn[data-open="true"] .syn-foe { display: block; margin-top: 8px; }
}
.syn-foe h3 { margin: 0 0 3px; color: #e5a493; font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.syn-foe .syn-item { cursor: default; height: 26px; }
.syn-foe .syn-item.on { border-color: #d98d78; background: #3a2a27; color: #ffd6c8; box-shadow: none; }
@media (hover: hover) { .syn-item:hover, .syn-toggle:hover { border-color: #efc789; } }
.syn-tip-members { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.syn-tip-members span { display: inline-flex; align-items: center; gap: 2px; padding: 1px 5px 1px 1px; border-radius: 10px; background: #ffffff0d; font-size: 11px; color: var(--cream3); }
.syn-tip-members span.on { background: #f3c8732a; color: var(--gold-hi); }
.syn-tip-members .beast-portrait { width: 20px; height: 20px; }
.tip-k.syn-tier { display: flex; gap: 6px; align-items: baseline; }
.tip-k.syn-tier em { flex: none; min-width: 22px; padding: 0 4px; border-radius: 5px; background: #0f2224; color: #a9b9ae; font: 800 11px/1.5 system-ui, sans-serif; font-style: normal; text-align: center; }
.tip-k.syn-tier.cur em { background: var(--cta); color: var(--cta-ink); }

/* ---------- 棋盘（墨色楚河汉界） ---------- */
.scr-battle .arena-wrap { flex: 1; flex-direction: column; min-width: 0; min-height: 0; }
.scr-battle .arena {
  flex: 1; min-height: 0;
  border: 1px solid #987d54; border-radius: 13px;
  background:
    radial-gradient(ellipse at 50% 0%, #7d49392e, transparent 46%),
    radial-gradient(ellipse at 50% 100%, #47897932, transparent 54%),
    linear-gradient(180deg, #30262a 0%, #28282a 47%, #1b3934 53%, #152d2b 100%);
  box-shadow: inset 0 0 0 3px #f7d88c10;
}
.scr-battle .cell::after { border: 1px dashed #e6c9a026; border-radius: 9px; }
.scr-battle .cell.mine::after { border-color: #a9d8bd3d; background: #ffffff07; }
.scr-battle .cell.front::after { border-style: solid; }
.scr-battle .cell.theirs.front::after { border-color: #e0a08a40; }
.scr-battle .cell.hot::after { background: #f3c87340; border-color: #f3c873; }
.scr-battle .cell.merge::after { background: #ff9f4366; border-color: #ffbf6e; border-style: solid; box-shadow: 0 0 12px #ffb36b inset; }
.scr-battle .river {
  background: linear-gradient(90deg, transparent, #c9a46126 18%, #c9a46140 50%, #c9a46126 82%, transparent);
  border-top: 1px solid #b08d5870; border-bottom: 1px solid #b08d5870;
  display: flex; align-items: center; justify-content: space-around; color: #e7cf9c88; font: 900 calc(2.6 * var(--arena-unit))/1 var(--serif); letter-spacing: 1.2em; text-indent: 1.2em;
}
.scr-battle .river::before { content: "楚河"; }
.scr-battle .river::after { content: "汉界"; }
.scr-battle .unit .card {
  --unit-bed: #203e3a;
  --unit-rim: color-mix(in srgb, var(--lc, #d7bc83) 68%, var(--unit-bed));
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; justify-items: center;
  padding: 2px 4px 3px; border: 1px solid var(--unit-rim); border-bottom-width: 2px; border-radius: 9px;
  background: radial-gradient(ellipse at 50% 32%, color-mix(in srgb, var(--lc, #d7bc83) 22%, var(--unit-bed)), transparent 76%), var(--unit-bed);
  box-shadow: 0 1px 2px #070d12a8; color: #fff1d9;
}
.scr-battle .unit.enemy .card { --unit-bed: #392d2f; }
.scr-battle .unit .card > :is(.emo, .unit-img) {
  width: 88%; height: 100%; min-height: 0; margin: 0; align-self: stretch;
  filter: drop-shadow(0 1px 1px #0008);
}
.scr-battle .unit .nm { position: static; line-height: 1.1; font-weight: 750; text-overflow: ellipsis; }
.scr-battle .unit.can-merge .nm { max-width: calc(100% - 13px); justify-self: start; }
.scr-battle .unit .badge {
  top: 2px; left: 3px; right: auto; bottom: auto; min-width: 13px; padding: 0 2px;
  background: #0b171acc; border: 1px solid var(--unit-rim); border-radius: 4px;
  color: var(--lc, #ffe2a7); font-size: max(8px, 1.9 * var(--arena-unit)); line-height: 1.16; text-align: center;
}
.scr-battle .unit .ustars { top: 2px; right: 3px; left: auto; color: #ffd17c; white-space: nowrap; }
.scr-battle .is-battle .ustars { display: none; }
.scr-battle .arena.is-prep .unit.ally.can-merge .card { box-shadow: inset 0 0 0 1px #ffe39a, 0 0 8px #ffbf6e85; animation: mergeHint 1.3s ease-in-out infinite; }
.scr-battle .unit .merge-tag {
  position: absolute; right: 2px; bottom: 2px; z-index: 3; padding: 0 2px; border-radius: 4px; border: 1px solid #b48647;
  background: #ffe09d; color: var(--cta-ink); font-size: max(8px, 1.9 * var(--arena-unit)); font-weight: 900; line-height: 1.16;
}
@keyframes mergeHint { 50% { box-shadow: inset 0 0 0 1px #ffe39a, 0 0 12px #ffbf6ec0; } }
.scr-battle .banner {
  border: 1px solid #e6c27f; border-radius: 14px; color: #fff4d8; -webkit-text-stroke: 0; font-family: var(--serif);
  text-shadow: 0 2px 0 #00000066; box-shadow: 0 14px 34px #050c0ecc;
}
.scr-battle .banner.win { background: linear-gradient(180deg, #2f6b55f2, #18392ff2); }
.scr-battle .banner.lose { background: linear-gradient(180deg, #8a3b2ff2, #4a1f1af2); }
.scr-battle .banner.draw { background: linear-gradient(180deg, #4a5b58f2, #253433f2); }
.scr-battle .banner small { font-family: inherit; color: #f3e3c0; margin-top: 4px; }

/* ---------- 底部：我方 / 主帅 / 商店 / 操作 ---------- */
.bt-dock { flex: none; display: grid; gap: 6px; min-width: 0; }
.bt-tactics {
  display: grid; gap: 5px; min-width: 0; padding: 6px 8px;
  border: 1px solid #a48556; border-radius: 10px; background: #203831;
}
.bt-tactics[hidden], .bt-tactic-actions button[hidden] { display: none; }
.bt-tactic-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 8px; }
.bt-tactic-head b { color: var(--gold-hi); font-size: 12px; }
.bt-tactic-head span { color: var(--cream2); font-size: 11px; }
.bt-tactic-actions { display: flex; gap: 6px; }
.bt-tactic-actions button {
  flex: 1; min-height: 34px; padding: 3px 6px; border: 1px solid #708c7e; border-radius: 7px;
  background: #132a2c; color: var(--cream); font-size: 12px; font-weight: 750; cursor: pointer; white-space: nowrap;
}
.bt-tactic-actions button[aria-pressed="true"] { background: #efcf90; color: var(--cta-ink); border-color: #ffdf9e; }
.bt-tactic-actions #tacticClear { flex: 0 1 auto; }
.tactic-aim {
  display: flex; flex: none; justify-content: space-between; align-items: center; gap: 6px;
  margin-bottom: 4px; padding: 0 4px 0 8px; border: 1px solid #8b976b; border-radius: 8px;
  background: #203b35; color: var(--gold-hi); font-size: 12px; font-weight: 800;
}
.tactic-aim[hidden] { display: none; }
.tactic-aim button {
  flex: none; min-height: 38px; padding: 0 6px; border: 0; border-radius: 6px; background: transparent;
  color: var(--cream2); cursor: pointer;
}
.tactic-targets { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
.tactic-target, .tactic-mark { position: absolute; width: 20%; height: calc(100% / 8.5); margin: 0; border-radius: 9px; }
.tactic-target {
  border: 2px solid #a8e2c4; background: #a8e2c426; color: #def8e8; pointer-events: auto; cursor: crosshair;
}
.tactic-target.focus { border-color: #f4ae98; background: #f4ae9826; }
.tactic-target:hover, .tactic-target:focus-visible { outline-offset: -4px; background: #e3c57b4d; }
.tactic-mark {
  display: grid; align-content: start; justify-items: center; padding: 2px;
  border: 2px solid #a8e2c4; color: #e2ffeb; background: linear-gradient(#10342abf 0 15px, transparent 15px);
  font-size: 10px; font-weight: 850; line-height: 1.1;
}
.tactic-mark.focus {
  border-color: #f4ae98; color: #ffdacb; background: linear-gradient(#582d24cf 0 15px, transparent 15px);
}
.scr-battle .unit.tactic-focus .card { box-shadow: inset 0 0 0 2px #f4ae98; }
.bt-me {
  display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 3px 4px 3px 8px;
  border: 1px solid var(--jade-line); border-radius: 11px; background: linear-gradient(150deg, #1c3735, #11282a);
}
.bt-summary { display: flex; flex: 1 1 auto; align-items: center; gap: 8px; justify-content: space-between; min-width: 0; }
.bt-me:has(.cmd-skills.dual) .bt-summary { flex: 1 1 100%; }
.bt-me-col { min-width: 0; display: grid; gap: 1px; line-height: 1.15; }
.bt-me-col > small { color: var(--cream3); font-size: 10px; }
.bt-me-col > .bt-recovery { color: #acdcbf; font-size: 11px; font-weight: 750; line-height: 1.2; }
.bt-gold { display: inline-flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.bt-gold b { display: inline-flex; align-items: center; gap: 4px; color: var(--gold-hi); font: 900 21px/1 system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.bt-gold b.bump { animation: goldBump .35s ease-out; }
@keyframes goldBump { 40% { transform: scale(1.18); color: #fff4c9; } }
.bt-income { color: var(--cream2); font-size: 11px; white-space: nowrap; }
.bt-income em { font-style: normal; color: #9fe0bf; font-weight: 800; }

/* 主帅按钮 + 冷却环 */
.cmd-skills { display: grid; min-width: 0; max-width: 52%; margin-left: auto; }
.cmd-skills:has(.cmd-btn.none) { display: none; }
.bt-me:has(.cmd-skills.dual) { flex-wrap: wrap; }
.cmd-skills.dual {
  flex: 1 1 100%; max-width: none; margin-left: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr)) 44px; gap: 5px;
}
.battle .cmd-mode {
  display: grid; grid-template-rows: 1fr 1fr; gap: 2px; min-height: 44px; padding: 2px;
  border: 1px solid #64796e; border-radius: 8px; background: #102527; color: #c2cfbf;
  font-size: 11px; line-height: 1.15; cursor: pointer;
}
.cmd-mode span { display: grid; place-items: center; border-radius: 5px; white-space: nowrap; }
.cmd-mode[aria-checked="false"] span:first-child { background: #2e4a42; color: #f7ecd1; font-weight: 800; }
.cmd-mode[aria-checked="true"] span:last-child { background: #eed19a; color: #31251a; font-weight: 800; }
.cmd-mode:disabled { opacity: .5; cursor: default; }
.cmd-btn {
  display: flex; min-width: 0; align-items: center; gap: 6px; min-height: 44px;
  padding: 2px 6px 2px 3px; border: 1px solid #50665e; border-radius: 9px; background: #142d2d; color: var(--cream); cursor: pointer; text-align: left;
}
.cmd-ring { position: relative; flex: none; width: 36px; height: 36px; padding: 3px; border-radius: 50%; background: conic-gradient(#f3c873 calc(var(--p, 0) * 360deg), #2b403c 0); }
.cmd-ring .eimg { width: 100%; height: 100%; border: 2px solid #10221f; background: #1d3634; }
.cmd-ring .eimg img { object-fit: cover; object-position: 50% 12%; }
.cmd-skill-icon { width: 100%; height: 100%; padding: 3px; border-radius: 50%; background: #1d3634; }
.cmd-ring > b { position: absolute; inset: 3px; display: grid; place-items: center; border-radius: 50%; background: #0a151966; color: #fff; text-shadow: 0 1px 3px #000; font: 900 15px/1 system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.cmd-copy { min-width: 0; display: grid; line-height: 1.15; }
.cmd-copy strong { font-size: 12px; color: var(--gold-hi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd-copy small { font-size: 10px; color: var(--cream3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd-copy .cmd-timing { display: flex; flex-wrap: wrap; gap: 1px 5px; }
.cmd-timing span { white-space: nowrap; }
.cmd-skills.dual .cmd-ring { width: clamp(28px, 8vw, 36px); height: clamp(28px, 8vw, 36px); }
.cmd-btn:disabled { cursor: default; }
.cmd-btn.ready { border-color: #ffe39a; background: linear-gradient(180deg, #3e4a33, #24372f); box-shadow: 0 0 0 1px #ffe39a66, 0 0 18px #f6c66a66; animation: cmdPulse 1.3s ease-in-out infinite; }
.cmd-btn.ready .cmd-copy small { color: #ffe39a; font-weight: 800; }
.cmd-btn.cast .cmd-ring { animation: cmdCast .6s ease-out; }
.cmd-btn.none { border-style: dashed; color: var(--cream3); }
.cmd-btn.none .cmd-ring { background: #2b403c; }
.cmd-btn.none .cmd-ring > span { width: 100%; height: 100%; display: grid; place-items: center; border-radius: 50%; background: #13292b; color: #7f948a; font: 900 15px var(--serif); }
@keyframes cmdPulse { 50% { box-shadow: 0 0 0 1px #ffe39a, 0 0 26px #f6c66a99; } }
@keyframes cmdCast { 0% { transform: scale(1); } 40% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* 商店 */
.shop {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 52px; gap: 5px; padding: 5px;
  border: 1px solid #53685d; border-radius: 11px; background: #132a2d;
}
.shop-head { display: none; }
.shop-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; min-width: 0; }
.shop-card {
  --rc: var(--rc-common); --rg: #6d7b7133;
  position: relative; min-width: 0; height: 86px; display: grid; grid-template-rows: auto 1fr auto auto; justify-items: center; gap: 1px;
  padding: 3px 2px 4px; border: 1px solid color-mix(in srgb, var(--rc) 45%, #1a2c2c); border-top: 2px solid var(--rc); border-radius: 8px;
  background: radial-gradient(ellipse at 50% 28%, var(--rg), #13292b 72%); color: var(--cream); cursor: pointer;
  transition: transform .1s, border-color .15s;
}
.shop-card.r-rare { --rc: var(--rc-rare); --rg: #4fb9a540; }
.shop-card.r-epic { --rc: var(--rc-epic); --rg: #a76fc84d; }
.shop-card.r-legend { --rc: var(--rc-legend); --rg: #e6b04a59; }
.sc-rar { justify-self: start; padding-left: 2px; color: var(--rc); font-size: 9px; font-weight: 850; line-height: 1.2; }
.shop-card .sc-art { width: 44px; height: 100%; max-height: 42px; min-height: 0; filter: drop-shadow(0 3px 2px #061014a0); }
.sc-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10.5px; font-weight: 800; line-height: 1.15; }
.sc-price { display: inline-flex; align-items: center; gap: 3px; color: var(--gold-hi); font: 900 12.5px/1 system-ui, sans-serif; }
.shop-card.poor { opacity: .62; }
.shop-card.poor .sc-price { color: #f0a08e; }
.shop-card.pair { border-color: #ffe39a; box-shadow: 0 0 0 1px #ffe39a55, 0 0 12px #f6c66a55; }
.shop-card .sc-pair {
  position: absolute; right: -3px; top: -7px; z-index: 1; padding: 1px 4px; border-radius: 6px; border: 1px solid #5a3a12;
  background: var(--cta); color: var(--cta-ink); font-size: 9px; font-weight: 900; font-style: normal; line-height: 1.25; white-space: nowrap;
}
.shop-card:active { transform: translateY(1px) scale(.98); }
.shop-card.bought { animation: shopBought .32s ease-out; }
@keyframes shopBought { from { transform: scale(.85); opacity: .3; } }
.shop-card.empty {
  border: 1px dashed #4a5f57; background: #0f2224; cursor: default; color: #7f948a; font-size: 10.5px; align-content: center;
  grid-template-rows: auto; place-items: center;
}
.shop-side { display: grid; grid-template-rows: 1fr 1fr; gap: 5px; }
.shop-btn {
  min-width: 0; display: grid; place-items: center; align-content: center; gap: 1px; padding: 2px;
  border: 1px solid #64776a; border-radius: 8px; background: #153230; color: #ffe5ad;
  font-size: 11.5px; font-weight: 850; line-height: 1.1; cursor: pointer;
}
.shop-btn small { display: inline-flex; align-items: center; gap: 2px; font-size: 10px; color: var(--gold-hi); font-weight: 800; }
.shop-btn.lock small { color: var(--cream3); }
.shop-btn.lock[aria-pressed="true"] { background: var(--cta); color: var(--cta-ink); border-color: #ffe3a1; }
.shop-btn.lock[aria-pressed="true"] small { color: #5a3d1c; }
.shop-btn:disabled, .shop-btn.disabled { opacity: .5; cursor: default; }
.shop-veil {
  position: absolute; inset: 0; z-index: 2; display: none; place-items: center; border-radius: inherit;
  background: #0a1519c4; color: var(--gold-text); font: 900 15px/1.4 var(--serif); letter-spacing: .18em; text-align: center;
}
.shop-veil small { display: block; font: 700 11px/1.4 system-ui, sans-serif; letter-spacing: 0; color: var(--cream3); }
.phase-battle .shop-veil, .phase-roundEnd .shop-veil, .phase-intro .shop-veil, .phase-pick .shop-veil { display: grid; }
@media (hover: hover) { .shop-card:not(.empty):hover { transform: translateY(-2px); border-color: #ffe39a; } .shop-btn:hover { border-color: #efc789; } }

/* 操作行：出售 / 自动合成 / 战斗 */
.bt-actions { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1fr) minmax(0, 1.55fr); gap: 6px; }
.scr-battle .trash {
  min-height: 48px; flex-direction: row; gap: 5px; padding: 4px 2px; border: 1px dashed #a28b65; border-radius: 11px;
  background: #13292a; color: var(--cream2); font-size: 14px; transition: background .12s, border-color .12s;
}
.scr-battle .trash > span { display: grid; gap: 3px; line-height: 1.1; }
.scr-battle .trash b { color: var(--cream); font-size: 12px; }
.scr-battle .trash small { font-size: 11px; color: var(--cream3); }
.scr-battle .trash.sell-target { background: #344038; border-color: #edc98d; }
.scr-battle .trash.sell-target small { color: var(--gold-hi); }
.scr-battle .trash.hot { background: #624935; border: 1px solid #ffe0a4; box-shadow: inset 0 0 0 1px #ffdb9d66; transform: none; }
.bt-merge, .bt-fight {
  min-height: 48px; padding: 4px 6px; border-radius: 11px; font-weight: 900; cursor: pointer; white-space: nowrap;
}
.bt-merge { border: 1px solid #6c9a86; background: #24453c; color: #e9f5e2; font-size: 14px; }
.bt-fight {
  border: 1px solid #ffe3a1; background: var(--cta); color: var(--cta-ink); font: 900 18px/1 var(--serif); letter-spacing: .12em;
  box-shadow: inset 0 1px #fff6d4, 0 2px #815834;
}
.bt-merge:disabled, .bt-fight:disabled, .bt-merge.disabled, .bt-fight.disabled { filter: grayscale(.7) brightness(.8); opacity: .62; cursor: default; }
.bt-fight.fighting { letter-spacing: .04em; font-size: 15px; }
@media (hover: hover) { .bt-fight:not(:disabled):hover { filter: brightness(1.08); } .bt-merge:not(:disabled):hover { border-color: #a6dcc4; } }
@media (min-width: 510px) and (max-width: 959px) {
  .bt-me:has(.cmd-skills.dual) { display: grid; grid-template-columns: auto minmax(0, 1fr); }
  .bt-me:has(.cmd-skills.dual) .bt-summary { display: grid; gap: 3px; }
  .bt-me:has(.cmd-skills.dual) .recent-report button { min-height: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  .scr-battle .arena.is-prep .unit.ally.can-merge .card, .cmd-btn.ready { animation: none; }
}

/* 主帅释放全屏特效 */
.sfx.cmd { background: radial-gradient(circle, #ffe9b3cc, #f3c87344 55%, transparent 75%); }
.sfx.cmd.foe { background: radial-gradient(circle, #ffb39f99, #c8523a44 55%, transparent 75%); }
.sfx-cmd {
  position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 6px;
  animation: cmdIn .5s cubic-bezier(.2, 1.4, .4, 1) both;
}
.sfx-cmd .eimg { width: 96px; height: 96px; border: 2px solid #ffe39a; box-shadow: 0 0 30px #f6c66a; background: #1d3634; }
.sfx.foe .sfx-cmd .eimg { border-color: #ffb39f; box-shadow: 0 0 30px #ff8a6c; }
.sfx-cmd small { padding: 2px 10px; border-radius: 999px; background: #0a1519cc; color: var(--cream2); font-size: 13px; font-weight: 800; }
.sfx-cmd b { color: #ffe39a; font: 900 44px/1.1 var(--serif); letter-spacing: .1em; -webkit-text-stroke: 2px #5a3412; paint-order: stroke fill; text-shadow: 0 4px 16px #000a; white-space: nowrap; }
.sfx.foe .sfx-cmd b { color: #ffd0c2; -webkit-text-stroke-color: #5a1a10; }
@keyframes cmdIn { from { transform: translate(-50%, -50%) scale(.4); opacity: 0; } }

/* ---------- 新手引导 ---------- */
.coach {
  position: fixed; z-index: 960; width: min(300px, calc(100vw - 24px)); padding: 10px 12px 9px;
  border: 1px solid #e6c27f; border-radius: 12px; background: linear-gradient(150deg, #2c4842, #142c2e);
  color: #fff0d0; box-shadow: 0 14px 34px #051214b0, 0 0 0 4px #f7d88c1c; font-size: 13px; line-height: 1.55;
  animation: coachIn .25s ease-out;
}
.coach-step { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; color: var(--gold-text); font-size: 11px; font-weight: 850; letter-spacing: .08em; }
.coach-step i { flex: 1; height: 3px; border-radius: 2px; background: #3c5650; overflow: hidden; }
.coach-step i::before { content: ""; display: block; height: 100%; width: var(--w, 25%); background: var(--cta); }
.coach p { margin: 0; }
.coach p b { color: var(--gold-hi); }
.coach-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; }
.coach-actions button {
  min-height: 36px; padding: 0 12px; border: 1px solid #738579; border-radius: 8px; background: #172e30; color: #ffe8b7;
  font: inherit; font-size: 12px; font-weight: 800; cursor: pointer;
}
.coach-actions button.primary { background: var(--cta); color: var(--cta-ink); border-color: #ffe3a1; }
.coach::after {
  content: ""; position: absolute; left: var(--ax, 50%); width: 12px; height: 12px; margin-left: -6px;
  background: inherit; border: inherit; border-width: 0 1px 1px 0; transform: rotate(45deg);
}
.coach.below::after { top: -7px; transform: rotate(-135deg); background: #2c4842; }
.coach.above::after { bottom: -7px; background: #142c2e; }
.coach-focus { position: relative; z-index: 30; outline: 2px solid #ffe39a; outline-offset: 3px; animation: coachGlow 1.4s ease-in-out infinite; }
@keyframes coachGlow { 50% { outline-color: #ffbf6e; box-shadow: 0 0 0 6px #f6c66a2e, 0 0 24px #f6c66a77; } }
@keyframes coachIn { from { opacity: 0; transform: translateY(6px); } }

/* ---------- 规则面板 ---------- */
.rules-modal { width: min(560px, 100%); }
.rules-modal .mtitle { margin-bottom: 8px; }
.rules-grid { display: grid; gap: 7px; }
.rule {
  display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 2px 9px; align-items: start; padding: 8px 10px;
  border: 1px solid #ffffff14; border-radius: 10px; background: #ffffff09;
}
.rule > span { grid-row: 1 / 3; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--gold-line2); background: #102324; color: var(--gold-hi); font: 900 16px/1 var(--serif); }
.rule h3 { margin: 0; color: var(--gold-hi); font: 900 15px/1.3 var(--serif); letter-spacing: .05em; }
.rule p { margin: 0; color: #e9dfc6; font-size: 12.5px; line-height: 1.55; }
.rule p b { color: var(--cream); }
.rules-modal .row { position: sticky; bottom: -16px; margin: 10px -16px -16px; padding: 10px 16px 14px; background: linear-gradient(transparent, #132a2c 30%); }

/* ---------- 桌面：三栏（羁绊 | 棋盘 | 商店） ---------- */
@media (min-width: 960px) and (min-height: 560px) {
  .app.scr-battle { max-width: 1320px; padding: 12px 18px; }
  .battle {
    display: grid; gap: 10px 14px;
    grid-template-columns: 240px minmax(0, 1fr) 340px; grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "top top top" "syn arena dock";
  }
  .battle.mode-tower { grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: "top top top" "buff buff buff" "syn arena dock"; }
  .bt-top { grid-area: top; padding: 6px 8px; min-height: 58px; }
  .bt-ava { width: 44px; height: 44px; }
  .bt-foe-name { font-size: 15px; }
  .bt-round b { font-size: 18px; }
  .scr-battle .buff-bar { grid-area: buff; }
  .scr-battle .arena-wrap { grid-area: arena; }
  .syn { grid-area: syn; align-self: start; max-height: 100%; overflow: auto; flex-direction: column; align-items: stretch; padding: 10px; gap: 8px; }
  .syn-toggle { pointer-events: none; justify-content: space-between; min-height: 34px; font-size: 14px; font-family: var(--serif); }
  .syn-toggle i { display: none; }
  .syn-list { flex-direction: column; overflow: visible; gap: 5px; }
  .syn-item { width: 100%; height: auto; min-height: 40px; padding: 4px 8px 4px 5px; border-radius: 10px; display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 7px; }
  .syn-item .syn-ico { grid-row: 1 / 3; width: 26px; height: 26px; font-size: 14px; }
  .syn-item .syn-name { font-size: 13px; text-align: left; }
  .syn-item .syn-count { grid-row: 1 / 3; grid-column: 3; align-self: center; font-size: 13px; }
  .syn-item .syn-pips { display: inline-flex; grid-column: 2; }
  .syn-foe { display: block; margin-top: 6px; }
  .syn-foe .syn-item { min-height: 34px; }
  .bt-dock { grid-area: dock; display: flex; flex-direction: column; min-height: 0; gap: 10px; }
  .bt-dock > :is(.bt-me, .bt-tactics, .bt-actions) { flex: none; }
  .bt-me { flex-wrap: wrap; padding: 8px 10px; }
  .cmd-skills { flex: 1 1 100%; max-width: none; margin-left: 0; }
  .cmd-btn { min-height: 56px; border-radius: 14px; }
  .cmd-ring { width: 50px; height: 50px; }
  .cmd-copy strong { font-size: 14px; }
  .cmd-copy small { font-size: 11px; white-space: normal; }
  .shop {
    flex: 0 1 auto; min-height: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto;
    padding: 8px; gap: 7px;
  }
  .shop-head { display: flex; align-items: baseline; justify-content: space-between; color: var(--gold-hi); font: 900 15px/1.2 var(--serif); letter-spacing: .1em; }
  .shop-head small { font: 700 11px/1.2 system-ui, sans-serif; letter-spacing: 0; color: var(--cream3); }
  .shop-cards {
    min-height: 0; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 5px;
    padding: 2px; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: #8d7956 #132a2d;
  }
  .shop-card { height: 56px; grid-template-columns: 46px minmax(0, 1fr) auto; grid-template-rows: auto auto; justify-items: start; align-items: center; column-gap: 8px; padding: 4px 10px 4px 6px; border-top-width: 1px; border-left: 4px solid var(--rc); }
  .shop-card .sc-art { grid-row: 1 / 3; grid-column: 1; width: 46px; height: 44px; max-height: 44px; }
  .shop-card .sc-name { grid-column: 2; grid-row: 1; font-size: 14px; align-self: end; }
  .shop-card .sc-rar { grid-column: 2; grid-row: 2; padding: 0; font-size: 11px; align-self: start; }
  .shop-card .sc-price { grid-column: 3; grid-row: 1 / 3; font-size: 17px; }
  .shop-card.pair .sc-price { grid-row: 1; align-self: end; justify-self: end; }
  .shop-card .sc-pair { position: static; grid-column: 3; grid-row: 2; align-self: start; justify-self: end; }
  .shop-card.empty { height: 56px; display: grid; grid-template-columns: 1fr; }
  .shop-side { grid-template-rows: none; grid-template-columns: 1fr 1fr; }
  .shop-btn { min-height: 44px; grid-auto-flow: column; gap: 6px; font-size: 13px; }
  .shop-btn small { font-size: 12px; }
  .bt-actions { grid-template-columns: 1fr 1fr; margin-top: auto; }
  .bt-actions .bt-fight { grid-column: 1 / -1; min-height: 56px; font-size: 22px; }
  .scr-battle .trash { min-height: 46px; }
}
@media (min-width: 960px) and (min-height: 560px) and (max-height: 695px) {
  .bt-dock { gap: 7px; }
  .bt-me { padding: 5px 7px; }
  .cmd-btn { min-height: 44px; }
  .shop-card, .shop-card.empty { height: 48px; }
  .shop-card .sc-art { height: 38px; max-height: 38px; }
  .bt-actions { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.25fr); }
  .bt-actions .bt-fight { grid-column: auto; min-height: 48px; font-size: 18px; }
}

/* ---------- v3 选卡池（墨绿 + 金） ---------- */
body:has(.scr-deck) { background: radial-gradient(ellipse at 50% 0%, #284943, #102325 62%, #0a1519) fixed; }
.app.scr-deck {
  max-width: 1180px; padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) calc(68px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}
.scr-deck .deck { color: var(--cream); gap: 10px; }
.scr-deck .deck-top button { color: var(--cream); border: 1px solid #92764e; background: #172e2e; box-shadow: none; text-shadow: none; border-radius: 10px; }
.scr-deck .deck-top h1 { color: var(--gold-hi); letter-spacing: .04em; }
.scr-deck .deck-hint { border: 1px solid #6f7f6c; background: #12282a; color: var(--cream2); }
.scr-deck .deck-hint b { color: var(--gold-hi); }
.scr-deck .deck-hint-tower { border-color: #8a7ab8; background: #1c2338; }
.scr-deck .deck-hint-daily { border-color: #b98262; background: #2b2420; }
.scr-deck .deck-hint-free { border-color: #5f9a88; background: #132d2b; color: #cfe5d8; }
.scr-deck .deck-section-head h2 { color: var(--gold-hi); font: 900 16px/1.2 var(--serif); letter-spacing: .06em; }
.scr-deck .deck-section-head span { color: var(--cream3); }
.scr-deck .deck-lineup { border: 1px solid var(--gold-line); background: linear-gradient(150deg, #26443d, #142c2e 75%); box-shadow: inset 0 0 0 3px #f7d88c10; }
.deck-workspace { display: grid; align-items: start; gap: 12px; }
.deck-lineup h2 small { margin-left: 3px; color: var(--cream2); font: 750 12px/1.2 system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.scr-deck .deck-auto {
  flex: none; min-height: 44px; padding: 0 10px; border: 1px solid #927d52; border-radius: 9px; background: #1a332f; color: var(--gold-hi);
  font: inherit; font-size: 13px; font-weight: 900; cursor: pointer; box-shadow: none;
}
.scr-deck .deck-slots { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.scr-deck .deck-slot { min-height: 56px; border: 1px solid #5f7a6e; border-top: 3px solid var(--rc, #5f7a6e); background: #12282a; color: var(--cream); }
.scr-deck .deck-slot .deck-slot-art { height: 31px; }
.scr-deck .deck-slot.r-common { --rc: var(--rc-common); }
.scr-deck .deck-slot.r-rare { --rc: var(--rc-rare); }
.scr-deck .deck-slot.r-epic { --rc: var(--rc-epic); }
.scr-deck .deck-slot.r-legend { --rc: var(--rc-legend); }
.scr-deck .deck-slot.vacant { border: 1px dashed #6a7f73; color: #a9b9ae; }
.deck-syn { margin-top: 7px; border-top: 1px solid #ffffff22; }
.deck-syn summary {
  display: flex; align-items: center; flex-wrap: wrap; column-gap: 6px; min-height: 44px; padding: 4px 1px;
  color: var(--gold-text); font-size: 13px; cursor: pointer; list-style: none;
}
.deck-syn summary::-webkit-details-marker { display: none; }
.deck-syn summary::after { content: ""; width: 6px; height: 6px; margin: 0 4px 3px auto; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.deck-syn[open] summary::after { transform: rotate(225deg); margin-block: 3px 0; }
.deck-syn summary small { color: var(--cream3); font-size: 11px; }
.deck-syn-list { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; }
.deck-syn-list li { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; padding: 0 8px 0 5px; border: 1px solid #4a6158; border-radius: 14px; background: #12282a; color: #cfd7c8; font-size: 12px; }
.deck-syn-list li b { color: var(--cream3); font-size: 11px; font-variant-numeric: tabular-nums; }
.deck-syn-list li.on { border-color: #e6c27f; background: linear-gradient(180deg, #3d4a36, #283a30); color: #ffe6ae; }
.deck-syn-list li.on b { color: #f3dca8; }
/* 主帅位 */
.deck-cmd { padding: 10px; border: 1px solid var(--jade-line); border-radius: 12px; background: #12282ae8; }
.deck-cmd-empty { margin: 0; color: var(--cream3); font-size: 12px; line-height: 1.45; }
.deck-cmd-body { display: grid; gap: 6px; }
.deck-cmd-grid { max-width: 520px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.deck-cmd-pick {
  position: relative; min-width: 0; min-height: 51px; display: flex; justify-content: center; align-items: center; gap: 5px;
  padding: 4px; border: 1px solid #577368; border-radius: 9px; background: #193331; color: var(--cream);
  font: inherit; cursor: pointer;
}
.deck-cmd-pick[aria-pressed="true"] { border-color: #e6c27f; background: #35473a; box-shadow: inset 0 -2px #e6c27f; }
.deck-cmd-pick[aria-pressed="true"] strong { color: var(--gold-hi); }
.deck-cmd-pick[aria-pressed="true"]::after { content: "✓" / ""; position: absolute; top: 2px; right: 4px; color: var(--gold-hi); font-size: 10px; }
.deck-cmd-seal, .deck-cmd-art { width: 28px; height: 28px; border: 1px solid #68806f; background: #1e3934; }
.deck-cmd-seal { display: grid; flex: none; place-items: center; border-radius: 50%; color: var(--cream3); }
.deck-cmd-portrait { flex: none; }
.deck-cmd-pick strong { font-size: 13px; }
.deck-cmd-copy { min-width: 0; display: grid; line-height: 1.15; justify-items: start; }
.deck-cmd-art img { object-position: 50% 10%; }
.deck-cmd-summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.deck-cmd-summary > div { display: grid; gap: 3px; color: var(--cream3); font-size: 11px; }
.deck-cmd-summary b { color: var(--cream); font-size: 12px; }
.deck-cmd-info {
  flex: none; min-height: 44px; padding: 4px 8px; border: 0; border-radius: 8px; color: var(--gold-hi);
  background: transparent; font: inherit; font-size: 12px; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.deck-cmd button:focus-visible, .deck-syn summary:focus-visible { outline: 2px solid #ffe39a; outline-offset: 2px; }
.deck-star { color: var(--gold-hi); font-size: 10px; letter-spacing: -1px; }
/* 候选 */
.scr-deck .deck-roster select { border: 1px solid #657767; background: #192f31; color: var(--cream); color-scheme: dark; }
.scr-deck .deck-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.scr-deck .deck-card {
  --rc: var(--rc-common); border: 1px solid #4f6a60; border-top: 3px solid var(--rc); border-radius: 10px; background: radial-gradient(ellipse at 50% 25%, var(--rg, #6d7b7122), #13292b 72%); box-shadow: none;
}
.scr-deck .deck-card.r-rare { --rc: var(--rc-rare); --rg: #4fb9a533; }
.scr-deck .deck-card.r-epic { --rc: var(--rc-epic); --rg: #a76fc840; }
.scr-deck .deck-card.r-legend { --rc: var(--rc-legend); --rg: #e6b04a44; }
.scr-deck .deck-card.is-picked { border-color: #f3c873; box-shadow: 0 0 0 1px #f3c87366, 0 0 14px #f3c87333; }
.scr-deck .deck-card-pick { color: var(--cream); }
.scr-deck .deck-rarity { color: var(--rc); }
.scr-deck .deck-picked { background: var(--cta); color: var(--cta-ink); }
.scr-deck .deck-card strong { color: var(--cream); }
.scr-deck .deck-card-meta { color: var(--cream3); font-weight: 700; font-size: 10.5px; }
.scr-deck .deck-restricted { color: #f0a08e; }
.scr-deck .deck-skill { border-top: 1px solid #ffffff12; background: #10262a; color: var(--gold-text); min-height: 36px; }
.scr-deck .deck-empty { border-color: #6a7f73; background: #12282a; color: var(--cream3); }
.scr-deck .deck-launch { border-color: var(--gold-line2); background: linear-gradient(150deg, #23403a, #10262a); box-shadow: 0 -4px 18px #050c0e88; }
.scr-deck .deck-launch-btn { border-color: #ffe3a1; background: var(--cta); color: var(--cta-ink); font-family: var(--serif); letter-spacing: .08em; }
.scr-deck .deck-launch-btn:disabled { background: #334846; color: #bfcec1; border-color: #79918a; }
@media (max-width: 359px) {
  .deck-cmd-pick { flex-direction: column; gap: 3px; }
  .deck-cmd-copy { justify-items: center; }
}
@media (min-width: 560px) { .scr-deck .deck-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 960px) {
  .deck-workspace { grid-template-columns: minmax(270px, 0.7fr) minmax(0, 1.3fr); gap: 16px; }
  .scr-deck .deck-lineup { position: sticky; top: 12px; }
  .deck-cmd-body { grid-template-columns: minmax(320px, 0.95fr) minmax(0, 1.05fr); gap: 16px; align-items: center; }
  .deck-cmd-summary { border-left: 1px solid #ffffff22; padding-left: 16px; }
  .scr-deck .deck-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
.drag-ghost .card { color: #3a2a1a; }
.deck-card-tags { display: inline-flex; align-items: center; gap: 3px; }
@media (min-width: 960px) and (min-height: 560px) {
  .syn-empty { white-space: normal; line-height: 1.5; }
}
.coach.left::after { left: auto; right: -7px; top: var(--ay, 50%); margin: -6px 0 0; transform: rotate(-45deg); background: #203a37; }
@media (min-width: 960px) and (min-height: 560px) { .syn-foe .syn-item { min-height: 42px; } }
.sfx.cmd { animation-duration: 2.4s; }
.bt-ava.bt-foe-cmd { overflow: visible; padding: 2px; border: 0; background: conic-gradient(#e57a62 calc(var(--p, 0) * 360deg), #3a2f2c 0); }
.bt-ava.bt-foe-cmd .eimg { border-radius: 50%; overflow: hidden; border: 1px solid #1a1110; }
/* 登塔路线、朝堂功勋与战报 */
.app:is(.scr-towerMap, .scr-towerReward, .scr-achievements) {
  max-width: 1040px;
  padding: max(12px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right))
    calc(72px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
}
:is(.tower-map, .tower-reward-modal, .medals) { --route-gold: #f8d48d; --route-text: #f7ebd2; --route-muted: #d0c8b0; --route-line: #ad885e80; color: var(--route-text); }
.modal-box.tower-reward-modal { width: min(100%, 490px); padding: clamp(14px, 4vw, 24px); overscroll-behavior: contain; }
.tower-reward-modal .route-stop { border: 0; padding: 0; box-shadow: none; background: none; }
.tower-reward-modal .route-stop h2 { margin-top: 4px; }
.tower-reward-actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 14px; }
.tower-reward-actions [data-mact="quit"] { margin-inline-start: auto; }
@media (prefers-reduced-motion: reduce) {
  .modal-box.tower-reward-modal { animation: none; }
}
.route-head {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; align-items: center;
  border: 1px solid var(--route-line); padding: clamp(8px, 2vw, 20px); border-radius: 16px;
  background: radial-gradient(ellipse at top, #34584d, #12282b 73%); box-shadow: inset 0 0 0 3px #f4d79a10;
}
.route-head h1 { font: 900 clamp(22px, 6vw, 38px)/1.16 var(--serif); color: var(--route-gold); margin: 1px 0; }
.route-head > div:nth-child(2) { text-align: center; }
.route-head > div > small { color: var(--route-muted); font-size: 12px; }
.route-back, .route-chart header button, .route-report, .recent-report button, .medal-filters button {
  font-family: inherit; line-height: 1.3; font-size: 13px; font-weight: 750; min-height: 44px; padding: 6px 9px;
  border: 1px solid var(--route-line, #96795488); border-radius: 9px; color: var(--route-text, #f7ebd2); background: #14292b;
  cursor: pointer;
}
.route-head > button { justify-self: start; }
.route-resources { justify-self: end; display: flex; flex-wrap: wrap; justify-content: end; gap: 4px 9px; font-size: 13px; }
.route-heart { color: #ffaaa6; white-space: nowrap; }
.route-gold { color: var(--route-gold); white-space: nowrap; font-variant-numeric: tabular-nums; }
.route-inventory { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; text-align: left; }
.route-inventory details { min-width: 0; border: 1px solid var(--route-line, #ad885e80); border-radius: 9px; background: #152d2f; color: #f7ebd2; }
.route-inventory summary, .route-extra summary { cursor: pointer; padding: 12px 8px; min-height: 44px; font-size: 13px; }
.route-inventory summary { display: flex; align-items: center; gap: 5px; }
.route-inventory summary::-webkit-details-marker { display: none; }
.route-inventory summary::after {
  content: ""; width: 5px; height: 5px; margin: -3px 2px 0 auto;
  border: solid #bda67d; border-width: 0 1px 1px 0; transform: rotate(45deg);
}
.route-inventory details[open] summary::after { transform: rotate(225deg); margin-top: 3px; }
.route-inventory summary .game-icon { width: 20px; height: 20px; }
.route-inventory summary b { color: #f8d48d; padding-left: 3px; }
.route-inventory ul { margin: 0; padding: 0 8px 8px; list-style: none; font-size: 13px; }
.route-inventory li { line-height: 1.45; border-top: 1px solid #b9a27048; padding: 7px 0; }
.route-inventory small { display: block; color: #d0c8b0; overflow-wrap: anywhere; }
.scr-battle .buff-bar { overflow: visible; position: relative; z-index: 10; }
.scr-battle .route-inventory {
  position: relative; gap: 0; align-items: start; border: 1px solid #50685f; border-radius: 9px; background: #152d2f;
}
.scr-battle .route-inventory details { border: 0; border-radius: 0; background: none; }
.scr-battle .route-inventory details + details { border-inline-start: 1px solid #526a605e; }
.scr-battle .route-inventory summary { min-height: 36px; padding: 4px 8px; white-space: nowrap; }
.scr-battle .route-inventory [open] summary { background: #28423a; border-radius: 8px; }
.scr-battle .route-inventory ul {
  position: absolute; top: calc(100% + 4px); inset-inline: 0; max-height: min(48dvh, 320px);
  padding: 4px 12px 8px; border: 1px solid var(--gold-line); border-radius: 9px;
  background: #173332; box-shadow: 0 7px 18px #060e12a8; overflow-y: auto; overscroll-behavior: contain;
}
.scr-battle .route-inventory li:first-child { border-top: 0; }
.scr-battle .route-inventory :is(ul, small) { font-size: 12px; }
.route-columns { display: grid; gap: 10px; align-items: start; }
.route-chart, .route-stop, .medals-progress {
  border: 1px solid var(--route-line); border-radius: 15px; min-width: 0;
  background: linear-gradient(140deg, #233f38, #11272b 75%);
}
.route-chart { padding: 10px; }
.route-chart > header { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.route-chart h2, .route-stop h2 { margin: 0; font: 850 clamp(20px, 5vw, 28px)/1.2 var(--serif); color: var(--route-gold); overflow-wrap: anywhere; }
.route-chart p, .route-stop p { font-size: 13px; line-height: 1.5; color: var(--route-muted); margin: 5px 0 0; }
.route-legend { display: flex; flex-wrap: wrap; gap: 5px 15px; margin: 10px 0; color: #e8dac0; font-size: 12px; }
.route-scroll {
  max-height: clamp(290px, 54dvh, 620px); overflow-y: auto; scrollbar-color: #af9362 #173133; overscroll-behavior: contain;
  padding: 9px 0; border: 1px solid #ad885e55; border-radius: 11px; background:
    radial-gradient(ellipse at 30% 70%, #2d544c 0%, transparent 62%),
    linear-gradient(#0d2428e6, #122b2de8), url("assets/home/campaign-cover.webp") center / cover;
}
.route-row { height: 76px; display: grid; grid-template-columns: 36px minmax(0, 1fr); align-items: center; }
.route-lanes { height: 100%; position: relative; }
.route-link-row { height: 32px; margin-left: 36px; }
.route-lines { display: block; height: 100%; width: 100%; }
.route-lines path { fill: none; stroke: #899b8b; stroke-width: 1.3; vector-effect: non-scaling-stroke; opacity: .66; }
.route-lines .next, .route-lines .traveled { stroke: #f1ce85; stroke-width: 2.3; opacity: 1; }
.route-floor { text-align: center; color: #ddd0ad; font: 750 16px/1 var(--serif); font-variant-numeric: tabular-nums; }
.route-floor small { display: block; margin-top: 4px; font: 11px system-ui; }
.route-node {
  --node-color: #c6d3bc; position: absolute; left: var(--lane); top: 0; transform: translateX(-50%); width: min(26%, 112px); height: 100%;
  display: grid; align-content: center; justify-items: center; gap: 2px; padding: 2px; border: 1px solid #839681;
  border-radius: 13px; color: var(--node-color); background: #152c2f; font: 750 13px/1.1 system-ui;
}
.route-node span { font: 700 23px/1.1 system-ui; }
.route-node small { font-size: 10px; margin-top: 3px; line-height: 1.2; }
.route-node.reachable, .route-node.current { color: #fff4d8; border: 2px solid #ebca82; background: #35564e; box-shadow: inset 0 0 0 2px #ffe2a43b, 0 0 13px #efcf7850; }
.route-node.reachable { cursor: pointer; }
.route-node.reachable:hover { background: #49695d; }
.route-node.current { border-style: double; border-width: 4px; }
.route-node.done:not(.current) { background: #2e4946; }
.route-node.node-elite { --node-color: #ffb3a8; }
.route-node.node-shop { --node-color: #ebce8a; }
.route-node.node-event { --node-color: #d7baf6; }
.route-node.node-rest { --node-color: #a3e6bd; }
.route-node.node-boss { --node-color: #ffda7d; }
.route-origin { text-align: center; padding: 12px 0 4px 36px; color: #e8d09e; font-size: 13px; }
.route-stop { display: grid; gap: 12px; padding: 14px; box-shadow: inset 0 0 0 3px #f8df9c14; }
.route-next { border-color: #d9b977; }
.route-next .route-choices { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.route-next .route-choice { border-color: #af965e; background: #28473f; }
.route-next .route-choice:hover { background: #36584b; }
.route-stop > div > span:first-child { color: #e5c795; font-size: 12px; }
.route-choices { display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; }
.route-choice {
  --choice-r: #d0b88c; min-width: 0; width: 100%; display: grid; grid-template-columns: 38px minmax(0, 1fr);
  align-items: center; gap: 10px; min-height: 62px; padding: 7px 9px; border: 1px solid color-mix(in srgb, var(--choice-r), #172f2c 40%);
  border-radius: 10px; background: #132c31; color: #fff0ce; text-align: left; font: inherit; cursor: pointer; line-height: 1.35;
}
.route-choice.r-rare { --choice-r: #9ddccf; }
.route-choice.r-epic { --choice-r: #dcb7f5; }
.route-choice.r-legend { --choice-r: #ffcf76; }
.route-choice:hover:not(:disabled) { background: #2c4942; }
.route-choice:disabled { color: #c2c6be; background: #233634; cursor: default; }
.route-choice-icon { display: grid; min-height: 36px; place-items: center; color: var(--choice-r); border: 1px solid #cbb5816b; border-radius: 9px; font-size: 21px; }
.route-choice small { display: block; margin-top: 3px; color: #d8d0b9; font-size: 12px; overflow-wrap: anywhere; }
.route-extra { border-top: 1px solid var(--route-line); }
.route-extra .route-choice { margin-bottom: 6px; }
.route-stop > .route-back { justify-self: end; color: var(--route-gold); }
.route-report { margin-top: 8px; width: 100%; }
.recent-report:empty { display: none; }
.recent-report button { white-space: nowrap; color: #e5c88e; background: #112829; border-color: #53685e; }
.battle .recent-report button { font-size: 11px; }
.route-node:focus-visible, .route-back:focus-visible, .route-choice:focus-visible, .route-report:focus-visible,
.route-inventory summary:focus-visible, .route-chart button:focus-visible, .medal-filters button:focus-visible {
  outline: 2px solid #ffdf91; outline-offset: 2px;
}
@media (min-width: 760px) {
  .route-columns:has(.route-stop) { grid-template-columns: minmax(0, .9fr) minmax(0, 1.15fr); }
  .route-scroll { max-height: min(62dvh, 660px); }
  .route-chart { padding: 16px; }
}
@media (max-width: 350px) {
  .home-medals span { display: none; }
  .home-medals::before { content: "✪"; color: #f5d181; }
  .home-stats { flex-wrap: wrap; }
}
.home-medals { cursor: pointer; color: #ffdaa0; }
.medals-progress { padding: 12px; display: grid; gap: 6px; }
.medals-progress progress { width: 100%; height: 8px; }
:is(.medals-progress, .rank-unit) progress { accent-color: #d6b474; }
.medal-filters { display: flex; flex-wrap: wrap; gap: 5px; }
.medal-filters button[aria-pressed="true"] { background: #f2d397; color: #292314; border-color: #fbe2ad; }
.medal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 8px; }
.medal-card {
  display: grid; grid-template-columns: 47px minmax(0, 1fr); align-items: start; gap: 9px;
  min-width: 0; min-height: 100px; padding: 10px; border: 1px solid var(--route-line);
  border-radius: 12px; background: linear-gradient(150deg, #254742, #142b30); color: #f7ebd2;
}
.medal-card.earned { border-color: #e3be75; background: linear-gradient(135deg, #3d523f, #1c3432); }
.medal-seal { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid #b69b6c; border-radius: 11px; color: #e5d2a6; font-size: 25px; }
.medal-card.earned .medal-seal { background: #f4d48d; color: #402c18; }
.medal-card h2 { font: 850 18px/1.2 var(--serif); margin: 5px 0 3px; }
.medal-card p { font-size: 13px; color: #ded5bc; margin: 0 0 6px; line-height: 1.5; }
.medal-meta { display: flex; justify-content: space-between; gap: 4px; color: #d7c6a0; }
.medal-reward { color: #f4d48d; font-size: 12px; font-weight: 750; }
.achievement-notice {
  position: fixed; z-index: 140; top: max(12px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right));
  display: flex; gap: 10px; align-items: center; max-width: min(320px, calc(100% - 20px)); padding: 10px 14px;
  border: 1px solid #c99d55; border-radius: 11px; background: #143133; color: #fff0ca; box-shadow: 0 7px 24px #071718aa;
  pointer-events: none;
}
.achievement-notice > span { font-size: 23px; color: #ffda8a; }
.achievement-notice small { display: block; color: #f7d58f; margin-top: 2px; }
.res-report { width: min(100%, 760px); }
.round-report-modal table, .res-report table { width: 100%; border-collapse: collapse; }
.round-report-modal th, .round-report-modal td { text-align: right; padding: 4px 2px; border-bottom: 1px solid #bba47877; }
.round-report-modal tbody th { text-align: left; }
.modal-box.round-report-modal { width: min(100%, 720px); max-height: min(90dvh, 760px); overflow-y: auto; }
.round-report-modal .btn { display: block; margin: 10px auto 0; }
.round-rank { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); margin-top: 8px; }
.round-side { min-width: 0; padding: 7px; border: 1px solid #b99e7355; border-radius: 8px; background: #aa8b4614; text-align: left; }
.round-side h4 { margin: 0; font-size: 14px; }
.round-side p { margin: 4px 0; font-size: 13px; }
.rank-unit { padding: 4px 0; border-top: 1px solid #96784b46; }
.rank-unit > div { display: flex; justify-content: space-between; gap: 4px; }
.rank-unit progress { width: 100%; height: 8px; display: block; margin: 3px 0; }
.round-side.side-1 progress { accent-color: #b96953; }
.rank-unit small { font-size: 11px; }
.res-tip ul { padding-left: 19px; margin: 5px 0; }
.res-round-list summary { min-height: 44px; padding: 11px 2px; cursor: pointer; }
.res-round-list details { border-top: 1px solid #bfa77a80; }

/* ---------- 自由对战 ---------- */
body:has(.scr-free, .scr-daily) { background: radial-gradient(ellipse at 50% 0%, #284841, #102325 72%) fixed; }
.app:is(.scr-free, .scr-daily) {
  max-width: 940px;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}
.free-page, .daily-page { gap: 16px; color: var(--cream); }
.fr-note {
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; justify-items: start; align-content: center; gap: 3px;
  min-height: clamp(112px, 21vw, 158px); padding: clamp(14px, 4vw, 26px);
  border: 1px solid var(--gold-line); border-radius: 15px;
  background: #12282a;
}
.fr-note::before {
  content: ""; position: absolute; inset: 0 0 0 40%; z-index: -1;
  background: url("assets/home/court.webp") center 58% / cover no-repeat;
  mask-image: linear-gradient(90deg, transparent, #000 40%);
}
.fr-note h2 { margin: 0; color: var(--gold-hi); font: 850 15px/1.3 var(--serif); }
.fr-note p { margin: 0; color: var(--cream2); font-size: 15px; font-weight: 750; }
.fr-note p b { color: var(--cream); font: 900 clamp(24px, 5vw, 34px)/1.14 var(--serif); }
.fr-note small { color: var(--cream3); font-size: 12px; }
.fr-difficulties h2 { margin: 0 0 10px; font: 850 19px/1.3 var(--serif); }
.fr-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 9px; }
.fr-card {
  --fr-accent: #b6ddaf;
  display: grid; grid-template-columns: auto minmax(0, 1fr) 22px; align-items: center; gap: 11px;
  min-height: 88px; padding: 9px 12px; border: 1px solid #526e60; border-radius: 12px;
  background: var(--panel-ink); color: var(--cream); font: inherit; text-align: left;
  cursor: pointer; touch-action: manipulation;
}
.fd-normal { --fr-accent: #9bcfd9; }
.fd-hard { --fr-accent: #d3b8e2; }
.fd-hell {
  --fr-accent: #edba9c; border-color: #a8745b;
  background: linear-gradient(116deg, #45312b, #2c2929 65%, #272e2c);
}
.fr-art {
  display: grid; place-items: center; width: clamp(53px, 10vw, 76px); aspect-ratio: 1;
  border: 1px solid color-mix(in srgb, var(--fr-accent) 36%, #162d2d); border-radius: 11px;
  background: radial-gradient(ellipse, color-mix(in srgb, var(--fr-accent) 31%, #142629), #142629 87%);
}
.fd-hell .fr-art { background: radial-gradient(ellipse, #805443, #392a28 84%); }
.fr-img, .fr-art .eimg.fr-elder { width: 90%; height: 90%; }
.fr-art .eimg.fr-elder { border: 0; border-radius: 0; background: none; }
.fr-art .fr-elder img { object-fit: contain; }
.fr-body { display: grid; min-width: 0; gap: 3px; }
.fr-card-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fr-card-title b { font: 900 clamp(18px, 4.3vw, 24px)/1.15 var(--serif); color: var(--cream); }
.fd-hell .fr-card-title b { color: #ffddc3; }
.fr-body small { color: #cbd1bf; font-size: 12px; line-height: 1.45; }
.fr-pips { color: var(--fr-accent); font-size: 10px; letter-spacing: 2px; white-space: nowrap; }
.fr-pips i { font-style: normal; color: #ffffff38; }
.fr-arrow { color: var(--gold-hi); font-size: 18px; text-align: center; }
.free-page button:focus-visible, .daily-page button:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
.fr-card:active { background: #314a3f; }
@media (hover: hover) { .fr-card:hover, .free-page .lv-back:hover { border-color: #dfbb7d; } }
@media (min-width: 600px) {
  .fr-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .fr-card { min-height: 118px; padding: 12px 16px; gap: 14px; }
}

/* ---------- 每日挑战 ---------- */
.dl-hero {
  position: relative; isolation: isolate; overflow: hidden; display: grid; justify-items: start; gap: 5px;
  padding: clamp(14px, 4vw, 26px); border: 1px solid var(--gold-line); border-radius: 15px; background: #142b2c;
}
.dl-hero::before {
  content: ""; position: absolute; inset: 0 0 0 37%; z-index: -1;
  background: linear-gradient(90deg, #142b2c 18%, #142b2c80 52%, #142b2c22 100%),
    url("assets/home/campaign-cover.webp") center 45% / cover no-repeat;
}
.dl-key { color: var(--gold-hi); font-size: 12px; font-weight: 750; font-variant-numeric: tabular-nums; }
.dl-hero h2 { margin: 0; color: var(--cream); font: 900 clamp(25px, 6vw, 38px)/1.15 var(--serif); }
.dl-hero p { max-width: 34ch; margin: 0; color: #f0e4c7; font-size: 13px; line-height: 1.5; }
.dl-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.dl-badge {
  padding: 3px 8px; border: 1px solid #839288; border-radius: 6px; background: #102729; color: var(--cream2);
  font-size: 12px; font-weight: 750;
}
.dl-badge.done { color: #c6edcf; border-color: #729887; }
.dl-badge.reward { color: var(--gold-hi); border-color: var(--gold-line); }
.dl-panel { min-width: 0; margin: 0; padding: 14px; border: 1px solid #516d60; border-radius: 12px; background: var(--panel-ink); }
.dl-panel h2 { margin: 0; color: var(--cream); font: 850 18px/1.25 var(--serif); }
.dl-roster { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 9px 12px; }
.dl-roster p { margin: 4px 0 0; color: var(--cream3); font-size: 13px; line-height: 1.45; }
.dl-warn { color: #ffcfad; }
.dl-cta {
  min-height: 44px; padding: 6px clamp(9px, 2.6vw, 18px); border: 1px solid #ffe1a0; border-radius: 9px;
  background: var(--cta); color: var(--cta-ink); font: 850 14px/1.3 system-ui, sans-serif; white-space: nowrap;
  cursor: pointer; touch-action: manipulation;
}
.dl-cta span { margin-inline-start: 5px; }
.dl-mine { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.dl-mine-img {
  width: 30px; height: 30px; padding: 1px; border-radius: 50%; background: #173332; border: 1px solid #60776a;
}
.dl-mine span:not(.beast-portrait) { color: var(--cream3); font-size: 12px; font-weight: 750; }
.dl-details { display: grid; gap: 12px; }
.dl-rules { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 10px 0 0; list-style: none; font-size: 13px; }
.dl-rules li { padding: 6px 8px; border: 1px solid #527168; border-radius: 7px; background: #142c2d; color: var(--cream2); }
.dl-tag { display: inline-block; margin-inline-end: 5px; font-weight: 800; }
.dl-tag.me { color: #bce8d0; }
.dl-tag.ai { color: #ffbda7; }
.dl-foes { display: grid; grid-template-columns: repeat(auto-fit, minmax(67px, 1fr)); gap: 6px; margin-top: 10px; }
.dl-foe {
  --dl-rank: var(--rc-common);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-width: 0; min-height: 82px; padding: 6px 3px; border: 1px solid color-mix(in srgb, var(--dl-rank) 40%, #29433b);
  border-radius: 9px; background: #162f30; color: var(--cream); font: inherit; cursor: pointer;
}
.dl-foe.r-rare { --dl-rank: var(--rc-rare); }
.dl-foe.r-epic { --dl-rank: var(--rc-epic); }
.dl-foe.r-legend { --dl-rank: var(--rc-legend); }
.dl-foe.elder { --dl-rank: var(--gold-hi); background: #35392e; }
.dl-foe b { max-width: 100%; font-size: 11px; line-height: 1.2; overflow-wrap: anywhere; }
.dl-foe small { color: var(--gold-hi); font-size: 10px; }
.dl-foe .eimg.mid, .dl-foe-img { width: 44px; height: 44px; }
.dl-foe .eimg.mid { border: 1px solid #9c8055; background: #273d38; }
@media (hover: hover) {
  .daily-page :is(.dl-foe, .lv-back):hover { border-color: #dfbb7d; }
  .dl-cta:hover { filter: brightness(1.08); }
}
@media (min-width: 700px) {
  .dl-details { grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); align-items: start; }
}

/* ---------- 对局结算 ---------- */
body:has(.scr-result, .scr-modeResult) { background: radial-gradient(ellipse at 50% 0%, #29463e, #102427 60%, #0b181c) fixed; }
.app:is(.scr-result, .scr-modeResult) {
  max-width: 940px;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}
.match-result { gap: 14px; color: var(--cream); }
.cr-page-title { font: 850 clamp(16px, 4.6vw, 22px)/1.2 var(--serif); text-align: center; }
.cr-hero {
  --cr-accent: #ffdda0;
  position: relative; isolation: isolate; overflow: hidden; display: flex; align-items: center;
  min-height: clamp(152px, 32vw, 236px); padding: clamp(16px, 4vw, 36px);
  border: 1px solid var(--gold-line); border-radius: 16px; background: #12292b;
}
.cr-hero::before, .cr-hero::after { content: ""; position: absolute; z-index: -1; inset: 0; }
.cr-hero::before { left: 25%; background: url("assets/home/court.webp") center 58% / cover no-repeat; }
.cr-hero::after {
  background: linear-gradient(90deg, #12292b 25%, #12292be8 35%, #12292b50 61%, #12292b00 89%),
    linear-gradient(0deg, #101f227a, transparent 55%);
}
.match-result[data-outcome="lose"] .cr-hero { --cr-accent: #ffc2ae; border-color: #9d7164; }
.match-result[data-outcome="draw"] .cr-hero { --cr-accent: #e2e4d2; border-color: var(--jade-line); }
.match-result:not([data-outcome="win"]) .cr-hero::before { filter: saturate(.52) brightness(.76); }
.cr-hero-copy { display: grid; justify-items: start; gap: 8px; }
.cr-stage, .cr-rounds { margin: 0; font-size: 13px; font-weight: 700; }
.cr-stage { color: var(--cr-accent); }
.cr-hero h1 { margin: 0; color: var(--cr-accent); font: 900 clamp(32px, 8vw, 60px)/1.08 var(--serif); }
.cr-rounds { color: var(--cream2); }
.cr-rounds b { color: var(--cream); font-variant-numeric: tabular-nums; }
.cr-rounds span { margin-inline: 2px; }
.cr-content, .cr-summary { display: grid; min-width: 0; gap: 12px; align-content: start; }
.cr-reward, .match-result .res-report, .match-result .res-timeout {
  min-width: 0; width: 100%; padding: 14px 16px; border: 1px solid #4e6a60; border-radius: 13px;
  background: var(--panel-ink); color: var(--cream2); text-align: left;
}
.cr-reward { border-color: #8c744e; }
.cr-reward-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cr-reward-head h2, .match-result .res-report h3 { margin: 0; color: var(--cream); font: 850 19px/1.3 var(--serif); }
.cr-reward-head strong {
  display: inline-flex; align-items: center; gap: 10px; color: var(--gold-hi);
  font-size: 26px; font-weight: 850; font-variant-numeric: tabular-nums;
}
.cr-reward-head i {
  flex: none; width: 13px; height: 13px; transform: rotate(45deg); border-radius: 2px;
  background: #91d9eb; box-shadow: inset -3px -3px #4ba1ba;
}
.cr-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.cr-reward-lines { display: grid; gap: 6px; margin: 10px 0 0; padding-top: 10px; border-top: 1px solid #ffffff1c; }
.cr-reward-lines > div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13px; }
.cr-reward-lines dd { margin: 0; color: var(--cream); font-weight: 750; font-variant-numeric: tabular-nums; }
.cr-reward > p { margin: 6px 0 0; color: var(--cream3); font-size: 13px; }
.cr-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.cr-actions button {
  min-height: 44px; padding: 6px 8px; border: 1px solid var(--jade-line); border-radius: 10px;
  background: #182f2f; color: var(--cream2); font: 750 14px/1.3 system-ui, sans-serif;
  cursor: pointer; touch-action: manipulation;
}
.cr-actions .cr-primary {
  display: flex; align-items: center; justify-content: center; gap: 16px; min-height: 50px;
  border-color: #ffe4a5; background: var(--cta); color: var(--cta-ink); font: 900 19px/1.15 var(--serif);
}
.cr-actions button:disabled { opacity: .55; cursor: default; }
@media (hover: hover) {
  .match-result button:not(:disabled):hover { border-color: var(--gold-hi); }
  .cr-actions .cr-primary:hover { filter: brightness(1.07); }
}
.match-result button:focus-visible, .match-result summary:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
.match-result .res-report h3 { margin-bottom: 8px; }
.match-result .res-report th, .match-result .res-report td { padding: 7px 0; border-color: #ffffff20; }
.match-result .res-report thead th { color: var(--cream3); }
.match-result .res-report thead th:nth-child(2) { color: #b7dec5; }
.match-result .res-report td { color: var(--cream); }
.match-result .res-report .res-tip { margin-top: 10px; background: #273e35; color: #f5e9cc; }
.match-result .res-round-list summary { color: var(--gold-hi); }
.match-result .res-round-list details { border-color: #ffffff20; }
@media (min-width: 680px) {
  .app:is(.scr-result, .scr-modeResult) { padding-inline: max(20px, env(safe-area-inset-left)) max(20px, env(safe-area-inset-right)); }
  .match-result { gap: 18px; }
  .cr-content.has-report { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 14px; align-items: start; }
}
