:root {
  color-scheme: dark;
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
  --bg: #090b14;
  --panel: rgba(18, 24, 40, 0.94);
  --panel-strong: #161d33;
  --text: #f3f6ff;
  --muted: #90a2c8;
  --accent: #73f0b4;
  --accent-2: #ffcf6b;
  --danger: #ff5d7a;
  --gold: #f7b731;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #1a2341 0%, var(--bg) 60%);
  color: var(--text);
  transition: background 0.8s ease;
}

/* ===== 按钮基础 ===== */
button {
  font: inherit;
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease;
}

button:active:not(:disabled) {
  transform: scale(0.94);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* 点击涟漪 */
button::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--ripple-x, 50%) var(--ripple-y, 50%), rgba(255,255,255,0.3) 0%, transparent 70%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

button:active::after {
  opacity: 1;
  transition: opacity 0s;
}

.action-button.rare {
  background: linear-gradient(135deg, #f2d45e, #f7a623);
  color: #111;
  box-shadow: 0 0 20px rgba(247, 166, 35, 0.2);
}

.action-button.rare:hover {
  box-shadow: 0 0 30px rgba(247, 166, 35, 0.4);
  transform: translateY(-2px);
}

/* ===== 应用容器 ===== */
.app-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px;
  animation: fadeIn 0.6s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== 顶栏 ===== */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-controls label,
.topbar-controls select {
  color: var(--text);
}

.topbar-controls select {
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  padding: 8px 10px;
  transition: border-color 0.3s, box-shadow 0.3s;
  cursor: pointer;
}

.topbar-controls select:hover {
  border-color: rgba(115, 240, 180, 0.4);
}

.topbar-controls select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(115, 240, 180, 0.15);
}

.topbar-controls select option {
  color: var(--text);
  background: rgba(18, 24, 40, 0.98);
}

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
  font-size: 0.8rem;
}

h1, h2 {
  margin: 0;
}

.ghost-button {
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(115, 240, 180, 0.12);
  color: var(--accent);
  border: 1px solid rgba(115, 240, 180, 0.15);
  transition: all 0.25s ease;
}

.ghost-button:hover {
  background: rgba(115, 240, 180, 0.22);
  border-color: rgba(115, 240, 180, 0.35);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(115, 240, 180, 0.12);
}

/* ===== HUD 网格 ===== */
.hud-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.25);
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.panel:hover {
  border-color: rgba(255,255,255,0.14);
}

/* ===== 角色面板 ===== */
.stat-list {
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.stat-list::-webkit-scrollbar {
  width: 4px;
}

.stat-list::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.04);
  border-radius: 4px;
}

.stat-list::-webkit-scrollbar-thumb {
  background: rgba(115, 240, 180, 0.3);
  border-radius: 4px;
}

.stat-list > div {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  transition: background 0.3s ease, padding-left 0.3s ease;
  border-radius: 6px;
  padding-left: 4px;
}

.stat-list > div:last-child { border-bottom: none; }

.stat-list > div:hover {
  background: rgba(255,255,255,0.03);
  padding-left: 10px;
}

.stat-list span {
  color: var(--muted);
}

/* 血量闪烁 */
#playerHp {
  transition: color 0.3s ease;
}

#playerHp.low {
  color: var(--danger);
  animation: pulseDanger 0.8s ease-in-out infinite;
}

@keyframes pulseDanger {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ===== 层级进度 ===== */
.big-label {
  font-size: 1.3rem;
  margin-bottom: 10px;
  color: var(--accent-2);
  transition: all 0.3s ease;
}

.progress-line {
  color: var(--muted);
  margin-bottom: 12px;
}

.room-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.room-badge {
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.84rem;
  background: rgba(255,255,255,0.08);
  transition: all 0.3s ease;
  cursor: default;
}

.room-badge:hover {
  background: rgba(255,255,255,0.14);
}

.room-badge.current {
  background: rgba(115, 240, 180, 0.2);
  color: var(--accent);
  box-shadow: 0 0 20px rgba(115, 240, 180, 0.1);
  animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 15px rgba(115, 240, 180, 0.05); }
  50% { box-shadow: 0 0 30px rgba(115, 240, 180, 0.2); }
}

