/* ==========================================================================
   点读小短文 · 站点样式
   配色取自 LOGO：墨蓝 / 亮黄 / 粉 / 青 / 纸白
   ========================================================================== */

:root {
  --ink: #0F2233;
  --ink-2: #1B3A52;
  --ink-3: #41627C;
  --muted: #6C8296;
  --paper: #FFFDF6;
  --white: #FFFFFF;
  --sun: #FFE94A;
  --sun-deep: #F5D93B;
  --pink: #F7B4CE;
  --teal: #8FD3CD;
  --line: rgba(15, 34, 51, .12);
  --line-strong: rgba(15, 34, 51, .22);
  --shadow: 0 10px 24px -14px rgba(15, 34, 51, .35);
  --shadow-flat: 0 6px 0 -2px rgba(15, 34, 51, .09);
  --radius: 20px;
  --radius-lg: 28px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 15px;
  line-height: 1.55;
}

body.auth-page {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background:
    radial-gradient(1100px 520px at 12% -10%, rgba(255, 233, 74, .55), transparent 60%),
    radial-gradient(900px 500px at 98% 8%, rgba(143, 211, 205, .45), transparent 62%),
    radial-gradient(700px 480px at 70% 110%, rgba(247, 180, 206, .38), transparent 60%),
    var(--paper);
}

