:root {
  color-scheme: light;
  --paper: #f6f3eb;
  --ink: #252c28;
  --muted: #5c6359;
  --green: #24463c;
  --moss: #dce5d4;
  --line: #d9d8ca;
  --serif: "Noto Serif CJK SC", "Songti SC", "SimSun", serif;
  --sans: system-ui, "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); }
a { color: inherit; text-underline-offset: .25em; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid #517c56; outline-offset: 4px; }
[hidden] { display: none !important; }
.wrap { width: min(100% - 3rem, 70rem); margin-inline: auto; }
.masthead { border-bottom: 1px solid var(--line); }
.masthead .wrap { min-height: 4rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { font-family: var(--serif); font-weight: 700; text-decoration: none; }
.masthead nav { font-size: .88rem; color: var(--muted); flex: none; }
.masthead nav a { text-decoration: none; }
.masthead nav a:hover { text-decoration: underline; }

.hero {
  overflow: hidden;
  position: relative;
  isolation: isolate;
  padding: clamp(3.25rem, 8vw, 6.5rem) clamp(1.5rem, 7vw, 5.25rem);
  margin-top: clamp(1.4rem, 4vw, 3rem);
  background: radial-gradient(ellipse at 89% 111%, #4b6350, transparent 55%), #243f37;
  color: #fbf4e2;
  border-radius: 1.2rem;
}
.hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 50%;
  right: -3%;
  width: clamp(12rem, 38vw, 28rem);
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translateY(-50%);
  background: repeating-radial-gradient(circle, transparent 0 1.35rem, #e7ebbf27 1.36rem 1.4rem);
  mask-image: linear-gradient(100deg, transparent 2%, black 62%);
}
.hero h1 { max-width: 16ch; margin: 0; font: 700 clamp(2.15rem, 5.8vw, 4.25rem)/1.25 var(--serif); text-wrap: balance; }
.hero p { color: #e0e8d3; margin: 1rem 0 0; line-height: 1.8; }
.hero .read-link { display: inline-block; margin-top: 1.65rem; background: #ece9d2; color: #233e35; padding: .65rem 1.1rem; border-radius: .5rem; font-weight: 650; text-decoration: none; }
.hero .read-link:hover { background: #fff5d7; }
.catalog { padding-block: clamp(2.3rem, 6vw, 4.5rem); }
.catalog h2 { margin: 0 0 .85rem; font: 700 1.6rem var(--serif); }
.catalog ol { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.catalog a { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem; padding: 1.2rem .65rem; text-decoration: none; border-bottom: 1px solid var(--line); }
.catalog a:hover { background: #ecefe3; }
.catalog .number, .catalog time { color: var(--muted); font-size: .85rem; }
.chapter-name { font-size: 1.05rem; font-weight: 650; }
.catalog .empty { color: var(--muted); }

.chapter-layout {
  display: grid;
  grid-template-columns: minmax(0, 45rem) minmax(9rem, 13rem);
  gap: clamp(2.5rem, 7vw, 6rem);
  margin-block: clamp(2.35rem, 7vw, 5rem);
  align-items: start;
}
.chapter-layout > article { min-width: 0; }
.chapter-heading { padding-bottom: 1.9rem; border-bottom: 1px solid var(--line); margin-bottom: 2.2rem; }
.chapter-meta { font-size: .82rem; color: var(--muted); margin: 0 0 .7rem; }
.chapter-heading h1 { margin: 0; font: 700 clamp(2.15rem, 5.2vw, 3.7rem)/1.25 var(--serif); }
.scenes { position: sticky; align-self: start; top: 1.5rem; border-left: 1px solid var(--line); padding-left: 1.2rem; }
.scenes h2 { margin: 0 0 .55rem; font-size: .86rem; }
.scenes ol { list-style: none; padding: 0; margin: 0; }
.scenes a { display: block; padding: .38rem 0; color: var(--muted); font-size: .86rem; text-decoration: none; }
.scenes a:hover { color: var(--green); text-decoration: underline; }
.scene { scroll-margin-top: 1rem; }
.scene + .scene { margin-top: 3.3rem; border-top: 1px solid var(--line); padding-top: 2.3rem; }
.scene h2 { margin: 0 0 .55rem; font: 700 1.35rem var(--serif); }
.scene .stamp { font: .83rem/1.7 var(--sans); color: var(--muted); margin: 0 0 1.25rem; }
.prose { font: clamp(1.07rem, 2vw, 1.2rem)/1.95 var(--serif); overflow-wrap: anywhere; }
.prose p { margin: 0 0 1em; }
.prose a { color: var(--green); }
.prose img { max-width: 100%; height: auto; border-radius: .5rem; }
.prose blockquote { margin: .8rem 0; padding-left: 1rem; border-left: 2px solid #9aaa8f; }
.prose .story-card {
  padding: .65rem .9rem;
  margin: 1.25rem 0;
  border: 1px solid #d1dac9;
  border-radius: .65rem;
  background: #ecf0e5;
  font: .95rem/1.75 var(--sans);
}
.reading-paragraph {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: .45rem;
  scroll-margin-top: 1rem;
}
.comment-trigger {
  border: 1px solid #d1dac9;
  border-radius: .5rem;
  background: #eef0e5;
  color: var(--green);
  font: 600 .8rem/1 var(--sans);
  cursor: pointer;
}
.comment-trigger:hover { background: var(--moss); }
.paragraph-comment {
  min-width: 1.65rem;
  min-height: 1.65rem;
  padding: .32rem;
  margin-top: .35rem;
}
.chapter-comment { margin-top: 1rem; padding: .55rem .72rem; }
.comments-dialog {
  padding: 0;
  border: 1px solid #bdcbb9;
  border-radius: 1rem;
  width: min(calc(100% - 2rem), 39rem);
  max-height: min(86dvh, 49rem);
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1rem 4rem #1d29242a;
}
.comments-dialog[open] { display: flex; flex-direction: column; }
.comments-dialog::backdrop { background: #17231f80; }
.comments-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1.15rem;
  border-bottom: 1px solid var(--line);
}
.comments-heading h2 { margin: 0; font: 700 1.15rem var(--serif); }
.comments-close, .comments-retry, .comments-more {
  background: transparent;
  border: 0;
  padding: .45rem;
  color: var(--green);
  cursor: pointer;
  font: inherit;
}
.comments-close { font-size: 1.4rem; line-height: 1; }
.comments-context {
  display: -webkit-box;
  margin: .75rem 1.15rem .3rem;
  padding-left: .7rem;
  border-left: 2px solid #9aaa8f;
  color: var(--muted);
  font: .9rem/1.55 var(--serif);
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.comments-feed { min-height: 0; overflow: auto; padding: .25rem 1.15rem .65rem; }
.comments-message { margin: .65rem 0; color: var(--muted); font-size: .9rem; }
.comments-message:empty { display: none; }
.comments-list { list-style: none; margin: 0; padding: 0; }
.comments-list li { padding: .8rem 0; border-bottom: 1px solid var(--line); }
.comment-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .6rem; font-size: .78rem; }
.comment-meta strong { overflow-wrap: anywhere; }
.comment-meta time, .comment-meta span { color: var(--muted); }
.comment-meta a { color: var(--green); }
.comment-text { margin: .36rem 0 0; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.comments-form { padding: .75rem 1.15rem; border-top: 1px solid var(--line); background: #edeee3; }
.comments-form label { display: block; margin-bottom: .55rem; font-size: .83rem; }
.comments-form input, .comments-form textarea {
  display: block;
  width: 100%;
  margin-top: .22rem;
  padding: .4rem .55rem;
  border: 1px solid #bec9b9;
  border-radius: .4rem;
  background: #fbfaf4;
  color: inherit;
  font: inherit;
  font-size: 1rem;
}
.comments-form textarea { resize: vertical; max-height: 18dvh; }
.comments-form-footer { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.comments-form-footer p { margin: 0; color: var(--muted); font-size: .8rem; }
.comments-form button {
  padding: .45rem .85rem;
  border: 0;
  border-radius: .4rem;
  background: var(--green);
  color: white;
  font: inherit;
  cursor: pointer;
  flex: none;
}
.comments-form button:disabled { opacity: .6; cursor: wait; }
.story-card summary, .status summary { width: fit-content; cursor: pointer; font-weight: 650; }
.story-card summary::marker, .status summary::marker { color: #4a6b4e; }
.story-card .card-body { margin-top: .6rem; }
.story-card .card-body > :last-child { margin-bottom: 0; }
.skill { color: var(--green); }

.status { margin-top: 1.55rem; padding: .85rem 1rem; background: #e6ebdf; border: 1px solid #ccd8c7; border-radius: .65rem; }
.tabbar { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .75rem; }
.tabbar button { cursor: pointer; border: 0; border-radius: .4rem; padding: .42rem .7rem; color: var(--green); background: transparent; font: inherit; font-size: .84rem; }
.tabbar button:hover { background: #dbe5d6; }
.tabbar [aria-selected="true"] { color: #fff; background: var(--green); }
.tabbar [aria-selected="true"]:hover { background: #31594b; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); gap: .6rem 1rem; margin: .85rem 0 .2rem; }
.stats div { min-width: 0; padding: .4rem 0; border-top: 1px solid #cbd5c5; }
.stats dt { color: var(--muted); font-size: .76rem; }
.stats dd { margin: .22rem 0 0; font-size: .9rem; overflow-wrap: anywhere; }
.chapter-nav { border-top: 1px solid var(--line); display: flex; justify-content: space-between; flex-wrap: wrap; gap: .8rem; margin-top: 3rem; padding-top: 1rem; color: var(--green); font-size: .9rem; }
.standalone { display: block; width: 100%; min-height: 75vh; border: 1px solid var(--line); border-radius: .6rem; background: white; }

@media (max-width: 47rem) {
  .wrap { width: calc(100% - 2rem); }
  .chapter-layout { display: flex; flex-direction: column; gap: 1.4rem; }
  .chapter-layout > article { width: 100%; }
  .scenes { position: static; order: -1; border: 0; padding: 0; }
  .scenes ol { display: flex; flex-wrap: wrap; gap: .3rem .85rem; }
  .paragraph-comment { min-width: 1.9rem; min-height: 1.9rem; }
  .comments-dialog { margin: auto auto 0; width: 100%; max-width: 100%; max-height: 90dvh; border-radius: .85rem .85rem 0 0; }
}
