/* 容器基础设置 */
.ui-frame {
  max-width: 800px;
  margin: 20px auto;
  background-color: #1a1b26;
  color: #a9b1d6;
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  overflow: hidden;
  border: 1px solid #2f334d;
  font-size: 14px;
  line-height: 1.6;
}

/* 1. 场景头部 */
.ui-frame .scene-header {
  background: linear-gradient(135deg, #24283b 0%, #1f2335 100%);
  padding: 15px;
  border-bottom: 2px solid #7aa2f7;
}

.ui-frame .header-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.ui-frame .tag {
  background: #3b4261;
  color: #7aa2f7;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
}

.ui-frame .info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  font-size: 13px;
  color: #c0caf5;
  margin-bottom: 10px;
}

.ui-frame .scene-summary {
  font-style: italic;
  color: #565f89;
  border-left: 3px solid #7aa2f7;
  padding-left: 10px;
  font-size: 12px;
}

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

.ui-frame .story-content p {
  margin: 0;
  line-height: 1.7;
}

/* 3. 折叠面板通用 */
.ui-frame details {
  border-top: 1px solid #2f334d;
}

.ui-frame summary {
  padding: 12px 20px;
  background: #24283b;
  cursor: pointer;
  font-weight: bold;
  color: #7aa2f7;
  user-select: none;
  transition: background 0.2s;
}

.ui-frame summary:hover {
  background: #2f334d;
}

.ui-frame details > div { /* Panel content for details tag */
  padding: 15px;
  background: #16161e;
}

/* 状态栏具体样式 */
.ui-frame .status-group {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px dashed #2f334d;
}

.ui-frame .group-title {
  color: #bb9af7;
  margin-bottom: 10px;
  font-weight: bold;
}

