:root{
  --bg:#0b1020;
  --panel:#111a33;
  --panel2:#0f1730;
  --text:#e8eefc;
  --muted:#a9b7e6;
  --border:rgba(255,255,255,.10);
  --accent:#7aa2ff;
  --accent2:#9ef0ff;
  --danger:#ff6b8a;
  --shadow: 0 10px 35px rgba(0,0,0,.35);
  --radius: 14px;
}

*{box-sizing:border-box}

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC","Hiragino Sans GB","Microsoft YaHei", Arial, sans-serif;
  color:var(--text);
  background: radial-gradient(1200px 700px at 15% -10%, rgba(122,162,255,.25), transparent 60%),
              radial-gradient(1000px 600px at 110% 10%, rgba(158,240,255,.18), transparent 55%),
              linear-gradient(180deg, #060914, var(--bg));
  min-height:100vh;
}

/* ✅ 关键：弹窗打开时锁定 body 滚动（配合 JS 记录/恢复 scrollY） */
body.modal-open{
  position: fixed;
  overflow: hidden;
  width: 100%;
}

a{color:inherit}

.container{
  width: min(1100px, 92vw);
  margin: 0 auto;
  padding: 22px 0 60px;
}

header{
  display:flex;
  gap:14px;
  align-items:flex-start;
  justify-content:space-between;
  flex-wrap:wrap;
  margin-bottom: 16px;
}

.title{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.title h1{
  font-size: 22px;
  margin:0;
  letter-spacing:.2px;
}

.title .sub{
  color:var(--muted);
  font-size: 13px;
  line-height: 1.4;
  max-width: 70ch;
}

.stats{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
  justify-content:flex-end;
}

.pill{
  border:1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  box-shadow: 0 6px 20px rgba(0,0,0,.20);
  white-space:nowrap;
}

.toolbar{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  box-shadow: var(--shadow);
  margin: 12px 0 14px;
}

.field{
  flex: 1 1 260px;
  display:flex;
  flex-direction:column;
  gap:6px;
  min-width: 220px;
}

label{
  font-size: 12px;
  color: var(--muted);
}

input[type="search"], select{
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(10,16,35,.55);
  color: var(--text);
  outline: none;
}

input[type="search"]::placeholder{color: rgba(169,183,230,.7)}

.row{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:flex-end;
}

.btn{
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(10,16,35,.55);
  color: var(--text);
  cursor:pointer;
  transition: transform .06s ease, background .2s ease, border-color .2s ease;
  user-select:none;
}

.btn:hover{ background: rgba(20,30,65,.55); border-color: rgba(122,162,255,.35) }
.btn:active{ transform: translateY(1px) }

.btn.primary{
  background: linear-gradient(180deg, rgba(122,162,255,.30), rgba(122,162,255,.15));
  border-color: rgba(122,162,255,.45);
}

.btn.danger{
  background: linear-gradient(180deg, rgba(255,107,138,.25), rgba(255,107,138,.12));
  border-color: rgba(255,107,138,.45);
}

.chips{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin: 10px 0 0;
}

.chip{
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--border);
  background: rgba(10,16,35,.50);
  padding: 7px 10px;
  border-radius: 999px;
  cursor:pointer;
  transition: background .2s ease, border-color .2s ease;
}

.chip:hover{ border-color: rgba(122,162,255,.35) }

.chip.active{
  color: var(--text);
  border-color: rgba(122,162,255,.55);
  background: rgba(122,162,255,.18);
}

.grid{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 14px;
}

@media (max-width: 980px){
  .grid{ grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px){
  .grid{ grid-template-columns: 1fr; }
  .title .sub{ max-width: 100%; }
}

/* ====== Card with image ====== */
.card{
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  box-shadow: var(--shadow);
  padding: 12px;
  display:flex;
  flex-direction:column;
  gap: 10px;
  cursor:pointer;
  transition: transform .08s ease, border-color .2s ease;
  min-height: 200px;
}

.card:hover{
  transform: translateY(-1px);
  border-color: rgba(122,162,255,.35);
}

.thumbWrap{
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.10);
  background:
    radial-gradient(400px 240px at 30% 20%, rgba(122,162,255,.22), transparent 55%),
    radial-gradient(360px 220px at 90% 30%, rgba(158,240,255,.16), transparent 60%),
    rgba(10,16,35,.40);

  /* ✅ 关键：从 3/2 改为 16/9，明显更省高度且不会左右留白（object-fit: cover） */
  aspect-ratio: 16 / 9;
}

.thumbWrap img{
  width:100%;
  height:100%;
  display:block;
  object-fit: cover;
  filter: saturate(1.02) contrast(1.02);
}

.thumbPh{
  width:100%;
  height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  color: rgba(232,238,252,.90);
  font-weight: 800;
  letter-spacing: .6px;
  font-size: 18px;
  text-shadow: 0 8px 24px rgba(0,0,0,.45);
}

.thumbTag{
  position:absolute;
  left:10px;
  bottom:10px;
  font-size: 11px;
  color: rgba(232,238,252,.92);
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(10,16,35,.45);
  padding: 6px 8px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
}

