@charset "UTF-8";
/*
 * 少儿口才朗诵稿件库 样式。
 * 布局：搜索和学段在首屏顶部，左侧是书库目录式的筛选栏，右侧是选稿结果；手机改为一列卡片和底部抽屉。
 * 颜色取自大象 Logo：蓝做主操作，浅蓝做选中底，黄只用于“编辑推荐”和古典诗文这类需要区分的标记。
 */
:root {
  color-scheme: light;
  --paper: #f6f8fa;
  --paper-deep: #edf1f5;
  --card: #ffffff;
  --ink: #1e2a3c;
  --ink-soft: #435064;
  --muted: #5e6a7c;
  --line: #dce4eb;
  --line-strong: #cbd6e1;
  --blue: #285898;
  --blue-deep: #1a4080;
  --blue-soft: #e8f0f8;
  --blue-line: #b9cfe6;
  --yellow: #f8d070;
  --yellow-soft: #fdf1d3;
  --yellow-ink: #7a5200;
  --ok: #24704f;
  --ok-soft: #e4f2ea;
  --bad: #a83a2a;
  --bad-soft: #fbe9e5;
  --warn-soft: #fbf0d9;
  --warn-ink: #7a5200;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", serif;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  --page: 1360px;
  --gutter: max(24px, env(safe-area-inset-left, 0px));
  --tabbar-h: 58px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: var(--sans); font-size: 15px; line-height: 1.6; }
body.reader-open, body.sheet-open { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: .5; }
select { cursor: pointer; }
a { color: var(--blue); }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
mark { background: var(--yellow); color: inherit; border-radius: 2px; padding: 0 1px; }

