* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
}

body {
  background: #1a1a2e;
  font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
  overflow: hidden;
  user-select: none;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  image-rendering: pixelated;
}

/* HUD */
#hud {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: calc(12px + env(safe-area-inset-left, 0px));
  right: calc(12px + env(safe-area-inset-right, 0px));
  pointer-events: none;
  z-index: 10;
}

.hud-row {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
}

.stat-bar {
  position: relative;
  height: 24px;
  border: 2px solid #333;
  background: rgba(0, 0, 0, 0.6);
  min-width: 200px;
  flex: 1;
  max-width: 300px;
}

.bar-fill {
  height: 100%;
  transition: width 0.2s;
}

.hp-bar .bar-fill {
  background: linear-gradient(180deg, #ff4444, #cc0000);
  width: 100%;
}

.xp-bar .bar-fill {
  background: linear-gradient(180deg, #44ff44, #00aa00);
  width: 0%;
}

.stat-bar span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  color: #fff;
  text-shadow: 1px 1px 2px #000;
}

.hud-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.stat-chip {
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid #555;
  padding: 3px 8px;
  font-size: 11px;
  color: #ddd;
  border-radius: 2px;
}

.skill-bar {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: flex-end;
  gap: 6px;
  max-width: min(96vw, 640px);
  z-index: 40;
  pointer-events: none;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.28);
  border-radius: 12px;
}
.skill-bar.hidden { display: none; }
.skill-chip {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 52px;
  min-width: 52px;
  background: rgba(20, 12, 40, 0.9);
  border: 2px solid #7a5cff;
  padding: 4px 2px 3px;
  font-size: 11px;
  color: #efd;
  border-radius: 8px;
  pointer-events: auto;
  cursor: pointer;
}
.skill-chip .skill-key {
  display: inline-block;
  min-width: 14px;
  text-align: center;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid #666;
  border-radius: 3px;
  font-weight: bold;
  font-size: 9px;
  color: #ffdd88;
  padding: 0 3px;
  line-height: 1.3;
}
.skill-chip .skill-name {
  display: none;
}
.skill-chip .skill-lv {
  position: absolute;
  right: 2px;
  bottom: 2px;
  color: #d8b8ff;
  font-size: 9px;
  line-height: 1;
  text-shadow: 0 0 2px #000;
}
.skill-chip .skill-cd {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  color: #ff8888;
  font-weight: bold;
  font-size: 12px;
  border-radius: 6px;
}
.skill-chip.ready {
  border-color: #afa;
  box-shadow: 0 0 8px rgba(100, 255, 100, 0.25);
}
.skill-chip.targeting {
  border-color: #ffe86a;
  color: #fff6bd;
  box-shadow: 0 0 14px rgba(255, 216, 64, 0.9);
  animation: skill-targeting-pulse 0.7s steps(2, end) infinite;
}
@keyframes skill-targeting-pulse {
  50% { transform: translateY(-2px); filter: brightness(1.2); }
}
.skill-chip.on-cd {
  opacity: 0.7;
  border-color: #666;
}
.skill-chip.locked {
  opacity: 0.38;
  border-color: #444;
  border-style: dashed;
}
.skill-chip.locked .skill-name {
  color: #888;
}

.dev-panel {
  margin-top: 12px;
  padding: 12px;
  background: rgba(80, 40, 120, 0.15);
  border: 2px dashed #a6f;
  border-radius: 8px;
}
.dev-panel.hidden { display: none; }
.dev-weapons, .dev-armor-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.dev-chip {
  background: #4a2a6a;
  border: 2px solid #a6f;
  color: #efd;
  padding: 6px 10px;
  font-size: 11px;
  border-radius: 4px;
  cursor: pointer;
}
.dev-chip:hover { background: #6a3a9a; }

.inv-hint, .empty-slot-hint {
  color: #888;
  font-size: 12px;
  text-align: center;
  margin: 0 0 10px;
}
.equip-slot.equipped {
  cursor: pointer;
}
.equip-slot.equipped:hover {
  outline: 2px solid #ffeb3b;
}
.unequip-hint, .inv-action {
  color: #ffcc66;
  font-size: 11px;
}
.inv-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.inv-item-affix {
  color: #444;
  font-size: 11px;
}
.inv-item-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.inv-btn {
  border: 2px solid #333;
  border-radius: 3px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.inv-btn.inv-equip {
  background: #8bc34a;
  color: #1b1b1b;
}
.inv-btn.inv-salvage {
  background: #c62828;
  color: #fff;
}
.inv-btn:hover {
  filter: brightness(1.08);
}

.item-score-tag, .item-score {
  color: #ffcc66;
  font-weight: bold;
  font-size: 12px;
}

.upgrade-card.skill-card {
  border-color: #a6f;
  background: linear-gradient(180deg, rgba(60, 30, 90, 0.95), rgba(30, 20, 50, 0.95));
}
.upgrade-card .skill-key {
  color: #ffdd88;
  font-size: 13px;
}

.hud-info {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: #ccc;
  text-shadow: 1px 1px 2px #000;
}

/* Overlays */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  z-index: 100;
  pointer-events: auto;
}

.overlay.hidden {
  display: none;
}

.panel {
  background: #c6c6c6;
  border: 4px solid #555;
  box-shadow:
    inset 2px 2px 0 #fff,
    inset -2px -2px 0 #888,
    4px 4px 0 rgba(0, 0, 0, 0.5);
  padding: 32px;
  text-align: center;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
}

.panel h1 {
  font-size: 32px;
  color: #333;
  margin-bottom: 8px;
  text-shadow: 2px 2px 0 #fff;
}

.panel h2 {
  font-size: 22px;
  color: #333;
  margin-bottom: 16px;
}

.subtitle {
  color: #555;
  margin-bottom: 20px;
  font-size: 16px;
}

.controls-info {
  background: rgba(0, 0, 0, 0.08);
  padding: 16px;
  margin-bottom: 20px;
  text-align: left;
  color: #444;
  font-size: 14px;
  line-height: 1.8;
}

.controls-info kbd {
  background: #aaa;
  border: 1px solid #888;
  padding: 2px 6px;
  font-size: 12px;
  border-radius: 2px;
}

.mc-btn {
  background: #7a7a7a;
  border: 3px solid #333;
  box-shadow: inset 2px 2px 0 #aaa, inset -2px -2px 0 #555;
  color: #fff;
  font-size: 18px;
  padding: 12px 40px;
  cursor: pointer;
  font-weight: bold;
  text-shadow: 1px 1px 0 #333;
  transition: filter 0.1s;
}

.mc-btn:hover {
  filter: brightness(1.15);
}

.mc-btn:active {
  box-shadow: inset -2px -2px 0 #aaa, inset 2px 2px 0 #555;
}

/* Upgrade Modal */
.upgrade-panel {
  min-width: 700px;
}

.upgrade-options {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.upgrade-card {
  background: #8b8b8b;
  border: 3px solid #444;
  box-shadow: inset 2px 2px 0 #bbb, inset -2px -2px 0 #666;
  padding: 20px;
  width: 200px;
  cursor: pointer;
  transition: transform 0.1s, filter 0.1s;
  text-align: center;
}

.upgrade-card:hover {
  transform: scale(1.05);
  filter: brightness(1.1);
}

.upgrade-card .icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.upgrade-card .name {
  font-size: 16px;
  font-weight: bold;
  color: #fff;
  text-shadow: 1px 1px 0 #333;
  margin-bottom: 6px;
}

.upgrade-card .desc {
  color: #eee;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-line;
  min-height: 2.8em;
  margin-bottom: 8px;
}

.upgrade-card .level {
  font-size: 11px;
  color: #ffeb3b;
}

/* Inventory */
.inventory-panel {
  min-width: 500px;
  text-align: left;
}

.close-btn {
  float: right;
  background: #c44;
  border: 2px solid #822;
  color: #fff;
  cursor: pointer;
  padding: 2px 8px;
  font-size: 14px;
}

.equipment-slots {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.equip-slot {
  background: #999;
  border: 2px solid #555;
  padding: 12px;
  text-align: center;
  min-height: 80px;
  font-size: 11px;
  color: #333;
  cursor: pointer;
}

.equip-slot.equipped {
  border-color: #ffd700;
  background: #b8a040;
}

.equip-slot .item-name {
  font-weight: bold;
  margin-bottom: 4px;
}

.equip-slot .item-stats {
  font-size: 10px;
  color: #222;
}

.inventory-list {
  max-height: 200px;
  overflow-y: auto;
}

.inv-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-bottom: 1px solid #888;
  font-size: 12px;
}

.inv-item:hover {
  background: rgba(0, 0, 0, 0.1);
}

.rarity-common { color: #ccc; }
.rarity-uncommon { color: #55ff55; }
.rarity-rare { color: #5555ff; }
.rarity-epic { color: #aa55ff; }
.rarity-legendary { color: #ffaa00; }

#inv-btn {
  position: absolute;
  bottom: 16px;
  right: 16px;
  z-index: 45;
  background: #7a7a7a;
  border: 3px solid #333;
  color: #fff;
  font-size: 20px;
  padding: 10px 16px;
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.5);
}

#inv-btn.hidden {
  display: none;
}

#final-stats {
  color: #444;
  font-size: 16px;
  margin: 16px 0 24px;
  line-height: 1.8;
}

/* FAB buttons */
.fab-btn {
  position: absolute;
  z-index: 20;
  background: #7a7a7a;
  border: 3px solid #333;
  color: #fff;
  font-size: 18px;
  padding: 10px 14px;
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.5);
  pointer-events: auto;
}

.fab-btn.hidden { display: none; }
.fab-btn.active { background: #4a8a4a; border-color: #2a5a2a; }

#settings-btn {
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: calc(12px + env(safe-area-inset-right, 0px));
}
#pc-auto-btn {
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  left: calc(16px + env(safe-area-inset-left, 0px));
  font-size: 15px;
}
#inv-btn {
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  right: calc(16px + env(safe-area-inset-right, 0px));
  font-size: 20px;
}

