/* ============================================================
   墨库 · 电子书共享  —  纯手写样式，无外部依赖
   ============================================================ */

:root {
  --paper: #f7f2e8;
  --paper-2: #fbf8f1;
  --paper-deep: #efe7d8;
  --surface: #fffdf8;
  --ink: #211b16;
  --ink-soft: #453c32;
  --muted: #7c7163;
  --line: #e6dccb;
  --line-strong: #d3c5ad;
  --accent: #a63d2f;
  --accent-dark: #8a3025;
  --green: #2c5b4c;
  --danger: #a3301f;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(60, 40, 20, 0.05), 0 10px 30px -22px rgba(60, 40, 20, 0.45);
  --shadow-md: 0 2px 6px rgba(60, 40, 20, 0.06), 0 22px 48px -30px rgba(60, 40, 20, 0.55);
  --serif: "Noto Serif SC", "Songti SC", STSong, "SimSun", "Times New Roman", serif;
  --sans: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(rgba(120, 90, 50, 0.055) 1px, transparent 1px),
    radial-gradient(rgba(120, 90, 50, 0.035) 1px, transparent 1px);
  background-size: 22px 22px, 11px 11px;
  background-position: 0 0, 6px 6px;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
h4 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.25;
  margin: 0;
  letter-spacing: 0.01em;
}

p {
  margin: 0;
}

.wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.muted {
  color: var(--muted);
}

.mono {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86rem;
  color: var(--ink-soft);
}

/* ------------------------------------------------------------- header --- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(247, 242, 232, 0.86);
  backdrop-filter: saturate(150%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
}

.brand-seal {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--accent);
  color: #fbf3e3;
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-text strong {
  font-family: var(--serif);
  font-size: 1.18rem;
  letter-spacing: 0.12em;
}

.brand-text small {
  font-size: 0.66rem;
  color: var(--muted);
  letter-spacing: 0.18em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}

.nav-link {
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 0.92rem;
  color: var(--ink-soft);
  transition: background 0.18s ease, color 0.18s ease;
}

.nav-link:hover {
  background: rgba(166, 61, 47, 0.08);
  color: var(--ink);
}

.nav-link.is-active {
  background: var(--ink);
  color: var(--paper);
}

.credit-pill {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.84rem;
  color: var(--ink-soft);
  white-space: nowrap;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.credit-pill:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.credit-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line-strong);
}

.credit-pill.has-credit {
  border-color: rgba(44, 91, 76, 0.45);
  color: var(--green);
  background: rgba(44, 91, 76, 0.07);
}

.credit-pill.has-credit .credit-dot {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(44, 91, 76, 0.16);
}

/* --------------------------------------------------------------- hero --- */
/* z-lib 式：居中字标 + 副标题 + 长搜索框 */

.hero {
  padding: 76px 0 10px;
  text-align: center;
  overflow: hidden;
}

.hero-inner {
  max-width: 800px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 18px;
}

.eyebrow-line {
  width: 28px;
  height: 1px;
  background: currentColor;
}

.wordmark {
  font-family: var(--serif);
  font-size: clamp(2.6rem, 5.5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.1;
  display: inline-flex;
  align-items: baseline;
}

.wordmark-mo {
  color: var(--accent);
}

.wordmark-ku {
  color: var(--ink);
}

.wordmark-wk {
  color: var(--muted);
  font-weight: 500;
  margin-left: 10px;
}

.wordmark-dot {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--accent);
  align-self: center;
  margin-left: 12px;
  transform: translateY(-2px);
}

.hero-tagline {
  font-family: var(--serif);
  font-style: italic;
  color: var(--muted);
  font-size: 1rem;
  letter-spacing: 0.06em;
  margin-top: 16px;
}

.hero-sub {
  max-width: 36em;
  margin: 14px auto 0;
  font-size: 0.9rem;
  line-height: 1.9;
  color: var(--muted);
}

.hero-sub b {
  color: var(--ink);
  font-weight: 600;
}

.search-zone {
  max-width: 720px;
  margin: 34px auto 0;
  text-align: left;
}

.searchbar {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 0 10px 10px 10px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.searchbar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(166, 61, 47, 0.1), var(--shadow-sm);
}

.searchbar input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  padding: 0.95rem 1.25rem;
  font-size: 0.95rem;
}

.searchbar input::placeholder {
  color: #b3a68f;
}

.searchbar button {
  border: none;
  border-left: 1px solid var(--line);
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.12em;
  padding: 0 30px;
  cursor: pointer;
  transition: background 0.18s ease;
}

.searchbar button:hover {
  background: var(--paper-deep);
}