/* ---------- 顶栏 ---------- */
.topbar { border-bottom: 1px solid var(--line); background: var(--paper); }
.topbar-inner { max-width: var(--page); margin: auto; height: 68px; padding-inline: var(--gutter); display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); white-space: nowrap; }
/* Logo 四周有透明留白，用负外边距收回，图片本身不裁切 */
.brand img { width: 72px; height: 72px; object-fit: contain; margin: -6px -4px -6px -8px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong { font-size: 18px; font-weight: 650; letter-spacing: .5px; }
.brand-text small { font-size: 12px; color: var(--muted); letter-spacing: 1px; }
.main-nav { display: flex; align-self: stretch; gap: 26px; margin-left: 12px; }
.nav-button { position: relative; color: var(--ink-soft); font-size: 15px; padding: 0 2px; white-space: nowrap; }
.nav-button:hover { color: var(--blue); }
.nav-button.active { color: var(--blue-deep); font-weight: 650; }
.nav-button.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: var(--blue); }
.nav-count { font-size: 12px; font-weight: 400; background: var(--paper-deep); color: var(--ink-soft); border-radius: 10px; padding: 1px 7px; margin-left: 2px; font-variant-numeric: tabular-nums; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.quiet-button { color: var(--ink-soft); font-size: 14px; }
.quiet-button:hover { color: var(--blue); }
.member-pill { font-size: 13px; color: var(--ink-soft); border: 1px solid var(--line-strong); border-radius: 16px; padding: 4px 12px; background: var(--card); text-decoration: none; }
.member-pill:hover { border-color: var(--blue); color: var(--blue); }
.member-pill .pill-short { display: none; }
.member-pill.active { background: var(--blue-soft); border-color: var(--blue-line); color: var(--blue-deep); }
.auth-slot { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.login-link, .admin-link { color: var(--blue-deep); font-weight: 600; text-decoration: none; }
.login-link:hover, .admin-link:hover { text-decoration: underline; }
.user-name { color: var(--ink-soft); max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.offline-tag { font-size: 13px; color: var(--warn-ink); }

/* ---------- 主区 ---------- */
main { max-width: var(--page); margin: auto; padding: 18px var(--gutter) 0; }
.desk { display: flex; flex-direction: column; gap: 12px; }
.search { display: flex; align-items: center; background: var(--card); border: 2px solid var(--blue); border-radius: 10px; height: 54px; padding-right: 5px; }
.search:focus-within { box-shadow: 0 0 0 3px var(--blue-soft); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; padding: 0 16px; font-size: 16px; }
.search input::-webkit-search-cancel-button { display: none; }
.search input::placeholder { color: #7a8494; }
.search-clear { display: grid; place-items: center; width: 34px; height: 34px; color: var(--muted); border-radius: 6px; }
.search-clear:hover { background: var(--paper-deep); }
.search kbd { font: 12px var(--sans); color: var(--muted); border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 6px; margin: 0 10px 0 4px; }
.search-go { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 20px; background: var(--blue); color: #fff; border-radius: 7px; font-weight: 600; }
.search-go:hover { background: var(--blue-deep); }

.stage-seg { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.stage-tab { display: flex; align-items: baseline; gap: 6px; min-height: 44px; padding: 8px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; text-align: left; white-space: nowrap; }
.stage-tab:hover { border-color: var(--blue-line); }
.stage-tab strong { font-size: 15px; font-weight: 600; }
.stage-tab em { font-style: normal; font-size: 12px; color: var(--muted); }
.stage-tab small { margin-left: auto; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stage-tab.active { background: var(--blue-soft); border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.stage-tab.active strong { color: var(--blue-deep); }
.desk-meta { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }

.notice { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--blue-soft); color: var(--ink); border-radius: 8px; padding: 8px 14px; font-size: 14px; margin-top: 12px; }
.notice.warn { background: var(--warn-soft); color: var(--warn-ink); }
.notice-action { font-weight: 600; color: var(--blue-deep); text-decoration: underline; text-underline-offset: 3px; }
.notice-action.quiet { font-weight: 400; color: var(--ink-soft); }

.hot-strip { display: flex; align-items: center; gap: 12px; margin-top: 12px; font-size: 14px; min-width: 0; }
.hot-strip-label { flex: none; font-size: 12px; font-weight: 600; color: var(--yellow-ink); background: var(--yellow-soft); padding: 1px 8px; border-radius: 4px; }
.hot-strip-list { display: flex; gap: 4px; overflow-x: auto; min-width: 0; scrollbar-width: none; }
.hot-strip .text-button { flex: none; white-space: nowrap; }
.hot-link { flex: none; color: var(--ink-soft); padding: 2px 4px; border-radius: 4px; }
.hot-link:hover { color: var(--blue); background: var(--blue-soft); }

/* ---------- 书库布局 ---------- */
.library { display: grid; grid-template-columns: 228px minmax(0, 1fr); gap: 28px; align-items: start; margin-top: 18px; }
.filter-panel { position: sticky; top: 12px; max-height: calc(100vh - 24px); display: flex; flex-direction: column; border-right: 1px solid var(--line); padding-right: 18px; }
.filter-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 8px; }
.filter-head h2 { font-size: 15px; font-weight: 650; }
.filter-scroll { overflow-y: auto; scrollbar-width: thin; display: flex; flex-direction: column; gap: 16px; padding: 2px 4px 12px 2px; margin: -2px -6px 0 -2px; }
.facet h3 { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.facet-list { display: flex; flex-direction: column; }
.facet-list:empty { display: none; }
.facet-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 8px; min-height: 32px; border-radius: 6px; text-align: left; font-size: 14px; color: var(--ink); }
.facet-item:hover { background: var(--paper-deep); }
.facet-item small { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.facet-item.active { background: var(--blue); color: #fff; font-weight: 600; }
.facet-item.active small { color: #dbe7f5; }
/* 古诗、文言文单独成组，方便老师一眼找到 */
.facet-item.classical:not(.active) { background: var(--yellow-soft); }
.facet-item.classical:not(.active):hover { background: #fbe7b5; }
.facet-item[data-value="古诗"] { margin-top: 6px; }
.facet-item[data-value="文言文"] { margin-top: 2px; }
.facet-note { font-size: 13px; color: var(--muted); padding: 2px 8px 0; }
.facet-note:empty { display: none; }
.facet-selects { display: flex; flex-direction: column; gap: 4px; }
.facet-selects label { font-size: 13px; font-weight: 600; color: var(--muted); margin-top: 6px; }
.facet-selects select { width: 100%; min-height: 36px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--card); padding: 5px 6px; font-size: 14px; }
.filter-head .sheet-close, .sheet-foot { display: none; }
.text-button { color: var(--blue); font-size: 13px; padding: 4px; }
.text-button:hover { text-decoration: underline; }

.results { min-width: 0; }
.results-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.results-title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; min-width: 0; }
.results-title h2 { font-size: 20px; font-weight: 650; }
.results-title p { font-size: 14px; color: var(--muted); }
.results-tools { display: flex; align-items: center; gap: 10px; }
.tool-button { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--card); font-size: 14px; color: var(--ink-soft); }
.tool-button:hover { border-color: var(--blue); color: var(--blue); }
.tool-button .icon { width: 17px; height: 17px; }
.filter-toggle { display: none; }
#filterCount { background: var(--blue); color: #fff; border-radius: 9px; font-size: 12px; min-width: 18px; text-align: center; }
.sort-label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.sort-label select { border: 1px solid var(--line-strong); border-radius: 7px; background: var(--card); min-height: 38px; padding: 0 6px; color: var(--ink); font-size: 14px; }
.hit-explain { font-size: 14px; color: var(--ink-soft); margin-top: 6px; }
.active-filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.active-filters:empty { display: none; }
.filter-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--blue-deep); background: var(--blue-soft); border-radius: 14px; padding: 3px 8px 3px 11px; }
.filter-chip .icon { width: 13px; height: 13px; }
.filter-chip:hover { background: #d9e6f4; }

/* ---------- 卡片 ---------- */
.work-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 12px; transition: opacity .15s; }
.work-grid:empty { display: none; }
.work-grid.is-loading { opacity: .55; }
.work-card { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.work-card:hover { border-color: var(--blue-line); }
.card-main { flex: 1; display: block; width: 100%; text-align: left; padding: 15px 18px 11px; border-radius: 10px 10px 0 0; min-width: 0; }
.card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; min-height: 22px; }
.genre-tag { font-size: 12px; background: var(--blue-soft); color: var(--blue-deep); padding: 1px 8px; border-radius: 4px; }
.genre-tag.classical { background: var(--yellow-soft); color: var(--yellow-ink); }
.card-badges { display: flex; gap: 6px; }
.card-badges:empty { display: none; }
.badge { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 4px; white-space: nowrap; }
.badge-pick { background: var(--yellow); color: #4a3200; }
.badge-hot { background: var(--blue); color: #fff; }
.card-meta { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.work-card h3 { font-family: var(--serif); font-size: 20px; line-height: 1.45; font-weight: 600; letter-spacing: .5px; overflow-wrap: anywhere; }
.author-line { font-size: 13px; color: var(--muted); margin: 2px 0 7px; overflow-wrap: anywhere; }
.card-excerpt { font-family: var(--serif); font-size: 15px; line-height: 1.75; color: var(--ink-soft); white-space: pre-line; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.match-why, .card-metric { font-size: 13px; color: var(--blue-deep); margin-top: 6px; }
.card-bottom { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding: 6px 10px 6px 18px; min-height: 44px; }
.card-themes { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 13px; color: var(--muted); }
.tiny-status { color: var(--yellow-ink); font-size: 13px; }
.card-live { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.card-live:empty { display: none; }
.card-download { display: inline-flex; align-items: center; gap: 3px; min-height: 36px; padding: 0 8px; color: var(--ink-soft); border-radius: 6px; font-size: 13px; white-space: nowrap; }
.card-download:hover { background: var(--blue-soft); color: var(--blue-deep); }
.card-download .icon { width: 17px; height: 17px; }
.star-button { display: grid; place-items: center; width: 38px; height: 38px; color: var(--muted); border-radius: 6px; }
.star-button:hover { background: var(--yellow-soft); color: var(--yellow-ink); }
.star-button.saved .icon { fill: var(--yellow); stroke: var(--yellow-ink); }
.work-skeleton { height: 196px; border-radius: 10px; background: linear-gradient(100deg, var(--paper-deep) 30%, var(--card) 50%, var(--paper-deep) 70%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.empty-state { margin-top: 12px; padding: 44px 20px; text-align: center; border: 1px dashed var(--line-strong); border-radius: 10px; }
.empty-state h3 { font-size: 18px; font-weight: 600; margin-bottom: 6px; overflow-wrap: anywhere; }
.empty-state p { color: var(--muted); font-size: 14px; }
.empty-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 12px; margin: 22px 0 6px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.pagination:empty { display: none; }
.page-button { min-width: 38px; height: 40px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--card); font-size: 14px; }
.page-button:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.page-label { font-variant-numeric: tabular-nums; }

.hot-view { margin-top: 18px; }
.hot-section { margin-top: 18px; }
.hot-section-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.hot-section-head h3 { font-size: 17px; font-weight: 650; }
.hot-section-head p { font-size: 14px; color: var(--muted); }
.hot-view .work-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.site-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; border-top: 1px solid var(--line); margin-top: 36px; padding: 16px 0 22px; font-size: 13px; color: var(--muted); }
.site-footer span { color: var(--ink-soft); font-weight: 600; }
.tabbar { display: none; }

/* ---------- 按钮 ---------- */
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: 7px; font-size: 14px; font-weight: 600; text-decoration: none; }
.primary-button { background: var(--blue); color: #fff; }
.primary-button:hover:not(:disabled) { background: var(--blue-deep); }
.secondary-button { background: var(--card); border: 1px solid var(--line-strong); color: var(--ink); }
.secondary-button:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.icon-button { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 7px; color: var(--ink-soft); }
.icon-button:hover { background: var(--paper-deep); }

/* ---------- 阅读 ---------- */
dialog { border: 0; padding: 0; color: var(--ink); background: var(--paper); box-shadow: 0 12px 48px rgba(26, 64, 128, .22); }
dialog::backdrop { background: rgba(30, 42, 60, .5); }
.reader { width: min(820px, 94vw); max-width: 820px; height: min(92dvh, 1000px); max-height: 92dvh; border-radius: 12px; overflow: hidden; }
.reader[open] { display: flex; flex-direction: column; }
.reader-top { flex: none; display: flex; align-items: center; gap: 12px; padding: 6px 12px 6px 24px; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.reader-top > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.font-controls { display: flex; gap: 4px; margin-left: auto; }
.font-controls button { min-width: 38px; height: 34px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--card); font-size: 13px; color: var(--ink-soft); }
.font-controls button:hover { border-color: var(--blue); color: var(--blue); }
.reader-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.reader-sheet { max-width: 680px; margin: auto; padding: 26px 24px 30px; }
.reader-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.reader-tags span { font-size: 13px; color: var(--blue-deep); background: var(--blue-soft); padding: 1px 9px; border-radius: 4px; }
.reader-tags span.note { background: var(--yellow-soft); color: var(--yellow-ink); }
.reader h2 { font-family: var(--serif); font-size: 30px; line-height: 1.4; font-weight: 600; letter-spacing: 1px; margin: 10px 0 6px; overflow-wrap: anywhere; }
.reader-byline { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.version-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 14px; color: var(--muted); }
.version-row label { flex: none; }
.version-row select { flex: 1; min-width: 0; min-height: 38px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--card); padding: 4px 6px; }
.manuscript { font-family: var(--serif); font-size: 20px; line-height: 2; letter-spacing: .4px; white-space: pre-wrap; overflow-wrap: anywhere; padding: 22px 0 28px; }
.reader-state { padding: 26px 0; display: flex; flex-direction: column; gap: 14px; }
.reader-state .line { height: 18px; border-radius: 4px; background: var(--paper-deep); }
.reader-state .line.short { width: 60%; }
.reader-lock { margin: 22px 0; padding: 24px; border: 1px solid var(--blue-line); background: var(--blue-soft); border-radius: 10px; }
.reader-lock > .icon { color: var(--blue); width: 24px; height: 24px; }
.reader-lock h3 { font-size: 18px; font-weight: 650; margin: 6px 0 4px; }
.reader-lock p { font-size: 15px; color: var(--ink-soft); }
.lock-excerpt { font-family: var(--serif); font-size: 16px; line-height: 1.9; color: var(--ink-soft); margin: 14px 0 0; padding: 12px 0 0; border-top: 1px solid var(--blue-line); white-space: pre-line; overflow-wrap: anywhere; }
.lock-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.fold { border-top: 1px solid var(--line); padding: 10px 0; }
.fold summary { cursor: pointer; font-size: 15px; font-weight: 600; min-height: 32px; display: list-item; padding-top: 4px; }
.fold summary span { font-weight: 400; font-size: 13px; color: var(--muted); margin-left: 4px; }
.fold-note { font-size: 14px; color: var(--muted); margin-top: 6px; }
#originalImageGrid img { display: block; width: 100%; height: auto; border-radius: 6px; margin-top: 12px; }
.source-status { font-size: 14px; color: var(--muted); padding: 8px 0 2px; }
.source-item { font-size: 14px; color: var(--ink-soft); padding: 10px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.source-item:last-child { border-bottom: 0; }
.source-item strong { color: var(--ink); font-weight: 600; }
.source-item a { display: inline-block; margin-top: 2px; }
.source-item .rights { font-size: 13px; color: var(--muted); }
.guidance { border-top: 1px solid var(--line); padding: 14px 0; }
.guidance h3, .comments h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.guidance p { font-size: 14px; color: var(--ink-soft); }
.grade-adjust { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; color: var(--muted); margin-top: 10px; }
.grade-adjust select { min-height: 36px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--card); padding: 3px 6px; }
.grade-adjust small { font-size: 13px; }
.comments { border-top: 1px solid var(--line); padding-top: 14px; }
.comments-state { font-size: 14px; color: var(--muted); }
.comments-state:empty { display: none; }
.comment-list { list-style: none; margin: 0; padding: 0; }
.comment { padding: 10px 0; border-bottom: 1px solid var(--line); }
.comment-head { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); }
.comment-head strong { color: var(--ink-soft); font-weight: 600; overflow-wrap: anywhere; }
.comment-body { font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.comment-form { margin-top: 12px; }
.comment-form label { display: block; font-size: 14px; color: var(--ink-soft); margin-bottom: 4px; }
.comment-form textarea { display: block; width: 100%; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--card); padding: 8px 10px; resize: vertical; font-size: 16px; line-height: 1.6; }
.comment-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.comment-status { font-size: 14px; margin-top: 6px; color: var(--muted); }
.comment-status:empty { display: none; }
.comment-status.ok { color: var(--ok); }
.comment-status.bad { color: var(--bad); }
.comment-gate { font-size: 14px; color: var(--muted); margin-top: 10px; }
.reader-actions { flex: none; display: grid; grid-template-columns: repeat(3, auto) 1fr; gap: 8px; align-items: center; padding: 8px 24px; padding-bottom: max(8px, env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: var(--card); }
.action-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 14px; border-radius: 7px; font-size: 14px; color: var(--ink-soft); }
.action-button:hover { background: var(--paper-deep); color: var(--blue); }
.action-button.saved .icon { fill: var(--yellow); stroke: var(--yellow-ink); }
.action-button.primary { justify-self: end; background: var(--blue); color: #fff; font-weight: 600; padding: 0 22px; }
.action-button.primary:hover { background: var(--blue-deep); color: #fff; }
.reader-actions.is-locked .action-button:not(#favoriteWork) { opacity: .55; }
.print-mark { display: none; }

/* ---------- 面板对话框 ---------- */
.panel-dialog { width: min(640px, 94vw); max-height: 88dvh; border-radius: 12px; overflow: auto; }
.panel-dialog.small { width: min(420px, 92vw); }
.panel-top { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 8px 12px 8px 22px; border-bottom: 1px solid var(--line); background: var(--paper); font-size: 16px; }
.panel-body { padding: 18px 22px 22px; }
.panel-body h3 { font-size: 16px; font-weight: 650; margin-bottom: 6px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.about-content h3 { margin-top: 14px; }
.about-content h3:first-child { margin-top: 0; }
.about-content p { font-size: 14px; color: var(--ink-soft); margin-bottom: 6px; }
.more-list { display: flex; flex-direction: column; padding-block: 6px 12px; }
.more-row { display: block; width: 100%; text-align: left; padding: 13px 4px; font-size: 16px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.more-row:last-child { border-bottom: 0; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 14px); max-width: min(92vw, 520px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 14px; z-index: 100; opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.warn { background: #5c3f00; }
.toast a { color: var(--yellow); pointer-events: auto; }
.fatal { margin: 20px; padding: 16px 20px; border-radius: 8px; background: var(--bad-soft); color: var(--bad); }

/* ---------- 会员购买页 ---------- */
.member-page { max-width: 880px; margin: auto; padding: 24px var(--gutter) 48px; }
.member-page > h1 { font-size: 24px; font-weight: 650; }
.member-lede { color: var(--ink-soft); margin-top: 4px; }
.member-now { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin-top: 16px; }
.member-now strong { font-size: 16px; font-weight: 650; }
.member-now p { font-size: 14px; color: var(--muted); }
.pay-banner { margin-top: 12px; }
.plan-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.plan { display: flex; flex-direction: column; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.plan.selected { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.plan h2 { font-size: 18px; font-weight: 650; }
.plan-price { color: var(--ink-soft); }
.plan-price b { font-size: 36px; line-height: 1.2; font-weight: 650; color: var(--blue-deep); font-variant-numeric: tabular-nums; }
.plan ul { margin: 4px 0 8px; padding-left: 18px; font-size: 14px; color: var(--ink-soft); flex: 1; }
.plan .primary-button, .plan .secondary-button { width: 100%; min-height: 44px; }
.plan button:disabled { background: var(--paper-deep); color: var(--muted); opacity: 1; }
.pay-panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; margin-top: 14px; display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.pay-panel h2 { font-size: 17px; font-weight: 650; }
.pay-panel p { font-size: 14px; color: var(--ink-soft); }
.pay-text { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 4px; }
.pay-qr { width: 208px; height: 208px; background: #fff; border: 1px solid var(--line); border-radius: 8px; image-rendering: pixelated; }
.pay-panel .pay-note { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.pay-note:empty { display: none; }
.pay-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.pay-panel.ok { border-color: #b5d9c5; background: var(--ok-soft); }
.pay-panel.bad { border-color: #e3bdb5; background: var(--bad-soft); }
.member-facts { margin-top: 18px; font-size: 14px; color: var(--ink-soft); }
.member-facts h2 { font-size: 15px; font-weight: 650; color: var(--ink); margin-bottom: 4px; }
.member-facts ul { margin: 0; padding-left: 18px; }

/* ---------- 中等宽度 ---------- */
@media (max-width: 1180px) {
  .topbar-inner { gap: 16px; }
  .main-nav { gap: 16px; margin-left: 0; }
  .user-name, #aboutButton { display: none; }
  .stage-tab em { display: none; }
  .hot-view .work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .library { grid-template-columns: 196px minmax(0, 1fr); gap: 18px; }
  .filter-panel { padding-right: 12px; }
  .work-grid { grid-template-columns: 1fr; }
  .search kbd { display: none; }
  .brand-text small { letter-spacing: 0; }
}

/* ---------- 手机 ---------- */
@media (max-width: 720px) {
  :root { --gutter: max(16px, env(safe-area-inset-left, 0px)); }
  body:not(.plain-page) { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); }
  .topbar-inner { height: 54px; gap: 8px; }
  .brand img { width: 58px; height: 58px; margin: -6px -4px -6px -10px; }
  .brand-text strong { font-size: 16px; letter-spacing: 0; }
  .main-nav, .auth-slot { display: none; }
  .member-pill { font-size: 12px; padding: 3px 9px; flex: none; }
  .member-pill .pill-full { display: none; }
  .member-pill .pill-short { display: inline; }
  main { padding-top: 10px; }
  .desk { gap: 10px; }
  .search { height: 48px; padding-right: 4px; }
  .search input { padding: 0 12px; }
  .search-go { padding: 0 12px; height: 38px; }
  .search-go span { display: none; }
  .stage-seg { display: flex; overflow-x: auto; gap: 6px; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); scrollbar-width: none; }
  .stage-seg::-webkit-scrollbar { display: none; }
  .stage-tab { flex: none; min-height: 38px; padding: 5px 12px; border-radius: 19px; align-items: center; }
  .stage-tab strong { font-size: 14px; }
  .stage-tab small { margin-left: 2px; font-size: 12px; }
  .desk-meta { font-size: 12px; gap: 0 12px; }
  .library { display: block; margin-top: 12px; }
  .filter-toggle { display: inline-flex; }
  .results-top { gap: 8px; }
  .results-title { gap: 2px 8px; flex-basis: 100%; }
  .results-title h2 { font-size: 18px; }
  .results-title p { font-size: 13px; }
  .results-tools { width: 100%; justify-content: space-between; }
  .sort-label span { display: none; }
  .work-grid, .hot-view .work-grid { grid-template-columns: 1fr; gap: 10px; }
  .card-main { padding: 13px 14px 9px; }
  .card-bottom { padding: 4px 6px 4px 14px; }
  .work-card h3 { font-size: 19px; }

  /* iOS 在字号小于 16px 的输入框聚焦时会放大页面 */
  input, select, textarea { font-size: 16px !important; }

  /* 筛选收进底部抽屉 */
  .sheet-scrim { position: fixed; inset: 0; background: rgba(30, 42, 60, .5); z-index: 40; }
  .filter-panel { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 41; max-height: 82dvh; background: var(--paper); border-right: 0; border-radius: 14px 14px 0 0; padding: 0; transform: translateY(102%); visibility: hidden; transition: transform .2s, visibility .2s; }
  .filter-panel.open { transform: none; visibility: visible; }
  .filter-head { padding: 8px 8px 8px 18px; border-bottom: 1px solid var(--line); gap: 8px; }
  .filter-head h2 { margin-right: auto; }
  .filter-head .sheet-close { display: grid; }
  .filter-scroll { padding: 12px 16px; margin: 0; flex: 1; min-height: 0; }
  .facet-list { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .facet-item, .facet-item[data-value="古诗"], .facet-item[data-value="文言文"] { margin-top: 0; border: 1px solid var(--line-strong); min-height: 38px; padding: 4px 10px; gap: 5px; }
  .facet-item.active { border-color: var(--blue); }
  .sheet-foot { display: block; padding: 10px 16px; padding-bottom: max(10px, env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); }
  .sheet-foot .primary-button { width: 100%; min-height: 46px; }

  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .tabbar button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; height: var(--tabbar-h); font-size: 12px; color: var(--muted); }
  .tabbar button.active { color: var(--blue-deep); font-weight: 600; }
  .tab-count { position: absolute; top: 5px; left: calc(50% + 8px); font-size: 11px; line-height: 15px; min-width: 15px; padding: 0 3px; border-radius: 8px; background: var(--paper-deep); color: var(--ink-soft); font-weight: 400; }
  .toast { bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom, 0px)); }

  .reader { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0; }
  .reader-top { padding: 4px 6px 4px 16px; padding-top: max(4px, env(safe-area-inset-top, 0px)); }
  .reader-sheet { padding: 16px 18px 20px; }
  .reader h2 { font-size: 25px; letter-spacing: .5px; }
  .manuscript { font-size: 19px; line-height: 1.95; letter-spacing: .2px; padding: 16px 0 22px; }
  .reader-actions { grid-template-columns: repeat(4, 1fr); gap: 0; padding: 4px 6px; padding-bottom: max(4px, env(safe-area-inset-bottom, 0px)); }
  .action-button { flex-direction: column; gap: 0; min-height: 50px; padding: 0 2px; font-size: 12px; }
  .action-button.primary { justify-self: stretch; padding: 0 4px; }
  .plan-grid { grid-template-columns: 1fr; }
  .member-page { padding-top: 16px; }
  .site-footer { margin-top: 24px; }
}
@media (max-width: 370px) {
  .brand-text small { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- 打印 ---------- */
@media print {
  body { background: #fff; padding: 0; }
  .topbar, main, .tabbar, dialog:not(#reader), .reader-top, .reader-actions, .comments, .guidance, .version-row, #originalImages, .toast { display: none !important; }
  #reader { display: block !important; position: static; width: auto; max-width: none; height: auto; max-height: none; box-shadow: none; overflow: visible; background: #fff; }
  dialog::backdrop { background: none; }
  .reader-scroll { overflow: visible; }
  .reader-sheet { max-width: none; padding: 0; }
  .reader-tags { display: none; }
  .manuscript { font-size: 16px; line-height: 1.9; padding: 14px 0; }
  .source-item { break-inside: avoid; font-size: 11px; }
  /* 固定定位的元素会在每一页重复，作为打印水印 */
  .print-mark { display: block; position: fixed; top: 45%; left: 0; right: 0; text-align: center; transform: rotate(-24deg); font-size: 22px; color: rgba(40, 88, 152, .16); pointer-events: none; }
}

/* ---------- 管理后台 ---------- */
.admin-shell { max-width: var(--page); margin: auto; padding: 18px var(--gutter) 40px; display: grid; grid-template-columns: 176px minmax(0, 1fr); gap: 28px; align-items: start; }
.admin-nav { position: sticky; top: 12px; display: flex; flex-direction: column; gap: 2px; }
.admin-nav button { display: flex; justify-content: space-between; align-items: center; text-align: left; padding: 8px 12px; border-radius: 7px; font-size: 15px; color: var(--ink-soft); white-space: nowrap; }
.admin-nav button:hover { background: var(--paper-deep); }
.admin-nav button.active { background: var(--blue); color: #fff; font-weight: 600; }
.admin-badge { font-size: 12px; background: var(--yellow); color: #4a3200; border-radius: 9px; min-width: 18px; padding: 0 5px; text-align: center; font-weight: 600; }
.admin-main { min-width: 0; max-width: none; margin: 0; padding: 0; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.admin-head.tight { margin-bottom: 8px; }
.admin-head h2 { font-size: 22px; font-weight: 650; }
.admin-head p { font-size: 14px; color: var(--muted); }
.admin-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.admin-tools select, .admin-tools input, .field input, .field select, .field textarea { min-height: 38px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--card); padding: 6px 9px; font-size: 14px; max-width: 100%; }
.admin-tools .grow { flex: 1; min-width: 180px; }
.admin-gate { max-width: 460px; margin: 60px auto; text-align: center; padding: 32px 24px; border: 1px solid var(--line); background: var(--card); border-radius: 12px; }
.admin-gate h2 { font-size: 20px; margin-bottom: 6px; }
.admin-gate p { color: var(--muted); margin-bottom: 14px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 14px; min-width: 0; }
.panel h3 { font-size: 16px; font-weight: 650; margin-bottom: 4px; }
.panel-sub { font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.kpi span { font-size: 13px; color: var(--muted); }
.kpi b { display: block; font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; }
.chart-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--sans); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .bar { fill: var(--blue); }
.chart .hit { fill: transparent; }
.chart g:hover .bar { fill: var(--blue-deep); }
.chart-tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; padding: 3px 8px; border-radius: 5px; white-space: nowrap; transform: translate(-50%, -110%); }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; font-weight: 600; font-size: 13px; color: var(--muted); padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.data-table td { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tr:last-child td { border-bottom: 0; }
.row-title { font-weight: 600; }
.row-sub { font-size: 13px; color: var(--muted); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.mini-button { min-height: 32px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--card); font-size: 13px; white-space: nowrap; }
.mini-button:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.mini-button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.mini-button.primary:hover:not(:disabled) { background: var(--blue-deep); color: #fff; }
.mini-button.danger { color: var(--bad); border-color: #e3bdb5; }
.mini-button.danger:hover:not(:disabled) { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 4px; white-space: nowrap; background: var(--paper-deep); color: var(--ink-soft); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.blue { background: var(--blue-soft); color: var(--blue-deep); }
.pill.warn { background: var(--warn-soft); color: var(--warn-ink); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; margin-top: 8px; }
.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field label, .field-label { font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.field small { font-size: 13px; color: var(--muted); }
.field input, .field select, .field textarea { width: 100%; font-size: 15px; }
.field textarea { font-family: var(--serif); line-height: 1.8; min-height: 180px; resize: vertical; }
.field textarea.plain { font-family: var(--sans); min-height: 76px; line-height: 1.6; }
.file-clear { align-self: flex-start; }
.field .field-error { color: var(--bad); font-size: 13px; }
.field .field-error:empty { display: none; }
.form-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.form-status { font-size: 14px; color: var(--muted); }
.form-status.ok { color: var(--ok); }
.form-status.bad { color: var(--bad); }
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; min-height: 38px; align-items: center; font-size: 15px; }
.radio-row input { width: auto; min-height: 0; }
.radio-row label { font-weight: 400; color: var(--ink); }
.admin-empty { padding: 24px 12px; text-align: center; color: var(--muted); font-size: 14px; }
.admin-empty.warn { color: var(--warn-ink); background: var(--warn-soft); border-radius: 8px; }
.comment-row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.comment-row:last-child { border-bottom: 0; }
.comment-row .comment-body { margin: 4px 0 8px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.user-pick { margin-top: 8px; }
.picked-user { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; background: var(--blue-soft); border-radius: 7px; padding: 6px 10px; }

@media (max-width: 860px) {
  .admin-shell { display: block; padding-top: 10px; }
  .admin-nav { position: static; flex-direction: row; overflow-x: auto; gap: 4px; margin: 0 calc(var(--gutter) * -1) 12px; padding-inline: var(--gutter); scrollbar-width: none; }
  .admin-nav button { flex: none; padding: 7px 12px; gap: 6px; font-size: 14px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi b { font-size: 22px; }
  .chart-pair, .form-grid { grid-template-columns: 1fr; }
  .data-table.stack thead { display: none; }
  .data-table.stack tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .data-table.stack tr:last-child { border-bottom: 0; }
  .data-table.stack td { display: block; padding: 2px 0; border: 0; }
  .data-table.stack td.num { text-align: left; }
}

/* Subscription cards share the existing mobile-friendly two-column layout. */
.plan.recommended { border-color:var(--blue-deep); box-shadow:0 0 0 1px var(--blue-deep); }
.plan-subtitle,.member-quota-note { color:var(--ink-soft);font-size:14px;line-height:1.7; }
.plan-subtitle { min-height:2.8em; }
.member-quota-note { margin-top:16px; }
.trial-intro { background:var(--card);border:1px solid var(--line);border-radius:10px;padding:16px;margin-top:16px; }
.plan { display:flex; flex-direction:column; }
.plan .primary-button { margin-top:auto; }
.quota-summary { display:flex;gap:12px;flex-wrap:wrap;padding:12px 0; }
.quota-summary span { padding:6px 10px;background:var(--card);border:1px solid var(--line);border-radius:8px; }

.access-guidance { width:min(520px,calc(100vw - 28px));max-height:calc(100dvh - 32px);padding:28px;border:1px solid var(--line);border-radius:18px;background:var(--card);color:var(--ink);overflow:auto;box-shadow:0 20px 70px #16304925; }
.access-guidance::backdrop { background:#1a2c4566; }
.access-guidance h2 { font-size:23px;line-height:1.5;margin:0 0 12px; }
.access-guidance p { line-height:1.8;margin:10px 0; }
.trial-allowances { padding:12px 16px 12px 32px;border-radius:10px;background:var(--blue-soft,#edf4fb);line-height:2; }
.guidance-note { color:var(--ink-soft);font-size:14px; }
.guidance-actions { display:flex;gap:10px;justify-content:flex-end;flex-wrap:wrap;margin-top:20px; }
.trial-quota-notice { margin:12px 0;order:1; }
@media(max-width:520px){.access-guidance{padding:22px 18px}.guidance-actions>*{flex:1;text-align:center}.access-guidance h2{font-size:21px}}