.ui-frame .stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.ui-frame .stat-box {
  background: #1f2335;
  padding: 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ui-frame .stat-box .label {
  width: 50px;
  font-size: 12px;
}

.ui-frame .progress-bar {
  flex-grow: 1;
  height: 6px;
  background: #16161e;
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.ui-frame .fill {
  height: 100%;
  border-radius: 3px;
}

.ui-frame .fill.red { background: #f7768e; }
.ui-frame .fill.blue { background: #7aa2f7; }
.ui-frame .fill.purple { background: #bb9af7; }
.ui-frame .fill.cyan { background: #7dcfff; }
.ui-frame .fill.pink { background: #ff9e64; }
.ui-frame .fill.hot-pink { background: #f7768e; }
.ui-frame .fill.gradient-flow {
  background: linear-gradient(90deg, #7aa2f7, #f7768e);
  animation: pulse 2s infinite;
}

.ui-frame .value {
  font-size: 12px;
  width: 35px;
  text-align: right;
  opacity: 0.8;
}

/* NPC 卡片 */
.ui-frame .npc-card {
  background: #1f2335;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 15px;
  border: 1px solid #292e42;
}

.ui-frame .npc-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  border-bottom: 1px solid #2f334d;
  padding-bottom: 5px;
}

.ui-frame .npc-name {
  color: #f7768e;
  font-weight: bold;
}

.ui-frame .npc-tags {
  font-size: 12px;
  color: #565f89;
}

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

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

.ui-frame .npc-details-text p {
  margin: 4px 0;
  font-size: 13px;
  color: #a9b1d6;
}

.ui-frame .npc-details-text strong {
  color: #7aa2f7;
}

.ui-frame .body-parts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 10px;
  background: #16161e;
  padding: 8px;
  border-radius: 6px;
}

.ui-frame .part-item {
  font-size: 12px;
  padding: 4px;
  border-radius: 4px;
  background: #1f2335;
}

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

.ui-frame .part-item .state {
  color: #9ece6a;
  float: right;
}

/* 4. 记忆表格 */
.ui-frame .mem-title {
  color: #e0af68;
  font-size: 13px;
  margin: 10px 0 5px;
  font-weight: bold;
}

.ui-frame .table-wrapper {
  overflow-x: auto;
}

.ui-frame .mem-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.ui-frame .mem-table th {
  background: #24283b;
  color: #7aa2f7;
  padding: 6px;
  text-align: left;
}

.ui-frame .mem-table td {
  padding: 6px;
  border-bottom: 1px solid #2f334d;
  color: #a9b1d6;
}

/* 5. 选项 */
.ui-frame .choices-container {
  padding: 20px;
  background: #16161e;
  border-top: 1px solid #2f334d;
}

.ui-frame .choice-header {
  color: #bb9af7;
  margin-bottom: 10px;
  font-weight: bold;
}

.ui-frame .choice-btn {
  display: block;
  background: #24283b;
  padding: 10px 15px;
  margin-bottom: 8px;
  border-radius: 6px;
  border: 1px solid #2f334d;
  color: #c0caf5;
  transition: all 0.2s;
  cursor: pointer;
}

.ui-frame .choice-btn:hover {
  background: #3b4261;
  border-color: #7aa2f7;
  color: #fff;
  transform: translateX(5px);
}

@keyframes pulse {
  0% { opacity: 0.8; }
  50% { opacity: 1; box-shadow: 0 0 5px #f7768e; }
  100% { opacity: 0.8; }
}

/* 移动端适配 */
@media (max-width: 600px) {
  .ui-frame .stats-grid {
    grid-template-columns: 1fr;
  }
  .ui-frame .header-row {
    flex-direction: column;
  }
  .ui-frame .story-content {
    padding: 15px;
    font-size: 14px;
  }
  .ui-frame .npc-card {
    padding: 10px;
  }
  .ui-frame .choice-btn {
    padding: 8px 12px;
    font-size: 14px;
  }
}

/* HTML介绍页的特定样式 (如果需要额外覆盖或补充) */
body {
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background-color: #1a1b26;
  color: #a9b1d6;
  margin: 0;
  padding: 20px;
  line-height: 1.6;
}

.container {
  max-width: 900px;
  margin: auto;
  background-color: #24283b;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.4);
  overflow: hidden;
}

.header {
  background: linear-gradient(135deg, #2f334d 0%, #1f2335 100%);
  padding: 25px;
  border-bottom: 2px solid #7aa2f7;
  text-align: center;
}

.header h1 {
  color: #c0caf5;
  font-size: 2.5em;
  margin-bottom: 10px;
}

.header p {
  color: #a9b1d6;
  font-size: 1.1em;
}

.nav-tabs {
  display: flex;
  justify-content: center;
  background-color: #1f2335;
  border-bottom: 1px solid #2f334d;
}

.nav-tabs button {
  background-color: transparent;
  border: none;
  padding: 15px 25px;
  color: #a9b1d6;
  font-size: 1em;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  outline: none;
}

.nav-tabs button:hover {
  color: #7aa2f7;
}

.nav-tabs button.active {
  color: #7aa2f7;
  font-weight: bold;
}

.nav-tabs button.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background-color: #7aa2f7;
}

.tab-content {
  padding: 30px;
  background-color: #1a1b26;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

h2 {
  color: #bb9af7;
  font-size: 1.8em;
  border-bottom: 1px solid #2f334d;
  padding-bottom: 10px;
  margin-top: 25px;
}

h3 {
  color: #7aa2f7;
  font-size: 1.4em;
  margin-top: 20px;
}

p, ul, li {
  color: #c0caf5;
  margin-bottom: 10px;
}

ul {
  list-style-type: disc;
  margin-left: 20px;
}

.config-section {
  background-color: #1f2335;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.config-section label {
  display: block;
  margin-bottom: 8px;
  color: #c0caf5;
}

.config-section input[type="text"],
.config-section select,
.config-section textarea {
  width: calc(100% - 20px);
  padding: 10px;
  margin-bottom: 15px;
  border-radius: 5px;
  border: 1px solid #2f334d;
  background-color: #2f334d;
  color: #c0caf5;
  font-size: 1em;
}

.config-section textarea {
  min-height: 80px;
  resize: vertical;
}

.config-preview {
  background-color: #16161e;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #2f334d;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.9em;
}

.copy-button {
  background-color: #7aa2f7;
  color: #1a1b26;
  border: none;
  padding: 12px 25px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1em;
  font-weight: bold;
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.copy-button:hover {
  background-color: #5a84e7;
  transform: translateY(-2px);
}

.random-button {
  background-color: #bb9af7;
  color: #1a1b26;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.9em;
  margin-top: 10px;
  transition: background-color 0.3s ease;
}

.random-button:hover {
  background-color: #9d7ae7;
}

.forge-link {
  display: block;
  text-align: center;
  margin-top: 20px;
  font-size: 0.9em;
  color: #565f89;
  text-decoration: none;
}

.forge-link:hover {
  color: #7aa2f7;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .header h1 {
    font-size: 2em;
  }
  .header p {
    font-size: 1em;
  }
  .nav-tabs button {
    padding: 12px 15px;
    font-size: 0.9em;
  }
  .tab-content {
    padding: 20px;
  }
  .config-section input[type="text"],
  .config-section select,
  .config-section textarea {
    width: calc(100% - 20px);
  }
}

@media (max-width: 480px) {
  .header h1 {
    font-size: 1.5em;
  }
  .header p {
    font-size: 0.9em;
  }
  .nav-tabs {
    flex-wrap: wrap;
  }
  .nav-tabs button {
    width: 100%;
    border-bottom: 1px solid #2f334d;
  }
  .nav-tabs button.active::after {
    display: none;
  }
  .nav-tabs button.active {
    background-color: #2f334d;
  }
  body {
    padding: 10px;
  }
  .container {
    border-radius: 0;
  }
}