/* ============================================================
   Taishan 资源库 · 独立样式
   所有选择器严格 scoped 在 #lib 内，绝不污染面板原有样式。
   颜色全部走面板 token，日夜主题自动跟随。
   ============================================================ */

/* 抵消 main 的 padding（20px 32px 48px），让资源库全宽沉浸；覆盖 .page 的 grid 间距 */
main > #lib.resource-page {
  display: block;
  margin: -20px -32px -48px;
  padding: 0 0 30px;
  background: var(--bg);
}

/* 预览稿变量名 → 面板 token 别名 */
#lib {
  --bg2: var(--panel-2);
  --panel2: var(--panel-2);
  --card: var(--panel);
  --border2: var(--border);
  --muted2: var(--muted);
  --accent: var(--primary);
  --accent2: var(--primary);
  --accentbg: var(--primary-soft);
  --gold: var(--warn);
  --green: var(--good);
  --red: var(--bad);
  font-size: 13px;
}
#lib button { font-family: inherit; cursor: pointer; }
#lib select { font-family: inherit; }

/* ---------- 第一排：讲解轮播（内缩留白，不再贴边） ---------- */
#lib .banner {
  height: 162px; position: relative; overflow: hidden;
  margin: 16px 26px 0; border: 1px solid var(--border); border-radius: 3px;
}
#lib .slide {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between;
  padding: 0 68px; opacity: 0; transform: translateY(8px);
  transition: opacity .5s, transform .5s; pointer-events: none;
}
#lib .slide.on { opacity: 1; transform: none; pointer-events: auto; }
#lib .s0 { background: linear-gradient(100deg, #181436, #241d54, #1b1740); }
#lib .s1 { background: linear-gradient(100deg, #0d2a2a, #14433f, #0d302e); }
#lib .s2 { background: linear-gradient(100deg, #2a1f0a, #3d3010, #291e0a); }
#lib .s3 { background: linear-gradient(100deg, #2a1230, #411c4a, #2a1230); }
#lib .s4 { background: linear-gradient(100deg, #101f38, #18315a, #101f38); }
#lib .s5 { background: linear-gradient(100deg, #2a1418, #481c24, #2a1418); }
#lib .s6 { background: linear-gradient(100deg, #141a2e, #1e2848, #141a2e); }
#lib .slide-txt { position: relative; z-index: 1; max-width: 640px; }
#lib .slide-txt .kicker { font-size: 10px; letter-spacing: 2px; color: rgba(255,255,255,.55); font-weight: 700; margin-bottom: 7px; }
#lib .slide-txt h2 { color: #fff; font-size: 21px; margin: 0 0 7px; letter-spacing: .3px; font-weight: 800; }
#lib .slide-txt p { color: rgba(255,255,255,.78); font-size: 12px; line-height: 1.6; max-width: 540px; margin: 0; }
#lib .slide-txt .mores { display: flex; gap: 14px; margin-top: 9px; flex-wrap: wrap; }
#lib .slide-txt .mores span { color: rgba(255,255,255,.7); font-size: 10.5px; }
#lib .slide-txt .mores span::before { content: "✓ "; color: #6ee7b7; }
#lib .slide-art { position: relative; z-index: 1; font-size: 66px; margin-right: 24px; filter: drop-shadow(0 8px 18px rgba(0,0,0,.4)); }
#lib .slide-art .ts-art { width: 96px; height: 96px; display: block; }
#lib .bn-dots { position: absolute; bottom: 12px; left: 68px; display: flex; gap: 6px; z-index: 3; }
#lib .bn-dots i { width: 16px; height: 4px; border-radius: 3px; background: rgba(255,255,255,.32); cursor: pointer; transition: .2s; }
#lib .bn-dots i.on { width: 28px; background: #fff; }
#lib .bn-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 28px; height: 28px;
  border-radius: 50%; background: rgba(8,8,20,.35); color: #fff; display: grid; place-items: center;
  cursor: pointer; z-index: 3; border: 1px solid rgba(255,255,255,.14); font-size: 16px; line-height: 1;
}
#lib .bn-nav.l { left: 10px; }
#lib .bn-nav.r { right: 10px; }

