/* Ai Instant Lab · 临时样式。沿用 Frontmost 样板的阅读样式（手机优先、正文 16.5px），
   P2 单独做 Ai Instant Lab 的视觉后整份替换。 */
:root {
  --void: #050505; --film: #171715; --film-2: #1f1e1b; --paper: #f3f0e6; --ink: #131312;
  --text: #e6e2d5; --mute: #96938a; --dim: #5c5a53; --amber: #e9a43c; --amber-ink: #1a1205;
  --ink-2: #5a564c; --rule: #d8d2c1; --rule-2: #e7e2d4;
  --sans: 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
  --mono: 'Space Mono', ui-monospace, 'SF Mono', monospace;
  --mast: Anton, 'Noto Sans SC', sans-serif;
  --g: 16px;
}
@media (min-width: 900px) { :root { --g: 40px; } }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body { margin: 0; background: var(--void); color: var(--text); font: 400 15px/1.6 var(--sans); }
a { color: inherit; }
.code { font-family: var(--mono); font-size: 11px; letter-spacing: .07em; color: var(--amber); font-weight: 400; }

/* 顶上一行 */
.rd-top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 20px;
  padding: 0 var(--g); height: 56px; background: rgba(5,5,5,.92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.rd-top .brand { font: 400 22px/1 var(--mast); text-transform: uppercase; letter-spacing: .01em; color: var(--paper); text-decoration: none; }
.rd-nav { display: flex; gap: 4px; margin-left: auto; }
.rd-nav a { position: relative; padding: 8px 10px; color: var(--mute); text-decoration: none; font-size: 14px; }
.rd-nav a:hover { color: var(--text); }
.rd-nav a.on { color: var(--text); font-weight: 700; }
.rd-nav a.on::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: 2px; height: 2px; background: var(--amber); }
.rd-nav a { white-space: nowrap; }
.rd-top .brand { white-space: nowrap; }
@media (max-width: 560px) {
  .rd-top { flex-wrap: wrap; height: auto; padding-top: 12px; padding-bottom: 4px; row-gap: 2px; }
  .rd-top .brand { font-size: 20px; }
  .rd-nav { margin-left: -10px; width: calc(100% + 10px); }
  html { scroll-padding-top: 104px; }
}

.rd { margin: 0 auto; padding: 8px var(--g) 64px; }
.rd-index { max-width: 1080px; }
.rd-lesson { max-width: 800px; }

/* 页面头 */
.page-head { padding: 28px 0 24px; max-width: 680px; }
.page-head h1 { margin: 0 0 10px; font: 900 34px/1.2 var(--sans); letter-spacing: .02em; color: var(--paper); }
.page-head p { margin: 0 0 8px; color: var(--mute); }
.page-head .count { font-size: 12px; margin-top: 14px; }
h2 .code { margin-left: 8px; color: var(--dim); font-size: 10.5px; vertical-align: 3px; }

/* 相纸：长文、最新一课、三行结论都放在纸上 */
.sheet { display: block; position: relative; background: var(--paper); color: var(--ink);
  box-shadow: 0 22px 44px -22px rgba(0,0,0,.9), 0 2px 0 rgba(0,0,0,.4); text-decoration: none; }
