/* ============================================
   三国·后台纪元 — 三国志经典风格主题
   参考光荣《三国志》系列视觉语言
   配色：墨黑、朱红、金色（汉代尚色）
   字体：Ma Shan Zheng（书法标题） / Noto Serif SC（正文）
   ============================================ */

/* ---------- 基础重置 ---------- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --gold: #d4a017;
  --gold-light: #f0d68a;
  --gold-dark: #b8860b;
  --red: #8b0000;
  --red-light: #cc3333;
  --red-dark: #5c0000;
  --ink: #1a1a2e;
  --ink-light: #2a2a4e;
  --parchment: #f5e6c8;
  --parchment-dark: #d4c4a0;
  --jade: #2e8b57;
  --jade-light: #3cb371;
  --text-primary: #e8dcc8;
  --text-secondary: #c0b090;
  --text-muted: #8a7a6a;
  --border-gold: rgba(212, 160, 23, 0.4);
  --border-gold-light: rgba(212, 160, 23, 0.2);
  --bg-dark: rgba(10, 10, 26, 0.85);
  --bg-panel: rgba(20, 18, 40, 0.75);
  --shadow-gold: rgba(212, 160, 23, 0.3);
  --font-title: 'Ma Shan Zheng', 'ZCOOL XiaoWei', 'KaiTi', 'STKaiti', serif;
  --font-body: 'Noto Serif SC', 'SimSun', 'STSong', serif;
  --font-mono: 'Courier New', 'Consolas', monospace;
}

body {
  background: #0a0a1a;
  color: var(--text-primary);
  font-family: var(--font-body);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ============================================
   背景纹理 — 宣纸/古卷质感
   ============================================ */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(212, 160, 23, 0.015) 2px,
      rgba(212, 160, 23, 0.015) 3px
    );
  pointer-events: none;
  z-index: 9999;
}

/* ============================================
   开始界面
   ============================================ */
#start-screen {
  width: 100%;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

.start-bg {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(139, 0, 0, 0.3) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(212, 160, 23, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 20% 70%, rgba(46, 139, 87, 0.06) 0%, transparent 40%),
    linear-gradient(180deg, #0a0a1a 0%, #1a0a0a 30%, #0f0a1a 60%, #0a0a1a 100%);
}

/* 装饰性云纹图案 */
.start-bg::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(circle at 15% 20%, rgba(212, 160, 23, 0.04) 0%, transparent 30%),
    radial-gradient(circle at 85% 15%, rgba(212, 160, 23, 0.03) 0%, transparent 25%),
    radial-gradient(circle at 50% 50%, rgba(212, 160, 23, 0.02) 0%, transparent 40%);
  animation: bgPulse 8s ease-in-out infinite alternate;
}

