/* 容器基础设置 */
.ui-frame {
  max-width: 900px;
  margin: 20px auto;
  background-color: #ffffff; /* 亮色背景 */
  color: #333333; /* 深色文字 */
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.15); /* 柔和阴影 */
  overflow: hidden;
  border: 1px solid #e0e0e0;
  font-size: 15px;
  line-height: 1.7;
}

/* 1. 场景头部 */
.ui-frame .scene-header {
  background: linear-gradient(135deg, #4a90e2 0%, #357ABD 100%); /* 渐变蓝色 */
  padding: 20px 25px;
  border-bottom: 3px solid #1E609A;
  color: #ffffff;
  position: relative;
}

.ui-frame .header-row {
  display: flex;
  gap: 15px;
  margin-bottom: 12px;
  align-items: center;
  flex-wrap: wrap; /* 允许换行 */
}

.ui-frame .tag {
  background: rgba(255,255,255,0.2);
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid rgba(255,255,255,0.3);
}

.ui-frame .info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  font-size: 14px;
  color: #e0e0e0;
  margin-bottom: 15px;
}
.ui-frame .info-grid div strong {
    color: #ffffff;
}

.ui-frame .scene-summary {
  font-style: italic;
  color: rgba(255,255,255,0.8);
  border-left: 4px solid #ffffff;
  padding-left: 15px;
  font-size: 13px;
  margin-top: 15px;
}

/* 2. 正文 (段落排版优化) */
.ui-frame .story-content {
  padding: 30px;
  color: #333333;
  font-size: 16px;
  background-color: #ffffff;
  text-align: justify;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ui-frame .story-content p {
  margin: 0;
  line-height: 1.8;
  text-indent: 2em; /* 首行缩进 */
}

/* 3. 折叠面板通用 */
.ui-frame .collapsible-panel {
  border-top: 1px solid #f0f0f0;
}

.ui-frame summary {
  padding: 15px 25px;
  background: #f8f8f8; /* 浅灰色背景 */
  cursor: pointer;
  font-weight: 600;
  color: #4a90e2; /* 蓝色标题 */
  user-select: none;
  transition: background 0.3s ease, color 0.3s ease;
  border-bottom: 1px solid #f0f0f0;
}

.ui-frame summary:hover {
  background: #e9e9e9;
  color: #357ABD;
}

.ui-frame details[open] summary {
    background: #e0e0e0;
    color: #333333;
    border-bottom: none;
}

.ui-frame .panel-content {
  padding: 20px 25px;
  background: #ffffff;
  border-bottom: 1px solid #f0f0f0;
}

/* 状态栏具体样式 */
.ui-frame .status-group {
  margin-bottom: 25px;
  padding-bottom: 18px;
  border-bottom: 1px dashed #cccccc;
}

.ui-frame .group-title {
  color: #884EA0; /* 紫色 */
  margin-bottom: 12px;
  font-weight: bold;
  font-size: 1.1em;
}

.ui-frame .stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* 更灵活的布局 */
  gap: 15px;
}

.ui-frame .stat-box {
  background: #f0f8ff; /* 浅蓝色背景 */
  padding: 10px 15px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #d0e0f0;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.ui-frame .stat-box .label {
  min-width: 60px; /* 增加标签宽度 */
  font-size: 13px;
  color: #555555;
  font-weight: 500;
}

.ui-frame .progress-bar {
  flex-grow: 1;
  height: 8px; /* 进度条高度 */
  background: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.ui-frame .fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease-out; /* 动画效果 */
}