a { color: var(--ink-2); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ------------------------------------------------------------------ 布局块 */

.wrap { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.wrap.narrow { width: min(760px, calc(100% - 40px)); }

/* --------------------------------------------------------------------- 导航 */

.nav {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 12px max(20px, calc((100% - 1180px) / 2));
  background: rgba(255, 253, 246, .88);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1.5px solid var(--line);
}
.nav-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; color: var(--ink); }
.nav-brand:hover { text-decoration: none; }
.nav-brand img { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; border: 1.5px solid var(--line); }
.nav-right { display: flex; align-items: center; gap: 10px; }
.nav-user { font-size: 13px; color: var(--ink-3); background: rgba(143, 211, 205, .22); padding: 5px 12px; border-radius: 999px; }

/* --------------------------------------------------------------------- 按钮 */

.btn {
  --btn-bg: var(--white); --btn-fg: var(--ink); --btn-bd: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 14px;
  border: 1.5px solid var(--btn-bd); background: var(--btn-bg); color: var(--btn-fg);
  font: inherit; font-weight: 700; font-size: 14px; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, background .15s ease;
  box-shadow: var(--shadow-flat);
  white-space: nowrap; text-decoration: none;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn-primary { --btn-bg: var(--ink); --btn-fg: #fff; --btn-bd: var(--ink); }
.btn-primary:hover { --btn-bg: var(--ink-2); }
.btn-accent { --btn-bg: var(--sun); --btn-fg: var(--ink); --btn-bd: var(--ink); }
.btn-ghost { --btn-bg: transparent; --btn-fg: var(--ink-2); --btn-bd: var(--line); box-shadow: none; }
.btn-ghost:hover { --btn-bg: rgba(15, 34, 51, .05); }
.btn-danger { --btn-bg: #fff; --btn-fg: #B32C3E; --btn-bd: rgba(179, 44, 62, .4); box-shadow: none; }
.btn-danger:hover { --btn-bg: #B32C3E; --btn-fg: #fff; }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 11px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

/* --------------------------------------------------------------------- 表单 */

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 7px; letter-spacing: .01em; }
.field .input { position: relative; display: flex; align-items: center; }
.input input,
.field input[type="text"],
.field input[type="password"] {
  width: 100%;
  padding: 13px 15px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input input:focus,
.field input:focus {
  border-color: var(--ink-2);
  box-shadow: 0 0 0 4px rgba(143, 211, 205, .35);
}
.field input::placeholder { color: #9DAEBB; }
.field .tip { font-size: 12px; color: var(--muted); margin-top: 6px; }
.field .tip.err { color: #B32C3E; }

.captcha-row { display: flex; gap: 10px; align-items: stretch; }
.captcha-row input { flex: 1; min-width: 0; }
.captcha-img {
  flex: 0 0 auto; width: 168px; height: 56px;
  border: 1.5px solid var(--line-strong); border-radius: 12px;
  background: #fff; cursor: pointer; overflow: hidden; padding: 0;
  box-shadow: var(--shadow-flat);
}
.captcha-img img { width: 100%; height: 100%; object-fit: cover; }
.captcha-img:active { transform: translateY(1px); }

/* --------------------------------------------------------------------- 提示 */

.flash {
  padding: 12px 16px; border-radius: 14px; margin: 0 0 16px;
  font-size: 14px; font-weight: 600;
  border: 1.5px solid transparent;
}
.flash.ok { background: rgba(143, 211, 205, .28); border-color: rgba(30, 122, 111, .35); color: #14564F; }
.flash.err { background: rgba(247, 180, 206, .32); border-color: rgba(179, 44, 62, .35); color: #8E2333; }
.flash.warn { background: rgba(255, 233, 74, .38); border-color: rgba(180, 150, 20, .35); color: #6B5510; }

/* ==========================================================================
   登录 / 注册
   ========================================================================== */

.auth-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  align-items: stretch;
}
body.auth-page .auth-shell {
  min-height: 0;
  flex: 1 1 auto;
}

.auth-aside {
  position: relative;
  overflow: hidden;
  padding: 54px 52px;
  background: var(--ink);
  color: #fff;
  display: flex; flex-direction: column; justify-content: space-between;
}
.auth-aside::before {
  content: "";
  position: absolute; inset: -40% -20% auto auto;
  width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255, 233, 74, .55), transparent 62%);
  filter: blur(6px);
}
.auth-aside::after {
  content: "";
  position: absolute; left: -120px; bottom: -160px;
  width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(143, 211, 205, .38), transparent 66%);
}
.auth-aside > * { position: relative; z-index: 1; }

.auth-logo {
  width: 132px; height: 132px; border-radius: 26px;
  object-fit: cover; background: #fff; padding: 8px;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .65);
  border: 2px solid rgba(255, 255, 255, .18);
}
.auth-brandline { display: flex; align-items: center; gap: 18px; }
.auth-brandtext h1 { margin: 0; font-size: 34px; letter-spacing: .04em; line-height: 1.2; }
.auth-brandtext p { margin: 6px 0 0; color: rgba(255, 255, 255, .72); font-size: 14px; letter-spacing: .18em; text-transform: uppercase; }

.auth-punch { margin: 46px 0 0; font-size: 30px; line-height: 1.5; font-weight: 800; letter-spacing: .01em; }
.auth-punch em { font-style: normal; font-weight: 800; }
.auth-points { margin: 26px 0 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.auth-points li { display: flex; gap: 10px; align-items: flex-start; color: rgba(255, 255, 255, .82); font-size: 14.5px; }
.auth-points li::before { content: "★"; color: var(--sun); font-size: 13px; line-height: 1.6; }

.auth-aside-foot { color: rgba(255, 255, 255, .55); font-size: 12.5px; }

.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
body.auth-page .auth-main { flex: 1 1 auto; }
.auth-card {
  width: min(420px, 100%);
  background: rgba(255, 255, 255, .92);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 34px 32px 28px;
  box-shadow: 0 30px 60px -40px rgba(15, 34, 51, .55), var(--shadow-flat);
}
.auth-card h2 { margin: 0 0 6px; font-size: 24px; letter-spacing: .02em; }
.auth-card .sub { margin: 0 0 22px; color: var(--muted); font-size: 13.5px; }
.auth-links { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; font-size: 13.5px; }
.auth-links.center { justify-content: center; }
.auth-links a { font-weight: 600; }
.auth-divider { height: 1px; background: var(--line); margin: 20px 0 16px; }
.auth-side-note { text-align: center; font-size: 12.5px; color: var(--muted); }

/* ==========================================================================
   首页书架
   ========================================================================== */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin: 30px 0 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 27px; letter-spacing: .01em; }
.page-head .sub { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; }

.toolbar { display: flex; gap: 10px; align-items: center; }

.seg {
  display: inline-flex; padding: 4px; gap: 2px;
  background: rgba(15, 34, 51, .06);
  border: 1.5px solid var(--line);
  border-radius: 14px;
}
.seg button {
  border: 0; background: transparent; color: var(--ink-3);
  font: inherit; font-weight: 700; font-size: 13px;
  padding: 8px 14px; border-radius: 10px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(15, 34, 51, .12); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 22px;
  padding-bottom: 40px;
}

.card {
  display: flex; flex-direction: column;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-flat);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--line-strong); text-decoration: none; }
.card-cover { position: relative; aspect-ratio: 3 / 4; background: #F1F4F6; overflow: hidden; }
.card-cover img { width: 100%; height: 100%; object-fit: cover; object-position: top center; transition: transform .4s ease; }
.card:hover .card-cover img { transform: scale(1.03); }
.card-badge {
  position: absolute; left: 10px; top: 10px;
  background: rgba(255, 253, 246, .92); color: var(--ink);
  font-size: 11.5px; font-weight: 800; padding: 3px 9px; border-radius: 999px;
  border: 1.5px solid var(--line);
}
.card-body { padding: 12px 14px 14px; }
.card-title { font-weight: 800; font-size: 15px; color: var(--ink); line-height: 1.4; }
.card-meta { margin-top: 4px; font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; }

/* 文件名模式 */
.grid.names { grid-template-columns: 1fr; gap: 10px; }
.grid.names .card { flex-direction: row; align-items: center; padding: 12px 16px; border-radius: 16px; }
.grid.names .card-cover { width: 44px; height: 44px; aspect-ratio: auto; border-radius: 12px; flex: 0 0 auto; border: 1px solid var(--line); }
.grid.names .card-cover img { object-fit: cover; }
.grid.names .card-body { padding: 0 0 0 14px; display: flex; flex-direction: column; }
.grid.names .card-badge { display: none; }
.grid.names .card-title { font-size: 14.5px; }

.empty {
  border: 2px dashed var(--line-strong); border-radius: var(--radius);
  padding: 54px 24px; text-align: center; color: var(--muted);
  background: rgba(255, 255, 255, .55);
}
.empty strong { display: block; color: var(--ink-2); font-size: 16px; margin-bottom: 6px; }

/* ==========================================================================
   后台
   ========================================================================== */

.admin-shell { display: grid; grid-template-columns: 216px 1fr; min-height: 100dvh; }
.admin-side { background: var(--ink); color: #fff; padding: 22px 16px; display: flex; flex-direction: column; gap: 6px; }
.admin-side .brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; font-weight: 800; }
.admin-side .brand img { width: 34px; height: 34px; border-radius: 9px; background: #fff; padding: 2px; }
.admin-side a {
  display: block; padding: 10px 12px; border-radius: 11px;
  color: rgba(255, 255, 255, .76); font-size: 14px; font-weight: 600;
}
.admin-side a:hover { background: rgba(255, 255, 255, .08); color: #fff; text-decoration: none; }
.admin-side a.on { background: var(--sun); color: var(--ink); }
.admin-side .spacer { flex: 1; }
.admin-side .who { font-size: 12px; color: rgba(255, 255, 255, .5); padding: 8px 12px; }

.admin-main { padding: 26px 30px 60px; background: var(--paper); min-width: 0; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.admin-head h1 { margin: 0; font-size: 23px; }
.admin-head .sub { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.panel {
  background: #fff; border: 1.5px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 20px;
  box-shadow: var(--shadow-flat);
}
.panel h2 { margin: 0 0 14px; font-size: 16px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: #fff; border: 1.5px solid var(--line); border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow-flat); }
.stat .n { font-size: 27px; font-weight: 800; letter-spacing: -.02em; }
.stat .k { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.table-wrap { overflow-x: auto; border: 1.5px solid var(--line); border-radius: 16px; background: #fff; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th, table.t td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t th { background: rgba(15, 34, 51, .04); font-size: 12px; letter-spacing: .04em; color: var(--ink-3); font-weight: 800; }
table.t tr:last-child td { border-bottom: 0; }
table.t td.wrap-cell { white-space: normal; min-width: 160px; }
table.t a { font-weight: 700; }

.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 800; }
.tag.on { background: rgba(143, 211, 205, .3); color: #14564F; }
.tag.off { background: rgba(15, 34, 51, .08); color: var(--muted); }
.tag.admin { background: rgba(255, 233, 74, .5); color: #6B5510; }

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.inline { display: inline; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 20px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; flex-wrap: wrap; }

.cover-thumb { width: 46px; height: 61px; border-radius: 8px; object-fit: cover; object-position: top; border: 1px solid var(--line); background: #F1F4F6; }

.upload-box { border: 2px dashed var(--line-strong); border-radius: 16px; padding: 18px; background: rgba(143, 211, 205, .07); }
.upload-box input[type="file"] { font: inherit; font-size: 13.5px; }

.note-list { margin: 0; padding-left: 20px; color: var(--ink-3); font-size: 13.5px; line-height: 1.9; }
.note-list code { background: rgba(15, 34, 51, .06); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; }

/* ==========================================================================
   点读页容器
   ========================================================================== */

.reader-frame { display: block; width: 100%; height: 100dvh; border: 0; }

.back-fab {
  position: fixed; left: 14px; top: 14px; z-index: 9999;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 15px; border-radius: 999px;
  background: rgba(15, 34, 51, .88); color: #fff;
  font: inherit; font-size: 13px; font-weight: 700;
  border: 1.5px solid rgba(255, 255, 255, .18);
  box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .6);
  backdrop-filter: blur(6px);
  text-decoration: none;
}
.back-fab:hover { background: var(--ink); text-decoration: none; }

/* --------------------------------------------------------------------- 页脚 */

.foot {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding: 26px 20px 34px; color: var(--muted); font-size: 12.5px;
  border-top: 1px solid var(--line); margin-top: 20px;
  flex-wrap: wrap;
}

/* 底部备案号：登录/注册/403/后台通用 */
.site-foot {
  flex: none;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  padding: 14px 20px 18px;
  letter-spacing: .01em;
}
.site-foot.rule { border-top: 1px solid var(--line); }
.admin-main .site-foot { margin-top: 26px; }
.site-foot a { color: inherit; text-decoration: none; }
.site-foot a:hover { text-decoration: underline; }

/* ------------------------------------------------------------------- 响应式 */

@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { padding: 30px 26px; flex-direction: column; gap: 24px; justify-content: flex-start; }
  .auth-logo { width: 84px; height: 84px; border-radius: 18px; }
  .auth-brandtext h1 { font-size: 25px; }
  .auth-punch { font-size: 21px; margin-top: 8px; }
  .auth-points { display: none; }
  .auth-aside-foot { display: none; }
  .auth-main { padding: 22px 16px 40px; }
  .auth-card { padding: 26px 22px 22px; }

  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { flex-direction: row; overflow-x: auto; padding: 12px; gap: 4px; align-items: center; }
  .admin-side .brand { padding: 0 10px; }
  .admin-side .brand span { display: none; }
  .admin-side a { white-space: nowrap; padding: 8px 12px; font-size: 13px; }
  .admin-side .spacer, .admin-side .who { display: none; }
  .admin-main { padding: 20px 16px 50px; }
}

@media (max-width: 640px) {
  .wrap { width: calc(100% - 28px); }
  .nav { padding: 10px 14px; }
  .nav-brand span { font-size: 15px; }
  .nav-user { display: none; }

  .page-head { margin: 20px 0 16px; }
  .page-head h1 { font-size: 22px; }
  .toolbar { width: 100%; justify-content: space-between; }

  .grid { grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 14px; }
  .card-body { padding: 10px 11px 12px; }
  .card-title { font-size: 13.5px; }
  .capcha-img, .captcha-img { width: 132px; height: 50px; }
  .captcha-row { gap: 8px; }
}

/* --------------------------------------------------------------------- 分页 */

.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 4px 0 44px;
}
.pager .btn { box-shadow: none; }
.pager .is-disabled { opacity: .38; cursor: default; pointer-events: none; }
.pager .is-current {
  --btn-bg: var(--ink); --btn-fg: #fff; --btn-bd: var(--ink);
  cursor: default;
}
.pager .pager-gap { color: var(--muted); padding: 0 2px; }
