:root {
  color-scheme: light;
  --ink: #202957;
  --muted: #59658d;
  --indigo: #3949b9;
  --accent: #5972ef;
  --line: #d8ddf5;
  --paper: #fcfcff;
  --wash: #eff1fc;
  --gold: #ffdb80;
  --rose: #b63e61;
  --font: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
body {
  color: var(--ink);
  background: radial-gradient(ellipse at 50% 16%, #3c4a87, #1a2349 72%);
  font: 16px/1.4 var(--font);
  user-select: none;
}
#stage, #stage * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
#stage img { -webkit-user-drag: none; }
button, summary { font: inherit; color: inherit; cursor: pointer; }
button { border: 0; }
button:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
h1, h2, p { margin: 0; }
.hidden { display: none !important; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 22px;
  height: 22px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#stage {
  position: fixed;
  left: 50%;
  top: 50%;
  width: var(--stage-w, 540px);
  height: var(--stage-h, 960px);
  transform: translate(-50%, -50%);
  overflow: hidden;
  border-radius: 16px;
  background: #e3e8f9;
  box-shadow: 0 20px 70px #0b122873;
}
#stage[data-full-viewport] { border-radius: 0; box-shadow: none; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }

.primary, .ghost, .hudbtn, .buy, .lock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  border-radius: 12px;
  font-weight: 800;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s, box-shadow .15s;
}
.primary {
  padding: 0 22px;
  color: white;
  background: var(--indigo);
  box-shadow: 0 4px 0 #253489, 0 7px 18px #3744ac38;
  font-size: 18px;
}
.primary:hover { background: #4356cb; }
.primary:active { box-shadow: 0 1px 0 #253489; transform: translateY(3px); }
.ghost, .hudbtn, .lock {
  padding: 0 15px;
  background: #f2f4ff;
  border: 1px solid var(--line);
  color: #394780;
}
.ghost:hover, .hudbtn:hover, .lock:hover { background: #e5e9fd; border-color: #a8b5ef; }
.icon-only, .hudbtn { width: 52px; padding: 0; }
i.coin {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid #b47e27;
  background: var(--gold);
  color: #67460f;
  font-style: normal;
  font-size: 12px;
  font-weight: 900;
}

/* 战况 */
#hud {
  position: absolute;
  inset: calc(10px + var(--safe-top, 0px)) calc(12px + var(--safe-right, 0px)) auto calc(12px + var(--safe-left, 0px));
  display: grid;
  grid-template-columns: 174px 100px 74px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 11px;
  min-height: 66px;
  background: var(--paper);
  border: 1px solid #cbd3f0;
  border-radius: 14px;
  box-shadow: 0 3px 0 #cbd2ee;
  font-variant-numeric: tabular-nums;
}
.hud-vitals { display: grid; gap: 5px; }
.meter {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  overflow: hidden;
  border-radius: 6px;
  min-width: 0;
}
.meter-fill { position: absolute; z-index: -1; inset: 0 auto 0 0; width: 0; }
.hp-meter { justify-content: center; gap: 6px; height: 24px; background: #fce8ee; color: #631638; }
.hp-meter .icon { width: 16px; height: 16px; color: #a12e50; }
.hp-meter .meter-fill { background: linear-gradient(90deg, #f49db6, #ffbdcc); }
.xp-meter { justify-content: space-between; padding: 0 6px; height: 19px; background: #e7ebfc; font-size: 12px; color: #27356f; }
.xp-meter .meter-fill { background: linear-gradient(90deg, #94a5ff, #c3c5fe); }
.hud-wave { display: grid; justify-items: center; line-height: 1.1; }
#hudWave { color: var(--muted); font-size: 13px; font-weight: 750; }
#hudEnemies { font-size: 22px; white-space: nowrap; }
#hudEnemies.hot { color: var(--rose); }
.boss-meter { width: 100%; height: 13px; justify-content: center; font-size: 11px; color: #79183c; background: #f9e4ed; white-space: nowrap; }
.boss-meter .meter-fill { background: linear-gradient(90deg, #f1a1bc, #f8bbd0); }
.hud-coins, .coins {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  color: #694710;
  font-size: 18px;
}
.hud-tokens { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.hud-token {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 3px;
  min-width: 0;
  padding: 3px 1px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f0f2fa;
  color: #667295;
  font-size: 14px;
}
.hud-token img { width: 26px; height: 26px; flex: none; opacity: .6; }
.hud-token.active { color: var(--indigo); border-color: #b3bffa; background: #e9edff; }
.hud-token.active img { opacity: 1; }
.hud-actions { display: flex; gap: 5px; }
.hud-actions .hudbtn { width: 56px; min-height: 50px; }
.hud-actions .off { background: #e1e6f9; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* 标题 */
.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  --pad-v: 22px;
  --pad-h: 22px;
  padding: calc(var(--pad-v) + var(--safe-top, 0px)) calc(var(--pad-h) + var(--safe-right, 0px))
    calc(var(--pad-v) + var(--safe-bottom, 0px)) calc(var(--pad-h) + var(--safe-left, 0px));
  background: #19264b91;
  backdrop-filter: blur(4px);
}
#scrTitle {
  --pad-v: 28px;
  --pad-h: 36px;
  background:
    radial-gradient(ellipse at 90% 25%, #d7dafa, transparent 54%),
    linear-gradient(140deg, #fafaff, #ebf0ff 80%);
  backdrop-filter: none;
}
.title-frame {
  position: relative;
  display: grid;
  grid-template: "logo hero" auto "settings hero" auto "loadout hero" auto "actions hero" auto / minmax(0, 1fr) minmax(0, .94fr);
  align-items: center;
  align-content: center;
  gap: 8px 34px;
  width: 100%;
}
[data-full-viewport][data-layout="landscape"] .title-frame { max-width: 1000px; }
[data-full-viewport][data-layout="landscape"] .title-hero { width: min(100%, 410px); justify-self: center; }
.title-hero {
  grid-area: hero;
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  padding: 10px;
  border-radius: 48% 48% 20px 20px;
  border: 1px solid #bac6fa;
  background: #f8f7ff;
  box-shadow: 0 8px 0 #c9d2f3, 0 16px 32px #424fb726;
}
.title-hero::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px dashed #c1caf1;
  border-radius: inherit;
  pointer-events: none;
}
.portrait { width: 100%; overflow: hidden; border-radius: inherit; background: #f2edf9; }
.portrait img { display: block; width: 100%; }
.logo { grid-area: logo; color: #293688; line-height: 1.08; }
.logo span {
  display: block;
  font-size: 74px;
  font-weight: 950;
  letter-spacing: .04em;
  text-shadow: 0 3px #fff, 0 6px #c9d3ff;
}
.logo small {
  display: block;
  margin-top: 8px;
  color: #3d53ae;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: .19em;
}
.title-settings { grid-area: settings; display: flex; gap: 8px; min-width: 0; }
.segments { display: flex; flex: 1; min-width: 0; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: #e9edfb; }
.segments button { flex: 1; min-width: 0; min-height: 36px; padding: 0 5px; border-radius: 7px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 800; white-space: nowrap; }
.segments button[aria-pressed="true"] { color: #fff; background: var(--indigo); box-shadow: 0 2px 4px #283a8240; }
.loadout { grid-area: loadout; min-width: 0; }
.loadout h2 { margin-bottom: 8px; color: var(--muted); font-size: 15px; letter-spacing: .14em; }
#lvCards, #shopItems { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.card {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  text-align: left;
}
button.card:hover { border-color: var(--accent); background: #f1f3ff; }
.card img { width: 54px; height: 54px; object-fit: contain; flex: none; }
.card .info { display: grid; align-content: start; gap: 4px; flex: 1; min-width: 0; }
.card .name { color: var(--ink); font-size: 17px; font-weight: 850; }
.card .name em {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 6px;
  border-radius: 5px;
  background: #e9eeff;
  color: #374c9a;
  font-size: 11px;
  font-style: normal;
  vertical-align: 1px;
}
.card .desc { color: var(--muted); font-size: 14px; line-height: 1.42; }
.wpick { grid-column: span 2; flex-direction: column; text-align: center; gap: 2px; padding: 8px 3px; }
.wpick:nth-child(n+4) { grid-column: span 3; }
.wpick img { width: 42px; height: 42px; }
.wpick .name { font-size: 16px; }
.wpick .desc { font-size: 14px; }
.wpick.sel {
  border-color: #5e72e0;
  background: #e9edff;
  box-shadow: inset 0 0 0 1px #5e72e0, 0 3px 0 #b1bff7;
}
.wpick.sel::after {
  content: "✓";
  position: absolute;
  top: 5px;
  right: 7px;
  color: var(--indigo);
  font-size: 15px;
  font-weight: 900;
}
.title-actions { grid-area: actions; display: flex; gap: 10px; align-items: center; }
.title-actions .primary { flex: 1; justify-content: space-between; }
summary { list-style: none; }
summary::-webkit-details-marker { display: none; }
.guide:not([open]) .guide-panel { display: none; }
.guide-panel {
  position: absolute;
  z-index: 1;
  bottom: 16px;
  right: 13px;
  width: 365px;
  padding: 16px;
  border: 1px solid #cbd4fa;
  border-radius: 14px;
  background: var(--paper);
  box-shadow: 0 10px 32px #1f2b6950;
}
.guide-panel h2 { margin-bottom: 6px; font-size: 18px; }
.guide-panel p { color: var(--muted); font-size: 13px; }
#tokenLegend { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.tok { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; }
.tok img { width: 32px; height: 32px; flex: none; }
.tok b { display: block; color: var(--indigo); font-size: 14px; }
.tok .c-repeat { color: #aa3e66; }
.tok .c-inspire { color: #825610; }
.tok .c-slack { color: #1d756f; }

/* 覆盖面板 */
.panel {
  width: min(100%, 704px);
  max-height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  border: 1px solid #cdd5f3;
  border-radius: 19px;
  padding: 21px 22px;
  background: var(--paper);
  box-shadow: 0 6px 0 #8c9cd1, 0 20px 60px #101d4c63;
}
.panel-head { margin-bottom: 15px; }
.panel-head h2, #resHead { font-size: 29px; line-height: 1.2; font-weight: 900; }
.sub { margin-top: 4px; color: var(--muted); font-size: 14px; }
#scrLevel .panel-head, #scrPause .panel-head { text-align: center; }
.up-card {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 13px 12px;
  border-top: 4px solid #86a8ea;
}
.up-card.cat-w { border-top-color: #55accb; }
.up-card.cat-t { border-top-color: #d681ab; }
.up-card.cat-b { border-top-color: #dfb64e; }
.up-card .key {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: #f3f5ff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.rank-meter { display: inline-flex; width: max-content; max-width: 100%; align-items: center; color: var(--muted); }
.rank-meter > span { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.rank-meter i { width: 9px; height: 9px; border: 1px solid #aebbe4; border-radius: 2px; background: #eef1fb; }
.rank-meter i.filled { border-color: var(--indigo); background: var(--indigo); }
.rank-meter.maxed i.filled { border-color: #a7761d; background: #ce9b43; }
.rank-meter b { padding-left: 3px; font-size: 11px; font-variant-numeric: tabular-nums; line-height: 1; }
.rank-meter.count-only b { padding: 2px 5px; border: 1px solid #aebbe4; border-radius: 3px; background: #eef1fb; }
.pill .rank-meter i { width: 7px; height: 7px; }
.pill.final-pill { color: #755215; border-color: #e0b861; background: #fffaeb; }

.shop-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#scrShop .panel { scrollbar-gutter: stable; }
.coins { min-width: 140px; padding: 6px 12px; border-radius: 10px; background: #fff1d1; font-size: 23px; font-weight: 850; font-variant-numeric: tabular-nums; }
.shop-card { height: 230px; flex-direction: column; align-items: flex-start; gap: 6px; }
.shop-card .info { width: 100%; }
[data-layout="landscape"] .shop-card { height: 240px; }
[data-layout="landscape"] .shop-card .info { display: flex; flex-direction: column; }
[data-layout="landscape"] .shop-card .rank-meter { align-self: center; margin-top: auto; }
#btnReroll { min-width: 128px; font-variant-numeric: tabular-nums; }
.shop-card.locked { border-color: #d5a741; background: #fffaf0; }
.shop-card.sold { background: #f1f3f9; }
.shop-card.sold img { opacity: .65; }
.shop-card .name em.item { color: #755215; background: #fff1d1; }
.shop-card.legendary { border-color: #dfb458; background: #fffaf0; }
.shop-card .name em.legendary { color: #734d08; background: #ffe5a5; }
.shop-card .name em.supply { color: #275f61; background: #d9f1ee; }
.acts { width: 100%; display: flex; gap: 6px; flex: none; margin-top: 4px; }
[data-layout="landscape"] .shop-card .acts { margin-top: auto; }
.buy { flex: 1; padding: 0 10px; min-height: 43px; border: 1px solid #d8a646; background: #ffe29c; color: #61420e; }
.buy:hover { background: #ffdb80; }
.buy.poor, .ghost.poor { opacity: .62; }
.buy[aria-disabled="true"] { border-color: var(--line); background: var(--wash); color: var(--muted); cursor: default; opacity: 1; }
.lock { flex: none; width: 45px; min-height: 43px; padding: 0; }
.shop-card.locked .lock { color: #68470e; background: #ffe29c; border-color: #d5a741; }
.shop-row { display: flex; justify-content: space-between; gap: 8px; margin-top: 13px; }
.shop-build { margin-top: 12px; }
.shop-build summary { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; color: var(--muted); font-size: 14px; font-weight: 700; }
.shop-build summary .icon { width: 18px; height: 18px; }
.shop-build[open] .build { margin-top: 6px; height: 108px; overflow: auto; scrollbar-gutter: stable; overscroll-behavior: contain; }
.build { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #f1f3ff; font-size: 13px; }
.build .row, .stats { display: flex; flex-wrap: wrap; gap: 6px 9px; }
.build .row { margin-bottom: 8px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px 2px 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  font-weight: 800;
}
.pill img { width: 24px; height: 24px; }
.pill.small { padding: 2px 7px; font-size: 12px; font-weight: 500; }
.pill.up { background: #fff4fa; border-color: #f4ccdf; }
.stats { color: var(--muted); }
.stats span { white-space: nowrap; }
.stats b { color: var(--ink); }
.stats.rates { margin-top: 6px; }
#scrPause .panel { max-width: 510px; }
#btnAbandon { color: var(--rose); background: #fff3f6; border-color: #edcbd7; }
#btnAbandon:hover { background: #ffe5ed; border-color: #dba3b7; }

.result-panel { display: grid; grid-template-columns: 184px minmax(0, 1fr); gap: 16px; align-items: center; }
.res-top { text-align: center; }
#resPortrait {
  display: block;
  width: 136px;
  height: 136px;
  margin: 0 auto 8px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: radial-gradient(circle, white, #e9edff);
}
#resHead { font-size: 23px; }
#resHead.win { color: var(--indigo); }
#resHead.lose { color: var(--rose); }
#resBadge {
  display: inline-block;
  margin-top: 7px;
  padding: 4px 9px;
  border: 1px solid #dfb458;
  border-radius: 8px;
  background: #fff1d1;
  color: #694710;
  font-size: 14px;
  font-weight: 850;
}
#resBadgeSub { margin-top: 5px; color: var(--muted); font-size: 12px; }
.rating {
  display: grid;
  grid-template-columns: auto minmax(86px, auto) 1fr;
  align-items: center;
  gap: 12px;
  padding: 9px;
  margin-bottom: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(135deg, #edf0ff, #fafaff);
}
#resGrade {
  display: grid;
  place-items: center;
  width: 49px;
  height: 49px;
  border: 1px solid #a5afca;
  border-radius: 10px;
  background: #e2e7f4;
  color: #455273;
  font-size: 29px;
  line-height: 1;
}
#resGrade[data-grade="S"] { background: #ffde8f; color: #68430c; border-color: #d7a84c; }
#resGrade[data-grade="A"] { background: #4657c0; color: white; border-color: #33439f; }
#resGrade[data-grade="B"] { background: #d3f3f1; color: #225d67; border-color: #8dc6ca; }
.rating-score { display: grid; color: var(--muted); font-size: 12px; line-height: 1.1; }
#resScore { color: var(--ink); font-size: 28px; font-variant-numeric: tabular-nums; }
#resScoreBreakdown { color: var(--muted); font-size: 12px; line-height: 1.35; }
#resLine { margin-bottom: 8px; color: var(--muted); font-size: 14px; font-weight: 650; }
#resStats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; color: var(--muted); font-size: 13px; text-align: center; }
#resStats span { display: grid; align-content: center; padding: 6px 3px; border-radius: 8px; background: var(--wash); }
#resStats b { color: var(--ink); font-size: 18px; }
#resDeath { margin-top: 8px; padding: 7px 9px; border-radius: 8px; background: #fff0f4; color: #824359; font-size: 13px; }
#resDeath b { display: block; color: #aa3458; }
.btn-row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 13px; }
.result-panel .btn-row { grid-column: 1 / -1; margin-top: 0; }

.progress-head { display: flex; align-items: center; gap: 12px; }
.progress-head > div:nth-child(2) { flex: 1; }
.ticket-balance, .result-reward { display: flex; align-items: center; gap: 6px; color: #685017; }
.ticket-balance { min-width: 94px; justify-content: center; padding: 7px 11px; border-radius: 10px; background: #fff0cb; font-size: 21px; }
i.ticket { display: inline-grid; place-items: center; width: 23px; height: 18px; flex: none; border: 1px solid #c49444; border-radius: 4px; background: #ffe19a; font-size: 12px; font-style: normal; font-weight: 850; }
.result-reward { margin-bottom: 7px; font-size: 14px; }
#progressCards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.progress-card { flex-direction: column; align-items: stretch; min-width: 0; }
.progress-card .info { gap: 4px; }
.progress-rank { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); }
.progress-rank span { display: flex; gap: 3px; }
.progress-rank i { width: 15px; height: 6px; border-radius: 4px; background: #e0e5f8; }
.progress-rank i.filled { background: var(--accent); }
.progress-rank b { margin-left: 4px; }
.progress-card .ghost { min-height: 42px; padding: 0 10px; }
.progress-card .ghost:disabled { opacity: .56; cursor: default; }
.progress-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 5px 12px; margin-top: 12px; font-size: 13px; color: var(--muted); }

/* 竖屏卡片和战况重排 */
[data-layout="portrait"] #scrTitle { --pad-v: 22px; --pad-h: 30px; }
[data-layout="portrait"] .title-frame {
  grid-template: "logo" auto "hero" auto "settings" auto "loadout" auto "actions" auto / minmax(0, 1fr);
  gap: 15px;
}
[data-layout="portrait"] .title-hero { justify-self: center; width: 330px; }
[data-layout="portrait"] .logo { text-align: center; }
[data-layout="portrait"] .logo span { font-size: 90px; }
[data-layout="portrait"] .logo small { font-size: 35px; }
[data-layout="portrait"] .wpick { min-height: 104px; }
[data-layout="portrait"] .title-actions > * { min-height: 62px; }
[data-layout="portrait"] .title-actions .hudbtn { width: 62px; min-height: 62px; }
[data-layout="portrait"] .guide-panel { bottom: 400px; right: calc((100% - 365px) / 2); }
[data-layout="portrait"] #hud {
  grid-template: "vitals wave coins actions" 50px "tokens tokens tokens tokens" 32px / minmax(0, 1fr) 86px 58px auto;
  gap: 4px 8px;
  padding: 6px 8px;
}
[data-layout="portrait"] .hud-vitals { grid-area: vitals; gap: 4px; }
[data-layout="portrait"] .hud-wave { grid-area: wave; }
[data-layout="portrait"] .boss-meter { height: 11px; font-size: 10px; }
[data-layout="portrait"] .hud-coins { grid-area: coins; }
[data-layout="portrait"] .hud-tokens { grid-area: tokens; }
[data-layout="portrait"] .hud-actions { grid-area: actions; }
[data-layout="portrait"] .hud-token { padding-block: 1px; }
[data-layout="portrait"] #lvCards, [data-layout="portrait"] #shopItems { grid-template-columns: minmax(0, 1fr); }
[data-layout="portrait"] .up-card, [data-layout="portrait"] .shop-card { flex-direction: row; align-items: center; min-height: 99px; }
[data-layout="portrait"] .up-card { border-top-width: 1px; border-top-color: var(--line); border-left-width: 4px; }
[data-layout="portrait"] .up-card.cat-w { border-left-color: #55accb; }
[data-layout="portrait"] .up-card.cat-t { border-left-color: #d681ab; }
[data-layout="portrait"] .up-card.cat-b { border-left-color: #dfb64e; }
[data-layout="portrait"] .up-card .info { padding-right: 26px; }
[data-layout="portrait"] .shop-card { height: 132px; }
[data-layout="portrait"] .shop-card .info { width: auto; }
[data-layout="portrait"] .acts { width: auto; flex-direction: column; }
[data-layout="portrait"] .buy, [data-layout="portrait"] .lock { width: 74px; }
[data-layout="portrait"] .result-panel { grid-template-columns: minmax(0, 1fr); }
[data-layout="portrait"] .res-top { display: flex; align-items: center; justify-content: center; gap: 12px; }
[data-layout="portrait"] #resPortrait { margin: 0; }
[data-layout="portrait"] .btn-row > *, [data-layout="portrait"] .shop-row > * { min-height: 60px; }
[data-layout="portrait"] .icon-only { width: 60px; }
[data-layout="portrait"] #progressCards { grid-template-columns: 1fr; }
[data-layout="portrait"] .progress-card { flex-direction: row; align-items: center; }
[data-layout="portrait"] .progress-card .ghost { min-height: 49px; }

/* 饭桌：基础与专精 */
.progress-tabs { display: flex; gap: 5px; margin: -3px 0 10px; padding: 4px; border-radius: 10px; background: #edf0ff; }
.progress-tabs button { flex: 1; min-height: 34px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-weight: 800; cursor: pointer; }
.progress-tabs button[aria-selected="true"] { background: white; color: var(--indigo); box-shadow: 0 1px 4px #263a7524; }
#specializationCards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.spec-card { display: flex; flex-direction: column; align-items: stretch; gap: 7px; padding: 10px; }
.spec-card.equipped { border-color: #788ce6; background: #f3f5ff; }
.spec-heading { display: flex; align-items: center; gap: 6px; min-width: 0; }
.spec-heading > b { color: var(--indigo); white-space: nowrap; }
.spec-heading .progress-rank { margin-left: auto; white-space: nowrap; }
.spec-icon { font-size: 21px; line-height: 1; }
.spec-effects { flex: 1; display: grid; align-content: start; gap: 3px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.spec-requirement { color: #80651f; }
.spec-actions { display: flex; gap: 5px; }
.spec-actions button { flex: 1; display: inline-flex; justify-content: center; align-items: center; gap: 3px; min-width: 0; min-height: 38px; padding: 0 4px; font-size: 12px; white-space: nowrap; }
.spec-actions button:disabled { opacity: .55; cursor: default; }
.spec-equip[aria-pressed="true"] { color: #3047a3; border-color: #8295e6; background: #e3e9ff; }
[data-layout="portrait"] #specializationCards { grid-template-columns: 1fr; }
[data-layout="portrait"] .spec-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; }
[data-layout="portrait"] .spec-heading { grid-column: 1; }
[data-layout="portrait"] .spec-effects { grid-column: 1; }
[data-layout="portrait"] .spec-actions { grid-column: 2; grid-row: 1 / 3; flex-direction: column; }
[data-layout="portrait"] .spec-actions button { min-width: 78px; min-height: 36px; }


/* 标题装备入口与武器库 */
#btnWeaponOpen {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 64px;
  padding: 7px 12px; text-align: left; border: 1px solid #bdc9f3; border-radius: 12px;
  background: #fff; color: var(--ink);
}
#btnWeaponOpen:hover { border-color: var(--accent); background: #f1f3ff; }
#btnWeaponOpen img { width: 46px; height: 46px; object-fit: contain; }
#btnWeaponOpen span { display: grid; flex: 1; min-width: 0; }
#btnWeaponOpen small { color: var(--muted); font-size: 12px; font-weight: 700; }
#btnWeaponOpen b { font-size: 16px; }
#btnWeaponOpen > .icon { color: var(--indigo); }
.weapon-panel { width: min(100%, 704px); }
.weapon-head { display: flex; align-items: center; gap: 12px; }
.weapon-head .sub { margin-top: 1px; }
.weapon-layout { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 12px; align-items: start; }
#weaponPick { display: grid; gap: 6px; }
.weapon-option {
  position: relative; display: flex; align-items: center; gap: 9px; min-width: 0; min-height: 56px;
  padding: 6px 10px; border: 1px solid var(--line); border-radius: 11px;
  background: #fff; color: var(--ink); text-align: left;
}
.weapon-option:hover { border-color: var(--accent); background: #f4f5ff; }
.weapon-option.sel { border-color: #5e72e0; background: #e9edff; box-shadow: inset 0 0 0 1px #5e72e0; }
.weapon-option.locked { color: var(--muted); background: #f3f4f9; }
.weapon-option.locked.sel { background: #edf0ff; }
.weapon-option img { width: 42px; height: 42px; flex: none; object-fit: contain; }
.weapon-option.locked img { opacity: .65; }
.weapon-option b { flex: 1; min-width: 0; font-size: 15px; }
.weapon-mark { display: flex; color: var(--indigo); }
.weapon-detail { display: grid; gap: 10px; min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: #f8f9ff; }
.weapon-detail-heading { display: flex; align-items: center; gap: 10px; }
.weapon-detail-heading img { width: 62px; height: 62px; object-fit: contain; flex: none; }
.weapon-detail-heading h3 { margin: 0; font-size: 20px; }
.weapon-detail-heading p { color: var(--muted); font-size: 13px; }
.weapon-requirement { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 3px 8px; color: #76591c; font-size: 13px; }
#weaponAchievements { display: grid; gap: 6px; }
.weapon-achievement { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 7px 8px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--muted); font-size: 12px; }
.weapon-achievement > .icon { width: 20px; height: 20px; flex: none; }
.weapon-achievement .info { display: grid; flex: 1; min-width: 0; }
.weapon-achievement .info b { color: var(--ink); font-size: 13px; }
.weapon-achievement .info small { font-size: 12px; }
.weapon-achievement.complete { border-color: #e1c57c; background: #fff9e9; color: #80601b; }
.weapon-achievement-value { flex: none; font-variant-numeric: tabular-nums; }
#btnWeaponEquip { width: 100%; min-height: 46px; }
#btnWeaponEquip:disabled { background: #dfe3f0; color: #78809a; box-shadow: none; cursor: default; }
#resWeaponUnlocks { margin-bottom: 8px; padding: 7px 9px; border: 1px solid #e3c574; border-radius: 8px; background: #fff6da; color: #765414; font-size: 13px; font-weight: 800; }
[data-layout="portrait"] .weapon-layout { grid-template-columns: 1fr; }
[data-layout="portrait"] #weaponPick { grid-template-columns: repeat(5, minmax(0, 1fr)); }
[data-layout="portrait"] .weapon-option { flex-direction: column; justify-content: center; gap: 2px; min-height: 80px; padding: 5px 2px; text-align: center; }
[data-layout="portrait"] .weapon-option b { flex: none; font-size: 12px; }
[data-layout="portrait"] .weapon-mark { height: 22px; }
[data-layout="portrait"] .weapon-detail { gap: 8px; }

/* Toy 排行榜 */
.title-actions { gap: 7px; }
.title-actions .primary { min-width: 0; padding-inline: 12px; }
.leaderboard-panel { width: min(100%, 520px); }
.leaderboard-head { display: flex; align-items: center; gap: 12px; }
.leaderboard-head > div { flex: 1; min-width: 0; }
.leaderboard-head .sub { margin-top: 1px; }
.leaderboard-periods { display: flex; gap: 5px; padding: 4px; border-radius: 10px; background: #edf0ff; }
.leaderboard-periods button { flex: 1; min-height: 40px; border-radius: 7px; background: transparent; color: var(--muted); font-weight: 800; }
.leaderboard-periods button[aria-pressed="true"] { background: white; color: var(--indigo); box-shadow: 0 1px 4px #263a7524; }
#leaderboardStatus, #leaderboardMine, #resLeaderboardStatus { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
#leaderboardStatus:not(:empty) { margin-top: 10px; }
#leaderboardList { display: grid; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
#leaderboardList li { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 9px; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #f8f9ff; }
.rank-place { color: var(--indigo); font-weight: 900; font-variant-numeric: tabular-nums; text-align: center; }
.rank-name { min-width: 0; overflow-wrap: anywhere; }
.rank-score { font-weight: 850; font-variant-numeric: tabular-nums; }
#leaderboardMine:not(:empty) { margin-top: 10px; padding: 9px 10px; border-radius: 9px; background: #edf0ff; }
#resLeaderboardStatus:not(:empty) { margin-bottom: 8px; }
[data-layout="portrait"] .leaderboard-periods button { min-height: 50px; }