.fab-auto.active {
  background: #4a8a4a;
  border-color: #2a5a2a;
  animation: pulse 1.5s infinite;
}

body.mobile-mode {
  touch-action: none;
  overflow: hidden;
}

/* 全屏模式：加大顶部避让，减少被浏览器栏/刘海遮挡 */
body.fullscreen-mode #hud,
body.fullscreen-mode .hub-hud {
  top: calc(12px + max(env(safe-area-inset-top, 0px), 28px));
}
body.fullscreen-mode #settings-btn,
body.fullscreen-mode #mobile-settings-btn {
  top: calc(12px + max(env(safe-area-inset-top, 0px), 28px));
}
body.fullscreen-mode #game-container {
  width: 100%;
  height: 100%;
  height: 100dvh;
}

/* 沉浸回退：系统全屏失败时（常见于平板 Chrome / iPad）加大顶栏避让 */
html.fullscreen-immersive,
body.fullscreen-immersive {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #1a1a2e;
}
body.fullscreen-immersive #game-container {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-height: -webkit-fill-available;
}
body.fullscreen-immersive #hud,
body.fullscreen-immersive .hub-hud {
  top: calc(12px + max(env(safe-area-inset-top, 0px), 48px));
}
body.fullscreen-immersive #settings-btn,
body.fullscreen-immersive #mobile-settings-btn {
  top: calc(12px + max(env(safe-area-inset-top, 0px), 48px));
}
body.fullscreen-immersive.mobile-mode .skill-bar {
  top: calc(96px + max(env(safe-area-inset-top, 0px), 48px));
}

/* 真正进入 :fullscreen 后可收紧避让 */
:fullscreen #game-container,
:-webkit-full-screen #game-container {
  width: 100%;
  height: 100%;
}
/* 弹层与表单允许滚动/点选，避免全身 touch-action:none 锁死 */
body.mobile-mode .overlay,
body.mobile-mode .settings-scroll,
body.mobile-mode .title-subpanel,
body.mobile-mode .title-menu,
body.mobile-mode .dialogue-panel,
body.mobile-mode .inventory-panel,
body.mobile-mode .chest-panel,
body.mobile-mode .upgrade-panel,
body.mobile-mode .compare-panel,
body.mobile-mode .tutorial-panel,
body.mobile-mode .keybinds-panel,
body.mobile-mode input,
body.mobile-mode textarea,
body.mobile-mode select,
body.mobile-mode button {
  touch-action: manipulation;
}
body.mobile-mode .settings-scroll,
body.mobile-mode .title-subpanel,
body.mobile-mode .title-subpanel-body,
body.mobile-mode .dialogue-actions,
body.mobile-mode .inventory-list,
body.mobile-mode #storage-list {
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}
body.mobile-mode .fab-btn {
  display: none !important;
}
body.mobile-mode .mc-btn,
body.mobile-mode .title-menu-btn,
body.mobile-mode .char-outfit-card,
body.mobile-mode .upgrade-card,
body.mobile-mode .inv-btn {
  min-height: 44px;
}

.auto-indicator {
  color: #ff8888;
  font-weight: bold;
  font-size: 13px;
}
.auto-indicator.active { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.5; } }