/* ===== 遗物面板 ===== */
.relic-panel {
  margin-bottom: 16px;
}

.relic-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  min-height: 44px;
  align-items: center;
}

.relic-badge {
  display: inline-flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(44, 57, 90, 0.9);
  border: 1px solid rgba(255,255,255,0.08);
  color: #dbe4ff;
  font-size: 0.85rem;
  transition: all 0.3s ease;
  cursor: default;
  animation: relicAppear 0.5s ease;
}

@keyframes relicAppear {
  from { opacity: 0; transform: scale(0.8) rotate(-6deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}

.relic-badge:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 8px 25px rgba(0,0,0,0.3);
  border-color: rgba(255,255,255,0.2);
}

.relic-badge.rare {
  background: linear-gradient(135deg, rgba(247,166,35,0.16), rgba(255,255,255,0.08));
  border-color: rgba(247,166,35,0.35);
  color: var(--gold);
}

/* ===== 主事件面板 ===== */
.main-panel {
  margin-bottom: 16px;
  min-height: 200px;
}

.event-title {
  font-size: 1.3rem;
  margin: 10px 0 6px;
  color: var(--accent);
  transition: all 0.3s ease;
}

.event-text {
  color: var(--muted);
  line-height: 1.7;
  min-height: 54px;
  transition: all 0.3s ease;
}

/* ===== 操作区 ===== */
.action-area {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  min-height: 50px;
}

.action-button {
  padding: 10px 18px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3455ff, #6f7cff);
  color: white;
  font-weight: 500;
  box-shadow: 0 4px 15px rgba(52, 85, 255, 0.25);
  transition: all 0.2s ease;
  border: 1px solid rgba(255,255,255,0.06);
}

.action-button:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(52, 85, 255, 0.35);
}

.action-button.secondary {
  background: linear-gradient(135deg, #2f6f53, #58b57c);
  box-shadow: 0 4px 15px rgba(47, 111, 83, 0.25);
}

.action-button.secondary:hover:not(:disabled) {
  box-shadow: 0 8px 30px rgba(47, 111, 83, 0.4);
}

.action-button.danger {
  background: linear-gradient(135deg, #b53b56, #ff5d7a);
  box-shadow: 0 4px 15px rgba(181, 59, 86, 0.3);
}

.action-button.danger:hover:not(:disabled) {
  box-shadow: 0 8px 30px rgba(181, 59, 86, 0.45);
}

.action-button.warning {
  background: linear-gradient(135deg, #c77d1e, #f7b731);
  color: #1a1a2e;
  box-shadow: 0 4px 15px rgba(199, 125, 30, 0.3);
}

.action-button.warning:hover:not(:disabled) {
  box-shadow: 0 8px 30px rgba(199, 125, 30, 0.45);
}

/* ===== 模态框 ===== */
.modal.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  overflow: auto;
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
  animation: backdropIn 0.3s ease;
}

@keyframes backdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  position: relative;
  width: min(92vw, 520px);
  max-height: 90vh;
  overflow-y: auto;
  background: rgba(15, 22, 44, 0.98);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  z-index: 10;
  animation: contentIn 0.35s ease;
}

@keyframes contentIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-close {
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1.6rem;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 8px;
  transition: background 0.2s;
  line-height: 1;
}

.modal-close:hover {
  background: rgba(255,255,255,0.08);
}

/* ===== 条件列表 ===== */
.conditions-list {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.condition-item {
  padding: 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  transition: all 0.3s ease;
}

.condition-item:hover {
  background: rgba(255,255,255,0.07);
  transform: translateX(4px);
}

.condition-item.achieved {
  border-color: rgba(115, 240, 180, 0.35);
  background: rgba(115, 240, 180, 0.08);
}

.condition-item.achieved strong {
  color: var(--accent);
}

.condition-item strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent-2);
}