/* ---------- 第二排：栏目导航 ---------- */
#lib .colbar {
  display: flex; align-items: center; gap: 6px; padding: 13px 26px;
  background: var(--panel); border-bottom: 1px solid var(--border); flex-wrap: nowrap;
}
/* 专属 logo 独立一块，右边框分隔，绝不被栏目按钮遮挡
   注意：style.css 有全局 .logo{width:34px;height:34px}（侧栏头像用），
   必须在此显式 width:auto/height:auto 覆盖，否则 logo 容器被锁成 34px、文字溢出被"全部商品"压住 */
#lib .logo {
  display: flex; align-items: center; gap: 9px; cursor: pointer; flex: 0 0 auto;
  width: auto; height: auto; min-width: 150px;
  padding: 0 18px 0 0; margin-right: 14px; border-right: 1px solid var(--border);
}
#lib .logo .lg { width: 40px; height: 40px; position: relative; flex: 0 0 40px; }
#lib .logo .lg svg { width: 40px; height: 40px; display: block; }
#lib .logo .lt { font-weight: 900; font-size: 15px; letter-spacing: .5px; line-height: 1.15; white-space: nowrap; }
#lib .logo .lt small { display: block; font-size: 8px; letter-spacing: 1.5px; color: var(--accent); margin-top: 3px; white-space: nowrap; }
#lib .col {
  padding: 7px 14px; border-radius: 3px; font-size: 12.5px; font-weight: 600;
  color: var(--muted); cursor: pointer; white-space: nowrap; transition: .18s;
}
#lib .col:hover { background: var(--panel2); color: var(--text); }
#lib .col.on { background: var(--accent); color: #0a0a0a; box-shadow: 0 4px 12px rgba(200,242,74,.25); }
#lib .col.svc { margin-left: auto; border: 1px solid var(--border); color: var(--accent); }
@media (max-width: 1200px) { #lib .colbar { flex-wrap: wrap; } #lib .col.svc { margin-left: 0; } }

/* ---------- 第三排：搜索 + 下拉 ---------- */
#lib .tools { display: flex; gap: 10px; padding: 15px 26px 11px; align-items: center; }
#lib .search {
  flex: 1; display: flex; align-items: center; gap: 9px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 3px; padding: 0 14px; height: 38px; color: var(--muted);
}
#lib .search input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 12.5px; min-width: 0; }
#lib .search input::placeholder { color: var(--muted2); }
#lib .sel {
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  border-radius: 3px; padding: 0 12px; height: 38px; font-size: 12px; outline: none; min-width: 130px;
}
#lib .tools .icon-btn {
  height: 38px; min-width: 42px; padding: 0 10px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 3px; color: var(--text);
  font-size: 17px; line-height: 1; cursor: pointer; transition: .18s;
}
#lib .tools .icon-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
#lib .tools .icon-btn:disabled { opacity: .6; cursor: default; }

/* ---------- 第四排：标签快筛 ---------- */
#lib .tags { display: flex; gap: 7px; padding: 0 26px 14px; flex-wrap: wrap; align-items: center; border-bottom: 1px solid var(--border); }
#lib .tag {
  padding: 6px 12px; border-radius: 7px; background: var(--panel); border: 1px solid var(--border);
  color: var(--muted); font-size: 11.5px; cursor: pointer; transition: .18s;
}
#lib .tag:hover { border-color: var(--accent); }
#lib .tag.on { background: var(--accentbg); border-color: var(--accent); color: var(--accent); font-weight: 700; }
#lib .tags .cnt { margin-left: auto; color: var(--muted2); font-size: 11px; }

