/* details 主容器 */
details {
  margin: 12px 0;
  background: linear-gradient(135deg, #ffffff 0%, #f4f8ff 100%);
  border: 1px solid #c8dafa;
  border-left: 4px solid #4a7fc8;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(74, 127, 200, 0.08);
  overflow: hidden;
  transition: box-shadow 0.3s ease;
}

details:hover {
  box-shadow: 0 4px 16px rgba(74, 127, 200, 0.15);
}

details[open] {
  background: linear-gradient(135deg, #ffffff 0%, #eef4ff 100%);
}

/* summary 标题栏 */
summary {
  padding: 12px 16px 12px 40px;
  font-weight: 600;
  font-size: 15px;
  color: #2a4d8f;
  cursor: pointer;
  position: relative;
  background: linear-gradient(90deg, #e8f1ff 0%, #f8fbff 100%);
  border-bottom: 1px solid transparent;
  list-style: none;
  user-select: none;
  transition: all 0.25s ease;
}

summary::-webkit-details-marker { display: none; }

summary::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid #4a7fc8;
  border-bottom: 2px solid #4a7fc8;
  transform: translateY(-65%) rotate(-45deg);
  transition: transform 0.3s ease;
}

details[open] > summary::before {
  transform: translateY(-25%) rotate(45deg);
}

summary:hover {
  background: linear-gradient(90deg, #dbe9ff 0%, #eef4ff 100%);
  color: #1e3a72;
}

details[open] > summary {
  border-bottom: 1px solid #c8dafa;
}

/* details 内部内容区 padding */
details > *:not(summary) {
  margin: 0;
  padding: 0;
}

/* 代码块美化 */
details pre {
  margin: 0;
  padding: 14px 16px;
  background: #fafcff;
  border-radius: 0;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.7;
}

details code {
  color: #1a2b4a;
  background: transparent;
  font-family: 'Consolas', 'Microsoft YaHei', monospace;
}

/* 内联code */
details p code, details li code {
  background: #e8f1ff;
  padding: 1px 6px;
  border-radius: 4px;
  color: #2a4d8f;
}

/* ========== 表格·横向滑动方案（核心） ========== */
details table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 0;
  background: #ffffff;
  -webkit-overflow-scrolling: touch; /* iOS 平滑滚动 */
}

/* 滚动条美化 */
details table::-webkit-scrollbar {
  height: 6px;
}
details table::-webkit-scrollbar-track {
  background: #f0f5fc;
}
details table::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, #6a9adf, #4a7fc8);
  border-radius: 3px;
}

/* 表头 */
details thead {
  background: linear-gradient(90deg, #4a7fc8, #6a9adf);
}
details th {
  padding: 10px 14px;
  color: #ffffff;
  font-weight: 600;
  font-size: 13px;
  text-align: left;
  white-space: nowrap;
  border: none;
}

/* 单元格 */
details td {
  padding: 10px 14px;
  border-bottom: 1px solid #eaf1fb;
  font-size: 13px;
  color: #1a2b4a;
  vertical-align: top;
  /* 默认不强制换行，保留长内容可读性 */
  min-width: 80px;
}

/* No. 列窄一点 */
details td:first-child, details th:first-child {
  white-space: nowrap;
  color: #4a7fc8;
  font-weight: 600;
  width: 40px;
  text-align: center;
}

/* Time 列不换行 */
details td:nth-child(2), details th:nth-child(2) {
  white-space: nowrap;
  min-width: 180px;
  color: #5478a8;
}

/* Scene 列 */
details td:nth-child(3), details th:nth-child(3) {
  min-width: 120px;
  white-space: nowrap;
}

/* Event 列允许换行但有最小宽度 */
details td:nth-child(4), details th:nth-child(4) {
  min-width: 280px;
}

/* 情感坐标列 */
details td:nth-child(5), details th:nth-child(5) {
  min-width: 140px;
  color: #6a4a8c;
  font-style: italic;
  white-space: nowrap;
}

/* 行 hover */
details tr:hover td {
  background: #f4f8ff;
}

/* 分隔线 hr */
details hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, #c8dafa, transparent);
  margin: 8px 16px;
}

/* ============ 移动端适配 ============ */
@media (max-width: 768px) {
  details {
    margin: 8px 0;
    border-radius: 8px;
  }
  
  summary {
    padding: 10px 12px 10px 34px;
    font-size: 14px;
  }
  
  summary::before {
    left: 12px;
    width: 7px;
    height: 7px;
  }
  
  details pre {
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.65;
  }
  
  details th, details td {
    padding: 8px 10px;
    font-size: 12px;
  }
  
  details td:first-child, details th:first-child {
    width: 32px;
  }
  
  details td:nth-child(2), details th:nth-child(2) {
    min-width: 160px;
  }
  
  details td:nth-child(4), details th:nth-child(4) {
    min-width: 220px;
  }
  
  /* 移动端滚动条更细 */
  details table::-webkit-scrollbar {
    height: 4px;
  }
}

/* 极小屏 */
@media (max-width: 380px) {
  summary { font-size: 13px; }
  details pre { font-size: 11.5px; }
  details th, details td { font-size: 11.5px; padding: 7px 8px; }
}