/* ===== 基础 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}
.hidden { display: none !important; }
kbd {
  background: rgba(0,0,0,.08); border: 1px solid rgba(0,0,0,.15); border-radius: 4px;
  padding: 1px 5px; font-size: 12px; font-family: inherit;
}
body.sys-dark kbd { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.22); }

/* ===== 系统主题（明亮 / 黑夜 / 多巴胺 / 马卡龙）：CSS 变量驱动全局配色 ===== */
body {
  /* 默认 = 明亮 */
  --sys-bg: #f6f3ea;
  --sys-topbar: rgba(255, 255, 255, .62);
  --sys-panel: rgba(255, 255, 255, .75);
  --sys-sheet: rgba(255, 255, 255, .93);
  --sys-solid: #ffffff;
  --sys-border: rgba(127, 127, 127, .22);
  --sys-text: #2b2f36;
  --sys-accent: #2f6fed;
  --sys-accent-strong: #2559c4;
  --sys-accent-weak: rgba(47, 111, 237, .08);
  --sys-btn-bg: #ffffff;
  --sys-btn-border: #c2c8d4;
  --sys-btn-text: #2b2f36;
  --sys-btn-hover: #f5f6f8;
  --sys-danger: #d92b2f;
  --sys-danger-strong: #b81f24;
  --sys-danger-weak: rgba(217, 43, 47, .10);
}
body.sys-dark {
  --sys-bg: #17171b;
  --sys-topbar: rgba(26, 26, 31, .72);
  --sys-panel: rgba(40, 40, 48, .82);
  --sys-sheet: rgba(30, 30, 37, .95);
  --sys-solid: #24242b;
  --sys-border: rgba(255, 255, 255, .14);
  --sys-text: #d8d8dc;
  --sys-accent: #7aa5ff;
  --sys-accent-strong: #9db9ff;
  --sys-accent-weak: rgba(122, 165, 255, .16);
  --sys-btn-bg: rgba(255, 255, 255, .08);
  --sys-btn-border: rgba(255, 255, 255, .18);
  --sys-btn-text: #cccccc;
  --sys-btn-hover: rgba(255, 255, 255, .14);
  --sys-danger: #ff7075;
  --sys-danger-strong: #ff8f93;
  --sys-danger-weak: rgba(255, 112, 117, .16);
}
body.sys-dopamine {
  --sys-bg: #ffe7ae;
  --sys-topbar: rgba(255, 244, 214, .78);
  --sys-panel: rgba(255, 252, 242, .84);
  --sys-sheet: rgba(255, 252, 243, .95);
  --sys-solid: #fffdf4;
  --sys-border: rgba(196, 98, 34, .30);
  --sys-text: #4a2a14;
  --sys-accent: #ff5c39;
  --sys-accent-strong: #e6452b;
  --sys-accent-weak: rgba(255, 92, 57, .12);
  --sys-btn-bg: #fffdf4;
  --sys-btn-border: #e0a267;
  --sys-btn-text: #4a2a14;
  --sys-btn-hover: #fff3d9;
  --sys-danger: #c62b12;
  --sys-danger-strong: #a52109;
  --sys-danger-weak: rgba(198, 43, 18, .12);
}
body.sys-macaron {
  --sys-bg: #efeaf7;
  --sys-topbar: rgba(250, 246, 255, .74);
  --sys-panel: rgba(255, 253, 255, .82);
  --sys-sheet: rgba(255, 253, 255, .94);
  --sys-solid: #fffdff;
  --sys-border: rgba(140, 110, 180, .28);
  --sys-text: #443a54;
  --sys-accent: #9d7fd4;
  --sys-accent-strong: #8468bd;
  --sys-accent-weak: rgba(157, 127, 212, .12);
  --sys-btn-bg: #fffdff;
  --sys-btn-border: #cdb9e8;
  --sys-btn-text: #443a54;
  --sys-btn-hover: #f3ecfc;
  --sys-danger: #bf3f6b;
  --sys-danger-strong: #a13359;
  --sys-danger-weak: rgba(191, 63, 107, .12);
}
body.sys-bright { background: var(--sys-bg); color: var(--sys-text); }
body.sys-dark { background: var(--sys-bg); color: var(--sys-text); }
body.sys-dopamine { background: var(--sys-bg); color: var(--sys-text); }
body.sys-macaron { background: var(--sys-bg); color: var(--sys-text); }

/* ===== 按钮规范：跟随系统主题变量 ===== */
.btn {
  border: 1px solid var(--sys-btn-border); background: var(--sys-btn-bg); color: var(--sys-btn-text); border-radius: 6px;
  padding: 6px 12px; cursor: pointer; font-size: 13px; font-weight: 500; transition: all .15s;
  user-select: none; white-space: nowrap; font-family: inherit;
}
.btn:hover { border-color: var(--sys-accent); background: var(--sys-btn-hover); }
.btn:disabled { opacity: .45; cursor: not-allowed; color: var(--sys-btn-text); }
.btn-primary { background: var(--sys-accent); border-color: var(--sys-accent); color: #fff; }
.btn-primary:hover { background: var(--sys-accent-strong); border-color: var(--sys-accent-strong); }
/* 危险操作（确认弹窗的主按钮）：实心危险色 */
.btn-danger { background: var(--sys-danger); border-color: var(--sys-danger); color: #fff; }
.btn-danger:hover { background: var(--sys-danger-strong); border-color: var(--sys-danger-strong); }
/* 危险操作（弹窗/列表内的轻量形态：退出登录、删除）：危险色文字 + 描边，不用中性灰 */
.btn-danger-ghost { background: transparent; border-color: var(--sys-danger); color: var(--sys-danger); }
.btn-danger-ghost:hover { background: var(--sys-danger-weak); border-color: var(--sys-danger); color: var(--sys-danger-strong); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--sys-accent); }
.btn-ghost:hover { background: var(--sys-accent-weak); border-color: transparent; color: var(--sys-accent-strong); }
.btn-icon { padding: 6px 10px; }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn-block { width: 100%; display: block; }
/* 正向恢复类操作（恢复访问 / 启用）：主色文字，避免与危险红混淆 */
.btn-warn { background: transparent; border-color: var(--sys-accent); color: var(--sys-accent); }
.btn-warn:hover { background: var(--sys-accent-weak); border-color: var(--sys-accent); color: var(--sys-accent-strong); }

/* ===== 视图布局 ===== */
.view { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }

/* 居中容器：宽屏两侧留白，内容聚焦 */
.topbar-inner {
  width: 100%; max-width: 1120px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.brand-link { cursor: pointer; border: none; background: none; font: inherit; padding: 0; }
.brand-link:hover { opacity: .75; }

/* ===== 顶栏（首页唯一顶栏：加高，LOGO 随高度缩放） ===== */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(18px + env(safe-area-inset-top)) 24px 18px; border-bottom: 1px solid var(--sys-border);
  background: var(--sys-topbar); backdrop-filter: blur(8px); flex-shrink: 0;
}
.brand { font-size: 20px; font-weight: 700; white-space: nowrap; }
.topbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: nowrap; }