.condition-item p {
  margin: 0;
  color: var(--muted);
}

.condition-progress {
  margin-top: 8px;
  color: var(--text);
  font-size: 0.95rem;
}

/* ===== 日志 ===== */
.log-panel {
  max-height: 200px;
  overflow-y: auto;
}

.log-panel::-webkit-scrollbar {
  width: 4px;
}

.log-panel::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.04);
  border-radius: 4px;
}

.log-panel::-webkit-scrollbar-thumb {
  background: rgba(115, 240, 180, 0.3);
  border-radius: 4px;
}

.log-list {
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
  margin: 8px 0 0;
  list-style: none;
}

.log-list li {
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  animation: logSlide 0.3s ease;
  position: relative;
  padding-left: 12px;
}

.log-list li::before {
  content: '▸';
  position: absolute;
  left: -8px;
  color: var(--accent);
  opacity: 0.5;
}

@keyframes logSlide {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

.log-list li:first-child {
  border-bottom: none;
}

/* ===== 统计面板 ===== */
.stats-panel .stat-list > div {
  padding: 4px 0;
}

/* ===== 战斗特效 ===== */
/* 攻击闪白 */
@keyframes hitFlash {
  0% { background-color: rgba(255,255,255,0.3); }
  100% { background-color: transparent; }
}

.hit-flash {
  animation: hitFlash 0.3s ease;
}

/* 屏幕震动 */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px) rotate(-0.5deg); }
  40% { transform: translateX(8px) rotate(0.5deg); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.shake {
  animation: shake 0.3s ease;
}

/* 伤害数字飘出 */
.damage-float {
  position: fixed;
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--danger);
  pointer-events: none;
  z-index: 100;
  animation: floatUp 0.9s ease forwards;
  text-shadow: 0 0 30px rgba(255, 93, 122, 0.4);
}

.damage-float.heal {
  color: var(--accent);
  text-shadow: 0 0 30px rgba(115, 240, 180, 0.4);
}

.damage-float.shield {
  color: #6fc3ff;
  text-shadow: 0 0 30px rgba(111, 195, 255, 0.4);
}

@keyframes floatUp {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-80px) scale(1.3); }
}

/* ===== 层级横幅 ===== */
.floor-banner {
  text-align: center;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--accent-2);
  padding: 20px;
  animation: bannerIn 0.6s ease, bannerOut 0.6s ease 0.9s forwards;
  text-shadow: 0 0 60px rgba(247,183,49,0.3);
}

@keyframes bannerIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes bannerOut {
  to { opacity: 0; transform: scale(1.2); }
}

/* ============================================================
   图鉴样式
   ============================================================ */

/* ===== 图鉴分类按钮 ===== */
.encyclopedia-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  justify-content: center;
}

.encyclopedia-categories .category-btn {
  padding: 10px 20px;
  border-radius: 999px;
  background: rgba(115, 240, 180, 0.12);
  color: var(--accent);
  border: 1px solid rgba(115, 240, 180, 0.15);
  transition: all 0.25s ease;
  font-size: 0.95rem;
  cursor: pointer;
}

.encyclopedia-categories .category-btn:hover {
  background: rgba(115, 240, 180, 0.22);
  border-color: rgba(115, 240, 180, 0.35);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(115, 240, 180, 0.12);
}

.encyclopedia-categories .category-btn.active {
  background: rgba(115, 240, 180, 0.25);
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(115, 240, 180, 0.15);
}

/* ===== 图鉴内容切换动画 ===== */
#encyclopediaList {
  min-height: 60px;
}

#encyclopediaList .condition-item {
  animation: itemFadeIn 0.3s ease forwards;
  opacity: 0;
  transform: translateY(10px);
}

