:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-2: #eef2f5;
  --ink: #20242a;
  --muted: #66707c;
  --line: #d9dee5;
  --green: #2f9b70;
  --blue: #2478c7;
  --coral: #c75b52;
  --gold: #b9862d;
  --shadow: 0 14px 34px rgba(32, 36, 42, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, rgba(47, 155, 112, 0.10), transparent 28rem),
    radial-gradient(circle at 95% 15%, rgba(199, 91, 82, 0.09), transparent 26rem),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 56px;
}

.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 24px;
  min-height: 310px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #172522;
  margin-bottom: 18px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(14, 18, 22, 0.82), rgba(14, 18, 22, 0.30) 58%, rgba(14, 18, 22, 0.10)),
    linear-gradient(0deg, rgba(14, 18, 22, 0.72), transparent 62%);
}

.hero-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-content,
.hero .refresh-button {
  position: relative;
  z-index: 1;
}

.hero-content {
  max-width: 680px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: 38px;
  line-height: 1.12;
  letter-spacing: 0;
}

.hero h1 {
  color: #ffffff;
  font-size: 48px;
}

.hero-copy {
  margin: 12px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 17px;
}

.hero-note {
  display: inline-flex;
  max-width: 100%;
  margin: 14px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.92);
  padding: 8px 10px;
  font-size: 14px;
  line-height: 1.45;
}

.refresh-button {
  min-width: 84px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 10px 14px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(32, 36, 42, 0.06);
}

.hero .refresh-button {
  background: rgba(255, 255, 255, 0.94);
}

.refresh-button:hover {
  border-color: var(--green);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  padding: 16px;
}

.stat-value {
  display: block;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.stat-label {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) repeat(3, minmax(150px, 0.6fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
}

.toolbar label {
  display: grid;
  gap: 6px;
}

.toolbar span {
  color: var(--muted);
  font-size: 12px;
}

.toolbar input,
.toolbar select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

.toolbar input:focus,
.toolbar select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 155, 112, 0.14);
}

.status-line {
  min-height: 28px;
  margin: 10px 2px 16px;
  color: var(--muted);
  font-size: 14px;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.book-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.cover-link {
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  text-decoration: none;
  cursor: pointer;
}

.cover-wrap {
  position: relative;
  height: 250px;
  background:
    linear-gradient(135deg, rgba(36, 120, 199, 0.12), rgba(47, 155, 112, 0.10)),
    var(--panel-2);
}

.cover {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.cover-fallback {
  display: none;
  width: 100%;
  height: 100%;
  background:
    linear-gradient(135deg, rgba(199, 91, 82, 0.24), rgba(185, 134, 45, 0.18)),
    var(--panel-2);
}

.book-body {
  padding: 14px;
}

.book-title-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
}

.book-title {
  margin: 0;
  min-height: 48px;
  font-size: 16px;
  line-height: 1.45;
  letter-spacing: 0;
}

.book-author {
  margin: 6px 0 12px;
  color: var(--muted);
  font-size: 13px;
  min-height: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-badge {
  border-radius: 999px;
  padding: 4px 8px;
  color: #ffffff;
  font-size: 12px;
  white-space: nowrap;
  background: var(--muted);
}

.status-badge[data-status="读完"] {
  background: var(--green);
}

.status-badge[data-status="在读"] {
  background: var(--blue);
}

.status-badge[data-status="未读"] {
  background: var(--muted);
}

.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.progress-text {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.progress-ring {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: conic-gradient(var(--green) var(--progress), #dfe5eb 0);
  position: relative;
}

.progress-ring::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--panel);
}

.category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 26px;
}

.category {
  max-width: 100%;
  border-radius: 6px;
  background: rgba(185, 134, 45, 0.16);
  color: #6f501a;
  padding: 4px 7px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.empty {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 36px;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20;
}

.modal[data-open="true"] {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 12%, rgba(47, 155, 112, 0.18), transparent 28rem),
    rgba(14, 18, 22, 0.66);
  backdrop-filter: blur(10px);
}

.detail-panel {
  position: absolute;
  inset: 26px max(26px, calc((100vw - 1380px) / 2));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 247, 249, 0.98)),
    var(--panel);
  box-shadow: 0 28px 84px rgba(14, 18, 22, 0.38);
  padding: 26px;
}

.modal-close {
  position: sticky;
  top: 0;
  float: right;
  z-index: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  padding: 9px 13px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(32, 36, 42, 0.08);
}

.detail-header {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  margin-bottom: 20px;
  padding: 4px 52px 8px 0;
}

.detail-cover-wrap {
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  box-shadow: 0 18px 38px rgba(32, 36, 42, 0.16);
}

