/* ============================================================
   tomato — 小说阅读主题
   ============================================================ */

:root {
    --tm-bg: #f4f4f5;
    --tm-panel: #ffffff;
    --tm-panel-soft: #fafafa;
    --tm-text: #2c2c2c;
    --tm-text-secondary: #8b8b8b;
    --tm-text-faint: #b0b0b0;
    --tm-border: #ececec;
    --tm-border-strong: #dcdcdc;
    --tm-accent: #e4573d;
    --tm-accent-soft: #fceeea;
    --tm-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
    --tm-sidebar-width: 336px;
    --tm-reader-width: 960px;
    --tm-font-size: 14px;
    --tm-font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", STSong, Georgia, "Times New Roman", serif;
    --tm-line-height: 2;
    --tm-radius: 12px;
    --tm-code-keyword: #d73a49;
    --tm-code-string: #22863a;
    --tm-code-number: #005cc5;
    --tm-code-comment: #6a737d;
    --tm-code-title: #6f42c1;
    --tm-code-builtin: #e36209;
    --tm-table-row: var(--tm-panel);
    --tm-table-stripe: #f2e7e3;
    --tm-table-border: #ddc7c1;
    --tm-table-head-bg: #ad5642;
    --tm-table-head-text: #ffffff;
}

html[data-theme="dark"] {
    --tm-bg: #111111;
    --tm-panel: #1a1a1a;
    --tm-panel-soft: #202020;
    --tm-text: #c9c9c9;
    --tm-text-secondary: #7f7f7f;
    --tm-text-faint: #5f5f5f;
    --tm-border: #272727;
    --tm-border-strong: #333333;
    --tm-accent: #ff7459;
    --tm-accent-soft: #2b1b17;
    --tm-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    --tm-code-keyword: #ff7b72;
    --tm-code-string: #a5d6ff;
    --tm-code-number: #79c0ff;
    --tm-code-comment: #8b949e;
    --tm-code-title: #d2a8ff;
    --tm-code-builtin: #ffa657;
    --tm-table-row: var(--tm-panel);
    --tm-table-stripe: #241c1a;
    --tm-table-border: #47332d;
    --tm-table-head-bg: #8a4d3f;
    --tm-table-head-text: #f2e4df;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body.tomato {
    margin: 0;
    background: var(--tm-bg);
    color: var(--tm-text);
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system,
        "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* ── 侧边栏 ─────────────────────────────────────────────── */

.tm-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    width: var(--tm-sidebar-width);
    max-width: 86vw;
    background: var(--tm-panel);
    border-right: 1px solid var(--tm-border);
    transition: transform 0.28s ease, background-color 0.25s ease;
}

.tm-book {
    padding: 18px 15px;
    border-bottom: 1px solid var(--tm-border);
}

.tm-book.tm-book-cover {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    max-height: 150px;
    overflow: hidden;
}

.tm-book-cover-link {
    flex: 0 0 70px;
    display: block;
    width: 70px;
    line-height: 0;
    border-radius: 8px;
}

.tm-book-cover-img {
    flex: 0 0 70px;
    width: 70px;
    height: auto;
    border-radius: 8px;
    object-fit: cover;
    background: var(--tm-panel-soft);
}

.tm-book-info {
    min-width: 0;
}

.tm-book.tm-book-cover .tm-book-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.tm-book h1 {
    margin: 0;
    font-size: 1.28rem;
    line-height: 1.5;
    font-weight: 700;
    color: var(--tm-text);
}

.tm-book-sub {
    margin-top: 6px;
    font-size: 0.82rem;
    color: var(--tm-text-secondary);
    line-height: 1.6;
}

/* ── 自定义提示框（替代系统 title） ─────────────────────── */

.tm-tip {
    position: fixed;
    z-index: 9999;
    max-width: 260px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #2b2b2b;
    color: #ffffff;
    font-size: 0.8rem;
    line-height: 1.5;
    letter-spacing: 0;
    text-align: left;
    white-space: normal;
    word-break: break-word;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
    pointer-events: none;
}

.tm-tip::before {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
}

.tm-tip[data-placement="bottom"]::before {
    top: -12px;
    border-bottom-color: #2b2b2b;
}

.tm-tip[data-placement="top"]::before {
    bottom: -12px;
    border-top-color: #2b2b2b;
}

.tm-tip[hidden] {
    display: none;
}

