/* ================= EMBER ARENA · 16-bit 像素 RPG ================= */
* { margin: 0; padding: 0; box-sizing: border-box; user-select: none; }

:root {
  --gold: #ffd23f;
  --amber: #e8a33d;
  --orange: #e8963c;
  --brown: #6b4a2f;
  --dark: #1a120b;
  --panel: #26190f;
  --panel2: #2f2013;
  --cream: #f2e3c2;
  --red: #c0392b;
  --green: #7ec850;
  --outline: #120c07;
}

html, body {
  width: 100%; height: 100%; overflow: hidden; background: var(--outline);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
body {
  font-family: "Courier New", "Lucida Console", monospace;
  color: var(--cream);
  cursor: crosshair;
}

#gameCanvas {
  position: fixed; inset: 0; display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.hidden { display: none !important; }

/* 像素对话框通用样式 */
.pixel-panel {
  background: var(--panel);
  border: 3px solid var(--brown);
  box-shadow: 0 0 0 3px var(--outline), inset 0 0 0 2px var(--outline);
}

/* ================= HUD ================= */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }

.hud-bl { position: absolute; left: calc(22px + env(safe-area-inset-left)); bottom: calc(20px + env(safe-area-inset-bottom)); display: flex; align-items: flex-end; gap: 20px; }

.hp-wrap { width: 290px; }
.hp-label { font-size: 26px; font-weight: bold; letter-spacing: 1px; color: var(--cream); text-shadow: 2px 2px 0 var(--outline); }
.hp-label small { font-size: 12px; opacity: .7; margin-left: 5px; letter-spacing: 3px; }
.hp-bar {
  position: relative; height: 16px; margin-top: 5px;
  border: 3px solid var(--outline);
  background: #3a2415;
  box-shadow: 0 0 0 2px var(--brown);
}
#hpFill {
  position: absolute; top: 0; left: 0; bottom: 0; width: 100%;
  background: repeating-linear-gradient(90deg, var(--amber) 0 13px, #c9862f 13px 16px);
  transition: width .12s steps(4);
}
#hpFill.low { background: repeating-linear-gradient(90deg, var(--red) 0 13px, #8f2b20 13px 16px); }
#hpGhost {
  position: absolute; top: 0; left: 0; bottom: 0; width: 100%;
  background: #5a2a1a; transition: width .5s steps(6) .15s;
}