/* ===== 首页大厅 ===== */
.home { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.home-inner {
  width: 100%; max-width: 1120px; margin: 0 auto; padding: 28px 28px 20px;
  display: flex; flex-direction: column; gap: 24px; min-height: 100%;
}
.home-hero { text-align: center; }
.home-greet { font-size: 34px; font-weight: 800; letter-spacing: 1px; }
.home-sub { margin-top: 8px; font-size: 13px; opacity: .6; }

.home-resume {
  border: 1px solid var(--sys-border); border-radius: 14px;
  background: var(--sys-panel); padding: 14px 18px; cursor: pointer;
  display: flex; align-items: center; gap: 14px; transition: all .15s;
}

/* ===== 摸鱼战报（登录信息） ===== */
.moyu-stats {
  border: 1px solid var(--sys-border); border-radius: 14px;
  background: var(--sys-panel); padding: 14px 18px;
  display: flex; flex-direction: column; gap: 8px;
  font-size: 13.5px; line-height: 1.5;
}
.moyu-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.moyu-line b { font-size: 17px; font-weight: 800; color: var(--sys-danger); font-variant-numeric: tabular-nums; }
.moyu-dim { font-size: 11.5px; opacity: .45; }
.moyu-offwork-line { position: relative; padding-right: 40px; }
.moyu-clock {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--sys-border); background: var(--sys-solid);
  font-size: 15px; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
  transition: transform .15s, box-shadow .15s;
}
.moyu-clock:hover { transform: translateY(-50%) scale(1.08); box-shadow: 0 3px 10px rgba(0,0,0,.16); }
.moyu-offwork-line[data-state="done"] b { color: #12a150; }
.offwork-quick { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.modal-narrow { max-width: 380px; }
.home-resume:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.resume-label { font-size: 12px; color: var(--sys-accent); font-weight: 600; white-space: nowrap; }
.resume-book { font-size: 16px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resume-meta { font-size: 12px; opacity: .6; white-space: nowrap; margin-left: auto; }

/* 四个入口：横向平铺的长方形 Tab（第一层：入口导航），宽度=内容宽四等分，宽高 5:3，图左标题右 */
.entry-tabs {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
}
.entry-tab {
  display: flex; align-items: stretch; aspect-ratio: 5 / 3;
  border-radius: 14px; overflow: hidden; cursor: pointer; outline: none; user-select: none;
  border: 1px solid var(--sys-border); background: var(--sys-panel);
  box-shadow: 0 2px 10px rgba(0,0,0,.06); transition: transform .18s, box-shadow .18s, border-color .15s;
}
.entry-tab img {
  width: 48%; height: 100%; object-fit: cover; flex-shrink: 0;
  transition: transform .3s ease;
}
.entry-tab-text {
  flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center;
  padding: 8px 14px; gap: 5px;
}
.entry-title { font-size: 17px; font-weight: 800; letter-spacing: .5px; }
.entry-sub { font-size: 12px; opacity: .62; }
.entry-tab:hover, .entry-tab:focus-visible { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0,0,0,.14); }
.entry-tab:hover img { transform: scale(1.05); }
.entry-tab:active { transform: translateY(-1px) scale(.99); }
/* 未选中的入口轻微后退，突出「当前所在板块」 */
.entry-tab:not(.active) { opacity: .9; }
.entry-tab:not(.active):hover { opacity: 1; }
.entry-tab.active {
  border-color: var(--sys-accent);
  box-shadow: 0 0 0 1px var(--sys-accent), 0 8px 22px var(--sys-accent-weak);
}
.entry-tab.active .entry-title { color: var(--sys-accent); }

/* Tab 下方的功能区域（第二层：归属当前入口的内容面板，用更重的面板感与入口区分层级） */
.home-panels { flex: 1; }
.home-panel {
  display: none;
  border: 1px solid var(--sys-border); border-radius: 16px;
  background: var(--sys-sheet); padding: 18px 22px 20px;
  box-shadow: 0 2px 14px rgba(0,0,0,.05);
}
.home-panel.active { display: block; }
.panel-empty { text-align: center; margin: 6vh 0 4vh; opacity: .78; }
.panel-empty .empty-icon { font-size: 48px; margin-bottom: 10px; }
.panel-empty p { font-size: 15px; font-weight: 600; }
.panel-empty .empty-sub { font-size: 12px; font-weight: 400; opacity: .7; line-height: 1.8; margin-top: 6px; }

.home-foot { text-align: center; font-size: 12px; opacity: .5; padding: 6px 0 10px; }
.home-foot a.icp { color: inherit; text-decoration: none; }
.home-foot a.icp:hover { text-decoration: underline; }

/* ===== 书架面板（首页内嵌） ===== */
.shelf-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
}
.shelf-head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.shelf-head-title { font-size: 16px; font-weight: 700; }
.shelf-tip { text-align: center; font-size: 12px; opacity: .55; padding: 12px 0 4px; }
.shelf {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px; align-content: start;
}
.book-card {
  border: 1px solid var(--sys-border); border-radius: 10px; padding: 14px;
  background: var(--sys-solid); cursor: pointer; position: relative;
  display: flex; flex-direction: column; gap: 6px; transition: all .15s;
}
.book-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.book-card .b-title {
  font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; padding-right: 22px;
}
.book-card .b-meta { font-size: 12px; opacity: .65; }
.book-card .b-tag {
  display: inline-block; margin-left: 6px; padding: 0 5px; border-radius: 4px;
  font-size: 11px; line-height: 16px; opacity: .95;
  background: rgba(7, 193, 96, .12); color: #07a352; vertical-align: 1px;
}
.book-card .b-progress { font-size: 12px; color: var(--sys-accent); }
.book-card .b-del {
  position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; line-height: 20px;
  text-align: center; border-radius: 50%; border: none; background: transparent;
  color: #999; cursor: pointer; font-size: 15px; display: none;
}
.book-card:hover .b-del { display: block; }
.book-card .b-del:hover { background: var(--sys-danger); color: #fff; }

.shelf-empty { text-align: center; margin: 6vh 0; opacity: .75; }
.empty-icon { font-size: 52px; margin-bottom: 10px; }
.empty-sub { font-size: 12px; opacity: .7; line-height: 1.8; }

.sync-bar {
  padding: 7px 14px; font-size: 12px; background: var(--sys-accent-weak);
  color: var(--sys-accent); border: 1px solid var(--sys-accent-weak); border-radius: 8px; flex-shrink: 0;
}

/* ===== 阅读视图 ===== */
.reader-topbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px; border-bottom: 1px solid rgba(127,127,127,.18); flex-shrink: 0;
}
.reader-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 34vw; }
.reader-progress { font-size: 12px; opacity: .6; margin-right: auto; }
.reader-body { flex: 1; display: flex; overflow: hidden; position: relative; }