/* 每个条目依次出现，延迟递增 */
#encyclopediaList .condition-item:nth-child(1) { animation-delay: 0.05s; }
#encyclopediaList .condition-item:nth-child(2) { animation-delay: 0.08s; }
#encyclopediaList .condition-item:nth-child(3) { animation-delay: 0.11s; }
#encyclopediaList .condition-item:nth-child(4) { animation-delay: 0.14s; }
#encyclopediaList .condition-item:nth-child(5) { animation-delay: 0.17s; }
#encyclopediaList .condition-item:nth-child(6) { animation-delay: 0.20s; }
#encyclopediaList .condition-item:nth-child(7) { animation-delay: 0.23s; }
#encyclopediaList .condition-item:nth-child(8) { animation-delay: 0.26s; }
#encyclopediaList .condition-item:nth-child(9) { animation-delay: 0.29s; }
#encyclopediaList .condition-item:nth-child(10) { animation-delay: 0.32s; }
#encyclopediaList .condition-item:nth-child(11) { animation-delay: 0.35s; }
#encyclopediaList .condition-item:nth-child(12) { animation-delay: 0.38s; }
#encyclopediaList .condition-item:nth-child(13) { animation-delay: 0.41s; }
#encyclopediaList .condition-item:nth-child(14) { animation-delay: 0.44s; }
#encyclopediaList .condition-item:nth-child(15) { animation-delay: 0.47s; }

@keyframes itemFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== 切换动画类 ===== */
.fade-out {
  animation: fadeOut 0.2s ease forwards !important;
}

.fade-in {
  animation: fadeInContent 0.35s ease forwards !important;
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.96);
  }
}

@keyframes fadeInContent {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ===== 返回按钮 ===== */
#encyclopediaBackButton {
  transition: all 0.3s ease;
}

#encyclopediaBackButton:hover {
  transform: translateX(-3px);
}

/* ===== 图鉴模态框内容过渡 ===== */
.modal-content .encyclopedia-categories,
.modal-content #encyclopediaList {
  transition: all 0.3s ease;
}

/* ===== 更新日志 ===== */
.changelog-list {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
  max-height: 500px;
  overflow-y: auto;
  padding-right: 4px;
}

.changelog-list::-webkit-scrollbar {
  width: 4px;
}

.changelog-list::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.04);
  border-radius: 4px;
}

.changelog-list::-webkit-scrollbar-thumb {
  background: rgba(115, 240, 180, 0.3);
  border-radius: 4px;
}

.changelog-item {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  transition: all 0.3s ease;
}

.changelog-item:hover {
  background: rgba(255,255,255,0.07);
  transform: translateX(4px);
}

.changelog-item .version {
  color: var(--accent-2);
  font-weight: 700;
  font-size: 1.1rem;
  display: block;
  margin-bottom: 6px;
}

.changelog-item ul {
  margin: 4px 0 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.8;
}

.changelog-item ul li {
  list-style: disc;
}

.changelog-item ul li::marker {
  color: var(--accent);
}

/* ============================================================
   关闭动画
   ============================================================ */
@keyframes fadeOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.95);
  }
}

/* ============================================================
   响应式 - 平板 & 手机
   ============================================================ */