.lede {
  max-width: 34em;
  font-size: 1.02rem;
  color: var(--ink-soft);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

/* -------------------------------------------------------------- steps --- */

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  padding-top: 26px;
  padding-bottom: 26px;
}

.step {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 22px 24px;
  box-shadow: var(--shadow-sm);
}

.step-num {
  font-family: var(--serif);
  font-size: 0.86rem;
  letter-spacing: 0.2em;
  color: var(--accent);
}

.step h3 {
  font-size: 1.12rem;
  margin: 8px 0 8px;
}

.step p {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.65;
}

/* ------------------------------------------------------------ buttons --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.7rem 1.25rem;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fdf6e9;
  box-shadow: 0 10px 24px -16px rgba(140, 50, 35, 0.9);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  background: #e7dcc9;
  color: var(--muted);
  box-shadow: none;
  opacity: 1;
}

.btn-ghost {
  border-color: var(--line-strong);
  color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.6);
}

.btn-ghost:hover:not(:disabled) {
  border-color: var(--ink-soft);
  color: var(--ink);
}

.btn-danger {
  border-color: rgba(163, 48, 31, 0.4);
  color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(163, 48, 31, 0.08);
}

.btn-mini {
  padding: 0.36rem 0.72rem;
  font-size: 0.8rem;
  border-radius: 8px;
}

.link-btn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  font-size: 0.88rem;
  cursor: pointer;
}

.link-btn:hover {
  text-decoration: underline;
}

.inline-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

/* ------------------------------------------------------------- library --- */

.library {
  padding-top: 34px;
  padding-bottom: 72px;
}

.library-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 12px;
}

.library-head h2 {
  font-size: 1.5rem;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.library-meta {
  margin-top: 4px;
  font-size: 0.84rem;
  color: var(--muted);
}

.search {
  position: relative;
  width: min(320px, 100%);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.6;
  stroke-linecap: round;
  pointer-events: none;
}

.search input {
  width: 100%;
  padding: 0.72rem 1rem 0.72rem 2.6rem;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 999px;
  outline: none;
  font-size: 0.92rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(166, 61, 47, 0.12);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0 26px;
}

.chip {
  padding: 0.36rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.18s ease;
}

.chip:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 30px 24px;
}

.book-card {
  min-width: 0;
}

.book-link {
  display: block;
}