.cardTop{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}

.names{
  display:flex;
  flex-direction:column;
  gap:4px;
  min-width:0;
}

.nameCn{
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.nameEn{
  color: var(--muted);
  font-size: 12px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.badge{
  font-size: 11px;
  color: rgba(255,255,255,.85);
  padding: 6px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(10,16,35,.45);
  white-space:nowrap;
}

.def{
  color: rgba(232,238,252,.92);
  font-size: 13px;
  line-height: 1.5;
  display:-webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow:hidden;
  min-height: 3.9em;
}

.meta{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-top:auto;
  padding-top:8px;
  border-top: 1px dashed rgba(255,255,255,.12);
  color: var(--muted);
  font-size: 12px;
}

.meta .id{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  color: rgba(169,183,230,.95);
}

/* Modal */
.overlay{
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.55);
  display:none;
  align-items:center;
  justify-content:center;
  padding: 18px;
  z-index: 20;

  /* ✅ 防止滚动链把 body 带着走 */
  overscroll-behavior: contain;
}

.overlay.show{ display:flex; }

/* 让 .modal 负责“圆角裁切”，不再自己滚动 */
.modal{
  width: min(920px, 96vw);
  max-height: min(86vh, 920px);

  /* 原来是 overflow:auto; 这里改成 hidden，避免内容滚动时“顶破圆角/边界” */
  overflow: hidden;

  /* 让 header 固定在上方，滚动交给 body */
  display: flex;
  flex-direction: column;

  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.14);
  background: linear-gradient(180deg, rgba(17,26,51,.98), rgba(15,23,48,.98));
  box-shadow: 0 20px 60px rgba(0,0,0,.55);
  padding: 14px;

  /* ✅ 防止滚动链 */
  overscroll-behavior: contain;
}

.modalHeader{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,.10);

  /* 原来是 position: sticky; top:0; 这里改成普通定位 */
  position: relative;

  background: linear-gradient(180deg, rgba(17,26,51,.98), rgba(15,23,48,.98));
  z-index: 2;
}

.modalTitle{
  display:flex;
  flex-direction:column;
  gap:6px;
  min-width:0;
}

.modalTitle h2{
  margin:0;
  font-size: 18px;
  line-height: 1.2;
}

.modalTitle .small{
  color: var(--muted);
  font-size: 12px;
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
}

/* 把滚动放到 .modalBody，且在 flex 下允许其缩小并滚动 */
.modalBody{
  padding-top: 10px;
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;

  /* 关键：允许作为 flex 子项缩小，否则 overflow 不生效 */
  min-height: 0;

  /* 现在由它负责滚动 */
  overflow: auto;
  -webkit-overflow-scrolling: touch;

  /* ✅ 防止滚动链 */
  overscroll-behavior: contain;
}

@media (max-width: 820px){
  .modalBody{ grid-template-columns: 1fr; }
}

.panel{
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  background: rgba(10,16,35,.35);
  padding: 12px;
}

.panel h3{
  margin: 0 0 8px;
  font-size: 13px;
  color: rgba(232,238,252,.95);
  letter-spacing:.2px;
}

.panel p, .panel li{
  margin:0;
  color: rgba(232,238,252,.90);
  font-size: 13px;
  line-height: 1.55;
}

.panel ul{
  margin: 6px 0 0 18px;
  padding:0;
}

.quote{
  border-left: 3px solid rgba(122,162,255,.65);
  padding-left: 10px;
  color: rgba(232,238,252,.92);
  background: rgba(122,162,255,.08);
  border-radius: 10px;
  padding: 10px 10px 10px 12px;
}

/* Modal hero image */
.span2{ grid-column: 1 / -1; }

.heroFigure{
  margin:0;
  display:flex;
  flex-direction:column;
  gap:8px;
}

.heroImg{
  width:100%;
  aspect-ratio: 16 / 9; /* ✅ 同步变扁，减少“占屏” */
  border-radius: 12px;
  overflow:hidden;
  border: 1px solid rgba(255,255,255,.10);
  background:
    radial-gradient(520px 320px at 30% 20%, rgba(122,162,255,.20), transparent 55%),
    radial-gradient(500px 300px at 95% 30%, rgba(158,240,255,.14), transparent 60%),
    rgba(10,16,35,.35);
}

.heroImg img{
  width:100%;
  height:100%;
  object-fit: cover;
  display:block;
}

.heroCaption{
  color: rgba(169,183,230,.92);
  font-size: 12px;
  line-height: 1.4;
}

.error{
  border:1px solid rgba(255,107,138,.45);
  background: rgba(255,107,138,.10);
  color: rgba(255,225,231,.95);
  border-radius: 14px;
  padding: 12px;
  margin-top: 12px;
  box-shadow: var(--shadow);
  line-height: 1.6;
  font-size: 13px;
}

.footerNote{
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  opacity: .95;
}

code.k{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  background: rgba(0,0,0,.25);
  border: 1px solid rgba(255,255,255,.12);
  padding: 1px 6px;
  border-radius: 8px;
}