@keyframes bgPulse {
  0% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* 装饰性网格 */
.start-bg::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    linear-gradient(rgba(212, 160, 23, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212, 160, 23, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.start-content {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

/* ---------- 标题区 ---------- */
.title-area {
  text-align: center;
  margin-bottom: 36px;
  animation: titleFadeIn 1.5s ease-out;
  position: relative;
}

@keyframes titleFadeIn {
  from { opacity: 0; transform: translateY(-30px); }
  to { opacity: 1; transform: translateY(0); }
}

.title-sub {
  color: var(--gold-dark);
  font-size: 14px;
  letter-spacing: 12px;
  margin-bottom: 8px;
  font-family: var(--font-body);
}

.title-main {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 64px;
  font-weight: 400;
  text-shadow:
    0 0 40px rgba(212, 160, 23, 0.5),
    0 0 80px rgba(212, 160, 23, 0.2),
    2px 2px 0 rgba(0, 0, 0, 0.5);
  letter-spacing: 16px;
  margin-bottom: 8px;
  animation: titleGlow 3s ease-in-out infinite alternate;
  line-height: 1.2;
}

@keyframes titleGlow {
  0% { text-shadow: 0 0 40px rgba(212, 160, 23, 0.5), 0 0 80px rgba(212, 160, 23, 0.2), 2px 2px 0 rgba(0,0,0,0.5); }
  100% { text-shadow: 0 0 60px rgba(212, 160, 23, 0.7), 0 0 120px rgba(212, 160, 23, 0.3), 2px 2px 0 rgba(0,0,0,0.5); }
}

.title-en {
  color: rgba(200, 180, 140, 0.35);
  font-size: 12px;
  letter-spacing: 8px;
  font-family: var(--font-mono);
  text-transform: uppercase;
}

/* ---------- 印章 ---------- */
.seal-deco {
  position: absolute;
  width: 80px;
  height: 80px;
  opacity: 0.85;
  filter: drop-shadow(0 0 8px rgba(192, 57, 43, 0.4));
  pointer-events: none;
}
.seal-start {
  top: -10px;
  right: -20px;
  animation: sealFloat 4s ease-in-out infinite alternate;
}

@keyframes sealFloat {
  0% { transform: rotate(-2deg); }
  100% { transform: rotate(2deg); }
}

/* ---------- 祥云分隔线 ---------- */
.divider {
  display: block;
  margin: 16px auto;
  width: min(400px, 80%);
  height: auto;
  opacity: 0.6;
}

/* ---------- 简介区 ---------- */
.intro-area {
  max-width: 700px;
  text-align: center;
  margin-bottom: 40px;
  animation: introFadeIn 2s ease-out 0.5s both;
}

@keyframes introFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.intro-text {
  margin-bottom: 28px;
}

.intro-text p {
  color: rgba(220, 210, 190, 0.75);
  font-size: 15px;
  line-height: 2;
  letter-spacing: 1px;
}

.intro-text .intro-highlight {
  color: var(--gold);
  font-size: 16px;
  font-weight: 600;
  text-shadow: 0 0 10px rgba(212, 160, 23, 0.25);
}

.intro-features {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.feature-item {
  background: rgba(212, 160, 23, 0.06);
  border: 1px solid rgba(212, 160, 23, 0.2);
  border-radius: 8px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(220, 210, 190, 0.7);
  font-size: 13px;
  transition: all 0.3s;
}

.feature-item:hover {
  background: rgba(212, 160, 23, 0.12);
  border-color: rgba(212, 160, 23, 0.5);
  transform: translateY(-2px);
  color: var(--gold-light);
}

.feature-icon {
  font-size: 18px;
}

/* ---------- 按钮区 ---------- */
.start-buttons {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
  animation: btnFadeIn 2s ease-out 1s both;
}

@keyframes btnFadeIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.start-btn {
  position: relative;
  background: linear-gradient(135deg, rgba(139, 0, 0, 0.4), rgba(139, 0, 0, 0.15));
  border: 2px solid var(--gold);
  color: var(--gold);
  padding: 16px 52px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 20px;
  font-family: var(--font-title);
  font-weight: 400;
  letter-spacing: 6px;
  transition: all 0.3s;
  box-shadow: 0 4px 20px rgba(212, 160, 23, 0.15), inset 0 1px 0 rgba(212, 160, 23, 0.1);
  overflow: hidden;
}

.start-btn::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(212, 160, 23, 0.1), transparent);
  transition: left 0.5s;
}

.start-btn:hover::before {
  left: 100%;
}

.start-btn:hover {
  background: linear-gradient(135deg, rgba(139, 0, 0, 0.6), rgba(139, 0, 0, 0.3));
  border-color: var(--gold-light);
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(212, 160, 23, 0.3), inset 0 1px 0 rgba(212, 160, 23, 0.2);
  color: var(--gold-light);
}

.start-btn:active {
  transform: translateY(-1px);
}

.start-btn.secondary {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(212, 160, 23, 0.3);
  color: rgba(212, 160, 23, 0.7);
  font-size: 16px;
  padding: 16px 36px;
  box-shadow: none;
}

.start-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 4px 15px rgba(212, 160, 23, 0.15);
}

.start-footer {
  color: rgba(255, 255, 255, 0.15);
  font-size: 11px;
  font-family: var(--font-mono);
}

/* ============================================
   游戏介绍弹窗
   ============================================ */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  position: relative;
  background: linear-gradient(135deg, #1a1028, #0f0a20);
  border: 2px solid var(--gold);
  border-radius: 8px;
  width: 90%;
  max-width: 640px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.8),
    0 0 40px rgba(212, 160, 23, 0.15),
    inset 0 0 60px rgba(139, 0, 0, 0.05);
  animation: modalSlideIn 0.4s ease-out;
}

.modal-content::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px; right: -1px; bottom: -1px;
  border: 1px solid rgba(212, 160, 23, 0.15);
  border-radius: 9px;
  pointer-events: none;
}