@media (max-width: 860px) {
  .hud-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .topbar-controls {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .topbar-controls .ghost-button {
    padding: 6px 12px;
    font-size: 0.78rem;
  }

  .topbar-controls select {
    padding: 6px 8px;
    font-size: 0.78rem;
  }

  .app-shell {
    padding: 12px;
  }

  .panel {
    padding: 14px;
  }

  .panel h2 {
    font-size: 1rem;
  }

  .action-button {
    padding: 8px 14px;
    font-size: 0.85rem;
  }

  .stat-list {
    max-height: 260px;
  }

  .stat-list > div {
    padding: 5px 0;
    font-size: 0.85rem;
  }

  .room-list {
    gap: 5px;
  }

  .room-badge {
    padding: 4px 8px;
    font-size: 0.7rem;
  }

  .action-area {
    gap: 8px;
  }

  .action-area .action-button {
    flex: 1 1 auto;
    min-width: 70px;
    text-align: center;
    font-size: 0.8rem;
    padding: 8px 10px;
  }

  .relic-list {
    gap: 6px;
  }

  .relic-badge {
    padding: 6px 10px;
    font-size: 0.75rem;
  }

  .encyclopedia-categories {
    gap: 6px;
  }

  .encyclopedia-categories .category-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  .modal-content {
    padding: 16px;
    width: min(96vw, 400px);
  }

  .log-list li {
    font-size: 0.8rem;
    padding: 3px 0 3px 12px;
  }

  /* ===== 商店按钮修复 ===== */
  #shopPanel .action-area .action-button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
    font-size: 0.8rem;
  }

  .action-button[data-action="skip-shop"] {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 0.8rem;
  }

  /* ===== 战斗按钮 ===== */
  #battlePanel .action-button {
    min-width: 80px;
    font-size: 0.8rem;
    padding: 8px 12px;
  }

  /* ===== 更新日志 ===== */
  .changelog-item {
    padding: 10px 12px;
  }

  .changelog-item .version {
    font-size: 0.95rem;
  }

  .changelog-item ul {
    font-size: 0.85rem;
    padding-left: 16px;
  }
}

@media (max-width: 480px) {
  .app-shell {
    padding: 8px;
  }

  .panel {
    padding: 10px;
  }

  .panel h2 {
    font-size: 0.9rem;
  }

  .stat-list > div {
    font-size: 0.75rem;
    padding: 4px 0;
  }

  .stat-list {
    max-height: 220px;
  }

  .action-area .action-button {
    font-size: 0.7rem;
    padding: 6px 8px;
    min-width: 60px;
  }

  .topbar h1 {
    font-size: 1.2rem;
  }

  .topbar .eyebrow {
    font-size: 0.6rem;
  }

  .topbar-controls .ghost-button {
    padding: 4px 8px;
    font-size: 0.65rem;
  }

  .topbar-controls select {
    padding: 4px 6px;
    font-size: 0.65rem;
  }

  .modal-content {
    padding: 12px;
    width: min(98vw, 320px);
  }

  .modal-content h3 {
    font-size: 1rem;
  }

  .relic-badge {
    padding: 4px 8px;
    font-size: 0.65rem;
  }

  .room-badge {
    padding: 3px 6px;
    font-size: 0.6rem;
  }

  .log-list li {
    font-size: 0.7rem;
    padding: 2px 0 2px 10px;
  }

  .event-title {
    font-size: 1rem;
  }

  .event-text {
    font-size: 0.85rem;
  }

  .big-label {
    font-size: 1rem;
  }

  .progress-line {
    font-size: 0.8rem;
  }

  .damage-float {
    font-size: 1.8rem !important;
  }

  .encyclopedia-categories .category-btn {
    padding: 4px 10px;
    font-size: 0.7rem;
  }

  .condition-item {
    padding: 10px;
  }

  .condition-item strong {
    font-size: 0.85rem;
  }

  .condition-item p {
    font-size: 0.75rem;
  }

  .changelog-item {
    padding: 8px 10px;
  }

  .changelog-item .version {
    font-size: 0.85rem;
  }

  .changelog-item ul {
    font-size: 0.75rem;
    padding-left: 14px;
  }

  /* ===== 商店按钮小屏适配 ===== */
  #shopPanel .action-area .action-button {
    min-height: 36px;
    font-size: 0.7rem;
    padding: 6px 8px;
  }

  .action-button[data-action="skip-shop"] {
    min-height: 36px;
    font-size: 0.7rem;
    padding: 6px 12px;
  }
}

/* ============================================================
   作弊面板样式
   ============================================================ */

/* 密码输入框容器 */
.cheat-password-wrapper {
  display: flex;
  gap: 10px;
  align-items: center;
}

.cheat-password-input {
  flex: 1;
  padding: 12px 16px;
  border-radius: 10px;
  border: 2px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.4);
  color: #fff;
  font-size: 1rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  outline: none;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  letter-spacing: 2px;
}

