/* =========================================================
   此山 flbook · 现代深色 UI 设计系统
   ========================================================= */
:root {
  --bg: #08090f;
  --bg-2: #0e1020;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-2: rgba(255, 255, 255, 0.07);
  --solid: #14172a;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --txt: #eef1f8;
  --txt-dim: #9aa3c4;
  --txt-mute: #6b739a;
  --brand: #6366f1;
  --brand-2: #a855f7;
  --accent: #22d3ee;
  --danger: #fb7185;
  --ok: #34d399;
  --grad: linear-gradient(135deg, #6366f1 0%, #a855f7 55%, #22d3ee 110%);
  --grad-soft: linear-gradient(135deg, rgba(99,102,241,.18), rgba(34,211,238,.14));
  --radius: 18px;
  --radius-lg: 26px;
  --radius-sm: 12px;
  --shadow: 0 20px 50px rgba(0, 0, 0, .45);
  --shadow-glow: 0 10px 40px rgba(99, 102, 241, .35);
  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html, body { min-height: 100vh; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial,
    "Noto Sans CJK SC", system-ui, sans-serif;
  color: var(--txt);
  line-height: 1.65;
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
/* 极光背景 */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(60vw 60vw at 12% -8%, rgba(99, 102, 241, .22), transparent 60%),
    radial-gradient(50vw 50vw at 95% 0%, rgba(168, 85, 247, .18), transparent 55%),
    radial-gradient(55vw 55vw at 70% 100%, rgba(34, 211, 238, .12), transparent 60%),
    var(--bg);
}
body::after {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 80%);
}
a { color: var(--brand); text-decoration: none; }
img { max-width: 100%; display: block; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 22px; }

/* ---------- 通用按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); color: var(--txt); cursor: pointer;
  font-size: 14px; font-weight: 500; transition: .22s var(--ease);
  user-select: none; white-space: nowrap; backdrop-filter: blur(8px);
}
.btn:hover { border-color: var(--line-strong); transform: translateY(-2px); background: var(--panel-2); }
.btn:active { transform: translateY(0); }
.btn.primary {
  background: var(--grad); border: none; color: #fff; font-weight: 600;
  box-shadow: var(--shadow-glow);
}
.btn.primary:hover { filter: brightness(1.08); box-shadow: 0 14px 50px rgba(99, 102, 241, .5); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--panel); }
.btn.danger { color: var(--danger); border-color: rgba(251, 113, 133, .35); }
.btn.danger:hover { background: rgba(251, 113, 133, .12); }
.btn.sm { padding: 7px 13px; font-size: 13px; border-radius: 999px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(22px) saturate(140%);
  background: rgba(8, 9, 15, .55);
  border-bottom: 1px solid var(--line);
}
.topbar .inner {
  display: flex; align-items: center; justify-content: space-between; height: 64px;
}
.logo { display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 19px; letter-spacing: .3px; }
.logo .dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--grad); box-shadow: 0 0 18px rgba(99, 102, 241, .8);
}
.logo .word { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav-links { display: flex; gap: 10px; align-items: center; }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 76px 0 36px; text-align: center; }
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--txt-dim);
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); margin-bottom: 22px;
}
.hero .eyebrow b { color: var(--accent); font-weight: 600; }
.hero h1 { font-size: clamp(34px, 5vw, 54px); margin: 0 0 16px; letter-spacing: -1.2px; line-height: 1.12; font-weight: 800; }
.hero h1 span {
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--txt-dim); font-size: 17px; margin: 0 auto 30px; max-width: 620px; }

/* 搜索条 */
.searchbar {
  display: flex; align-items: center; gap: 8px; max-width: 560px; margin: 0 auto;
  padding: 7px 7px 7px 18px; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line-strong);
  backdrop-filter: blur(14px); box-shadow: var(--shadow);
  transition: .25s var(--ease);
}
.searchbar:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(99, 102, 241, .18), var(--shadow); }
.searchbar .ico { color: var(--txt-mute); flex-shrink: 0; }
.searchbar input {
  flex: 1; border: none; background: transparent; color: var(--txt);
  font-size: 15px; padding: 9px 4px; outline: none; font-family: inherit;
}
.searchbar input::placeholder { color: var(--txt-mute); }
.searchbar button { flex-shrink: 0; }

