/* 选品库 V2 商品详情（library-v2-detail.js 画）。图表默认是画好的样子（不跑脚本也看得见），
   只有带 data-motion 时才先藏起来、加上 is-in 再画出来。颜色只用站里的 --ink/--bg/--muted/--line/--accent，
   所有规则都挂在 .lv2d 下，不碰站内其他地方。 */
.lv2d{--lv2d-tile:color-mix(in srgb,var(--ink) 4%,var(--bg));--lv2d-soft:color-mix(in srgb,var(--ink) 8%,var(--bg));--lv2d-plate:#f5f5f7;--lv2d-down:#c4361d;--lv2d-spring:var(--spring,cubic-bezier(.34,1.56,.64,1));max-width:960px;color:var(--ink)}
:root[data-theme=dark] .lv2d{--lv2d-plate:#e8e8ec;--lv2d-down:#ff7a5c}
@media(prefers-color-scheme:dark){:root:not([data-theme=light]) .lv2d{--lv2d-plate:#e8e8ec;--lv2d-down:#ff7a5c}}
.lv2d *{box-sizing:border-box}
.lv2d a{color:inherit}
.lv2d h2{margin:56px 0 0;font-size:20px;line-height:1.3;font-weight:700;letter-spacing:-.01em}
.lv2d h2+.lv2d-say{margin-top:6px}
.lv2d-back{display:inline-flex;align-items:center;gap:4px;font-size:15px;color:var(--muted)!important;text-decoration:none}
.lv2d-back:hover{color:var(--ink)!important}

/* 商品头：小图、名字、价格、一个主按钮 */
.lv2d-head{display:grid;grid-template-columns:132px minmax(0,1fr) auto;gap:24px;align-items:center;margin:20px 0 0}
.lv2d-head .pic{aspect-ratio:1;border-radius:22px;background:var(--lv2d-plate);overflow:hidden;display:grid;place-items:center}
.lv2d-head .pic img{width:86%;height:86%;object-fit:contain;mix-blend-mode:multiply}
.lv2d-head .meta{font-size:13px;color:var(--muted)}
.lv2d-head h1{margin:6px 0 0;font-size:26px;line-height:1.25;font-weight:700;letter-spacing:-.01em;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.lv2d-head .price{margin:8px 0 0;font-size:15px;color:var(--muted)}
.lv2d-head .price b{color:var(--ink);font-weight:600;font-variant-numeric:tabular-nums}
.lv2d-save{all:unset;box-sizing:border-box;cursor:pointer;display:inline-flex;align-items:center;gap:8px;padding:12px 22px;border-radius:999px;background:var(--ink);color:var(--bg);font-size:15px;font-weight:600;transition:transform .45s var(--lv2d-spring),opacity .2s}
.lv2d-save:active{transform:scale(.95)}
.lv2d-save:focus-visible{outline:2px solid var(--ink);outline-offset:3px}
.lv2d-save[disabled]{opacity:.6;cursor:default}
.lv2d-save svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2;stroke-linejoin:round}
.lv2d-save[aria-pressed=true] svg{fill:currentColor}
.lv2d-save .on,.lv2d-save[aria-pressed=true] .off{display:none}
.lv2d-save[aria-pressed=true] .on{display:inline}

/* 主角：这一页的指标 */
.lv2d-hero{margin:48px 0 0}
.lv2d-label{font-size:15px;color:var(--muted)}
.lv2d-big{display:flex;align-items:baseline;flex-wrap:wrap;gap:4px 12px;margin:6px 0 0}
.lv2d-big strong{font-size:60px;line-height:1.05;font-weight:700;letter-spacing:-.03em;font-variant-numeric:tabular-nums}
.lv2d-big>span:not(.lv2d-chip){font-size:20px;color:var(--muted);font-weight:500}
.lv2d-chip{display:inline-flex;align-items:center;gap:4px;padding:4px 10px;border-radius:999px;background:var(--lv2d-soft);font-size:13px;font-weight:600;align-self:center}
.lv2d-chip.up{color:var(--accent);background:color-mix(in srgb,var(--accent) 12%,var(--bg))}
.lv2d-chip.down{color:var(--lv2d-down);background:color-mix(in srgb,var(--lv2d-down) 12%,var(--bg))}
.lv2d-say{margin:12px 0 0;max-width:640px;font-size:15px;line-height:1.6;color:var(--muted)}
.lv2d-facts{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:12px;margin:28px 0 0}
.lv2d-facts div{padding:16px 18px;border-radius:18px;background:var(--lv2d-tile)}
.lv2d-facts dt{font-size:13px;color:var(--muted)}
.lv2d-facts dd{margin:6px 0 0;font-size:19px;font-weight:600;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.lv2d-facts dd small{display:block;margin-top:2px;font-size:12px;font-weight:400;color:var(--muted)}
.lv2d-links{display:flex;flex-wrap:wrap;gap:20px;margin:24px 0 0;font-size:15px}
.lv2d-links a{color:var(--ink);text-decoration:none;border-bottom:1px solid var(--line);padding-bottom:2px}
.lv2d-links a:hover{border-color:var(--ink)}
.lv2d-empty{margin:24px 0 0;padding:28px;border-radius:20px;background:var(--lv2d-tile);font-size:15px;color:var(--muted);line-height:1.6}
.lv2d-empty b{display:block;color:var(--ink);font-size:17px;margin-bottom:4px}

/* 折线：从左往右画出来 */
.lv2d-chart{--ch:200px;position:relative;margin:28px 0 0;padding:0 64px 24px 0}
.lv2d-chart svg{display:block;width:100%;height:var(--ch);overflow:visible}
.lv2d-note{margin:10px 0 0;font-size:13px;color:var(--muted)}
.lv2d-chart .line{fill:none;stroke:var(--ink);stroke-width:2.2;stroke-linejoin:round;stroke-linecap:round;vector-effect:non-scaling-stroke}
.lv2d-chart .area{fill:color-mix(in srgb,var(--ink) 6%,transparent);stroke:none}
.lv2d-chart .grid{fill:none}
.lv2d-chart .grid{stroke:var(--line);stroke-width:1;vector-effect:non-scaling-stroke}
.lv2d-chart .draw{transition:clip-path 1.1s cubic-bezier(.3,.7,.2,1)}
.lv2d[data-motion] .lv2d-chart:not(.is-in) .draw{clip-path:inset(0 100% 0 0)}
.lv2d[data-motion] .lv2d-chart.is-in .draw{clip-path:inset(0)}
.lv2d-chart .dot{position:absolute;width:12px;height:12px;margin:-6px 0 0 -6px;border-radius:50%;background:var(--accent);box-shadow:0 0 0 4px color-mix(in srgb,var(--accent) 22%,transparent);transition:opacity .2s 1s,transform .5s var(--lv2d-spring) 1s}
.lv2d[data-motion] .lv2d-chart:not(.is-in) .dot{opacity:0;transform:scale(.4)}
.lv2d-chart .y{position:absolute;right:0;width:56px;font-size:12px;color:var(--muted);font-variant-numeric:tabular-nums}
.lv2d-chart .x{position:absolute;left:0;right:64px;bottom:0;display:flex;justify-content:space-between;font-size:12px;color:var(--muted)}

/* 每天多卖：柱子 */
.lv2d-bars{display:flex;align-items:flex-end;gap:3px;height:180px;margin:28px 0 0}
.lv2d-bars i{flex:1;min-width:2px;border-radius:4px 4px 1px 1px;background:var(--ink);height:var(--h);transform-origin:bottom;transition:transform .7s var(--lv2d-spring) calc(var(--n)*22ms)}
.lv2d-bars i.zero{background:var(--lv2d-soft);height:3px}
.lv2d-bars i.gap{background:none;border:1px dashed var(--line);height:12px}
.lv2d[data-motion] .lv2d-bars:not(.is-in) i{transform:scaleY(0)}
.lv2d-bars-x{display:flex;justify-content:space-between;margin:8px 0 0;font-size:12px;color:var(--muted)}

/* 差价：一根价钱条拆开 */
.lv2d-split{display:flex;height:56px;margin:32px 0 0;border-radius:16px;overflow:hidden;background:var(--lv2d-tile)}
.lv2d-split i{display:block;height:100%;flex:0 0 var(--w);transform-origin:left;transition:transform .8s cubic-bezier(.3,.7,.2,1) calc(var(--n)*.18s)}
.lv2d[data-motion] .lv2d-split:not(.is-in) i{transform:scaleX(0)}
.lv2d-split .unit,.lv2d-sum em.unit{background:color-mix(in srgb,var(--ink) 55%,var(--bg))}
.lv2d-split .ship,.lv2d-sum em.ship{background:color-mix(in srgb,var(--ink) 28%,var(--bg))}
.lv2d-split .gap,.lv2d-sum em.gap{background:var(--accent)}
.lv2d-sum em.neg{background:var(--lv2d-down)}
.lv2d-sum em.retail{background:var(--lv2d-tile);border:1px solid var(--line)}
.lv2d-sum{margin:20px 0 0;padding:0;list-style:none;max-width:520px}
.lv2d-sum li{display:flex;align-items:center;gap:12px;padding:12px 0;border-bottom:1px solid var(--line);font-size:15px}
.lv2d-sum li em{width:10px;height:10px;border-radius:3px;flex:none}
.lv2d-sum li span{flex:1}
.lv2d-sum li b{font-weight:600;font-variant-numeric:tabular-nums}
.lv2d-sum li small{color:var(--muted);font-size:13px}
.lv2d-sum li.total{border-bottom:0;font-size:17px}
.lv2d-sum li.total b{font-size:22px}
.lv2d-sum li.todo{color:var(--muted)}
.lv2d-sum li.todo em{border:1.5px dashed var(--muted)}

/* 低价货源：两张图并排 */
.lv2d-pair{display:grid;grid-template-columns:1fr 1fr;gap:12px;max-width:560px;margin:28px 0 0}
.lv2d-pair figure{margin:0;border-radius:22px;background:var(--lv2d-plate);aspect-ratio:1;position:relative;overflow:hidden;display:grid;place-items:center}
.lv2d-pair img{width:84%;height:84%;object-fit:contain;mix-blend-mode:multiply}
.lv2d-pair figcaption{position:absolute;left:14px;top:14px;padding:4px 10px;border-radius:999px;background:rgba(255,255,255,.9);color:#000;font-size:12px;font-weight:600}
.lv2d-verdict{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:16px 0 0;font-size:15px}
.lv2d-verdict .lv2d-say{margin:0}
.lv2d-leads{margin:16px 0 0;padding:0;list-style:none}
.lv2d-leads li{display:grid;grid-template-columns:56px minmax(0,1fr) auto;gap:14px;align-items:center;padding:12px 0;border-bottom:1px solid var(--line)}
.lv2d-leads img{width:56px;height:56px;border-radius:12px;object-fit:cover;background:var(--lv2d-plate)}
.lv2d-leads p{margin:0;font-size:14px;line-height:1.4;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.lv2d-leads small{display:block;margin-top:2px;font-size:12px;color:var(--muted)}
.lv2d-leads b{font-size:15px;font-weight:600;font-variant-numeric:tabular-nums;white-space:nowrap}

/* 流量：大播放器 + 视频清单 */
.lv2d-stage{margin:28px 0 0;border-radius:22px;overflow:hidden;background:#000;aspect-ratio:16/9;position:relative}
.lv2d-stage.tall{aspect-ratio:9/16;max-width:360px}
.lv2d-stage iframe{position:absolute;inset:0;width:100%;height:100%;border:0}
.lv2d-stage :is(button,a){all:unset;cursor:pointer;position:absolute;inset:0;display:grid;place-items:center}
.lv2d-stage :is(button,a):focus-visible{outline:2px solid #fff;outline-offset:-4px}
.lv2d-stage :is(button,a) img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.lv2d-stage :is(button,a) span{position:relative;width:72px;height:72px;border-radius:50%;background:rgba(255,255,255,.92);display:grid;place-items:center;transition:transform .45s var(--lv2d-spring)}
.lv2d-stage :is(button,a):hover span{transform:scale(1.08)}
.lv2d-stage :is(button,a) span::after{content:"";margin-left:5px;border-left:20px solid #000;border-top:12px solid transparent;border-bottom:12px solid transparent}
.lv2d-now{margin:14px 0 0;font-size:15px;font-weight:600;line-height:1.4}
.lv2d-now small{display:block;margin-top:4px;font-size:13px;font-weight:400;color:var(--muted)}
.lv2d-vids{margin:12px 0 0;padding:0;list-style:none}
.lv2d-vids :is(button,a){all:unset;cursor:pointer;box-sizing:border-box;display:grid;grid-template-columns:128px minmax(0,1fr);gap:14px;align-items:center;width:calc(100% + 20px);padding:10px;margin:0 -10px;border-radius:16px;transition:background-color .2s}
.lv2d-vids :is(button,a):hover,.lv2d-vids :is(button,a)[aria-current=true]{background:var(--lv2d-tile)}
.lv2d-vids :is(button,a):focus-visible{outline:2px solid var(--ink);outline-offset:-2px}
.lv2d-vids .th{aspect-ratio:16/9;border-radius:10px;overflow:hidden;background:var(--lv2d-soft)}
.lv2d-vids .th img{width:100%;height:100%;object-fit:cover;display:block}
/* 视频封面过期时用商品图顶上：整张放进浅底里，不裁 */
.lv2d-vids .th:has(img.is-product),.lv2d-stage :is(button,a):has(img.is-product){background:var(--lv2d-plate)}
.lv2d-vids .th img.is-product{object-fit:contain;mix-blend-mode:multiply;padding:4px}
.lv2d-stage :is(button,a) img.is-product{object-fit:contain;mix-blend-mode:multiply;padding:12%}
.lv2d-vids p{margin:0;font-size:14px;line-height:1.4;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.lv2d-vids small{display:block;margin-top:4px;font-size:12px;color:var(--muted)}
.lv2d-tag{display:inline-block;margin-right:6px;padding:1px 7px;border-radius:999px;background:var(--lv2d-soft);font-size:11px;font-weight:600;color:var(--ink)}
.lv2d-tag.same{background:color-mix(in srgb,var(--accent) 14%,var(--bg));color:var(--accent)}
.lv2d-quotes{margin:16px 0 0;padding:0;list-style:none;display:grid;gap:10px}
.lv2d-quotes li{padding:14px 16px;border-radius:16px;background:var(--lv2d-tile);font-size:14px;line-height:1.5}

/* 换个角度看这件 */
.lv2d-more{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:12px;margin:20px 0 0}
.lv2d-more :is(a,button){all:unset;box-sizing:border-box;cursor:pointer;position:relative;display:block;padding:18px;border-radius:20px;isolation:isolate;transition:transform .45s var(--lv2d-spring)}
.lv2d-more :is(a,button)::before{content:"";position:absolute;inset:0;border-radius:inherit;background:var(--lv2d-tile);z-index:-1;transition:transform .45s var(--lv2d-spring)}
.lv2d-more :is(a,button):focus-visible{outline:2px solid var(--ink);outline-offset:2px}
@media(hover:hover){.lv2d-more :is(a,button):hover{transform:translateY(-3px)}.lv2d-more :is(a,button):hover::before{transform:scale(1.04)}}
.lv2d-more span{font-size:13px;color:var(--muted)}
.lv2d-more b{display:block;margin-top:6px;font-size:22px;font-weight:700;font-variant-numeric:tabular-nums}
.lv2d-more small{display:block;margin-top:2px;font-size:12px;color:var(--muted)}
.lv2d-src{margin:48px 0 0;font-size:13px;line-height:1.6;color:var(--muted)}

@media(max-width:600px){
 .lv2d-head{grid-template-columns:88px minmax(0,1fr);gap:16px}
 .lv2d-head .pic{border-radius:18px}
 .lv2d-head h1{font-size:19px}
 .lv2d-save{grid-column:1/-1;justify-content:center}
 .lv2d-hero{margin-top:36px}
 .lv2d-big strong{font-size:46px}
 .lv2d-facts{grid-template-columns:1fr 1fr}
 .lv2d-chart{--ch:160px}
 .lv2d-bars{height:140px;gap:2px}
 .lv2d-vids :is(button,a){grid-template-columns:104px minmax(0,1fr)}
 .lv2d-more{grid-template-columns:1fr 1fr}
 .lv2d-more b{font-size:19px}
}
@media(prefers-reduced-motion:reduce){.lv2d-chart .draw,.lv2d-bars i,.lv2d-split i,.lv2d-chart .dot{transition:none!important}}