/* 文献资料封面：浅色纸感 + 顶栏标签印章 + 标题页式排版 */
.cover {
  --c1: #8c3b2e;
  --c2: #c2703f;
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 12px 12px 10px;
  background: linear-gradient(
    160deg,
    color-mix(in srgb, var(--c1) 13%, #fffdf6) 0%,
    color-mix(in srgb, var(--c1) 4%, #fffcf4) 55%,
    color-mix(in srgb, var(--c2) 11%, #fdf8ec) 100%
  );
  border: 1px solid color-mix(in srgb, var(--c1) 28%, #e6dcc9);
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease,
    border-color 0.3s ease;
}

.cover-glyph {
  position: absolute;
  right: -6px;
  bottom: -16px;
  font-family: var(--serif);
  font-size: 6.8rem;
  line-height: 1;
  font-weight: 700;
  color: color-mix(in srgb, var(--c1) 8%, transparent);
  user-select: none;
  pointer-events: none;
}

.cover-top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cover-format {
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  color: color-mix(in srgb, var(--c1) 80%, var(--ink));
  border: 1px solid color-mix(in srgb, var(--c1) 45%, #e6dcc9);
  border-radius: 3px;
  padding: 1px 6px;
  background: rgba(255, 255, 255, 0.45);
}

.cover-seal {
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fdf6ea;
  font-family: var(--serif);
  font-size: 0.58rem;
  border-radius: 3px;
  box-shadow: 0 1px 2px rgba(120, 30, 20, 0.3);
}

.cover-body {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 9px;
  padding: 6px 0;
}

.cover-title {
  font-family: var(--serif);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.55;
  color: color-mix(in srgb, var(--c1) 55%, var(--ink));
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cover-rule {
  width: 24px;
  height: 2px;
  border-radius: 1px;
  background: color-mix(in srgb, var(--c1) 55%, #e6dcc9);
}

.cover-author {
  position: relative;
  z-index: 2;
  font-size: 0.66rem;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-link:hover .cover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--c1) 55%, #e6dcc9);
  box-shadow: 0 13px 26px -12px rgba(60, 40, 20, 0.22);
}

.book-title {
  margin: 12px 0 2px;
  font-size: 0.97rem;
  font-weight: 700;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-author {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--muted);
}

.book-dl {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.badge {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-size: 0.64rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  background: rgba(255, 253, 248, 0.7);
  white-space: nowrap;
}

.badge--hidden {
  border-color: rgba(166, 61, 47, 0.35);
  color: var(--danger);
}

.badge--live {
  border-color: rgba(44, 91, 76, 0.35);
  color: var(--green);
}

.empty {
  margin-top: 18px;
  padding: 54px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  text-align: center;
  background: rgba(255, 253, 248, 0.5);
}

.empty-title {
  font-family: var(--serif);
  font-size: 1.3rem;
  margin-bottom: 6px;
}

.empty-text {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 18px;
}

.empty--inline {
  margin-top: 0;
  padding: 28px 18px;
}

.load-more {
  display: flex;
  justify-content: center;
  margin-top: 40px;
}

/* ------------------------------------------------------------ page head --- */

.page {
  padding-top: 40px;
  padding-bottom: 80px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
  margin-bottom: 34px;
}

.page-head h1 {
  font-size: clamp(2rem, 3.6vw, 2.9rem);
  margin-bottom: 12px;
}

.page-head .lede {
  max-width: 46em;
  font-size: 0.94rem;
}

/* ------------------------------------------------------------- upload --- */

.upload-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(260px, 0.75fr);
  gap: 36px;
  align-items: start;
}

.cycle-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.cycle-ring {
  position: relative;
  width: 96px;
  height: 96px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: conic-gradient(var(--accent) calc(var(--p, 0) * 1%), var(--line) 0);
  transition: background 0.4s ease;
}

.cycle-ring::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: var(--surface);
}

.cycle-count {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 1px;
  font-family: var(--serif);
  line-height: 1;
}

.cycle-count b {
  font-size: 1.7rem;
  font-weight: 700;
}

.cycle-count i {
  font-style: normal;
  color: var(--line-strong);
  margin: 0 1px;
}

.cycle-count em {
  font-style: normal;
  font-size: 0.9rem;
  color: var(--muted);
}

.cycle-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.cycle-title b {
  color: var(--accent);
  font-size: 1.1rem;
}

.cycle-sub {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 52px 24px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.6);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--accent);
  background: rgba(255, 253, 248, 0.95);
  outline: none;
}

.dropzone.is-drag {
  border-color: var(--accent);
  background: rgba(166, 61, 47, 0.06);
  transform: scale(1.005);
}

.dropzone.is-compact {
  padding: 14px 18px;
  flex-direction: row;
  gap: 10px;
}

.dropzone.is-compact .drop-icon {
  width: 24px;
  height: 24px;
}

.dropzone.is-compact .drop-title {
  font-size: 0.9rem;
}

.dropzone.is-compact .drop-sub {
  display: none;
}

.drop-icon {
  width: 42px;
  height: 42px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.85;
}

.drop-title {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 600;
}

.drop-sub {
  font-size: 0.8rem;
  color: var(--muted);
}

.queue {
  margin-top: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.queue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.queue-head h2 {
  font-size: 1.02rem;
}

.queue-head span {
  color: var(--accent);
}

.queue-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.queue-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px 8px;
  background: var(--paper-2, #fbf8f1);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.queue-item.is-uploading {
  border-color: rgba(166, 61, 47, 0.45);
}

.queue-item.is-done {
  border-color: rgba(44, 91, 76, 0.4);
  background: rgba(44, 91, 76, 0.05);
}

.queue-item.is-error {
  border-color: rgba(163, 48, 31, 0.45);
  background: rgba(163, 48, 31, 0.04);
}

.queue-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.file-ext {
  flex-shrink: 0;
  min-width: 46px;
  padding: 3px 0;
  text-align: center;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  border: 1px solid rgba(166, 61, 47, 0.28);
  border-radius: 5px;
}

.queue-fields {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 8px;
}

.queue-fields input {
  width: 100%;
  min-width: 0;
  padding: 0.36rem 0.55rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.65);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.queue-fields input:hover {
  background: #fff;
}

.queue-fields input:focus {
  border-color: var(--line-strong);
  background: #fff;
}

.queue-side {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.queue-size {
  font-size: 0.74rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.icon-btn {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  background: rgba(163, 48, 31, 0.1);
  color: var(--danger);
}

.queue-progress {
  height: 3px;
  margin-top: 8px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}

.queue-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.2s ease;
}

.queue-item.is-done .queue-progress span {
  background: var(--green);
}

.queue-error {
  margin-top: 4px;
  font-size: 0.76rem;
  color: var(--danger);
}

.queue-error:empty {
  display: none;
}

.queue-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.queue-hint {
  font-size: 0.78rem;
  color: var(--muted);
}

.result-card {
  margin-top: 22px;
  padding: 26px 24px;
  border: 1px solid rgba(44, 91, 76, 0.28);
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(44, 91, 76, 0.08), rgba(255, 253, 248, 0.9));
}

.result-card h2 {
  font-size: 1.3rem;
  margin-bottom: 8px;
}

.result-card p {
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.upload-aside {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.upload-aside h2 {
  font-size: 1.1rem;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.rule-list {
  margin: 14px 0 0;
  padding-left: 20px;
  font-size: 0.86rem;
  color: var(--ink-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rule-list li::marker {
  color: var(--accent);
  font-family: var(--serif);
}

.aside-note {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: rgba(166, 61, 47, 0.06);
  border: 1px solid rgba(166, 61, 47, 0.15);
}

.aside-note strong {
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.aside-note p {
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ------------------------------------------------------------- detail --- */

.back-link {
  display: inline-block;
  font-size: 0.84rem;
  color: var(--muted);
  margin-bottom: 28px;
  transition: color 0.18s ease;
}

.back-link:hover {
  color: var(--accent);
}

.book-detail {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

.cover--lg {
  border-radius: 8px;
  padding: 18px 16px 14px;
  box-shadow: 0 30px 60px -34px rgba(50, 30, 10, 0.5);
}

.cover--lg .cover-title {
  font-size: 1.02rem;
}

.cover--lg .cover-glyph {
  font-size: 9rem;
}

.cover--lg .cover-format {
  font-size: 0.66rem;
}

.cover--lg .cover-author {
  font-size: 0.74rem;
}

.detail-eyebrow {
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  color: var(--accent);
  margin-bottom: 10px;
}

.detail-title {
  font-size: clamp(1.9rem, 3.4vw, 2.7rem);
  margin-bottom: 6px;
}

.detail-author {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 22px;
}

.detail-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  padding: 16px 0;
  margin: 0 0 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.detail-meta dt {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 2px;
}

.detail-meta dd {
  margin: 0;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.detail-desc {
  font-size: 0.94rem;
  color: var(--ink-soft);
  padding: 4px 0 8px;
  white-space: pre-wrap;
}

.download-box {
  margin-top: 22px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.download-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.btn-download {
  padding: 0.78rem 1.6rem;
}

.download-cost {
  font-size: 0.82rem;
  color: var(--muted);
}

.download-cost b {
  color: var(--ink);
}

.download-hint {
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--muted);
}

.detail-rules {
  margin-top: 26px;
  padding-left: 16px;
  border-left: 2px solid var(--line-strong);
}

.detail-rules strong {
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.detail-rules p {
  margin-top: 4px;
  font-size: 0.84rem;
  color: var(--muted);
}

.skeleton-block {
  grid-column: 1 / -1;
  padding: 60px;
  text-align: center;
  color: var(--muted);
}

/* ----------------------------------------------------------- my page --- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.stat-card--accent {
  background: linear-gradient(160deg, #a63d2f, #8a3025);
  border-color: transparent;
  color: #fdf3e4;
}

.stat-label {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.stat-card--accent .stat-label {
  color: rgba(253, 243, 228, 0.72);
}

.stat-value {
  font-family: var(--serif);
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1.15;
  margin: 8px 0 4px;
}

.stat-value small {
  font-size: 1rem;
  font-weight: 400;
  color: var(--muted);
}

.stat-card--accent .stat-value small {
  color: rgba(253, 243, 228, 0.72);
}

.stat-link {
  font-size: 0.8rem;
  color: rgba(253, 243, 228, 0.86);
  text-decoration: underline;
  text-underline-offset: 3px;
  margin-top: auto;
  padding-top: 8px;
}

.stat-sub {
  font-size: 0.78rem;
  color: var(--muted);
}

.stat-card--accent .stat-sub {
  color: rgba(253, 243, 228, 0.8);
}

.progress {
  height: 6px;
  margin: 8px 0 6px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.panel + .panel {
  margin-top: 24px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.panel-head h2 {
  font-size: 1.15rem;
}

.simple-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.simple-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.86rem;
}

.simple-item:last-child {
  border-bottom: 0;
}

.simple-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.simple-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.simple-title:hover {
  color: var(--accent);
}

.simple-author {
  font-size: 0.78rem;
  color: var(--muted);
}

.simple-meta {
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* -------------------------------------------------------------- admin --- */

.admin-login {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 560px;
}

.admin-login label {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.inline-field {
  display: flex;
  gap: 10px;
}

.inline-field input {
  flex: 1;
  min-width: 0;
  padding: 0.66rem 0.85rem;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  outline: none;
  font-size: 0.9rem;
}

.inline-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(166, 61, 47, 0.12);
}

.form-hint {
  font-size: 0.76rem;
  color: var(--muted);
}

.stat-grid--compact {
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 24px;
}

.stat-grid--compact .stat-value {
  font-size: 1.7rem;
}

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

.admin-tools input {
  padding: 0.46rem 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  outline: none;
  font-size: 0.84rem;
  width: 220px;
}

.table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 720px;
}

.admin-table th {
  text-align: left;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}

.admin-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.admin-table tr.is-hidden {
  opacity: 0.55;
}

.admin-table tr:hover td {
  background: rgba(166, 61, 47, 0.03);
}

.cell-title {
  font-weight: 600;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-sub {
  font-size: 0.76rem;
  color: var(--muted);
}

.ta-right {
  text-align: right;
}

.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.table-empty {
  text-align: center;
  color: var(--muted);
  padding: 32px 0;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.pager-info {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ------------------------------------------------------------- footer --- */

.site-footer {
  margin-top: auto;
  background: #241d17;
  color: rgba(247, 242, 232, 0.72);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 28px 24px;
  font-size: 0.8rem;
}

.footer-links {
  display: flex;
  gap: 18px;
}

.footer-links a:hover {
  color: #fff;
}

/* -------------------------------------------------------------- toast --- */

.toast-root {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: min(92vw, 460px);
}

.toast {
  padding: 10px 18px;
  border-radius: 999px;
  background: #2b231c;
  color: #fbf4e7;
  font-size: 0.84rem;
  box-shadow: 0 14px 30px -14px rgba(0, 0, 0, 0.6);
  animation: toast-in 0.24s ease both;
  text-align: center;
}

.toast--success {
  background: #2c5b4c;
}

.toast--error {
  background: #8a3025;
}

.toast.is-out {
  animation: toast-out 0.5s ease both;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-6px);
  }
}

/* ----------------------------------------------------------- notfound --- */

.notfound {
  text-align: center;
  padding-top: 90px;
  padding-bottom: 110px;
}

.notfound-code {
  font-family: var(--serif);
  font-size: 5rem;
  line-height: 1;
  color: var(--line-strong);
}

.notfound h1 {
  font-size: 1.9rem;
  margin: 10px 0 16px;
}

.notfound .lede {
  margin: 0 auto 26px;
}

/* --------------------------------------------------------- responsive --- */

@media (max-width: 980px) {
  .upload-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .upload-main,
  .upload-aside {
    min-width: 0;
  }

  .book-detail {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 32px;
  }

  .stat-grid,
  .stat-grid--compact {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 760px) {
  .header-inner {
    height: 60px;
    gap: 12px;
  }

  .brand-text small {
    display: none;
  }

  .nav {
    margin-left: 0;
  }

  .nav-link {
    padding: 6px 10px;
    font-size: 0.86rem;
  }

  .credit-pill {
    padding: 6px 10px;
    font-size: 0.76rem;
  }

  .hero {
    padding-top: 40px;
  }

  .steps {
    grid-template-columns: 1fr;
  }

  .book-grid {
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 24px 16px;
  }

  .page {
    padding-top: 26px;
    padding-bottom: 56px;
  }

  .page-head {
    gap: 20px;
  }

  .cycle-card {
    width: 100%;
  }

  .book-detail {
    grid-template-columns: 1fr;
  }

  .book-detail .cover {
    width: 200px;
    max-width: 100%;
    justify-self: center;
  }

  .detail-meta {
    grid-template-columns: repeat(2, 1fr);
  }

  .queue-fields {
    grid-template-columns: 1fr;
  }

  .queue-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-tools {
    width: 100%;
    flex-wrap: wrap;
  }

  .admin-tools input {
    flex: 1;
    width: auto;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

@media (max-width: 560px) {
  .brand-text {
    display: none;
  }

  .header-inner {
    gap: 8px;
    padding: 0 16px;
  }

  .wrap {
    padding-left: 16px;
    padding-right: 16px;
  }

  .nav {
    gap: 0;
  }

  .nav-link {
    padding: 6px 8px;
    font-size: 0.82rem;
  }

  .credit-pill {
    gap: 6px;
    padding: 5px 10px;
    font-size: 0.72rem;
  }

  .credit-dot {
    width: 6px;
    height: 6px;
  }

  .stat-grid,
  .stat-grid--compact {
    grid-template-columns: 1fr;
  }

  .book-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
