/* ===== 容器与布局 ===== */
main {
  max-width: 860px;
  margin: 24px auto;
  padding: 0 0px; /* 初始左右内边距保持适中 */
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.75;
  color: #2c3e50;
  background: linear-gradient(135deg, #fafbfc 0%, #f0f2f5 100%);
  display: block;
  box-sizing: border-box; /* 确保padding不增加宽度 */
}

/* ===== 模块卡片与折叠框 ===== */
details, card {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  margin-bottom: 20px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.3s ease;
  display: block;
}

details:hover, card:hover {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}


/* ===== 模块内容 ===== */
details > div, card > div {
  padding: 20px;
}

   /* ===== 标题栏 ===== */
  summary, header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    font-weight: 700;
    font-size: 16px;
    color: #1a1a2e;
    border-bottom: 2px solid #f0f2f5;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
    list-style: none;
    
    /* [新增] 强制单行显示，超出隐藏 */
    white-space: nowrap;
    overflow: hidden;
  }
  
  summary::-webkit-details-marker {
    display: none;
  }

  summary:hover, header:hover {
    background: #fafbfc;
  }

  /* [新增] flex-shrink: 0 防止图标被长文本挤压变形 */
  summary i, header i {
    font-size: 20px;
    font-style: normal;
    flex-shrink: 0; 
  }

  /* [新增] flex-shrink: 0 保证右侧标签完整显示 */
  summary b, header b {
    margin-left: auto;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    flex-shrink: 0;
  }

  /* ===== 折叠控件 ===== */
  /* [新增] flex-shrink: 0 保证右侧箭头永远可见 */
  summary::after {
    margin-left: auto;
    font-size: 12px;
    color: #999;
    flex-shrink: 0;
  }
  summary:has(b)::after {
    margin-left: 8px;
  }
  details[open] > summary::after {
    content: "▲";
  }
  details:not([open]) > summary::after {
    content: "▼";
  }


/* ===== 当前情况 ===== */
grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 10px;
  border-left: 3px solid #667eea;
}

item b {
  font-weight: 600;
  color: #495057;
  white-space: nowrap;
}

item span {
  color: #212529;
}

/* ===== 正文区域 ===== */
story {
  display: block;
  padding: 24px;
  background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
  border-radius: 12px;
  margin: 0 16px 16px 16px; /* 初始左右外边距 */
  line-height: 2;
  text-indent: 2em;
}

/* 对话样式：单层块级，与 p 结构一致 */
pl, npc, tht {
  display: block;
  margin-bottom: 16px;
}

pl {
  color: #2563eb;
  font-weight: 500;
}

npc {
  color: #dc2626;
  font-weight: 500;
}

tht {
  color: #db2777;
  font-style: italic;
}

/* ===== 角色档案 ===== */
char {
  display: block;
  background: linear-gradient(135deg, #fff5f5 0%, #fff 100%);
  border: 1px solid #fed7d7;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}

char:last-child {
  margin-bottom: 0;
}

name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  color: #1a1a2e;
}

name tag {
  font-size: 12px;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  padding: 2px 8px;
  border-radius: 8px;
  font-weight: 500;
}

/* ===== 状态表格 ===== */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 12px 0;
  font-size: 14px;
}

th {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
}

th:first-child {
  border-radius: 8px 0 0 0;
}

th:last-child {
  border-radius: 0 8px 0 0;
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid #e9ecef;
}

tr:last-child td:first-child {
  border-radius: 0 0 0 8px;
}

tr:last-child td:last-child {
  border-radius: 0 0 8px 0;
}

tr:hover td {
  background: #f8f9fa;
}

/* ===== 进度条 ===== */
prog {
  display: block;
  margin: 12px 0;
}

prog > div {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 13px;
  color: #6c757d;
}

bar {
  display: block;
  height: 10px;
  background: #e9ecef;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  border-radius: 5px;
  transition: width 0.5s ease;
}

/* ===== 记忆区 ===== */
mem-sec {
  display: block;
  margin-bottom: 16px;
}

mem-title {
  font-weight: 700;
  color: #495057;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

mem-item {
  background: #f8f9fa;
  border-left: 3px solid #667eea;
  padding: 10px 14px;
  margin-bottom: 8px;
  border-radius: 0 8px 8px 0;
  font-size: 14px;
  display: block;
}

mem-item time {
  color: #6c757d;
  font-size: 12px;
  display: block;
}

mem-item event {
  color: #212529;
  margin-top: 4px;
  display: block;
}

/* ===== 紧急提示 ===== */
urgent {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

/* ===== 分隔线 ===== */
hr {
  height: 1px;
  border: none;
  background: linear-gradient(90deg, transparent 0%, #e9ecef 50%, transparent 100%);
  margin: 16px 0;
}

/* ===== 响应式：核心优化部分 ===== */
@media (max-width: 600px) {
  /* 1. 主容器与正文区域：进一步压缩左右边距 */
  main {
    padding: 0 8px; /* 压减左右内边距 */
    margin: 12px auto; /* 缩小上下外边距，让内容更突出 */
  }

  story {
    margin: 0 4px 12px 4px; /* 极致压缩故事区域的左右外边距 */
    padding: 16px 12px; /* 内边距也稍作压缩 */
    border-radius: 12px;
    line-height: 1.9;
  }

  /* 2. 模块卡片与内容：内部间距微调 */
  details > div, card > div {
    padding: 16px 12px; /* 减小内容区域的内边距 */
  }

  summary, header {
    padding: 14px 14px; /* 标题栏也稍紧凑 */
  }

  /* 3. 网格布局：确保单列，避免挤压 */
  grid {
    grid-template-columns: 1fr; /* 强制单列 */
    gap: 10px;
  }

  item {
    padding: 10px 12px; /* grid项内部稍紧凑 */
  }

  /* 4. 表格：优化移动端显示 */
  table {
    font-size: 13px;
  }
  th, td {
    padding: 8px 10px;
  }

  /* 5. 角色档案：内部微调 */
  char {
    padding: 12px;
  }
  name {
    font-size: 16px;
  }
}

/* 极小屏幕（如竖屏手机）的额外优化 */
@media (max-width: 380px) {
  main {
    padding: 0 4px; /* 最小边距 */
    margin: 8px auto;
  }
  story {
    margin: 0 2px 8px 2px;
    padding: 12px 8px;
  }
  summary, header {
    padding: 12px 10px;
    gap: 8px;
    font-size: 14px;
  }
  details > div, card > div {
    padding: 12px 8px;
  }
}