/* 八字画本 · 目录页（只作用于本页；外框与色板来自 canggan/style.css） */

/* ---------- 页首小标 ---------- */
.hub-tape-line { margin: 2px 0 4px; }
.hub-tape {
  display: inline-block;
  padding: 3px 18px;
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  color: var(--ink);
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.3) 0 6px, transparent 6px 12px),
    rgba(127, 163, 107, 0.55);
  transform: rotate(-1.5deg);
  box-shadow: 0 1px 0 rgba(45, 42, 38, 0.12);
  clip-path: polygon(1% 0, 100% 5%, 99% 100%, 0 94%);
}

/* ---------- 版面 ---------- */
.hub-spread {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 356px);
  gap: 26px;
  align-items: start;
  margin-top: 10px;
}
.hub-cards, .hub-side { min-width: 0; }

/* ---------- 目录分组 ---------- */
.hub-group + .hub-group { margin-top: 26px; }
.hub-group h2 {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 16px;
  font-size: 1.32rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}
.hub-group h2::after {
  content: "";
  flex: 1 1 auto;
  height: 2px;
  margin-bottom: 4px;
  background: repeating-linear-gradient(90deg, rgba(45, 42, 38, 0.4) 0 8px, transparent 8px 14px);
}
.hub-count {
  font-size: 0.82rem;
  font-weight: 400;
  letter-spacing: 0;
  color: #6b6257;
}

.hub-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 18px;
}

/* ---------- 纸卡 ---------- */
.hub-card {
  --tape: rgba(185, 164, 94, 0.62);
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  grid-template-areas:
    "head fig"
    "stamp stamp";
  align-items: center;
  gap: 6px 8px;
  padding: 18px 14px 12px;
  border: 2px solid var(--ink);
  border-radius: 4px 14px 6px 12px;
  background: var(--card);
  box-shadow: 4px 5px 0 rgba(45, 42, 38, 0.1);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.hub-card:nth-child(2n) { --tape: rgba(127, 163, 107, 0.55); }
.hub-card:nth-child(3n) { --tape: rgba(201, 107, 75, 0.42); }
.hub-card:hover {
  transform: translateY(-2px) rotate(-0.3deg);
  box-shadow: 6px 7px 0 rgba(45, 42, 38, 0.14);
  background: #fffdf6;
}
.hub-card:focus-visible { outline: 3px dashed var(--fire); outline-offset: 4px; }

.hub-tape-strip {
  position: absolute;
  top: -11px;
  left: 26px;
  width: 58px;
  height: 20px;
  transform: rotate(-4deg);
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.28) 0 5px, transparent 5px 10px),
    var(--tape);
  pointer-events: none;
}

.hub-card-top {
  grid-area: head;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 0;
}
.hub-no {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 0.82rem;
  line-height: 1;
  transform: rotate(-6deg);
}
.hub-titles { display: grid; gap: 2px; min-width: 0; }
.hub-titles b { font-size: 1.22rem; line-height: 1.25; letter-spacing: 0.04em; }
.hub-titles small { font-size: 0.9rem; line-height: 1.35; color: #5c5448; }

.hub-figure { grid-area: fig; display: grid; place-items: center; }
.hub-figure img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  filter: drop-shadow(2px 3px 0 rgba(45, 42, 38, 0.12));
}

.hub-stamp-line {
  grid-area: stamp;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1.5px dashed rgba(45, 42, 38, 0.22);
}
.hub-stamp-num {
  flex: none;
  font-family: var(--sans);
  font-size: 0.8rem;
  color: #6b6257;
}
.hub-dots { display: flex; flex-wrap: wrap; gap: 4px; }
.hub-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px dashed rgba(45, 42, 38, 0.42);
}
.hub-dot.got {
  border: 1.5px solid #c0473a;
  background: #c0473a;
  transform: rotate(-10deg);
}

.hub-full {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border: 3px solid #c0473a;
  border-radius: 50%;
  background: rgba(255, 250, 240, 0.74);
  box-shadow: inset 0 0 0 2px rgba(192, 71, 58, 0.35);
  color: #c0473a;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1;
  transform: rotate(12deg);
  pointer-events: none;
}
.hub-card.is-full .hub-figure { padding-top: 12px; }