.tm-toc-head {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px 12px;
    padding: 16px 18px 10px;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--tm-text);
}

.tm-toc-title {
    white-space: nowrap;
}

.tm-toc-head .tm-count {
    color: var(--tm-text-faint);
    font-weight: 400;
}

.tm-toc-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
}

.tm-toc-action {
    padding: 4px 7px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--tm-text-secondary);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.tm-toc-action:hover {
    color: var(--tm-accent);
    background: var(--tm-accent-soft);
}

.tm-toc-action.is-active {
    color: var(--tm-accent);
}

.tm-caret {
    font-size: 0.72em;
}

.tm-search-icon {
    display: inline-block;
    width: 13px;
    height: 13px;
    vertical-align: -2px;
    background: currentColor;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
}

.tm-volume-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 12px;
    width: 200px;
    max-width: calc(100% - 24px);
    z-index: 60;
    max-height: 400px;
    padding: 6px;
    overflow-y: auto;
    background: var(--tm-panel);
    border: 1px solid var(--tm-border);
    border-radius: 12px;
    box-shadow: var(--tm-shadow);
}

/* 合并筛选：左侧一级分类 + 右侧二级选项的级联下拉 */
.tm-filter-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 12px;
    z-index: 60;
    display: flex;
    flex-direction: column;
    width: 320px;
    max-width: calc(100% - 24px);
    height: 200px;
    padding: 6px;
    background: var(--tm-panel);
    border: 1px solid var(--tm-border);
    border-radius: 12px;
    box-shadow: var(--tm-shadow);
}

.tm-filter-menu[hidden] {
    display: none;
}

.tm-filter-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-top: auto;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--tm-text-secondary);
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.tm-filter-clear:hover:not(:disabled) {
    color: var(--tm-accent);
    background: var(--tm-accent-soft);
}

.tm-filter-clear:disabled {
    opacity: 0.35;
    cursor: default;
}

.tm-filter-clear-icon {
    width: 14px;
    height: 14px;
    background: currentColor;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
}

.tm-filter-body {
    display: flex;
    flex: 1;
    min-height: 0;
}

.tm-filter-cats {
    flex: 0 0 96px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-right: 6px;
    border-right: 1px solid var(--tm-border);
}

.tm-filter-cat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--tm-text-secondary);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.tm-filter-cat:hover {
    color: var(--tm-text);
    background: var(--tm-panel-soft);
}

.tm-filter-cat.is-active {
    color: var(--tm-accent);
    background: var(--tm-accent-soft);
}

.tm-filter-values {
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    padding-left: 6px;
}