/* ---------- 商品列表 ---------- */
#lib .goods { padding: 18px 26px; }
#lib .goods h3 { font-size: 16px; margin: 0 0 3px; }
#lib .goods .desc { color: var(--muted); font-size: 11.5px; margin: 0 0 14px; }
#lib .cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; }
@media (max-width: 1250px) { #lib .cards { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 980px)  { #lib .cards { grid-template-columns: repeat(2, 1fr); } }
#lib .card {
  background: var(--card); border: 1px solid var(--border); border-radius: 3px;
  overflow: hidden; cursor: pointer; transition: transform .2s, border-color .2s, box-shadow .2s;
}
#lib .card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
#lib .cover { height: 148px; position: relative; display: grid; place-items: center; overflow: hidden; }
#lib .cover .ar { font-size: 50px; z-index: 1; filter: drop-shadow(0 5px 12px rgba(0,0,0,.42)); }
#lib .cover .ct {
  position: absolute; bottom: 9px; left: 10px; right: 10px; color: #fff; font-weight: 900;
  font-size: 13px; letter-spacing: .6px; text-align: center; z-index: 1; text-shadow: 0 2px 8px rgba(0,0,0,.75);
}
#lib .cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 42%, rgba(0,0,0,.58)); }
#lib .cv0 { background: radial-gradient(circle at 30% 20%, #2a6f8a, #0d2b3d); }
#lib .cv1 { background: radial-gradient(circle at 70% 25%, #1f6f6a, #0a2422); }
#lib .cv2 { background: radial-gradient(circle at 30% 30%, #a55a1e, #2a1206); }
#lib .cv3 { background: radial-gradient(circle at 70% 30%, #b98b2e, #3a2a08); }
#lib .cv4 { background: radial-gradient(circle at 30% 25%, #2e7a4a, #0a2415); }
#lib .cv5 { background: radial-gradient(circle at 70% 25%, #c99a2c, #3a2a05); }
#lib .cv6 { background: radial-gradient(circle at 30% 25%, #5b4bb5, #1a1440); }
#lib .cv7 { background: radial-gradient(circle at 70% 25%, #2b5fb5, #0d1c3a); }
#lib .cv8 { background: radial-gradient(circle at 30% 25%, #3f8f7a, #0d2a22); }
#lib .cv9 { background: radial-gradient(circle at 70% 25%, #6a4bb5, #1d1440); }
#lib .tagx {
  position: absolute; top: 8px; left: 8px; background: rgba(8,10,22,.74); color: #d5d9ee;
  font-size: 9px; padding: 3px 7px; border-radius: 5px; z-index: 2; backdrop-filter: blur(4px);
}
#lib .tagx.free { color: #5ce0a8; }
#lib .tagx.pay { color: #f0c25a; }
#lib .tagx.src { color: #b89bff; }
/* 卡片文字区固定行高：标题/标签/简介/meta 各自占位，首行与末行在所有卡片中严格对齐 */
#lib .ci { padding: 9px 11px 10px; display: grid; grid-template-rows: 18px 19px 15px 14px 34px; row-gap: 2px; }
#lib .ci h4 {
  font-size: 12.5px; margin: 0; line-height: 18px; height: 18px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#lib .ci .tags2 { display: flex; gap: 4px; flex-wrap: nowrap; overflow: hidden; height: 19px; align-items: center; }
#lib .ci .tags2 span { font-size: 9px; padding: 2px 6px; border-radius: 4px; background: var(--panel2); border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
#lib .ci .meta { color: var(--muted2); font-size: 10px; line-height: 14px; height: 14px; overflow: hidden; white-space: nowrap; }
#lib .pr { display: grid; grid-template-columns: 1fr 104px; align-items: center; gap: 6px; }
#lib .price { font-size: 14px; font-weight: 800; color: var(--gold); height: 20px; line-height: 20px; display: flex; align-items: center; white-space: nowrap; }
#lib .price.free { color: var(--green); }
#lib .price small { font-size: 9.5px; color: var(--muted); font-weight: 500; }
#lib .get {
  width: 104px; height: 32px; padding: 0; border: 0; border-radius: 3px;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  background: linear-gradient(135deg, var(--accent) 0%, #7aa816 100%);
  color: #0a0a0a; font-size: 11.5px; font-weight: 800; letter-spacing: .2px; white-space: nowrap;
  box-shadow: 0 4px 12px rgba(200,242,74,.22);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 38%, transparent);
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
#lib .get svg, #lib .buy svg { width: 15px; height: 15px; flex: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; fill: none; }
#lib .get:hover { transform: translateY(-2px); filter: brightness(1.08); box-shadow: 0 7px 18px rgba(200,242,74,.32); }
#lib .get:active { transform: translateY(0); }