.sheet .edge { display: flex; justify-content: space-between; gap: 12px; margin: 0; padding: 9px 18px;
  background: var(--ink); color: var(--amber); font: 400 10.5px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.sheet .edge a { color: var(--amber); text-decoration: none; }

/* 最新一课 */
.today { margin-bottom: 40px; }
.today .t { display: block; padding: 22px 18px 8px; font: 900 26px/1.3 var(--sans); }
.today .d { display: block; padding: 0 18px; color: var(--ink-2); }
.today .d .code, .rd-lesson .dek .code { color: var(--ink-2); margin-right: 8px; }
.today .go { display: inline-block; margin: 20px 18px 20px; padding: 0 16px; height: 36px; line-height: 36px;
  background: var(--amber); color: var(--amber-ink); font-weight: 700; font-size: 14px; }
.today:hover .go { background: #f2b24f; }
@media (min-width: 900px) { .today .t { font-size: 34px; padding: 28px 28px 10px; } .today .d, .today .go { margin-left: 0; } .today .d { padding: 0 28px; } .today .go { margin: 24px 28px 28px; } }

/* 课程表：一个阶段一卷胶片 */
.map h2, .archive h2, .board h2 { font: 900 20px/1.3 var(--sans); color: var(--paper); margin: 0 0 14px; }
.stage { background: var(--film); margin-bottom: 8px; }
.stage summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: 'c n k' 's s s';
  gap: 6px 12px; align-items: center; padding: 14px 16px; }
.stage summary::-webkit-details-marker { display: none; }
.stage summary > .code:first-child { grid-area: c; }
.stage .sname { grid-area: n; font-weight: 700; color: var(--text); }
.stage .n { grid-area: k; color: var(--mute); }
.stage .strip { grid-area: s; display: flex; gap: 3px; }
.stage .strip i { width: 14px; height: 10px; background: #2a2925; }
.stage .strip i.done { background: var(--paper); }
.stage .strip i.next { background: transparent; box-shadow: inset 0 0 0 1.5px var(--amber); }
@media (min-width: 700px) { .stage summary { grid-template-columns: 64px 1fr auto auto; grid-template-areas: 'c n s k'; } }
.stage[open] summary { border-bottom: 1px solid #262521; }
.stage ol { list-style: none; margin: 0; padding: 6px 0; }
.stage li > a, .stage li > div { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: start; padding: 10px 16px; text-decoration: none; }
.stage li > a:hover { background: var(--film-2); }
.stage .num { width: 36px; height: 28px; display: grid; place-items: center; font: 700 11px/1 var(--mono); color: var(--dim); box-shadow: inset 0 0 0 1px #2e2d29; }
.stage li.done .num { background: var(--paper); color: var(--ink); box-shadow: none; }
.stage li.next .num { color: var(--amber); box-shadow: inset 0 0 0 1.5px var(--amber); }
.stage .lbl b { display: block; font-weight: 500; color: var(--mute); }
.stage li.done .lbl b, .stage li.next .lbl b { color: var(--text); }
.stage .lbl span { display: block; font-size: 13px; color: var(--dim); line-height: 1.5; margin-top: 2px; }
.stage li > * > .code { padding-top: 5px; }

/* 往期：一条样片，横着滑 */
.archive { margin-top: 44px; }
.frames { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; scroll-snap-type: x mandatory; }
.frame { flex: 0 0 220px; scroll-snap-align: start; background: var(--film); padding: 14px; text-decoration: none; display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.frame b { font-weight: 700; color: var(--text); line-height: 1.4; }
.frame > span:last-child:not(.code) { color: var(--mute); font-size: 13px; }
.frame:hover { box-shadow: inset 0 0 0 1.5px var(--amber); }

/* 长文页 */
.crumbs { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0 16px; }
.crumbs a { color: var(--mute); text-decoration: none; font-size: 14px; }
.crumbs a:hover { color: var(--text); }
.rd-lesson .sheet { padding-bottom: 28px; }
.rd-lesson .sheet > :not(.edge):not(details) { margin-left: 18px; margin-right: 18px; }
.rd-lesson .sheet > details { margin: 28px 18px 0; }
@media (min-width: 700px) {
  .rd-lesson .sheet > :not(.edge):not(details) { margin-left: 44px; margin-right: 44px; }
  .rd-lesson .sheet > details { margin: 32px 44px 0; }
}
.rd-lesson h1 { font: 900 28px/1.3 var(--sans); margin-top: 26px; margin-bottom: 12px; letter-spacing: .01em; }
@media (min-width: 700px) { .rd-lesson h1 { font-size: 36px; margin-top: 36px; } }
.rd-lesson .dek { font-size: 16px; color: var(--ink-2); margin-top: 0; }
.rd-lesson .meta { display: flex; gap: 16px; margin-top: 0; }
.rd-lesson .meta .code { color: var(--ink-2); }
.toc { display: flex; flex-wrap: wrap; gap: 6px; padding: 14px 0 6px; border-top: 1px solid var(--rule); margin-top: 18px; }
.toc a { height: 28px; line-height: 28px; padding: 0 10px; font-size: 13px; text-decoration: none; color: var(--ink); box-shadow: inset 0 0 0 1px var(--rule); }
.toc a:hover { box-shadow: inset 0 0 0 1px var(--ink); }

.part { font-size: 16.5px; line-height: 1.85; }
.part h2 { font: 900 22px/1.35 var(--sans); margin: 44px 0 14px; padding-top: 18px; border-top: 2px solid var(--ink); }
.part h3 { font: 700 18px/1.4 var(--sans); margin: 30px 0 8px; }
.part h4 { font: 700 16.5px/1.5 var(--sans); margin: 22px 0 6px; }
.part p { margin: 0 0 14px; }
.part strong { font-weight: 700; }
.part a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--amber); text-decoration-thickness: 2px; text-underline-offset: 3px; word-break: break-word; }
.part a:hover { background: rgba(233,164,60,.18); }
.part ul, .part ol { margin: 0 0 14px; padding-left: 1.4em; }
.part li { margin: 4px 0; }
.part li > ul, .part li > ol { margin: 4px 0; }
.part li .cont { display: block; margin-top: 4px; }
.part li.task { list-style: none; margin-left: -1.2em; }
.part .tick { display: inline-block; width: 16px; height: 16px; margin-right: 8px; vertical-align: -2px; box-shadow: inset 0 0 0 1.5px var(--ink-2); text-align: center; font-size: 12px; line-height: 16px; }
.part .tick.on { background: var(--ink); color: var(--paper); box-shadow: none; }
.part blockquote { margin: 0 0 16px; padding: 2px 0 2px 14px; border-left: 3px solid var(--ink); color: var(--ink-2); font-size: 15px; }
.part blockquote p:last-child { margin-bottom: 0; }
.part hr { border: 0; border-top: 1px solid var(--rule); margin: 28px 0; }
.part code { font-family: var(--mono); font-size: .86em; background: var(--rule-2); padding: 1px 5px; }
.part pre.code { margin: 0 0 16px; padding: 14px 16px; background: var(--film); color: var(--text); overflow-x: auto; font: 400 13px/1.7 var(--mono); }
.part pre.code code { background: none; padding: 0; font-size: inherit; }
.table { overflow-x: auto; margin: 0 0 18px; -webkit-overflow-scrolling: touch; }
.table table { border-collapse: collapse; min-width: 100%; font-size: 14px; line-height: 1.6; }
.table th { text-align: left; font-weight: 700; padding: 8px 12px 8px 0; border-bottom: 2px solid var(--ink); white-space: nowrap; }
.table td { padding: 8px 12px 8px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.table td:first-child { min-width: 6em; }

/* 答案默认收起 */
details.answers { background: var(--rule-2); font-size: 16px; line-height: 1.8; }
details.answers summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center;
  padding: 0 16px; height: 44px; background: var(--ink); color: var(--paper); font-weight: 900; }
details.answers summary::-webkit-details-marker { display: none; }
details.answers summary span { font: 400 11px/1 var(--mono); color: var(--amber); letter-spacing: .07em; }
details.answers[open] summary span { visibility: hidden; }
details.answers > :not(summary) { margin-left: 16px; margin-right: 16px; }
details.answers > :nth-child(2) { margin-top: 16px; }
details.answers > :last-child { margin-bottom: 18px; }
details.answers ol, details.answers ul { padding-left: 1.4em; }
details.answers .cont { display: block; margin-top: 4px; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 24px; }
.pager a { background: var(--film); padding: 14px 16px; text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 6px; line-height: 1.4; }
.pager a.next { text-align: right; }
.pager a:hover { box-shadow: inset 0 0 0 1.5px var(--amber); }

/* 趋势：三行结论 + 看板 */
.concl { margin-bottom: 36px; }
.concl h2 { font: 900 22px/1.3 var(--sans); margin: 22px 18px 10px; color: var(--ink); }
.concl ol { margin: 0 18px 22px; padding-left: 1.3em; font-size: 16px; line-height: 1.8; }
.concl ol li { margin: 8px 0; }
.concl a { color: var(--ink); text-decoration-color: var(--amber); text-decoration-thickness: 2px; text-underline-offset: 3px; }
@media (min-width: 900px) { .concl h2 { margin: 26px 28px 10px; } .concl ol { margin: 0 28px 26px; } }
.board { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 900px) { .board { grid-template-columns: 1fr 1fr; } .board .wide, .board .kpis { grid-column: 1 / -1; } }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--film); padding: 14px 16px; }
.kpi .n { font: 700 30px/1.1 var(--mono); color: var(--paper); }
.kpi .l { font-size: 13px; color: var(--mute); margin-top: 6px; }
.kpi .d { font-size: 12px; color: var(--dim); margin-top: 4px; line-height: 1.5; }
.panel { background: var(--film); padding: 16px; min-width: 0; }
.panel h2 { font-size: 17px; margin-bottom: 6px; }
.panel .hint { margin: 0 0 12px; font-size: 13px; color: var(--mute); line-height: 1.55; }
.ch { position: relative; height: 260px; }
.ch.tall { height: 360px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 12px; color: var(--mute); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; display: inline-block; }
.panel .empty { color: var(--mute); font-size: 14px; }
.panel > .legend { margin: 0 0 10px; }
.legend i.dot { width: 10px; height: 10px; }
.legend i.amber { background: #e9a43c; }
.legend i.grey { background: #77746a; }
.cats { overflow-x: auto; }
.cats table { width: 100%; border-collapse: collapse; font-size: 14px; }
.cats th { text-align: left; font-weight: 400; font-size: 12px; color: var(--dim); padding: 0 8px 8px 0; border-bottom: 1px solid #262521; }
.cats td { padding: 6px 8px 6px 0; border-bottom: 1px solid #1f1e1b; vertical-align: middle; }
.cats .cat { color: var(--text); }
.cats .spark { width: 140px; }
.cats .spark svg { display: block; }
.cats .num { text-align: right; font-family: var(--mono); font-size: 13px; color: var(--mute); white-space: nowrap; }
.cats td.num:nth-child(3) { color: var(--text); }
.cats .num.up { color: var(--text); }
.cats .sr { color: transparent; }
@media (max-width: 420px) { .cats .spark { width: 96px; } .cats .spark svg { width: 96px; } }

.rd-foot { padding: 28px var(--g) 40px; color: var(--dim); font-size: 12px; line-height: 1.6; border-top: 1px solid #141412; }
.rd-foot .code { color: var(--dim); margin-right: 8px; }