.tm-volume-item {
    display: block;
    padding: 6px 10px;
    border-radius: 8px;
    color: var(--tm-text-secondary);
    font-size: 0.82rem;
    line-height: 1.5;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.tm-volume-item:hover {
    color: var(--tm-text);
    background: var(--tm-panel-soft);
}

.tm-volume-item.is-active {
    color: var(--tm-accent);
    background: var(--tm-accent-soft);
}

.tm-volume-item-split {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.tm-volume-item-split .tm-volume-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tm-volume-count {
    flex: none;
    color: var(--tm-text-faint);
    font-size: 0.76rem;
}

.tm-volume-title {
    margin: 10px 12px 4px;
    color: var(--tm-text-faint);
    font-size: 0.76rem;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: 0.02em;
}

.tm-chapters .tm-volume-title:first-child {
    margin-top: 0;
}

.tm-index {
    flex: none;
    display: inline-block;
    width: var(--tm-index-width);
    margin-right: 8px;
    text-align: right;
    color: var(--tm-text-faint);
    font-variant-numeric: tabular-nums;
}

.tm-chapters {
    flex: 1;
    overflow-y: auto;
    padding: 4px 14px 26px;
    scrollbar-width: thin;
}

.tm-chapters::-webkit-scrollbar {
    width: 6px;
}

.tm-chapters::-webkit-scrollbar-thumb {
    background: var(--tm-border-strong);
    border-radius: 3px;
}

.tm-chapter {
    display: flex;
    align-items: center;
    padding: 12px 12px;
    border-radius: 8px;
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--tm-text-secondary);
    text-decoration: none;
    transition: color 0.15s ease, background-color 0.15s ease;
    overflow: hidden;
    white-space: nowrap;
}

.tm-chapter-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tm-chapter:hover {
    color: var(--tm-text);
    background: var(--tm-panel-soft);
}

.tm-chapter.tm-dir {
    color: var(--tm-text-faint);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.tm-chapter.tm-current {
    color: var(--tm-accent);
    background: var(--tm-accent-soft);
    font-weight: 600;
}

.tm-sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 14px 26px;
    border-top: 1px solid var(--tm-border);
    font-size: 0.76rem;
    color: var(--tm-text-faint);
    line-height: 1.7;
}

.tm-footer-links {
    white-space: nowrap;
}

.tm-footer-version {
    margin-left: auto;
    color: var(--tm-text-faint);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.tm-sidebar-footer a {
    color: var(--tm-text-secondary);
    text-decoration: none;
}

.tm-sidebar-footer a.tm-footer-version {
    color: var(--tm-text-faint);
}

.tm-sidebar-footer a:hover {
    color: var(--tm-accent);
}

/* ── 主内容 ─────────────────────────────────────────────── */

.tm-main {
    min-height: 100vh;
    margin-left: var(--tm-sidebar-width);
    transition: margin-left 0.28s ease;
}

.tm-reader {
    max-width: var(--tm-reader-width);
    margin: 0 auto;
    padding: 50px 60px 50px 48px;
}

.tm-reader-head {
    margin-bottom: 40px;
}

.tm-reader-head h1 {
    margin: 0;
    font-size: 1.7rem;
    line-height: 1.5;
    font-weight: 700;
    color: var(--tm-text);
}

.tm-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 22px;
    margin-top: 16px;
    font-size: 0.8rem;
    color: var(--tm-text-faint);
}

.tm-meta-date {
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: color 0.15s ease;
}

.tm-meta-date:hover {
    color: var(--tm-accent);
}

/* ── 正文排版 ───────────────────────────────────────────── */

.tm-content {
    font-family: var(--tm-font-family);
    font-size: var(--tm-font-size);
    line-height: var(--tm-line-height);
    color: var(--tm-text);
    letter-spacing: 0.02em;
    word-break: break-word;
}

.tm-content p {
    margin: 0 0 1.1em;
}

.tm-content h1,
.tm-content h2,
.tm-content h3,
.tm-content h4,
.tm-content h5,
.tm-content h6 {
    margin: 1.8em 0 0.7em;
    line-height: 1.5;
    font-weight: 700;
    color: var(--tm-text);
}

.tm-content h1 {
    font-size: 1.5em;
}

.tm-content h2 {
    font-size: 1.32em;
}

.tm-content h3 {
    font-size: 1.16em;
}

.tm-content blockquote {
    margin: 1.4em 0;
    padding: 0.6em 1.1em;
    border-left: 3px solid var(--tm-accent);
    background: var(--tm-panel-soft);
    color: var(--tm-text-secondary);
    border-radius: 0 8px 8px 0;
}

.tm-content blockquote p:last-child {
    margin-bottom: 0;
}

.tm-content ul,
.tm-content ol {
    margin: 1em 0;
    padding-left: 1.6em;
}

.tm-content li {
    margin: 0.35em 0;
}

.tm-content img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 1.6em auto;
    border-radius: 8px;
}