.dash-wrap { text-align: center; }
.dash-ring {
  width: 58px; height: 58px; display: grid; place-items: center;
  background: var(--panel2);
  border: 3px solid var(--brown);
  box-shadow: 0 0 0 3px var(--outline);
  font-size: 11px; font-weight: bold; color: #b09468;
}
.dash-ring.ready {
  border-color: var(--gold);
  color: var(--gold);
  animation: dashPulse 1.2s steps(2) infinite;
}
@keyframes dashPulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--outline); }
  50% { box-shadow: 0 0 0 3px var(--outline), 0 0 0 5px var(--gold); }
}
.dash-text { font-size: 11px; color: #b09468; margin-top: 5px; letter-spacing: 2px; }

.hud-br { position: absolute; right: calc(22px + env(safe-area-inset-right)); bottom: calc(20px + env(safe-area-inset-bottom)); text-align: right; }
.weapon-box {
  padding: 12px 16px; min-width: 225px;
  background: var(--panel);
  border: 3px solid var(--brown);
  box-shadow: 0 0 0 3px var(--outline);
}
.weapon-row { display: flex; align-items: center; justify-content: flex-end; gap: 7px; margin-bottom: 8px; }
.weapon-slots { display: flex; gap: 7px; justify-content: flex-end; }
#tReload {
  width: 30px; height: 30px; display: none; place-items: center;
  background: #1c1109; border: 2px solid #4a3320;
  font-size: 13px; font-weight: bold; color: #6d5436;
  touch-action: none; flex-shrink: 0;
}
#tReload.ready { border-color: var(--gold); color: var(--gold); }
.w-slot {
  width: 30px; height: 30px; display: grid; place-items: center;
  background: #1c1109; border: 2px solid #4a3320;
  font-size: 14px; font-weight: bold; color: #6d5436;
  cursor: pointer; transition: transform 0.1s, border-color 0.15s;
}
.w-slot:active { transform: scale(0.9); }
.w-slot.owned { color: var(--cream); border-color: var(--brown); }
.w-slot.active {
  color: var(--gold); border-color: var(--gold);
  background: #3a2a12;
}
.weapon-name { font-size: 16px; font-weight: bold; letter-spacing: 2px; color: var(--cream); }
.weapon-ammo { font-size: 12px; color: #b09468; margin-top: 3px; letter-spacing: 1px; }

.hud-top {
  position: absolute; top: calc(16px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
}
.stat-chip {
  padding: 7px 18px; font-size: 13px; letter-spacing: 2px;
  background: var(--panel); border: 3px solid var(--brown);
  box-shadow: 0 0 0 3px var(--outline);
}
.stat-chip b { color: var(--gold); font-size: 15px; }
.chip-credit b { color: var(--gold); }
.chip-mid { display: flex; align-items: center; gap: 13px; }
.alive-count { display: flex; align-items: center; gap: 6px; font-weight: bold; font-size: 16px; }
.dot { width: 9px; height: 9px; display: inline-block; border: 2px solid var(--outline); }
.dot-ally { background: var(--gold); }
.dot-enemy { background: var(--red); }
.vs { font-size: 11px; color: #b09468; letter-spacing: 1px; }

#killfeed {
  position: absolute; top: 68px; right: 22px; display: flex; flex-direction: column;
  align-items: flex-end; gap: 6px;
}
.kf-item {
  padding: 5px 12px; font-size: 12px; letter-spacing: 1px;
  background: var(--panel); border: 2px solid var(--brown);
  box-shadow: 0 0 0 2px var(--outline);
  animation: kfIn .2s steps(3);
}
.kf-item.me { border-color: var(--gold); }
.kf-item .k-name-hero { color: var(--gold); font-weight: bold; }
.kf-item .k-name-foe { color: #ff8a70; font-weight: bold; }
.kf-item .k-weapon { opacity: .9; margin: 0 7px; }
@keyframes kfIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

#minimap {
  position: absolute; top: 16px; left: 22px;
  border: 3px solid var(--brown);
  box-shadow: 0 0 0 3px var(--outline);
  image-rendering: pixelated;
  background: var(--panel);
}

#banner {
  position: absolute; top: 33%; left: 50%; transform: translate(-50%,-50%);
  text-align: center; font-size: 42px; font-weight: bold; letter-spacing: 8px;
  opacity: 0; transition: opacity .2s steps(3); white-space: nowrap;
  color: var(--cream);
  text-shadow: 4px 4px 0 var(--outline);
}
#banner .banner-sub { display: block; font-size: 14px; letter-spacing: 3px; color: #d8bd8f; margin-top: 8px; text-shadow: 2px 2px 0 var(--outline); }
#banner.show { opacity: 1; }
#banner.gold { color: var(--gold); }
#banner.red { color: #ff6b5a; }

/* ================= 覆盖层 ================= */
.overlay {
  position: fixed; inset: 0; z-index: 20; display: flex;
  overflow-y: auto;
  background: rgba(14, 8, 4, 0.88);
}
.menu-inner { text-align: center; max-width: 730px; padding: 20px; margin: auto; }

.title-glow {
  font-size: 64px; font-weight: bold; letter-spacing: 5px; line-height: 1;
  color: var(--gold);
  text-shadow: 5px 5px 0 #7a3f16, 8px 8px 0 var(--outline);
}
.title-glow span { color: var(--orange); text-shadow: 5px 5px 0 #6b2f16, 8px 8px 0 var(--outline); }
.title-glow.small { font-size: 44px; }
.subtitle { margin-top: 14px; font-size: 14px; letter-spacing: 6px; color: #d8bd8f; text-shadow: 2px 2px 0 var(--outline); }
.menu-desc { margin: 26px 0; font-size: 14px; line-height: 2; color: #d8c9a8; text-shadow: 1px 1px 0 var(--outline); }
.menu-desc b { color: var(--gold); }

.btn {
  pointer-events: auto; cursor: pointer; border: 3px solid var(--outline);
  font-family: inherit; font-size: 16px; font-weight: bold; letter-spacing: 4px;
  padding: 14px 42px; color: #241207;
  background: var(--gold);
  box-shadow: 4px 4px 0 var(--outline);
  transition: transform .08s, box-shadow .08s;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--outline); }
.btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--outline); }
.btn-ghost {
  background: var(--panel2); color: #d8bd8f; border-color: var(--outline);
  box-shadow: 4px 4px 0 var(--outline); margin-top: 14px;
}
.btn-ghost:hover { color: var(--cream); border-color: var(--red); }
.btn-large { font-size: 18px; padding: 16px 54px; margin-top: 24px; }

.controls-grid {
  margin-top: 30px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.ctrl {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px; font-size: 12px; color: #d8c9a8;
  background: var(--panel); border: 2px solid var(--brown);
  box-shadow: 0 0 0 2px var(--outline);
}
.ctrl span { opacity: .85; }
kbd {
  background: #1c1109; border: 2px solid var(--brown);
  border-bottom-width: 4px; padding: 2px 7px; font-size: 11px;
  font-family: inherit; color: var(--cream);
}
.best-record { margin-top: 20px; font-size: 12px; color: #b09468; letter-spacing: 2px; }

/* ================= 武器工坊 ================= */
.shop-inner {
  width: min(860px, 92vw); padding: 30px 34px; margin: auto;
  background: var(--panel);
  border: 4px solid var(--brown);
  box-shadow: 0 0 0 4px var(--outline), inset 0 0 0 3px var(--outline);
}
.shop-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 22px; }
.shop-title { font-size: 28px; font-weight: bold; letter-spacing: 5px; color: var(--gold); text-shadow: 3px 3px 0 var(--outline); }
.shop-title.lose { color: #ff6b5a; }
.shop-credit { font-size: 14px; letter-spacing: 2px; color: #d8c9a8; }
.shop-credit b { color: var(--gold); font-size: 20px; }

.shop-weapons { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 13px; }
.w-card {
  padding: 16px 14px; position: relative;
  background: var(--panel2);
  border: 3px solid #4a3320;
  box-shadow: 0 0 0 2px var(--outline);
  transition: transform .1s;
}
.w-card:hover { transform: translateY(-2px); }
.w-card.owned { border-color: #a3742f; }
.w-card.equipped { border-color: var(--gold); box-shadow: 0 0 0 2px var(--outline), 0 0 0 4px var(--gold); }
.w-card .w-icon { font-size: 24px; margin-bottom: 7px; }
.w-card .w-name { font-size: 15px; font-weight: bold; letter-spacing: 1px; color: var(--cream); }
.w-card .w-desc { font-size: 12px; color: #c4a97e; margin: 7px 0 11px; line-height: 1.7; min-height: 56px; }
.w-card .w-stats { display: flex; gap: 9px; font-size: 11px; color: #b09468; margin-bottom: 12px; }
.w-card .w-stats i { font-style: normal; color: var(--cream); }
.w-card .w-tag {
  position: absolute; top: 10px; right: 10px; font-size: 10px; letter-spacing: 1px;
  padding: 2px 7px; background: #3a2a12; color: var(--gold);
  border: 2px solid #a3742f;
}
.w-card .w-tag.no-gold { color: #ff8a70; border-color: var(--red); background: #2a1210; }
.w-card .w-buy {
  pointer-events: auto; cursor: pointer; width: 100%;
  border: 3px solid var(--outline); padding: 8px 0;
  font-family: inherit; font-size: 13px; font-weight: bold; letter-spacing: 2px;
  background: var(--gold); color: #241207;
  box-shadow: 3px 3px 0 var(--outline);
}
.w-card .w-buy:hover { filter: brightness(1.1); }
.w-card .w-buy:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--outline); }
.w-card .w-buy:disabled { background: #3a2a18; color: #7a5c38; box-shadow: none; cursor: not-allowed; border-color: #241207; }
.w-card .w-buy.own-btn { background: #3a2a12; color: var(--gold); border-color: #a3742f; }

/* ================= 地形图库（展开式） ================= */
.maplib-toggle {
  cursor: pointer; width: 100%; font-family: inherit; text-align: left;
  padding: 11px 14px; font-size: 13px; letter-spacing: 3px; color: #d8bd8f;
  background: var(--panel2); border: 3px solid #4a3320;
  box-shadow: 0 0 0 2px var(--outline);
  display: flex; align-items: center; gap: 8px;
}
.maplib-toggle:hover { color: var(--cream); border-color: var(--brown); }
.maplib-toggle .ml-arrow { display: inline-block; transition: transform .15s; width: 12px; }
.maplib-toggle.open .ml-arrow { transform: rotate(90deg); }
.maplib-toggle .ml-count { font-size: 11px; opacity: .6; letter-spacing: 1px; }
.maplib-toggle .ml-current {
  margin-left: auto; font-size: 12px; letter-spacing: 1px;
  color: var(--gold); font-weight: bold;
}
.maplib {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin-top: 10px; padding: 12px;
  background: var(--panel2); border: 3px solid #4a3320;
  box-shadow: 0 0 0 2px var(--outline);
  animation: libIn .18s ease-out;
}
@keyframes libIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.map-card {
  cursor: pointer; padding: 9px;
  background: var(--panel); border: 3px solid #4a3320;
  transition: transform .1s, border-color .1s;
}
.map-card:hover { transform: translateY(-2px); border-color: var(--brown); }
.map-card.active { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.map-card canvas {
  display: block; width: 100%; image-rendering: pixelated;
  border: 2px solid var(--outline); background: #d8c9a8;
}
.map-card .mc-name { font-size: 14px; font-weight: bold; letter-spacing: 2px; color: var(--cream); margin-top: 8px; }
.map-card .mc-tags { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 4px; }
.map-card .mc-tags i {
  font-style: normal; font-size: 10px; letter-spacing: 1px; padding: 2px 7px;
  background: rgba(255,210,63,0.12); color: var(--gold); border: 1px solid rgba(255,210,63,0.35);
}
.map-card .mc-desc { font-size: 11px; color: #c4a97e; margin-top: 6px; line-height: 1.55; }
.map-card .mc-random-canvas {
  width: 100%; height: 88px; display: grid; place-items: center;
  font-size: 34px; font-weight: bold; color: var(--gold);
  border: 2px dashed var(--brown); background: var(--panel);
}
body[data-theme="chibi"] .maplib-toggle,
body[data-theme="chibi"] .map-card,
body[data-theme="chibi"] .maplib { border-radius: 12px; }
body[data-theme="chibi"] .map-card canvas { border-radius: 8px; }
body[data-theme="chibi"] .maplib { background: #fff3ea; border-color: #f0cdbd; }
body[data-theme="chibi"] .maplib-toggle { background: #fff3ea; border-color: #f0cdbd; color: #9a7a6e; }
body[data-theme="chibi"] .map-card { background: #fff8f2; border-color: #f0cdbd; }
body[data-theme="chibi"] .map-card .mc-name { color: #6d4c47; }
body[data-theme="chibi"] .map-card .mc-desc { color: #b09184; }
body[data-theme="chibi"] .map-card .mc-tags i { background: #ffe4ec; color: #e07a97; border-color: #ffc4d4; }
body[data-theme="adventure"] .maplib { background: #1c2833; border-color: #3d5566; }
body[data-theme="adventure"] .maplib-toggle { background: #1c2833; border-color: #3d5566; color: #8ba3ad; }
body[data-theme="adventure"] .map-card { background: #16222c; border-color: #3d5566; }
body[data-theme="adventure"] .map-card .mc-name { color: #f5e6c8; }
body[data-theme="adventure"] .map-card .mc-desc { color: #8ba3ad; }
body[data-theme="adventure"] .map-card .mc-tags i { background: rgba(255,107,53,0.15); color: #ff8c5a; border-color: rgba(255,107,53,0.4); }
body[data-theme="adventure"] .map-card canvas { background: #3aa89b; }

#audioHint {
  position: fixed; bottom: 10px; left: 50%; transform: translateX(-50%); z-index: 5;
  font-size: 11px; color: #b09468; letter-spacing: 2px; transition: opacity .6s;
}
#audioHint.off { opacity: 0; }

/* ================= 主页：设置面板 ================= */
.setting-row { margin-top: 22px; text-align: left; }
.setting-label { font-size: 13px; letter-spacing: 3px; color: #d8bd8f; margin-bottom: 10px; }

.theme-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
/* 主题风格库（展开式，复用 .maplib 容器样式） */
.themelib { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 720px) { .themelib { grid-template-columns: repeat(2, 1fr); } }
.theme-card {
  cursor: pointer; padding: 14px 12px; text-align: center;
  background: var(--panel2); border: 3px solid #4a3320;
  box-shadow: 0 0 0 2px var(--outline);
  transition: transform .1s, border-color .1s;
}
.theme-card:hover { transform: translateY(-2px); }
.theme-card.active { border-color: var(--gold); box-shadow: 0 0 0 2px var(--outline), 0 0 0 4px var(--gold); }
.theme-card .tc-swatches { display: flex; justify-content: center; gap: 5px; margin-bottom: 9px; }
.theme-card .tc-swatches i {
  width: 16px; height: 16px; display: inline-block; border: 2px solid var(--outline);
}
.theme-card .tc-name { font-size: 15px; font-weight: bold; letter-spacing: 2px; color: var(--cream); }
.theme-card .tc-tag { font-size: 9px; letter-spacing: 2px; color: #b09468; margin-top: 3px; }
.theme-card .tc-desc { font-size: 11px; color: #c4a97e; margin-top: 7px; line-height: 1.5; }

/* 英雄角色卡片 */
.hero-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.hero-card {
  cursor: pointer; padding: 10px 8px 12px; text-align: center; position: relative;
  background: var(--panel2); border: 3px solid #4a3320;
  box-shadow: 0 0 0 2px var(--outline);
  transition: transform .1s, border-color .1s, box-shadow .1s;
}
.hero-card:hover { transform: translateY(-2px); }
.hero-card.active { border-color: var(--gold); box-shadow: 0 0 0 2px var(--outline), 0 0 0 4px var(--gold); }
.hc-avatar {
  display: block; margin: 0 auto 8px; image-rendering: pixelated;
  background: rgba(0,0,0,0.28); border: 2px solid var(--outline);
}
.hc-name { font-size: 14px; font-weight: bold; letter-spacing: 2px; color: var(--cream); }
.hc-title { font-size: 9px; letter-spacing: 2px; color: #b09468; margin: 3px 0 7px; }
.hc-stats { font-size: 10px; color: #c4a97e; display: grid; gap: 2px; margin-bottom: 7px; }
.hc-row { display: flex; justify-content: space-between; }
.hc-row b { color: var(--cream); }
.hc-weapon { font-size: 9px; letter-spacing: 1px; color: #e8a33d; }
@media (max-width: 720px) { .hero-cards { grid-template-columns: repeat(2, 1fr); } }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.seg.seg-small { grid-template-columns: repeat(2, 1fr); max-width: 280px; }
.seg button {
  cursor: pointer; font-family: inherit; padding: 11px 8px;
  background: var(--panel2); color: #c4a97e;
  border: 3px solid #4a3320; border-right-width: 0;
  font-size: 14px; font-weight: bold; letter-spacing: 2px;
}
.seg button:last-child { border-right-width: 3px; }
.seg button span { display: block; font-size: 10px; font-weight: normal; letter-spacing: 1px; margin-top: 4px; opacity: .75; }
.seg button:hover { color: var(--cream); }
.seg button.active {
  background: var(--gold); color: #241207; border-color: var(--outline);
  box-shadow: inset 0 0 0 2px var(--outline);
}
.seg button.active span { opacity: .85; }

/* ================= 主题一（默认）：像素 RPG ================= */
body[data-theme="pixel"] {
  --gold: #ffd23f; --amber: #e8a33d; --panel: #26190f; --panel2: #2f2013;
  --brown: #6b4a2f; --cream: #f2e3c2; --red: #c0392b; --outline: #120c07;
}

/* ================= 主题二：治愈 Q 版 ================= */
body[data-theme="chibi"] {
  --gold: #ff9db8; --amber: #ffb7c9; --panel: #fff8f2; --panel2: #ffefe4;
  --brown: #e8b7a0; --cream: #7a5c50; --red: #f38ba0; --outline: #d9a08c;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
body[data-theme="chibi"] .menu-inner,
body[data-theme="chibi"] .shop-inner,
body[data-theme="chibi"] .weapon-box,
body[data-theme="chibi"] .stat-chip,
body[data-theme="chibi"] .w-card,
body[data-theme="chibi"] .ctrl,
body[data-theme="chibi"] .dash-ring,
body[data-theme="chibi"] .kf-item,
body[data-theme="chibi"] .theme-card {
  border-radius: 16px;
  box-shadow: 0 4px 14px rgba(214, 150, 130, 0.28);
}
body[data-theme="chibi"] .hp-bar,
body[data-theme="chibi"] .w-slot,
body[data-theme="chibi"] .btn,
body[data-theme="chibi"] .seg button { border-radius: 10px; }
body[data-theme="chibi"] .btn { box-shadow: 0 4px 12px rgba(214, 150, 130, 0.4); }
body[data-theme="chibi"] .btn:hover { box-shadow: 0 6px 18px rgba(214, 150, 130, 0.55); }
body[data-theme="chibi"] .title-glow {
  color: #ff8fae;
  text-shadow: 3px 3px 0 #ffd3de, 6px 6px 0 rgba(214, 150, 130, 0.3);
}
body[data-theme="chibi"] .title-glow span { color: #8fd0b0; text-shadow: 3px 3px 0 #d2f0de, 6px 6px 0 rgba(150, 190, 160, 0.3); }
body[data-theme="chibi"] .subtitle,
body[data-theme="chibi"] .menu-desc,
body[data-theme="chibi"] .setting-label { color: #9a7a6e; }
body[data-theme="chibi"] .menu-desc b { color: #ff8fae; }
body[data-theme="chibi"] .btn { color: #fff; background: #ffb7c9; }
body[data-theme="chibi"] .w-buy { color: #fff; background: #ffb7c9; box-shadow: none; border: none; border-radius: 10px; }
body[data-theme="chibi"] .w-buy.own-btn { background: #fff0f4; color: #e07a97; border: 2px solid #ffc4d4; }
body[data-theme="chibi"] .w-buy:disabled { background: #f0e4dd; color: #c4a99b; }
body[data-theme="chibi"] .seg button { border-color: #f0cdbd; }
body[data-theme="chibi"] .seg button.active { background: #ffb7c9; color: #fff; box-shadow: none; }
body[data-theme="chibi"] .theme-card { border-color: #f0cdbd; }
body[data-theme="chibi"] .theme-card.active { border-color: #ff9db8; box-shadow: 0 0 0 3px #ffd3de; }
body[data-theme="chibi"] .tc-swatches i { border-color: #d9a08c; border-radius: 50%; }
body[data-theme="chibi"] .tc-name { color: #6d4c47; }
body[data-theme="chibi"] .tc-tag,
body[data-theme="chibi"] .tc-desc { color: #b09184; }
body[data-theme="chibi"] .w-card .w-name,
body[data-theme="chibi"] .weapon-name,
body[data-theme="chibi"] .hp-label { color: #6d4c47; }
body[data-theme="chibi"] .weapon-ammo,
body[data-theme="chibi"] .dash-text,
body[data-theme="chibi"] .best-record { color: #b09184; }
body[data-theme="chibi"] .kf-item .k-name-hero { color: #ff8fae; }
body[data-theme="chibi"] .kf-item .k-name-foe { color: #8fb8d0; }
body[data-theme="chibi"] .shop-title { color: #ff8fae; text-shadow: 2px 2px 0 #ffd3de; }
body[data-theme="chibi"] .shop-title.lose { color: #f38ba0; }
body[data-theme="chibi"] #hpFill { background: repeating-linear-gradient(90deg, #ffb7c9 0 13px, #f495b3 13px 16px); }
body[data-theme="chibi"] #hpFill.low { background: repeating-linear-gradient(90deg, #f38ba0 0 13px, #dd6f8c 13px 16px); }
body[data-theme="chibi"] .dot-ally { background: #ff9db8; }
body[data-theme="chibi"] .dot-enemy { background: #8fb8d0; }
body[data-theme="chibi"] .kbd,
body[data-theme="chibi"] kbd { border-radius: 7px; }
body[data-theme="chibi"] .stat-chip b { color: #ff8fae; }
body[data-theme="chibi"] .chip-credit b { color: #f4b942; }

/* ================= 主题三：图形冒险 ================= */
body[data-theme="adventure"] {
  --gold: #ff6b35; --amber: #ffc94d; --panel: #22333f; --panel2: #2b3a4a;
  --brown: #3d5566; --cream: #f5e6c8; --red: #ff4d5e; --outline: #101820;
  font-family: "Arial", "Microsoft YaHei", sans-serif;
}
body[data-theme="adventure"] .title-glow {
  color: #ff6b35;
  text-shadow: 5px 5px 0 #3aa89b, 9px 9px 0 #101820;
  letter-spacing: 8px;
}
body[data-theme="adventure"] .title-glow span { color: #ffc94d; text-shadow: 5px 5px 0 #22333f, 9px 9px 0 #101820; }
body[data-theme="adventure"] .subtitle { color: #3aa89b; }
body[data-theme="adventure"] .menu-desc { color: #c8d8d2; }
body[data-theme="adventure"] .menu-desc b { color: #ffc94d; }
body[data-theme="adventure"] .setting-label { color: #ffc94d; }
body[data-theme="adventure"] .btn { background: #ff6b35; color: #101820; }
body[data-theme="adventure"] .btn-ghost { background: #2b3a4a; color: #c8d8d2; }
body[data-theme="adventure"] .btn-ghost:hover { border-color: #3aa89b; color: #fff; }
body[data-theme="adventure"] .w-buy { background: #ffc94d; color: #101820; }
body[data-theme="adventure"] .w-buy.own-btn { background: #2b3a4a; color: #ffc94d; border-color: #3d5566; }
body[data-theme="adventure"] .w-buy:disabled { background: #1c2833; color: #4a5c68; }
body[data-theme="adventure"] .seg button { border-color: #3d5566; background: #1c2833; color: #8ba3ad; }
body[data-theme="adventure"] .seg button.active { background: #3aa89b; color: #101820; border-color: #101820; }
body[data-theme="adventure"] .theme-card { border-color: #3d5566; background: #1c2833; }
body[data-theme="adventure"] .theme-card.active { border-color: #ff6b35; box-shadow: 0 0 0 2px #101820, 0 0 0 4px #ff6b35; }
body[data-theme="adventure"] .tc-swatches i { border-radius: 0; border-color: #101820; }
body[data-theme="adventure"] .tc-tag { color: #3aa89b; }
body[data-theme="adventure"] .tc-desc { color: #8ba3ad; }
body[data-theme="adventure"] .stat-chip b { color: #ffc94d; }
body[data-theme="adventure"] .chip-credit b { color: #ffc94d; }
body[data-theme="adventure"] .dot-ally { background: #ff6b35; }
body[data-theme="adventure"] .dot-enemy { background: #3aa89b; }
body[data-theme="adventure"] #hpFill { background: repeating-linear-gradient(90deg, #ff6b35 0 13px, #d94f1e 13px 16px); }
body[data-theme="adventure"] #hpFill.low { background: repeating-linear-gradient(90deg, #ff4d5e 0 13px, #c93a48 13px 16px); }
body[data-theme="adventure"] .kf-item .k-name-hero { color: #ff9d6b; }
body[data-theme="adventure"] .kf-item .k-name-foe { color: #6bd0c2; }
body[data-theme="adventure"] .shop-title { color: #ffc94d; text-shadow: 3px 3px 0 #101820; }
body[data-theme="adventure"] .shop-title.lose { color: #ff4d5e; }
body[data-theme="adventure"] .w-slot.active { color: #ffc94d; border-color: #ffc94d; background: #1c2833; }
body[data-theme="adventure"] .dash-ring.ready { border-color: #3aa89b; color: #6bd0c2; }
body[data-theme="adventure"] .dash-ring.ready:hover { border-color: #3aa89b; }

/* ================= 主题四：绘本物语 ================= */
body[data-theme="cozy"] {
  --gold: #e8a04c; --amber: #f4d8a8; --panel: #fbf3e4; --panel2: #f5e8d3;
  --brown: #c9a878; --cream: #7a5c44; --red: #e09a84; --outline: #d9c4a8;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
body[data-theme="cozy"] .menu-inner,
body[data-theme="cozy"] .shop-inner,
body[data-theme="cozy"] .weapon-box,
body[data-theme="cozy"] .stat-chip,
body[data-theme="cozy"] .w-card,
body[data-theme="cozy"] .ctrl,
body[data-theme="cozy"] .dash-ring,
body[data-theme="cozy"] .kf-item,
body[data-theme="cozy"] .theme-card,
body[data-theme="cozy"] .maplib,
body[data-theme="cozy"] .map-card,
body[data-theme="cozy"] .maplib-toggle,
body[data-theme="cozy"] .hero-card {
  border-radius: 12px;
  box-shadow: 0 3px 10px rgba(160,120,80,0.2);
}
body[data-theme="cozy"] .hp-bar,
body[data-theme="cozy"] .w-slot,
body[data-theme="cozy"] .btn,
body[data-theme="cozy"] .seg button { border-radius: 8px; }
body[data-theme="cozy"] .btn { color: #fff; background: #e8a04c; }
body[data-theme="cozy"] .title-glow {
  color: #e8a04c;
  text-shadow: 3px 3px 0 #f4d8a8, 6px 6px 0 rgba(200,160,100,0.3);
}
body[data-theme="cozy"] .title-glow span { color: #a8d8b0; text-shadow: 3px 3px 0 #d0e8d4, 6px 6px 0 rgba(150,190,150,0.3); }
body[data-theme="cozy"] .subtitle,
body[data-theme="cozy"] .menu-desc,
body[data-theme="cozy"] .setting-label { color: #a88a6e; }
body[data-theme="cozy"] .menu-desc b { color: #e8a04c; }
body[data-theme="cozy"] .theme-card { border-color: #e8d8c0; background: #fffaf2; }
body[data-theme="cozy"] .theme-card.active { border-color: #e8a04c; box-shadow: 0 0 0 2px #f4d8a8; }
body[data-theme="cozy"] .tc-name { color: #7a5c44; }
body[data-theme="cozy"] .tc-tag, body[data-theme="cozy"] .tc-desc { color: #b09a82; }
body[data-theme="cozy"] .seg button { border-color: #e8d8c0; background: #fffaf2; color: #a88a6e; }
body[data-theme="cozy"] .seg button.active { background: #e8a04c; color: #fff; }
body[data-theme="cozy"] .w-buy { color: #fff; background: #e8a04c; border: none; border-radius: 8px; box-shadow: none; }
body[data-theme="cozy"] .w-buy.own-btn { background: #f5e8d3; color: #e8a04c; border: 2px solid #e8d8c0; }
body[data-theme="cozy"] .w-buy:disabled { background: #e8e0d0; color: #b0a898; }
body[data-theme="cozy"] .stat-chip b { color: #e8a04c; }
body[data-theme="cozy"] .chip-credit b { color: #d9b36c; }
body[data-theme="cozy"] .dot-ally { background: #e8a04c; }
body[data-theme="cozy"] .dot-enemy { background: #a8c8e8; }
body[data-theme="cozy"] #hpFill { background: repeating-linear-gradient(90deg, #e8a04c 0 13px, #d99040 13px 16px); }
body[data-theme="cozy"] #hpFill.low { background: repeating-linear-gradient(90deg, #e09a84 0 13px, #cc8870 13px 16px); }
body[data-theme="cozy"] .kf-item .k-name-hero { color: #e8a04c; }
body[data-theme="cozy"] .kf-item .k-name-foe { color: #88a8cc; }
body[data-theme="cozy"] .shop-title { color: #e8a04c; text-shadow: 2px 2px 0 #f4d8a8; }
body[data-theme="cozy"] .shop-title.lose { color: #e09a84; }
body[data-theme="cozy"] .weapon-name, body[data-theme="cozy"] .hp-label { color: #7a5c44; }
body[data-theme="cozy"] .weapon-ammo, body[data-theme="cozy"] .dash-text, body[data-theme="cozy"] .best-record { color: #b09a82; }
body[data-theme="cozy"] .ml-current { color: #e8a04c; }
body[data-theme="cozy"] .maplib-toggle { background: #fffaf2; border-color: #e8d8c0; color: #a88a6e; }
body[data-theme="cozy"] .maplib { background: #f5e8d3; border-color: #e8d8c0; }
body[data-theme="cozy"] .map-card { background: #fffaf2; border-color: #e8d8c0; }
body[data-theme="cozy"] .map-card .mc-name { color: #7a5c44; }
body[data-theme="cozy"] .map-card .mc-desc { color: #b09a82; }
body[data-theme="cozy"] .map-card .mc-tags i { background: #f4d8a8; color: #b8863a; border-color: #e8c898; }

/* ================= 主题五：霓虹夜城 ================= */
body[data-theme="cyberpunk"] {
  --gold: #00f0ff; --amber: #ff00aa; --panel: #12102a; --panel2: #1a1638;
  --brown: #2a2a5a; --cream: #d0e8ff; --red: #ff2a6d; --outline: #05040f;
  font-family: "Courier New", "Arial", sans-serif;
}
body[data-theme="cyberpunk"] .title-glow {
  color: #00f0ff;
  text-shadow: 0 0 10px #00f0ff, 0 0 20px #00f0ff, 5px 5px 0 #ff00aa;
}
body[data-theme="cyberpunk"] .title-glow span { color: #ff00aa; text-shadow: 0 0 10px #ff00aa, 0 0 20px #ff00aa, 5px 5px 0 #00f0ff; }
body[data-theme="cyberpunk"] .subtitle { color: #8a5cf0; }
body[data-theme="cyberpunk"] .menu-desc { color: #a0a8d0; }
body[data-theme="cyberpunk"] .menu-desc b { color: #00f0ff; }
body[data-theme="cyberpunk"] .setting-label { color: #ff00aa; }
body[data-theme="cyberpunk"] .btn { background: #00f0ff; color: #05040f; }
body[data-theme="cyberpunk"] .btn-ghost { background: #1a1638; color: #a0a8d0; border-color: #2a2a5a; }
body[data-theme="cyberpunk"] .btn-ghost:hover { border-color: #ff00aa; color: #fff; }
body[data-theme="cyberpunk"] .w-buy { background: #ff00aa; color: #fff; }
body[data-theme="cyberpunk"] .w-buy.own-btn { background: #1a1638; color: #00f0ff; border-color: #2a2a5a; }
body[data-theme="cyberpunk"] .w-buy:disabled { background: #12102a; color: #4a4a7a; }
body[data-theme="cyberpunk"] .seg button { border-color: #2a2a5a; background: #12102a; color: #a0a8d0; }
body[data-theme="cyberpunk"] .seg button.active { background: #00f0ff; color: #05040f; border-color: #05040f; }
body[data-theme="cyberpunk"] .theme-card { border-color: #2a2a5a; background: #12102a; }
body[data-theme="cyberpunk"] .theme-card.active { border-color: #00f0ff; box-shadow: 0 0 0 2px #05040f, 0 0 0 4px #00f0ff; }
body[data-theme="cyberpunk"] .tc-name { color: #d0e8ff; }
body[data-theme="cyberpunk"] .tc-tag, body[data-theme="cyberpunk"] .tc-desc { color: #8a5cf0; }
body[data-theme="cyberpunk"] .stat-chip b { color: #00f0ff; }
body[data-theme="cyberpunk"] .chip-credit b { color: #ff00aa; }
body[data-theme="cyberpunk"] .dot-ally { background: #00f0ff; }
body[data-theme="cyberpunk"] .dot-enemy { background: #ff00aa; }
body[data-theme="cyberpunk"] #hpFill { background: repeating-linear-gradient(90deg, #00f0ff 0 13px, #00a0b0 13px 16px); }
body[data-theme="cyberpunk"] #hpFill.low { background: repeating-linear-gradient(90deg, #ff2a6d 0 13px, #c41a50 13px 16px); }
body[data-theme="cyberpunk"] .kf-item .k-name-hero { color: #00f0ff; }
body[data-theme="cyberpunk"] .kf-item .k-name-foe { color: #ff00aa; }
body[data-theme="cyberpunk"] .shop-title { color: #00f0ff; text-shadow: 0 0 8px #00f0ff; }
body[data-theme="cyberpunk"] .shop-title.lose { color: #ff2a6d; }
body[data-theme="cyberpunk"] .weapon-name, body[data-theme="cyberpunk"] .hp-label { color: #d0e8ff; }
body[data-theme="cyberpunk"] .weapon-ammo, body[data-theme="cyberpunk"] .dash-text, body[data-theme="cyberpunk"] .best-record { color: #8a5cf0; }
body[data-theme="cyberpunk"] .ml-current { color: #00f0ff; }
body[data-theme="cyberpunk"] .maplib-toggle { background: #1a1638; border-color: #2a2a5a; color: #a0a8d0; }
body[data-theme="cyberpunk"] .maplib { background: #12102a; border-color: #2a2a5a; }
body[data-theme="cyberpunk"] .map-card { background: #1a1638; border-color: #2a2a5a; }
body[data-theme="cyberpunk"] .map-card .mc-name { color: #d0e8ff; }
body[data-theme="cyberpunk"] .map-card .mc-desc { color: #8a5cf0; }
body[data-theme="cyberpunk"] .map-card .mc-tags i { background: rgba(0,240,255,0.12); color: #00f0ff; border-color: rgba(0,240,255,0.35); }
body[data-theme="cyberpunk"] .hero-card { background: #1a1638; border-color: #2a2a5a; }
body[data-theme="cyberpunk"] .hero-card.active { border-color: #00f0ff; box-shadow: 0 0 0 2px #05040f, 0 0 0 4px #00f0ff; }
body[data-theme="cyberpunk"] .hc-name { color: #d0e8ff; }
body[data-theme="cyberpunk"] .hc-title, body[data-theme="cyberpunk"] .hc-stats { color: #8a5cf0; }
body[data-theme="cyberpunk"] .hc-weapon { color: #ff00aa; }
body[data-theme="cyberpunk"] .hc-avatar { background: #12102a; border-color: #2a2a5a; }

/* ================= 主题六：樱色魔法 ================= */
body[data-theme="anime"] {
  --gold: #ff6b9d; --amber: #ffb7c9; --panel: #fff0f6; --panel2: #ffe4ef;
  --brown: #f0b8d0; --cream: #5c4a6e; --red: #f38ba0; --outline: #e8b8d0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
body[data-theme="anime"] .menu-inner,
body[data-theme="anime"] .shop-inner,
body[data-theme="anime"] .weapon-box,
body[data-theme="anime"] .stat-chip,
body[data-theme="anime"] .w-card,
body[data-theme="anime"] .ctrl,
body[data-theme="anime"] .dash-ring,
body[data-theme="anime"] .kf-item,
body[data-theme="anime"] .theme-card,
body[data-theme="anime"] .maplib,
body[data-theme="anime"] .map-card,
body[data-theme="anime"] .maplib-toggle,
body[data-theme="anime"] .hero-card {
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(255,107,157,0.15);
}
body[data-theme="anime"] .hp-bar,
body[data-theme="anime"] .w-slot,
body[data-theme="anime"] .btn,
body[data-theme="anime"] .seg button { border-radius: 6px; }
body[data-theme="anime"] .btn { color: #fff; background: #ff6b9d; }
body[data-theme="anime"] .title-glow {
  color: #ff6b9d;
  text-shadow: 3px 3px 0 #ffd3de, 6px 6px 0 rgba(255,107,157,0.2);
}
body[data-theme="anime"] .title-glow span { color: #6bd0ff; text-shadow: 3px 3px 0 #d0e8ff, 6px 6px 0 rgba(107,208,255,0.2); }
body[data-theme="anime"] .subtitle { color: #c86bff; }
body[data-theme="anime"] .menu-desc { color: #9a7a8e; }
body[data-theme="anime"] .menu-desc b { color: #ff6b9d; }
body[data-theme="anime"] .setting-label { color: #c86bff; }
body[data-theme="anime"] .theme-card { border-color: #f0b8d0; background: #fff8fc; }
body[data-theme="anime"] .theme-card.active { border-color: #ff6b9d; box-shadow: 0 0 0 2px #ffd3de; }
body[data-theme="anime"] .tc-name { color: #5c4a6e; }
body[data-theme="anime"] .tc-tag, body[data-theme="anime"] .tc-desc { color: #b091a4; }
body[data-theme="anime"] .seg button { border-color: #f0b8d0; background: #fff8fc; color: #9a7a8e; }
body[data-theme="anime"] .seg button.active { background: #ff6b9d; color: #fff; }
body[data-theme="anime"] .w-buy { color: #fff; background: #ff6b9d; border: none; border-radius: 6px; box-shadow: none; }
body[data-theme="anime"] .w-buy.own-btn { background: #ffe4ef; color: #ff6b9d; border: 2px solid #f0b8d0; }
body[data-theme="anime"] .w-buy:disabled { background: #f0e4ec; color: #c4a9b8; }
body[data-theme="anime"] .stat-chip b { color: #ff6b9d; }
body[data-theme="anime"] .chip-credit b { color: #ffd76b; }
body[data-theme="anime"] .dot-ally { background: #ff6b9d; }
body[data-theme="anime"] .dot-enemy { background: #6bd0ff; }
body[data-theme="anime"] #hpFill { background: repeating-linear-gradient(90deg, #ff6b9d 0 13px, #e05a88 13px 16px); }
body[data-theme="anime"] #hpFill.low { background: repeating-linear-gradient(90deg, #f38ba0 0 13px, #dd6f8c 13px 16px); }
body[data-theme="anime"] .kf-item .k-name-hero { color: #ff6b9d; }
body[data-theme="anime"] .kf-item .k-name-foe { color: #6bd0ff; }
body[data-theme="anime"] .shop-title { color: #ff6b9d; text-shadow: 2px 2px 0 #ffd3de; }
body[data-theme="anime"] .shop-title.lose { color: #f38ba0; }
body[data-theme="anime"] .weapon-name, body[data-theme="anime"] .hp-label { color: #5c4a6e; }
body[data-theme="anime"] .weapon-ammo, body[data-theme="anime"] .dash-text, body[data-theme="anime"] .best-record { color: #b091a4; }
body[data-theme="anime"] .ml-current { color: #ff6b9d; }
body[data-theme="anime"] .maplib-toggle { background: #fff8fc; border-color: #f0b8d0; color: #9a7a8e; }
body[data-theme="anime"] .maplib { background: #ffe4ef; border-color: #f0b8d0; }
body[data-theme="anime"] .map-card { background: #fff8fc; border-color: #f0b8d0; }
body[data-theme="anime"] .map-card .mc-name { color: #5c4a6e; }
body[data-theme="anime"] .map-card .mc-desc { color: #b091a4; }
body[data-theme="anime"] .map-card .mc-tags i { background: #ffd3e0; color: #e06a98; border-color: #f0b8d0; }
body[data-theme="anime"] .hero-card { background: #fff8fc; border-color: #f0b8d0; }
body[data-theme="anime"] .hero-card.active { border-color: #ff6b9d; box-shadow: 0 0 0 2px #ffd3de; }
body[data-theme="anime"] .hc-name { color: #5c4a6e; }
body[data-theme="anime"] .hc-title, body[data-theme="anime"] .hc-stats { color: #b091a4; }
body[data-theme="anime"] .hc-weapon { color: #c86bff; }
body[data-theme="anime"] .hc-avatar { background: #fff0f6; border-color: #f0b8d0; }

/* ================= 主题七：荒野纪实 ================= */
body[data-theme="real"] {
  --gold: #d9b36c; --amber: #c9a86a; --panel: #24221e; --panel2: #2e2b26;
  --brown: #4a443a; --cream: #e8e2d4; --red: #a85a4a; --outline: #12100d;
  font-family: "Georgia", "Times New Roman", serif;
}
body[data-theme="real"] .title-glow {
  color: #d9b36c;
  text-shadow: 3px 3px 0 #5a4a3a, 6px 6px 0 #12100d;
}
body[data-theme="real"] .title-glow span { color: #8a9a6a; text-shadow: 3px 3px 0 #4a443a, 6px 6px 0 #12100d; }
body[data-theme="real"] .subtitle { color: #8a9a6a; }
body[data-theme="real"] .menu-desc { color: #b0a898; }
body[data-theme="real"] .menu-desc b { color: #d9b36c; }
body[data-theme="real"] .setting-label { color: #8a9a6a; }
body[data-theme="real"] .btn { background: #d9b36c; color: #24221e; }
body[data-theme="real"] .btn-ghost { background: #2e2b26; color: #b0a898; border-color: #4a443a; }
body[data-theme="real"] .btn-ghost:hover { border-color: #a85a4a; color: #fff; }
body[data-theme="real"] .w-buy { background: #d9b36c; color: #24221e; }
body[data-theme="real"] .w-buy.own-btn { background: #2e2b26; color: #d9b36c; border-color: #4a443a; }
body[data-theme="real"] .w-buy:disabled { background: #24221e; color: #5a544a; }
body[data-theme="real"] .seg button { border-color: #4a443a; background: #24221e; color: #b0a898; }
body[data-theme="real"] .seg button.active { background: #d9b36c; color: #24221e; border-color: #12100d; }
body[data-theme="real"] .theme-card { border-color: #4a443a; background: #2e2b26; }
body[data-theme="real"] .theme-card.active { border-color: #d9b36c; box-shadow: 0 0 0 2px #12100d, 0 0 0 4px #d9b36c; }
body[data-theme="real"] .tc-name { color: #e8e2d4; }
body[data-theme="real"] .tc-tag, body[data-theme="real"] .tc-desc { color: #8a7a66; }
body[data-theme="real"] .stat-chip b { color: #d9b36c; }
body[data-theme="real"] .chip-credit b { color: #d9b36c; }
body[data-theme="real"] .dot-ally { background: #d9b36c; }
body[data-theme="real"] .dot-enemy { background: #a85a4a; }
body[data-theme="real"] #hpFill { background: repeating-linear-gradient(90deg, #d9b36c 0 13px, #b89a4a 13px 16px); }
body[data-theme="real"] #hpFill.low { background: repeating-linear-gradient(90deg, #a85a4a 0 13px, #8a4a3a 13px 16px); }
body[data-theme="real"] .kf-item .k-name-hero { color: #d9b36c; }
body[data-theme="real"] .kf-item .k-name-foe { color: #a88a7a; }
body[data-theme="real"] .shop-title { color: #d9b36c; text-shadow: 2px 2px 0 #5a4a3a; }
body[data-theme="real"] .shop-title.lose { color: #a85a4a; }
body[data-theme="real"] .weapon-name, body[data-theme="real"] .hp-label { color: #e8e2d4; }
body[data-theme="real"] .weapon-ammo, body[data-theme="real"] .dash-text, body[data-theme="real"] .best-record { color: #8a7a66; }
body[data-theme="real"] .ml-current { color: #d9b36c; }
body[data-theme="real"] .maplib-toggle { background: #2e2b26; border-color: #4a443a; color: #b0a898; }
body[data-theme="real"] .maplib { background: #24221e; border-color: #4a443a; }
body[data-theme="real"] .map-card { background: #2e2b26; border-color: #4a443a; }
body[data-theme="real"] .map-card .mc-name { color: #e8e2d4; }
body[data-theme="real"] .map-card .mc-desc { color: #8a7a66; }
body[data-theme="real"] .map-card .mc-tags i { background: rgba(217,179,108,0.12); color: #d9b36c; border-color: rgba(217,179,108,0.35); }
body[data-theme="real"] .hero-card { background: #2e2b26; border-color: #4a443a; }
body[data-theme="real"] .hero-card.active { border-color: #d9b36c; box-shadow: 0 0 0 2px #12100d, 0 0 0 4px #d9b36c; }
body[data-theme="real"] .hc-name { color: #e8e2d4; }
body[data-theme="real"] .hc-title, body[data-theme="real"] .hc-stats { color: #8a7a66; }
body[data-theme="real"] .hc-weapon { color: #d9b36c; }
body[data-theme="real"] .hc-avatar { background: #24221e; border-color: #4a443a; }

/* ================= 主题八：浮世绘卷 ================= */
body[data-theme="ukiyo"] {
  --gold: #d94f3d; --amber: #e8c86a; --panel: #f2e8d5; --panel2: #e8dcc2;
  --brown: #b8a888; --cream: #2b3a55; --red: #d94f3d; --outline: #1a2332;
  font-family: "Georgia", "Times New Roman", serif;
}
body[data-theme="ukiyo"] .title-glow {
  color: #d94f3d;
  text-shadow: 3px 3px 0 #1a3a5c, 6px 6px 0 rgba(26,58,92,0.2);
}
body[data-theme="ukiyo"] .title-glow span { color: #1a3a5c; text-shadow: 3px 3px 0 #d94f3d, 6px 6px 0 rgba(217,79,61,0.2); }
body[data-theme="ukiyo"] .subtitle { color: #1a3a5c; }
body[data-theme="ukiyo"] .menu-desc { color: #5a6a7a; }
body[data-theme="ukiyo"] .menu-desc b { color: #d94f3d; }
body[data-theme="ukiyo"] .setting-label { color: #1a3a5c; }
body[data-theme="ukiyo"] .btn { background: #d94f3d; color: #f2e8d5; }
body[data-theme="ukiyo"] .btn-ghost { background: #e8dcc2; color: #5a6a7a; border-color: #b8a888; }
body[data-theme="ukiyo"] .btn-ghost:hover { border-color: #d94f3d; color: #1a2332; }
body[data-theme="ukiyo"] .w-buy { background: #d94f3d; color: #f2e8d5; }

/* ================= 触屏控件（仅 body.touch 显示） ================= */
#gameCanvas { touch-action: none; }

.t-ctrl { display: none; }

/* 虚拟摇杆（位置由 JS 动态设置，仅作视觉反馈，不拦截触摸） */
#joyBase {
  position: fixed; left: 0; top: 0; width: 120px; height: 120px;
  transform: translate(-50%, -50%);
  border: 3px solid var(--brown); border-radius: 50%;
  background: rgba(0, 0, 0, 0.25);
  box-shadow: 0 0 0 3px var(--outline);
  z-index: 11; pointer-events: none;
}
#joyKnob {
  position: absolute; left: 50%; top: 50%; width: 48px; height: 48px;
  margin: -24px 0 0 -24px;
  border: 3px solid var(--outline); border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 2px var(--brown);
}

/* 触屏按钮：冲刺 / 暂停 / 换弹 / 射击 / 全屏 */
body.touch #tDash, body.touch #tPause, body.touch #tReload, body.touch #tShoot, body.touch #tFullscreen { display: grid; pointer-events: auto; }
#tDash, #tPause, #tShoot, #tFullscreen {
  position: fixed; z-index: 12;
  place-items: center; text-align: center;
  font-weight: bold; color: var(--cream);
  background: var(--panel);
  border: 3px solid var(--brown);
  box-shadow: 0 0 0 3px var(--outline);
  touch-action: none;
}
#tShoot {
  right: calc(104px + env(safe-area-inset-right)); bottom: calc(170px + env(safe-area-inset-bottom)); width: 68px; height: 68px;
  border-radius: 50%; font-size: 14px; letter-spacing: 2px;
  background: radial-gradient(circle at 35% 30%, #ff7a59, #c0392b);
  border-color: #7a1f12; color: #fff;
}
#tShoot:active { transform: scale(0.92); }
#tDash {
  right: calc(24px + env(safe-area-inset-right)); bottom: calc(170px + env(safe-area-inset-bottom)); width: 68px; height: 68px;
  border-radius: 50%; font-size: 14px; letter-spacing: 2px;
}
#tDash.ready { border-color: var(--gold); color: var(--gold); }
#tPause {
  top: calc(14px + env(safe-area-inset-top)); right: calc(16px + env(safe-area-inset-right)); width: 44px; height: 44px;
  font-size: 14px; letter-spacing: 2px;
}
/* 全屏键：紧邻暂停键左侧，全屏中金色高亮 */
#tFullscreen {
  top: calc(14px + env(safe-area-inset-top)); right: calc(68px + env(safe-area-inset-right)); width: 44px; height: 44px;
  font-size: 19px; line-height: 1;
}
#tFullscreen.on { border-color: var(--gold); color: var(--gold); }
#tFullscreen:active { transform: scale(0.92); }

/* 触屏下武器槽可点触切换（#hud 整体 pointer-events:none，单独开洞） */
body.touch .weapon-slots { pointer-events: auto; }
body.touch .weapon-slots .w-slot { width: 40px; height: 40px; font-size: 17px; }

/* 触屏横屏：武器栏改为横向单行紧凑条，减少遮挡视野 */
body.touch-landscape .hud-br { bottom: calc(10px + env(safe-area-inset-bottom)); right: calc(10px + env(safe-area-inset-right)); }
body.touch-landscape .weapon-box {
  min-width: 0; padding: 4px 8px;
  border-width: 2px; box-shadow: 0 0 0 2px var(--outline);
  background: rgba(28, 17, 9, 0.82);
  display: flex; align-items: center; gap: 6px;
}
body.touch-landscape .weapon-row { margin-bottom: 0; gap: 4px; }
body.touch-landscape .weapon-slots { gap: 4px; margin-bottom: 0; }
body.touch-landscape .weapon-slots .w-slot { width: 30px; height: 30px; font-size: 14px; }
body.touch-landscape .weapon-name { font-size: 11px; letter-spacing: 0; white-space: nowrap; }
body.touch-landscape .weapon-ammo { font-size: 10px; margin-top: 0; white-space: nowrap; opacity: 0.85; }
body.touch-landscape #tReload { width: 26px; height: 26px; font-size: 11px; }

/* 触屏下隐藏键盘冲刺提示（由 #tDash 替代） */
body.touch .dash-wrap { display: none; }
/* 触屏下血条上移，给左摇杆让位 */
body.touch .hud-bl { bottom: calc(150px + env(safe-area-inset-bottom)); }

/* ================= 移动端 HUD 优化（触屏设备，窄屏或矮屏横屏） ================= */
@media (max-width: 960px), (max-height: 540px) {
  body.touch .hud-top { gap: 6px; top: calc(10px + env(safe-area-inset-top)); }
  body.touch .stat-chip {
    padding: 4px 10px; font-size: 11px; letter-spacing: 1px;
    border-width: 2px; box-shadow: 0 0 0 2px var(--outline);
  }
  body.touch .stat-chip b { font-size: 12px; }
  body.touch .chip-mid { gap: 8px; }
  body.touch .alive-count { font-size: 13px; gap: 4px; }
  body.touch .dot { width: 7px; height: 7px; border-width: 2px; }

  /* 小地图：缩小并上移，避免挤占中央视野 */
  body.touch #minimap {
    transform: scale(0.58); transform-origin: top left;
    top: calc(10px + env(safe-area-inset-top)); left: calc(16px + env(safe-area-inset-left));
    border-width: 2px; box-shadow: 0 0 0 2px var(--outline);
  }

  /* 血条：收窄、字号缩小、血条变细 */
  body.touch .hp-wrap { width: 180px; }
  body.touch .hp-label { font-size: 18px; text-shadow: 2px 2px 0 var(--outline); }
  body.touch .hp-label small { font-size: 10px; margin-left: 3px; }
  body.touch .hp-bar { height: 12px; margin-top: 4px; border-width: 2px; box-shadow: 0 0 0 2px var(--brown); }

  /* 武器箱：手机端已由 touch-landscape 规则统一处理 */

  /* 击杀播报：更紧凑，避免遮挡视野 */
  body.touch #killfeed { top: calc(52px + env(safe-area-inset-top)); right: calc(16px + env(safe-area-inset-right)); gap: 4px; }
  body.touch .kf-item { padding: 3px 8px; font-size: 10px; letter-spacing: 0; border-width: 2px; box-shadow: 0 0 0 2px var(--outline); }

  /* 横幅：字号与字距适配小屏 */
  body.touch #banner { font-size: 26px; letter-spacing: 5px; }
  body.touch #banner .banner-sub { font-size: 11px; letter-spacing: 2px; margin-top: 5px; }

  /* 触屏控件尺寸微调 */
  body.touch #tDash { width: 60px; height: 60px; font-size: 12px; letter-spacing: 1px; bottom: calc(150px + env(safe-area-inset-bottom)); }
  body.touch #tShoot { width: 60px; height: 60px; font-size: 12px; letter-spacing: 1px; right: calc(92px + env(safe-area-inset-right)); bottom: calc(150px + env(safe-area-inset-bottom)); }
  body.touch #tPause { width: 38px; height: 38px; font-size: 12px; top: calc(10px + env(safe-area-inset-top)); right: calc(14px + env(safe-area-inset-right)); }
  body.touch #tFullscreen { width: 38px; height: 38px; font-size: 16px; top: calc(10px + env(safe-area-inset-top)); right: calc(60px + env(safe-area-inset-right)); }
  body.touch #tReload { width: 38px; height: 38px; font-size: 15px; }
}
/* ================= 手机短横屏：信息框等比缩放（JS 按有效横屏高度分级）
   仅主菜单使用 zoom；武器工坊不缩放——保证安卓物理横屏与 iPhone 竖持旋转态尺寸一致 ================= */
body.touch-landscape .menu-inner { zoom: 0.9; }
body.touch-landscape.tl-sm .menu-inner { zoom: 0.85; }
body.touch-landscape.tl-xs .menu-inner { zoom: 0.8; }

/* 弹层居中改由容器 safe center 负责：内容比视口高时回退到起始对齐，
   避免 iOS 上 margin:auto + flex 溢出时顶部被裁且无法滚动到 */
body.touch-landscape .overlay {
  justify-content: safe center;
  align-items: safe center;
  /* iPhone 物理横持：刘海/圆角在左右两侧 */
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
body.touch-landscape .menu-inner,
body.touch-landscape .shop-inner { margin: 0; }
/* iPhone 竖持旋转态：物理顶部刘海转到容器左侧、底部 Home 指示条转到右侧 */
body.force-landscape .overlay {
  padding-left: env(safe-area-inset-top);
  padding-right: env(safe-area-inset-bottom);
}

/* ========== 手机短横屏：主菜单网格（由原 3~4 屏滚动压缩为约 1 屏；仅限 #menu，暂停面板不受影响） ========== */
body.touch-landscape #menu .menu-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  column-gap: 22px; row-gap: 0;
  align-content: start;
  width: 100%; max-width: 920px;
  grid-template-areas:
    "title title"
    "sub   sub"
    "desc  desc"
    "hero  hero"
    "diff  music"
    "theme start"
    "map   rec";
}
body.touch-landscape #menuTitle { grid-area: title; text-align: center; font-size: 52px; }
body.touch-landscape #menuSubtitle { grid-area: sub; text-align: center; margin-top: 8px; }
body.touch-landscape .menu-desc { grid-area: desc; margin: 10px 0; text-align: center; line-height: 1.7; }
body.touch-landscape .sr-hero { grid-area: hero; margin-top: 10px; }
body.touch-landscape .sr-diff { grid-area: diff; margin-top: 10px; }
body.touch-landscape .sr-theme { grid-area: theme; margin-top: 10px; }
body.touch-landscape .sr-map { grid-area: map; margin-top: 10px; }
body.touch-landscape .sr-music { grid-area: music; margin-top: 10px; }
body.touch-landscape #btnStart { grid-area: start; align-self: center; margin-top: 10px; min-width: 200px; padding: 12px 30px; font-size: 15px; }
body.touch-landscape .best-record { grid-area: rec; align-self: center; margin-top: 10px; text-align: center; font-size: 11px; }

/* 设置行统一收紧 */
body.touch-landscape .setting-label { margin-bottom: 6px; }
/* 触屏上键盘操作提示无用，隐藏节省空间 */
body.touch-landscape .controls-grid { display: none; }

/* 英雄卡：左宽栏内单排 4 张（手机宽约 500+ 排得下），比 2×2 节省一整行高度 */
body.touch-landscape .hero-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
body.touch-landscape .hero-card { padding: 6px 5px 8px; }
body.touch-landscape .hc-avatar { width: 36px; height: 36px; margin-bottom: 4px; }
body.touch-landscape .hc-title { margin: 2px 0 4px; font-size: 8px; }
body.touch-landscape .hc-stats {
  display: flex; justify-content: space-between; gap: 2px;
  margin-bottom: 4px; font-size: 10px;
}
body.touch-landscape .hc-row { display: inline; }
body.touch-landscape .hc-row span { display: none; }
body.touch-landscape .hc-name { font-size: 12px; }
body.touch-landscape .hc-weapon { font-size: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

/* 展开式图库：2 列、紧凑内边距 */
body.touch-landscape .themelib,
body.touch-landscape .maplib { grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 9px; }
body.touch-landscape .map-card { padding: 7px; }
body.touch-landscape .map-card .mc-name { font-size: 12px; margin-top: 5px; }
body.touch-landscape .map-card .mc-desc { margin-top: 4px; line-height: 1.4; }
body.touch-landscape .map-card canvas { height: auto; }
body.touch-landscape .theme-card { padding: 10px 8px; }
body.touch-landscape .theme-card .tc-swatches { margin-bottom: 6px; }
body.touch-landscape .theme-card .tc-name { font-size: 13px; }
body.touch-landscape .theme-card .tc-desc { margin-top: 5px; }

/* 难度/音乐分段控件：紧凑，手机端隐藏难度辅助说明（选项名已表意） */
body.touch-landscape .seg button { padding: 8px 6px; font-size: 13px; }
body.touch-landscape .seg button span { display: none; }
body.touch-landscape .seg.seg-small { max-width: 100%; }

/* ========== 手机短横屏：回合结束武器工坊（5 卡一排，弹性内布局，一屏完成） ========== */
/* 宽度用百分比而非 vw：竖持旋转态下 vw 仍相对物理视口会把商店压窄，% 相对 overlay（即旋转容器） */
body.touch-landscape .shop-inner { width: min(940px, 97%); padding: 14px 16px; }
body.touch-landscape .shop-header { margin-bottom: 10px; align-items: center; }
body.touch-landscape .shop-title { font-size: 24px; letter-spacing: 4px; }
body.touch-landscape .shop-credit { font-size: 13px; letter-spacing: 1px; }
body.touch-landscape .shop-credit b { font-size: 19px; }

body.touch-landscape .shop-weapons {
  grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px;
}
/* 卡片改为纵向弹性布局：描述区自动伸缩，属性行与购买按钮在 5 张卡片间严格对齐 */
body.touch-landscape .w-card { padding: 10px 8px; display: flex; flex-direction: column; }
body.touch-landscape .w-card .w-icon { font-size: 24px; line-height: 1.1; margin-bottom: 4px; }
body.touch-landscape .w-card .w-name { font-size: 14px; }
body.touch-landscape .w-card .w-desc {
  min-height: 0; flex: 1 0 auto;
  margin: 5px 0 8px; line-height: 1.5; font-size: 10px;
}
/* 属性三项等距排开不换行，结构清晰 */
body.touch-landscape .w-card .w-stats {
  flex-wrap: nowrap; justify-content: space-between; gap: 3px;
  margin-bottom: 8px; font-size: 9px;
}
body.touch-landscape .w-card .w-stats span { white-space: nowrap; }
body.touch-landscape .w-card .w-buy { padding: 9px 3px; font-size: 12px; letter-spacing: 0; }
body.touch-landscape #btnNextRound {
  width: 100%; margin-top: 10px; padding: 11px; font-size: 16px; letter-spacing: 6px;
}

/* 浅底卡片主题：默认描述文字（金棕色）在浅色上发灰，改用各主题色系保证可读 */
body.touch-landscape[data-theme="chibi"] .w-card .w-desc { color: #b0877c; }
body.touch-landscape[data-theme="cozy"] .w-card .w-desc { color: #ad8255; }
body.touch-landscape[data-theme="anime"] .w-card .w-desc { color: #bc6f90; }
body.touch-landscape[data-theme="ukiyo"] .w-card .w-desc { color: #8c6a4f; }

/* ========== 移动端细滚动条（覆盖各主题色调由下方主题块微调） ========== */
body.touch-landscape .overlay::-webkit-scrollbar { width: 5px; }
body.touch-landscape .overlay::-webkit-scrollbar-thumb { background: rgba(255,210,63,0.4); border-radius: 3px; }
body.touch-landscape .overlay::-webkit-scrollbar-track { background: transparent; }

/* ========== 各主题：短横屏细节微调 ========== */
/* 像素/冒险/赛博/纪实（深底）滚动条沿用金色 */
body.touch-landscape[data-theme="adventure"] .overlay::-webkit-scrollbar-thumb { background: rgba(255,201,77,0.4); }
body.touch-landscape[data-theme="cyberpunk"] .overlay::-webkit-scrollbar-thumb { background: rgba(0,240,255,0.35); }
body.touch-landscape[data-theme="real"] .overlay::-webkit-scrollbar-thumb { background: rgba(217,179,108,0.4); }
/* 浅底主题：滚动条用主题主色，避免金色在浅色上发灰 */
body.touch-landscape[data-theme="chibi"] .overlay::-webkit-scrollbar-thumb { background: rgba(255,157,184,0.55); }
body.touch-landscape[data-theme="cozy"] .overlay::-webkit-scrollbar-thumb { background: rgba(232,160,76,0.5); }
body.touch-landscape[data-theme="anime"] .overlay::-webkit-scrollbar-thumb { background: rgba(255,107,157,0.5); }
body.touch-landscape[data-theme="ukiyo"] .overlay::-webkit-scrollbar-thumb { background: rgba(217,79,61,0.45); }

/* 赛博朋克：主菜单标题辉光在双栏小尺寸下收敛，避免光晕糊到相邻元素（仅限 #menuTitle，暂停标题保持主题原样） */
body.touch-landscape[data-theme="cyberpunk"] #menuTitle {
  text-shadow: 0 0 8px #00f0ff, 4px 4px 0 #ff00aa;
}
body.touch-landscape[data-theme="cyberpunk"] #menuTitle span {
  text-shadow: 0 0 8px #ff00aa, 4px 4px 0 #00f0xff;
}
/* 冒险主题主菜单标题字距大，窄栏下收敛防溢出（仅限 #menuTitle） */
body.touch-landscape[data-theme="adventure"] #menuTitle { letter-spacing: 4px; }

body[data-theme="ukiyo"] .w-buy.own-btn { background: #e8dcc2; color: #d94f3d; border-color: #b8a888; }
body[data-theme="ukiyo"] .w-buy:disabled { background: #d0c8b8; color: #9a8a7a; }
body[data-theme="ukiyo"] .seg button { border-color: #b8a888; background: #f2e8d5; color: #5a6a7a; }
body[data-theme="ukiyo"] .seg button.active { background: #d94f3d; color: #f2e8d5; border-color: #1a2332; }
body[data-theme="ukiyo"] .theme-card { border-color: #b8a888; background: #f2e8d5; }

/* ================= 强制横屏（触屏竖屏时 CSS 旋转容器） ================= */
#rotate-wrap { position: fixed; inset: 0; }

/* 竖屏：容器宽高互换并顺时针旋转 90° */
body.force-landscape #rotate-wrap {
  left: 50%; top: 50%;
  width: 100vh; height: 100vw;
  transform: translate(-50%, -50%) rotate(90deg);
  overflow: hidden;
}
/* 动态视口单位：避免 iOS 地址栏收缩跳动 */
@supports (width: 100dvh) {
  body.force-landscape #rotate-wrap { width: 100dvh; height: 100dvw; }
}

/* 旋转容器内 fixed 元素必须改为 absolute，与容器共享同一坐标系 */
body.force-landscape #gameCanvas,
body.force-landscape .overlay,
body.force-landscape #hud,
body.force-landscape #joyBase,
body.force-landscape #tDash,
body.force-landscape #tShoot,
body.force-landscape #tFullscreen,
body.force-landscape #tPause,
body.force-landscape #audioHint { position: absolute; }
body[data-theme="ukiyo"] .theme-card.active { border-color: #d94f3d; box-shadow: 0 0 0 2px #1a2332, 0 0 0 4px #d94f3d; }
body[data-theme="ukiyo"] .tc-name { color: #2b3a55; }
body[data-theme="ukiyo"] .tc-tag, body[data-theme="ukiyo"] .tc-desc { color: #8a7a66; }
body[data-theme="ukiyo"] .stat-chip b { color: #d94f3d; }
body[data-theme="ukiyo"] .chip-credit b { color: #d94f3d; }
body[data-theme="ukiyo"] .dot-ally { background: #d94f3d; }
body[data-theme="ukiyo"] .dot-enemy { background: #1a3a5c; }
body[data-theme="ukiyo"] #hpFill { background: repeating-linear-gradient(90deg, #d94f3d 0 13px, #b83a28 13px 16px); }
body[data-theme="ukiyo"] #hpFill.low { background: repeating-linear-gradient(90deg, #a83a28 0 13px, #8a2a1a 13px 16px); }
body[data-theme="ukiyo"] .kf-item .k-name-hero { color: #d94f3d; }
body[data-theme="ukiyo"] .kf-item .k-name-foe { color: #1a3a5c; }
body[data-theme="ukiyo"] .shop-title { color: #d94f3d; text-shadow: 2px 2px 0 #1a3a5c; }
body[data-theme="ukiyo"] .shop-title.lose { color: #a83a28; }
body[data-theme="ukiyo"] .weapon-name, body[data-theme="ukiyo"] .hp-label { color: #2b3a55; }
body[data-theme="ukiyo"] .weapon-ammo, body[data-theme="ukiyo"] .dash-text, body[data-theme="ukiyo"] .best-record { color: #8a7a66; }
body[data-theme="ukiyo"] .ml-current { color: #d94f3d; }
body[data-theme="ukiyo"] .maplib-toggle { background: #e8dcc2; border-color: #b8a888; color: #5a6a7a; }
body[data-theme="ukiyo"] .maplib { background: #f2e8d5; border-color: #b8a888; }
body[data-theme="ukiyo"] .map-card { background: #e8dcc2; border-color: #b8a888; }
body[data-theme="ukiyo"] .map-card .mc-name { color: #2b3a55; }
body[data-theme="ukiyo"] .map-card .mc-desc { color: #8a7a66; }
body[data-theme="ukiyo"] .map-card .mc-tags i { background: rgba(217,79,61,0.12); color: #d94f3d; border-color: rgba(217,79,61,0.35); }
body[data-theme="ukiyo"] .hero-card { background: #e8dcc2; border-color: #b8a888; }
body[data-theme="ukiyo"] .hero-card.active { border-color: #d94f3d; box-shadow: 0 0 0 2px #1a2332, 0 0 0 4px #d94f3d; }
body[data-theme="ukiyo"] .hc-name { color: #2b3a55; }
body[data-theme="ukiyo"] .hc-title, body[data-theme="ukiyo"] .hc-stats { color: #8a7a66; }
body[data-theme="ukiyo"] .hc-weapon { color: #d94f3d; }
body[data-theme="ukiyo"] .hc-avatar { background: #f2e8d5; border-color: #b8a888; }