/* ---------- EA服务专页 ---------- */
#lib #svcPage { padding: 18px 26px 30px; }
#lib #svcPage .svc-head {
  background: var(--panel); border: 1px solid var(--border); border-radius: 3px;
  padding: 22px; margin-bottom: 16px; display: flex; align-items: flex-start; gap: 20px;
}
#lib #svcPage .svc-head h2 { font-size: 20px; margin: 0 0 6px; }
#lib #svcPage .svc-head p { color: var(--muted); font-size: 12px; line-height: 1.7; margin: 0; }
#lib #svcPage .svc-head .contact {
  margin-left: auto; white-space: nowrap; padding: 9px 14px; border-radius: 3px;
  background: var(--panel2); border: 1px solid var(--border); color: var(--accent); font-size: 11.5px; font-weight: 700;
  cursor: pointer; transition: border-color .15s ease, background .15s ease;
}
#lib #svcPage .svc-head .contact:hover, #lib #svcPage .svc-head .contact:focus-visible {
  border-color: var(--accent); background: var(--panel); outline: none;
}
#lib .svc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 980px) { #lib .svc-grid { grid-template-columns: 1fr; } }
#lib .svc-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 3px;
  padding: 18px; display: flex; flex-direction: column; min-height: 280px;
}
#lib .svc-card .top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
#lib .svc-card .ic { width: 36px; height: 36px; border-radius: 3px; background: var(--accentbg); display: grid; place-items: center; font-size: 17px; }
#lib .svc-card .badge { font-size: 9.5px; padding: 4px 8px; border-radius: 5px; background: var(--panel2); border: 1px solid var(--border); color: var(--muted); }
#lib .svc-card h3 { font-size: 15px; margin: 0 0 5px; }
#lib .svc-card .sub { color: var(--accent); font-size: 11px; font-weight: 700; margin-bottom: 12px; min-height: 32px; }
#lib .svc-card ul { list-style: none; flex: 1; margin: 0; padding: 0; }
#lib .svc-card li { position: relative; padding: 5px 0 5px 15px; color: var(--muted); font-size: 11px; line-height: 1.5; }
#lib .svc-card li::before { content: ""; position: absolute; left: 2px; top: 11px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
#lib .svc-contact {
  display: flex; align-items: center; justify-content: space-between; margin-top: 14px;
  padding: 10px 12px; border-radius: 3px; background: var(--panel2);
  border: 1px solid var(--border); font-size: 11px; color: var(--muted); cursor: pointer;
}
#lib .svc-contact b { color: var(--accent); }
#lib .co-op {
  margin-top: 16px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 3px; padding: 14px 18px; display: flex; align-items: center; gap: 14px;
}
#lib .co-op .l { font-size: 11.5px; color: var(--muted); line-height: 1.6; flex: 1; }
#lib .co-op .l b { color: var(--text); }
#lib .co-op button { padding: 9px 14px; border-radius: 3px; background: var(--accent); color: #0a0a0a; font-weight: 700; font-size: 11.5px; white-space: nowrap; }

/* ---------- 资源详情 ---------- */
#lib #detailView { padding: 16px 26px 30px; display: none; }
#lib .crumb { color: var(--muted); font-size: 11px; margin-bottom: 13px; }
#lib .crumb .back { color: var(--accent); cursor: pointer; font-weight: 700; }
#lib .dtop { display: grid; grid-template-columns: 360px 1fr; gap: 22px; background: var(--panel); border: 1px solid var(--border); border-radius: 3px; padding: 20px; }
@media (max-width: 980px) { #lib .dtop { grid-template-columns: 1fr; } }
#lib .big { height: 260px; border-radius: 3px; display: grid; place-items: center; position: relative; overflow: hidden; }
#lib .big .ar { font-size: 104px; z-index: 1; filter: drop-shadow(0 10px 22px rgba(0,0,0,.45)); }
#lib .big .bt { position: absolute; bottom: 20px; color: #fff; font-weight: 900; font-size: 22px; letter-spacing: 1.5px; z-index: 1; text-shadow: 0 3px 12px rgba(0,0,0,.7); }
#lib .dtitle { font-size: 22px; font-weight: 800; margin: 0 0 9px; }
#lib .ddesc { color: var(--muted); line-height: 1.7; font-size: 11.5px; margin: 0 0 14px; }
#lib .bprice { font-size: 28px; font-weight: 900; color: var(--gold); }
#lib .buy {
  position: relative; width: 100%; padding: 16px 18px; border: 0; border-radius: 3px;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  background: linear-gradient(135deg, var(--accent) 0%, #7aa816 100%);
  color: #0a0a0a; font-weight: 800; font-size: 15px; letter-spacing: .6px;
  margin: 16px 0 10px; overflow: hidden; cursor: pointer;
  box-shadow: 0 8px 22px rgba(200,242,74,.22);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 42%, transparent);
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
#lib .buy::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.22) 50%, transparent 65%);
  transform: translateX(-120%); transition: transform .6s ease;
}
#lib .buy:hover { transform: translateY(-2px); filter: brightness(1.06); box-shadow: 0 12px 28px rgba(200,242,74,.3); }
#lib .buy:hover::after { transform: translateX(120%); }
#lib .buy:active { transform: translateY(0); }
#lib .tabs2 { display: flex; gap: 20px; border-bottom: 1px solid var(--border); margin: 18px 0 14px; }
#lib .tabs2 span { padding: 8px 0; color: var(--muted); cursor: pointer; font-weight: 600; border-bottom: 2px solid transparent; font-size: 12px; }
#lib .tabs2 span.on { color: var(--accent); border-color: var(--accent); }
#lib table { width: 100%; border-collapse: collapse; font-size: 11px; }
#lib td { border: 1px solid var(--border); padding: 8px 11px; }
#lib td:first-child { width: 100px; background: var(--panel2); color: var(--muted); font-weight: 600; }
#lib .foot { text-align: center; color: var(--muted2); font-size: 10.5px; padding: 18px 0; }

