/* 回响书院 · 墨纸 × 终端 */
:root {
  --ink: #0a0908;
  --paper: #12100c;
  --paper-2: #191612;
  --paper-3: #221d16;
  --line: rgba(200, 164, 92, 0.16);
  --line-strong: rgba(200, 164, 92, 0.34);
  --gold: #c8a45c;
  --gold-bright: #e8c987;
  --seal: #b8422f;
  --jade: #6d9d78;
  --text: #eae3d4;
  --muted: #97896f;
  --faint: #6b6152;
  --serif: 'Noto Serif SC', 'Songti SC', 'STSong', 'SimSun', serif;
  --display: 'Cormorant Garamond', 'Noto Serif SC', serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --shadow: 0 18px 50px -22px rgba(0, 0, 0, 0.9);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 620px at 12% -8%, rgba(200, 164, 92, 0.09), transparent 62%),
    radial-gradient(900px 560px at 105% 8%, rgba(184, 66, 47, 0.07), transparent 60%),
    var(--ink);
  color: var(--text);
  font-family: var(--serif);
  font-weight: 300;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 纸纹颗粒 */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
}

/* ------------------------------- 顶栏 ------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 14px 24px;
  background: linear-gradient(to bottom, rgba(10, 9, 8, 0.96), rgba(10, 9, 8, 0.78));
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }

.seal {
  width: 50px; height: 50px;
  display: grid; place-items: center;
  font-size: 20px; font-weight: 700; line-height: 1;
  color: #f5ecd8;
  background: linear-gradient(145deg, var(--seal), #8d2f20);
  border-radius: 5px;
  letter-spacing: -2px;
  box-shadow: 0 6px 20px -8px rgba(184, 66, 47, 0.9), inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  flex: none;
}

.brand-text h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 25px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--gold-bright);
}
.brand-text p { margin: 2px 0 0; font-size: 11.5px; color: var(--muted); letter-spacing: 0.08em; }

.topbar-stats { display: flex; gap: 20px; margin-left: auto; flex-wrap: wrap; }
.stat { text-align: right; }
.stat b { display: block; font-family: var(--display); font-size: 19px; color: var(--gold-bright); font-weight: 600; }
.stat span { font-size: 10.5px; color: var(--faint); letter-spacing: 0.1em; }

.topbar-actions { display: flex; gap: 10px; flex: none; }

.btn {
  font-family: var(--serif);
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 3px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--gold);
  cursor: pointer;
  letter-spacing: 0.06em;
  transition: all 0.22s ease;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: rgba(200, 164, 92, 0.1); color: var(--gold-bright); border-color: var(--gold); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-primary { background: linear-gradient(160deg, rgba(200, 164, 92, 0.2), rgba(184, 66, 47, 0.14)); color: var(--gold-bright); }
.btn-primary:hover:not(:disabled) { background: linear-gradient(160deg, rgba(200, 164, 92, 0.32), rgba(184, 66, 47, 0.24)); }
.btn-seal { border-color: rgba(184, 66, 47, 0.5); color: #e08d78; }
.btn-seal:hover:not(:disabled) { background: rgba(184, 66, 47, 0.16); border-color: var(--seal); color: #ffb9a5; }
.btn-sm { padding: 6px 11px; font-size: 12px; }

/* ------------------------------- 布局 ------------------------------- */
.stage {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 360px;
  gap: 18px;
  padding: 20px 24px 60px;
  align-items: start;
  max-width: 2100px;
  margin: 0 auto;
}
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.col-left, .col-right { position: sticky; top: 86px; max-height: calc(100vh - 104px); overflow-y: auto; padding-right: 4px; }
.col-left::-webkit-scrollbar, .col-right::-webkit-scrollbar, .feed::-webkit-scrollbar, .reading-scroll::-webkit-scrollbar { width: 6px; }
.col-left::-webkit-scrollbar-thumb, .col-right::-webkit-scrollbar-thumb, .feed::-webkit-scrollbar-thumb, .reading-scroll::-webkit-scrollbar-thumb {
  background: rgba(200, 164, 92, 0.22); border-radius: 3px;
}