@keyframes modalSlideIn {
  from { transform: translateY(30px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-content::-webkit-scrollbar { width: 6px; }
.modal-content::-webkit-scrollbar-track { background: transparent; }
.modal-content::-webkit-scrollbar-thumb { background: rgba(212, 160, 23, 0.3); border-radius: 3px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 28px 16px;
  border-bottom: 1px solid rgba(212, 160, 23, 0.2);
}

.modal-header h2 {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 4px;
}

.modal-close {
  color: rgba(255, 255, 255, 0.3);
  font-size: 28px;
  cursor: pointer;
  transition: color 0.2s;
  line-height: 1;
}

.modal-close:hover {
  color: var(--gold-light);
}

.modal-body {
  padding: 20px 28px 28px;
}

.intro-section {
  margin-bottom: 24px;
}

.intro-section:last-child {
  margin-bottom: 0;
}

.intro-section h3 {
  color: var(--gold);
  font-size: 16px;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(212, 160, 23, 0.15);
  font-family: var(--font-title);
  font-weight: 400;
  letter-spacing: 2px;
}

.intro-section p {
  color: rgba(220, 210, 190, 0.75);
  font-size: 14px;
  line-height: 1.8;
}

.intro-section ul {
  list-style: none;
  padding: 0;
}

.intro-section ul li {
  color: rgba(220, 210, 190, 0.75);
  font-size: 14px;
  line-height: 1.8;
  padding: 3px 0 3px 20px;
  position: relative;
}

.intro-section ul li::before {
  content: '◆';
  position: absolute;
  left: 0;
  color: var(--gold-dark);
  font-size: 10px;
}

.intro-section ul li strong {
  color: var(--gold);
}

/* ============================================
   游戏容器
   ============================================ */
#game-container {
  width: 100%;
  height: 100%;
  position: relative;
}

/* 背景层 */
#bg-layer {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

#bg-layer::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(139, 0, 0, 0.2) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 70%, rgba(212, 160, 23, 0.05) 0%, transparent 40%),
    linear-gradient(180deg, rgba(10, 8, 20, 0.6) 0%, rgba(8, 6, 16, 0.85) 100%);
  pointer-events: none;
}

#bg-layer::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(212, 160, 23, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212, 160, 23, 0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
}

/* ============================================
   游戏主界面
   ============================================ */
#game-ui {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* ---------- 顶部状态栏 ---------- */
#top-bar {
  background: linear-gradient(180deg, rgba(10, 8, 26, 0.92), rgba(10, 8, 26, 0.85));
  border-bottom: 2px solid var(--gold);
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  position: relative;
}

#top-bar::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212, 160, 23, 0.3), transparent);
}

.game-title {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 24px;
  font-weight: 400;
  text-shadow: 0 0 20px rgba(212, 160, 23, 0.5);
  letter-spacing: 6px;
  white-space: nowrap;
}

.status-info {
  display: flex;
  gap: 20px;
  font-size: 14px;
  color: var(--gold-dark);
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* ---------- Tab 导航栏 ---------- */
#tab-bar {
  display: flex;
  background: rgba(8, 6, 22, 0.85);
  border-bottom: 1px solid rgba(212, 160, 23, 0.2);
  padding: 0 16px;
  overflow-x: auto;
  gap: 0;
  flex-shrink: 0;
}

