/* 靓靓小说网 · 照海灯 —— 站点样式
   视觉方向：旧港口纸本档案。米纸底、墨蓝字、赭石与海绿两个点色，
   硬边框 + 实心偏移投影（像印在纸上的盖章块），不用柔和阴影。 */

:root {
  --font-body: Georgia, "Songti SC", STSong, serif;

  --ink: #16222e;
  --ink-soft: #3a4a58;
  --muted: #6d6354;
  --paper: #f6f1e4;
  --paper-2: #efe7d5;
  --paper-3: #e6dcc4;
  --rule: #c8b996;
  --ochre: #a9601f;
  --ochre-weak: #f0dcc0;
  --teal: #22584f;
  --teal-weak: #d7e4df;
  --rust: #8a3324;

  --fs-base: 1rem;
  --fs-reader: 1.0625rem;
  --lh-reader: 1.95;
  --measure: 35em;
  --pad: 1.15rem;
  --radius: 2px;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  background: var(--paper-2);
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.75;
  color: var(--ink);
  background: var(--paper);
  background-image:
    repeating-linear-gradient(180deg, rgba(22, 34, 46, 0.028) 0 1px, transparent 1px 42px);
}

/* ---------- 可访问性 ---------- */
.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 0.5rem 0.9rem;
  z-index: 50;
}
.skip:focus { left: 0.5rem; top: 0.5rem; }

img, svg { max-width: 100%; }
img { height: auto; }

a { color: var(--teal); text-underline-offset: 0.22em; }
a:hover { color: var(--ochre); }
:focus-visible { outline: 2px solid var(--ochre); outline-offset: 2px; }

/* ---------- 版心 ---------- */
.wrap {
  width: 100%;
  max-width: 62rem;
  margin: 0 auto;
  padding: 0 var(--pad);
}

/* ---------- 页眉 ---------- */
.top {
  border-bottom: 1px solid var(--rule);
  background: var(--paper-2);
}
.top-in {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  align-items: center;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}
.brand svg { flex: none; }
.brand b { font-weight: 700; }
.brand span {
  display: block;
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  min-width: 0;
}
.nav a {
  display: block;
  padding: 0.28rem 0.6rem;
  color: var(--ink-soft);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 0.95rem;
}
.nav a:hover { background: var(--ochre-weak); color: var(--ink); }
.nav a[aria-current="page"] {
  border-color: var(--ochre);
  color: var(--ink);
  background: #fff;
}

/* 窄屏下顶栏搜索框会占掉整一行首屏，而导航里的「书中查」已经是
   同一个入口，所以手机宽度只留导航链接。 */
.topsearch {
  display: none;
  gap: 0.35rem;
  margin-left: auto;
  min-width: 0;
}
@media (min-width: 36rem) { .topsearch { display: flex; } }
.topsearch input {
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 0.3rem 0.5rem;
  width: 8.5rem;
  max-width: 42vw;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  min-width: 0;
}
.topsearch button {
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  flex: none;
}
.topsearch button:hover { background: var(--teal); border-color: var(--teal); }

/* ---------- 面包屑 ---------- */
.crumb {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0.6rem 0 0;
}
.crumb ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.4rem;
  margin: 0;
  padding: 0;
}
.crumb li::after { content: "›"; margin-left: 0.4rem; color: var(--rule); }
.crumb li:last-child::after { content: ""; }

/* ---------- 标题区 ---------- */
main { display: block; padding-bottom: 2.5rem; }

h1 {
  font-size: clamp(1.45rem, 1.15rem + 1.5vw, 2.1rem);
  line-height: 1.4;
  margin: 0.8rem 0 0.5rem;
  letter-spacing: 0.01em;
}
h2 {
  font-size: clamp(1.15rem, 1.02rem + 0.6vw, 1.4rem);
  line-height: 1.5;
  margin: 2.2rem 0 0.7rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--rule);
}
h3 {
  font-size: 1.04rem;
  margin: 1.5rem 0 0.4rem;
  color: var(--teal);
}
.lede {
  font-size: 1.06rem;
  color: var(--ink-soft);
  max-width: var(--measure);
  margin: 0 0 1.2rem;
}
.kicker {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ochre);
  margin: 0;
}

p, ul, ol, dl { max-width: var(--measure); }
.prose p { margin: 0 0 1.05em; }
.full { max-width: none; }

/* ---------- 纸块 ---------- */
.card {
  background: #fff;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--paper-3);
  padding: 1rem 1.05rem;
  min-width: 0;
}
.card h3 { margin-top: 0; }
.card p:last-child, .card ul:last-child { margin-bottom: 0; }