/* Compare modal */
.compare-panel { min-width: 600px; max-width: 95vw; }
.compare-grid {
  display: flex;
  gap: 12px;
  align-items: stretch;
  margin: 16px 0;
  text-align: left;
}
.compare-col {
  flex: 1;
  background: rgba(0,0,0,0.08);
  padding: 16px;
  border: 2px solid #888;
  font-size: 13px;
  color: #333;
  line-height: 1.6;
}
.compare-col h3 { margin-bottom: 8px; font-size: 15px; color: #222; }
.compare-vs {
  display: flex;
  align-items: center;
  font-weight: bold;
  font-size: 20px;
  color: #c44;
}
.compare-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.item-title { font-weight: bold; font-size: 15px; margin-bottom: 4px; }
.item-meta { color: #666; font-size: 12px; margin-bottom: 8px; }
.item-weapon-desc { color: #555; font-style: italic; margin-bottom: 8px; font-size: 12px; }
.stat-line { margin: 2px 0; }
.affix-list span {
  display: inline-block;
  background: rgba(0,0,0,0.1);
  padding: 2px 6px;
  margin: 2px;
  border-radius: 2px;
  font-size: 11px;
}

.mc-btn-green { background: #5a9a5a !important; }
.mc-btn-red { background: #a55 !important; font-size: 14px; padding: 10px 20px; }

/* Settings */
.settings-panel {
  width: min(460px, 94vw);
  max-height: min(86vh, 720px);
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 0 !important;
  overflow: hidden;
  background: linear-gradient(180deg, #efebe9 0%, #d7ccc8 100%) !important;
  border: 4px solid #4e342e;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}
.settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  background: linear-gradient(180deg, #5d4037, #4e342e);
  border-bottom: 3px solid #3e2723;
}
.settings-head h2 {
  margin: 0;
  color: #ffe082;
  font-size: 22px;
  text-shadow: 0 2px 0 #2c1c16;
}
.settings-sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: #bcaaa4;
}
.settings-scroll {
  overflow-y: auto;
  padding: 14px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.settings-section {
  background: rgba(255, 255, 255, 0.42);
  border: 2px solid #8d6e63;
  border-radius: 8px;
  padding: 12px 12px 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.settings-section-title {
  margin: 0 0 10px;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: #5d4037;
  text-transform: none;
}
.settings-section-title::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 8px;
  border-radius: 1px;
  background: #ffb300;
  vertical-align: 1px;
}
.setting-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  color: #3e2723;
  font-size: 13px;
}
.setting-row:last-child { margin-bottom: 0; }
.setting-row-slider label {
  flex: 0 0 72px;
  font-weight: 600;
}
.setting-row-slider input[type=range] {
  flex: 1;
  min-width: 0;
  accent-color: #6d4c41;
}
.setting-value {
  flex: 0 0 42px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #5d4037;
  font-size: 12px;
}
.setting-row-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
}
.setting-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: #3e2723;
  font-size: 13px;
}
.setting-check input {
  width: 16px;
  height: 16px;
  accent-color: #6d4c41;
}
.setting-check-block {
  display: flex;
  margin-bottom: 10px;
}
.setting-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.setting-select-label {
  font-size: 12px;
  color: #6d4c41;
  font-weight: 600;
}
.settings-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.settings-action-btn {
  width: 100%;
  font-size: 13px !important;
  padding: 10px 12px !important;
}
.setting-hint {
  color: #6d4c41;
  font-size: 11px;
  margin: 8px 0 0;
  text-align: left;
  line-height: 1.45;
}
.settings-hint-left { text-align: left; margin-top: 4px; }
.settings-section-advanced {
  background: rgba(255, 255, 255, 0.28);
  border-style: dashed;
}
.settings-panel .save-io {
  margin-top: 10px;
  min-height: 64px;
  border-radius: 6px;
  border-color: #5d4037;
  background: #2c211c;
}
.settings-panel .dev-panel {
  margin-top: 8px;
}
.settings-panel .dev-panel h4 {
  margin: 0 0 4px;
  color: #4a148c;
  font-size: 13px;
}

/* Mobile controls */
#mobile-controls {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 30;
  touch-action: none;
}
#mobile-controls.hidden { display: none; }

#joystick-base {
  position: absolute;
  left: calc(24px + env(safe-area-inset-left, 0px));
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  border: 3px solid rgba(255, 255, 255, 0.3);
  pointer-events: auto;
  touch-action: none;
}
#joystick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.7);
  pointer-events: none;
}

.mobile-btn {
  position: absolute;
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.45);
  border: 3px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  padding: 14px 20px;
  border-radius: 12px;
  touch-action: manipulation;
}
.mobile-btn.active { background: rgba(80, 160, 80, 0.7); border-color: #afa; }

#mobile-auto-btn {
  right: calc(24px + env(safe-area-inset-right, 0px));
  bottom: calc(100px + env(safe-area-inset-bottom, 0px));
}
#mobile-interact-btn {
  right: calc(126px + env(safe-area-inset-right, 0px));
  bottom: calc(112px + env(safe-area-inset-bottom, 0px));
  min-width: 76px;
  min-height: 52px;
  background: rgba(174, 125, 38, 0.72);
  border-color: rgba(255, 224, 130, 0.8);
}
#mobile-attack-btn {
  right: calc(24px + env(safe-area-inset-right, 0px));
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  width: 108px;
  height: 108px;
  min-width: 108px;
  min-height: 108px;
  border-radius: 50%;
  font-size: 20px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(180, 60, 60, 0.65);
  border-color: rgba(255, 150, 150, 0.6);
}
body.mobile-mode #mobile-auto-btn {
  right: calc(24px + env(safe-area-inset-right, 0px));
  bottom: calc(140px + env(safe-area-inset-bottom, 0px));
}
#mobile-inv-btn {
  right: calc(126px + env(safe-area-inset-right, 0px));
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  min-width: 72px;
  background: rgba(55, 90, 130, 0.75);
  border-color: rgba(144, 202, 249, 0.75);
}
#mobile-settings-btn {
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: calc(12px + env(safe-area-inset-right, 0px));
  bottom: auto;
  padding: 10px 14px;
  font-size: 14px;
  background: rgba(0, 0, 0, 0.5);
}
#mobile-cancel-skill {
  right: calc(24px + env(safe-area-inset-right, 0px));
  bottom: calc(176px + env(safe-area-inset-bottom, 0px));
  background: rgba(80, 60, 20, 0.75);
  border-color: #ffd54f;
}
.mobile-cancel.hidden,
.mobile-interact.hidden,
.mobile-portal.hidden,
.mobile-inv.hidden,
.mobile-settings.hidden {
  display: none !important;
}
body.mobile-mode.hub-like #mobile-attack-btn,
body.mobile-mode #mobile-attack-btn.hidden {
  display: none !important;
}
@media (max-width: 420px) {
  body.mobile-mode .skill-bar {
    top: calc(58px + env(safe-area-inset-top, 0px));
    bottom: calc(180px + env(safe-area-inset-bottom, 0px));
  }
  body.mobile-mode .skill-chip {
    width: 40px;
    min-width: 40px;
  }
  body.mobile-mode .skill-chip .skill-icon,
  body.mobile-mode .skill-chip .skill-icon-fallback {
    width: 24px;
    height: 24px;
  }
  #joystick-base {
    left: calc(12px + env(safe-area-inset-left, 0px));
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    width: 120px;
    height: 120px;
  }
  #mobile-attack-btn {
    width: 112px;
    height: 112px;
    min-width: 112px;
    min-height: 112px;
    right: calc(14px + env(safe-area-inset-right, 0px));
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    font-size: 20px;
  }
  #mobile-auto-btn {
    right: calc(14px + env(safe-area-inset-right, 0px));
    bottom: calc(140px + env(safe-area-inset-bottom, 0px));
    font-size: 14px;
    padding: 12px 14px;
  }
  #mobile-interact-btn {
    right: calc(132px + env(safe-area-inset-right, 0px));
    bottom: calc(108px + env(safe-area-inset-bottom, 0px));
    font-size: 15px;
    padding: 12px 16px;
    min-width: 72px;
    min-height: 56px;
  }
  #mobile-inv-btn {
    right: calc(100px + env(safe-area-inset-right, 0px));
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    font-size: 13px;
    padding: 10px 12px;
    min-width: 64px;
  }
  #mobile-cancel-skill {
    right: calc(14px + env(safe-area-inset-right, 0px));
    bottom: calc(156px + env(safe-area-inset-bottom, 0px));
    font-size: 13px;
  }
  body.mobile-mode .hub-hud { top: calc(52px + env(safe-area-inset-top, 0px)); }
  body.mobile-mode.fullscreen-mode .hub-hud {
    top: calc(52px + max(env(safe-area-inset-top, 0px), 28px));
  }
}

@media (max-width: 768px) {
  .upgrade-panel { min-width: auto; }
  .compare-panel { min-width: auto; }
  .compare-grid { flex-direction: column; }
  .compare-vs { justify-content: center; }
}

/* Boot / brand */
.boot-panel { min-width: min(420px, 90vw); }
.boot-bar {
  height: 14px;
  background: #333;
  border: 2px solid #111;
  margin: 16px 0 8px;
  overflow: hidden;
}
.boot-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #7cb342, #ffd54f);
  transition: width 0.15s linear;
}
.boot-text { color: #666; font-size: 13px; }
.menu-hero {
  width: min(320px, 80vw);
  image-rendering: pixelated;
  border: 3px solid #333;
  margin-bottom: 12px;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.35);
}
.brand-title {
  font-size: 40px;
  letter-spacing: 0.06em;
  color: #222;
}
.start-panel { background: linear-gradient(180deg, #c8d6b0 0%, #8b8b8b 100%); }

/* —— 标题页：背景图 + 悬浮游戏菜单 —— */
.title-overlay {
  background: #070b14 !important;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  overflow: hidden;
}
.title-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background: #070b14;
}
.title-bg {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* 拉远：完整显示画幅，篝火仍靠下 */
  object-position: center bottom;
  transform: translateX(-50%) scale(0.92);
  transform-origin: center bottom;
  image-rendering: auto;
  user-select: none;
  -webkit-user-drag: none;
}
.title-bg-shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(4, 8, 14, 0.62) 0%, rgba(4, 8, 14, 0.32) 26%, rgba(4, 8, 14, 0.08) 46%, transparent 62%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.12) 0%, transparent 28%, transparent 70%, rgba(0, 0, 0, 0.22) 100%);
  pointer-events: none;
}