#tab-bar::-webkit-scrollbar { height: 2px; }
#tab-bar::-webkit-scrollbar-thumb { background: rgba(212, 160, 23, 0.3); border-radius: 1px; }

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-title);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 2px;
  padding: 10px 18px;
  cursor: pointer;
  transition: all 0.25s;
  white-space: nowrap;
  position: relative;
}

.tab-btn:hover {
  color: var(--gold-dark);
  background: rgba(212, 160, 23, 0.06);
}

.tab-btn.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
  background: rgba(212, 160, 23, 0.08);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-light), transparent);
}

/* ---------- Tab 内容容器 ---------- */
#tab-content-container {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--bg-dark);
}

.tab-pane {
  display: none;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  position: absolute;
  top: 0; left: 0;
}

.tab-pane.active {
  display: flex;
  flex-direction: column;
}

.tab-pane-header {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 16px;
  font-weight: 400;
  text-align: center;
  padding: 14px 20px 10px;
  letter-spacing: 4px;
  border-bottom: 1px solid rgba(212, 160, 23, 0.15);
  flex-shrink: 0;
}

/* Tab 内滚动内容 */
#story-display {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

#story-display::-webkit-scrollbar { width: 6px; }
#story-display::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.3); }
#story-display::-webkit-scrollbar-thumb { background: rgba(212, 160, 23, 0.3); border-radius: 3px; }

#general-list, #faction-status, #cities-display, #action-buttons {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

/* ---------- 地图容器（全屏） ---------- */
.sg-map-wrapper {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border-radius: 0;
}

#map-container {
  width: 100%;
  height: 100%;
}

/* ---------- 资源栏 ---------- */
#resource-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.res-bar-item {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(212, 160, 23, 0.06);
  border: 1px solid rgba(212, 160, 23, 0.15);
  border-radius: 4px;
  padding: 4px 10px;
  transition: all 0.3s;
}

.res-bar-item:hover {
  background: rgba(212, 160, 23, 0.1);
  border-color: rgba(212, 160, 23, 0.3);
}

.res-bar-icon {
  font-size: 16px;
}

.res-bar-name {
  font-size: 11px;
  color: var(--text-muted);
}

.res-bar-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--jade-light);
  font-family: var(--font-mono);
}

.res-bar-item .res-delta {
  font-size: 10px;
  font-weight: 600;
  margin-left: 2px;
}

.res-bar-item .res-delta.pos { color: var(--jade-light); }
.res-bar-item .res-delta.neg { color: var(--red-light); }

/* ---------- 事件弹窗 ---------- */
#event-popup-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
  pointer-events: none;
}

.event-popup {
  background: rgba(10, 8, 26, 0.95);
  backdrop-filter: blur(12px);
  border-radius: 8px;
  padding: 14px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  pointer-events: auto;
  animation: eventPopupIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-left: 4px solid var(--gold);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 20px rgba(212, 160, 23, 0.1);
  transition: all 0.4s ease;
}