/* ---------- 集章册 ---------- */
.hub-passport {
  position: relative;
  padding: 18px 16px 16px 20px;
  border: 2px solid var(--ink);
  border-radius: 6px 16px 8px 14px;
  background:
    radial-gradient(rgba(45, 42, 38, 0.07) 1px, transparent 1.3px) 0 0 / 16px 16px,
    #fff6e3;
  box-shadow: 5px 6px 0 rgba(45, 42, 38, 0.12);
}
.hub-passport::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 7px;
  width: 2px;
  background: repeating-linear-gradient(180deg, rgba(192, 71, 58, 0.5) 0 6px, transparent 6px 12px);
}

.pass-head {
  position: relative;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--ink);
}
.pass-kicker {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.3em;
  color: #6b6257;
}
.pass-head h2 {
  margin: 0;
  font-size: 1.7rem;
  letter-spacing: 0.18em;
}
.pass-total { margin: 4px 0 0; font-size: 0.95rem; }
.pass-total b { font-size: 1.12rem; color: #b3453a; }

.pass-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 7px;
}
.pass-row {
  display: grid;
  gap: 3px;
  padding-bottom: 7px;
  border-bottom: 1px dashed rgba(45, 42, 38, 0.2);
}
.pass-row:last-child { border-bottom: 0; padding-bottom: 0; }
.pass-name {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}
.pass-no {
  flex: none;
  font-family: var(--sans);
  font-size: 0.7rem;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(45, 42, 38, 0.85);
  color: var(--paper);
}
.pass-title { font-size: 1rem; }
.pass-count {
  margin-left: auto;
  font-family: var(--sans);
  font-size: 0.76rem;
  color: #6b6257;
}
.pass-cells { display: flex; flex-wrap: wrap; gap: 4px; }
.pass-cell {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  border: 1.5px dashed rgba(45, 42, 38, 0.35);
  font-size: 9px;
  line-height: 1;
  color: transparent;
}
.pass-cell.got {
  border: 1.5px solid #c0473a;
  background: #c0473a;
  color: #fff5ea;
  transform: rotate(-7deg);
}
.pass-note {
  margin: 10px 0 0;
  font-size: 0.84rem;
  line-height: 1.45;
  color: #6b6257;
}

.hub-lantern {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 2px dashed rgba(45, 42, 38, 0.25);
}
.hub-lantern img {
  flex: none;
  width: 74px;
  height: auto;
  filter: drop-shadow(3px 4px 0 rgba(45, 42, 38, 0.12));
}
.hub-lantern p { margin: 0 0 8px; font-size: 1rem; line-height: 1.5; }

/* ---------- 页尾 ---------- */
.hub-spread + .caveat { margin-top: 28px; max-width: 52em; }