.toc-panel {
  width: 260px; border-right: 1px solid rgba(127,127,127,.18); display: flex;
  flex-direction: column; flex-shrink: 0; background: rgba(127,127,127,.06);
}
.toc-head { padding: 10px 14px; font-weight: 600; border-bottom: 1px solid rgba(127,127,127,.15); }
.toc-list { flex: 1; overflow-y: auto; padding: 6px 0; -webkit-overflow-scrolling: touch; }
.toc-item { padding: 8px 14px; cursor: pointer; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toc-item:hover { background: rgba(127,127,127,.12); }
.toc-item.active { color: var(--sys-accent); font-weight: 600; }

/* 分页阅读区 */
.reader-content {
  flex: 1; overflow: hidden; position: relative; display: flex;
  justify-content: center; align-items: stretch; touch-action: pan-y;
}
.reader-inner {
  max-width: 720px; width: 100%; padding: 26px 32px; box-sizing: border-box;
  overflow: hidden;
}
.reader-inner .chapter-title { font-size: 1.35em; font-weight: 700; margin-bottom: 1em; text-align: center; }
.reader-inner p { margin-bottom: .9em; text-align: justify; text-indent: 2em; word-break: break-word; }
.reader-inner.measure { position: absolute; left: -99999px; top: 0; visibility: hidden; }

@keyframes flipNext { from { opacity: .25; transform: translateX(22px); } to { opacity: 1; transform: none; } }
@keyframes flipPrev { from { opacity: .25; transform: translateX(-22px); } to { opacity: 1; transform: none; } }
.flip-next { animation: flipNext .16s ease-out; }
.flip-prev { animation: flipPrev .16s ease-out; }

.reader-bottombar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(127,127,127,.18); flex-shrink: 0;
}
.chapter-pos { font-size: 12px; opacity: .6; }

/* 沉浸模式（移动端点中屏切换） */
#view-reader.immersive .reader-topbar,
#view-reader.immersive .reader-bottombar { display: none; }

/* ===== 阅读主题（只作用于阅读视图；系统界面配色由 --sys-* 变量决定） ===== */
#view-reader.theme-ivory { background: #f7f3e8; color: #3a362e; }
#view-reader.theme-green { background: #cfe8d5; color: #2c3a2e; }
#view-reader.theme-paper { background: #f0e4cd; color: #4a3b28; }
#view-reader.theme-blue  { background: #e3edf8; color: #2e3a4a; }
#view-reader.theme-gray  { background: #ebebeb; color: #333; }
#view-reader.theme-dark  { background: #1c1c20; color: #c8c8c8; }
#view-reader.theme-dark .btn { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.16); color: #ccc; }
#view-reader.theme-dark .btn-ghost { background: transparent; border-color: transparent; color: #7fa4ff; }
#view-reader.theme-dark .btn-ghost:hover { background: rgba(127,164,255,.14); color: #9db9ff; }
#view-reader.theme-dark .btn:disabled { color: #777; }
#view-reader.theme-dark .btn-primary { background: #2f6fed; border-color: #2f6fed; color: #fff; }
#view-reader.theme-dark .btn-danger { background: var(--sys-danger); border-color: var(--sys-danger); color: #fff; }

