:root {
  --bg: #faf8f5;
  --paper: #fffef9;
  --ink: #2c2824;
  --muted: #6b6560;
  --accent: #8b6914;
  --line: #e8e4dc;
  --main: #3d5a4a;
  --side: #5c6b7a;
  --btn-bg: #eae6df;
  --btn-border: #d4cfc4;
}

[data-theme="dark"] {
  --bg: #1a1917;
  --paper: #242220;
  --ink: #eae6e0;
  --muted: #9a948c;
  --accent: #d4a84b;
  --line: #3d3a36;
  --main: #7d9e8c;
  --side: #8fa0b0;
  --btn-bg: #33302c;
  --btn-border: #4a4640;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Source Han Sans SC", "Noto Sans SC", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  transition: background-color 0.2s ease, color 0.2s ease;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--ink);
}

[data-theme="dark"] a:hover {
  color: #fff;
}

.wrap {
  max-width: 42rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.site-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.site-brand {
  flex: 1;
  min-width: 12rem;
}

.theme-toggle {
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  cursor: pointer;
  color: var(--ink);
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  filter: brightness(1.05);
}

.theme-toggle svg {
  width: 1.35rem;
  height: 1.35rem;
}

.theme-toggle .theme-icon {
  display: none;
}

html[data-theme="light"] .theme-toggle .theme-icon--sun {
  display: block;
}

html[data-theme="light"] .theme-toggle .theme-icon--moon {
  display: none;
}

html[data-theme="dark"] .theme-toggle .theme-icon--sun {
  display: none;
}

html[data-theme="dark"] .theme-toggle .theme-icon--moon {
  display: block;
}

header.site {
  border-bottom: 1px solid var(--line);
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
}

header.site h1 {
  margin: 0 0 0.35rem;
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

header.site .tag {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

section.block {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.25rem;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

section.block h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
}

section.block .placeholder {
  margin: 0;
  color: var(--muted);
  font-style: italic;
}

.prose p {
  margin: 0 0 0.85rem;
}

.prose p:last-child {
  margin-bottom: 0;
}

.world-figure {
  margin: 1rem 0;
}

.world-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.source-note {
  margin: 1rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

nav.toc {
  margin-top: 0.75rem;
  width: 100%;
}

nav.toc a {
  margin-right: 1rem;
  font-size: 0.9rem;
}

.work-group-title {
  margin: 0.35rem 0 0.4rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.03em;
}

section.block .work-group-title:first-of-type {
  margin-top: 0.15rem;
}

.work-split {
  margin: 1rem 0;
  border: none;
  border-top: 1px solid var(--line);
}

.work-list {
  list-style: none;
  margin: 0 0 0.15rem;
  padding: 0;
}

.work-list li {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem 0.85rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
}

.work-list li:first-child {
  padding-top: 0;
}

.work-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.work-tag {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.6rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.2;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.work-tag--main {
  color: var(--main);
  border-color: color-mix(in srgb, var(--main) 45%, var(--line));
  background: color-mix(in srgb, var(--main) 14%, transparent);
}

.work-tag--side {
  color: var(--side);
  border-color: color-mix(in srgb, var(--side) 45%, var(--line));
  background: color-mix(in srgb, var(--side) 14%, transparent);
}

.note {
  margin: 1rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* 角色卡轮播 */
.carousel {
  position: relative;
  margin: 0.5rem 0 1rem;
}

.carousel-viewport {
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg);
}

.carousel-track {
  display: flex;
  transition: transform 0.35s ease;
}

.carousel-slide {
  flex: 0 0 100%;
  margin: 0;
}

.carousel-slide img {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}

.carousel-prev,
.carousel-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink);
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: 50%;
  opacity: 0.92;
}

.carousel-prev:hover,
.carousel-next:hover {
  opacity: 1;
}

.carousel-prev {
  left: 0.35rem;
}

.carousel-next {
  right: 0.35rem;
}

.carousel-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin-top: 0.65rem;
}

.carousel-dot {
  width: 0.5rem;
  height: 0.5rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--line);
  cursor: pointer;
}

.carousel-dot.is-active,
.carousel-dot[aria-selected="true"] {
  background: var(--accent);
}

.char-caption {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.char-link {
  margin: 0;
  font-size: 0.95rem;
}

footer.site {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--muted);
}
