* {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --page-x: 12px;
  --bg: #f6f3ee;
  --surface: #fffdfa;
  --surface-quiet: #f0ece4;
  --ink: #25211c;
  --muted: #6f675e;
  --line: #ded7cd;
  --green: #0d7668;
  --blue: #315f99;
  --red: #a24034;
  --shadow: 0 10px 28px rgba(34, 28, 20, 0.08);
}

html {
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(13, 118, 104, 0.08), rgba(246, 243, 238, 0) 190px),
    var(--bg);
  font-family: "Avenir Next", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  font-weight: 500;
  line-height: 1.55;
}

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

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

.page {
  width: min(100%, 560px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px var(--page-x) 30px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  margin: -14px calc(var(--page-x) * -1) 14px;
  padding: 10px var(--page-x);
  background: rgba(246, 243, 238, 0.94);
  border-bottom: 1px solid rgba(222, 215, 205, 0.82);
  backdrop-filter: blur(12px);
}

.nav-row,
.action-row,
.chip-row,
.meta-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.nav-row {
  justify-content: space-between;
}

.brand {
  font-family: "Iowan Old Style", "Noto Serif CJK SC", "Songti SC", serif;
  font-size: 1.25rem;
  font-weight: 900;
}

.nav-link,
.button,
.chip,
.page-link {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.1;
}

.button.primary,
.chip.active,
.page-link.current {
  border-color: var(--green);
  background: var(--green);
  color: white;
}

.button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.button.ghost {
  background: transparent;
}

.button.compact {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.86rem;
}

.button.danger {
  border-color: rgba(162, 64, 52, 0.35);
  background: rgba(162, 64, 52, 0.08);
  color: var(--red);
}

.hero {
  margin: 14px 0 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
}

.title {
  margin: 0;
  font-family: "Iowan Old Style", "Noto Serif CJK SC", "Songti SC", serif;
  font-size: 1.9rem;
  font-weight: 900;
  line-height: 1.18;
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
}

.panel,
.card,
.reader-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 12px;
  margin-bottom: 12px;
}

.compact-panel {
  padding: 10px 12px;
}

.search-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-weight: 600;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--green);
  outline: 2px solid rgba(13, 118, 104, 0.16);
}

.textarea {
  min-height: 112px;
  resize: vertical;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field-label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.form-actions,
.card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.card-actions {
  margin-top: 8px;
}

.form-actions {
  padding-top: 2px;
}

.inline-form {
  display: inline-flex;
  margin: 0;
}

.collect-search-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.stack {
  display: grid;
  gap: 10px;
}

.section-title {
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 800;
}

.summary {
  width: 100%;
  list-style: none;
  cursor: pointer;
}

.summary::-webkit-details-marker {
  display: none;
}

.summary-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
}

.count-pill,
.tag,
.meta-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--surface-quiet);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.card {
  display: block;
  padding: 12px;
}

.novel-list {
  gap: 5px;
}

.novel-card {
  padding: 7px 8px;
  box-shadow: none;
}

.novel-card .card-title {
  font-size: 1.024rem;
  line-height: 1.22;
}

.novel-card .card-title.clamp-3 {
  -webkit-line-clamp: 2;
}

.novel-card .card-meta {
  margin-top: 4px;
  font-size: 0.896rem;
}

.novel-card .card-meta.stack {
  gap: 4px;
}

.novel-card .card-meta > .clamp-2 {
  -webkit-line-clamp: 1;
}

.novel-card .meta-row {
  gap: 4px;
}

.novel-card .meta-pill {
  min-height: 18px;
  padding: 1px 5px;
  border-radius: 6px;
  font-size: 0.848rem;
}

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

.favorite-home-card {
  min-width: 0;
}

.edit-actions {
  display: none;
}

.edit-mode .edit-actions {
  display: flex;
}

.card-title-link {
  display: block;
}

.card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.35;
  word-break: break-word;
}

.card-title.large {
  font-size: 1.18rem;
}

.card-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.note-text {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.mini-novel {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 250, 0.72);
}

.link-pill {
  border-color: rgba(13, 118, 104, 0.25);
  color: var(--green);
}

.error-panel {
  border-color: rgba(162, 64, 52, 0.36);
  background: rgba(162, 64, 52, 0.08);
  color: var(--red);
  font-weight: 700;
}

.success-panel {
  border-color: rgba(13, 118, 104, 0.28);
  background: rgba(13, 118, 104, 0.08);
  color: var(--green);
  font-weight: 700;
}

.clamp-2,
.clamp-3 {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
}

.clamp-2 {
  -webkit-line-clamp: 2;
}

.clamp-3 {
  -webkit-line-clamp: 3;
}