/* ---------- 区块标题 ---------- */
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 36px 0 20px; }
.section-title h2 { font-size: 22px; margin: 0; font-weight: 700; letter-spacing: -.3px; }
.section-title .meta { color: var(--txt-dim); font-size: 13px; }
.search-hint { color: var(--txt-dim); font-size: 14px; margin: -6px 0 18px; }
.search-hint a { color: var(--brand); }

/* ---------- 文档卡片墙 ---------- */
.grid {
  display: grid; gap: 24px;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  padding-bottom: 70px;
}
.card {
  background: var(--solid); border: 1px solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden; transition: .3s var(--ease);
  display: flex; flex-direction: column; position: relative;
}
.card::after {
  content: ""; position: absolute; inset: 0; border-radius: var(--radius-lg);
  background: linear-gradient(180deg, transparent 55%, rgba(99, 102, 241, .12));
  opacity: 0; transition: .3s var(--ease); pointer-events: none;
}
.card:hover { transform: translateY(-8px); border-color: var(--line-strong); box-shadow: var(--shadow); }
.card:hover::after { opacity: 1; }
.card .cover {
  aspect-ratio: 3 / 4; background: #0b0d18 center / cover no-repeat;
  position: relative; overflow: hidden;
}
.card .cover img { transition: transform .5s var(--ease); width: 100%; height: 100%; object-fit: cover; }
.card:hover .cover img { transform: scale(1.06); }
.card .cover .pages-badge {
  position: absolute; right: 10px; bottom: 10px; z-index: 2;
  background: rgba(8, 9, 15, .72); color: #fff; font-size: 12px; font-weight: 500;
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); backdrop-filter: blur(6px);
}
.card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 7px; }
.card .body h3 { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.4; }
.card .body .meta { font-size: 12.5px; color: var(--txt-dim); display: flex; gap: 10px; align-items: center; }
.card .body .meta .views { display: inline-flex; align-items: center; gap: 4px; }
.card .body .acts { display: flex; gap: 8px; margin-top: 8px; }
.card .body .acts .btn { flex: 1; }

.empty { text-align: center; color: var(--txt-dim); padding: 80px 0; }
.empty .big { font-size: 19px; color: var(--txt); margin-bottom: 8px; font-weight: 600; }
.empty a { color: var(--brand); font-weight: 600; }

/* ---------- 表单 ---------- */
.form-wrap { max-width: 600px; margin: 60px auto; }
.form-wrap h2 { text-align: center; font-size: 26px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; color: var(--txt-dim); margin-bottom: 8px; font-weight: 500; }
.input, textarea.input, select.input {
  width: 100%; padding: 13px 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--panel); color: var(--txt);
  font-size: 14.5px; font-family: inherit; transition: .2s var(--ease);
}
.input:focus, textarea.input:focus, select.input:focus {
  outline: none; border-color: var(--brand); background: var(--panel-2);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, .15);
}
.error-msg { color: var(--danger); text-align: center; margin: 10px 0; }

/* ---------- 上传拖拽 ---------- */
.drop {
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius-lg);
  padding: 48px 24px; text-align: center; transition: .25s var(--ease); cursor: pointer;
  background: var(--panel); position: relative; overflow: hidden;
}
.drop::before {
  content: ""; position: absolute; inset: 0; background: var(--grad-soft); opacity: 0; transition: .25s;
}
.drop.hover { border-color: var(--brand); transform: scale(1.01); }
.drop.hover::before { opacity: 1; }
.drop .big { font-size: 18px; font-weight: 700; position: relative; }
.drop .hint { color: var(--txt-dim); font-size: 13px; margin-top: 8px; position: relative; }
.upload-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin-top: 20px; }
.upload-row .field { flex: 1; min-width: 170px; margin-bottom: 0; }
.progress { height: 9px; background: var(--panel); border-radius: 999px; overflow: hidden; margin-top: 18px; display: none; border: 1px solid var(--line); }
.progress > i { display: block; height: 100%; width: 0; background: var(--grad); transition: width .25s var(--ease); }

