/* FMHY 免费资源大全 — 全屏工作台样式 */
:root {
  --fm-bg: #0f1419;
  --fm-card: #161b22;
  --fm-card-2: #1c2230;
  --fm-card-3: #11161d;
  --fm-border: #2a3340;
  --fm-line-2: #354154;
  --fm-text: #e6edf3;
  --fm-sub: #9ba7b4;
  --fm-faint: #7d8b99;
  --fm-accent: #58a6ff;
  --fm-accent-fill: #1f6feb;
  --fm-on-accent: #ffffff;
  --fm-accent-soft: rgba(88,166,255,.13);
  --fm-hover: #212a37;
  --fm-gold: #e3b341;
  --fm-ok: #3fb950;
  --fm-shadow: 0 8px 28px rgba(0,0,0,.3);
  --fm-shadow-sm: 0 2px 8px rgba(0,0,0,.22);
  --fm-radius: 14px;
  --fm-side-w: 264px;
}
[data-theme="light"] {
  --fm-bg: #f6f8fa;
  --fm-card: #ffffff;
  --fm-card-2: #f0f3f6;
  --fm-card-3: #f6f8fa;
  --fm-border: #d8dee4;
  --fm-line-2: #c2cbd4;
  --fm-text: #1f2328;
  --fm-sub: #4e5863;
  --fm-faint: #65707b;
  --fm-accent: #0969da;
  --fm-accent-fill: #0969da;
  --fm-on-accent: #ffffff;
  --fm-accent-soft: rgba(9,105,218,.09);
  --fm-hover: #eaeef2;
  --fm-gold: #9a6700;
  --fm-ok: #1a7f37;
  --fm-shadow: 0 8px 28px rgba(31,35,40,.10);
  --fm-shadow-sm: 0 2px 8px rgba(31,35,40,.06);
}
body.page-fmhy-full { overflow: visible; }
body.fm-drawer-open { overflow: hidden !important; }
body.page-fmhy-full .app { max-width: 100%; }
body.page-fmhy-full .main-content { max-width: 100%; width: 100%; border-right: 0; min-width: 0; }