/* auto-fit 的轨道下限必须是可用长度：minmax(0, 1fr) 会让 Chrome 铺出一排
   0 宽轨道，于是四张卡在 390px 下被挤成四列，卡里的图直接溢出文档。
   min(100%, …) 保证窄屏退回单列，列数固定的栅格仍按规则用 minmax(0, 1fr)。 */
.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  margin: 1.2rem 0;
}
.grid > * { min-width: 0; }
@media (min-width: 46rem) {
  .grid.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.note {
  border-left: 4px solid var(--ochre);
  background: var(--ochre-weak);
  padding: 0.75rem 0.9rem;
  margin: 1.3rem 0;
  font-size: 0.95rem;
  max-width: var(--measure);
}
.note strong { color: var(--rust); }
.note.teal { border-left-color: var(--teal); background: var(--teal-weak); }
.note p:last-child { margin-bottom: 0; }
.note p { max-width: none; }

/* ---------- 首页 ---------- */
.hero {
  display: grid;
  gap: 1.4rem;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  padding: 1.3rem 0 0.4rem;
}
.hero > * { min-width: 0; }
@media (min-width: 52rem) {
  .hero { grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 2rem; }
}
.hero figure { margin: 0; }
.hero svg, figure svg { display: block; width: 100%; height: auto; }
figcaption {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.45rem;
  line-height: 1.6;
}

.btnrow { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1.1rem 0 0; }
.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font-size: 0.97rem;
}
.btn:hover { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.ghost { background: #fff; color: var(--ink); }
.btn.ghost:hover { background: var(--ochre-weak); color: var(--ink); }

/* ---------- 目录表 ---------- */
.toc { list-style: none; margin: 1.2rem 0; padding: 0; max-width: none; }
.toc li {
  border-bottom: 1px dotted var(--rule);
  padding: 0.65rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.7rem;
  align-items: baseline;
}
.toc .no {
  flex: none;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--ochre);
  width: 4.2rem;
}
.toc .ti { flex: 1 1 12rem; min-width: 0; font-size: 1.02rem; }
.toc .meta { flex: none; font-size: 0.8rem; color: var(--muted); }
.toc .ab {
  flex: none;
  font-size: 0.7rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.05rem 0.35rem;
  color: var(--ink-soft);
  background: var(--paper-2);
}

/* ---------- 表格 ---------- */
.tablewrap {
  overflow-x: auto;
  margin: 1.2rem 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: #fff;
}
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td {
  text-align: left;
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--paper-3);
  vertical-align: top;
}
th { background: var(--paper-2); font-size: 0.82rem; letter-spacing: 0.06em; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }

