/* ============ 漫次元 MANGAVERSE 设计系统 ============ */
:root {
  /* 背景 · 近黑深底带紫调 */
  --bg: #0b0a10;
  --bg-2: #12101a;
  --bg-3: #1a1726;
  --card: #16131f;
  --card-hi: #1f1a2c;

  /* 主色 · 琥珀橙 (禁漫气质 拒绝紫渐变) */
  --primary: #ff7a00;
  --primary-2: #ffb35c;
  --primary-grad: linear-gradient(135deg, #ffb35c 0%, #ff7a00 100%);
  --primary-soft: rgba(255, 122, 0, .14);
  --primary-line: rgba(255, 150, 40, .35);

  /* 文字 */
  --text: #f2ecdf;
  --text-dim: #a89fb4;
  --text-faint: #6d6578;

  /* 阴影/动效 */
  --shadow-card: 0 8px 26px rgba(0,0,0,.45);
  --shadow-float: 0 18px 44px rgba(0,0,0,.6), 0 0 0 1px var(--primary-line);
  --ease: cubic-bezier(.22,.8,.3,1);
  --radius: 14px;
  --radius-s: 9px;

  /* 排版阶梯 (clamp 响应式) */
  --fs-hero: clamp(2rem, 6vw, 4rem);
  --fs-display: clamp(1.7rem, 4.6vw, 3rem);
  --fs-heading: clamp(1.25rem, 3vw, 1.8rem);
  --fs-body: clamp(.95rem, 1.3vw, 1.05rem);
  --fs-small: clamp(.8rem, 1.1vw, .88rem);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scrollbar-color: #3a3249 var(--bg); }
body {
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(255,122,0,.07), transparent 60%),
    radial-gradient(900px 420px at -10% 0%, rgba(255,179,92,.05), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "PingFang SC", "Microsoft JhengHei", "Microsoft YaHei", sans-serif;
  font-size: var(--fs-body);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(11,10,16,.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.topbar-inner {
  max-width: 1440px; margin: 0 auto;
  display: flex; align-items: center; gap: clamp(.6rem, 2vw, 1.4rem);
  padding-inline: clamp(.75rem, 3vw, 1.6rem);
  padding-block: .55rem; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .55rem; flex-shrink: 0; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--primary-grad);
  display: grid; place-items: center;
  font-family: "Noto Serif SC", serif; font-weight: 900; font-size: 1.05rem;
  color: #1c0d00; box-shadow: 0 4px 14px rgba(255,122,0,.35);
}
.brand-name { font-family: "Noto Serif SC", serif; font-weight: 900; letter-spacing: .06em; font-size: 1.05rem; display: flex; flex-direction: column; line-height: 1.05; }
.brand-name em { font-style: normal; font-family: "Bangers", cursive; font-weight: 400; font-size: .66rem; letter-spacing: .24em; color: var(--primary-2); }

.cats { display: flex; gap: .2rem; overflow-x: auto; flex: 1 1 auto; min-width: 0; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cats a {
  white-space: nowrap; padding: .42rem .8rem; border-radius: 999px;
  font-size: var(--fs-small); color: var(--text-dim);
  transition: all .22s var(--ease); border: 1px solid transparent;
}
.cats a:hover { color: var(--text); background: var(--bg-2); }
.cats a.active { color: #1c0d00; background: var(--primary-grad); font-weight: 700; }

.search { position: relative; display: flex; align-items: center; flex-shrink: 0; }
.search .si { position: absolute; left: .8rem; color: var(--text-faint); pointer-events: none; }
.search input {
  width: clamp(150px, 24vw, 280px);
  background: var(--bg-2); border: 1px solid rgba(255,255,255,.08);
  border-radius: 999px; padding: .5rem 1rem .5rem 2.3rem;
  color: var(--text); font-size: var(--fs-small); outline: none;
  transition: border .2s var(--ease), box-shadow .2s var(--ease);
}
.search input:focus { border-color: var(--primary-line); box-shadow: 0 0 0 3px var(--primary-soft); }

/* ---------- 主视图 ---------- */
.view { max-width: 1440px; margin: 0 auto; padding-inline: clamp(.75rem, 3vw, 1.6rem); padding-block: clamp(1.1rem, 3vw, 2rem) 2.5rem; }

/* 区块标题 */
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: clamp(.8rem, 2vw, 1.3rem); }
.sec-title { font-family: "Noto Serif SC", serif; font-weight: 900; font-size: var(--fs-heading); letter-spacing: .02em; display: flex; align-items: center; gap: .55rem; }
.sec-title::before { content: ""; width: 5px; height: 1.15em; border-radius: 3px; background: var(--primary-grad); }
.sec-sub { color: var(--text-faint); font-size: var(--fs-small); }

.sortrow { display: flex; gap: .4rem; flex-wrap: wrap; }
.sortrow a { font-size: var(--fs-small); color: var(--text-dim); padding: .3rem .7rem; border-radius: 999px; border: 1px solid rgba(255,255,255,.08); transition: all .2s var(--ease); }
.sortrow a:hover { color: var(--text); border-color: var(--primary-line); }
.sortrow a.active { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary-2); }

/* ---------- 海报墙 ---------- */
.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: clamp(.55rem, 1.6vw, 1.1rem); }
@media (min-width: 520px) { .wall { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); } }
@media (min-width: 1100px) { .wall { grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); } }