/* ---------- 适配 ---------- */
@media (max-width: 1180px) {
  .hub-spread { grid-template-columns: minmax(0, 1fr); }
  .hub-side { max-width: 520px; }
}
@media (max-width: 700px) {
  .hub-grid { gap: 18px 14px; }
  .hub-card { padding: 16px 12px 10px; grid-template-columns: minmax(0, 1fr) 86px; }
  .hub-figure img { width: 86px; height: 86px; }
  .hub-titles b { font-size: 1.15rem; }
  .hub-titles small { font-size: 0.86rem; }
  .hub-passport { padding: 16px 12px 14px 18px; }
  .pass-head h2 { font-size: 1.55rem; }
  .pass-cell { width: 16px; height: 16px; }
  .hub-lantern img { width: 66px; }
}
@media (max-width: 640px) {
  .hub-grid { grid-template-columns: minmax(0, 1fr); }
  .hub-card { grid-template-columns: minmax(0, 1fr) 100px; }
  .hub-figure img { width: 100px; height: 100px; }
  .hub-side { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hub-card { transition: none; }
  .hub-card:hover { transform: none; }
}

/* 即将推出的章节卡片 */
.hub-card.is-soon { opacity: 0.55; filter: grayscale(0.4); cursor: default; }
.hub-card.is-soon:hover { transform: none; }
.hub-soon-tag { display: inline-block; padding: 1px 10px; border: 1.5px dashed rgba(45, 42, 38, 0.6); border-radius: 999px; font-size: 13px; }

/* 集章册按分册折叠（2026-11-22） */
.pass-list { gap: 4px; }
.pass-sec { border-bottom: 1px dashed rgba(45, 42, 38, 0.25); }
.pass-sec:last-child { border-bottom: 0; }
.pass-sec summary {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name count" "bar bar";
  gap: 4px 8px; align-items: center; min-height: 44px; padding: 6px 2px 8px; cursor: pointer; list-style: none;
}
.pass-sec summary::-webkit-details-marker { display: none; }
.pass-sec-name { grid-area: name; font-size: 1.08rem; font-weight: 700; letter-spacing: 0.08em; }
.pass-sec-name::before { content: "▸ "; font-size: 0.8em; color: #8a7d6b; }
.pass-sec details[open] .pass-sec-name::before { content: "▾ "; }
.pass-sec-count { grid-area: count; font-family: var(--sans); font-size: 0.82rem; color: #6b6257; }
.pass-bar { grid-area: bar; height: 8px; border: 1.5px solid var(--ink); border-radius: 999px; background: #fffaf0; overflow: hidden; }
.pass-bar i { display: block; height: 100%; background: repeating-linear-gradient(135deg, #c0473a 0 6px, #d4685a 6px 12px); }
.pass-sublist { list-style: none; margin: 2px 0 10px; padding: 0; display: grid; gap: 7px; }

/* ---------- 「继续学习」未满章快捷入口 ---------- */
.pass-next { margin-top: 10px; }
.pass-next-link {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 10px;
  min-height: 42px;
  padding: 7px 11px;
  border: 1.5px solid var(--ink);
  border-radius: 5px 11px 6px 10px;
  background: #fffdf6;
  box-shadow: 2px 3px 0 rgba(45, 42, 38, 0.1);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.94rem;
  line-height: 1.35;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}
.pass-next-link:hover {
  transform: translateY(-1px);
  box-shadow: 3px 4px 0 rgba(45, 42, 38, 0.14);
  background: #fff7e2;
}
.pass-next-text {
  font-weight: 700;
  min-width: 0;
  overflow-wrap: anywhere;
}
.pass-next-meta {
  flex: none;
  font-family: var(--sans);
  font-size: 0.78rem;
  color: #b3453a;
}
.pass-next-done {
  margin: 0;
  padding: 7px 10px;
  border: 1.5px dashed rgba(192, 71, 58, 0.55);
  border-radius: 6px;
  background: rgba(255, 250, 240, 0.85);
  font-size: 0.88rem;
  line-height: 1.45;
  color: #8f392f;
}

/* ---------- 集章进度备份 / 恢复 ---------- */
.pass-backup {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1.5px dashed rgba(45, 42, 38, 0.25);
}
.pass-backup summary {
  display: flex;
  align-items: center;
  min-height: 36px;
  cursor: pointer;
  list-style: none;
  font-size: 0.9rem;
  color: #5c5448;
  letter-spacing: 0.04em;
}
.pass-backup summary::-webkit-details-marker { display: none; }
.pass-backup summary::before {
  content: "▸ ";
  margin-right: 4px;
  font-size: 0.8em;
  color: #8a7d6b;
}
.pass-backup[open] summary::before { content: "▾ "; }
.pass-backup-body {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}
.pass-backup-actions,
.pass-backup-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pass-btn {
  min-height: 36px;
  padding: 4px 12px;
  border: 1.5px solid var(--ink);
  border-radius: 6px 10px 6px 8px;
  background: var(--card);
  box-shadow: 2px 2px 0 rgba(45, 42, 38, 0.12);
  font-family: var(--kai);
  font-size: 0.9rem;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}
.pass-btn:hover { background: #fff4d8; transform: translateY(-1px); }
.pass-btn:active { transform: translateY(0); }
.pass-btn-primary {
  background: #c0473a;
  border-color: var(--ink);
  color: #fffaf0;
}
.pass-btn-primary:hover { background: #a83c31; }
.pass-backup-box {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.pass-backup-input {
  width: 100%;
  max-width: 100%;
  padding: 7px 9px;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  background: #fffdf8;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  line-height: 1.4;
  resize: vertical;
  word-break: break-all;
}
.pass-backup-msg {
  margin: 0;
  min-height: 1.2em;
  font-size: 0.84rem;
  line-height: 1.45;
  color: #6b6257;
  overflow-wrap: anywhere;
}
.pass-backup-msg:empty { display: none; }
.pass-backup-msg.is-ok { color: #4d6e3c; }
.pass-backup-msg.is-warn { color: #8c5c23; }
.pass-backup-msg.is-err { color: #b3453a; }

@media (prefers-reduced-motion: reduce) {
  .pass-next-link,
  .pass-btn { transition: none; }
  .pass-next-link:hover,
  .pass-btn:hover { transform: none; }
}
