/* 母题课“问 AI”：顶部黑色胶囊（灵动岛）＋展开面板＋选中文字后的气泡 */
.has-ai .nav .t { visibility: hidden; }
.ai-pill { position: fixed; z-index: 33; top: calc(var(--safe-t) + 10px); left: 50%; transform: translateX(-50%); height: 32px; display: flex; align-items: center; gap: 7px;
  padding: 0 15px 0 12px; border: 0; border-radius: 999px; background: #000; color: #fff; font: 650 14px var(--font); cursor: pointer; white-space: nowrap; overflow: hidden;
  box-shadow: 0 4px 14px rgba(0,0,0,.16); transition: opacity .2s, transform .25s var(--ease); }
.ai-pill:active { transform: translateX(-50%) scale(.95); }
.ai-open .ai-pill { opacity: 0; pointer-events: none; }
.ai-pill .tm { font-variant-numeric: tabular-nums; color: rgba(255,255,255,.62); min-width: 2.4em; }
.ai-pill .ok { font-style: normal; width: 18px; height: 18px; border-radius: 50%; background: #34c759; color: #000; font: 800 12px/18px var(--font); text-align: center; }
.ai-pill .ok.bad { background: #ff6b5a; }
.ic { background: linear-gradient(135deg, #a5a3ff, #ff9f5a); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 800; }
.sp { display: inline-block; flex: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(165,163,255,.25); border-top-color: #a5a3ff; animation: aispin .8s linear infinite; }
@keyframes aispin { to { transform: rotate(360deg); } }
@media (prefers-color-scheme: dark) { .ai-pill { box-shadow: 0 0 0 .5px rgba(255,255,255,.24); } }

.ai-shade { position: fixed; inset: 0; z-index: 44; background: rgba(0,0,0,.22); }
.ai-pn { position: fixed; z-index: 45; top: calc(var(--safe-t) + 6px); left: 50%; transform: translateX(-50%); width: min(720px, calc(100vw - 16px));
  height: min(86vh, calc(100dvh - var(--safe-t) - 14px)); display: flex; flex-direction: column; overflow: hidden;
  background: var(--card); color: var(--label); border-radius: 26px; box-shadow: 0 24px 70px rgba(0,0,0,.28), 0 0 0 .5px var(--sep); }
.ai-pn[hidden], .ai-shade[hidden] { display: none; }
@media (min-width: 1100px) {
  .ai-pn { left: auto; right: 14px; transform: none; width: 460px; height: calc(100vh - var(--safe-t) - 20px); }
  .ai-shade { display: none; }
}
.ai-hd { display: flex; align-items: center; gap: 8px; padding: 10px 10px 9px 16px; border-bottom: .5px solid var(--sep); }
.ai-hd .nm { font: 700 15px var(--round); display: flex; gap: 5px; align-items: center; white-space: nowrap; }
.ai-seg { display: flex; background: var(--fill); border-radius: 10px; padding: 2px; margin-left: auto; }
.ai-seg button { font: 600 13px var(--font); border: 0; background: none; color: var(--label); padding: 6px 11px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.ai-seg button.on { background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.14); }
@media (prefers-color-scheme: dark) { .ai-seg button.on { background: #48484a; } }
.ai-hd .rb { flex: none; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--fill); color: var(--label-2); cursor: pointer; display: grid; place-items: center; padding: 0; }
.ai-main { flex: 1; overflow: auto; padding: 14px 18px 22px; position: relative; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.ai-main [hidden] { display: none; }

.ai-empty { text-align: center; color: var(--label-2); font-size: 14.5px; line-height: 1.8; padding: 28px 10px; }
.ai-empty .big { font-size: 34px; margin-bottom: 6px; }
.ai-empty p { margin: 0 0 .6em; } .ai-empty b { color: var(--label); }
.ai-empty .s { font-size: 13px; color: var(--label-3); }

.ai-quote { background: var(--fill); border-radius: 14px; padding: 9px 14px 10px; margin-bottom: 6px; font-size: 14.5px; line-height: 1.7; color: var(--label-2); }
.ai-quote .sec { font: 650 12.5px var(--font); color: var(--indigo); margin-bottom: 3px; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.ai-quote .sec button { flex: none; font: 600 12.5px var(--font); color: var(--blue); background: none; border: 0; padding: 0; cursor: pointer; }
.ai-quote .tx { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.ai-quote.full .tx { -webkit-line-clamp: unset; display: block; }

.ai-q { margin: 16px 0 10px auto; width: fit-content; max-width: 86%; background: var(--indigo); color: #fff; border-radius: 17px 17px 5px 17px; padding: 8px 13px; font: 500 15px/1.6 var(--font); white-space: pre-wrap; }
.ai-a { font-size: 15.5px; line-height: 1.85; overflow-wrap: anywhere; }
.ai-a p { margin: 0 0 .8em; }
.ai-a h3 { font: 700 16.5px/1.45 var(--round); margin: 1.2em 0 .45em; }
.ai-a h4 { font: 700 15.5px/1.45 var(--font); margin: 1em 0 .4em; }
.ai-a ul, .ai-a ol { padding-left: 1.35em; margin: 0 0 .8em; }
.ai-a li { margin-bottom: .3em; } .ai-a li > ul, .ai-a li > ol { margin: .3em 0 0; }
.ai-a strong { font-weight: 650; }
.ai-a code { font: 13.5px ui-monospace, Menlo, monospace; background: var(--fill); padding: 1px 5px; border-radius: 5px; }
.ai-a pre { overflow: auto; background: var(--fill); padding: 10px 12px; border-radius: 10px; font-size: 13px; line-height: 1.6; }
.ai-a pre code { background: none; padding: 0; }
.ai-a blockquote { margin: 0 0 .8em; padding: 2px 0 2px 12px; border-left: 3px solid var(--sep); color: var(--label-2); }
.ai-a hr { border: 0; height: 1px; background: var(--sep); margin: 1.2em 0; }
.ai-a .sc { overflow-x: auto; margin: 0 0 .9em; border-radius: 12px; box-shadow: 0 0 0 .5px var(--sep); }
.ai-a table { font-size: 13.5px; line-height: 1.6; }
.ai-a th, .ai-a td { padding: 7px 10px; }
.ai-a td:first-child { white-space: normal; min-width: 4.5em; }
.ai-fig { margin: 12px -8px 16px; }
.ai-fig .pp { background: #fbf8f1; border-radius: 16px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--paper-edge); }
.ai-fig iframe { display: block; width: 100%; height: 280px; border: 0; background: #fbf8f1; }
.ai-fig figcaption { font-size: 13.5px; line-height: 1.6; color: var(--label-2); margin: 7px 8px 0; }
.ai-fig figcaption b { color: var(--label); font-weight: 650; }
.ai-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--label-3); margin: 2px 0 6px; }
.ai-meta button { font: 600 12px var(--font); color: var(--label-2); background: var(--fill); border: 0; border-radius: 999px; padding: 3px 10px; cursor: pointer; }
.ai-wait { display: flex; gap: 10px; align-items: flex-start; background: color-mix(in srgb, var(--indigo) 8%, transparent); border-radius: 14px; padding: 11px 14px; }
.ai-wait .sp { margin-top: 4px; border-color: color-mix(in srgb, var(--indigo) 25%, transparent); border-top-color: var(--indigo); }
.ai-wait b { font: 650 14.5px var(--font); } .ai-wait .tm { font-variant-numeric: tabular-nums; color: var(--indigo); margin-left: 4px; }
.ai-wait small { display: block; font-size: 13px; line-height: 1.6; color: var(--label-2); margin-top: 2px; }
.ai-err { background: rgba(192,83,59,.09); color: #c0533b; border-radius: 14px; padding: 10px 14px; font-size: 14px; line-height: 1.6; display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.ai-err button { flex: none; font: 650 13.5px var(--font); color: #fff; background: #c0533b; border: 0; border-radius: 999px; padding: 6px 14px; cursor: pointer; }

.ai-ft { border-top: .5px solid var(--sep); padding: 8px 10px calc(10px + var(--safe-b)); }
.ai-ft[hidden] { display: none; }
.ai-chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; }
.ai-chips::-webkit-scrollbar { display: none; }
.ai-chips button { flex: none; font: 600 13.5px var(--font); color: var(--indigo); background: color-mix(in srgb, var(--indigo) 11%, transparent); border: 0; border-radius: 999px; padding: 7px 12px; cursor: pointer; }
.ai-chips button:disabled, .ai-in button:disabled { opacity: .35; cursor: default; }
.ai-in { display: flex; gap: 8px; align-items: flex-end; margin: 0; }
.ai-in textarea, .ai-in input { flex: 1; min-width: 0; resize: none; font: 16px/1.45 var(--font); color: var(--label); background: var(--fill); border: 0; border-radius: 19px; padding: 8px 14px; max-height: 132px; min-height: 38px; outline: none; }
.ai-in button { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--indigo); color: #fff; cursor: pointer; display: grid; place-items: center; padding: 0; }
.ai-code p { font-size: 13.5px; line-height: 1.6; color: var(--label-2); margin: 2px 4px 8px; }
.ai-code p.bad { color: #c0533b; }

.ai-li { padding: 11px 4px; border-bottom: .5px solid var(--sep); cursor: pointer; }
.ai-li:hover { background: color-mix(in srgb, var(--fill) 50%, transparent); }
.ai-li .h { display: flex; justify-content: space-between; gap: 10px; font: 600 12.5px var(--font); color: var(--indigo); }
.ai-li .h span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-li .h small { flex: none; color: var(--label-3); font-weight: 500; }
.ai-li .qu { font-size: 14.5px; line-height: 1.6; margin: 4px 0 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ai-li .f { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--label-2); }
.ai-li .f span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-li .f .b { color: var(--indigo); flex: none; } .ai-li .f .e { color: #c0533b; flex: none; }
.ai-li .del { margin-left: auto; flex: none; font: 500 12.5px var(--font); color: var(--label-3); background: none; border: 0; padding: 2px 4px; cursor: pointer; }
.ai-li .del:hover { color: #c0533b; }
.ai-flt { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--label-2); padding: 0 4px 6px; }
.ai-flt button { font: 600 13px var(--font); color: var(--blue); background: none; border: 0; cursor: pointer; }
.ai-note { font-size: 12.5px; color: var(--label-3); text-align: center; padding: 10px 0 0; }

.ai-sel { position: fixed; z-index: 46; display: flex; align-items: center; height: 36px; padding: 0 4px; border-radius: 999px; background: #000; box-shadow: 0 6px 22px rgba(0,0,0,.28); animation: aipop .2s var(--ease); }
.ai-sel[hidden] { display: none; }
.ai-sel button { font: 650 14px var(--font); color: #fff; background: none; border: 0; padding: 0 11px; height: 36px; cursor: pointer; white-space: nowrap; }
.ai-sel i { width: 1px; height: 16px; background: rgba(255,255,255,.25); }
@keyframes aipop { from { transform: scale(.75); opacity: 0; } }
@media (prefers-color-scheme: dark) { .ai-sel { box-shadow: 0 0 0 .5px rgba(255,255,255,.24), 0 6px 22px rgba(0,0,0,.5); } }

.ai-mk { font: 700 11.5px/1.5 var(--font); color: var(--indigo); background: color-mix(in srgb, var(--indigo) 12%, transparent); border: 0; border-radius: 999px; padding: 0 7px; margin-left: 5px; vertical-align: 2px; cursor: pointer; white-space: nowrap; }
.ai-tip { position: fixed; z-index: 47; left: 50%; transform: translateX(-50%); top: calc(var(--safe-t) + 50px); background: #000; color: #fff; font: 600 13.5px var(--font); padding: 8px 14px; border-radius: 999px; animation: aipop .2s var(--ease); }
@media (max-width: 560px) { .ai-main { padding: 12px 14px 20px; } .ai-hd { padding-left: 13px; } .ai-seg button { padding: 6px 9px; } }

/* 知识点收集：气泡里的“★ 收藏”、正文底色和 ★ 标记、插图上的收藏按钮、面板里的收集本 */
.ai-hd .rb[hidden] { display: none; }
.ai-sel.only button[data-a="go"], .ai-sel.only button[data-a="ask"], .ai-sel.only i { display: none; }
::highlight(muti-clip) { background-color: rgba(255, 204, 0, .3); }
::highlight(muti-clip-on) { background-color: color-mix(in srgb, var(--indigo) 30%, transparent); }
@media (prefers-color-scheme: dark) { ::highlight(muti-clip) { background-color: rgba(255, 204, 0, .22); } }
.cl-mk { font: 700 11.5px/1.5 var(--font); color: #b07800; background: rgba(255, 204, 0, .2); border: 0; border-radius: 999px; padding: 0 7px; margin-left: 5px; vertical-align: 2px; cursor: pointer; white-space: nowrap; }
@media (prefers-color-scheme: dark) { .cl-mk { color: #ffd04d; } }
figure.fig .pp, .ai-fig .pp { position: relative; }
.cl-fb { font: 650 12.5px var(--font); color: var(--label-2); background: color-mix(in srgb, var(--card) 82%, transparent); border: 0; border-radius: 999px; padding: 4px 10px; cursor: pointer; white-space: nowrap;
  box-shadow: 0 0 0 .5px var(--sep), 0 2px 6px rgba(0,0,0,.06); }
.cl-fb.on { color: #b07800; }
@media (prefers-color-scheme: dark) { .cl-fb.on { color: #ffd04d; } }
figure.fig .pp > .cl-fb, .ai-fig .pp > .cl-fb { position: absolute; top: 8px; right: 8px; }
.ai-fig .pp > .cl-fb { color: #6b645c; background: rgba(251,248,241,.9); }
.anim .hd { gap: 8px; } .anim .hd > span { flex: 1; min-width: 0; } .anim .hd > .cl-fb { flex: none; }
.cl-toast { position: fixed; z-index: 47; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-b) + 22px); display: flex; align-items: center; gap: 4px; background: #000; color: #fff;
  font: 600 14px var(--font); padding: 5px 6px 5px 15px; border-radius: 999px; box-shadow: 0 6px 22px rgba(0,0,0,.28); animation: aipop .2s var(--ease); white-space: nowrap; }
.cl-toast button { font: 650 13.5px var(--font); color: #fff; background: rgba(255,255,255,.16); border: 0; border-radius: 999px; padding: 6px 12px; cursor: pointer; }
@media (prefers-color-scheme: dark) { .cl-toast { box-shadow: 0 0 0 .5px rgba(255,255,255,.24), 0 6px 22px rgba(0,0,0,.5); } }
@media print { .cl-mk, .cl-fb, .cl-toast { display: none !important; } }

.cl-box[hidden] { display: none; }
.cl-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cl-bar .cl-seg { margin-left: 0; }
.cl-pr { margin-left: auto; font: 600 13px var(--font); color: var(--blue); background: none; border: 0; padding: 6px 4px; cursor: pointer; }
.cl-tagf { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.cl-tagf::-webkit-scrollbar { display: none; }
.cl-tagf button, .cl-chips button { flex: none; font: 600 13px var(--font); color: var(--label); background: var(--fill); border: 0; border-radius: 999px; padding: 5px 11px; cursor: pointer; white-space: nowrap; }
.cl-tagf button.on, .cl-chips button.on { color: #fff; background: var(--indigo); }
.cl-sync { font-size: 12.5px; color: var(--label-2); padding: 2px 2px 8px; display: flex; align-items: center; gap: 8px; }
.cl-sync.w { color: #b85c00; }
.cl-sync button { flex: none; margin-left: auto; font: 650 12.5px var(--font); color: var(--blue); background: none; border: 0; padding: 2px 0; cursor: pointer; }
.cl-grp { font: 700 14px var(--round); margin: 14px 2px 2px; display: flex; justify-content: space-between; align-items: baseline; }
.cl-grp small { font: 500 12px var(--font); color: var(--label-3); }
.cl-li { padding: 11px 4px 9px; border-bottom: .5px solid var(--sep); }
.cl-li .h { display: flex; justify-content: space-between; gap: 10px; font: 600 12.5px var(--font); color: var(--indigo); }
.cl-li .h span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-li .h small { flex: none; color: var(--label-3); font-weight: 500; }
.cl-tx { font-size: 15px; line-height: 1.75; margin: 5px 0 4px; padding-left: 10px; border-left: 3px solid rgba(255, 204, 0, .75); display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; overflow-wrap: anywhere; }
.cl-tx.full { -webkit-line-clamp: unset; display: block; }
.cl-fig { margin: 7px 0 4px; background: #fbf8f1; border-radius: 14px; padding: 8px; box-shadow: inset 0 0 0 1px var(--paper-edge); min-height: 40px; }
.cl-fig svg { width: 100%; height: auto; display: block; max-width: 560px; margin: 0 auto; }
.cl-fig.ai { padding: 0; } .cl-fig .ai-fig { margin: 0; } .cl-fig .ai-fig figcaption { display: none; }
.cl-fig .ld { display: block; text-align: center; font-size: 13px; color: #6b645c; padding: 10px; }
.cl-cap { font-size: 13.5px; line-height: 1.65; color: var(--label-2); white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.cl-note { font-size: 14px; line-height: 1.65; margin: 5px 0 2px; color: var(--label); background: var(--fill); border-radius: 10px; padding: 6px 10px; white-space: pre-wrap; }
.cl-tg { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0 2px; }
.cl-tg span { font: 600 11.5px/1.7 var(--font); color: var(--indigo); background: color-mix(in srgb, var(--indigo) 11%, transparent); border-radius: 999px; padding: 0 8px; }
.cl-li .f { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin-top: 6px; }
.cl-li .f button { font: 600 12.5px var(--font); color: var(--blue); background: none; border: 0; padding: 2px 0; cursor: pointer; }
.cl-li .f .u { font-size: 12px; color: #b85c00; }
.cl-li .f .del { margin-left: auto; color: var(--label-3); font-weight: 500; }
.cl-li .f .del:hover { color: #c0533b; }
.cl-ed { margin-top: 8px; background: var(--fill); border-radius: 14px; padding: 10px; }
.cl-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cl-chips button { background: var(--card); }
.cl-chips .nt { width: 7.5em; font: 15px var(--font); color: var(--label); background: var(--card); border: 0; border-radius: 999px; padding: 5px 11px; outline: none; }
.cl-ed .nn { display: block; width: 100%; margin-top: 8px; font: 15px/1.5 var(--font); color: var(--label); background: var(--card); border: 0; border-radius: 10px; padding: 8px 10px; resize: vertical; outline: none; }
.cl-ed .r { display: flex; justify-content: flex-end; margin-top: 8px; }
.cl-ed .ok { font: 650 13.5px var(--font); color: #fff; background: var(--indigo); border: 0; border-radius: 999px; padding: 6px 16px; cursor: pointer; }
@media (max-width: 430px) { .ai-hd .nmt { display: none; } }
