/* 知识树 /tree/：画布舞台和它上面的控件，页面其余部分（列表）用 style.css 原来的 .lv、.tk */
/* 首页嵌入：只留星球，不要导航、左栏、搜索和详情 */
html.tv-embed, html.tv-embed body { width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; background: var(--paper); }
html.tv-embed .tv { width: 100%; height: 100vh; height: 100dvh; }
html.tv-embed .tv-left, html.tv-embed .tv-top, html.tv-embed .tv-zoom, html.tv-embed .tv-hud,
html.tv-embed .tv-side, html.tv-embed .tv-tip, html.tv-embed .tv-help { display: none !important; }
html.tv-embed .tv canvas { cursor: default; }
html.tv-on, html.tv-on body { height: 100%; overflow: hidden; overscroll-behavior: none; }
html.tv-on .foot, html.tv-on .tv-list { display: none; }
html:not(.tv-on) .tv { display: none; }
html.tv-on .top { position: relative; }

.tv { --glass: color-mix(in srgb, var(--card) 96%, transparent); --edge: color-mix(in srgb, var(--ink) 10%, transparent);
  position: relative; height: calc(100vh - var(--top-h, 65px)); height: calc(100dvh - var(--top-h, 65px)); overflow: hidden; background: var(--paper); color: var(--ink); -webkit-user-select: none; user-select: none; }
.tv canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; outline: 0; }
.tv canvas:focus-visible { outline: 1px solid var(--rule); outline-offset: -1px; }
.tv canvas.hov { cursor: pointer; }
.tv canvas.drag { cursor: grabbing; }
.tv button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
/* 控件不用 backdrop-filter：下面的画布每帧都变，模糊要每帧重算（11-01 实测关掉以后 50 ms 一帧变 16.6 ms） */
.tv-glass { background: var(--glass); box-shadow: 0 0 0 .5px var(--edge), 0 6px 22px rgba(27, 34, 56, .07); }