/* ---------- 管理员面板 ---------- */
.fm-admin-gear { width: 34px; height: 34px; border: 1px solid var(--fm-border); background: var(--fm-card-2); color: var(--fm-text); border-radius: 9px; cursor: pointer; font-size: 17px; display: inline-grid; place-items: center; }
.fm-admin-gear:hover { border-color: var(--fm-accent); color: var(--fm-accent); }
.fm-admask { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 100100; }
.fm-admin { position: fixed; top: 0; right: 0; bottom: 0; width: min(680px, 100vw); background: var(--fm-bg); z-index: 100101; box-shadow: -8px 0 30px rgba(0,0,0,.35); display: flex; flex-direction: column; }
.fm-ad-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 12px; border-bottom: 1px solid var(--fm-border); }
.fm-ad-title { margin: 0; font-size: 16px; }
.fm-ad-x { border: 0; background: transparent; color: var(--fm-sub); font-size: 18px; cursor: pointer; }
.fm-ad-tabs { display: flex; gap: 8px; padding: 10px 16px 0; }
.fm-ad-tab { border: 1px solid var(--fm-border); background: var(--fm-card); color: var(--fm-sub); border-radius: 8px; padding: 6px 14px; cursor: pointer; font-size: 12.5px; }
.fm-ad-tab.is-on { border-color: var(--fm-accent); color: var(--fm-accent); background: var(--fm-accent-soft); }
.fm-ad-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 12px 16px; scrollbar-width: thin; }
.fm-ad-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.fm-ad-new { border: 1px solid var(--fm-accent); background: var(--fm-accent); color: #fff; border-radius: 8px; padding: 7px 12px; cursor: pointer; font-size: 12.5px; }
.fm-ad-bar input { flex: 1 1 180px; height: 34px; padding: 0 10px; border: 1px solid var(--fm-border); background: var(--fm-card); color: var(--fm-text); border-radius: 8px; font-size: 13px; }
.fm-ad-reset { border: 1px solid var(--fm-gold); color: var(--fm-gold); background: transparent; border-radius: 8px; padding: 7px 10px; cursor: pointer; font-size: 12.5px; }
.fm-ad-hint { font-size: 11px; color: var(--fm-faint); }
.fm-ad-list { display: flex; flex-direction: column; gap: 5px; }
.fm-ad-row { display: flex; align-items: center; gap: 8px; border: 1px solid var(--fm-border); background: var(--fm-card); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.fm-ad-ic { font-size: 16px; }
.fm-ad-name { font-size: 13px; font-weight: 600; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-ad-sub { font-size: 11px; color: var(--fm-faint); flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-ad-btn { border: 1px solid var(--fm-border); background: var(--fm-card-2); color: var(--fm-text); border-radius: 6px; padding: 4px 9px; cursor: pointer; font-size: 11.5px; flex: 0 0 auto; }
.fm-ad-btn:hover { border-color: var(--fm-accent); }
.fm-ad-btn.danger { color: #e5534b; }
.fm-ad-btn.pri { background: var(--fm-accent); color: #fff; border-color: var(--fm-accent); }
.fm-ad-empty { text-align: center; padding: 30px; color: var(--fm-faint); font-size: 12px; }
.fm-ad-form { border-top: 1px solid var(--fm-border); padding: 12px 16px 16px; background: var(--fm-card); max-height: 54%; overflow-y: auto; }
.fm-ad-form-title { margin: 0 0 10px; font-size: 14px; }
.fm-ad-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; font-size: 12px; color: var(--fm-sub); }
.fm-ad-field input, .fm-ad-field textarea { width: 100%; border: 1px solid var(--fm-border); background: var(--fm-bg); color: var(--fm-text); border-radius: 7px; padding: 7px 9px; font-size: 13px; font-family: inherit; resize: vertical; }
.fm-ad-check { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--fm-sub); margin-bottom: 8px; }
.fm-ad-form-acts { display: flex; justify-content: flex-end; gap: 8px; }

.fm, .fm [hidden] { }
.fm [hidden], .fm-dmask[hidden], .fm-drawer[hidden], .fm-toast[hidden], .fm-export-menu[hidden], .fm-side-close[hidden],
.fm-admask[hidden], .fm-admin[hidden], .fm-ad-form[hidden], #fmAdCatPane[hidden], #fmAdItemPane[hidden], #fmAdF5Wrap[hidden], #fmAdF6Wrap[hidden], #fmAdF7Wrap[hidden], .fm-admin-gear[hidden] { display: none !important; }
.fm {
  max-width: 100%; margin: 0; padding: 18px 26px 60px;
  box-sizing: border-box; color: var(--fm-text);
  font-variant-numeric: tabular-nums;
  -webkit-text-size-adjust: 100%;
}
.fm * { box-sizing: border-box; }
.fm a { color: var(--fm-accent); text-decoration: none; }
.fm a:hover { text-decoration: underline; }
button, input, select { font-family: inherit; }

/* ---------- Hero ---------- */
.fm-hero { position: relative; background: linear-gradient(135deg, var(--fm-accent-soft), transparent 72%), var(--fm-card); border: 1px solid var(--fm-border); border-radius: var(--fm-radius); padding: 16px 20px; margin-bottom: 16px; box-shadow: var(--fm-shadow); text-wrap: pretty; }
.fm-hero-top { display: flex; align-items: center; gap: 14px; }
.fm-hero-ic { width: 48px; height: 48px; flex: 0 0 48px; display: grid; place-items: center; border-radius: 13px; color: #fff; background: linear-gradient(135deg, #2f81f7, #8957e5); box-shadow: var(--fm-shadow-sm); }
.fm-hero-t { min-width: 0; flex: 1 1 auto; }
.fm-title { font-size: 22px; font-weight: 700; margin: 0 0 4px; letter-spacing: .3px; text-wrap: balance; }
.fm-sub { margin: 0; color: var(--fm-sub); font-size: 13px; line-height: 1.55; }
.fm-hero-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.fm-lang, .fm-fold { height: 34px; border: 1px solid var(--fm-line-2); background: var(--fm-card-2); color: var(--fm-text); border-radius: 9px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 4px; transition: border-color .15s, background .15s, color .15s; }
.fm-lang:hover, .fm-fold:hover { border-color: var(--fm-accent); background: var(--fm-hover); }
.fm-lang:focus-visible, .fm-fold:focus-visible { outline: 2px solid var(--fm-accent); outline-offset: 2px; }
.fm-lang { padding: 0 12px; font-size: 13px; font-weight: 600; }
.fm-lang-zh { color: var(--fm-faint); }
.fm-lang-en { color: var(--fm-faint); }
.fm.is-en .fm-lang-zh { color: var(--fm-faint); }
.fm:not(.is-en) .fm-lang-en { color: var(--fm-faint); }
.fm.is-en .fm-lang-en, .fm:not(.is-en) .fm-lang-zh { color: var(--fm-accent); }
.fm-lang-sep { color: var(--fm-faint); }
.fm-fold { width: 34px; }
.fm-fold svg { transition: transform .2s; }
.fm-hero.is-collapsed .fm-fold svg { transform: rotate(-90deg); }
.fm-hero.is-collapsed .fm-hero-extra { display: none; }
.fm-hero-extra { padding-top: 14px; margin-top: 14px; border-top: 1px dashed var(--fm-border); }
.fm-stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); border: 1px solid var(--fm-border); border-radius: 12px; overflow: hidden; background: var(--fm-card-2); }
.fm-stat { display: flex; flex-direction: column; gap: 3px; padding: 10px 16px; background: var(--fm-card-2); border-right: 1px solid var(--fm-border); }
.fm-stat:last-child { border-right: 0; }
.fm-stat b { font-size: 20px; font-weight: 700; line-height: 1.1; color: var(--fm-accent); }
.fm-stat:nth-child(2) b { color: var(--fm-ok); }
.fm-stat:nth-child(3) b { color: var(--fm-text); }
.fm-stat:nth-child(4) b { color: var(--fm-gold); }
.fm-stat span { font-size: 11.5px; color: var(--fm-sub); letter-spacing: .2px; }
.fm-disclaimer { margin: 11px 0 0; font-size: 11.5px; color: var(--fm-faint); line-height: 1.6; }

/* ---------- Workbench ---------- */
.fm-work { display: grid; grid-template-columns: var(--fm-side-w) minmax(0,1fr); gap: 18px; align-items: start; }
.fm-side { position: sticky; top: 14px; background: var(--fm-card); border: 1px solid var(--fm-border); border-radius: var(--fm-radius); overflow: hidden; max-height: calc(100dvh - 28px); display: flex; flex-direction: column; box-shadow: var(--fm-shadow-sm); }
.fm-side-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 14px 10px; }
.fm-side-title { font-weight: 700; font-size: 14px; }
.fm-side-close { display: none; border: 0; background: transparent; color: var(--fm-sub); font-size: 16px; cursor: pointer; }
.fm-cat-search { padding: 0 12px 10px; }
.fm-cat-search input { width: 100%; height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--fm-line-2); background: var(--fm-bg); color: var(--fm-text); font-size: 12.5px; }
.fm-cat-search input:focus { outline: none; border-color: var(--fm-accent); box-shadow: 0 0 0 3px var(--fm-accent-soft); }
.fm-cats { overflow-y: auto; padding: 0 8px 10px; scrollbar-width: thin; overscroll-behavior: contain; }
.fm-cat { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; border: 0; background: transparent; color: var(--fm-text); padding: 9px 10px; border-radius: 9px; cursor: pointer; font-size: 13px; transition: background .12s, color .12s; }
.fm-cat:hover { background: var(--fm-hover); }
.fm-cat:focus-visible { outline: 2px solid var(--fm-accent); outline-offset: -2px; }
.fm-cat.is-on { background: var(--fm-accent-soft); color: var(--fm-accent); font-weight: 600; }
.fm-cat-ic { font-size: 16px; width: 20px; text-align: center; flex: 0 0 20px; }
.fm-cat-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-cat-n { font-size: 11px; color: var(--fm-faint); background: var(--fm-card-2); padding: 2px 7px; border-radius: 20px; }
.fm-cat.is-on .fm-cat-n { background: var(--fm-accent-fill); color: var(--fm-on-accent); }

.fm-main { min-width: 0; }
.fm-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.fm-menu-btn { display: none; width: 40px; height: 40px; border: 1px solid var(--fm-line-2); background: var(--fm-card); color: var(--fm-text); border-radius: 10px; cursor: pointer; font-size: 17px; }
.fm-search-wrap { position: relative; flex: 1 1 320px; min-width: 200px; }
.fm-search-ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--fm-faint); pointer-events: none; }
.fm-search-wrap input { width: 100%; height: 40px; padding: 0 38px 0 38px; border: 1px solid var(--fm-line-2); background: var(--fm-card); color: var(--fm-text); border-radius: 10px; font-size: 14px; transition: border-color .15s, box-shadow .15s; }
.fm-search-wrap input::placeholder { color: var(--fm-faint); }
.fm-search-wrap input:focus { outline: none; border-color: var(--fm-accent); box-shadow: 0 0 0 3px var(--fm-accent-soft); }
.fm-search-clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border: 0; background: var(--fm-card-2); color: var(--fm-sub); border-radius: 50%; cursor: pointer; font-size: 12px; }
.fm-quick { height: 40px; padding: 0 13px; border: 1px solid var(--fm-line-2); background: var(--fm-card); color: var(--fm-text); border-radius: 10px; cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; transition: border-color .12s, background .12s, color .12s; }
.fm-quick:hover { border-color: var(--fm-accent); background: var(--fm-hover); }
.fm-quick:focus-visible { outline: 2px solid var(--fm-accent); outline-offset: 2px; }
.fm-quick.is-on { border-color: var(--fm-gold); color: var(--fm-gold); background: var(--fm-accent-soft); }
.fm-quick-accent { background: var(--fm-accent-fill); color: var(--fm-on-accent); border-color: var(--fm-accent-fill); font-weight: 600; }
.fm-quick-accent:hover { filter: brightness(1.08); color: var(--fm-on-accent); }
.fm-export-wrap { position: relative; }
.fm-export-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; background: var(--fm-card); border: 1px solid var(--fm-line-2); border-radius: 10px; box-shadow: var(--fm-shadow); padding: 6px; min-width: 120px; }
.fm-export-menu button { display: block; width: 100%; text-align: left; border: 0; background: transparent; color: var(--fm-text); padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.fm-export-menu button:hover { background: var(--fm-hover); }

.fm-filterbar { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 12px; }
.fm-filter-label { flex: 0 0 auto; font-size: 12px; color: var(--fm-sub); padding-top: 7px; font-weight: 600; }
.fm-section-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.fm-chip { border: 1px solid var(--fm-line-2); background: var(--fm-card); color: var(--fm-sub); border-radius: 20px; padding: 5px 12px; font-size: 12px; cursor: pointer; transition: border-color .12s, background .12s, color .12s; }
.fm-chip:hover { border-color: var(--fm-accent); color: var(--fm-text); background: var(--fm-hover); }
.fm-chip:focus-visible { outline: 2px solid var(--fm-accent); outline-offset: 1px; }
.fm-chip.is-on { background: var(--fm-accent-fill); border-color: var(--fm-accent-fill); color: var(--fm-on-accent); }

.fm-result-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.fm-result-count { font-size: 13px; color: var(--fm-sub); }
.fm-result-count b { color: var(--fm-accent); font-size: 15px; }
.fm-result-ctl { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.fm-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--fm-sub); cursor: pointer; }
.fm-check input { accent-color: var(--fm-accent-fill); width: 15px; height: 15px; }
.fm-result-ctl select { height: 34px; padding: 0 9px; border: 1px solid var(--fm-line-2); background: var(--fm-card); color: var(--fm-text); border-radius: 8px; font-size: 12.5px; }
.fm-reset { height: 34px; padding: 0 11px; border: 1px solid var(--fm-line-2); background: transparent; color: var(--fm-sub); border-radius: 8px; cursor: pointer; font-size: 12.5px; transition: border-color .12s, color .12s; }
.fm-reset:hover { border-color: var(--fm-accent); color: var(--fm-accent); }