.cheat-password-input:focus {
  border-color: var(--danger);
  box-shadow: 0 0 25px rgba(255, 93, 122, 0.15);
}

.cheat-password-input::placeholder {
  color: rgba(255,255,255,0.3);
  letter-spacing: 0;
}

/* 密码显示切换按钮 */
.cheat-password-toggle {
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--muted);
  font-size: 1.1rem;
  transition: all 0.25s ease;
  cursor: pointer;
  flex-shrink: 0;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cheat-password-toggle:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.2);
  transform: scale(1.05);
}

.cheat-password-toggle:active {
  transform: scale(0.95);
}

/* 密码确认按钮 */
.cheat-password-confirm {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--danger), #cc4a6a);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 20px rgba(255, 93, 122, 0.25);
  margin-top: 10px;
}

.cheat-password-confirm:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(255, 93, 122, 0.35);
}

.cheat-password-confirm:active {
  transform: scale(0.97);
}

/* 密码错误提示 */
.cheat-password-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 10px;
  text-align: center;
  display: none;
  animation: shake 0.4s ease;
  background: rgba(255, 93, 122, 0.1);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 93, 122, 0.2);
}

/* 作弊面板内的小标题 */
.cheat-section {
  margin-bottom: 16px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.03);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  transition: border-color 0.3s ease;
}

.cheat-section:hover {
  border-color: rgba(255,255,255,0.12);
}

.cheat-section-title {
  margin: 0 0 12px 0;
  color: var(--accent-2);
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 数值修改网格 */
.cheat-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cheat-stat-item {
  display: flex;
  flex-direction: column;
}

.cheat-stat-item label {
  color: var(--muted);
  font-size: 0.7rem;
  margin-bottom: 2px;
  letter-spacing: 0.5px;
}

.cheat-stat-item input {
  width: 100%;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.35);
  color: #fff;
  font-size: 0.9rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  outline: none;
}

.cheat-stat-item input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(115, 240, 180, 0.08);
}

.cheat-stat-item input[type="number"]::-webkit-inner-spin-button,
.cheat-stat-item input[type="number"]::-webkit-outer-spin-button {
  opacity: 0.5;
}

/* 下拉选择框 */
.cheat-select {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.35);
  color: #fff;
  font-size: 0.9rem;
  margin-bottom: 8px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.3s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.cheat-select:focus {
  border-color: var(--accent);
}

.cheat-select option {
  background: #1a1a2e;
  color: #fff;
}

/* 作弊按钮 - 添加遗物/增益 */
.cheat-add-btn {
  width: 100%;
  padding: 8px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
}

.cheat-add-btn:hover {
  transform: translateY(-2px);
}

.cheat-add-btn:active {
  transform: scale(0.97);
}