/* ===== 伪装 Excel ===== */
.disguise {
  position: fixed; inset: 0; z-index: 9999; background: #f3f3f3; color: #333;
  display: flex; flex-direction: column; font-family: "Segoe UI", -apple-system, sans-serif;
}
.xl-titlebar { background: #217346; color: #fff; padding: 4px 12px 0; flex-shrink: 0; }
/* 移动端无键盘：长按标题栏/状态栏退出伪装，禁掉长按菜单与选中 */
#disguise .xl-titlebar,
#disguise .xl-statusbar {
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: manipulation;
}
.xl-tab { display: inline-block; padding: 6px 16px; font-size: 12px; background: #f3f3f3; color: #217346; border-radius: 4px 4px 0 0; }
.xl-file { font-size: 12px; padding: 6px 4px 8px; opacity: .95; }
.xl-toolbar {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: #f3f3f3;
  border-bottom: 1px solid #d4d4d4; font-size: 12px; flex-shrink: 0;
}
.xl-cellref { border: 1px solid #d4d4d4; padding: 2px 10px; background: #fff; min-width: 52px; }
.xl-fx { font-style: italic; opacity: .7; }
.xl-formula { border: 1px solid #d4d4d4; padding: 2px 10px; background: #fff; flex: 1; overflow: hidden; }
.xl-grid {
  flex: 1; overflow: auto; background: #fff; display: grid;
  grid-template-columns: 42px repeat(9, 1fr); font-size: 12px;
}
.xl-grid .hcell {
  background: #f3f3f3; border: 1px solid #e0e0e0; text-align: center; padding: 3px 4px;
  color: #616161; position: sticky; font-weight: 400;
}
.xl-grid .hcell.corner { z-index: 30; }
.xl-grid .hcell.colhead { top: 0; z-index: 20; }
.xl-grid .hcell.rowhead { left: 0; z-index: 10; }
.xl-grid .xcell { border: 1px solid #e6e6e6; padding: 3px 6px; text-align: right; min-height: 22px; white-space: nowrap; overflow: hidden; }
.xl-grid .xcell.sel { outline: 2px solid #217346; outline-offset: -2px; }
.xl-grid .xcell.txt { text-align: left; }
.xl-statusbar {
  border-top: 1px solid #d4d4d4; background: #f3f3f3; padding: 4px 12px;
  font-size: 12px; color: #444; flex-shrink: 0;
}

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  background: var(--sys-solid); color: var(--sys-text); border-radius: 12px; width: 440px; max-width: 100%;
  max-height: 86vh; overflow-y: auto; padding: 20px 22px; box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.modal-wide { width: 560px; }
.modal-head { font-size: 16px; font-weight: 700; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.modal-close { border: none; background: transparent; font-size: 22px; cursor: pointer; color: #999; line-height: 1; }
.modal-desc { display: block; margin-bottom: 14px; line-height: 1.6; }
.modal-section { margin-bottom: 16px; }
.section-title { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.section-hint { font-size: 12px; opacity: .55; font-weight: 400; margin-left: 6px; }
.setting-inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.text-input {
  border: 1px solid var(--sys-border); border-radius: 6px; padding: 8px 10px; font-size: 14px;
  width: 160px; color: var(--sys-text); background: var(--sys-solid); font-family: inherit;
}
.text-input.grow { flex: 1; width: auto; min-width: 0; }
.text-input:focus { outline: none; border-color: var(--sys-accent); }
.login-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.field-error { color: var(--sys-danger); font-size: 12px; margin: 4px 0 6px; }

.theme-row { display: flex; gap: 10px; flex-wrap: wrap; }
.theme-swatch {
  width: 72px; height: 48px; border-radius: 8px; border: 2px solid transparent;
  cursor: pointer; display: flex; align-items: flex-end; justify-content: center;
  font-size: 11px; padding-bottom: 3px;
}
.theme-swatch.active { border-color: var(--sys-accent) !important; }
.theme-swatch.theme-ivory { background: #f7f3e8; color: #333; border-color: #d8d2c0; }
.theme-swatch.theme-green { background: #cfe8d5; color: #2c3a2e; }
.theme-swatch.theme-paper { background: #f0e4cd; color: #4a3b28; }
.theme-swatch.theme-blue  { background: #e3edf8; color: #2e3a4a; }
.theme-swatch.theme-gray  { background: #ebebeb; color: #333; }
.theme-swatch.theme-dark  { background: #1c1c20; color: #c8c8c8; }

/* 系统主题选择块（设置弹窗） */
.sys-theme-row { display: flex; gap: 10px; flex-wrap: wrap; }
.sys-swatch {
  width: 88px; height: 54px; border-radius: 10px; border: 2px solid var(--sys-border);
  cursor: pointer; display: flex; align-items: flex-end; justify-content: center;
  font-size: 11px; padding-bottom: 4px; font-weight: 600; transition: all .15s;
}
.sys-swatch:hover { transform: translateY(-2px); }
.sys-swatch.active { border-color: var(--sys-accent); box-shadow: 0 0 0 2px var(--sys-accent-weak); }
.sys-swatch.sys-bright { background: #f6f3ea; color: #2b2f36; }
.sys-swatch.sys-dark { background: #17171b; color: #d8d8dc; }
.sys-swatch.sys-dopamine { background: linear-gradient(135deg, #ffe7ae 40%, #ff8f6b); color: #7a2e12; }
.sys-swatch.sys-macaron { background: linear-gradient(135deg, #f0eaf8 40%, #c9e8d8); color: #443a54; }

input[type="range"] { width: 100%; accent-color: var(--sys-accent); }

.ai-output {
  border: 1px solid #e2e2e2; border-radius: 8px; min-height: 180px; max-height: 320px;
  overflow-y: auto; padding: 12px; font-size: 14px; line-height: 1.8;
  white-space: pre-wrap; background: #fafafa;
}
.ai-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.toast {
  position: fixed; left: 50%; bottom: 64px; transform: translateX(-50%);
  background: rgba(20,20,24,.88); color: #fff; padding: 9px 18px; border-radius: 8px;
  font-size: 13px; z-index: 2000; pointer-events: none; max-width: 80vw; text-align: center;
}

/* ===== 书架使用引导（首次进入书架弹一次） =====
   全部配色走 var(--sys-*)：暗色/多巴胺/马卡龙主题下都不能写死颜色，否则会瞎
   高度交给 .modal 的 max-height:86vh + overflow-y:auto，这里不设固定高度 */
.guide-steps { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 16px; }
.guide-step {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 13px; border-radius: 10px;
  background: var(--sys-panel); border: 1px solid var(--sys-border);
}
.guide-num {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  /* 数字用 --sys-text 而不是 --sys-accent：多巴胺/马卡龙主题下强调色偏淡，
     对比度只有 2.6~2.9，达不到 3.0；accent 只留在底色与描边上做微弱点缀 */
  background: var(--sys-accent-weak); border: 1px solid var(--sys-accent-weak);
  color: var(--sys-text);
  font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.guide-body { flex: 1; min-width: 0; }
.guide-body h4 { font-size: 14px; font-weight: 600; line-height: 1.4; margin-bottom: 3px; color: var(--sys-text); }
.guide-body p { font-size: 12.5px; line-height: 1.7; opacity: .72; }
/* 弹窗说明行：不复用 .section-hint 的 .55 透明度（马卡龙主题下对比度只有 2.99），
   抬到与正文一致的 .72；.section-hint 本身是全站既有约定，不去动它的全局样式 */
.guide-desc { opacity: .72; }
/* 底部主按钮：短屏（390×844）下 5 步内容会超出 .modal 的 max-height:86vh，
   用 sticky 把它钉在滚动区底部，用户不滚也能看见「知道了，开始用」。
   sticky 的 inset 以 margin 盒为基准、且不能越过内容盒底缘，因此本弹窗先把
   .modal 的底部内边距清零（仅此弹窗，别的不受影响），由按钮自己补回 20px，
   这样贴底时不会在弹窗最底部留出一条透出正文的缝隙。
   左右用负外边距顶到弹窗边缘，滚动内容不会从两侧透出来。
   桌面端内容放得下时 sticky 不生效，间距与原来一致（仅多一条分隔线） */
#modal-shelf-guide .modal { padding-bottom: 0; }
.guide-foot {
  display: flex; justify-content: flex-end;
  position: sticky; bottom: 0;
  margin: 0 -22px; padding: 10px 22px 20px;
  background: var(--sys-solid); border-top: 1px solid var(--sys-border);
}

/* ===== 手机适配 ===== */
@media (max-width: 820px) {
  .hide-sm { display: none !important; }
  .topbar { padding: calc(12px + env(safe-area-inset-top)) 12px 12px; }
  .brand { font-size: 16px; }
  .brand-logo { width: 28px; height: 28px; }
  .btn { padding: 6px 10px; font-size: 13px; }
  /* 窄屏：入口 Tab 退化为 2×2，保持 5:3 */
  .entry-tabs { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .home-inner { padding: 20px 16px 16px; gap: 18px; }
  .home-panel { padding: 14px 14px 16px; border-radius: 14px; }
  .home-greet { font-size: 26px; }
  .shelf { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .book-card { padding: 12px; }
  .book-card .b-title { font-size: 14px; }
  .book-card .b-del { display: block; }

  .reader-topbar { gap: 4px; padding: calc(6px + env(safe-area-inset-top)) 8px 6px; }
  .reader-title { max-width: 38vw; font-size: 14px; }
  .reader-progress { font-size: 11px; }

  .toc-panel {
    position: absolute; top: 0; left: 0; bottom: 0; width: 78%; max-width: 320px;
    z-index: 50; background: var(--sys-solid); box-shadow: 0 0 24px rgba(0,0,0,.25);
  }
  #view-reader.theme-dark .toc-panel { background: #26262b; }

  .reader-inner { padding: 18px 20px; }
  .reader-inner .chapter-title { font-size: 1.2em; }
  .chapter-pos { font-size: 11px; }

  /* 书架引导：窄屏坚持单列，字号略降一档，免得 5 步挤成一片 */
  .guide-steps { grid-template-columns: 1fr; gap: 8px; }
  .guide-step { padding: 10px 11px; }
  .guide-body h4 { font-size: 13px; }
  .guide-body p { font-size: 12px; }
}

@media (max-width: 420px) {
  .brand { max-width: 34vw; overflow: hidden; text-overflow: ellipsis; }
  .reader-title { display: none; }
  .reader-topbar .topbar-actions { margin-left: auto; }
}

/* ===== 品牌 LOGO ===== */
.brand { display: flex; align-items: center; gap: 9px; }
.brand-logo { width: 34px; height: 34px; flex-shrink: 0; }

/* ===== 账号头像 / 资料 ===== */
.account-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; overflow: hidden;
  font-size: 13px; line-height: 1; vertical-align: -3px; margin-right: 4px; background: rgba(127,127,127,.12);
}
.account-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.profile-avatar-row { display: flex; gap: 14px; align-items: flex-start; }
.avatar-preview {
  width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: 38px; line-height: 1; background: rgba(47,111,237,.1); border: 2px solid rgba(47,111,237,.35);
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-avatar-side { flex: 1; min-width: 0; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.emoji-cell {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  font-size: 22px; border-radius: 8px; cursor: pointer; border: 2px solid transparent;
  user-select: none; transition: all .12s;
}
.emoji-cell:hover { background: var(--sys-accent-weak); }
.emoji-cell.active { border-color: var(--sys-accent); background: var(--sys-accent-weak); }
.profile-upload-row { margin-top: 8px; }
.gender-row { display: flex; gap: 10px; }
.gender-option {
  flex: 1; text-align: center; padding: 10px 8px; border-radius: 8px; cursor: pointer;
  border: 2px solid rgba(127,127,127,.25); font-size: 14px; user-select: none; transition: all .12s;
}
.gender-option:hover { background: var(--sys-accent-weak); }
.gender-option.active { border-color: var(--sys-accent); background: var(--sys-accent-weak); color: var(--sys-accent); font-weight: 600; }

/* ===== 神秘设置：Excel 内容选择 ===== */
.xl-type-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.xl-type-option {
  padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 13px;
  border: 2px solid rgba(127,127,127,.25); user-select: none; transition: all .12s;
}
.xl-type-option:hover { background: rgba(127,127,127,.08); }
.xl-type-option.active { border-color: #217346; background: rgba(33,115,70,.1); color: #217346; font-weight: 600; }

/* Excel 伪装表头行 */
.xl-grid .xcell.thead { font-weight: 600; background: #f0f4ef; color: #217346; }

/* ===== 阅读外观快捷面板（阅读中直接调字号/行距/背景） ===== */
.appearance-panel {
  position: fixed; right: 18px; bottom: 68px; z-index: 60;
  width: 300px; padding: 12px 14px 10px;
  border-radius: 12px;
  background: var(--sys-solid); color: var(--sys-text);
  box-shadow: 0 10px 32px rgba(0,0,0,.18);
  border: 1px solid var(--sys-border);
  backdrop-filter: blur(10px);
}
#view-reader.theme-dark .appearance-panel { background: rgba(44,44,50,.97); color: #ddd; border-color: rgba(255,255,255,.12); }
.ap-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.ap-close { border: none; background: transparent; font-size: 18px; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }
.ap-close:hover { opacity: 1; }
.ap-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.ap-label { width: 34px; flex: none; font-size: 12px; opacity: .65; }
.ap-val { min-width: 42px; text-align: center; font-size: 12px; opacity: .8; font-variant-numeric: tabular-nums; }
.ap-row input[type="range"] { flex: 1; width: auto; }
.ap-row-themes { align-items: flex-start; }
.ap-swatches { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.ap-swatch {
  width: 32px; height: 22px; border-radius: 6px; cursor: pointer;
  border: 2px solid rgba(127,127,127,.35); display: inline-block;
}
.ap-swatch.active { border-color: var(--sys-accent); box-shadow: 0 0 0 2px var(--sys-accent-weak); }
.ap-swatch.theme-ivory { background: #f7f3e8; }
.ap-swatch.theme-green { background: #cfe8d5; }
.ap-swatch.theme-paper { background: #f0e4cd; }
.ap-swatch.theme-blue  { background: #e3edf8; }
.ap-swatch.theme-gray  { background: #ebebeb; }
.ap-swatch.theme-dark  { background: #1c1c20; }
.ap-hint { font-size: 11px; opacity: .5; margin-top: 6px; }

@media (max-width: 720px) {
  .appearance-panel {
    left: 12px; right: 12px; bottom: 0; width: auto;
    border-radius: 14px 14px 0 0; padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 28px rgba(0,0,0,.22);
  }
  .ap-swatch { width: 40px; height: 28px; }
}

/* ===== 登录门：未登录时锁定全站 ===== */
.login-gate {
  position: fixed; inset: 0; z-index: 3000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 20px;
  background: inherit;   /* 跟随当前主题的 body 背景 */
}
body.gate-on .view, body.gate-on .sync-bar { display: none !important; }
.gate-card {
  background: var(--sys-solid); color: var(--sys-text); border-radius: 14px; width: 400px; max-width: 100%;
  padding: 26px 26px 20px; box-shadow: 0 12px 40px rgba(0,0,0,.18);
}
.gate-brand { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 6px; }
.gate-logo { width: 56px; height: 56px; }
.gate-name { font-size: 18px; font-weight: 600; letter-spacing: .5px; }
.gate-hint { text-align: center; font-size: 12.5px; opacity: .65; margin-bottom: 14px; }
.gate-section { margin-bottom: 14px; }
/* 一键登录身份提示条：告诉用户「现在哪个身份、要做什么」 */
.gate-bind {
  display: flex; align-items: flex-start; gap: 8px;
  margin: 0 0 14px; padding: 10px 12px; border-radius: 10px;
  background: #fff7e6; border: 1px solid #ffe1a8; color: #8a5b00;
  font-size: 12.5px; line-height: 1.55;
}
.gate-bind::before { content: '🔗'; flex: 0 0 auto; font-size: 14px; line-height: 1.4; }
.gate-bind .gb-id { font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; opacity: .8; margin-top: 2px; }
body.sys-dark .gate-bind { background: rgba(255,193,94,.14); border-color: rgba(255,193,94,.35); color: #ffd79a; }
.login-alt { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.gate-section .login-row { display: flex; gap: 8px; margin-bottom: 10px; }
.gate-version { font-size: 12px; opacity: .5; }

/* ===== 小玩具大厅 + 游戏：这玩意儿当年有吗 ===== */
.game-hub { display: grid; gap: 16px; }
.game-card {
  display: flex; gap: 16px; align-items: stretch;
  background: var(--sys-solid); border: 1px solid var(--sys-border);
  border-radius: 14px; padding: 12px; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.game-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.game-cover { position: relative; width: 220px; min-width: 160px; border-radius: 10px; overflow: hidden; background: linear-gradient(135deg, #d9d2c3, #b9b1a0); }
.game-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.game-cover-badge {
  position: absolute; right: 6px; bottom: 6px; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; color: #fff; background: rgba(0,0,0,.55);
}
.game-card-body { display: flex; flex-direction: column; gap: 6px; justify-content: center; min-width: 0; }
.game-title { font-size: 17px; font-weight: 700; }
.game-desc { font-size: 13px; opacity: .72; }
.game-play { align-self: flex-start; margin-top: 6px; }
/* 历史关卡回顾 */
.game-lvl-toggle { align-self: flex-start; margin-top: 2px; background: none; border: none; color: var(--accent, #6ea8ff); cursor: pointer; font-size: 13px; padding: 2px 0; opacity: .85; }
.game-lvl-toggle:hover { opacity: 1; }
.game-lvl-grid { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 0 2px; }
.lvl-chip { background: rgba(110, 168, 255, .12); border: 1px solid rgba(110, 168, 255, .4); color: var(--accent, #6ea8ff); border-radius: 999px; padding: 4px 14px; font-size: 12px; cursor: pointer; }
.lvl-chip:hover { background: rgba(110, 168, 255, .22); }
.game-hub-tip { font-size: 12px; opacity: .55; text-align: center; padding: 4px 0 8px; }

/* 游戏进行时 */
.game-hint { font-size: 12px; opacity: .6; margin-right: 8px; }
.game-timer {
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: 16px;
  padding: 2px 10px; border-radius: 8px; background: rgba(0,0,0,.06);
}
.game-timer.danger { color: #fff; background: var(--sys-danger); }
.game-body { width: 100%; max-width: 980px; margin: 0 auto; padding: 12px 16px 32px; }
.game-progress { height: 6px; border-radius: 999px; background: rgba(0,0,0,.1); overflow: hidden; }
.game-progress > div { height: 100%; width: 0; background: #4caf6d; transition: width .25s ease; }
.game-progress-text { font-size: 13px; font-weight: 700; color: #2c7a46; font-variant-numeric: tabular-nums; }
.game-pu-row { display: flex; align-items: center; gap: 10px; margin: 2px 0 8px; flex-wrap: wrap; }
.game-powerups { display: flex; gap: 10px; margin-left: auto; }
/* 道具 pill：上半是「icon 名称 + 余额」（点它用道具），下半是领取入口（分享 / 看广告互斥） */
.game-pu {
  display: flex; flex-direction: column; gap: 6px; min-width: 118px;
  padding: 8px 12px; border-radius: 14px; cursor: pointer;
  background: rgba(76,175,109,.14); color: #2c7a46; border: 1px solid rgba(76,175,109,.35);
}
.game-pu-main { font-size: 14px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 6px; }
.game-pu-main b {
  font-weight: 700; font-size: 12px; min-width: 22px; text-align: center;
  padding: 0 6px; border-radius: 999px; background: rgba(44,122,70,.14);
}
.pu-get {
  display: block; text-align: center; font-size: 12px; font-weight: 700; line-height: 1.5;
  padding: 4px 0; border-radius: 9px; background: #2c7a46; color: #fff; cursor: pointer;
  user-select: none;
}
.pu-get.ad { background: #fff; color: #2c7a46; border: 1px solid #2c7a46; }
.pu-get:hover { filter: brightness(1.05); }
.game-pu b { font-weight: 700; }
/* 只有「用道具」这一行会因为余额为 0 / 本局用过而变淡；领取入口永远是可点的实色 */
.game-pu.empty .game-pu-main, .game-pu.used .game-pu-main { opacity: .45; }
.game-pu-note { font-size: 11px; opacity: .5; }
.game-float {
  position: absolute; transform: translate(-50%, -50%); font-size: 16px; font-weight: 700;
  pointer-events: none; animation: game-float-up .9s ease forwards;
}
.game-float.bad { color: var(--sys-danger); }
.game-float.good { color: #2c7a46; }
@keyframes game-float-up {
  from { opacity: 1; margin-top: 0; }
  to   { opacity: 0; margin-top: -34px; }
}
/* 扣时提示：闪一圈内阴影，不做位移/外边距抖动。
   原来用 margin-left 抖动，缩放后画面会跟着横向挪；如果改成 transform 更糟——
   动画会盖掉内联的 translate+scale，画面瞬间跳回未缩放状态。 */
.game-scene.shake { animation: game-shake .38s ease; }
@keyframes game-shake {
  0%, 100% { box-shadow: inset 0 0 0 0 rgba(229,72,77,0); }
  30% { box-shadow: inset 0 0 0 6px rgba(229,72,77,.7); }
  60% { box-shadow: inset 0 0 0 6px rgba(229,72,77,.32); }
}
.game-tip {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%);
  background: rgba(0,0,0,.72); color: #fff; font-size: 13px; padding: 6px 14px;
  border-radius: 999px; opacity: 0; transition: opacity .25s ease; pointer-events: none;
}
.game-tip.show { opacity: 1; }
.game-found { display: flex; flex-wrap: wrap; gap: 6px; min-height: 26px; padding: 8px 2px; }
.game-chip { font-size: 12px; padding: 2px 10px; border-radius: 999px; background: rgba(76,175,109,.15); color: #2c7a46; }
.game-stage { position: relative; border-radius: 14px; overflow: hidden; box-shadow: 0 8px 28px rgba(0,0,0,.14); }
.game-scene {
  position: relative;
  /* 竖版场景（1024 x 1471）：按可用高度约束宽度并居中，保证整图完整显示 */
  aspect-ratio: 1024 / 1471;
  width: min(100%, calc(min(74vh, 900px) * 0.6961));
  height: auto; margin: 0 auto; cursor: crosshair;
  background-size: 100% 100%; background-position: center top; user-select: none; -webkit-user-select: none;
  animation: game-kenburns 18s ease-in-out infinite alternate;
}
/* 缩放查看态：关掉 Ken Burns 动画，变换原点取左上角便于以鼠标为中心缩放；
   扣时反馈只闪内阴影、不动 transform，所以在缩放态也放行（原来这里的 animation:none 把反馈一起禁掉了） */
.game-scene.zoomed { animation: none; transform-origin: 0 0; cursor: grab; }
.game-scene.zoomed.shake { animation: game-shake .38s ease; }
.game-scene.zoomed.dragging { cursor: grabbing; }
/* 场景图从云库下载中（首次进这一关才会出现） */
.game-scene.asset-loading {
  animation: none; background: #efeade; cursor: progress;
  display: flex; align-items: center; justify-content: center;
}
.game-scene.asset-loading::before {
  content: '正在取场景图…'; font-size: 15px; color: #6b6459; letter-spacing: .5px;
}
@keyframes game-kenburns {
  from { transform: scale(1); }
  to   { transform: scale(1.045) translate(0.5%, -0.35%); }
}
.game-items, .game-fx { position: absolute; inset: 0; }
.game-fx { pointer-events: none; }   /* 特效层不接受点击，空点才能算「找错」 */
.game-item {
  /* [2026-11-19 用户实报重大缺陷] 这里是找茬游戏的**点击热区**（覆盖在照片上的不可见 div）。
   * 原来写 `cursor: pointer` ⇒ 鼠标移到可点物品上指针就变手型，
   *   **等于直接把答案标出来**，玩家只要拖着鼠标扫一遍就能通关。
   * 改成 `inherit`：跟场景容器保持同一个指针（当前是普通箭头），
   *   悬停时**没有任何视觉差异** —— 找茬的信息只能来自眼睛，不能来自指针。
   * ⚠️ 以后改这里之前先想一遍"这会不会变成提示"：hover 高亮、tooltip(title)、
   *   描边、缩放动画都算同一类泄题。 */
  position: absolute; cursor: inherit;
}
.game-item.found { cursor: default; animation: game-pop .35s ease; }
.game-item.found::after {
  content: ''; position: absolute; inset: -4%; border: 3px dashed #4caf6d; border-radius: 12px;
}
.game-tag {
  position: absolute; left: 50%; top: -22px; transform: translateX(-50%);
  white-space: nowrap; font-size: 12px; padding: 2px 8px; border-radius: 999px;
  background: #4caf6d; color: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25);
  pointer-events: none;
  /* 名称只短暂展示后淡出，避免长期盖住场景图影响继续找其他物品 */
  animation: game-tag-flash 1.5s ease forwards;
}
@keyframes game-tag-flash {
  0%   { opacity: 0; transform: translateX(-50%) translateY(4px) scale(.9); }
  12%  { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}
.game-miss {
  position: absolute; transform: translate(-50%, -50%); color: var(--sys-danger);
  font-weight: 800; font-size: 20px; pointer-events: none; animation: game-fade .5s ease forwards;
}
.game-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.45); backdrop-filter: blur(2px);
}
.game-modal {
  background: var(--sys-solid); border-radius: 16px; padding: 22px 26px; text-align: center;
  display: flex; flex-direction: column; gap: 8px; min-width: 260px;
}
.game-modal-icon { font-size: 34px; }
.game-modal-title { font-size: 17px; font-weight: 700; }
.game-modal-sub { font-size: 13px; opacity: .7; }
.game-modal-btns { display: flex; gap: 8px; justify-content: center; margin-top: 8px; flex-wrap: wrap; }
@keyframes game-pop { 0% { transform: scale(1); } 45% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes game-fade { 0% { opacity: 1; } 100% { opacity: 0; } }
@media (max-width: 640px) {
  .game-card { flex-direction: column; }
  .game-cover { width: 100%; min-width: 0; height: 150px; }
  .game-hint { display: none; }
}

/* 游戏静音按钮 */
.game-sound-btn {
  width: 28px; height: 28px; min-width: 28px; padding: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; line-height: 1; position: relative;
  border: 1px solid rgba(255,255,255,.28);
}
.game-sound-btn::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 0; height: 2px; border-radius: 2px; background: #e5484d;
  transform: translate(-50%, -50%) rotate(-45deg); transition: width .18s ease;
}
.game-sound-btn.off::after { width: 132%; }
.game-sound-btn.off { opacity: .6; }

/* ===== 牛马的乐子（#panel-fun）===== */
/* 硬约束：全部颜色/边框/背景只用 var(--sys-*) 令牌（四套皮肤），零硬编码 # 色值 */
.fun-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.fun-count {
  font-size: 13px; font-weight: 600; color: var(--sys-text);
  white-space: nowrap;
}
.fun-chips {
  display: flex; gap: 8px; overflow-x: auto; flex-wrap: nowrap;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
  margin-bottom: 12px; /* 独立成行后与列表 border-top 的间距 */
}
.fun-chips::-webkit-scrollbar { display: none; }
.fun-chip {
  flex: 0 0 auto; padding: 5px 14px; border-radius: 999px;
  font-size: 13px; line-height: 1.5; cursor: pointer;
  border: 1px solid var(--sys-border);
  background: var(--sys-panel); color: var(--sys-text);
  transition: background .15s ease, border-color .15s ease;
}
.fun-chip:hover { background: var(--sys-btn-hover); }
.fun-chip.active {
  background: var(--sys-accent-weak);
  border-color: var(--sys-accent);
  color: var(--sys-accent-strong);
  font-weight: 600;
}

/* 三态筛选状态行（连续阅读增量 ARCH §3.4）：描边 pill，与分类行 .fun-chip（实底）视觉分组 */
.fun-status-row {
  display: flex; gap: 8px; flex-wrap: nowrap; overflow-x: auto;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
  margin-bottom: 10px;
}
.fun-status-row::-webkit-scrollbar { display: none; }
.fun-status-chip {
  flex: 0 0 auto; padding: 4px 14px; border-radius: 999px;
  font-size: 13px; line-height: 1.5; cursor: pointer;
  border: 1px solid var(--sys-accent);
  background: transparent; color: var(--sys-accent-strong);
  transition: background .15s ease, color .15s ease;
}
.fun-status-chip:hover { background: var(--sys-accent-weak); }
/* active = 主色实底反白：文字用 --sys-solid（亮皮肤=白、暗皮肤=深底色），四皮肤下自动反转、无需硬编码 */
.fun-status-chip.active {
  background: var(--sys-accent);
  border-color: var(--sys-accent);
  color: var(--sys-solid);
  font-weight: 600;
}

/* 列表独立滚动：避免与 .home 页面滚动嵌套 */
.fun-list {
  max-height: calc(100vh - 320px); min-height: 360px;
  overflow-y: auto; overscroll-behavior: contain;
  display: grid; grid-template-columns: 1fr; gap: 12px;
  align-content: start;
  border-top: 1px solid var(--sys-border);
  padding-top: 12px;
}
@media (min-width: 860px) {
  .fun-list { grid-template-columns: 1fr 1fr; }
}

.fun-card {
  display: flex; flex-direction: column; gap: 8px;
  border: 1px solid var(--sys-border); border-radius: 12px;
  background: var(--sys-panel); padding: 14px 16px;
}

/* 骨架卡（加载态）：标题条 + 两行摘要条 + meta 条 */
.fun-skel-line {
  position: relative; overflow: hidden;
  height: 14px; width: 100%; border-radius: 7px;
  background: var(--sys-btn-hover);
}
.fun-skel-line.fun-skel-title { height: 18px; width: 72%; border-radius: 9px; }
.fun-skel-line.fun-skel-short { width: 55%; }
.fun-skel-line.fun-skel-meta  { height: 12px; width: 40%; }
.fun-skel-line::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--sys-border), transparent);
  animation: fun-shimmer 1.4s ease-in-out infinite;
}
@keyframes fun-shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}
@media (prefers-reduced-motion: reduce) {
  .fun-skel-line::after { animation: none; }
}

/* 空态 / 失败态（居中） */
.fun-empty { text-align: center; padding: 48px 16px 32px; }
.fun-empty-icon { font-size: 44px; margin-bottom: 10px; }
.fun-empty-title { font-size: 15px; font-weight: 600; color: var(--sys-text); margin: 0 0 6px; }
.fun-empty-sub { font-size: 12px; color: var(--sys-text); opacity: .8; margin: 0 0 16px; }
.fun-empty-btn {
  padding: 7px 26px; border-radius: 10px; font-size: 14px; cursor: pointer;
  border: 1px solid var(--sys-btn-border);
  background: var(--sys-btn-bg); color: var(--sys-btn-text);
}
.fun-empty-btn:hover { background: var(--sys-btn-hover); }

/* 免责条：常驻面板底部，不随列表滚动；对比度 ≥4.5（勿用 .55 透明度） */
.fun-foot {
  margin-top: 12px; padding-top: 10px;
  border-top: 1px solid var(--sys-border);
  text-align: center;
  font-size: 12px; color: var(--sys-text); opacity: .78;
}

/* 手机窄屏 */
@media (max-width: 820px) {
  .fun-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .fun-chips { width: 100%; }
  .fun-list { min-height: 280px; max-height: calc(100vh - 260px); }
  .fun-card { padding: 12px 14px; border-radius: 11px; }
}

/* ---- 卡片内容（T03）---- */
.fun-tag {
  display: inline-block; align-self: flex-start;
  padding: 2px 10px; border-radius: 999px;
  font-size: 12px; line-height: 1.6; font-weight: 600;
  background: var(--sys-accent-weak);
  color: var(--sys-accent-strong);
}
.fun-card-title {
  font-size: 15px; font-weight: 600; line-height: 1.45; color: var(--sys-text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.fun-card-summary {
  font-size: 13px; line-height: 1.6; color: var(--sys-text); opacity: .85;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.fun-card-meta { font-size: 12px; color: var(--sys-text); opacity: .8; }
.fun-card { cursor: pointer; }
.fun-card:hover, .fun-card:focus-visible { border-color: var(--sys-accent); outline: none; }
.fun-card:focus-visible { box-shadow: 0 0 0 2px var(--sys-accent-weak); }

/* 已读弱化：仅标题降到 .6，分类标签与 meta 保持对比度；hover/焦点恢复 */
.fun-card.is-read .fun-card-title { opacity: .6; }
.fun-card.is-read:hover .fun-card-title,
.fun-card.is-read:focus-visible .fun-card-title { opacity: 1; }

/* 不足 100 提示（列表底部） */
.fun-more {
  grid-column: 1 / -1;
  text-align: center; font-size: 12px; padding: 8px 0 2px;
  color: var(--sys-text); opacity: .8;
}

/* 缓存提示黄条（RPC 失败 + 同日缓存时出现在列表上方；四皮肤用 accent 令保证可见） */
.fun-notice {
  display: block; width: 100%; text-align: center; cursor: pointer;
  margin-bottom: 10px; padding: 8px 12px;
  border: 1px solid var(--sys-accent); border-radius: 10px;
  background: var(--sys-accent-weak);
  color: var(--sys-accent-strong);
  font-size: 13px; font-weight: 600;
}
.fun-notice:hover { background: var(--sys-btn-hover); }

/* ---- 详情弹窗（居中，max-width 640px；遮罩 rgba(0,0,0,.45) 为 PRD 指定的唯一例外）---- */
.fun-modal-mask {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0, 0, 0, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}

/* 弹窗左右切换按钮（连续阅读增量 ARCH §1.6）：遮罩的绝对定位直接子节点，
   垂直居中于弹窗两侧空白区，不占弹窗内容宽度；边界禁用不循环 */
.fun-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--sys-border);
  background: var(--sys-panel); color: var(--sys-text);
  font-size: 18px; line-height: 1; cursor: pointer;
  z-index: 1;
}
/* [2026-11-19 用户要求] 翻页按钮从"贴窗口边缘"挪到"贴弹窗两侧"。
 * 原来 `left/right: 24px` 是相对**遮罩**（= 整屏）定位的，宽屏下按钮被甩到屏幕最边上，
 * 离弹窗很远、鼠标要跑很远。现在按弹窗宽度（max-width 640px）反算：
 *   左边距 = 50% − 320（半个弹窗）− 60（间距）= calc(50% - 380px)
 * 再用 `max(12px, …)` 夹一道：窄屏/小窗口下 50%−380 会变负数，不加夹会被挤出屏幕。
 * 改间距只动这里的 380px（= 320 + 60），一处生效。 */
.fun-nav-prev { left: max(12px, calc(50% - 380px)); }
.fun-nav-next { right: max(12px, calc(50% - 380px)); }
.fun-nav:hover { background: var(--sys-btn-hover); border-color: var(--sys-accent); }
.fun-nav:disabled { opacity: .35; cursor: default; }
.fun-nav:disabled:hover { background: var(--sys-panel); border-color: var(--sys-border); }
@media (max-width: 820px) {
  /* 窄屏遮罩空白不足：贴边小按钮 + 半透明（RR9：375px 下不出屏、不遮挡正文） */
  .fun-nav { width: 34px; height: 34px; font-size: 15px; opacity: .8; }
  .fun-nav-prev { left: 6px; }
  .fun-nav-next { right: 6px; }
}
.fun-modal {
  width: 100%; max-width: 640px; max-height: 82vh;
  display: flex; flex-direction: column;
  background: var(--sys-solid);
  border: 1px solid var(--sys-border); border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, .18);
}
.fun-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 0;
}
.fun-modal-close {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--sys-btn-border);
  background: var(--sys-btn-bg); color: var(--sys-btn-text);
  font-size: 16px; line-height: 1; cursor: pointer;
}
.fun-modal-close:hover { background: var(--sys-btn-hover); }
.fun-modal-body {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 12px 18px 6px;
}
.fun-modal-title {
  font-size: 17px; font-weight: 700; line-height: 1.5; color: var(--sys-text);
  margin-bottom: 8px;
}
.fun-modal-meta { font-size: 12px; color: var(--sys-text); opacity: .8; margin-bottom: 12px; }

/* 正文全文块（content 优先、空则回退 summary）：段落由 JS 按空行拆分、textContent 赋值 */
.fun-modal-text {
  padding-top: 12px; border-top: 1px solid var(--sys-border);
  font-size: 14px; color: var(--sys-text);
}
.fun-modal-p {
  margin: 0 0 .8em;
  line-height: 1.8;
  word-break: break-word;
  white-space: pre-wrap; /* 段内单个换行保留（段落切分只认空行） */
}
.fun-modal-p:last-child { margin-bottom: 0; }

.fun-modal-summary {
  font-size: 14px; line-height: 1.9; color: var(--sys-text);
  padding-top: 12px; border-top: 1px solid var(--sys-border);
  white-space: pre-wrap; word-break: break-word;
}
.fun-modal-src {
  font-size: 12px; color: var(--sys-text); opacity: .8;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--sys-border);
}
.fun-modal-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 10px 18px 16px; border-top: 1px solid var(--sys-border);
}
.fun-modal-actions .btn { text-decoration: none; }

/* 复制链接两级降级都失败后才出现：把分享链接摊成可选文本 */
.fun-share-url {
  margin: 0 18px 14px;
  padding: 8px 10px;
  border: 1px dashed var(--sys-border);
  border-radius: 8px;
  background: var(--sys-surface-2, var(--sys-surface));
  color: var(--sys-text);
  font-size: 12px;
  line-height: 1.5;
  word-break: break-all;
  user-select: all;
}

@media (max-width: 820px) {
  .fun-modal { max-height: 86vh; border-radius: 14px; }
  .fun-modal-head { padding: 12px 14px 0; }
  .fun-modal-body { padding: 10px 14px 4px; }
  .fun-modal-actions { padding: 10px 14px 14px; }
}