/* （旧 CSS 场景层已停用，保留无害；实际背景为 title-bg 图片） */
.ts-sky {
  display: none;
}
.ts-aurora {
  position: absolute;
  left: 0;
  top: 0;
  width: 58%;
  height: 46%;
  background:
    radial-gradient(ellipse 45% 55% at 35% 45%, rgba(64, 150, 110, 0.2), transparent 70%),
    radial-gradient(ellipse 35% 50% at 60% 35%, rgba(48, 110, 140, 0.12), transparent 72%);
  animation: ts-aurora 9s ease-in-out infinite alternate;
}
@keyframes ts-aurora {
  from { opacity: 0.4; transform: translateX(0); }
  to { opacity: 0.85; transform: translateX(18px); }
}
.ts-stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 6% 14%, #fff, transparent),
    radial-gradient(1px 1px at 14% 32%, #ffe9a8, transparent),
    radial-gradient(1.5px 1.5px at 22% 10%, #fff, transparent),
    radial-gradient(1px 1px at 34% 26%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 48% 8%, #ffe9a8, transparent),
    radial-gradient(1px 1px at 58% 30%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 70% 16%, #fff, transparent),
    radial-gradient(1px 1px at 82% 38%, #ffe9a8, transparent),
    radial-gradient(1.5px 1.5px at 90% 12%, #fff, transparent),
    radial-gradient(1px 1px at 28% 48%, #fff, transparent),
    radial-gradient(1px 1px at 64% 50%, #ffe9a8, transparent);
  animation: ts-twinkle 5s ease-in-out infinite alternate;
}
.ts-stars-b {
  opacity: 0.4;
  transform: scale(1.2);
  animation-duration: 7.5s;
  animation-direction: alternate-reverse;
}
@keyframes ts-twinkle {
  from { opacity: 0.45; }
  to { opacity: 0.95; }
}
.ts-moon {
  position: absolute;
  top: 7%;
  right: 12%;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 32%, #fffaf0, #efdfb0 50%, #c4b078 100%);
  box-shadow:
    0 0 36px rgba(255, 236, 179, 0.55),
    0 0 110px rgba(255, 210, 120, 0.25),
    0 0 180px rgba(255, 190, 90, 0.1);
}
.ts-moon::after {
  content: '';
  position: absolute;
  top: 20%;
  left: 24%;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(175, 155, 105, 0.35);
  box-shadow: 30px 24px 0 -3px rgba(165, 145, 95, 0.28);
}

/* 远景山脊 / 松林剪影 */
.ts-far {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 34%;
  height: 36%;
}
.ts-ridge {
  position: absolute;
  left: -5%;
  right: -5%;
  bottom: 0;
  height: 70%;
  background:
    radial-gradient(ellipse 48% 100% at 22% 100%, #0c1524 0%, transparent 70%),
    radial-gradient(ellipse 55% 110% at 58% 110%, #0a1220 0%, transparent 72%),
    radial-gradient(ellipse 40% 90% at 88% 100%, #0e1828 0%, transparent 68%);
}
.ts-ridge-2 {
  height: 52%;
  opacity: 0.65;
  filter: brightness(1.15);
}
.ts-pines {
  position: absolute;
  left: 48%;
  right: 4%;
  bottom: 18%;
  height: 55%;
  background:
    linear-gradient(160deg, transparent 40%, #0a1610 40% 55%, transparent 55%) 10% 100% / 28px 70% no-repeat,
    linear-gradient(200deg, transparent 40%, #0c1a12 40% 58%, transparent 58%) 28% 100% / 34px 85% no-repeat,
    linear-gradient(170deg, transparent 42%, #081410 42% 56%, transparent 56%) 48% 100% / 26px 65% no-repeat,
    linear-gradient(190deg, transparent 40%, #0d1c14 40% 60%, transparent 60%) 70% 100% / 40px 95% no-repeat,
    linear-gradient(175deg, transparent 42%, #0a1610 42% 55%, transparent 55%) 90% 100% / 30px 75% no-repeat;
  opacity: 0.85;
}

/* 中景：湖面与岸 */
.ts-mid {
  position: absolute;
  left: 28%;
  right: 0;
  bottom: 26%;
  height: 22%;
}
.ts-lake {
  position: absolute;
  inset: 0 0 20% 8%;
  background:
    linear-gradient(180deg, rgba(30, 55, 75, 0.35), rgba(18, 36, 52, 0.55)),
    linear-gradient(90deg, transparent, rgba(255, 230, 160, 0.06) 40%, transparent 70%);
  border-radius: 40% 30% 0 0 / 40% 30% 0 0;
  box-shadow: inset 0 8px 20px rgba(255, 230, 170, 0.04);
}
.ts-shore {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28%;
  background: linear-gradient(180deg, #1a2818, #142014);
}

/* 营地中景：篝火为核心 */
.ts-camp {
  position: absolute;
  left: 30%;
  right: 0;
  bottom: 0;
  height: 58%;
  min-height: 300px;
}
.ts-glow-pool {
  position: absolute;
  left: 28%;
  bottom: 14%;
  width: 46%;
  height: 42%;
  background: radial-gradient(ellipse at 45% 55%, rgba(255, 140, 40, 0.42), rgba(255, 100, 20, 0.12) 42%, transparent 72%);
  animation: ts-glow 1.4s ease-in-out infinite alternate;
  z-index: 1;
}
@keyframes ts-glow {
  from { opacity: 0.7; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1.06); }
}
.ts-fire {
  position: absolute;
  left: 42%;
  bottom: 28%;
  width: 120px;
  height: 130px;
  z-index: 4;
  transform: translateX(-50%);
}
.ts-logs {
  position: absolute;
  left: 18px;
  bottom: 8px;
  width: 84px;
  height: 20px;
  background: linear-gradient(90deg, #3e2723, #6d4c41 45%, #2c1c16);
  border-radius: 2px;
  box-shadow: 0 10px 0 #1a120e;
  transform: rotate(-5deg);
}
.ts-logs::after {
  content: '';
  position: absolute;
  left: 10px;
  top: -8px;
  width: 68px;
  height: 16px;
  background: linear-gradient(90deg, #5d4037, #8d6e63 50%, #3e2723);
  transform: rotate(20deg);
  border-radius: 2px;
}
.ts-flame {
  position: absolute;
  left: 50%;
  bottom: 22px;
  width: 44px;
  height: 70px;
  margin-left: -22px;
  background: radial-gradient(ellipse at 50% 78%, #fff59d 0%, #ffb300 32%, #ef6c00 62%, transparent 78%);
  border-radius: 50% 50% 40% 40%;
  animation: ts-flame 0.5s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 12px rgba(255, 140, 40, 0.65));
}
.ts-flame-b {
  width: 28px;
  height: 48px;
  margin-left: -14px;
  bottom: 36px;
  opacity: 0.85;
  animation-delay: 0.15s;
  background: radial-gradient(ellipse at 50% 80%, #fffde7 0%, #ffcc80 45%, transparent 75%);
}
@keyframes ts-flame {
  from { transform: scaleY(0.9) translateY(2px); }
  to { transform: scaleY(1.12) translateY(-3px); }
}
.ts-embers {
  position: absolute;
  left: 30%;
  bottom: 50%;
  width: 50px;
  height: 90px;
  background-image:
    radial-gradient(2px 2px at 20% 80%, #ffb74d, transparent),
    radial-gradient(1.5px 1.5px at 60% 55%, #ffcc80, transparent),
    radial-gradient(2px 2px at 40% 70%, #ff8a65, transparent),
    radial-gradient(1.5px 1.5px at 75% 40%, #ffe082, transparent);
  animation: ts-embers 2.6s linear infinite;
}
@keyframes ts-embers {
  0% { transform: translateY(0); opacity: 0.95; }
  100% { transform: translateY(-56px); opacity: 0; }
}

/* 角色：面向篝火 */
.ts-hero {
  position: absolute;
  left: 54%;
  bottom: 26%;
  width: 78px;
  height: 110px;
  z-index: 5;
  filter: drop-shadow(0 0 14px rgba(255, 140, 40, 0.4));
}
.ts-hero-legs {
  position: absolute;
  left: 22px;
  bottom: 6px;
  width: 14px;
  height: 20px;
  background: #3e2723;
  box-shadow: 18px 0 0 #3e2723;
  border-radius: 2px;
}
.ts-hero-body {
  position: absolute;
  left: 20px;
  bottom: 22px;
  width: 36px;
  height: 44px;
  background: linear-gradient(180deg, #546e7a, #263238);
  border-radius: 4px 4px 2px 2px;
  box-shadow: inset 0 0 0 2px #1a2226;
}
.ts-hero-scarf {
  position: absolute;
  left: 22px;
  bottom: 58px;
  width: 32px;
  height: 11px;
  background: #c62828;
  border-radius: 2px;
  box-shadow: 10px 10px 0 -2px #b71c1c;
  z-index: 2;
}
.ts-hero-head {
  position: absolute;
  left: 24px;
  bottom: 62px;
  width: 28px;
  height: 28px;
  background: linear-gradient(180deg, #ffcc80, #e0a060);
  border-radius: 50%;
  box-shadow: 0 -9px 0 -2px #37474f;
  z-index: 3;
}
.ts-hero-arm {
  position: absolute;
  left: 8px;
  bottom: 42px;
  width: 20px;
  height: 11px;
  background: #607d8b;
  border-radius: 4px;
  transform: rotate(-32deg);
  transform-origin: right center;
  animation: ts-roast 2.5s ease-in-out infinite;
  z-index: 2;
}
.ts-skewer {
  position: absolute;
  left: -6px;
  bottom: 52px;
  width: 28px;
  height: 5px;
  background: #5d4037;
  transform: rotate(-32deg);
  transform-origin: right center;
  animation: ts-roast 2.5s ease-in-out infinite;
  z-index: 2;
  box-shadow: -10px -1px 0 3px #e57373;
}
@keyframes ts-roast {
  0%, 100% { transform: rotate(-28deg); }
  50% { transform: rotate(-40deg); }
}

.ts-tree {
  position: absolute;
  bottom: 22%;
  width: 58px;
  height: 150px;
  z-index: 3;
  background:
    linear-gradient(90deg, #2c1c16, #4e342e 40%, #2c1c16) center bottom / 14px 50% no-repeat,
    radial-gradient(ellipse at 50% 35%, #1b3a24, #0c1c14 72%) center 8% / 100% 72% no-repeat;
  filter: drop-shadow(0 8px 12px rgba(0,0,0,0.4));
}
.ts-tree::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  width: 96px;
  height: 96px;
  margin-left: -48px;
  border-radius: 50% 50% 42% 42%;
  background: radial-gradient(circle at 40% 40%, #2e5a38, #12281c 70%);
  box-shadow: -24px 20px 0 -10px #1a3824, 26px 24px 0 -14px #214a30;
}
.ts-tree-back {
  left: 8%;
  bottom: 34%;
  transform: scale(0.85);
  opacity: 0.75;
  z-index: 2;
}
.ts-tree-side {
  right: 6%;
  bottom: 20%;
  transform: scale(1.1);
  z-index: 6;
}
.ts-prop {
  position: absolute;
  z-index: 4;
  image-rendering: pixelated;
}
.ts-barrel {
  right: 22%;
  bottom: 24%;
  width: 28px;
  height: 36px;
  background: linear-gradient(90deg, #5d4037, #8d6e63 40%, #4e342e);
  border-radius: 4px;
  box-shadow: inset 0 0 0 2px #3e2723, 0 6px 0 #2c1c16;
}
.ts-barrel::before {
  content: '';
  position: absolute;
  left: 2px;
  right: 2px;
  top: 10px;
  height: 3px;
  background: #2c211c;
  box-shadow: 0 12px 0 #2c211c;
}
.ts-sign {
  right: 12%;
  bottom: 30%;
  width: 8px;
  height: 48px;
  background: #5d4037;
  box-shadow:
    10px -18px 0 -1px #6d4c41,
    18px -18px 0 -1px #6d4c41,
    14px -26px 0 6px #8d6e63;
}

/* 前景：草 / 石 / 花 */
.ts-fore {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28%;
  z-index: 7;
  background: linear-gradient(180deg, transparent 0%, #142014 28%, #0e160e 100%);
}
.ts-grass {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(10deg, transparent 60%, #1f3a1c 60% 78%, transparent 78%) 8% 70% / 10px 28px no-repeat,
    linear-gradient(-8deg, transparent 55%, #243f20 55% 80%, transparent 80%) 18% 78% / 12px 32px no-repeat,
    linear-gradient(6deg, transparent 58%, #1c361a 58% 76%, transparent 76%) 72% 74% / 11px 30px no-repeat,
    linear-gradient(-12deg, transparent 52%, #264422 52% 82%, transparent 82%) 86% 80% / 14px 34px no-repeat,
    linear-gradient(4deg, transparent 60%, #1a3218 60% 75%, transparent 75%) 42% 85% / 10px 26px no-repeat;
  opacity: 0.9;
}
.ts-rock {
  position: absolute;
  bottom: 18%;
  background: #3a3f3a;
  border-radius: 40% 50% 40% 45%;
  box-shadow: inset -3px -3px 0 rgba(0,0,0,0.35), 0 4px 0 #222;
}
.ts-rock-1 { left: 10%; width: 36px; height: 22px; }
.ts-rock-2 { left: 22%; width: 22px; height: 14px; bottom: 12%; opacity: 0.85; }
.ts-wildflowers {
  position: absolute;
  inset: 20% 6% 10% 6%;
  background-image:
    radial-gradient(2px 2px at 12% 50%, #e8eaf0, transparent),
    radial-gradient(2px 2px at 30% 70%, #dfe6ef, transparent),
    radial-gradient(1.5px 1.5px at 55% 40%, #fff, transparent),
    radial-gradient(2px 2px at 78% 65%, #e0e7ef, transparent),
    radial-gradient(1.5px 1.5px at 90% 45%, #fff, transparent);
  opacity: 0.55;
}
.ts-shade {
  position: absolute;
  inset: 0;
  z-index: 8;
  background:
    linear-gradient(90deg, rgba(4, 8, 14, 0.58) 0%, rgba(4, 8, 14, 0.28) 28%, rgba(4, 8, 14, 0.05) 48%, transparent 62%),
    radial-gradient(ellipse 50% 55% at 48% 68%, rgba(255, 130, 40, 0.1), transparent 60%),
    linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.28) 100%);
}

/* 左侧悬浮菜单：无容器面板 */
.title-layout {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: clamp(40px, 8vh, 80px) clamp(36px, 6vw, 88px);
  gap: 32px;
  pointer-events: none;
}
.title-menu {
  pointer-events: auto;
  width: min(300px, 86vw);
  display: flex;
  flex-direction: column;
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
}
.title-brand {
  margin-bottom: clamp(28px, 5vh, 48px);
}
.title-eyebrow {
  margin: 0 0 10px;
  font-size: 10px;
  letter-spacing: 0.28em;
  color: rgba(200, 175, 120, 0.45);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.title-menu .brand-title {
  margin: 0 0 12px;
  line-height: 1.1;
}
.title-menu .brand-title-glow {
  display: inline-block;
  color: #ffe082;
  font-size: clamp(38px, 5.6vw, 56px);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-shadow:
    0 0 1px #1a1008,
    2px 0 0 #1a1008,
    -2px 0 0 #1a1008,
    0 2px 0 #1a1008,
    0 -2px 0 #1a1008,
    3px 3px 0 #0e0a06,
    0 0 28px rgba(255, 180, 60, 0.28),
    0 0 48px rgba(255, 140, 40, 0.12);
}
.title-menu .subtitle {
  margin: 0;
  max-width: 260px;
  font-size: 12px;
  line-height: 1.6;
  letter-spacing: 0.04em;
  color: rgba(190, 175, 145, 0.55);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}
.title-menu-btns {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.title-menu-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  padding: 14px 16px 14px 14px;
  border: 1px solid rgba(180, 145, 75, 0.28);
  background: rgba(6, 10, 16, 0.38);
  color: #e6d8b8;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.35);
  clip-path: polygon(
    0 5px, 5px 0, calc(100% - 5px) 0, 100% 5px,
    100% calc(100% - 5px), calc(100% - 5px) 100%, 5px 100%, 0 calc(100% - 5px)
  );
  transition: color 0.12s ease, background 0.12s ease, border-color 0.12s ease, transform 0.1s ease;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}
.title-menu-caret {
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid transparent;
  flex: 0 0 auto;
  transition: border-left-color 0.12s ease;
}
.title-menu-label { flex: 1; }
.title-menu-btn:hover:not(:disabled) {
  background: rgba(12, 18, 26, 0.58);
  border-color: rgba(220, 175, 90, 0.65);
  color: #fff3d0;
  transform: translateX(4px);
}
.title-menu-btn:hover:not(:disabled) .title-menu-caret {
  border-left-color: #d4a84b;
}
.title-menu-btn:active:not(:disabled) {
  transform: translateX(2px);
}
.title-menu-btn-primary {
  padding-top: 16px;
  padding-bottom: 16px;
  font-size: 16px;
  background: rgba(28, 68, 38, 0.55);
  border-color: rgba(200, 160, 70, 0.55);
  color: #f2ebd8;
  box-shadow:
    inset 0 1px 0 rgba(160, 210, 140, 0.1),
    0 0 20px rgba(50, 110, 60, 0.18);
}
.title-menu-btn-primary .title-menu-caret {
  border-left-color: #e0c36a;
}
.title-menu-btn-primary:hover:not(:disabled) {
  background: rgba(36, 88, 48, 0.72);
  border-color: rgba(230, 190, 100, 0.85);
  color: #fff8e7;
}
.title-menu-btn:disabled,
.title-menu-btn.is-disabled {
  opacity: 0.32;
  cursor: not-allowed;
  transform: none !important;
  filter: grayscale(0.3);
}
.title-menu-meta {
  margin-top: clamp(22px, 4vh, 36px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.title-version {
  appearance: none;
  -webkit-appearance: none;
  align-self: flex-start;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: rgba(160, 150, 130, 0.55);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.08em;
  cursor: pointer;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.title-version:hover {
  color: rgba(210, 190, 140, 0.85);
}
.title-slot-hint {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.03em;
  line-height: 1.5;
  color: rgba(150, 160, 170, 0.55);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  max-width: 280px;
}

/* 子面板（读档/新游戏/版本）仍轻量浮层 */
.title-subpanel {
  pointer-events: auto;
  width: min(400px, 90vw);
  max-height: min(70vh, 520px);
  overflow: auto;
  padding: 16px;
  background: rgba(8, 12, 18, 0.9);
  border: 1px solid rgba(180, 140, 70, 0.4);
  color: #eceff1;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  clip-path: polygon(
    0 10px, 10px 0, calc(100% - 10px) 0, 100% 10px,
    100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px)
  );
}
.title-subpanel.is-wide {
  width: min(520px, 94vw);
  max-height: min(82vh, 640px);
}
.char-create {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.char-create-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.char-create-field label {
  font-size: 12px;
  color: #b0bec5;
  letter-spacing: 0.04em;
}
.char-create-field input[type="text"] {
  appearance: none;
  border: 1px solid rgba(180, 140, 70, 0.45);
  background: rgba(0, 0, 0, 0.4);
  color: #fff8e7;
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
}
.char-create-field input[type="text"]:focus {
  border-color: #e0c36a;
}
.char-create-hint {
  margin: 0;
  font-size: 11px;
  color: #78909c;
}
.char-create-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(140, 150, 160, 0.28);
}
.char-create-preview canvas {
  width: 56px;
  height: 64px;
  image-rendering: pixelated;
  background: rgba(0, 0, 0, 0.25);
}
.char-create-preview-name {
  font-size: 16px;
  font-weight: bold;
  color: #ffe082;
  text-shadow: 0 1px 0 #1a1208;
}
.char-outfit-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.char-outfit-card {
  appearance: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 6px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(140, 150, 160, 0.35);
  color: #cfd8dc;
  font: inherit;
}
.char-outfit-card canvas {
  width: 48px;
  height: 54px;
  image-rendering: pixelated;
}
.char-outfit-card strong {
  font-size: 11px;
  font-weight: 600;
  color: #eceff1;
}
.char-outfit-card.is-selected {
  border-color: rgba(220, 175, 90, 0.85);
  background: rgba(180, 140, 70, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 224, 130, 0.25);
}
.settings-char-preview {
  margin-bottom: 10px;
}
.settings-section .char-create-field {
  margin-bottom: 10px;
}
.settings-section .char-outfit-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.title-subpanel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.title-subpanel-head h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0.08em;
  color: #ffe082;
  text-shadow: 0 2px 0 #1a1208;
}
.title-subpanel-close {
  appearance: none;
  border: 1px solid rgba(180, 140, 70, 0.4);
  background: rgba(0, 0, 0, 0.35);
  color: #e8dcc4;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 14px;
}
.title-subpanel-close:hover {
  border-color: #e0c36a;
  color: #fff;
}
.title-subpanel-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.title-slot-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(140, 150, 160, 0.3);
}
.title-slot-card.is-empty { opacity: 0.7; }
.title-slot-card.is-active {
  border-color: rgba(220, 175, 90, 0.65);
}
.title-slot-meta {
  font-size: 12px;
  color: #90a4ae;
}
.title-slot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.title-slot-actions .mc-btn {
  font-size: 13px !important;
  padding: 8px 14px !important;
}
.changelog-list {
  margin: 0;
  padding-left: 18px;
  color: #cfd8dc;
  font-size: 13px;
  line-height: 1.55;
}
.changelog-list li { margin-bottom: 6px; }
.keybinds-panel {
  min-width: min(440px, 92vw);
  max-width: 520px;
  max-height: min(80vh, 640px);
  overflow: auto;
}
.keybinds-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.keybind-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.08);
  border: 1px solid #8d6e63;
  border-radius: 4px;
}
.keybind-keys kbd {
  display: inline-block;
  min-width: 1.4em;
  padding: 2px 6px;
  margin: 0 2px 2px 0;
  border: 1px solid #5d4037;
  border-radius: 3px;
  background: #efebe9;
  font-size: 12px;
  color: #3e2723;
}
.keybind-desc {
  font-size: 13px;
  color: #4e342e;
}
@media (max-width: 900px) {
  .title-bg-shade {
    background:
      linear-gradient(180deg, rgba(4, 8, 14, 0.28) 0%, rgba(4, 8, 14, 0.5) 75%),
      linear-gradient(90deg, rgba(4, 8, 14, 0.35) 0%, transparent 70%);
  }
  .title-layout {
    align-items: flex-end;
    padding: 24px 20px 32px;
  }
  .title-menu { width: min(320px, 92vw); }
  .title-menu .brand-title-glow { font-size: clamp(30px, 8vw, 42px); }
}


.skill-chip {
  font: inherit;
}
.skill-chip .skill-icon {
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
  border: 1px solid #444;
  border-radius: 3px;
  background: #1a1228;
}
.skill-chip .skill-icon-fallback,
.upgrade-skill-icon.skill-icon-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid #444;
  border-radius: 3px;
  background: var(--icon-color, #7a5cff);
  color: #fff;
  font-weight: bold;
  font-size: 13px;
  text-shadow: 0 1px 0 #000;
  image-rendering: pixelated;
}
.upgrade-glyph {
  width: 48px;
  height: 48px;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--glyph-color, #7a5cff);
  border: 2px solid #333;
  color: #fff;
  font-size: 22px;
  font-weight: bold;
  text-shadow: 0 2px 0 rgba(0,0,0,0.45);
  box-shadow: inset 2px 2px 0 rgba(255,255,255,0.25);
}
body.mobile-mode .skill-bar {
  left: auto;
  right: calc(6px + env(safe-area-inset-right, 0px));
  top: calc(64px + env(safe-area-inset-top, 0px));
  bottom: calc(196px + env(safe-area-inset-bottom, 0px));
  transform: none;
  flex-direction: column;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: center;
  width: auto;
  max-width: none;
  gap: 4px;
  padding: 4px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: rgba(0, 0, 0, 0.22);
  pointer-events: auto;
}
body.mobile-mode .skill-bar:not(.hidden) {
  display: flex;
}
body.fullscreen-mode.mobile-mode .skill-bar {
  top: calc(84px + max(env(safe-area-inset-top, 0px), 28px));
}
body.mobile-mode .skill-chip {
  width: 44px;
  min-width: 44px;
  padding: 3px 2px;
}
body.mobile-mode .skill-chip .skill-icon,
body.mobile-mode .skill-chip .skill-icon-fallback {
  width: 26px;
  height: 26px;
}
.upgrade-card.pop-in {
  animation: upgrade-pop 0.28s ease-out;
}
.upgrade-card.skill-card {
  border-color: #b39ddb;
  box-shadow: inset 2px 2px 0 #ddd, inset -2px -2px 0 #666, 0 0 0 2px rgba(170,100,255,0.35);
}
.upgrade-skill-icon {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
  margin: 0 auto 8px;
  display: block;
  border: 2px solid #333;
}
@keyframes upgrade-pop {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.settings-panel select {
  background: #efebe9;
  color: #3e2723;
  border: 2px solid #6d4c41;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 13px;
}
@media (max-width: 420px) {
  .settings-actions { grid-template-columns: 1fr; }
  .setting-row-slider { flex-wrap: wrap; }
  .setting-row-slider label { flex: 1 1 100%; }
}

/* 像素溯源 · 大厅 / 对话 / 背包 */
.hub-hud {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: calc(12px + env(safe-area-inset-left, 0px));
  right: calc(12px + env(safe-area-inset-right, 0px));
  z-index: 12;
  pointer-events: none;
  color: #fff;
  text-shadow: 1px 1px 2px #000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}
.hub-stat-bar {
  pointer-events: none;
}
.hub-stat-row, .dialogue-stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.hub-stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 8px;
  background: linear-gradient(180deg, rgba(30, 35, 28, 0.92), rgba(18, 22, 16, 0.88));
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  min-height: 40px;
}
.hub-stat-chip .stat-icon {
  font-size: 22px;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}
.hub-stat-chip .stat-body {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.hub-stat-chip .stat-value {
  font-size: 17px;
  font-weight: 800;
  color: #fff8e1;
}
.hub-stat-chip .stat-sub {
  font-size: 11px;
  color: #b0bec5;
  margin-top: 1px;
}
.hub-stat-chip.stat-gold .stat-value { color: #ffd54f; }
.hub-stat-chip.stat-name .stat-value { color: #ffe082; font-size: 13px; }
.hub-stat-chip.stat-rep .stat-value { color: #e1bee7; }
.hub-stat-chip.stat-fish .stat-value { color: #81d4fa; }
.hub-stat-chip.stat-farm .stat-value { color: #c5e1a5; }
.hub-stat-chip.stat-rod .stat-value { color: #ffcc80; }
.hub-stat-chip.stat-bounty .stat-value { color: #ffe082; }

.hub-tutorial-tip {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 12px;
  background: linear-gradient(90deg, rgba(46, 125, 50, 0.92), rgba(27, 94, 32, 0.88));
  border: 2px solid #81c784;
  border-radius: 10px;
  font-size: 13px;
  color: #e8f5e9;
  max-width: min(420px, 92vw);
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}
.hub-tutorial-icon { font-size: 18px; }
.hub-tutorial-btn {
  margin-left: auto;
  padding: 4px 10px;
  font-size: 12px;
  border: 2px solid #a5d6a7;
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
}
.hub-tutorial-btn:hover { background: rgba(255,255,255,0.22); }

.tutorial-panel {
  text-align: center;
  min-width: min(440px, 92vw);
  max-width: 520px;
  background: linear-gradient(165deg, #fff8e1, #d7ccc8) !important;
  border: 4px solid #5d4037 !important;
}
.tutorial-icon-wrap {
  font-size: 52px;
  margin: 4px 0 8px;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.2));
}
.tutorial-panel h2 {
  color: #3e2723;
  margin: 0 0 10px;
  font-size: 24px;
}
.tutorial-body {
  color: #4e342e;
  line-height: 1.65;
  margin: 0 0 16px;
  text-align: left;
}
.tutorial-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
}
.tutorial-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #bcaaa4;
  border: 2px solid #8d6e63;
}
.tutorial-dot.active {
  background: #66bb6a;
  border-color: #2e7d32;
  transform: scale(1.15);
}
.tutorial-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.start-panel-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(165deg, #2e4a32 0%, #1b2e24 45%, #3e2723 100%) !important;
  color: #f0f4c3;
  border: 4px solid #5d4037;
  min-width: min(480px, 92vw);
}
.start-panel-hero .brand-title {
  color: #ffecb3 !important;
  font-size: 46px !important;
  text-shadow: 0 3px 0 #3e2723, 0 0 24px rgba(255,200,80,0.35);
}
.start-panel-hero .subtitle { color: #c8e6c9; }
.start-panel-hero .controls-info { color: #dcedc8; }
.start-panel-hero .controls-info b { color: #ffe082; }
.start-hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255,193,7,0.18), transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(76,175,80,0.2), transparent 45%);
  pointer-events: none;
}
.start-panel-hero > *:not(.start-hero-bg) { position: relative; z-index: 1; }

.dialogue-panel {
  position: relative;
  min-width: min(520px, 92vw);
  max-width: 640px;
  background: linear-gradient(180deg, #efebe9, #bcaaa4);
  border: 4px solid #4e342e;
}
.dialogue-speaker {
  font-weight: bold;
  font-size: 16px;
  color: #3e2723;
  margin-bottom: 8px;
}
.dialogue-stats {
  margin-bottom: 10px;
}
.dialogue-stats .hub-stat-chip {
  background: linear-gradient(180deg, #fffde7, #fff8e1);
  border-color: #8d6e63;
  box-shadow: inset 0 1px 0 #fff, 0 2px 6px rgba(62,39,35,0.15);
  text-shadow: none;
}
.dialogue-stats .stat-value { color: #3e2723 !important; }
.dialogue-stats .stat-sub { color: #6d4c41; }
.dialogue-bubble {
  background: #fff8e1;
  border: 2px solid #6d4c41;
  border-radius: 8px;
  padding: 14px 16px;
  min-height: 56px;
  color: #212121;
  line-height: 1.5;
  margin-bottom: 14px;
}
.dialogue-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
}
.dialogue-actions .mc-btn {
  text-align: left;
  white-space: normal;
  line-height: 1.35;
}
.dialogue-actions small { opacity: 0.85; font-weight: normal; }
.btn-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}
.btn-label-name { flex: 1; }
.price-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: rgba(255, 213, 79, 0.2);
  border: 1px solid rgba(255, 193, 7, 0.45);
  border-radius: 6px;
  font-weight: 700;
  color: #f9a825;
  white-space: nowrap;
}
.price-chip span:last-child { color: #ff8f00; }
.bounty-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.bounty-progress {
  font-weight: 700;
  color: #5d4037;
}
.bounty-progress.done { color: #2e7d32; }

.game-toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  color: #fff8e1;
  background: rgba(20, 24, 18, 0.92);
  border: 2px solid rgba(255, 224, 130, 0.5);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  pointer-events: none;
  max-width: min(520px, 92vw);
  text-align: center;
}
.game-toast.hidden { display: none !important; }

.dialogue-feedback {
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 10px;
  border: 2px solid transparent;
}
.dialogue-feedback.hidden { display: none !important; }
.dialogue-feedback-ok {
  background: #e8f5e9;
  color: #1b5e20;
  border-color: #66bb6a;
}
.dialogue-feedback-err {
  background: #ffebee;
  color: #b71c1c;
  border-color: #ef5350;
}

.dialogue-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
  max-height: 280px;
  overflow-y: auto;
}
.dialogue-cards.hidden { display: none !important; }
.dialogue-card {
  background: #fff;
  border: 2px solid #8d6e63;
  border-radius: 10px;
  padding: 10px 12px;
}
.dialogue-card-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 6px;
}
.dialogue-card-icon { font-size: 28px; line-height: 1; }
.dialogue-card-title {
  font-weight: 800;
  color: #3e2723;
  font-size: 15px;
}
.dialogue-card-line {
  color: #5d4037;
  font-size: 14px;
  margin-top: 2px;
}
.dialogue-card-hint {
  font-size: 12px;
  color: #795548;
  margin-bottom: 8px;
  line-height: 1.45;
}
.dialogue-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.dialogue-card-actions .mc-btn {
  flex: 1;
  min-width: 120px;
  text-align: center;
}
.dialogue-actions .mc-btn.is-primary,
.dialogue-card-actions .mc-btn.is-primary {
  border-color: #2e7d32;
  background: linear-gradient(180deg, #66bb6a, #43a047);
  color: #fff;
}
.dialogue-actions .mc-btn:disabled,
.dialogue-card-actions .mc-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
#dialogue-close {
  position: absolute;
  top: 10px;
  right: 10px;
}

.trinket-slots {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}
.trinket-slot {
  background: rgba(255,255,255,0.35);
  border: 2px solid #555;
  padding: 6px;
  font-size: 11px;
  min-height: 64px;
}
.trinket-slot.filled { cursor: pointer; border-color: #ffb300; }
.trinket-slot.filled:hover { outline: 2px solid #ffd54f; }

.bag-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}
.bag-capacity-hint {
  font-size: 12px;
  color: #555;
  margin-bottom: 4px;
}
.bag-slot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border: 2px dashed #777;
  background: rgba(255,255,255,0.25);
  align-items: center;
}
.bag-slot.filled {
  border-style: solid;
  border-color: #555;
}
.bag-empty { color: #888; font-size: 12px; }

.save-io {
  width: 100%;
  min-height: 80px;
  margin-top: 8px;
  font-family: Consolas, monospace;
  font-size: 11px;
  background: #222;
  color: #ddd;
  border: 2px solid #444;
  padding: 8px;
}
.save-row { gap: 8px; }
.setting-divider {
  border: none;
  border-top: 1px solid #666;
  margin: 14px 0;
}

.inventory-panel { max-width: min(640px, 94vw); }
.inventory-list { max-height: 280px; }

/* —— 家中木箱图形化 UI —— */
.chest-panel {
  width: min(720px, 96vw);
  max-width: 720px;
  text-align: left;
  background:
    linear-gradient(180deg, #5d4037 0%, #4e342e 28%, #3e2723 100%) !important;
  border: 4px solid #2c1c16;
  color: #f3e5d8;
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 236, 179, 0.15);
  padding: 16px 18px 18px;
}
.chest-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.chest-panel-head h2 {
  margin: 0;
  font-size: 22px;
  color: #ffe082;
  text-shadow: 0 2px 0 #2c1c16;
  letter-spacing: 0.04em;
}
.chest-sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: #bcaaa4;
}
.chest-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chest-columns {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 14px;
}
@media (max-width: 700px) {
  .chest-columns { grid-template-columns: 1fr; }
}
.chest-section {
  background: linear-gradient(180deg, rgba(30, 20, 16, 0.55), rgba(20, 14, 10, 0.72));
  border: 2px solid #6d4c41;
  border-radius: 8px;
  padding: 10px;
  box-shadow: inset 0 0 0 1px rgba(255, 224, 178, 0.06);
}
.chest-section-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: bold;
  color: #ffecb3;
}
.chest-count {
  font-weight: normal;
  color: #a1887f;
  font-size: 12px;
}
.chest-grid {
  display: grid;
  gap: 6px;
}
.chest-grid-16 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.chest-grid-8 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.chest-cell {
  position: relative;
  aspect-ratio: 1;
  min-height: 64px;
  border: 2px solid #5d4037;
  border-radius: 6px;
  background:
    linear-gradient(160deg, #6d4c41 0%, #4e342e 55%, #3e2723 100%);
  color: #efebe9;
  cursor: pointer;
  padding: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 2px 0 rgba(0,0,0,0.25);
  transition: transform 0.08s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.chest-cell.is-empty {
  background: linear-gradient(160deg, rgba(62, 39, 35, 0.65), rgba(33, 24, 20, 0.85));
  border-style: dashed;
  border-color: #6d4c41;
  cursor: default;
}
.chest-cell.is-filled:hover,
.chest-cell.is-focus {
  transform: translateY(-1px);
  border-color: var(--rarity, #ffd54f);
  box-shadow:
    inset 0 0 0 1px rgba(255, 236, 179, 0.2),
    0 0 0 2px color-mix(in srgb, var(--rarity, #ffd54f) 45%, transparent),
    0 4px 10px rgba(0,0,0,0.35);
}
.chest-glyph {
  font-size: 20px;
  line-height: 1;
  color: var(--rarity, #ffe082);
  text-shadow: 0 1px 0 #211612;
}
.chest-name {
  font-size: 10px;
  line-height: 1.15;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #efebe9;
}
.chest-name.muted { color: #8d6e63; }
.chest-qty {
  position: absolute;
  right: 4px;
  bottom: 3px;
  min-width: 16px;
  padding: 0 3px;
  border-radius: 3px;
  background: rgba(20, 12, 8, 0.85);
  border: 1px solid #8d6e63;
  font-size: 10px;
  font-weight: bold;
  color: #fff8e1;
}
.chest-transfer-hint {
  margin-top: 8px;
  font-size: 11px;
  color: #a1887f;
  line-height: 1.4;
}
.chest-detail {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 8px;
  border: 2px solid #6d4c41;
  background: linear-gradient(180deg, rgba(255, 236, 179, 0.08), rgba(0,0,0,0.22));
  min-height: 72px;
}
.chest-detail.empty-detail {
  display: block;
  color: #bcaaa4;
  font-size: 12px;
}
.chest-detail.empty-detail .chest-detail-title {
  color: #ffe082;
  margin-bottom: 4px;
}
.chest-detail-glyph {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 8px;
  border: 2px solid var(--rarity, #a1887f);
  background: #3e2723;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--rarity, #ffe082);
  box-shadow: 0 0 12px color-mix(in srgb, var(--rarity, #ffe082) 25%, transparent);
}
.chest-detail-main { min-width: 0; flex: 1; }
.chest-detail-title {
  font-size: 15px;
  font-weight: bold;
  margin-bottom: 4px;
}
.chest-detail-line {
  font-size: 12px;
  color: #d7ccc8;
  line-height: 1.4;
}

/* 裂隙休整条：盖住技能栏，避免按钮与技能格叠在一起 */
.intermission-bar {
  position: absolute;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(520px, calc(100% - 24px));
  z-index: 55;
  pointer-events: auto;
}
.intermission-bar.hidden { display: none; }
.intermission-inner {
  padding: 14px 16px 16px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(18, 22, 30, 0.97), rgba(10, 12, 18, 0.95));
  border: 2px solid rgba(114, 230, 162, 0.65);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.55);
}
.intermission-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}
.intermission-title {
  font-weight: 700;
  color: #B9FFD4;
  font-size: 16px;
}
.intermission-sub {
  color: #BDB6C5;
  font-size: 12px;
}
.intermission-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.inter-chip {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 13px;
  color: #FFE69B;
}
.intermission-actions {
  display: flex;
  gap: 10px;
}
.intermission-actions .mc-btn {
  flex: 1;
  min-height: 46px;
  font-size: 15px;
  pointer-events: auto;
}
.mc-btn-gold {
  background: linear-gradient(180deg, #c9a227, #8a6d12);
  border-color: #5c4808;
  color: #fff8e1;
}
.mc-btn-gold:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
body.mobile-mode .intermission-bar {
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  width: min(520px, calc(100% - 16px));
}
#mobile-portal-return {
  right: calc(132px + env(safe-area-inset-right, 0px));
  left: auto;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  min-width: 72px;
  min-height: 52px;
  background: rgba(40, 100, 60, 0.85);
}
#mobile-portal-continue {
  right: calc(132px + env(safe-area-inset-right, 0px));
  left: auto;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  min-width: 72px;
  min-height: 52px;
  background: rgba(120, 90, 20, 0.85);
}
.mobile-portal.hidden { display: none !important; }

body.mobile-mode.run-intermission #mobile-interact-btn {
  right: calc(24px + env(safe-area-inset-right, 0px));
  bottom: calc(168px + env(safe-area-inset-bottom, 0px));
  min-width: 88px;
  min-height: 56px;
  font-size: 17px;
  z-index: 35;
}
body.mobile-mode.run-intermission #mobile-portal-return {
  right: calc(24px + env(safe-area-inset-right, 0px));
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}
body.mobile-mode.run-intermission #mobile-portal-continue {
  right: calc(24px + env(safe-area-inset-right, 0px));
  bottom: calc(92px + env(safe-area-inset-bottom, 0px));
}