/* ---------- 管理列表 ---------- */
.admin-table { width: 100%; border-collapse: separate; border-spacing: 0 10px; margin-top: 8px; }
.admin-table th { color: var(--txt-dim); font-weight: 600; font-size: 13px; text-align: left; padding: 0 14px 6px; }
.admin-table td { padding: 12px 14px; background: var(--solid); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.admin-table td:first-child { border-left: 1px solid var(--line); border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.admin-table td:last-child { border-right: 1px solid var(--line); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.admin-table tr { transition: .2s; }
.admin-table tbody tr:hover td { background: var(--panel-2); }
.admin-table img { width: 52px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; box-shadow: 0 4px 12px rgba(0, 0, 0, .4); }
.tag { font-size: 12px; padding: 3px 11px; border-radius: 999px; font-weight: 500; }
.tag.pub { background: rgba(52, 211, 153, .14); color: var(--ok); }
.tag.draft { background: rgba(251, 113, 133, .14); color: var(--danger); }
.acts-cell { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- 查看器 ---------- */
.viewer-app { height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.viewer-top {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px;
  border-bottom: 1px solid var(--line); background: rgba(8, 9, 15, .7);
  backdrop-filter: blur(18px); flex-wrap: wrap; position: relative; z-index: 5;
}
.viewer-top .title { font-weight: 700; font-size: 16px; margin-right: auto; display: flex; align-items: baseline; gap: 10px; }
.viewer-top .title small { color: var(--txt-dim); font-weight: 400; font-size: 13px; }
.mode-switch {
  display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--line);
  padding: 5px; border-radius: 999px; backdrop-filter: blur(10px);
}
.mode-switch .btn { border: none; background: transparent; padding: 8px 15px; border-radius: 999px; color: var(--txt-dim); }
.mode-switch .btn:hover { color: var(--txt); background: var(--panel-2); transform: none; }
.mode-switch .btn.active { background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(99, 102, 241, .4); }

.stage { flex: 1; overflow: hidden; position: relative; display: flex; align-items: center; justify-content: center; background:
  radial-gradient(80vw 80vh at 50% 0%, #11142a, var(--bg)); }
.mode-pane { display: none; width: 100%; height: 100%; }
.mode-pane.active { display: flex; }

/* flip */
.flip-stage { align-items: center; justify-content: center; overflow: auto; padding: 22px; }
.flip-book { margin: 0 auto; filter: drop-shadow(0 30px 60px rgba(0, 0, 0, .55)); border-radius: 3px; }
.flip-book .page { background: #fff; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,.04); }
.flip-book .page img { width: 100%; height: 100%; object-fit: contain; display: block; }
.flip-pager {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  background: rgba(8, 9, 15, .7); border: 1px solid var(--line); color: var(--txt);
  padding: 6px 16px; border-radius: 999px; font-size: 13px; backdrop-filter: blur(8px); z-index: 4;
}

/* slide */
.slide-stage { position: relative; align-items: center; justify-content: center; background: #05060c; }
.slide-stage img { max-width: 95%; max-height: 90%; box-shadow: var(--shadow); border-radius: 6px; }
.slide-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255, 255, 255, .08); border: 1px solid var(--line); color: #fff; font-size: 26px;
  width: 52px; height: 72px; cursor: pointer; border-radius: 14px; backdrop-filter: blur(8px); transition: .2s;
}
.slide-nav.prev { left: 20px; } .slide-nav.next { right: 20px; }
.slide-nav:hover { background: var(--brand); border-color: var(--brand); }
.slide-bar {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; color: #fff;
  background: rgba(8, 9, 15, .6); border: 1px solid var(--line); padding: 9px 18px; border-radius: 999px; font-size: 14px; backdrop-filter: blur(10px);
}
.slide-bar .play { cursor: pointer; }

/* pdf 原文模式 */
.pdf-toolbar {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line); background: rgba(8, 9, 15, .6); backdrop-filter: blur(10px); width: 100%;
}
.pdf-toolbar .btn { padding: 6px 12px; }
.pdf-toolbar input[type=range] { accent-color: var(--brand); }
.pdf-toolbar .input { width: auto; padding: 7px 12px; height: auto; }
.pdf-search-wrap { display: flex; align-items: center; gap: 6px; }
#pdfSearchResult { color: var(--txt-dim); font-size: 12px; min-width: 60px; }
.pdf-stage { flex: 1; overflow: auto; padding: 22px; display: flex; flex-direction: column; align-items: center; gap: 18px; background: #0a0c16; }
.pdf-stage canvas { border-radius: 6px; box-shadow: var(--shadow); }

/* grid */
.grid-stage { align-items: flex-start; justify-content: flex-start; overflow: auto; padding: 24px; flex-wrap: wrap; gap: 16px; background: #0a0c16; }
.grid-stage .thumb {
  width: 158px; cursor: pointer; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--line); background: var(--solid); transition: .25s var(--ease);
}
.grid-stage .thumb:hover { border-color: var(--brand); transform: translateY(-4px); box-shadow: var(--shadow); }
.grid-stage .thumb img { display: block; width: 100%; aspect-ratio: 3/4; object-fit: cover; }
.grid-stage .thumb span { display: block; text-align: center; font-size: 12px; padding: 6px; color: var(--txt-dim); }

/* scroll */
.scroll-stage { flex-direction: column; align-items: center; gap: 16px; overflow: auto; padding: 22px; background: #0a0c16; }
.scroll-stage img { max-width: 880px; width: 100%; border-radius: 8px; box-shadow: var(--shadow); }

/* ---------- 分享/编辑弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(4, 5, 10, .65); backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-mask.show { display: flex; animation: fade .2s var(--ease); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--solid); border: 1px solid var(--line-strong); border-radius: var(--radius-lg);
  padding: 26px; width: 440px; max-width: 100%; box-shadow: var(--shadow);
  animation: pop .26s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
.modal h3 { margin: 0 0 16px; font-size: 19px; }
.modal .qr { text-align: center; margin: 10px 0 16px; }
.modal .qr img { width: 184px; height: 184px; background: #fff; border-radius: 12px; padding: 8px; }
.modal .copymsg { font-size: 12.5px; color: var(--ok); height: 16px; }
.modal textarea { width: 100%; height: 70px; font-size: 12px; resize: vertical; }

/* ---------- 密码锁页 ---------- */
.lock-wrap { max-width: 400px; margin: 14vh auto; text-align: center; }
.lock-wrap .cover { width: 150px; aspect-ratio: 3 / 4; margin: 0 auto 22px; border-radius: 14px; background-size: cover; background-position: center; box-shadow: var(--shadow); }
.lock-wrap h2 { font-size: 22px; margin: 0 0 6px; }
.lock-wrap p { color: var(--txt-dim); margin: 0 0 22px; }
.lock-wrap .field { text-align: left; margin-bottom: 16px; }

/* ---------- 页脚 / Toast ---------- */
.footer { text-align: center; color: var(--txt-mute); font-size: 13px; padding: 36px 0; border-top: 1px solid var(--line); }
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(10px);
  background: var(--solid); color: var(--txt); padding: 12px 20px; border-radius: 999px;
  border: 1px solid var(--line-strong); box-shadow: var(--shadow); opacity: 0; transition: .28s var(--ease); z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 嵌入模式 ---------- */
body.embed .viewer-top .title, body.embed .viewer-top .back, body.embed .footer { display: none; }

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .hero { padding: 48px 0 28px; }
  .searchbar { padding-left: 14px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
  .viewer-top { gap: 8px; padding: 10px 12px; }
  .mode-switch { order: 3; width: 100%; justify-content: space-between; }
  .mode-switch .btn { flex: 1; padding: 8px 6px; }
  .admin-table { font-size: 13px; }
  .admin-table td, .admin-table th { padding: 8px 8px; }
  .acts-cell .btn { padding: 5px 9px; font-size: 12px; }
}