.card {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: var(--card); aspect-ratio: 3 / 4;
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
  transition: transform .28s var(--ease), box-shadow .28s var(--ease);
  opacity: 0; transform: translateY(14px);
  animation: rise .5s var(--ease) forwards;
}
.card:nth-child(2n) { animation-delay: .04s; }
.card:nth-child(3n) { animation-delay: .08s; }
@keyframes rise { to { opacity: 1; transform: translateY(0); } }

.card img { width: 100%; height: 100%; object-fit: cover; transition: transform .45s var(--ease); }
.card:hover img { transform: scale(1.06); }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-float); z-index: 2; }

.card-veil {
  position: absolute; inset: auto 0 0 0; padding: .55rem .6rem;
  background: linear-gradient(transparent, rgba(0,0,0,.88));
  display: flex; flex-direction: column; gap: .2rem;
}
.card-title {
  font-size: clamp(.76rem, 1.5vw, .92rem); font-weight: 700; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  text-shadow: 0 1px 6px rgba(0,0,0,.8);
}
.card-tag { font-size: .68rem; color: var(--primary-2); opacity: .92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.skeleton { position: relative; overflow: hidden; background: var(--bg-2); }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.05) 50%, transparent 80%); animation: shimmer 1.6s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; justify-content: center; gap: .8rem; margin-top: clamp(1.6rem, 4vw, 2.6rem); flex-wrap: wrap; }
.pager button, .pager .pg-info {
  padding: .55rem 1.1rem; border-radius: 999px; font-size: var(--fs-small);
  border: 1px solid rgba(255,255,255,.1); background: var(--bg-2); color: var(--text);
  transition: all .2s var(--ease);
}
.pager button:not(:disabled):hover { border-color: var(--primary-line); background: var(--primary-soft); }
.pager button:disabled { opacity: .35; cursor: not-allowed; }
.pager .pg-info { border-color: transparent; color: var(--text-dim); background: none; }

.empty { text-align: center; padding: 4rem 1rem; color: var(--text-faint); }
.empty .big { font-size: 2.6rem; margin-bottom: .6rem; }

/* ---------- 详情页 ---------- */
.detail-wrap { display: grid; gap: clamp(1.2rem, 3vw, 2.4rem); }
@media (min-width: 860px) { .detail-wrap { grid-template-columns: minmax(240px, 300px) 1fr; } }

.detail-cover {
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-card);
  aspect-ratio: 3/4; align-self: start; position: sticky; top: 84px;
}
.detail-cover img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 859px) { .detail-cover { position: static; max-width: 260px; } }

.detail-info h1 { font-family: "Noto Serif SC", serif; font-weight: 900; font-size: var(--fs-display); line-height: 1.2; margin-bottom: .7rem; }
.detail-meta { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1.1rem; }
.chip { font-size: var(--fs-small); padding: .26rem .7rem; border-radius: 999px; background: var(--bg-3); color: var(--text-dim); border: 1px solid rgba(255,255,255,.06); }
.chip.heat { color: var(--primary-2); border-color: var(--primary-line); background: var(--primary-soft); }

.detail-actions { display: flex; gap: .7rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.btn-read {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--primary-grad); color: #1c0d00; font-weight: 800;
  padding: .72rem 1.5rem; border-radius: 999px; font-size: var(--fs-body);
  box-shadow: 0 6px 20px rgba(255,122,0,.3); transition: all .22s var(--ease);
}
.btn-read:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(255,122,0,.4); }
.btn-ghost {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .72rem 1.4rem; border-radius: 999px; font-size: var(--fs-body);
  border: 1px solid rgba(255,255,255,.14); color: var(--text-dim); transition: all .22s var(--ease);
}
.btn-ghost:hover { border-color: var(--primary-line); color: var(--text); }

