/* UI upgrade layer (Claude, 2026-10). Loaded after the base stylesheets; presentation only. */

/* ---------- Graph canvas: constellation theme ---------- */
:root { --graph-bg: #F7FAFC; --graph-ink: #173B68; --graph-ink-muted: rgb(23 59 104 / .62); --graph-chip: rgb(255 255 255 / .86); --graph-chip-border: rgb(23 59 104 / .12); }
:root[data-graph-theme="dark"] { --graph-bg: #0F1C2E; --graph-ink: #E6F0F9; --graph-ink-muted: rgb(221 236 247 / .66); --graph-chip: rgb(22 41 74 / .82); --graph-chip-border: rgb(156 200 234 / .22); }
.app:not(.path-mode) #graph-workspace #graph-wrap { background: var(--graph-bg); transition: background-color .24s var(--mn-ease-out); }
#graph-workspace .graph-help { background: transparent; color: var(--graph-ink-muted); }
#graph-workspace .zoom { gap: 0; padding: 4px; border: 1px solid var(--graph-chip-border); border-radius: 12px; background: var(--graph-chip); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 6px 20px rgb(15 28 46 / .08); }
#graph-workspace .zoom button { width: 36px; height: 36px; min-height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--graph-ink); font-size: 18px; }
#graph-workspace .zoom button:hover { background: rgb(79 143 215 / .12); }
#graph-theme-toggle[aria-pressed="true"] { color: var(--gc-blue); }
.graph-math-label { color: var(--graph-ink); }
:root[data-graph-theme="dark"] #tooltip { background: #16294A; color: #E6F0F9; border-color: rgb(156 200 234 / .3); }
@media (prefers-reduced-motion: reduce) { .app:not(.path-mode) #graph-workspace #graph-wrap { transition: none; } }

/* ---------- Header: calmer chrome ---------- */
header { box-shadow: 0 1px 0 rgb(23 59 104 / .06); border-bottom-color: transparent !important; }
.file-menu > summary { border-color: #D4DFEA; border-radius: 10px; }
.file-menu > div { border: 0; border-radius: 14px; box-shadow: 0 18px 44px rgb(15 28 46 / .16), 0 1px 3px rgb(15 28 46 / .08); }
.search { border-radius: 12px !important; }
@media (max-width: 760px) {
  #total { display: none; }
  .header-actions { gap: 8px; }
  .file-menu > summary { width: 44px; padding: 0; justify-content: center; font-size: 0; }
  .file-menu > summary::before { content: '⋯'; font-size: 20px; line-height: 1; }
  .file-menu > summary::after { display: none; }
}

/* ---------- Node-type legend on the canvas: colour = what the node is ---------- */
#graph-type-legend { position: absolute; bottom: 58px; left: 16px; z-index: 6; display: grid; gap: 2px; padding: 8px; border: 1px solid var(--graph-chip-border); border-radius: 14px; background: var(--graph-chip); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 8px 24px rgb(15 28 46 / .08); }
#graph-type-legend button { display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 8px; min-height: 30px; padding: 3px 8px; border: 0; border-radius: 8px; background: transparent; color: var(--graph-ink); font-size: 13px; line-height: 1.3; text-align: left; cursor: pointer; }
#graph-type-legend button:hover { background: rgb(79 143 215 / .1); }
#graph-type-legend button small { color: var(--graph-ink-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
#graph-type-legend button[aria-pressed="false"] { opacity: .42; }
#graph-type-legend button[aria-pressed="false"] span { text-decoration: line-through; }
#tooltip { display: grid; gap: 2px; border: 0; border-radius: 10px; box-shadow: 0 10px 28px rgb(15 28 46 / .16); }
#tooltip b { font-size: 14px; font-weight: 600; }
#tooltip small { color: var(--mn-text-muted); font-size: 12.5px; }
.tooltip-type { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--mn-text-muted); }
.tooltip-type::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--swatch); }
:root[data-graph-theme="dark"] #tooltip small, :root[data-graph-theme="dark"] .tooltip-type { color: rgb(221 236 247 / .7); }
@media (max-width: 760px) {
  #graph-type-legend { top: 8px; left: 8px; right: 8px; grid-template-columns: repeat(4, auto); justify-content: start; overflow-x: auto; padding: 4px; }
  #graph-type-legend button { grid-template-columns: 10px auto; gap: 5px; padding: 2px 6px; font-size: 12px; white-space: nowrap; }
  #graph-type-legend button small { display: none; }
}
/* Keep badge colours identical to the graph legend. */
[data-node-type="SKILL"] { --mn-type-color: #4A9A57; --category-tint: #EDF6EE; }
@media (max-width: 760px) { #graph-type-legend { bottom: auto; top: 8px; } }


/* ---------- Public view: internal curation states stay out of sight (?review=1 shows them) ---------- */
:root:not([data-review-mode]) :is(
  .r80-source-links, .r80-relation-proposals, .r80-proposals, .r80-branch-record, .r80-relation-trace, .r80-note,
  .r80-record-id, .r80-formula-status, .r80-scope, .r80-origin, .requirement-trace, .requirement-reference, .requirement-raw,
  .requirement-context, .requirement-framework, .requirement-missing, .competency-evidence, .support-scope,
  .reader-application-branches summary small, .method-nav-links small:not(.thought-relation-note), #r80-unassigned, .textbook-copy-origin, .path-footnote, .content-status
) { display: none !important; }
:root:not([data-review-mode]) .reader-requirements:not(:has(.requirement-main, .requirement-level)) { display: none !important; }
#total { display: none !important; }

/* ---------- Reading typography ---------- */
#reader-dialog { border: 0; border-radius: 20px; box-shadow: 0 24px 64px rgb(15 28 46 / .18), 0 2px 6px rgb(15 28 46 / .06); background: #fff; }
#reader-dialog .current-node { background: transparent; border-bottom: 0; }
#reader-dialog .current-node h1 { margin: 6px 0 14px; font-size: 28px; line-height: 1.3; }
#reader-title:focus { outline: none; }
.reader-overview p, .reader-overview .reader-description, .textbook-content p, .textbook-content li, .r80-content-body p, .r80-content-body li, .thought-lead {
  font-family: "Songti SC","STSong","Noto Serif CJK SC","Source Han Serif SC","Noto Serif SC",serif; font-size: 16.5px; line-height: 1.9; color: #1D3557; }
.textbook-inline-math, .r80-math:not(.display) { margin: 0 .14em; }
.reader-overview .textbook-formula, .r80-math.display, .textbook-formula { padding: 14px 18px; border-radius: 12px; background: #F4F8FC; overflow-x: auto; }

/* ---------- Reader tabs: 概念 / 题目 / 关系 ---------- */
.path-jumps, .current-node > .reader-actions, .current-node > .reader-method-summary, .current-node > .method-summary { display: none !important; }
.reader-tabs { position: sticky; top: 0; z-index: 4; display: flex; gap: 4px; margin: 0 0 18px; padding: 6px 0 8px; background: linear-gradient(#fff 82%, rgb(255 255 255 / 0)); border-bottom: 1px solid #EEF2F6; }
.reader-tabs button { position: relative; min-height: 38px; padding: 4px 14px; border: 0; border-radius: 10px; background: transparent; color: rgb(23 59 104 / .62); font-size: 15px; font-weight: 500; }
.reader-tabs button small { margin-left: 3px; font-size: 12px; color: rgb(23 59 104 / .45); font-variant-numeric: tabular-nums; }
.reader-tabs button:hover { background: #F3F6F9; color: var(--mn-text); }
.reader-tabs button[aria-selected="true"] { color: var(--mn-text); }
.reader-tabs button[aria-selected="true"]::after { content: ''; position: absolute; left: 14px; right: 14px; bottom: -9px; height: 2px; border-radius: 2px; background: #173B68; }
#learning-path[data-tab="concept"] :is(.r80-reading, .reader-application-branches, .reader-exercises, .reader-method-navigation, .path-controls, .path-columns, .method-section) { display: none !important; }
#learning-path[data-tab="examples"] .current-node > :not(.reader-meta, h1, .reader-tabs, .r80-reading, .reader-application-branches, .reader-exercises),
#learning-path[data-tab="examples"] :is(.path-controls, .path-columns, .method-section, .reader-reference, .path-footnote) { display: none !important; }
#learning-path[data-tab="relations"] .current-node > :not(.reader-meta, h1, .reader-tabs, .reader-method-navigation),
#learning-path[data-tab="relations"] :is(.reader-reference, .path-footnote) { display: none !important; }
#learning-path[data-tab="relations"] .current-column { border-bottom: 0; padding-bottom: 0; }
.reader-meta .role-badge { display: none; }

/* ---------- Problems: a calm numbered list; questions first, solutions on demand ---------- */
.r80-examples-head { display: grid; gap: 8px; margin: 4px 0 10px; }
.r80-examples-head h3 { margin: 0; font-size: 17px; }
.r80-examples-head h3 span { color: rgb(23 59 104 / .45); font-weight: 400; font-size: 14px; }
.r80-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.r80-filters > span { color: rgb(23 59 104 / .5); font-size: 12.5px; margin-right: 2px; }
.r80-filters button { min-height: 30px; padding: 2px 11px; border: 1px solid #E1E8EF; border-radius: 999px; background: #fff; color: rgb(23 59 104 / .75); font-size: 13px; }
.r80-filters button small { color: rgb(23 59 104 / .45); }
.r80-filters button[aria-pressed="true"] { border-color: #173B68; background: #173B68; color: #fff; }
.r80-filters button[aria-pressed="true"] small { color: rgb(255 255 255 / .7); }
.r80-filters.is-methods button[aria-pressed="true"] { border-color: #7A6F9F; background: #7A6F9F; }
.r80-example-list { border-top: 1px solid #EEF2F6; }
.r80-reading:not(.show-all):not([data-filtering="1"]) .r80-example-list > .r80-content.is-overflow { display: none; }
.r80-example-list > .r80-content.is-filtered-out { display: none; }
.r80-reading.show-all .r80-show-all, .r80-reading[data-filtering="1"] .r80-show-all { display: none; }
.r80-example-list > .r80-content { margin: 0 !important; border: 0 !important; border-bottom: 1px solid #EEF2F6 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; padding: 0 !important; }
.r80-example-list > .r80-content > summary { display: grid !important; grid-template-columns: 26px 1fr 14px; grid-template-areas: "n t c" "n m c"; align-items: center; column-gap: 10px; row-gap: 1px; min-height: 54px; padding: 9px 4px !important; list-style: none; cursor: pointer; }
.r80-example-list > .r80-content > summary::-webkit-details-marker { display: none; }
.r80-index { grid-area: n; align-self: start; margin-top: 2px; width: 24px; height: 24px; border-radius: 8px; background: #F3F6F9; color: rgb(23 59 104 / .6); font-size: 12px; line-height: 24px; text-align: center; font-variant-numeric: tabular-nums; }
.r80-example-list > .r80-content > summary b { grid-area: t; font-size: 15px; font-weight: 500; line-height: 1.5; }
.r80-example-list > .r80-content > summary small { grid-area: m; display: flex !important; flex-wrap: wrap; gap: 4px 10px; color: rgb(23 59 104 / .55); font-size: 12.5px; }
.r80-example-list > .r80-content > summary::after { grid-area: c; content: ''; width: 7px; height: 7px; border-right: 1.5px solid rgb(23 59 104 / .4); border-bottom: 1.5px solid rgb(23 59 104 / .4); transform: rotate(45deg); transition: transform .16s ease; }
.r80-example-list > .r80-content[open] > summary::after { transform: rotate(-135deg); }
.r80-kind { color: #46617F; }
.r80-kind::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: #58769D; vertical-align: 1px; }
.r80-kind[data-kind="context"]::before { background: #528584; }
.r80-kind[data-kind="method_application"]::before, .r80-kind[data-kind="contrast"]::before { background: #7A6F9F; }
.r80-uses { color: #6E5FA6; }
.r80-uses::before { content: '◆ '; font-size: 9px; vertical-align: 1px; }
.r80-example-list > .r80-content > .r80-content-body { margin: 0 0 14px 36px !important; padding: 2px 0 4px 14px !important; border-left: 2px solid #E8EEF4; }
.r80-solution { margin: 8px 0 4px; }
.r80-solution > summary { display: inline-flex; align-items: center; min-height: 34px; padding: 4px 14px; border: 1px solid #D7E0EA; border-radius: 10px; background: #fff; color: #3E6FA8; font-size: 13.5px; cursor: pointer; list-style: none; }
.r80-solution > summary::-webkit-details-marker, .r80-solution > summary::after { display: none !important; }
.r80-solution[open] > summary { margin-bottom: 8px; font-size: 0; color: rgb(23 59 104 / .55); }
.r80-solution[open] > summary::before { content: '收起解答'; font-size: 13.5px; }
.r80-show-all { margin: 12px 0 4px; min-height: 40px; width: 100%; border: 1px dashed #CFDAE6; border-radius: 12px; background: #FAFCFE; color: var(--mn-text); font-size: 14px; }
.r80-show-all:hover { border-style: solid; border-color: #4F8FD7; color: #4F8FD7; }
/* Wide reader: two-pane study view */
.r80-reading.is-split { display: grid; grid-template-columns: minmax(260px, 38%) 1fr; grid-template-areas: "head head" "list pane" "more pane"; column-gap: 28px; align-items: start; }
.r80-reading.is-split > .r80-examples-head { grid-area: head; }
.r80-reading.is-split > .r80-example-list { grid-area: list; }
.r80-reading.is-split > .r80-show-all { grid-area: more; }
.r80-reading.is-split > :not(.r80-examples-head, .r80-example-list, .r80-show-all, .r80-study-pane) { grid-column: 1 / -1; }
.r80-reading.is-split .r80-example-list > .r80-content > .r80-content-body { display: none !important; }
.r80-reading.is-split .r80-example-list > .r80-content > summary::after { transform: rotate(-45deg); }
.r80-reading.is-split .r80-example-list > .r80-content.is-chosen > summary { background: #F3F7FB; border-radius: 10px; }
.r80-reading.is-split .r80-example-list > .r80-content.is-chosen .r80-index { background: #173B68; color: #fff; }
.r80-study-pane { grid-area: pane; position: sticky; top: 64px; max-height: calc(100vh - 160px); overflow-y: auto; padding: 18px 22px; border-radius: 16px; background: #FAFCFE; border: 1px solid #EEF2F6; }
.r80-study-head small { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12.5px; color: rgb(23 59 104 / .55); }
.r80-study-head h4 { margin: 4px 0 12px; font-size: 18px; line-height: 1.45; }
:root:not([data-review-mode]) .requirement-category:not(:has(.requirement-main, .requirement-level)) { display: none !important; }
@media (max-width: 760px) {
  #graph-type-legend { top: auto !important; bottom: 10px !important; left: 8px !important; right: 132px !important; display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  #graph-type-legend[hidden] { display: none !important; }
}

/* ---------- One layout everywhere: the catalog is a drawer, never a column ---------- */
.app, .app.notes-open, .app.catalog-collapsed, .app.path-mode { grid-template-columns: minmax(0, 1fr) !important; }
.app > .left { position: fixed !important; top: 0; bottom: 0; left: 0; z-index: 60; display: block !important; width: min(340px, calc(100vw - 24px)); visibility: hidden; pointer-events: none; transform: translateX(-100%);
  border-radius: 0 20px 20px 0; box-shadow: 0 24px 64px rgb(15 28 46 / .18); transition: transform .24s cubic-bezier(.32,.72,0,1), visibility 0s linear .24s; }
.app > .left.open { visibility: visible; pointer-events: auto; transform: translateX(0); transition-delay: 0s; }
.app > .left .left-body { padding: 18px 20px 24px; }
#catalog-close { display: block !important; margin: 0 0 14px auto; }
#nav-backdrop:not([hidden]) { position: fixed; inset: 0; z-index: 59; display: block; min-height: 0; padding: 0; border: 0; border-radius: 0; background: rgb(15 28 46 / .22); }
#catalog-layout-toggle { display: none !important; }
#nav-toggle { display: inline-flex !important; align-items: center; gap: 6px; width: auto !important; height: 40px !important; min-height: 40px; padding: 0 12px !important; border: 1px solid #D7E0EA; border-radius: 12px; background: #fff; color: var(--mn-text); font-size: 14px; }
@media (max-width: 900px) { #nav-toggle span { display: none; } #nav-toggle { padding: 0 10px !important; } }


/* ---------- One visual vocabulary: colour + shape per kind, used by every view ---------- */
:root { --k-competency:#94627F; --k-book:#58769D; --k-chapter:#528584; --k-lesson:#C4CCD2; --k-topic:#AB7F81; --k-knowledge:#B8996D; --k-method:#7A6F9F; --k-skill:#739373; --k-thought:#A0805A; }
.kn-icon, #graph-type-legend i { display: inline-block; flex: none; width: 10px; height: 10px; background: var(--swatch, var(--k-knowledge)); border-radius: 50%; vertical-align: -1px; }
:is(.kn-icon, #graph-type-legend i)[data-shape="method"] { width: 8px; height: 8px; border-radius: 1px; transform: rotate(45deg); }
:is(.kn-icon, #graph-type-legend i)[data-shape="thought"] { width: 11px; height: 10px; border-radius: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
:is(.kn-icon, #graph-type-legend i)[data-shape="competency"] { width: 11px; height: 11px; border-radius: 0; clip-path: polygon(50% 0,100% 25%,100% 75%,50% 100%,0 75%,0 25%); }
:is(.kn-icon, #graph-type-legend i):is([data-shape="book"],[data-shape="chapter"]) { border-radius: 3px; }
:is(.kn-icon, #graph-type-legend i)[data-shape="topic"] { background: transparent; box-shadow: inset 0 0 0 2.5px var(--swatch, var(--k-topic)); }
:is(.kn-icon, #graph-type-legend i)[data-shape="lesson"] { width: 6px; height: 6px; }
.app > main > .status { display: none !important; }
.lens-diag h4 { white-space: nowrap; }

/* Thought provenance is learning content, not internal review metadata. */
.reader-method-navigation .method-nav-links .thought-relation-note { display:block; max-width:380px; overflow-wrap:anywhere; }