.tm-content a {
    color: var(--tm-accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.tm-content a:hover {
    border-bottom-color: var(--tm-accent);
}

.tm-content :not(pre) > code:not(.hljs) {
    padding: 0.12em 0.4em;
    font-size: 0.92em;
    border-radius: 5px;
    background: var(--tm-panel-soft);
    border: 1px solid var(--tm-border);
}

.tm-content pre {
    margin: 1.4em 0;
    padding: 1em 1.2em;
    overflow-x: auto;
    border-radius: 10px;
    background: var(--tm-panel-soft);
    border: 1px solid var(--tm-border);
}

.tm-content pre code {
    font-size: 0.85em;
    line-height: 1.7;
    border: 0;
    padding: 0;
    background: transparent;
}

.tm-content pre code.hljs {
    display: block;
    color: var(--tm-text);
}

.tm-content .hljs-comment,
.tm-content .hljs-quote {
    color: var(--tm-code-comment);
    font-style: italic;
}

.tm-content .hljs-keyword,
.tm-content .hljs-selector-tag,
.tm-content .hljs-meta,
.tm-content .hljs-literal {
    color: var(--tm-code-keyword);
}

.tm-content .hljs-string,
.tm-content .hljs-regexp,
.tm-content .hljs-symbol,
.tm-content .hljs-bullet,
.tm-content .hljs-addition,
.tm-content .hljs-template-tag {
    color: var(--tm-code-string);
}

.tm-content .hljs-number {
    color: var(--tm-code-number);
}

.tm-content .hljs-title,
.tm-content .hljs-section,
.tm-content .hljs-name,
.tm-content .hljs-selector-id,
.tm-content .hljs-selector-class {
    color: var(--tm-code-title);
    font-weight: 600;
}

.tm-content .hljs-built_in,
.tm-content .hljs-builtin-name,
.tm-content .hljs-type,
.tm-content .hljs-attribute,
.tm-content .hljs-attr,
.tm-content .hljs-variable,
.tm-content .hljs-template-variable {
    color: var(--tm-code-builtin);
}

.tm-content table {
    width: 100%;
    margin: 1.4em 0;
    border-collapse: collapse;
    font-size: 0.92em;
}

.tm-content th,
.tm-content td {
    padding: 0.5em 0.7em;
    border: 1px solid var(--tm-table-border);
    text-align: left;
}

.tm-content thead th {
    background: var(--tm-table-head-bg);
    color: var(--tm-table-head-text);
}

.tm-content tbody tr:nth-child(odd) {
    background: var(--tm-table-row);
}

.tm-content tbody tr:nth-child(even) {
    background: var(--tm-table-stripe);
}

.tm-content hr {
    margin: 2em 0;
    border: 0;
    border-top: 1px solid var(--tm-border);
}

/* ── 上一章 / 下一章 ────────────────────────────────────── */

.tm-pager {
    display: flex;
    gap: 14px;
    padding-top: 40px;
}

.tm-pager > a,
.tm-pager > span {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 18px;
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius);
    text-decoration: none;
    background: var(--tm-panel);
    min-width: 0;
}

.tm-pager > a:hover {
    border-color: var(--tm-accent);
    color: var(--tm-accent);
}

.tm-pager .tm-pager-label {
    font-size: 0.86rem;
    color: var(--tm-text-secondary);
    letter-spacing: 0.08em;
}

.tm-pager .tm-pager-title {
    font-size: 0.9rem;
    color: var(--tm-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tm-pager .tm-pager-next {
    text-align: center;
    align-items: center;
}

.tm-pager .tm-pager-placeholder {
    border: 1px dashed var(--tm-border);
    background: transparent;
}

.tm-copy-link {
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

/* ── 管理布局的按钮与遮罩 ───────────────────────────────── */

.tm-menu-btn {
    position: fixed;
    top: 18px;
    left: calc(var(--tm-sidebar-width) + 18px);
    z-index: 45;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--tm-border);
    border-radius: 10px;
    background: var(--tm-panel);
    color: var(--tm-text-secondary);
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--tm-shadow);
    transition: left 0.28s ease, color 0.15s ease, border-color 0.15s ease;
}

.tm-menu-btn:hover {
    color: var(--tm-accent);
    border-color: var(--tm-accent);
}

.tm-menu-btn[hidden] {
    display: none;
}

/* 非持久模式：目录抽屉右上角的关闭按钮 */
.tm-drawer-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--tm-border);
    border-radius: 8px;
    background: var(--tm-panel);
    color: var(--tm-text-secondary);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.tm-drawer-close:hover {
    color: var(--tm-accent);
    border-color: var(--tm-accent);
}

.tm-drawer-close[hidden] {
    display: none;
}

body.tm-drawer-mode .tm-book {
    padding-right: 48px;
}

/* ── 阅读设置工具栏 ─────────────────────────────────────── */

.tm-tools {
    position: fixed;
    right: 22px;
    top: 50%;
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transform: translateY(-50%);
}

.tm-tool,
.tm-font {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tm-panel);
    border: 1px solid var(--tm-border);
    border-radius: 12px;
    box-shadow: var(--tm-shadow);
}

.tm-tool {
    width: 46px;
    height: 46px;
    flex-direction: column;
    gap: 2px;
    cursor: pointer;
    color: var(--tm-text-secondary);
    font-size: 1rem;
    transition: color 0.15s ease, border-color 0.15s ease;
}

a.tm-tool {
    text-decoration: none;
}

.tm-tool:hover {
    color: var(--tm-accent);
    border-color: var(--tm-accent);
}

.tm-tool[hidden] {
    display: none;
}