/* ---------- 顶栏「云控首页 / 资源库」切换 tab ---------- */
/* 顶栏轻量切换：文字 + 细下划线，不再用实心色块，避免突兀 */
.top-tabs { display: flex; align-items: center; gap: 2px; }
.top-tab {
  position: relative; padding: 8px 14px 11px; color: var(--muted); font-weight: 600;
  font-size: 14px; text-decoration: none; white-space: nowrap; transition: color .18s;
}
.top-tab:hover { color: var(--text); }
.top-tab.active { color: var(--primary); font-weight: 700; }
.top-tab.active::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 5px; height: 2px;
  border-radius: 2px; background: var(--primary);
}

/* 真实封面图：有图时盖住渐变占位，图片铺满封面区；保留极轻遮罩让左上角角标可读 */
#lib .cover.with-img::after { background: transparent; }
#lib .cover .cover-img { position:absolute; inset:0; width:100%; height:100%; object-fit:contain; display:block; z-index:0; background:#0a0a0a; }
#lib .big.with-img::after { content:""; position:absolute; inset:0; background:linear-gradient(180deg, rgba(0,0,0,.12), transparent 40%, rgba(0,0,0,.32)); }
#lib .big #dCoverImg { position:absolute; inset:0; width:100%; height:100%; object-fit:contain; z-index:0; background:#0a0a0a; }
#lib .big.with-img .ar, #lib .big.with-img .bt { display:none; }

/* 卡片简介：固定一行，避免撑高卡片导致价格栏错位 */
#lib .ci .brief { color:var(--muted); font-size:10.5px; line-height:15px; height:15px; margin:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
/* 详情页资源介绍：信息表 + 详细说明 */
#lib .detail-info, #lib .detail-desc { background:var(--panel); border:1px solid var(--border); border-radius: 3px; padding:16px; margin-bottom:14px; }
#lib .detail-info h3, #lib .detail-desc h3 { margin:0 0 12px; font-size:14px; font-weight:800; color:var(--text); }
#lib .detail-desc-body { color:var(--muted); font-size:12.5px; line-height:1.85; white-space:pre-wrap; word-break:break-word; }
/* 详细介绍配图：参数图 / 回测图 / 收益统计图 */
#lib .detail-images { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:14px; margin-top:18px; }
#lib .detail-images figure { margin:0; background:var(--panel2); border:1px solid var(--border); border-radius: 3px; overflow:hidden; }
#lib .detail-images img { display:block; width:100%; max-height:420px; object-fit:contain; background:var(--panel2); cursor:zoom-in; }
#lib .detail-images figcaption { padding:7px 10px; font-size:11px; color:var(--muted2); text-align:center; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
#lib .d-img-lightbox { position:fixed; inset:0; z-index:9999; background:rgba(0,0,0,.86); display:flex; align-items:center; justify-content:center; padding:32px; cursor:zoom-out; }
#lib .d-img-lightbox img { max-width:96vw; max-height:92vh; object-fit:contain; box-shadow:0 10px 50px rgba(0,0,0,.5); }
