Files
MDHelper/mdhelper/resources/reader.css
T
2026-06-18 12:30:37 +08:00

1127 lines
20 KiB
CSS

html {
color-scheme: light;
}
html[data-theme="dark"] {
color-scheme: dark;
}
body {
margin: 0;
background: #f6f7f9;
color: #23272f;
font-family: var(--reader-font-family);
font-size: var(--reader-font-size);
line-height: 1.72;
}
html[data-theme="dark"] body {
background: #17191f;
color: #e4e8ef;
}
.reader {
box-sizing: border-box;
max-width: var(--reader-paper-width);
min-height: 100vh;
margin: 0 auto;
padding: 34px 42px 56px;
background: #ffffff;
}
html[data-theme="dark"] .reader {
background: #20242c;
}
.reader-shell {
box-sizing: border-box;
width: 100%;
min-height: 100vh;
}
.reader-shell.has-reader-toc {
display: grid;
grid-template-columns: minmax(0, var(--reader-paper-width)) minmax(190px, 240px);
gap: 24px;
justify-content: center;
align-items: start;
padding: 0 24px;
}
.reader-shell.has-reader-toc .reader {
grid-column: 1;
grid-row: 1;
width: 100%;
margin: 0;
}
.reader-toc {
box-sizing: border-box;
grid-column: 2;
grid-row: 1;
position: sticky;
top: 18px;
max-height: calc(100vh - 36px);
margin: 24px 0;
padding: 14px 10px 16px;
overflow: auto;
border: 1px solid #d9dee7;
border-radius: 8px;
background: rgba(255, 255, 255, 0.92);
box-shadow: 0 8px 24px rgba(22, 34, 51, 0.08);
}
.reader-toc__title {
margin: 0 6px 10px;
color: #526071;
font-size: 0.82em;
font-weight: 700;
}
.reader-toc__nav {
display: grid;
gap: 2px;
}
.reader-toc__link {
display: block;
min-height: 24px;
padding: 4px 8px;
border-radius: 6px;
color: #415064;
font-size: 0.86em;
line-height: 1.35;
text-decoration: none;
}
.reader-toc__link:hover {
background: #eef4fb;
text-decoration: none;
}
.reader-toc__link.is-active {
background: #dbeafe;
color: #124a7c;
font-weight: 700;
}
.reader-toc__link--level-2 {
padding-left: 18px;
}
.reader-toc__link--level-3 {
padding-left: 30px;
}
.reader-toc__link--level-4,
.reader-toc__link--level-5,
.reader-toc__link--level-6 {
padding-left: 42px;
}
.reader-progress {
position: fixed;
right: 18px;
bottom: 16px;
z-index: 20;
display: flex;
align-items: center;
gap: 8px;
min-width: 128px;
padding: 7px 9px;
border: 1px solid #d3dbe7;
border-radius: 8px;
background: rgba(255, 255, 255, 0.9);
color: #384557;
box-shadow: 0 8px 22px rgba(22, 34, 51, 0.12);
font-size: 12px;
backdrop-filter: blur(8px);
}
.reader-progress__track {
flex: 1;
height: 5px;
overflow: hidden;
border-radius: 999px;
background: #d9e2ef;
}
.reader-progress__bar {
width: 0%;
height: 100%;
border-radius: inherit;
background: #3577b9;
}
.reader-progress__text {
min-width: 34px;
text-align: right;
font-variant-numeric: tabular-nums;
}
html[data-theme="dark"] .reader-toc {
border-color: #3a4352;
background: rgba(32, 36, 44, 0.92);
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}
html[data-theme="dark"] .reader-toc__title {
color: #aeb8c8;
}
html[data-theme="dark"] .reader-toc__link {
color: #c7d0de;
}
html[data-theme="dark"] .reader-toc__link:hover {
background: #2b3543;
}
html[data-theme="dark"] .reader-toc__link.is-active {
background: #1f4a73;
color: #f2f7ff;
}
html[data-theme="dark"] .reader-progress {
border-color: #3a4352;
background: rgba(32, 36, 44, 0.9);
color: #dce5f3;
box-shadow: 0 8px 22px rgba(0, 0, 0, 0.32);
}
html[data-theme="dark"] .reader-progress__track {
background: #3b4656;
}
html[data-theme="dark"] .reader-progress__bar {
background: #6aa9e9;
}
@media (max-width: 1080px) {
.reader-shell.has-reader-toc {
display: block;
padding: 0;
}
.reader-shell.has-reader-toc .reader {
margin: 0 auto;
}
.reader-toc {
grid-column: auto;
grid-row: auto;
position: static;
max-width: var(--reader-paper-width);
max-height: 34vh;
margin: 16px auto 0;
}
}
@media (max-width: 720px) {
.reader-toc {
display: none;
}
.reader-progress {
right: 10px;
bottom: 10px;
min-width: 108px;
}
}
h1,
h2,
h3,
h4 {
line-height: 1.32;
color: #121722;
margin: 1.35em 0 0.55em;
}
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4 {
color: #f4f7fb;
}
h1 {
margin-top: 0;
padding-bottom: 0.34em;
border-bottom: 1px solid #d9dee7;
font-size: 2.05em;
}
h2 {
font-size: 1.48em;
}
h3 {
font-size: 1.2em;
}
p {
margin: 0.74em 0;
}
a {
color: #1769aa;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
html[data-theme="dark"] a {
color: #79b8ff;
}
blockquote {
margin: 1em 0;
padding: 0.55em 1em;
border-left: 4px solid #4f8cc9;
background: #eef5fc;
color: #344258;
}
html[data-theme="dark"] blockquote {
background: #26313f;
color: #d6deeb;
}
.admonition {
margin: 1em 0;
padding: 0.72em 1em;
border: 1px solid #cfe0f2;
border-left: 5px solid #3b82c4;
border-radius: 8px;
background: #f0f7ff;
color: #28384f;
}
.admonition-title {
display: block;
margin: 0 0 0.38em;
color: #17395f;
font-weight: 750;
}
.admonition-title + p,
.admonition p:last-child {
margin-bottom: 0;
}
.admonition-tip {
border-color: #ccebd9;
border-left-color: #2f9e63;
background: #f0fff6;
}
.admonition-note {
border-color: #cfe0f2;
border-left-color: #3b82c4;
background: #f0f7ff;
}
.admonition-warning,
.admonition-caution {
border-color: #f1d7a8;
border-left-color: #d08700;
background: #fff8e8;
}
.admonition-important {
border-color: #e0cef3;
border-left-color: #8b5cf6;
background: #f8f4ff;
}
html[data-theme="dark"] .admonition {
border-color: #344e68;
border-left-color: #5aa5e8;
background: #1e2b38;
color: #dce8f4;
}
html[data-theme="dark"] .admonition-title {
color: #f0f7ff;
}
html[data-theme="dark"] .admonition-tip {
border-color: #294f39;
border-left-color: #54c07d;
background: #1d3026;
}
html[data-theme="dark"] .admonition-note {
border-color: #344e68;
border-left-color: #5aa5e8;
background: #1e2b38;
}
html[data-theme="dark"] .admonition-warning,
html[data-theme="dark"] .admonition-caution {
border-color: #584725;
border-left-color: #f0b849;
background: #332b1b;
}
html[data-theme="dark"] .admonition-important {
border-color: #4a3b66;
border-left-color: #ad8cff;
background: #2c253b;
}
.task-list {
padding-left: 1.1em;
}
.task-list-item {
list-style: none;
margin-left: -1.1em;
}
.task-list-item-checkbox {
width: 1em;
height: 1em;
margin: 0 0.42em 0 0;
vertical-align: -0.12em;
accent-color: #2f7ecb;
}
table {
width: 100%;
margin: 1.2em 0;
border-collapse: collapse;
font-size: 0.96em;
}
.table-wrapper {
margin: 1.2em 0;
overflow-x: auto;
border: 1px solid #d5dbe5;
border-radius: 8px;
background: #ffffff;
}
.table-wrapper table {
min-width: 640px;
margin: 0;
border: 0;
}
.table-wrapper th:first-child,
.table-wrapper td:first-child {
border-left: 0;
}
.table-wrapper th:last-child,
.table-wrapper td:last-child {
border-right: 0;
}
.table-wrapper tr:first-child th,
.table-wrapper tr:first-child td {
border-top: 0;
}
.table-wrapper tr:last-child th,
.table-wrapper tr:last-child td {
border-bottom: 0;
}
.table-tools {
position: sticky;
left: 0;
display: flex;
justify-content: flex-end;
gap: 0.45em;
padding: 0.44em 0.52em;
border-bottom: 1px solid #d5dbe5;
background: #f7f9fc;
}
.copy-table-button {
padding: 0.25em 0.62em;
border: 1px solid #c8d0dc;
border-radius: 5px;
background: #ffffff;
color: #354052;
font: 600 0.78em "Segoe UI", "Microsoft YaHei UI", sans-serif;
cursor: pointer;
}
.copy-table-button:hover {
background: #f0f4f8;
}
html[data-theme="dark"] .table-wrapper {
border-color: #3a4352;
background: #20242c;
}
html[data-theme="dark"] .table-tools {
border-bottom-color: #3a4352;
background: #242b36;
}
html[data-theme="dark"] .copy-table-button {
border-color: #445063;
background: #2d3542;
color: #edf2f7;
}
html[data-theme="dark"] .copy-table-button:hover {
background: #364151;
}
th,
td {
border: 1px solid #d5dbe5;
padding: 0.62em 0.76em;
vertical-align: top;
}
th {
background: #edf1f6;
font-weight: 650;
text-align: left;
}
html[data-theme="dark"] th,
html[data-theme="dark"] td {
border-color: #3a4352;
}
html[data-theme="dark"] th {
background: #2b3340;
}
code {
font-family: "Cascadia Mono", Consolas, "Courier New", monospace;
}
p code,
li code,
td code {
padding: 0.12em 0.32em;
border-radius: 4px;
background: #eef1f5;
color: #9b2c2c;
}
html[data-theme="dark"] p code,
html[data-theme="dark"] li code,
html[data-theme="dark"] td code {
background: #303745;
color: #f2b8b5;
}
.code-block {
content-visibility: auto;
contain-intrinsic-size: auto 360px;
position: relative;
margin: 1.2em 0;
border: 1px solid #d4d4d4;
border-radius: 8px;
overflow: hidden;
background: #ffffff;
}
html[data-theme="dark"] .code-block {
border-color: #3c3c3c;
background: #1e1e1e;
}
.code-title {
padding: 0.42em 0.76em;
border-bottom: 1px solid #d4d4d4;
background: #f3f3f3;
color: #616161;
font-size: 0.82em;
font-weight: 650;
}
html[data-theme="dark"] .code-title {
border-bottom-color: #3c3c3c;
background: #252526;
color: #cccccc;
}
pre.highlight {
margin: 0;
padding: 1em;
overflow-x: auto;
background: #ffffff;
color: #000000;
}
html[data-theme="dark"] pre.highlight {
background: #1e1e1e;
color: #d4d4d4;
}
pre.highlight code {
display: block;
min-width: max-content;
}
.highlight .c,
.highlight .cm,
.highlight .c1,
.highlight .cs {
color: #008000;
font-style: italic;
}
.highlight .k,
.highlight .kc,
.highlight .kd,
.highlight .kn,
.highlight .kp,
.highlight .kr,
.highlight .ow {
color: #0000ff;
font-weight: 400;
}
.highlight .kt,
.highlight .nc,
.highlight .nn {
color: #267f99;
}
.highlight .s,
.highlight .sa,
.highlight .sb,
.highlight .sc,
.highlight .dl,
.highlight .sd,
.highlight .s1,
.highlight .s2,
.highlight .se,
.highlight .sh,
.highlight .si,
.highlight .sx,
.highlight .sr,
.highlight .ss {
color: #a31515;
}
.highlight .m,
.highlight .mb,
.highlight .mf,
.highlight .mh,
.highlight .mi,
.highlight .mo,
.highlight .il {
color: #098658;
}
.highlight .nf,
.highlight .fm,
.highlight .nb,
.highlight .bp {
color: #795e26;
}
.highlight .na,
.highlight .nv,
.highlight .vc,
.highlight .vg,
.highlight .vi,
.highlight .vm {
color: #001080;
}
.highlight .nd,
.highlight .ne,
.highlight .nl {
color: #af00db;
}
.highlight .o,
.highlight .p {
color: #000000;
}
.highlight .err {
background: transparent;
color: #a31515;
}
html[data-theme="dark"] .highlight .c,
html[data-theme="dark"] .highlight .cm,
html[data-theme="dark"] .highlight .c1,
html[data-theme="dark"] .highlight .cs {
color: #6a9955;
}
html[data-theme="dark"] .highlight .k,
html[data-theme="dark"] .highlight .kc,
html[data-theme="dark"] .highlight .kd,
html[data-theme="dark"] .highlight .kn,
html[data-theme="dark"] .highlight .kp,
html[data-theme="dark"] .highlight .kr,
html[data-theme="dark"] .highlight .ow {
color: #569cd6;
}
html[data-theme="dark"] .highlight .kt,
html[data-theme="dark"] .highlight .nc,
html[data-theme="dark"] .highlight .nn {
color: #4ec9b0;
}
html[data-theme="dark"] .highlight .s,
html[data-theme="dark"] .highlight .sa,
html[data-theme="dark"] .highlight .sb,
html[data-theme="dark"] .highlight .sc,
html[data-theme="dark"] .highlight .dl,
html[data-theme="dark"] .highlight .sd,
html[data-theme="dark"] .highlight .s1,
html[data-theme="dark"] .highlight .s2,
html[data-theme="dark"] .highlight .se,
html[data-theme="dark"] .highlight .sh,
html[data-theme="dark"] .highlight .si,
html[data-theme="dark"] .highlight .sx,
html[data-theme="dark"] .highlight .sr,
html[data-theme="dark"] .highlight .ss {
color: #ce9178;
}
html[data-theme="dark"] .highlight .m,
html[data-theme="dark"] .highlight .mb,
html[data-theme="dark"] .highlight .mf,
html[data-theme="dark"] .highlight .mh,
html[data-theme="dark"] .highlight .mi,
html[data-theme="dark"] .highlight .mo,
html[data-theme="dark"] .highlight .il {
color: #b5cea8;
}
html[data-theme="dark"] .highlight .nf,
html[data-theme="dark"] .highlight .fm,
html[data-theme="dark"] .highlight .nb,
html[data-theme="dark"] .highlight .bp {
color: #dcdcaa;
}
html[data-theme="dark"] .highlight .na,
html[data-theme="dark"] .highlight .nv,
html[data-theme="dark"] .highlight .vc,
html[data-theme="dark"] .highlight .vg,
html[data-theme="dark"] .highlight .vi,
html[data-theme="dark"] .highlight .vm {
color: #9cdcfe;
}
html[data-theme="dark"] .highlight .nd,
html[data-theme="dark"] .highlight .ne,
html[data-theme="dark"] .highlight .nl {
color: #c586c0;
}
html[data-theme="dark"] .highlight .o,
html[data-theme="dark"] .highlight .p {
color: #d4d4d4;
}
html[data-theme="dark"] .highlight .err {
color: #f48771;
}
.code-line {
box-sizing: border-box;
display: block;
min-width: 100%;
width: max-content;
min-height: 1.5em;
padding-left: 3.4em;
position: relative;
white-space: pre;
}
.code-line::before {
content: attr(data-line);
position: absolute;
left: 0;
width: 2.5em;
color: #858585;
text-align: right;
user-select: none;
}
html[data-theme="dark"] .code-line::before {
color: #858585;
}
.code-block.is-collapsible.is-collapsed pre.highlight {
max-height: 18.5em;
overflow: hidden;
}
.code-block.is-collapsible.is-collapsed::after {
content: "";
position: absolute;
left: 0;
right: 0;
bottom: 0;
height: 3.2em;
pointer-events: none;
background: linear-gradient(rgb(255 255 255 / 0), #ffffff);
}
html[data-theme="dark"] .code-block.is-collapsible.is-collapsed::after {
background: linear-gradient(rgb(30 30 30 / 0), #1e1e1e);
}
.plain-file-view {
margin: 1em 0;
padding: 1em;
overflow: auto;
border: 1px solid #d8dee8;
border-radius: 8px;
background: #f7f9fc;
white-space: pre-wrap;
}
html[data-theme="dark"] .plain-file-view {
border-color: #384252;
background: #171b22;
}
.diagram-block,
.math-block {
content-visibility: auto;
contain-intrinsic-size: auto 320px;
margin: 1.2em 0;
border: 1px solid #d8dee8;
border-radius: 8px;
overflow: auto;
background: #f7f9fc;
}
html[data-theme="dark"] .diagram-block,
html[data-theme="dark"] .math-block {
border-color: #384252;
background: #171b22;
}
.diagram-title {
padding: 0.42em 0.76em;
border-bottom: 1px solid #d8dee8;
background: #edf1f6;
color: #53606f;
font-size: 0.82em;
font-weight: 650;
}
html[data-theme="dark"] .diagram-title {
border-bottom-color: #384252;
background: #242b36;
color: #b7c0cc;
}
.mermaid,
.math-block {
padding: 1em;
}
.diagram-missing-runtime::before {
content: "Mermaid 本地资源未加载,下面显示原始图表代码。";
display: block;
margin-bottom: 0.75em;
color: #9b2c2c;
font-weight: 650;
}
.diagram-render-error::before {
content: "Mermaid 图表渲染失败,下面显示原始图表代码。";
display: block;
margin-bottom: 0.75em;
color: #9b2c2c;
font-weight: 650;
}
html[data-theme="dark"] .diagram-missing-runtime::before,
html[data-theme="dark"] .diagram-render-error::before {
color: #f2b8b5;
}
.copy-code-button {
position: absolute;
top: 6px;
right: 8px;
padding: 0.24em 0.58em;
border: 1px solid #c8d0dc;
border-radius: 5px;
background: #ffffff;
color: #354052;
font: 600 0.78em "Segoe UI", "Microsoft YaHei UI", sans-serif;
cursor: pointer;
}
.toggle-code-button {
position: absolute;
top: 6px;
right: 62px;
z-index: 2;
padding: 0.24em 0.58em;
border: 1px solid #c8d0dc;
border-radius: 5px;
background: #ffffff;
color: #354052;
font: 600 0.78em "Segoe UI", "Microsoft YaHei UI", sans-serif;
cursor: pointer;
}
.toggle-code-button:hover {
background: #f0f4f8;
}
html[data-theme="dark"] .toggle-code-button {
border-color: #445063;
background: #2d3542;
color: #edf2f7;
}
html[data-theme="dark"] .toggle-code-button:hover {
background: #364151;
}
.copy-code-button:hover {
background: #f0f4f8;
}
html[data-theme="dark"] .copy-code-button {
border-color: #445063;
background: #2d3542;
color: #edf2f7;
}
html[data-theme="dark"] .copy-code-button:hover {
background: #364151;
}
.pseudo-keyword {
color: #0000ff;
font-weight: 700;
}
html[data-theme="dark"] .pseudo-keyword {
color: #569cd6;
}
img {
max-width: 100%;
height: auto;
}
.reader img {
cursor: zoom-in;
}
.media-block {
content-visibility: auto;
contain-intrinsic-size: auto 420px;
margin: 1.25em 0;
}
.media-block img,
.media-block video {
display: block;
width: min(100%, 880px);
max-height: 70vh;
object-fit: contain;
border: 1px solid #d8dee8;
border-radius: 8px;
background: #0f1115;
}
.media-audio audio {
width: min(100%, 680px);
}
.media-player-link__box {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1em;
width: min(100%, 680px);
box-sizing: border-box;
padding: 1em 1.1em;
border: 1px solid #d8dee8;
border-radius: 8px;
background: #f7f9fc;
}
.media-player-link__title {
color: #344258;
font-weight: 650;
}
.media-player-link__actions {
display: flex;
flex-wrap: wrap;
gap: 0.55em;
}
.media-player-link__button {
display: inline-block;
padding: 0.42em 0.82em;
border-radius: 6px;
background: #1769aa;
color: #ffffff;
font-weight: 650;
}
.media-player-link__button:hover {
background: #0f5d99;
text-decoration: none;
}
.media-player-link__button--secondary {
background: #e7edf5;
color: #344258;
}
.media-player-link__button--secondary:hover {
background: #dbe4ef;
}
html[data-theme="dark"] .media-player-link__box {
border-color: #384252;
background: #242b36;
}
html[data-theme="dark"] .media-player-link__title {
color: #dce3ec;
}
html[data-theme="dark"] .media-player-link__button--secondary {
background: #303948;
color: #edf2f7;
}
html[data-theme="dark"] .media-player-link__button--secondary:hover {
background: #3a4658;
}
.media-fallback {
display: none;
margin-top: 0.72em;
padding: 0.7em 0.85em;
border: 1px solid #d8dee8;
border-radius: 8px;
background: #f7f9fc;
color: #3f4a5d;
}
.media-fallback.is-visible {
display: block;
}
.media-fallback a {
font-weight: 650;
}
html[data-theme="dark"] .media-fallback {
border-color: #384252;
background: #242b36;
color: #dce3ec;
}
figcaption {
margin-top: 0.45em;
color: #697586;
font-size: 0.9em;
}
html[data-theme="dark"] figcaption {
color: #a9b4c4;
}
hr {
border: 0;
border-top: 1px solid #d9dee7;
margin: 2em 0;
}
html[data-theme="dark"] hr {
border-top-color: #384252;
}
.image-lightbox {
position: fixed;
inset: 0;
z-index: 1000;
display: none;
align-items: center;
justify-content: center;
padding: 34px;
background: rgb(12 15 20 / 88%);
}
.image-lightbox.is-open {
display: flex;
}
.image-lightbox__toolbar {
position: fixed;
top: 18px;
left: 50%;
z-index: 1001;
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 8px;
max-width: min(92vw, 760px);
transform: translateX(-50%);
}
.image-lightbox__toolbar button {
min-width: 36px;
height: 34px;
padding: 0 10px;
border: 1px solid rgb(255 255 255 / 22%);
border-radius: 6px;
background: rgb(24 28 36 / 92%);
color: #f5f7fb;
font: 700 0.9em "Segoe UI", "Microsoft YaHei UI", sans-serif;
cursor: pointer;
}
.image-lightbox__toolbar button:hover {
background: rgb(48 56 70 / 96%);
}
.image-lightbox img {
max-width: 96vw;
max-height: 92vh;
object-fit: contain;
border-radius: 8px;
box-shadow: 0 20px 70px rgb(0 0 0 / 45%);
cursor: grab;
transition: transform 120ms ease-out;
}
.image-lightbox__caption {
position: fixed;
left: 24px;
right: 24px;
bottom: 16px;
color: #f5f7fb;
font-size: 0.92em;
text-align: center;
}
@media (max-width: 760px) {
.reader {
padding: 24px 20px 42px;
}
}