.cheat-add-btn.relic {
  background: linear-gradient(135deg, #2f6f53, #58b57c);
  color: #fff;
  box-shadow: 0 4px 15px rgba(47, 111, 83, 0.25);
}

.cheat-add-btn.relic:hover {
  box-shadow: 0 8px 25px rgba(47, 111, 83, 0.4);
}

.cheat-add-btn.bonus {
  background: linear-gradient(135deg, #b8860b, #f7b731);
  color: #1a1a2e;
  box-shadow: 0 4px 15px rgba(184, 134, 11, 0.25);
}

.cheat-add-btn.bonus:hover {
  box-shadow: 0 8px 25px rgba(184, 134, 11, 0.4);
}

/* 应用数值按钮 */
.cheat-apply-btn {
  width: 100%;
  height: 100%;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 8px;
  background: linear-gradient(135deg, #3455ff, #6f7cff);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 15px rgba(52, 85, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cheat-apply-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(52, 85, 255, 0.35);
}

.cheat-apply-btn:active {
  transform: scale(0.97);
}

/* 密码层提示文字 */
.cheat-password-hint {
  color: var(--muted);
  text-align: center;
  margin-bottom: 20px;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* 密码输入行 */
.cheat-password-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* 作弊面板标题 */
.cheat-title {
  color: var(--danger);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 移动端适配 */
@media (max-width: 480px) {
  .cheat-stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  
  .cheat-stat-item input {
    padding: 4px 8px;
    font-size: 0.8rem;
  }
  
  .cheat-stat-item label {
    font-size: 0.65rem;
  }
  
  .cheat-password-row {
    flex-wrap: wrap;
  }
  
  .cheat-password-input {
    font-size: 0.9rem;
    padding: 10px 12px;
  }
  
  .cheat-section {
    padding: 10px 12px;
  }
}
/* 关闭动画 - 和打开相反 */
@keyframes contentOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(20px) scale(0.96); }
}

@keyframes backdropOut {
  from { opacity: 1; }
  to { opacity: 0; }
}
/* ============================================================
   移动端布局调整：遗物和增益移到战斗日志下面
   ============================================================ */

@media (max-width: 768px) {
  /* 使用 flex 布局控制顺序 */
  .app-shell {
    display: flex;
    flex-direction: column;
  }

  /* 所有 panel 默认 order 为 0，按 DOM 顺序排列 */
  .app-shell > .panel {
    order: 0;
  }

  /* 战斗日志移到最前面（在事件面板之后） */
  .app-shell > .log-panel {
    order: 1;
  }

  /* 遗物和增益移到日志后面 */
  .app-shell > .relic-panel {
    order: 2;
  }

  .app-shell > .bonus-panel {
    order: 3;
  }

  /* 记录面板保持在最后 */
  .app-shell > .stats-panel {
    order: 4;
  }

  /* HUD 网格保持原有顺序（在顶部） */
  .app-shell > .hud-grid {
    order: 0;
  }

  /* 主事件面板在日志之前 */
  .app-shell > .main-panel {
    order: 0;
  }
}

/* 更小屏幕的微调 */
@media (max-width: 480px) {
  .app-shell > .log-panel {
    order: 1;
  }
  .app-shell > .relic-panel {
    order: 2;
  }
  .app-shell > .bonus-panel {
    order: 3;
  }
  .app-shell > .stats-panel {
    order: 4;
  }
}
/* ============================================================
   自定义难度面板
   ============================================================ */

.custom-difficulty-panel {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 16px 20px;
  margin-bottom: 16px;
  animation: fadeIn 0.3s ease;
}

.custom-difficulty-panel.hidden {
  display: none;
}

.custom-difficulty-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px 20px;
}

.custom-diff-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.custom-diff-item label {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.3px;
}

/* 输入框样式 - 替代原来的滑块 */
.custom-diff-item input[type="number"] {
  width: 100%;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(0,0,0,0.35);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  appearance: textfield;          /* 标准属性 */
  -moz-appearance: textfield;     /* Firefox 兼容 */
}

.custom-diff-item input[type="number"]::-webkit-outer-spin-button,
.custom-diff-item input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.custom-diff-item input[type="number"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(115, 240, 180, 0.1);
}

.custom-diff-item input[type="number"]:hover {
  border-color: rgba(255,255,255,0.2);
}

.custom-diff-item span {
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: right;
}

/* 响应式 */
@media (max-width: 600px) {
  .custom-difficulty-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  
  .custom-diff-item label {
    font-size: 0.65rem;
  }
  
  .custom-diff-item input[type="number"] {
    font-size: 0.8rem;
    padding: 4px 8px;
  }
  
  .custom-diff-item span {
    font-size: 0.75rem;
  }
}

@media (max-width: 400px) {
  .custom-difficulty-grid {
    grid-template-columns: 1fr;
  }
}
/* 自定义难度面板 - 折叠头部 */
.custom-difficulty-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  padding: 2px 0;
}

.custom-difficulty-header span {
  color: var(--accent-2);
  font-weight: 600;
  font-size: 0.95rem;
}

.collapse-toggle {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--muted);
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.25s ease;
}