.panel {
  background: linear-gradient(180deg, rgba(25, 22, 18, 0.92), rgba(18, 16, 12, 0.92));
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 13px 14px 15px;
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; letter-spacing: 0.16em; color: var(--muted);
  padding-bottom: 10px; margin-bottom: 11px;
  border-bottom: 1px solid var(--line);
  text-transform: uppercase;
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); flex: none; }
.dot-live { background: var(--seal); box-shadow: 0 0 0 0 rgba(184, 66, 47, 0.7); animation: pulse 1.8s infinite; }
@keyframes pulse {
  70% { box-shadow: 0 0 0 7px rgba(184, 66, 47, 0); }
  100% { box-shadow: 0 0 0 0 rgba(184, 66, 47, 0); }
}
.chip {
  margin-left: auto; font-family: var(--mono); font-size: 10.5px;
  color: var(--gold); background: rgba(200, 164, 92, 0.09);
  padding: 2px 7px; border-radius: 2px; letter-spacing: 0;
}

/* ------------------------------- 作者席 ------------------------------ */
.authors { display: flex; flex-direction: column; gap: 9px; }
.author {
  display: flex; gap: 11px; padding: 9px 10px; border-radius: 3px;
  border: 1px solid transparent; transition: all 0.25s ease; position: relative; overflow: hidden;
}
.author.active { border-color: var(--line-strong); background: rgba(200, 164, 92, 0.07); }
.author.active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--gold); }
.avatar {
  width: 38px; height: 38px; flex: none; border-radius: 3px; display: grid; place-items: center;
  font-size: 17px; font-weight: 500; color: #f2e8d4;
  background: linear-gradient(150deg, #2c251b, #1a1611);
  border: 1px solid var(--line);
}
.author-name { font-size: 15px; color: var(--text); font-weight: 500; display: flex; align-items: center; gap: 7px; }
.author-tag { font-size: 10.5px; color: var(--faint); letter-spacing: 0.08em; margin-top: 3px; }
.mtag {
  font-family: var(--mono); font-size: 9.5px; padding: 1.5px 5px; border-radius: 2px;
  background: rgba(109, 157, 120, 0.14); color: var(--jade); border: 1px solid rgba(109, 157, 120, 0.26);
  letter-spacing: 0;
}
.mtag-max { background: rgba(184, 66, 47, 0.14); color: #d98a75; border-color: rgba(184, 66, 47, 0.3); }

/* ------------------------------- 书架 -------------------------------- */
.shelf { display: flex; flex-direction: column; gap: 9px; }
.book {
  padding: 11px 12px; border-radius: 3px; cursor: pointer;
  border: 1px solid var(--line); background: rgba(10, 9, 8, 0.4);
  transition: all 0.25s ease; position: relative;
}
.book:hover { border-color: var(--line-strong); transform: translateX(2px); }
.book.active { border-color: var(--gold); background: rgba(200, 164, 92, 0.08); }
.book.active::after { content: ''; position: absolute; right: 0; top: 0; bottom: 0; width: 2px; background: var(--gold); }
.book-title { font-size: 16px; font-weight: 500; color: var(--gold-bright); letter-spacing: 0.05em; }
.book-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 10.5px; color: var(--faint); font-family: var(--mono); }
.book-premise { margin-top: 7px; font-size: 11.5px; line-height: 1.65; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.badge-score { color: var(--gold); }

/* ------------------------------- 阅读台 ------------------------------ */
.reading {
  background: linear-gradient(180deg, rgba(26, 23, 18, 0.94), rgba(15, 13, 10, 0.96));
  border: 1px solid var(--line); border-radius: 5px; min-height: 70vh;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.reading::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent, transparent 27px, rgba(200, 164, 92, 0.022) 28px);
}

.empty { padding: 90px 40px; text-align: center; }
.empty-mark {
  width: 76px; height: 76px; margin: 0 auto 22px; display: grid; place-items: center;
  font-size: 34px; color: var(--gold); border: 1px solid var(--line-strong); border-radius: 4px;
  background: radial-gradient(circle at 50% 40%, rgba(200, 164, 92, 0.12), transparent 70%);
}
.empty h2 { font-family: var(--display); font-size: 26px; color: var(--gold-bright); margin: 0 0 12px; letter-spacing: 0.08em; font-weight: 600; }
.empty p { color: var(--muted); font-size: 13.5px; line-height: 2; max-width: 520px; margin: 0 auto; }

.reading-head { padding: 20px 30px 14px; border-bottom: 1px solid var(--line); position: relative; }
.rh-genre { font-family: var(--mono); font-size: 10.5px; color: var(--jade); letter-spacing: 0.14em; }
.rh-title { font-family: var(--display); font-size: 34px; font-weight: 700; color: var(--gold-bright); margin: 6px 0 8px; letter-spacing: 0.06em; }
.rh-by { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.rh-premise { margin-top: 12px; font-size: 12.5px; line-height: 1.95; color: var(--muted); border-left: 2px solid var(--line-strong); padding-left: 12px; max-width: 720px; }

.chapter-tabs { display: flex; gap: 7px; flex-wrap: wrap; padding: 14px 30px 0; position: relative; }
.ctab {
  font-size: 12px; padding: 5px 11px; border-radius: 2px; cursor: pointer;
  border: 1px solid var(--line); color: var(--muted); background: transparent; font-family: var(--serif);
  transition: all 0.2s;
}
.ctab:hover { color: var(--gold); }
.ctab.active { color: var(--gold-bright); border-color: var(--gold); background: rgba(200, 164, 92, 0.1); }
.ctab .v { font-family: var(--mono); font-size: 9.5px; opacity: 0.75; margin-left: 5px; }

.actions { display: flex; gap: 9px; flex-wrap: wrap; padding: 16px 30px 0; position: relative; align-items: center; }
.action-hint { font-size: 11px; color: var(--faint); font-family: var(--mono); }

.thought {
  margin: 16px 30px 0; border: 1px dashed var(--line-strong); border-radius: 3px;
  padding: 11px 13px; background: rgba(200, 164, 92, 0.035); position: relative;
}
.thought-head {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: 11px; color: var(--gold); letter-spacing: 0.12em; font-family: var(--mono);
}
.thought-body {
  margin-top: 9px; font-family: var(--mono); font-size: 11px; line-height: 1.85;
  color: var(--faint); max-height: 150px; overflow-y: auto; white-space: pre-wrap; word-break: break-word;
}
.thought-body::-webkit-scrollbar { width: 5px; }
.thought-body::-webkit-scrollbar-thumb { background: rgba(200, 164, 92, 0.2); }

.reading-scroll { padding: 22px 30px 44px; position: relative; }
.chapter-title-h {
  font-family: var(--display); font-size: 24px; font-weight: 600; color: var(--text);
  text-align: center; margin: 8px 0 26px; letter-spacing: 0.1em;
}
.chapter-title-h::after { content: ''; display: block; width: 44px; height: 1px; background: var(--line-strong); margin: 14px auto 0; }

.prose { font-size: 16.5px; line-height: 2.15; color: #ded5c3; max-width: 820px; margin: 0 auto; }
.prose p { margin: 0 0 1.15em; text-indent: 2em; }
.prose p.dialog { text-indent: 0; }
.prose mark.para {
  background: transparent; color: inherit; text-decoration: none;
  border-bottom: 1px dashed rgba(200, 164, 92, 0.55); cursor: help; position: relative;
  transition: background 0.2s;
}
.prose mark.para:hover, .prose mark.para.on { background: rgba(200, 164, 92, 0.14); }
.prose mark.para[data-mood='踩'] { border-bottom-color: rgba(184, 66, 47, 0.65); }
.prose mark.para[data-mood='惑'] { border-bottom-color: rgba(109, 157, 120, 0.65); }

.cursor { display: inline-block; width: 8px; height: 18px; background: var(--gold); vertical-align: -3px; animation: blink 0.9s steps(2) infinite; margin-left: 2px; }
@keyframes blink { 50% { opacity: 0; } }

.stream-state {
  display: flex; align-items: center; gap: 9px; justify-content: center;
  padding: 14px; color: var(--gold); font-size: 13px; letter-spacing: 0.14em;
}
.stream-state .spinner {
  width: 13px; height: 13px; border: 1.5px solid rgba(200, 164, 92, 0.28); border-top-color: var(--gold);
  border-radius: 50%; animation: spin 0.85s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 段评批注 */
.para-notes { max-width: 820px; margin: 34px auto 0; padding-top: 20px; border-top: 1px solid var(--line); }
.para-notes h3 { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: 0.16em; margin: 0 0 14px; font-weight: 400; }
.note {
  display: grid; grid-template-columns: 3px 1fr; gap: 12px; margin-bottom: 12px;
  animation: rise 0.45s ease both;
}
.note-bar { background: var(--gold); border-radius: 2px; }
.note[data-mood='踩'] .note-bar { background: var(--seal); }
.note[data-mood='惑'] .note-bar { background: var(--jade); }
.note-quote { font-size: 12.5px; color: var(--gold); font-style: italic; line-height: 1.7; }
.note-text { font-size: 13px; color: var(--text); line-height: 1.85; margin-top: 4px; }
.note-who { font-family: var(--mono); font-size: 10px; color: var(--faint); margin-top: 4px; }
@keyframes rise { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

/* ------------------------------- 读者席 ------------------------------ */
.reader-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.rd {
  aspect-ratio: 1; border-radius: 2px; display: grid; place-items: center;
  font-family: var(--mono); font-size: 8.5px; color: var(--faint);
  background: rgba(255, 255, 255, 0.035); border: 1px solid transparent;
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.rd.reading { background: rgba(200, 164, 92, 0.16); border-color: var(--line-strong); color: var(--gold); animation: rdpop 1s infinite alternate; }
@keyframes rdpop { to { background: rgba(200, 164, 92, 0.34); } }
.rd.done { background: rgba(109, 157, 120, 0.14); border-color: rgba(109, 157, 120, 0.3); color: var(--jade); }
.rd.done.low { background: rgba(184, 66, 47, 0.16); border-color: rgba(184, 66, 47, 0.34); color: #d98a75; }
.rd.err { background: rgba(184, 66, 47, 0.1); color: var(--faint); }

.score-panel { display: flex; gap: 16px; align-items: center; }
.score-big { text-align: center; flex: none; padding-right: 16px; border-right: 1px solid var(--line); }
.score-big span { display: block; font-family: var(--display); font-size: 42px; font-weight: 700; color: var(--gold-bright); line-height: 1; }
.score-big small { font-size: 10px; color: var(--faint); letter-spacing: 0.12em; }
.dist-bars { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.drow { display: grid; grid-template-columns: 20px 1fr 26px; align-items: center; gap: 7px; font-family: var(--mono); font-size: 10px; color: var(--muted); }
.dtrack { height: 5px; background: rgba(255, 255, 255, 0.05); border-radius: 3px; overflow: hidden; }
.dfill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-bright)); border-radius: 3px; transition: width 0.5s ease; width: 0; }

.feed { display: flex; flex-direction: column; gap: 9px; max-height: 42vh; overflow-y: auto; padding-right: 4px; }
.feed-empty { font-size: 12px; color: var(--faint); text-align: center; padding: 26px 10px; line-height: 1.9; }
.cmt { animation: rise 0.5s ease both; padding: 9px 10px; border-radius: 3px; background: rgba(255, 255, 255, 0.026); border-left: 2px solid var(--line-strong); }
.cmt-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.cmt-name { font-size: 12.5px; color: var(--gold-bright); font-weight: 500; }
.cmt-role { font-size: 10px; color: var(--faint); }
.cmt-score { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--jade); }
.cmt-score.low { color: #d98a75; }
.cmt-text { font-size: 12.5px; line-height: 1.8; color: var(--text); margin-top: 5px; }
.cmt-para { font-size: 11.5px; color: var(--muted); margin-top: 6px; padding-left: 9px; border-left: 1px solid var(--line); line-height: 1.7; }
.cmt-para b { color: var(--gold); font-weight: 400; font-style: italic; }

.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translate(-50%, 20px);
  background: rgba(25, 22, 18, 0.97); border: 1px solid var(--line-strong); color: var(--gold-bright);
  padding: 12px 22px; border-radius: 3px; font-size: 13px; letter-spacing: 0.06em;
  opacity: 0; pointer-events: none; transition: all 0.3s ease; z-index: 200; box-shadow: var(--shadow);
  max-width: 80vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: rgba(184, 66, 47, 0.6); color: #f0a08c; }

.rules { margin: 0; padding-left: 16px; font-size: 11.5px; line-height: 1.95; color: var(--muted); }
.rules b { color: var(--gold); font-weight: 500; }

@media (max-width: 1400px) {
  .stage { grid-template-columns: 260px minmax(0, 1fr) 310px; }
}
@media (max-width: 1180px) {
  .stage { grid-template-columns: 1fr; }
  .col-left, .col-right { position: static; max-height: none; overflow: visible; }
  .reader-grid { grid-template-columns: repeat(20, 1fr); }
  .feed { max-height: 320px; }
  .topbar-stats { display: none; }
}