/* 左栏（11-04 起和路线页同一个位置、同一种排法）：标题和「?」、筛选、款式，底下是讲到第几章 */
.tv-left { position: absolute; z-index: 3; left: 10px; top: 16px; bottom: 16px; width: 206px; padding: 0 10px; display: flex; flex-direction: column; overflow: auto; scrollbar-width: none; }
.tv-left::-webkit-scrollbar { display: none; }
.tv-lh { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.tv-home { display: flex; align-items: baseline; gap: 12px; }
.tv-home h1 { margin: 0; font-size: 26px; letter-spacing: .06em; line-height: 1.2; }
.tv-num { margin: 0; font-size: 14px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tv-num b { font: 700 20px/1 var(--serif); color: var(--accent); margin-right: 3px; }
.tv .tv-q { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 4px; color: var(--ink-3); font-size: 14px; }
.tv .tv-q:hover, .tv .tv-q[aria-expanded="true"] { color: var(--ink); background: var(--paper-2); }
.tv-routes { display: flex; flex-direction: column; }
.tv .tv-r { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 5px 10px; width: calc(100% + 20px); margin: 0 -10px 1px; padding: 8px 10px 9px; border-radius: 5px; text-align: left; color: var(--ink-2); text-decoration: none; transition: color .18s, background .18s; }
.tv-r small { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tv-r i { grid-column: 1 / -1; display: block; height: 2px; border-radius: 2px; background: var(--paper-2); overflow: hidden; }
.tv-r u { display: block; height: 100%; border-radius: 2px; background: var(--accent-fill); }
.tv-r b { font: 600 16px/1.35 var(--serif); letter-spacing: .03em; }
.tv .tv-r:hover { color: var(--ink); }
.tv .tv-r[aria-pressed="true"] { color: var(--ink); background: var(--paper-2); }
.tv-r[aria-pressed="true"] b { font-weight: 700; }
.tv-r[data-filter="lit"] b::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: var(--accent-fill); vertical-align: 2px; }
.tv .tv-views-l { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; margin-top: 14px; background: var(--paper-2); }
.tv .tv-views-l button { justify-content: center; padding: 0 2px; }
/* 路径：选中以后写在画面左上，左栏右边 */
.tv-hud { position: absolute; left: 236px; top: 18px; max-width: calc(100% - 640px); pointer-events: none; }
.tv-hud > * { pointer-events: auto; }
.tv-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 7px; font-size: 14.5px; line-height: 1.5; max-width: min(640px, calc(100vw - 460px)); }
.tv-crumbs[hidden] { display: none; }
.tv-crumbs, .tv-home { text-shadow: 0 0 5px var(--paper), 0 0 5px var(--paper), 0 0 10px var(--paper); }
.tv-crumbs button { color: var(--ink-3); }
.tv-crumbs button:hover { color: var(--accent); }
.tv-crumbs i { font-style: normal; color: var(--ink-3); opacity: .55; }
.tv-crumbs b { font: 700 19px/1.3 var(--serif); }

/* 左栏底下的大数字：讲到第几章（电脑上；标题旁边那个小的就不显示） */
.tv-big { margin-top: auto; padding-top: 24px; pointer-events: none; }
.tv-big b { display: block; font: 700 96px/1 var(--serif); letter-spacing: -.02em; color: var(--accent); font-variant-numeric: tabular-nums; }
.tv-big span { display: block; margin-top: 6px; font: 700 22px/1.3 var(--serif); color: var(--ink-2); }
.tv-big i { display: block; height: 5px; margin-top: 14px; border-radius: 3px; background: var(--paper-2); overflow: hidden; }
.tv-big u { display: block; height: 100%; border-radius: 3px; background: var(--accent-fill); }
@media (min-width: 901px) { .tv-num { display: none; } }
@media (min-width: 901px) and (max-height: 920px) { .tv-big { display: none; } .tv-lh { margin-bottom: 8px; } .tv .tv-r { padding: 6px 10px 7px; } .tv .tv-views-l { margin-top: 10px; } }
@media (min-width: 901px) and (max-height: 720px) { .tv-lh { margin-bottom: 6px; } .tv .tv-r { padding: 4px 10px 5px; } .tv .tv-views-l { margin-top: 8px; } }

/* 右上：搜索 */
.tv-top { position: absolute; right: 16px; top: 12px; display: flex; align-items: center; gap: 10px; z-index: 3; transition: transform .35s cubic-bezier(.3, .8, .3, 1); }
.tv-views { display: inline-flex; gap: 1px; padding: 3px; border-radius: 5px; }
.tv-views button, .tv-list .tv-views button { display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 11px; border: 0; border-radius: 4px; background: none; color: var(--ink-2); font: 500 13.5px/1 var(--sans); cursor: pointer; white-space: nowrap; transition: background .18s, color .18s; }
.tv-views svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.tv-views button:hover { color: var(--ink); }
.tv-views button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.tv-search { position: relative; }
.tv-search input { width: 150px; height: 38px; padding: 0 12px 0 32px; border: 0; border-radius: 5px; outline: 0; background: var(--glass); box-shadow: 0 0 0 .5px var(--edge), 0 6px 22px rgba(27, 34, 56, .07); color: var(--ink); font: 400 14px/1 var(--sans); transition: width .25s cubic-bezier(.3, .8, .3, 1), box-shadow .2s; -webkit-user-select: text; user-select: text; }
.tv-search input:focus { width: 230px; box-shadow: 0 0 0 1.5px var(--accent-fill), 0 6px 22px rgba(27, 34, 56, .07); }
.tv-search input::placeholder { color: var(--ink-3); }
.tv-search input::-webkit-search-cancel-button { display: none; }
.tv-search svg { position: absolute; z-index: 1; left: 10px; top: 11px; width: 16px; height: 16px; fill: none; stroke: var(--ink-3); stroke-width: 1.7; stroke-linecap: round; pointer-events: none; }
.tv-res { position: absolute; right: 0; top: 44px; width: 280px; max-height: 340px; overflow: auto; padding: 6px; border-radius: 8px; background: var(--card); box-shadow: 0 0 0 .5px var(--edge), var(--shadow); }
.tv-res[hidden] { display: none; }
.tv-res p { margin: 0; padding: 10px 12px; font-size: 14px; color: var(--ink-3); }
.tv-res button { display: block; width: 100%; padding: 7px 10px; border-radius: 4px; text-align: left; }
.tv-res button.cur, .tv-res button:hover { background: var(--paper-2); }
.tv-res b { display: block; font-size: 14.5px; font-weight: 600; line-height: 1.45; }
.tv-res small { display: block; font-size: 12px; line-height: 1.4; color: var(--ink-3); }

/* 右下：缩放 */
.tv-zoom { position: absolute; right: 16px; bottom: 14px; display: flex; gap: 1px; padding: 3px; border-radius: 5px; transition: transform .35s cubic-bezier(.3, .8, .3, 1); }
.tv-zoom button { display: grid; place-items: center; width: 32px; height: 30px; border-radius: 4px; color: var(--ink-2); font-size: 16px; line-height: 1; }
.tv-zoom button:hover { background: var(--paper-2); color: var(--ink); }
.tv-zoom svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tv.side-open .tv-zoom { transform: translateX(-372px); }
.tv-help { position: absolute; z-index: 5; left: 200px; top: 52px; width: 262px; padding: 12px 14px; border-radius: 8px; background: var(--card); box-shadow: 0 0 0 .5px var(--edge), var(--shadow); font-size: 13.5px; line-height: 1.7; color: var(--ink-2); }
.tv-help[hidden] { display: none; }
.tv-help p { margin: 0 0 4px; }
.tv-help b { color: var(--ink); font-weight: 600; }

/* 悬停提示 */
.tv-tip { position: absolute; left: 0; top: 0; display: flex; align-items: baseline; gap: 8px; padding: 5px 10px; border-radius: 4px; background: var(--ink); color: var(--paper); font-size: 13px; line-height: 1.5; white-space: nowrap; pointer-events: none; z-index: 4; }
.tv-tip[hidden] { display: none; }
.tv-tip b { font-weight: 600; }
.tv-tip span { opacity: .72; font-size: 12px; }

/* 右边详情 */
.tv-side { position: absolute; right: 12px; top: 62px; bottom: 12px; width: 356px; overflow: auto; padding: 20px 20px 18px; border-radius: 8px; background: var(--card); box-shadow: 0 0 0 .5px var(--edge), 0 12px 40px rgba(27, 34, 56, .12); -webkit-user-select: text; user-select: text; animation: tp-in .32s cubic-bezier(.2, .8, .25, 1); scrollbar-width: thin; z-index: 2; }
.tv-side[hidden] { display: none; }
@keyframes tp-in { from { opacity: 0; transform: translateX(14px); } }
.tv-side > * { animation: tp-fade .3s cubic-bezier(.2, .8, .25, 1) backwards; }
.tv-side > :nth-child(n+3) { animation-delay: .04s; }
.tv-side > :nth-child(n+5) { animation-delay: .08s; }
@keyframes tp-fade { from { opacity: 0; transform: translateY(6px); } }
.tv-side h2 { margin: 0 26px 2px 0; font-size: 23px; line-height: 1.35; }
.tv-side h3 { margin: 18px 0 6px; font: 600 12.5px/1.5 var(--sans); letter-spacing: .08em; color: var(--ink-3); }
.tp-x { position: absolute; right: 12px; top: 12px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; z-index: 2; color: var(--ink-3); background: color-mix(in srgb, var(--card) 70%, transparent) !important; }
.tp-x:hover { color: var(--ink); }
.tp-x svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.tp-meta { margin: 0 0 10px; font-size: 13.5px; line-height: 1.6; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tp-txt { margin: 6px 0 10px; font-size: 14.5px; line-height: 1.75; color: var(--ink-2); }
.tp-law { margin: 2px 0 6px; font-size: 13px; color: var(--accent); }
.tp-none { margin: 10px 0 0; font-size: 14px; color: var(--ink-3); }
.tp-bar { display: block; height: 4px; margin: 4px 0 12px; border-radius: 3px; background: var(--paper-2); overflow: hidden; }
.tp-bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent-fill); }
.tp-acts { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 2px; }
.tp-btn { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: 5px; background: var(--paper-2); color: var(--ink); font-size: 13.5px; font-weight: 500; text-decoration: none; }
.tp-btn:hover { background: color-mix(in srgb, var(--paper-2) 70%, var(--rule)); }
.tp-btn-main { background: var(--ink); color: var(--paper); }
.tp-btn-main:hover { background: color-mix(in srgb, var(--ink) 85%, var(--accent-fill)); }
.tp-list { display: flex; flex-direction: column; gap: 1px; margin: 0 -8px; }
.tp-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; width: 100%; padding: 6px 8px; border-radius: 4px; text-align: left; font-size: 14.5px; line-height: 1.5; color: var(--ink-2); }
.tp-row:hover { background: var(--paper-2); color: var(--ink); }
.tp-row.on { color: var(--ink); font-weight: 600; }
.tp-row.on span::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: var(--accent-fill); vertical-align: 2px; }
.tp-row small { flex: none; font-size: 12px; font-weight: 400; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tp-ep { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 11px; align-items: center; width: 100%; padding: 6px 8px; border-radius: 5px; text-align: left; }
.tp-ep:hover { background: var(--paper-2); }
.tp-ep img { width: 96px; height: 54px; object-fit: cover; border-radius: 7px; background: var(--paper-2); }
.tp-ep b { display: block; font-size: 14px; font-weight: 600; line-height: 1.45; }
.tp-ep small { display: block; margin-top: 1px; font-size: 12px; color: var(--ink-3); }
.tp-layers { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 4px 0 2px; }
.tp-layers div { padding: 8px 10px; border-radius: 5px; background: var(--paper); }
.tp-layers b { display: block; font: 700 14px/1.4 var(--serif); }
.tp-layers span { font-size: 12.5px; color: var(--ink-3); }
.tp-pl { position: relative; aspect-ratio: 16 / 9; margin: -6px -6px 14px; border-radius: 5px; overflow: hidden; background: #000; }
.tp-pl img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tp-pl iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.tv .tp-go { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: #fff; font-size: 13px; font-weight: 600; background: rgba(0, 0, 0, .1); }
.tp-go svg { width: 44px; height: 44px; fill: rgba(255, 255, 255, .94); }
.tp-go svg path { fill: #1b2238; }
.tp-go span { padding: 2px 10px; border-radius: 3px; background: rgba(0, 0, 0, .62); font-variant-numeric: tabular-nums; }

/* 列表：原来的页面，上面放一排款式 */
.tv-list .tv-views { background: var(--paper-2); box-shadow: none; }
.tv-list-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }

@media (min-width: 901px) { .tv-views-l svg { display: none; } }
@media (min-width: 901px) and (max-width: 1180px) {
  .tv-left { width: 170px; }
  .tv-hud { left: 200px; }
  .tv-help { left: 164px; }
  .tv .tv-views-l button { font-size: 13px; }
}
@media (max-width: 1080px) {
  .tv-search input { width: 116px; }
  .tv-search input:focus { width: 200px; }
  .tv-list .tv-views button { padding: 0 9px; }
}
/* 手机、窄屏（和路线页同一个分界 900px）：左栏变成顶上一条——标题、横排的路线、款式；树在它下面 */
@media (max-width: 900px) {
  .tv-left { left: 0; right: 0; top: 0; bottom: auto; width: auto; padding: 14px 16px 8px; display: block; overflow: visible; background: var(--paper); }
  .tv-lh { margin-bottom: 8px; padding-right: 120px; justify-content: flex-start; gap: 10px; }
  .tv-home h1 { font-size: 22px; }
  .tv-num { font-size: 13px; }
  .tv-num b { font-size: 17px; }
  .tv-routes { flex-direction: row; gap: 6px; overflow-x: auto; margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: none; }
  .tv-routes::-webkit-scrollbar { display: none; }
  .tv .tv-r { display: inline-flex; flex: none; width: auto; margin: 0; padding: 7px 13px; border-radius: 3px; background: var(--paper-2); }
  .tv .tv-r[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
  .tv-r b { font: 500 14px/1.4 var(--sans); }
  .tv-r i, .tv .side-gl, .tv-r[data-filter] small { display: none; }
  .tv .tv-r { gap: 6px; }
  .tv .tv-views-l { margin-top: 6px; }
  .tv .tv-views-l button { height: 34px; font-size: 14px; }
  .tv-big { display: none; }
  .tv-hud { left: 14px; top: calc(var(--lh, 150px) + 4px); max-width: calc(100% - 28px); }
  .tv-crumbs { font-size: 13px; max-width: calc(100vw - 28px); }
  .tv-crumbs b { font-size: 16px; }
  .tv-list .tv-views svg { display: none; }
  .tv-list .tv-views button { padding: 0 13px; height: 34px; font-size: 14px; }
  .tv-top { display: contents; }
  .tv-search { position: absolute; right: 12px; top: 12px; z-index: 5; }
  .tv-search input { width: 104px; height: 34px; padding-left: 29px; font-size: 13.5px; }
  .tv-search svg { top: 9px; left: 9px; }
  .tv-res { top: 40px; }
  .tv-res { width: min(280px, calc(100vw - 24px)); }
  .tv-zoom { display: none; }
  .tv-help { left: 12px; right: 12px; width: auto; top: 48px; }
  .tv-side { left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; max-height: 52%; padding: 16px 16px 14px; border-radius: 8px; animation-name: tp-up; z-index: 4; }
  @keyframes tp-up { from { opacity: 0; transform: translateY(18px); } }
  .tv-side h2 { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .tv-side, .tv-side > * { animation: none; }
  .tv-top, .tv-zoom, .tv-search input { transition: none; }
}
.tp-law-row { text-decoration: none; } .tp-law-row small { color: var(--g3); white-space: nowrap; }
/* 还没上线的题（11-27 并树）：题名、进度和「我也想看」 */
.tp-h-n { margin-left: 6px; font: 400 12px/1 var(--sans, inherit); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tp-tds { gap: 0; }
.tp-td { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 4px; }
.tp-td + .tp-td { border-top: 1px solid var(--rule); }
.tp-td b { display: block; font-size: 14px; font-weight: 500; line-height: 1.5; color: var(--ink-2); }
.tp-td small { display: block; margin-top: 1px; font-size: 12px; color: var(--ink-3); }
.tv .tp-vote { flex: none; height: 28px; padding: 0 10px; border-radius: 14px; border: 1px solid var(--rule-2); font-size: 12.5px; color: var(--ink-2); background: transparent; white-space: nowrap; }
.tv .tp-vote:hover { border-color: var(--accent-fill); color: var(--ink); }
.tv .tp-vote.on { border-color: var(--accent-fill); background: var(--accent-soft); color: var(--accent); }
.tv .tp-vote:disabled { opacity: .55; }