.ui-frame .fill.red { background: #e74c3c; } /* 鲜艳红色 */
.ui-frame .fill.blue { background: #3498db; } /* 鲜艳蓝色 */
.ui-frame .fill.purple { background: #9b59b6; } /* 鲜艳紫色 */
.ui-frame .fill.cyan { background: #1abc9c; } /* 鲜艳青色 */
.ui-frame .fill.pink { background: #f39c12; } /* 橙黄色 */
.ui-frame .fill.hot-pink { background: #ff69b4; } /* 亮粉色 */
.ui-frame .fill.gradient-flow {
  background: linear-gradient(90deg, #3498db, #9b59b6);
  animation: pulse 2s infinite alternate; /* 呼吸灯效果 */
}

.ui-frame .value {
  font-size: 13px;
  min-width: 40px; /* 增加数值宽度 */
  text-align: right;
  opacity: 0.9;
  color: #333333;
  font-weight: 600;
}

/* NPC 卡片 */
.ui-frame .npc-card {
  background: #fefefe;
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 20px;
  border: 1px solid #e8e8e8;
  box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.ui-frame .npc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 8px;
}

.ui-frame .npc-name {
  color: #e74c3c; /* 红色强调 */
  font-weight: bold;
  font-size: 1.2em;
}

.ui-frame .npc-tags {
  font-size: 13px;
  color: #777777;
  background: #f0f0f0;
  padding: 3px 8px;
  border-radius: 15px;
}

.ui-frame .npc-core-stats {
  margin-bottom: 15px;
}

.ui-frame .stat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  margin-bottom: 6px;
}

.ui-frame .npc-details-text p {
  margin: 6px 0;
  font-size: 14px;
  color: #555555;
}

.ui-frame .npc-details-text strong {
  color: #4a90e2; /* 蓝色强调 */
}

.ui-frame .body-parts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 15px;
  background: #fcfcfc;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #f5f5f5;
}

.ui-frame .part-item {
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
  background: #f0f8ff; /* 浅蓝色背景 */
  border: 1px solid #e0e0f0;
}

.ui-frame .part-item.full-width {
  grid-column: 1 / -1;
}

.ui-frame .part-item .state {
  color: #27ae60; /* 绿色 */
  float: right;
  font-weight: 500;
}

/* 4. 记忆表格 */
.ui-frame .mem-title {
  color: #d35400; /* 橙色 */
  font-size: 1.05em;
  margin: 15px 0 8px;
  font-weight: bold;
}

.ui-frame .table-wrapper {
  overflow-x: auto;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.ui-frame .mem-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 600px; /* 确保表格在小屏幕下也能横向滚动 */
}

.ui-frame .mem-table th {
  background: #e0f2f7; /* 浅蓝灰色 */
  color: #333333;
  padding: 10px;
  text-align: left;
  border-bottom: 1px solid #d0e0e0;
}

.ui-frame .mem-table td {
  padding: 10px;
  border-bottom: 1px solid #f5f5f5;
  color: #555555;
  vertical-align: top;
}
.ui-frame .mem-table tr:last-child td {
    border-bottom: none;
}
.ui-frame .mem-table tbody tr:hover {
    background-color: #fcfcfc;
}

/* 5. 选项 */
.ui-frame .choices-container {
  padding: 25px;
  background: #fcfcfc;
  border-top: 1px solid #e0e0e0;
}

.ui-frame .choice-header {
  color: #884EA0; /* 紫色 */
  margin-bottom: 15px;
  font-weight: bold;
  font-size: 1.1em;
}

.ui-frame .choice-btn {
  display: block;
  background: #ffffff;
  padding: 12px 20px;
  margin-bottom: 10px;
  border-radius: 8px;
  border: 1px solid #d0e0e0;
  color: #4a90e2; /* 蓝色文字 */
  transition: all 0.3s ease;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  text-align: left;
  font-size: 15px;
  font-weight: 500;
}

.ui-frame .choice-btn:hover {
  background: #e0f2f7; /* 浅蓝灰色 */
  border-color: #4a90e2;
  color: #357ABD;
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.ui-frame .choice-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

@keyframes pulse {
  0% { opacity: 0.9; box-shadow: 0 0 5px rgba(52, 152, 219, 0.7); }
  50% { opacity: 1; box-shadow: 0 0 10px rgba(155, 89, 182, 0.9); }
  100% { opacity: 0.9; box-shadow: 0 0 5px rgba(52, 152, 219, 0.7); }
}

/* 移动端适配 */
@media (max-width: 768px) {
  .ui-frame {
    margin: 10px;
    border-radius: 8px;
  }
  .ui-frame .scene-header {
    padding: 15px 20px;
  }
  .ui-frame .header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .ui-frame .tag {
    font-size: 11px;
    padding: 3px 8px;
  }
  .ui-frame .info-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    font-size: 13px;
  }
  .ui-frame .scene-summary {
    padding-left: 10px;
    font-size: 12px;
  }
  .ui-frame .story-content {
    padding: 20px;
    font-size: 15px;
    gap: 10px;
  }
  .ui-frame summary {
    padding: 12px 20px;
    font-size: 1em;
  }
  .ui-frame .panel-content {
    padding: 15px 20px;
  }
  .ui-frame .status-group {
    margin-bottom: 20px;
    padding-bottom: 15px;
  }
  .ui-frame .stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .ui-frame .stat-box {
    padding: 8px 12px;
    gap: 8px;
  }
  .ui-frame .stat-box .label {
    min-width: 50px;
    font-size: 12px;
  }
  .ui-frame .value {
    min-width: 35px;
    font-size: 12px;
  }
  .ui-frame .npc-card {
    padding: 12px;
    margin-bottom: 15px;
  }
  .ui-frame .npc-name {
    font-size: 1.1em;
  }
  .ui-frame .npc-tags {
    font-size: 12px;
  }
  .ui-frame .stat-row {
    font-size: 13px;
    gap: 10px;
  }
  .ui-frame .npc-details-text p {
    font-size: 13px;
  }
  .ui-frame .body-parts-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 8px;
  }
  .ui-frame .part-item {
    font-size: 12px;
    padding: 5px 8px;
  }
  .ui-frame .mem-title {
    font-size: 1em;
    margin: 12px 0 6px;
  }
  .ui-frame .mem-table {
    font-size: 12px;
  }
  .ui-frame .mem-table th, .ui-frame .mem-table td {
    padding: 8px;
  }
  .ui-frame .choices-container {
    padding: 20px;
  }
  .ui-frame .choice-header {
    font-size: 1em;
    margin-bottom: 12px;
  }
  .ui-frame .choice-btn {
    padding: 10px 15px;
    margin-bottom: 8px;
    font-size: 14px;
  }
}