.media-card {
  padding: 0;
  overflow: hidden;
}

.media-cover {
  width: 100%;
  aspect-ratio: 4 / 5;
  display: block;
  object-fit: cover;
  background: var(--surface-quiet);
}

.media-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-family: "Iowan Old Style", "Noto Serif CJK SC", "Songti SC", serif;
  font-weight: 800;
}

.avatar {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-quiet);
  border: 1px solid var(--line);
}

.artist-line {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 10px;
  align-items: center;
}

.card-body {
  padding: 12px;
}

.compact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: start;
}

.pixiv-page .hero {
  margin: 10px 0 12px;
}

.pixiv-page .title {
  font-size: 1.58rem;
}

.pixiv-page .subtitle {
  font-size: 0.88rem;
}

.pixiv-page .panel {
  padding: 10px;
  margin-bottom: 10px;
}

.pixiv-page .input,
.pixiv-page .select {
  min-height: 38px;
  padding: 8px 10px;
  font-size: 0.9rem;
}

.pixiv-page .button,
.pixiv-page .chip,
.pixiv-page .page-link {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.86rem;
}

.pixiv-author-card {
  min-width: 0;
  padding: 9px;
}

.pixiv-author-card .artist-line {
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
}

.pixiv-author-card .avatar,
.compact-author-line .avatar {
  width: 36px;
  height: 36px;
}

.pixiv-author-card .card-title,
.compact-author-line .card-title {
  font-size: 0.9rem;
}

.pixiv-author-card .card-meta,
.pixiv-article-card .card-meta {
  margin-top: 6px;
}

.pixiv-author-card .meta-pill,
.pixiv-article-card .meta-pill,
.pixiv-article-card .tag {
  max-width: 100%;
  min-height: 21px;
  padding: 3px 6px;
  border-radius: 7px;
  font-size: 0.68rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.compact-account {
  display: inline-flex;
  max-width: 100%;
}

.compact-series-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.compact-series-link {
  min-width: 0;
  min-height: 28px;
  display: flex;
  align-items: center;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 250, 0.72);
  color: var(--ink);
  font-size: 0.76rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.pixiv-article-card {
  min-width: 0;
}

.pixiv-article-card .media-cover {
  aspect-ratio: 1 / 1;
  border-bottom: 1px solid var(--line);
}

.pixiv-article-card .card-body {
  padding: 9px;
}

.pixiv-article-card .card-title.large {
  font-size: 0.92rem;
  line-height: 1.32;
}

.pixiv-article-card .meta-row,
.pixiv-article-card .chip-row {
  gap: 5px;
}

.pixiv-article-card .chip-row {
  max-height: 23px;
  overflow: hidden;
}

.pixiv-article-card .tag {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compact-author-line {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}

.pagination {
  display: grid;
  gap: 7px;
  justify-content: center;
  align-items: center;
  margin-top: 16px;
}

.pagination-links,
.page-jump-form {
  display: flex;
  gap: 7px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.pagination .page-link {
  min-width: 34px;
  padding-left: 10px;
  padding-right: 10px;
}

.page-link.disabled {
  opacity: 0.46;
  pointer-events: none;
}

.page-jump-form {
  width: 100%;
  margin-top: 4px;
}

.page-jump-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.page-jump-input {
  width: 74px;
  min-height: 34px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  text-align: center;
}

.page-jump-input:focus {
  border-color: var(--green);
  outline: 2px solid rgba(13, 118, 104, 0.16);
}

.empty {
  padding: 24px 12px;
  color: var(--muted);
  text-align: center;
}

.reader-header {
  margin-bottom: 12px;
}

.reader-panel {
  padding: 16px 14px;
}

.reader-body {
  color: #211d18;
  font-family: "Microsoft YaHei", "微软雅黑", "Noto Sans CJK SC", sans-serif;
  font-size: 1.04rem;
  line-height: 1.95;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
}

.reader-body p {
  margin: 0 0 1em;
}

.reader-body img,
.inline-novel-image {
  width: 100%;
  height: auto;
  display: block;
  margin: 12px 0;
  border-radius: 8px;
}

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  height: 3px;
  background: transparent;
}

.reading-progress-bar {
  width: 100%;
  height: 100%;
  background: var(--green);
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
}

.caption-box {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-quiet);
  color: var(--muted);
  word-break: break-word;
}

.recommend-list {
  display: grid;
  gap: 8px;
}

.recommend-item {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.recommend-cover {
  width: 54px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--surface-quiet);
}

.hide {
  display: none;
}

@media (max-width: 380px) {
  :root {
    --page-x: 10px;
  }

  .title {
    font-size: 1.65rem;
  }

  .search-form {
    grid-template-columns: 1fr;
  }
}