.detail-intro { color: var(--text-dim); font-size: var(--fs-body); margin-bottom: 1.8rem; white-space: pre-line; }

.sec-block { margin-top: clamp(1.4rem, 3vw, 2.2rem); }
.ep-list { display: grid; gap: .6rem; }
.ep-item {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .8rem 1.1rem; border-radius: var(--radius-s);
  background: var(--card); border: 1px solid rgba(255,255,255,.06);
  transition: all .2s var(--ease);
}
.ep-item:hover { border-color: var(--primary-line); background: var(--card-hi); transform: translateX(4px); }
.ep-name { font-weight: 600; font-size: var(--fs-body); }
.ep-date { color: var(--text-faint); font-size: var(--fs-small); flex-shrink: 0; }

.related-wall { margin-top: 1rem; }

/* ---------- 阅读器 ---------- */
.reader-mask {
  position: fixed; inset: 0; z-index: 100; background: #060508;
  display: flex; flex-direction: column;
}
.reader-mask[hidden] { display: none !important; }
.toast[hidden] { display: none !important; }
.reader-loading[hidden] { display: none !important; }
.reader-head {
  display: flex; align-items: center; gap: .9rem;
  padding: .6rem clamp(.75rem, 3vw, 1.6rem);
  background: rgba(10,9,14,.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,.07); z-index: 5;
}
.r-close {
  width: 38px; height: 38px; flex-shrink: 0; border-radius: 50%;
  background: var(--bg-3); color: var(--text); font-size: 1rem;
  display: grid; place-items: center; transition: all .2s var(--ease);
  border: 1px solid rgba(255,255,255,.08);
}
.r-close:hover { background: rgba(255,60,60,.2); border-color: rgba(255,80,80,.4); color: #ff8080; }
.r-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: var(--fs-body); }
.r-page { color: var(--text-dim); font-size: var(--fs-small); flex-shrink: 0; }
.r-mode { display: flex; gap: .3rem; flex-shrink: 0; }
.r-mode button {
  padding: .34rem .7rem; border-radius: 999px; font-size: var(--fs-small);
  border: 1px solid rgba(255,255,255,.1); color: var(--text-dim); transition: all .2s var(--ease);
}
.r-mode button.active { background: var(--primary-soft); color: var(--primary-2); border-color: var(--primary-line); }

.reader-scroll {
  flex: 1; overflow-y: auto; padding: clamp(.4rem, 1.4vw, 1rem) 0 clamp(3rem, 6vw, 5rem);
  display: flex; flex-direction: column; align-items: center; gap: .4rem;
  scroll-behavior: smooth;
}
.reader-scroll img {
  width: min(100%, 860px); max-width: 100%; height: auto;
  background: #050408; border-radius: 2px;
}
.reader-pager {
  display: flex; align-items: center; justify-content: center; gap: 1.2rem;
  padding: 1rem; background: rgba(10,9,14,.9);
}
.reader-pager button {
  padding: .55rem 1.5rem; border-radius: 999px; font-weight: 700;
  background: var(--primary-grad); color: #1c0d00; transition: all .2s var(--ease);
}
.reader-pager button:disabled { opacity: .3; cursor: not-allowed; }
.reader-pager .rp-pos { color: var(--text-dim); font-size: var(--fs-small); }

.reader-loading {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1rem; color: var(--text-dim);
  background: #060508;
}
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--bg-3); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 2rem; transform: translateX(-50%);
  background: var(--bg-3); color: var(--text); padding: .7rem 1.3rem; border-radius: 999px;
  border: 1px solid var(--primary-line); box-shadow: var(--shadow-card);
  font-size: var(--fs-small); z-index: 200;
  animation: rise .3s var(--ease);
}

/* ---------- footer ---------- */
.footer {
  text-align: center; padding: 1.4rem 1rem clamp(2rem, 5vw, 3rem);
  color: var(--text-faint); font-size: var(--fs-small);
  border-top: 1px solid rgba(255,255,255,.05);
}
.footer .dim { margin-top: .2rem; opacity: .7; font-size: .72rem; }

/* ---------- 移动细节 ---------- */
@media (max-width: 700px) {
  .topbar-inner { gap: .5rem; }
  .cats { order: 3; width: 100%; margin: .1rem -.2rem 0; padding-bottom: .1rem; }
  .cats a { padding: .34rem .65rem; }
  .search input { width: min(56vw, 220px); }
}

/* hidden 属性必须真的隐藏：阅读器遮罩是 fixed 全屏层，会盖住整站 */
[hidden] { display: none !important; }