/* ---------- Resource list ---------- */
.fm-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.fm-item { position: relative; background: var(--fm-card); border: 1px solid var(--fm-border); border-radius: 12px; padding: 13px 14px; min-width: 0; transition: border-color .14s, transform .14s, box-shadow .14s; contain: layout style; }
.fm-item:hover { border-color: var(--fm-accent); box-shadow: var(--fm-shadow); transform: translateY(-2px); }
.fm-item.is-star { padding-left: 17px; }
.fm-item.is-star::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--fm-gold); border-radius: 12px 0 0 12px; }
.fm-item-top { display: flex; align-items: flex-start; gap: 8px; }
.fm-item-star { color: var(--fm-gold); font-size: 13px; flex: 0 0 auto; line-height: 1.35; }
.fm-item-name { flex: 1 1 auto; min-width: 0; font-size: 14px; font-weight: 650; line-height: 1.45; }
.fm-item-name a { color: var(--fm-text); overflow-wrap: anywhere; }
.fm-item-name a:hover { color: var(--fm-accent); text-decoration: none; }
.fm-item-sec { display: inline-block; font-size: 10.5px; color: var(--fm-sub); background: var(--fm-card-2); border-radius: 20px; padding: 2px 8px; margin: 4px 0 6px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-item-desc { font-size: 12px; color: var(--fm-sub); line-height: 1.6; margin: 2px 0 10px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.fm-item-desc .fm-orig { color: var(--fm-faint); }
.fm-item-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.fm-item-tag { font-size: 10px; color: var(--fm-faint); border: 1px solid var(--fm-line-2); border-radius: 20px; padding: 2px 7px; }
.fm-item-acts { margin-left: auto; display: flex; gap: 5px; }
.fm-iact { width: 28px; height: 28px; border: 1px solid var(--fm-line-2); background: transparent; color: var(--fm-sub); border-radius: 8px; cursor: pointer; font-size: 12px; display: inline-grid; place-items: center; transition: border-color .12s, color .12s, background .12s; }
.fm-iact:hover { border-color: var(--fm-accent); color: var(--fm-accent); background: var(--fm-hover); }
.fm-iact:focus-visible { outline: 2px solid var(--fm-accent); outline-offset: 1px; }
.fm-iact.is-fav { color: var(--fm-gold); border-color: var(--fm-gold); }

.fm-empty { text-align: center; padding: 60px 20px; color: var(--fm-sub); }
.fm-empty-ic { font-size: 40px; margin-bottom: 10px; }
.fm-empty p { margin: 0 0 14px; }
.fm-empty button { border: 1px solid var(--fm-accent); color: var(--fm-accent); background: transparent; border-radius: 8px; padding: 7px 16px; cursor: pointer; }
.fm-loadmore { text-align: center; padding: 20px; }
.fm-loadmore button { border: 1px solid var(--fm-border); background: var(--fm-card); color: var(--fm-text); border-radius: 8px; padding: 8px 22px; cursor: pointer; }
.fm-loadmore button:hover { border-color: var(--fm-accent); color: var(--fm-accent); }

/* ---------- Drawer ---------- */
.fm-dmask { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 100000; }
.fm-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); background: var(--fm-bg); z-index: 100001; box-shadow: -8px 0 30px rgba(0,0,0,.3); display: flex; flex-direction: column; }
.fm-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--fm-border); }
.fm-drawer-kicker { font-weight: 700; font-size: 14px; }
.fm-drawer-close { border: 0; background: transparent; color: var(--fm-sub); font-size: 18px; cursor: pointer; }
.fm-drawer-body { padding: 18px 18px calc(24px + env(safe-area-inset-bottom)); overflow-y: auto; scrollbar-width: thin; overscroll-behavior: contain; }
.fm-dd-name { font-size: 19px; font-weight: 700; margin: 0 0 10px; overflow-wrap: anywhere; line-height: 1.4; }
.fm-dd-sec { display: inline-block; font-size: 11px; color: var(--fm-sub); background: var(--fm-card-2); border-radius: 20px; padding: 3px 9px; margin-bottom: 14px; }
.fm-dd-block { margin-bottom: 18px; }
.fm-dd-label { font-size: 11px; color: var(--fm-faint); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 7px; font-weight: 600; }
.fm-dd-desc { font-size: 13px; line-height: 1.75; color: var(--fm-text); overflow-wrap: anywhere; }
.fm-dd-orig { font-size: 12px; line-height: 1.6; color: var(--fm-sub); margin-top: 8px; }
.fm-dd-link { display: flex; align-items: center; gap: 8px; border: 1px solid var(--fm-line-2); background: var(--fm-card); border-radius: 9px; padding: 11px 12px; margin-bottom: 7px; font-size: 13px; transition: border-color .12s, background .12s; }
.fm-dd-link:hover { border-color: var(--fm-accent); background: var(--fm-hover); }
.fm-dd-link a { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-dd-btn { border: 1px solid var(--fm-line-2); background: var(--fm-card-2); color: var(--fm-text); border-radius: 8px; padding: 9px 14px; cursor: pointer; font-size: 13px; margin: 0 8px 8px 0; transition: border-color .12s, background .12s; }
.fm-dd-btn:hover { border-color: var(--fm-accent); background: var(--fm-hover); }
.fm-dd-btn.pri { background: var(--fm-accent-fill); color: var(--fm-on-accent); border-color: var(--fm-accent-fill); font-weight: 600; }
.fm-dd-note { background: var(--fm-accent-soft); border-left: 3px solid var(--fm-accent); border-radius: 8px; padding: 11px 12px; font-size: 12px; line-height: 1.65; color: var(--fm-text); }

.fm-toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); z-index: 100002; background: #24292f; color: #fff; padding: 10px 20px; border-radius: 10px; font-size: 13px; box-shadow: var(--fm-shadow); max-width: min(86vw, 520px); text-align: center; line-height: 1.5; }
[data-theme="light"] .fm-toast { background: #1f2328; }
.fm-loading { text-align: center; padding: 70px 20px; color: var(--fm-sub); font-size: 13px; }
.fm-load-err { text-align: center; padding: 50px 20px; color: var(--fm-sub); }
.fm-load-err button { border: 1px solid var(--fm-accent); color: var(--fm-accent); background: transparent; border-radius: 8px; padding: 7px 16px; cursor: pointer; margin-top: 10px; }

/* ---------- Responsive ---------- */
@media (min-width: 1600px) {
  .fm { padding: 22px 34px 72px; }
  .fm-list { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
  .fm-side { top: 18px; max-height: calc(100dvh - 36px); }
  .fm-stat { padding: 12px 18px; }
  .fm-stat b { font-size: 22px; }
}
@media (max-width: 1180px) {
  .fm { padding: 14px 16px 60px; }
  .fm-list { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}
@media (max-width: 900px) {
  :root { --fm-side-w: 230px; }
  .fm-work { grid-template-columns: 1fr; }
  .fm-side { position: fixed; top: 0; left: 0; bottom: 0; width: min(86vw, 340px); max-height: none; z-index: 99999; border-radius: 0; transform: translateX(-104%); transition: transform .22s; }
  .fm-work.side-open .fm-side { transform: translateX(0); }
  .fm-menu-btn { display: inline-grid; place-items: center; }
  .fm-side-close { display: inline-block; }
  .fm-work.side-open::before { content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.46); z-index: 99998; }
  /* 章节数多：改为单行横向滚动，避免把资源列表挤出首屏 */
  .fm-filterbar { flex-wrap: nowrap; gap: 9px; }
  .fm-section-chips { flex: 1 1 auto; flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; padding-bottom: 2px; }
  .fm-section-chips::-webkit-scrollbar { display: none; }
  .fm-chip { flex: 0 0 auto; scroll-snap-align: start; }
}
@media (max-width: 640px) {
  .fm { padding: 12px 12px 72px; }
  .fm-hero { padding: 12px 14px; }
  .fm-hero-top { gap: 10px; }
  .fm-hero-ic { width: 38px; height: 38px; flex-basis: 38px; border-radius: 11px; }
  .fm-title { font-size: 18px; }
  .fm-sub { font-size: 11.5px; line-height: 1.5; }
  .fm-hero-extra { padding-top: 10px; margin-top: 10px; }
  .fm-stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .fm-stat { padding: 7px 12px; gap: 2px; }
  .fm-stat b { font-size: 17px; }
  .fm-stat span { font-size: 10.5px; }
  .fm-stat:nth-child(2) { border-right: 0; }
  .fm-stat:nth-child(-n+2) { border-bottom: 1px solid var(--fm-border); }
  .fm-disclaimer { margin-top: 9px; font-size: 11px; line-height: 1.5; }
  /* 菜单与搜索同一行，四个快捷操作等宽一行 */
  .fm-toolbar { gap: 7px; }
  .fm-menu-btn { order: -2; width: 42px; height: 42px; flex: 0 0 42px; }
  .fm-search-wrap { order: -1; flex: 1 1 calc(100% - 49px); min-width: 0; }
  .fm-search-wrap input { height: 42px; font-size: 16px; }
  .fm-cat-search input { font-size: 16px; height: 38px; }
  .fm-quick { flex: 1 1 0; justify-content: center; height: 40px; padding: 0 6px; gap: 4px; font-size: 12.5px; }
  .fm-quick span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .fm-export-wrap { flex: 1 1 0; min-width: 0; }
  .fm-export-wrap .fm-quick { width: 100%; }
  .fm-filter-label { padding-top: 10px; }
  .fm-chip { padding: 8px 13px; font-size: 12.5px; }
  .fm-result-head { gap: 8px; }
  .fm-result-count { flex: 1 1 100%; }
  .fm-result-ctl { flex: 1 1 100%; gap: 8px; }
  .fm-result-ctl select { flex: 1 1 auto; height: 38px; font-size: 15px; }
  .fm-reset { height: 38px; }
  .fm-check { min-height: 38px; font-size: 13px; }
  .fm-check input { width: 17px; height: 17px; }
  .fm-list { grid-template-columns: 1fr; gap: 10px; }
  .fm-item { padding: 13px 14px; }
  .fm-item-name { font-size: 15px; }
  .fm-iact { width: 34px; height: 34px; font-size: 14px; }
  .fm-cat { padding: 11px 10px; min-height: 44px; }
  /* 详情在手机端改为底部面板，拇指可达 */
  .fm-drawer { top: auto; left: 0; right: 0; width: 100%; height: min(88dvh, 760px); border-radius: 18px 18px 0 0; box-shadow: 0 -10px 34px rgba(0,0,0,.32); }
  .fm-drawer:not([hidden]) { animation: fm-drawer-up .24s ease-out; }
  .fm-drawer-body { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .fm-drawer-close { min-width: 36px; min-height: 36px; }
  .fm-toast { bottom: calc(18px + env(safe-area-inset-bottom)); }
}
@keyframes fm-drawer-up { from { transform: translateY(16px); opacity: .55; } to { transform: none; opacity: 1; } }
@media (max-width: 400px) {
  .fm-hero-actions { flex-direction: row; gap: 6px; }
  .fm-lang { padding: 0 9px; font-size: 12.5px; }
  .fm-title { font-size: 17px; }
  .fm-stat b { font-size: 16px; }
  .fm-sub { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .fm * { transition: none !important; animation: none !important; }
}
@media (hover: none) {
  .fm-item:hover { transform: none; }
}
@media print {
  .fm-side, .fm-toolbar, .fm-filterbar, .fm-result-head, .fm-hero-actions, .fm-loadmore, .fm-drawer, .fm-dmask, .fm-toast { display: none !important; }
  .fm-work { display: block; }
  .fm-list { grid-template-columns: repeat(2, 1fr); }
}
