/* ═══════ 《凡人·长生劫》修真暗色调主题 ═══════ */
:root {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-panel: #0f3460;
  --bg-card: #1e2746;
  --text-primary: #e0d8c8;
  --text-dim: #8b8a7a;
  --text-title: #c9a96e;
  --hp-color: #e74c3c;
  --mp-color: #3498db;
  --sp-color: #9b59b6;
  --danger: #e74c3c;
  --safe: #2ecc71;
  --warn: #f39c12;
  --btn-bg: #1a1a2e;
  --btn-hover: #0f3460;
  --border: #2a3a5c;
  --radius: 6px;
  --font-game: 'SimSun', 'Noto Serif SC', 'STSong', serif;
}

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

body {
  font-family: var(--font-game);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  line-height: 1.8;
}

/* ═══ 标题栏 ═══ */
#title-bar {
  height: 44px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  flex-shrink: 0;
  z-index: 10;
}
#game-title {
  font-size: 18px;
  font-weight: bold;
  color: var(--text-title);
  letter-spacing: 2px;
}
#title-bar nav {
  display: flex;
  gap: 10px;
}
#title-bar button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 4px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font-game);
  font-size: 13px;
  transition: all .2s;
}
#title-bar button:hover {
  background: var(--btn-hover);
  color: var(--text-primary);
}

/* ═══ 主容器 ═══ */
#game-container {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ═══ 事件区 ═══ */
#event-area {
  flex: 7;
  overflow-y: auto;
  padding: 24px 20px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
#event-text {
  font-size: 16px;
  white-space: pre-wrap;
  min-height: 120px;
  transition: opacity .3s;
}
#event-text .fade { opacity: 0; }
#event-text .gold { color: var(--text-title); }
#event-text .red { color: var(--danger); }
#event-text .blue { color: var(--mp-color); }
#event-text .purple { color: var(--sp-color); }
#event-text .green { color: var(--safe); }
#event-text .dim { color: var(--text-dim); }

#event-log {
  flex: 1;
  overflow-y: auto;
  font-size: 13px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 8px;
}
#event-log p {
  padding: 2px 0;
  border-bottom: 1px solid rgba(42,58,92,.3);
}

/* ═══ 状态面板 ═══ */
#status-panel {
  flex: 3;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}
.stat-group { margin-bottom: 4px; }
.stat-label {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 3px;
  display: flex;
  justify-content: space-between;
}
.stat-bar {
  height: 14px;
  background: var(--bg-primary);
  border-radius: 7px;
  overflow: hidden;
  position: relative;
}
.stat-fill {
  height: 100%;
  border-radius: 7px;
  transition: width .5s ease;
}
.stat-fill.hp { background: var(--hp-color); }
.stat-fill.mp { background: var(--mp-color); }
.stat-fill.sp { background: var(--sp-color); }

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(42,58,92,.4);
}
.info-row .label { color: var(--text-dim); }
.info-row .value { color: var(--text-title); font-weight: bold; }

/* ═══ 快捷按钮 ═══ */
#quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
  margin-top: 6px;
}
.quick-btn {
  background: var(--btn-bg);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 6px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font-game);
  font-size: 11px;
  transition: all .2s;
  text-align: center;
}
.quick-btn:hover {
  background: var(--btn-hover);
  border-color: var(--text-title);
}

/* ═══ 选项栏 ═══ */
#choice-bar {
  height: 64px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  padding: 8px 14px;
  flex-shrink: 0;
}
.choice-btn {
  flex: 1;
  background: var(--btn-bg);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font-game);
  font-size: 14px;
  transition: all .2s;
  padding: 0 8px;
}
.choice-btn:hover {
  background: var(--btn-hover);
  border-color: var(--text-title);
  transform: translateY(-1px);
}
.choice-btn:disabled {
  opacity: .3;
  cursor: not-allowed;
  transform: none;
}
.choice-btn.danger:hover { border-color: var(--danger); color: var(--danger); }

/* ═══ 模态窗 ═══ */
#modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,10,20,.85);
  z-index: 100;
  justify-content: center;
  align-items: center;
}
#modal-overlay.active { display: flex; }
#modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--text-title);
  border-radius: var(--radius);
  padding: 28px 24px;
  max-width: 520px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}