@keyframes eventPopupIn {
  from { opacity: 0; transform: translateX(100px) scale(0.8); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

.event-popup-exit {
  opacity: 0;
  transform: translateX(100px) scale(0.8);
}

.event-popup-success { border-left-color: var(--jade); }
.event-popup-warning { border-left-color: var(--red-light); }
.event-popup-battle { border-left-color: #e67e22; }
.event-popup-disaster { border-left-color: #9b59b6; }
.event-popup-talent { border-left-color: #f39c12; }
.event-popup-achievement { border-left-color: var(--gold); }
.event-popup-info { border-left-color: #3498db; }

.event-popup-icon {
  font-size: 24px;
  flex-shrink: 0;
  line-height: 1;
}

.event-popup-body {
  flex: 1;
  min-width: 0;
}

.event-popup-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 4px;
}

.event-popup-content {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.event-popup-close {
  font-size: 16px;
  color: #555;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.2s;
}

.event-popup-close:hover {
  color: #fff;
}

/* ---------- 操作弹出面板 ---------- */
.overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: overlayFadeIn 0.2s ease-out;
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.overlay-backdrop {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.overlay-panel {
  position: relative;
  background: linear-gradient(135deg, #1a1028, #0f0a20);
  border: 2px solid var(--gold);
  border-radius: 8px;
  width: 90%;
  max-width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.8),
    0 0 40px rgba(212, 160, 23, 0.15);
  animation: overlaySlideIn 0.25s ease-out;
}

@keyframes overlaySlideIn {
  from { transform: translateY(20px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(212, 160, 23, 0.2);
  flex-shrink: 0;
}

.overlay-title {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 4px;
}

.overlay-close {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.3);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.2s;
}

.overlay-close:hover {
  color: var(--gold-light);
}

.overlay-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.overlay-body::-webkit-scrollbar { width: 6px; }
.overlay-body::-webkit-scrollbar-track { background: transparent; }
.overlay-body::-webkit-scrollbar-thumb { background: rgba(212, 160, 23, 0.3); border-radius: 3px; }

/* ---------- 游戏容器 ---------- */
.resource-item {
  background: rgba(212, 160, 23, 0.06);
  border: 1px solid rgba(212, 160, 23, 0.15);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
  transition: all 0.3s;
}

.resource-item:hover {
  background: rgba(212, 160, 23, 0.1);
  border-color: rgba(212, 160, 23, 0.3);
  transform: translateX(3px);
}

.resource-item .res-icon {
  font-size: 20px;
  margin-bottom: 2px;
}

.resource-item .res-name {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.resource-item .res-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--jade-light);
  font-family: var(--font-mono);
}

.resource-item .res-delta {
  font-size: 11px;
  margin-top: 2px;
}

.resource-item .res-delta.pos { color: var(--jade-light); }
.resource-item .res-delta.neg { color: var(--red-light); }

/* ---------- 武将项 ---------- */
.general-item {
  background: rgba(139, 0, 0, 0.08);
  border: 1px solid rgba(139, 0, 0, 0.2);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 6px;
  font-size: 12px;
  transition: all 0.3s;
}

.general-item:hover {
  background: rgba(139, 0, 0, 0.12);
  border-color: rgba(139, 0, 0, 0.35);
}

.general-item .gen-name {
  color: var(--gold);
  font-weight: 600;
  margin-bottom: 3px;
  font-size: 13px;
}

.general-item .gen-stats {
  color: var(--text-muted);
  font-size: 11px;
}

/* ---------- 阵营状态 ---------- */
.faction-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 8px;
}

.faction-item .faction-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  font-family: var(--font-title);
  letter-spacing: 2px;
}

.faction-item .faction-stats {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.6;
  font-family: var(--font-mono);
}

/* ---------- 中间剧情区 ---------- */
#center-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-gold);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

#center-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.3;
}

#story-display {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

#story-display::-webkit-scrollbar { width: 6px; }
#story-display::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.3); }
#story-display::-webkit-scrollbar-thumb { background: rgba(212, 160, 23, 0.3); border-radius: 3px; }

/* ---------- 对话框样式 ---------- */
.dialog-box {
  margin-bottom: 18px;
  animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 系统消息 */
.dialog-system {
  background: rgba(155, 89, 182, 0.1);
  border-left: 3px solid #9b59b6;
  padding: 12px 16px;
  border-radius: 0 6px 6px 0;
  font-size: 14px;
  color: #d0b0e0;
  margin-bottom: 14px;
}

.dialog-system .label {
  color: #9b59b6;
  font-weight: 600;
  margin-right: 8px;
  font-size: 12px;
}

/* NPC对话 */
.dialog-npc {
  display: flex;
  align-items: flex-start;
  margin-bottom: 18px;
}

.dialog-npc .avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-right: 14px;
  flex-shrink: 0;
  box-shadow: 0 4px 15px rgba(212, 160, 23, 0.4);
  border: 2px solid rgba(212, 160, 23, 0.6);
}

.dialog-npc .bubble {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px 18px;
  border-radius: 4px 16px 16px 16px;
  max-width: 75%;
  font-size: 14px;
  line-height: 1.7;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.dialog-npc .bubble .name {
  color: var(--gold);
  font-weight: 600;
  margin-bottom: 4px;
  font-size: 13px;
}

/* 警告消息 */
.dialog-warning {
  background: rgba(231, 76, 60, 0.1);
  border-left: 3px solid var(--red-light);
  padding: 12px 16px;
  border-radius: 0 6px 6px 0;
  font-size: 14px;
  color: #f0b0b0;
  margin-bottom: 14px;
}

.dialog-warning .label {
  color: var(--red-light);
  font-weight: 600;
  margin-right: 8px;
}

/* 成功消息 */
.dialog-success {
  background: rgba(46, 204, 113, 0.1);
  border-left: 3px solid var(--jade);
  padding: 12px 16px;
  border-radius: 0 6px 6px 0;
  font-size: 14px;
  color: #b0f0c0;
  margin-bottom: 14px;
}

/* ---------- 操作按钮区 ---------- */
#action-buttons {
  background: rgba(0, 0, 0, 0.5);
  border-top: 1px solid rgba(212, 160, 23, 0.2);
  padding: 16px;
  min-height: 80px;
}

.choice-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.choice-btn {
  position: relative;
  background: linear-gradient(135deg, rgba(139, 0, 0, 0.2), rgba(139, 0, 0, 0.08));
  border: 1px solid rgba(212, 160, 23, 0.4);
  color: var(--gold);
  padding: 12px 22px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-family: var(--font-body);
  transition: all 0.3s;
  min-width: 160px;
  text-align: center;
  font-weight: 600;
  box-shadow: 0 3px 12px rgba(212, 160, 23, 0.1);
  overflow: hidden;
}

.choice-btn::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(212, 160, 23, 0.08), transparent);
  transition: left 0.4s;
}

.choice-btn:hover::before {
  left: 100%;
}

.choice-btn:hover {
  background: linear-gradient(135deg, rgba(139, 0, 0, 0.35), rgba(139, 0, 0, 0.15));
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212, 160, 23, 0.2);
  color: var(--gold-light);
}

.choice-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.choice-btn:disabled::before {
  display: none;
}

.choice-btn.selected {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #000;
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(212, 160, 23, 0.4);
}

/* ---------- 阵营选择卡片 ---------- */
.faction-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 20px 0;
}

