:root {
  --bg: #0e1013;
  --bg2: #16191f;
  --card: #1b1f27;
  --line: #262b35;
  --text: #e9ecf2;
  --dim: #8a93a6;
  --accent: #6a8dff;
  --accent2: #3d5fd9;
  --green: #3ecf8e;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
code { background: #242a35; padding: 1px 6px; border-radius: 4px; font-size: 13px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(14, 16, 19, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-in {
  max-width: 1060px; margin: 0 auto;
  padding: 10px 16px;
  display: flex; align-items: center; gap: 12px;
}
.brand { font-weight: 700; font-size: 17px; margin-right: auto; }
.topbar-title {
  font-weight: 600; font-size: 15px; margin-right: auto;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.upd-line {
  max-width: 1060px; margin: 0 auto; padding: 0 16px 8px;
  color: var(--dim); font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg2); color: var(--text);
  font-size: 13px; cursor: pointer; user-select: none; white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent2); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.big { padding: 12px 26px; font-size: 15px; border-radius: 10px; }
.btn[disabled] { opacity: .55; cursor: default; }

/* ---------- 页面 ---------- */
.page { max-width: 1060px; margin: 0 auto; padding: 20px 16px 60px; }
.empty { text-align: center; color: var(--dim); padding: 80px 20px; }
.dim { color: var(--dim); }
.green { color: var(--green); font-weight: 600; }

/* ---------- 书架 ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.card {
  position: relative; display: flex; flex-direction: column;
  border-radius: 12px; overflow: hidden;
  background: var(--card); border: 1px solid var(--line);
  transition: transform .15s, border-color .15s;
}
.card:hover { transform: translateY(-2px); border-color: #39414f; }
.cover { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: #12151a; display: block; }
.cover-ph { display: flex; align-items: center; justify-content: center; font-size: 40px; }
.badge {
  position: absolute; top: 8px; right: 8px;
  background: var(--green); color: #08130d;
  font-size: 12px; font-weight: 700;
  padding: 2px 8px; border-radius: 20px;
}
.card-body { padding: 10px 12px 12px; }
.card-title {
  font-weight: 600; font-size: 14px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { color: var(--dim); font-size: 12px; margin-top: 4px; }
.cont-btn {
  display: inline-block; margin-top: 8px;
  font-size: 12px; font-weight: 600; color: var(--accent);
  padding: 4px 10px; border: 1px solid var(--accent);
  border-radius: 20px; cursor: pointer;
}
.cont-btn:hover { background: rgba(106, 141, 255, .12); }

/* ---------- 章节列表 ---------- */
.stat { color: var(--dim); font-size: 13px; margin-bottom: 12px; }
.chlist { display: flex; flex-direction: column; gap: 8px; }
.chrow {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
}
a.chrow:hover { border-color: #39414f; }
.chrow.read { opacity: .55; }
.chrow.nodl { opacity: .4; }
.ch-num { font-weight: 700; white-space: nowrap; }
.ch-title {
  flex: 1; min-width: 0; font-size: 14px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ch-info { color: var(--dim); font-size: 12px; white-space: nowrap; }
.ch-read { color: var(--green); font-weight: 700; }
.cur-mark { color: var(--accent); font-size: 12px; }

/* ---------- 阅读器 ---------- */
#reader { padding-bottom: 40px; }
.rtop {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top));
  background: linear-gradient(rgba(10, 12, 15, .96), rgba(10, 12, 15, .85));
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(38, 43, 53, .6);
  transition: transform .25s;
}
.rtop.hide { transform: translateY(-110%); }
.rtop-mid { flex: 1; min-width: 0; }
.rtop-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rtop-sub { font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rtop-btns { display: flex; gap: 8px; }
.rmain { max-width: 860px; margin: 0 auto; padding-top: 58px; }
.rmain img { display: block; width: 100%; background: #151920; min-height: 40px; }
.rend {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 28px 16px 60px;
}
.rhint { text-align: center; color: var(--dim); font-size: 12px; padding-bottom: 24px; }

/* ---------- 提示 ---------- */
#toast {
  position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 20px);
  background: #222834; border: 1px solid var(--line); color: var(--text);
  padding: 10px 18px; border-radius: 10px;
  opacity: 0; pointer-events: none; transition: .25s;
  z-index: 99; max-width: 86vw; font-size: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .5);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 600px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card-title { font-size: 13px; }
  .rtop .btn { padding: 6px 10px; font-size: 12px; }
  .rend { flex-direction: column-reverse; }
  .rend .btn { width: 100%; }
  .ch-info { display: none; }
}