#modal-content h2 {
  color: var(--text-title);
  font-size: 20px;
  margin-bottom: 16px;
  text-align: center;
  letter-spacing: 2px;
}
#modal-content h3 {
  color: var(--text-title);
  font-size: 16px;
  margin-bottom: 12px;
}
#modal-content p { margin-bottom: 8px; font-size: 14px; }
#modal-content .actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  justify-content: center;
}
#modal-content .actions button {
  padding: 8px 20px;
  border: 1px solid var(--text-title);
  background: var(--btn-bg);
  color: var(--text-title);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font-game);
  font-size: 13px;
  transition: all .2s;
}
#modal-content .actions button:hover {
  background: var(--text-title);
  color: var(--bg-primary);
}

/* ═══ 进度条（修炼/炼丹） ═══ */
.progress-wrap {
  margin: 10px 0;
}
.progress-wrap .bar {
  height: 22px;
  background: var(--bg-primary);
  border-radius: 11px;
  overflow: hidden;
}
.progress-wrap .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--text-title), #e6c97a);
  border-radius: 11px;
  transition: width .3s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--bg-primary);
  font-weight: bold;
}

/* ═══ 战斗界面 ═══ */
.combat-stat {
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
  margin-bottom: 4px;
  background: var(--bg-card);
  border-radius: var(--radius);
  font-size: 13px;
}
.combat-stat .hp-bar {
  flex: 1;
  height: 10px;
  background: var(--bg-primary);
  border-radius: 5px;
  margin: 0 10px;
  overflow: hidden;
  align-self: center;
}
.combat-stat .hp-fill {
  height: 100%;
  background: var(--danger);
  border-radius: 5px;
  transition: width .5s;
}

/* ═══ 物品列表 ═══ */
.item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.item-row:hover { background: var(--btn-hover); }
.item-row .item-name { color: var(--text-title); }
.item-row .item-desc { color: var(--text-dim); font-size: 11px; }
.item-row .item-actions { display: flex; gap: 4px; }
.item-row .item-actions button {
  padding: 2px 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  border-radius: 3px;
  cursor: pointer;
  font-family: var(--font-game);
  font-size: 11px;
}
.item-row .item-actions button:hover {
  border-color: var(--text-title);
  color: var(--text-primary);
}

/* ═══ 标签页 ═══ */
.tabs { display: flex; gap: 0; margin-bottom: 10px; }
.tab-btn {
  flex: 1;
  padding: 6px 0;
  text-align: center;
  border: 1px solid var(--border);
  background: var(--btn-bg);
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--font-game);
  font-size: 11px;
  transition: all .2s;
}
.tab-btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.tab-btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.tab-btn.active { background: var(--btn-hover); color: var(--text-title); border-color: var(--text-title); }

/* ═══ 响应式（移动端） ═══ */
@media (max-width: 768px) {
  #status-panel { display: none; }
  #status-panel.mobile-show {
    display: flex;
    position: fixed;
    inset: 44px 0 64px 0;
    z-index: 50;
    border-left: none;
    background: rgba(22,33,62,.97);
    overflow-y: auto;
  }
  #event-area { flex: 1; padding: 14px; }
  #event-text { font-size: 14px; }
  #choice-bar { height: 56px; padding: 6px; }
  .choice-btn { font-size: 12px; }
  #mobile-stat-bar {
    display: flex !important;
    height: 36px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    align-items: center;
    justify-content: space-around;
    font-size: 11px;
    color: var(--text-dim);
    flex-shrink: 0;
  }
  #mobile-stat-bar .mstat { display: flex; gap: 4px; align-items: center; }
}

/* Desktop: hide mobile stat bar */
#mobile-stat-bar { display: none; }

/* ═══ 炼丹温度条 ═══ */
.temp-bar {
  height: 28px;
  background: linear-gradient(90deg, #3498db, #2ecc71 40%, #f39c12 60%, #e74c3c);
  border-radius: 14px;
  position: relative;
  margin: 10px 0;
}
.temp-marker {
  position: absolute;
  top: -4px;
  width: 4px;
  height: 36px;
  background: #fff;
  border-radius: 2px;
  transition: left .3s;
  box-shadow: 0 0 8px rgba(255,255,255,.5);
}
.temp-zone {
  position: absolute;
  top: 2px;
  height: 24px;
  border: 2px dashed rgba(255,255,255,.6);
  border-radius: 12px;
}

/* ═══ 墓志铭 ═══ */
.tombstone {
  text-align: center;
  padding: 20px;
  color: var(--text-dim);
}
.tombstone h2 { color: var(--text-title); font-size: 22px; margin-bottom: 16px; }
.tombstone .epitaph {
  font-style: italic;
  color: var(--text-primary);
  font-size: 15px;
  line-height: 2;
  margin: 16px 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-primary);
}
.tombstone .stats { font-size: 12px; margin-top: 10px; }
.tombstone .stats span { margin: 0 8px; }