/* 移动端用图标代替字号面板，点击后在图标上方显示纵向拖动条 */
.tm-tool.tm-font-toggle {
    display: none;
}

.tm-tool .tm-tool-label {
    font-size: 0.62rem;
    letter-spacing: 0.05em;
}

.tm-tool-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    background: currentColor;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
    -webkit-mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    mask-size: contain;
}

.tm-font {
    flex-direction: column;
    gap: 6px;
    padding: 8px 6px;
}

.tm-font-btn {
    width: 34px;
    height: 30px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--tm-text-secondary);
    font-size: 0.86rem;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.tm-font-btn:hover {
    color: var(--tm-accent);
    background: var(--tm-accent-soft);
}

.tm-font-range {
    width: 34px;
    height: 90px;
    margin: 0;
    writing-mode: vertical-lr;
    direction: rtl;
    accent-color: var(--tm-accent);
    cursor: pointer;
}

/* ── 遮罩 ───────────────────────────────────────────────── */

.tm-overlay {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(0, 0, 0, 0.42);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

/* ── 目录首页 ───────────────────────────────────────────── */

.tm-home-head h1 {
    margin: 0;
    font-size: 2rem;
    line-height: 1.4;
    font-weight: 700;
}

.tm-home-sub {
    margin: 12px 0 0;
    font-size: 0.95rem;
    color: var(--tm-text-secondary);
    line-height: 1.8;
}

.tm-home-desc {
    margin: 26px 0 0;
    padding: 18px 22px;
    border-radius: var(--tm-radius);
    background: var(--tm-panel);
    border: 1px solid var(--tm-border);
    color: var(--tm-text-secondary);
    line-height: 1.9;
    font-size: 0.92rem;
}

.tm-home-list {
    margin-top: 30px;
    border-top: 1px solid var(--tm-border);
}

.tm-home-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 15px 6px;
    border-bottom: 1px solid var(--tm-border);
    text-decoration: none;
    color: var(--tm-text);
    transition: color 0.15s ease;
}

.tm-home-item:hover {
    color: var(--tm-accent);
}

.tm-home-item .tm-home-item-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.95rem;
    line-height: 1.6;
}

.tm-home-item .tm-home-item-date {
    flex: none;
    font-size: 0.78rem;
    color: var(--tm-text-faint);
}

/* ── 统计 / 友链等通用页面 ──────────────────────────────── */

.tm-panel {
    background: var(--tm-panel);
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius);
    padding: 26px 30px;
    margin-bottom: 22px;
}

.tm-panel h2 {
    margin: 0 0 18px;
    font-size: 1.05rem;
}

.tm-stat-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}

.tm-stat-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 18px;
    background: var(--tm-panel);
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius);
}

.tm-stat-label {
    color: var(--tm-text-faint);
    font-size: 0.78rem;
}

.tm-stat-value {
    color: var(--tm-text);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.tm-stat-unit {
    margin-left: 2px;
    color: var(--tm-text-faint);
    font-size: 0.78rem;
    font-weight: 500;
}

.tm-chart-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-bottom: 18px;
}

.tm-chart-head h2 {
    margin: 0;
    font-size: 1.05rem;
}

.tm-chart-switch {
    display: inline-flex;
    padding: 2px;
    border: 1px solid var(--tm-border);
    border-radius: 999px;
    background: var(--tm-panel-soft);
}

.tm-chart-toggle {
    padding: 4px 12px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--tm-text-faint);
    font: inherit;
    font-size: 0.78rem;
    line-height: 1.4;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.tm-chart-toggle:hover {
    color: var(--tm-accent);
}

.tm-chart-toggle.is-active {
    color: var(--tm-accent);
    background: var(--tm-accent-soft);
}

.tm-chart-svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.tm-chart-grid line {
    stroke: var(--tm-border);
    stroke-width: 1;
    shape-rendering: crispEdges;
}

.tm-chart-axis text {
    fill: var(--tm-text-faint);
    font-size: 11px;
}

.tm-chart-line {
    fill: none;
    stroke: var(--tm-accent);
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.tm-chart-area {
    fill: var(--tm-accent-soft);
    stroke: none;
}

.tm-chart-dot {
    fill: var(--tm-panel);
    stroke: var(--tm-accent);
    stroke-width: 2;
}

.tm-chart-empty {
    margin: 8px 0 0;
    color: var(--tm-text-faint);
    font-size: 0.85rem;
}

.tm-simple-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.tm-simple-list li {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    text-align: left;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 0;
}

.tm-simple-logo {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--tm-panel-soft);
    overflow: hidden;
}

