:root {
  --bg: #1a1614;
  --panel: #2a221e;
  --text: #f3ebe3;
  --muted: #b5a59a;
  --accent: #c45c26;
  --line: #3d322c;
  --warn: #e6b35a;
  --ok: #7cb87c;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(ellipse at top, #2c2018 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1rem 1.1rem 0.6rem;
  border-bottom: 1px solid var(--line);
}
.brand {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.meta {
  display: flex;
  gap: 0.85rem;
  font-size: 0.82rem;
  color: var(--muted);
}
main { padding: 1rem 1.1rem 3rem; max-width: 720px; margin: 0 auto; }
.panel {
  background: color-mix(in srgb, var(--panel) 92%, black);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.notice p { margin-top: 0; color: var(--muted); font-size: 0.92rem; }
.check { display: flex; gap: 0.5rem; align-items: flex-start; font-size: 0.9rem; }
h2 { margin: 0 0 0.75rem; font-size: 1.05rem; }
input[type="text"], input[type="file"] {
  display: block;
  width: 100%;
  margin-bottom: 0.65rem;
  background: #181411;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
}
button {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
  cursor: pointer;
  margin-right: 0.4rem;
  margin-bottom: 0.4rem;
}
button.secondary {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}
button.danger {
  background: transparent;
  border: 1px solid #8a4040;
  color: #e8a0a0;
}
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.5rem 0 0.75rem;
}
.book-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.6rem;
}
.book-row .book-main { flex: 1; min-width: 0; cursor: pointer; }
.book-row .book-ops { flex-shrink: 0; }
.book-row .book-ops button {
  padding: 0.25rem 0.55rem;
  font-size: 0.78rem;
  margin: 0;
}
button:disabled { opacity: 0.45; cursor: not-allowed; }
.hint, .msg { font-size: 0.85rem; color: var(--muted); }
.msg.err { color: #e88; }
.msg.ok { color: var(--ok); }
ul { list-style: none; padding: 0; margin: 0; }
li.book-item {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
li.book-item:last-child { border-bottom: 0; }
li .name { font-weight: 600; }
li .sub { font-size: 0.8rem; color: var(--muted); }
.eligible { font-size: 1.15rem; font-weight: 600; }
.warn { color: var(--warn); }
.hidden { display: none !important; }
.linkish {
  background: transparent;
  color: var(--muted);
  padding: 0;
  margin-bottom: 0.5rem;
}
.card {
  border-top: 1px solid var(--line);
  padding: 0.9rem 0;
}
.card h3 { margin: 0 0 0.35rem; font-size: 1rem; }
.card .hook {
  white-space: pre-wrap;
  background: #181411;
  padding: 0.7rem;
  border-radius: 8px;
  font-size: 0.88rem;
  color: #e8ddd3;
}
.subhead {
  margin: 1rem 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #e8ddd3;
}
.notice .notice-title {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  color: var(--accent);
}
.notice .notice-body {
  margin: 0 0 0.85rem;
  white-space: pre-line;
  line-height: 1.55;
  color: #e8ddd3;
  font-size: 0.92rem;
}
.remain-box {
  margin: 0.75rem 0;
  padding: 0.75rem 0.9rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #181411;
  color: #cfc4b8;
  font-size: 0.92rem;
}
.remain-box p { margin: 0; }
.remain-box button {
  margin-top: 0.65rem;
}
.countdown-box {
  margin: 0.85rem 0;
  padding: 1rem 1rem 1.1rem;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: linear-gradient(160deg, #2a2218 0%, #181411 70%);
  color: #f0e6d8;
}
.countdown-box .cd-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
}
.countdown-box .cd-time {
  margin: 0 0 0.25rem;
  font-size: 1.55rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.countdown-box .cd-hint {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: #cfc4b8;
}
.cd-bar {
  height: 6px;
  border-radius: 999px;
  background: #2e2822;
  overflow: hidden;
}
.cd-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.8s linear;
}
.countdown-box.cd-done {
  border-color: #4a7a4a;
}
.countdown-box.cd-done .cd-title { color: #8fd48f; }
.hl-list {
  list-style: none;
  padding: 0;
  margin: 0.4rem 0 0.8rem;
}
.hl-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.5rem;
  background: #181411;
}
.hl-item.next-batch {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}
.hl-item.st-unlocked { border-color: #3d5a3d; }
.hl-item.st-failed { border-color: #6a4a20; }
.hl-item.st-locked { opacity: 0.92; }
.hl-top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.7rem;
  align-items: baseline;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
}
.hl-idx {
  font-weight: 700;
  color: var(--accent);
}
.hl-meta { color: var(--muted); }
.hl-st {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--ok);
}
.st-locked .hl-st { color: var(--muted); }
.st-failed .hl-st { color: var(--warn); }
.st-generating .hl-st { color: var(--warn); }
  .hl-preview {
  margin: 0;
  font-size: 0.86rem;
  color: #d9cfc4;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hl-tip { margin: 0 0 0.5rem; }
.essay { font-size: 0.92rem; color: #f0e6dc; }
.badge { font-size: 0.78rem; margin: 0.2rem 0 0.5rem; }
.badge.ok { color: var(--ok); }
.badge.bad { color: var(--warn); }
.card button {
  margin-top: 0.5rem;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}
.process-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 0.75rem 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: linear-gradient(160deg, #2c2419 0%, #181411 75%);
}
.process-banner.hidden { display: none !important; }
.process-spin {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.15rem;
  border: 2px solid rgba(212, 168, 90, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: pw-spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes pw-spin {
  to { transform: rotate(360deg); }
}
.process-copy { min-width: 0; }
.process-title {
  margin: 0 0 0.25rem;
  font-weight: 700;
  color: var(--accent);
  font-size: 1rem;
}
.process-desc {
  margin: 0;
  font-size: 0.86rem;
  color: #cfc4b8;
  line-height: 1.45;
}

.reader-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.reader-overlay.hidden { display: none !important; }
.reader-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}
.reader-sheet {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  background: #16120f;
  border: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.45);
}
@media (min-width: 800px) {
  .reader-overlay { align-items: center; padding: 1.5rem; }
  .reader-sheet {
    border-radius: 14px;
    max-height: 85vh;
  }
}
.reader-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.reader-toolbar h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--accent);
}
.reader-toolbar button {
  margin: 0;
  padding: 0.35rem 0.75rem;
}
.reader-body {
  margin: 0;
  padding: 0.9rem 1rem 1.4rem;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.55;
  color: #e8ddd3;
  background: #120f0c;
}