/* ---------- 阅读器 ---------- */
.readerbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.8rem;
  align-items: center;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-2);
  padding: 0.6rem 0.75rem;
  margin: 1.1rem 0;
  font-size: 0.88rem;
}
.readerbar .grp { display: flex; align-items: center; gap: 0.3rem; min-width: 0; }
.readerbar .lab { color: var(--muted); font-size: 0.8rem; }
.sbtn {
  font-family: var(--font-body);
  font-size: 0.85rem;
  padding: 0.22rem 0.55rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
.sbtn:hover { background: var(--ochre-weak); }
.sbtn[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.sbtn.mark { border-color: var(--teal); color: var(--teal); }
.sbtn.mark:hover { background: var(--teal-weak); }

.chapter {
  font-size: var(--fs-reader);
  line-height: var(--lh-reader);
  max-width: var(--measure);
}
.chapter p { max-width: none; margin: 0 0 1.15em; text-indent: 2em; }
.chapter p.noind { text-indent: 0; }
.chapter hr {
  border: 0;
  border-top: 1px solid var(--rule);
  width: 5rem;
  margin: 2rem auto;
}
.chapter .sep {
  text-align: center;
  color: var(--ochre);
  letter-spacing: 0.6em;
  text-indent: 0;
  margin: 1.8rem 0;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: space-between;
  border-top: 1px solid var(--rule);
  margin-top: 2rem;
  padding-top: 1rem;
}
.pager a, .pager span {
  font-size: 0.93rem;
  max-width: 100%;
  min-width: 0;
}
.pager span { color: var(--muted); }

/* ---------- 人物卡 ---------- */
.pcard {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 5px 5px 0 var(--paper-3);
  background: #fff;
  padding: 1rem;
  margin: 1.3rem 0;
}
.pcard > * { min-width: 0; }
@media (min-width: 40rem) {
  .pcard { grid-template-columns: 7.5rem minmax(0, 1fr); align-items: start; }
}
.pcard .emblem {
  width: 7.5rem;
  max-width: 7.5rem;
  height: auto;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.pcard dl { margin: 0; max-width: none; }
.pcard dt {
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  color: var(--ochre);
  margin-top: 0.7rem;
}
.pcard dt:first-child { margin-top: 0; }
.pcard dd { margin: 0.12rem 0 0; }

/* ---------- 搜索页 ---------- */
.sform { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.2rem 0 0.6rem; }
.sform input[type="search"] {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.5rem 0.65rem;
  flex: 1 1 16rem;
  min-width: 0;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}
.sform button {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
}
.schip {
  display: inline-block;
  font-size: 0.85rem;
  padding: 0.18rem 0.55rem;
  margin: 0 0.35rem 0.35rem 0;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink-soft);
  text-decoration: none;
  cursor: pointer;
  font-family: var(--font-body);
}
.schip:hover { background: var(--ochre-weak); color: var(--ink); }
.scount { font-size: 0.88rem; color: var(--muted); margin: 0.8rem 0; }
.shits { list-style: none; margin: 0; padding: 0; max-width: none; }
.shits li {
  border-top: 1px solid var(--paper-3);
  padding: 0.75rem 0;
}
.shits .sk { font-size: 0.72rem; letter-spacing: 0.16em; color: var(--ochre); }
.shits .st { font-size: 1.03rem; margin: 0.1rem 0; }
.shits .sd { font-size: 0.9rem; color: var(--ink-soft); margin: 0; max-width: var(--measure); }
.shits li[hidden] { display: none; }
mark { background: #f6e07a; color: var(--ink); padding: 0 0.1em; }

/* ---------- 工具表单 ---------- */
.tool {
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 5px 5px 0 var(--paper-3);
  padding: 1rem;
  margin: 1.3rem 0;
}
.fields {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
}
.fields > * { min-width: 0; }
@media (min-width: 40rem) { .fields.f2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.field { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.field label { font-size: 0.82rem; letter-spacing: 0.04em; color: var(--ink-soft); }
.field input, .field textarea, .field select {
  font-family: var(--font-body);
  font-size: 0.97rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  width: 100%;
  min-width: 0;
}
.field textarea { resize: vertical; min-height: 4.5rem; line-height: 1.7; }
.hint { font-size: 0.78rem; color: var(--muted); }

.out {
  margin: 1rem 0 0;
  border-top: 1px dashed var(--rule);
  padding-top: 0.9rem;
}
.tool > pre,
.out pre {
  margin: 0;
  padding: 0.8rem;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
}
.bignum {
  font-size: 1.6rem;
  color: var(--teal);
  display: block;
  line-height: 1.3;
}
.kv { display: grid; gap: 0.35rem 1rem; grid-template-columns: minmax(0, 1fr); margin: 0.8rem 0 0; }
@media (min-width: 34rem) { .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kv div { border-bottom: 1px dotted var(--rule); padding-bottom: 0.3rem; min-width: 0; }
.kv b { font-weight: 400; color: var(--muted); font-size: 0.82rem; display: block; }

/* 失败 / 成功提示 */
.alert {
  margin: 0.9rem 0 0;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--rust);
  border-left-width: 5px;
  border-radius: var(--radius);
  background: #fbeae6;
  color: #6d2619;
  font-size: 0.9rem;
}
.alert[hidden] { display: none; }
.okmsg {
  margin: 0.9rem 0 0;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--teal);
  border-left-width: 5px;
  border-radius: var(--radius);
  background: var(--teal-weak);
  color: #16423b;
  font-size: 0.9rem;
}
.okmsg[hidden] { display: none; }

/* ---------- 页脚 ---------- */
.foot {
  border-top: 2px solid var(--ink);
  background: var(--paper-2);
  padding: 1.6rem 0 2.2rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.foot .cols {
  display: grid;
  gap: 1.2rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
}
.foot .cols > * { min-width: 0; }
@media (min-width: 44rem) { .foot .cols { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.foot h2 {
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ochre);
  border: 0;
  margin: 0 0 0.5rem;
  padding: 0;
}
.foot ul { list-style: none; margin: 0; padding: 0; }
.foot li { padding: 0.12rem 0; }
.foot p { margin: 0 0 0.6rem; max-width: var(--measure); }
.foot .fine {
  margin-top: 1.4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-size: 0.82rem;
  color: var(--muted);
  max-width: none;
}

/* ---------- 404 ---------- */
.lost { padding: 1.5rem 0 1rem; }
.lost figure { margin: 1.2rem 0; max-width: 25rem; }