.detail-cover {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.detail-heading h2 {
  margin: 12px 0 10px;
  max-width: 780px;
  font-size: 34px;
  line-height: 1.2;
  letter-spacing: 0;
}

.detail-heading p {
  margin: 0 0 14px;
  color: var(--muted);
}

.detail-progress-card {
  width: min(100%, 440px);
  margin: 16px 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 12px;
}

.detail-progress {
  justify-content: flex-start;
  margin-bottom: 10px;
}

.detail-progress span:first-child {
  color: var(--muted);
  font-size: 13px;
}

.detail-progress-track {
  overflow: hidden;
  height: 9px;
  border-radius: 999px;
  background: #dfe5eb;
}

.detail-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), #68c6a0);
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.detail-actions a {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  padding: 9px 12px;
  text-decoration: none;
  background: var(--panel);
}

.detail-actions a:hover {
  border-color: var(--green);
}

.detail-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
  margin-bottom: 20px;
  color: var(--muted);
}

.detail-meta span {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  padding: 12px;
}

.detail-meta strong {
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.detail-meta small {
  color: var(--muted);
  font-size: 12px;
}

.detail-notes {
  display: grid;
  gap: 14px;
  max-width: 980px;
  margin-top: 6px;
}

.notes-overview {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(47, 155, 112, 0.10), rgba(36, 120, 199, 0.08)),
    rgba(255, 255, 255, 0.88);
  padding: 18px;
}

.notes-overview-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.section-kicker {
  display: block;
  margin-bottom: 6px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.notes-overview h3 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

.notes-overview p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.note-filter {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.note-filter button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  padding: 8px 11px;
  cursor: pointer;
}

.note-filter button[data-active="true"] {
  border-color: rgba(47, 155, 112, 0.46);
  background: var(--green);
  color: #ffffff;
}

.notes-overview-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.notes-overview-stats span {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(217, 222, 229, 0.78);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
  padding: 10px;
}

.notes-overview-stats strong {
  font-size: 22px;
  line-height: 1;
}

.notes-overview-stats small {
  color: var(--muted);
  font-size: 12px;
}

.note-block {
  border-radius: 8px;
}

.note-block[data-note-kind="heading"] {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.note-block[data-note-kind="heading"]::before {
  content: "";
  width: 22px;
  height: 2px;
  border-radius: 999px;
  background: var(--green);
}

.note-block h3,
.note-block h4 {
  margin: 10px 0 4px;
  line-height: 1.35;
  letter-spacing: 0;
}

.note-block p {
  margin: 0;
  line-height: 1.8;
}

.note-callout,
.note-quote,
.note-paragraph {
  padding: 16px 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 24px rgba(32, 36, 42, 0.06);
}

.note-callout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  border-color: rgba(36, 120, 199, 0.20);
  background: linear-gradient(90deg, rgba(36, 120, 199, 0.08), rgba(255, 255, 255, 0.86));
}

.note-quote {
  border-left: 5px solid var(--green);
  color: #3a434d;
  background: linear-gradient(90deg, rgba(47, 155, 112, 0.08), rgba(255, 255, 255, 0.86));
}

.note-paragraph {
  border-left: 5px solid rgba(139, 99, 219, 0.62);
}

.note-icon {
  line-height: 1.8;
  font-size: 18px;
}

.note-label {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border-radius: 999px;
  background: rgba(32, 36, 42, 0.06);
  color: var(--muted);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 700;
}

.note-callout .note-label {
  grid-column: 2;
}

.note-callout p {
  grid-column: 2;
}

.note-quote .note-label,
.note-paragraph .note-label {
  margin-bottom: 8px;
}

.note-divider {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
}

.detail-notes[data-filter="highlight"] .note-block:not([data-note-kind="highlight"]),
.detail-notes[data-filter="highlight"] .note-divider,
.detail-notes[data-filter="thought"] .note-block:not([data-note-kind="thought"]),
.detail-notes[data-filter="thought"] .note-divider {
  display: none;
}

@media (max-width: 820px) {
  .shell {
    width: min(100% - 22px, 720px);
    padding-top: 24px;
  }

  .topbar {
    align-items: start;
    flex-direction: column;
  }

  .hero {
    grid-template-columns: 1fr;
    align-items: end;
    min-height: 280px;
    padding: 22px;
  }

  h1 {
    font-size: 30px;
  }

  .hero h1 {
    font-size: 34px;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    inset: 10px;
    padding: 16px;
  }

  .detail-header {
    grid-template-columns: 1fr;
    padding-right: 0;
  }

  .detail-cover-wrap {
    width: min(220px, 70vw);
  }

  .detail-meta,
  .notes-overview-stats {
    grid-template-columns: 1fr;
  }

  .notes-overview-header {
    flex-direction: column;
  }

  .note-filter {
    justify-content: flex-start;
  }
}

@media (max-width: 520px) {
  .book-grid {
    grid-template-columns: 1fr;
  }

  .cover-wrap {
    height: 300px;
  }
}