.tm-simple-logo img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: cover;
}

.tm-simple-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 6px;
    min-width: 0;
    line-height: 1.5;
}

.tm-simple-list a {
    color: var(--tm-text);
    text-decoration: none;
}

.tm-simple-list a:hover {
    color: var(--tm-accent);
}

.tm-simple-list a,
.tm-simple-logo,
.tm-sidebar-footer a,
.tm-chapter {
    cursor: pointer;
}

.tm-muted {
    color: var(--tm-text-faint);
    font-size: 0.8rem;
}

.tm-stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.tm-stats-table th,
.tm-stats-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--tm-border);
    text-align: left;
}

.tm-stats-table th {
    color: var(--tm-text-faint);
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
}

.tm-bar {
    height: 8px;
    border-radius: 4px;
    background: var(--tm-accent-soft);
    overflow: hidden;
}

.tm-bar > i {
    display: block;
    height: 100%;
    background: var(--tm-accent);
    border-radius: 4px;
}

/* ── 响应式 ─────────────────────────────────────────────── */

@media (min-width: 901px) {
    body.tm-collapsed .tm-sidebar {
        transform: translateX(-100%);
    }

    body.tm-collapsed .tm-main {
        margin-left: 0;
        height: 100vh;
    }

    body.tm-collapsed .tm-reader {
        background: var(--tm-panel);
    }

    body.tm-collapsed .tm-menu-btn {
        left: 18px;
    }

    /* 非持久显示：目录以抽屉方式覆盖，正文不再让出侧栏宽度 */
    body.tm-drawer-mode .tm-sidebar {
        width: 500px;
        transform: translateX(-100%);
        box-shadow: var(--tm-shadow);
    }

    body.tm-drawer-mode .tm-main {
        margin-left: 0;
        height: 100vh;
    }

    body.tm-drawer-mode .tm-reader {
        background: var(--tm-panel);
    }

    body.tm-drawer-mode.tm-open .tm-sidebar {
        transform: translateX(0);
    }
}

body.tm-drawer-mode.tm-open .tm-overlay {
    opacity: 1;
    visibility: visible;
}

body.tm-drawer-mode .tm-overlay {
    background: rgba(0, 0, 0, 0.18);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

@media (max-width: 900px) {
    .tm-stat-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tm-sidebar {
        transform: translateX(-100%);
        width: min(86vw, 360px);
        box-shadow: var(--tm-shadow);
    }

    body.tm-open .tm-sidebar {
        transform: translateX(0);
    }

    .tm-main {
        margin-left: 0;
    }

    .tm-menu-btn {
        left: auto;
        right: 14px;
        top: 14px;
    }

    body.tm-open .tm-overlay {
        opacity: 1;
        visibility: visible;
    }

    .tm-reader {
        padding: 72px 22px 96px;
    }

    .tm-reader-head h1 {
        font-size: 1.32rem;
    }

    .tm-content {
        letter-spacing: 0;
    }

    .tm-tools {
        right: 14px;
        top: auto;
        bottom: 16px;
        transform: none;
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }

    .tm-tool {
        width: 40px;
        height: 40px;
        flex-direction: row;
        gap: 0;
        padding: 0;
        justify-content: center;
        border-radius: 20px;
    }

    .tm-tool.tm-font-toggle {
        display: flex;
    }

    .tm-tool .tm-tool-label {
        display: none;
    }

    .tm-font {
        display: none;
    }

    body.tm-font-open .tm-font {
        display: flex;
        position: absolute;
        right: 0;
        bottom: calc(100% + 10px);
        flex-direction: column;
        gap: 6px;
        padding: 10px 6px;
        border-radius: 12px;
    }

    body.tm-font-open .tm-font-btn {
        display: none;
    }

    body.tm-font-open .tm-font-range {
        width: 24px;
        height: 96px;
        writing-mode: vertical-lr;
        direction: rtl;
    }
}

@media (max-width: 480px) {
    .tm-reader {
        padding: 66px 16px 88px;
    }

    .tm-reader-head h1 {
        font-size: 1.18rem;
    }

    .tm-pager {
        flex-direction: column;
    }

    .tm-pager .tm-pager-next {
        text-align: center;
        align-items: center;
    }
}