.faction-card {
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
}

.faction-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.faction-card.wei:hover { border-color: #4a90d9; box-shadow: 0 12px 40px rgba(74, 144, 217, 0.3); }
.faction-card.shu:hover { border-color: var(--jade); box-shadow: 0 12px 40px rgba(46, 204, 113, 0.3); }
.faction-card.wu:hover { border-color: var(--red-light); box-shadow: 0 12px 40px rgba(231, 76, 60, 0.3); }
.faction-card.han:hover { border-color: var(--gold); box-shadow: 0 12px 40px rgba(212, 160, 23, 0.3); }

.faction-card .emblem {
  font-size: 48px;
  margin-bottom: 12px;
}

.faction-card .emblem-img {
  width: 56px;
  height: 56px;
  margin: 0 auto 10px;
  display: block;
  filter: drop-shadow(0 0 10px rgba(212, 160, 23, 0.4));
}

.faction-card h3 {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 400;
  margin-bottom: 10px;
  color: #fff;
  letter-spacing: 3px;
}

.faction-card .desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
}

.faction-card .stats {
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 10px;
  line-height: 1.5;
  font-family: var(--font-mono);
}

/* ---------- 结局展示 ---------- */
.ending-display {
  background: linear-gradient(135deg, rgba(139, 0, 0, 0.2), rgba(0, 0, 0, 0.5));
  border: 2px solid rgba(212, 160, 23, 0.5);
  border-radius: 8px;
  padding: 32px;
  margin: 20px 0;
  text-align: center;
  box-shadow: 0 8px 32px rgba(212, 160, 23, 0.15);
}