.collapse-toggle:hover {
  background: rgba(255,255,255,0.12);
  color: var(--text);
}

/* 折叠主体 - 动画过渡 */
.custom-difficulty-body {
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.3s ease, margin-top 0.3s ease;
  max-height: 400px;
  opacity: 1;
  margin-top: 12px;
}

.custom-difficulty-body.collapsed {
  max-height: 0 !important;
  opacity: 0;
  margin-top: 0;
  padding-top: 0;
}

/* 响应式 */
@media (max-width: 600px) {
  .custom-difficulty-header span {
    font-size: 0.8rem;
  }
  .collapse-toggle {
    font-size: 0.65rem;
    padding: 3px 10px;
  }
}
/* 自定义难度警告提示 */
.custom-difficulty-warning {
  color: var(--danger);
  font-size: 0.6rem;
  padding: 4px 12px;
  border-radius: 6px;
  background: rgba(255, 93, 122, 0.1);
  border: 1px solid rgba(255, 93, 122, 0.15);
  animation: warningFade 0.3s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.custom-difficulty-warning.hidden {
  display: none !important;
}

@keyframes warningFade {
  from { opacity: 0; transform: translateX(-4px); }
  to { opacity: 1; transform: translateX(0); }
}
/* ============================================================
   侧边栏
   ============================================================ */

/* 侧边栏切换按钮 - 固定在右下角 */
.sidebar-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--panel), rgba(18, 24, 40, 0.95));
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text);
  font-size: 1.4rem;
  cursor: pointer;
  z-index: 9999;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}

.sidebar-toggle:hover {
  transform: scale(1.08);
  border-color: rgba(115, 240, 180, 0.3);
  box-shadow: 0 6px 32px rgba(0,0,0,0.5);
}

.sidebar-toggle:active {
  transform: scale(0.94);
}

/* 侧边栏遮罩 */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* 侧边栏主体 */
.sidebar {
  position: fixed;
  top: 0;
  right: -340px;
  width: 320px;
  max-width: 85vw;
  height: 100vh;
  background: var(--panel);
  border-left: 1px solid rgba(255,255,255,0.08);
  z-index: 10000;
  padding: 0;
  transition: right 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: -8px 0 40px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(16px);
}

.sidebar.open {
  right: 0;
}

/* 侧边栏头部 */
.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 22px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.sidebar-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent-2);
}

.sidebar-close {
  background: rgba(255,255,255,0.06);
  border: none;
  color: var(--muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-close:hover {
  background: rgba(255,255,255,0.12);
  color: var(--text);
  transform: rotate(90deg);
}

/* 侧边栏内容区 */
.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.sidebar-body::-webkit-scrollbar {
  width: 3px;
}

.sidebar-body::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-body::-webkit-scrollbar-thumb {
  background: rgba(115, 240, 180, 0.2);
  border-radius: 4px;
}

/* 占位提示 */
.sidebar-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.sidebar-placeholder span {
  font-size: 2.8rem;
  margin-bottom: 12px;
  opacity: 0.4;
}

.sidebar-placeholder p {
  margin: 0 0 4px;
  font-size: 0.95rem;
  color: var(--text);
}

.sidebar-placeholder small {
  font-size: 0.75rem;
  color: var(--muted);
  opacity: 0.6;
}

/* ===== 移动端适配 ===== */
@media (max-width: 480px) {
  .sidebar-toggle {
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
    bottom: 16px;
    right: 16px;
  }
  
  .sidebar {
    width: 280px;
    right: -300px;
  }
  
  .sidebar-header {
    padding: 16px 18px 12px;
  }
  
  .sidebar-title {
    font-size: 0.95rem;
  }
  
  .sidebar-body {
    padding: 12px 16px;
  }
  
  .sidebar-placeholder span {
    font-size: 2.2rem;
  }
  
  .sidebar-placeholder p {
    font-size: 0.85rem;
  }
}