.ending-display h2 {
  font-family: var(--font-title);
  color: var(--gold);
  font-size: 28px;
  font-weight: 400;
  margin-bottom: 16px;
  text-shadow: 0 0 20px rgba(212, 160, 23, 0.5);
  letter-spacing: 4px;
}

.ending-display .quote {
  font-size: 16px;
  color: var(--gold-dark);
  font-style: italic;
  line-height: 2;
  margin: 20px 0;
}

/* ---------- 音乐播放器 ---------- */
#music-player {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(10, 8, 22, 0.75);
  border: 1px solid rgba(212, 160, 23, 0.4);
  border-radius: 24px;
  padding: 5px 12px;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

#music-player button {
  background: transparent;
  border: none;
  color: var(--gold);
  font-size: 15px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 4px;
  transition: color 0.2s;
}

#music-player button:hover { color: var(--gold-light); }

#music-name {
  color: var(--gold-dark);
  font-size: 11px;
  max-width: 120px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: var(--font-mono);
}

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 1200px) {
  #main-content {
    flex-direction: column;
    overflow-y: auto;
  }
  #left-panel, #right-panel {
    width: 100%;
    min-width: unset;
    max-height: 200px;
  }
  .faction-grid {
    grid-template-columns: 1fr;
  }
  #top-bar {
    flex-wrap: wrap;
  }
  #resource-bar {
    flex-wrap: wrap;
    gap: 6px;
  }
}

@media (max-width: 768px) {
  body {
    overflow: auto;
  }
  #game-container {
    height: auto;
    min-height: 100vh;
  }
  #game-ui {
    height: auto;
    min-height: 100vh;
  }

  .title-main {
    font-size: 36px;
    letter-spacing: 8px;
  }
  .title-sub {
    font-size: 12px;
    letter-spacing: 6px;
  }
  .title-en {
    font-size: 10px;
    letter-spacing: 4px;
  }
  .intro-text p {
    font-size: 13px;
  }
  .intro-features {
    gap: 10px;
  }
  .feature-item {
    padding: 8px 12px;
    font-size: 12px;
  }
  .start-buttons {
    flex-direction: column;
    gap: 10px;
  }
  .start-btn {
    padding: 12px 32px;
    font-size: 16px;
  }
  .start-btn.secondary {
    font-size: 14px;
  }
  .modal-content {
    width: 95%;
    max-height: 85vh;
  }
  .seal-deco {
    width: 56px;
    height: 56px;
  }
  .seal-start {
    top: -5px;
    right: -10px;
  }

  #top-bar {
    padding: 8px 12px;
    gap: 6px;
  }
  .game-title {
    font-size: 18px;
    letter-spacing: 3px;
  }
  #resource-bar {
    gap: 4px;
    order: 3;
    width: 100%;
    justify-content: center;
  }
  .res-bar-item {
    padding: 3px 7px;
  }
  .res-bar-name {
    display: none;
  }
  .res-bar-value {
    font-size: 12px;
  }
  .status-info {
    gap: 10px;
    font-size: 11px;
  }

  #main-content {
    flex-direction: column;
    padding: 8px;
    gap: 8px;
    overflow-y: auto;
    flex: none;
  }

  #left-panel, #right-panel {
    width: 100%;
    min-width: unset;
    max-height: 160px;
    padding: 10px;
  }

  #center-panel {
    min-height: 280px;
    max-height: 50vh;
  }

  #story-display {
    padding: 12px;
  }

  #action-buttons {
    padding: 10px;
    min-height: 70px;
  }
  .choice-btn {
    padding: 10px 14px;
    font-size: 12px;
    min-width: 120px;
  }

  #event-popup-container {
    right: 6px;
    max-width: 260px;
    top: 70px;
  }
  .event-popup {
    padding: 8px 10px;
  }
  .event-popup-title {
    font-size: 12px;
  }
  .event-popup-content {
    font-size: 11px;
  }
  .event-popup-icon {
    font-size: 20px;
  }

  #music-player {
    padding: 4px 10px;
  }
  #music-name {
    display: none;
  }
}
