:root {
  --ink: #0e0c0a;
  --paper: #faf7f2;
  --cream: #f0ebe0;
  --gold: #c8952a;
  --gold-lt: #e8b84b;
  --rust: #8b3a2a;
  --sage: #4a6741;
  --mist: #d4d0c8;
  --text: #1c1a17;
  --dim: #6b6560;
  --card: #fff;
  --shadow-sm: 0 2px 8px rgba(14, 12, 10, 0.08);
  --shadow-md: 0 6px 24px rgba(14, 12, 10, 0.14);
  --shadow-lg: 0 16px 48px rgba(14, 12, 10, 0.18);
  --r: 6px;
  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'DM Sans', system-ui, sans-serif;
  --ease: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

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

img {
  display: block;
  max-width: 100%;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Section divider */
.sec-divider {
  border: none;
  border-top: 1px solid var(--mist);
  margin: 0;
}

/* Section header */
.sec-hd {
  max-width: 1200px;
  margin: 0 auto;
  padding: 52px 24px 24px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.sec-hd h2 {
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 700;
}

.sec-hd a {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold);
  transition: color var(--ease);
}

.sec-hd a:hover {
  color: var(--rust);
}

/* Skeleton animation */
.sk {
  background: linear-gradient(90deg, var(--cream) 25%, var(--paper) 50%, var(--cream) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 4px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Toast */
.toast-ct {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 999;
}

.toast {
  padding: 11px 18px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  animation: fadeUp 0.3s ease;
  max-width: 300px;
}

.toast-ok {
  background: #2ec27e;
  color: #000;
}

.toast-err {
  background: #e05050;
  color: #fff;
}

.toast-info {
  background: var(--ink);
  color: var(--paper);
}

/* Hero section */
.hero {
  max-width: 1200px;
  margin: 0 auto;
  padding: 72px 24px 56px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
}

.hero-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 14px;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.1;
  font-weight: 900;
  margin-bottom: 18px;
}

.hero h1 em {
  font-style: italic;
  color: var(--gold);
}

.hero-sub {
  font-size: 1rem;
  color: var(--dim);
  line-height: 1.75;
  max-width: 480px;
  margin-bottom: 32px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-primary {
  padding: 12px 26px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  border-radius: var(--r);
  cursor: pointer;
  transition: background var(--ease), transform var(--ease);
}

.btn-primary:hover {
  background: var(--rust);
  transform: translateY(-2px);
}

.btn-outline {
  padding: 12px 26px;
  background: transparent;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 600;
  border: 1.5px solid var(--mist);
  border-radius: var(--r);
  cursor: pointer;
  transition: all var(--ease);
}

.btn-outline:hover {
  border-color: var(--ink);
  transform: translateY(-2px);
}

/* Featured card */
.featured-card {
  background: var(--card);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  transition: transform var(--ease), box-shadow var(--ease);
}

.featured-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 24px 64px rgba(14, 12, 10, 0.22);
}

.fc-cover {
  height: 240px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1208, #3d2b0f);
}

.fc-letter {
  font-family: var(--serif);
  font-size: 5rem;
  font-weight: 900;
  font-style: italic;
  color: rgba(255, 255, 255, 0.1);
}

.fc-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  background: var(--gold);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.fc-body {
  padding: 22px;
}

.fc-genre {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sage);
  margin-bottom: 6px;
}

.fc-title {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.fc-author {
  font-size: 0.8rem;
  color: var(--dim);
  margin-bottom: 12px;
}

.fc-meta {
  display: flex;
  gap: 16px;
  font-size: 0.76rem;
  color: var(--dim);
}

.fc-meta strong {
  color: var(--text);
}

/* Novel grid */
.novel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 24px;
  padding-bottom: 60px;
}

/* Novel card */
.novel-card {
  background: var(--card);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform var(--ease), box-shadow var(--ease);
  animation: fadeUp 0.55s ease both;
}

.novel-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
}

.card-cover {
  height: 195px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-letter {
  font-family: var(--serif);
  font-size: 3.5rem;
  font-style: italic;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.15);
}

.card-status {
  position: absolute;
  bottom: 10px;
  left: 10px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 3px;
  letter-spacing: 0.05em;
}

.s-ongoing { background: var(--sage); color: #fff; }
.s-completed { background: var(--gold); color: #fff; }
.s-hiatus { background: var(--rust); color: #fff; }

.card-body {
  padding: 16px;
}

.card-genre {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 5px;
}

.card-title {
  font-family: var(--serif);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-author {
  font-size: 0.76rem;
  color: var(--dim);
  margin-bottom: 10px;
}

.card-stats {
  display: flex;
  gap: 12px;
  font-size: 0.72rem;
  color: var(--dim);
  border-top: 1px solid var(--cream);
  padding-top: 10px;
}

.card-stats strong {
  color: var(--text);
}

/* Chapter list */
.ch-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  padding-bottom: 80px;
}

.ch-item {
  background: var(--card);
  border-radius: 8px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  border-left: 3px solid var(--gold);
  cursor: pointer;
  transition: all var(--ease);
  animation: fadeUp 0.5s ease both;
}

.ch-item:hover {
  border-left-color: var(--rust);
  transform: translateX(3px);
  box-shadow: var(--shadow-md);
}

.ch-novel {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 4px;
}

.ch-title {
  font-family: var(--serif);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 5px;
}

.ch-meta {
  font-size: 0.73rem;
  color: var(--dim);
  display: flex;
  gap: 12px;
}

/* Continue reading */
.continue-grid {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 8px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.continue-card {
  background: var(--card);
  border-radius: 8px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 14px;
  align-items: center;
  cursor: pointer;
  border-left: 3px solid var(--gold);
  transition: transform var(--ease), box-shadow var(--ease);
}

.continue-card:hover {
  transform: translateX(3px);
  box-shadow: var(--shadow-md);
}

.cc-thumb {
  width: 44px;
  height: 60px;
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 1.4rem;
  font-style: italic;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.2);
}

.cc-info .novel-name {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 4px;
}

.cc-info .chap-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

.cc-info .time-ago {
  font-size: 0.72rem;
  color: var(--dim);
  margin-top: 4px;
}

/* Continue section */
#continue-section {
  display: none;
}

#continue-section.visible {
  display: block;
}

/* Auth modal */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(10, 8, 6, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ease);
}

.overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal-box {
  background: #17140f;
  border: 1px solid rgba(200, 149, 42, 0.25);
  border-radius: 14px;
  width: 100%;
  max-width: 420px;
  padding: 36px;
  transform: translateY(20px);
  transition: transform var(--ease);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6);
  position: relative;
}

.overlay.open .modal-box {
  transform: translateY(0);
}

.modal-brand {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 900;
  color: #fff;
  text-align: center;
  margin-bottom: 4px;
}

.modal-brand span {
  color: var(--gold);
}

.modal-sub {
  text-align: center;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 28px;
}

.auth-tabs {
  display: flex;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  margin-bottom: 28px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--sans);
  transition: all var(--ease);
}

.auth-tab.active {
  background: var(--gold);
  color: #000;
}

.auth-panel {
  display: none;
}

.auth-panel.active {
  display: block;
}

.auth-field {
  margin-bottom: 16px;
}

.auth-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.auth-field input {
  width: 100%;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #fff;
  font-family: var(--sans);
  font-size: 0.9rem;
  padding: 11px 14px;
  outline: none;
  transition: border-color var(--ease);
}

.auth-field input:focus {
  border-color: var(--gold);
}

.auth-field input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.auth-submit {
  width: 100%;
  padding: 13px;
  background: var(--gold);
  color: #000;
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 700;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 8px;
  transition: background var(--ease);
}

.auth-submit:hover {
  background: var(--gold-lt);
}

.auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-error {
  color: #ff7070;
  font-size: 0.8rem;
  text-align: center;
  margin-top: 10px;
  min-height: 20px;
}

.modal-close-x {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close-x:hover {
  color: #fff;
}

/* Novel detail page */
.page-header {
  padding: 48px 0 32px;
  border-bottom: 1px solid var(--mist);
  margin-bottom: 0;
}

.page-header h1 {
  font-family: var(--serif);
  font-size: 2.2rem;
  font-weight: 900;
  margin-bottom: 8px;
}

.page-subtitle {
  color: var(--dim);
  font-size: 1rem;
}

.novel-header {
  padding: 24px 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--dim);
  margin-bottom: 20px;
  transition: color var(--ease);
}

.back-link:hover {
  color: var(--gold);
}

.novel-main {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 40px;
}

.novel-cover-large {
  width: 200px;
  height: 280px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 4rem;
  font-style: italic;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.novel-info {
  flex: 1;
}

.novel-genre {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}

.novel-title {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 4px;
  line-height: 1.2;
}

.novel-title-cn {
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--dim);
  margin-bottom: 12px;
}

.novel-meta {
  font-size: 0.85rem;
  color: var(--dim);
  margin-bottom: 20px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.novel-meta strong {
  color: var(--text);
}

.novel-description {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 24px;
}

.btn-read {
  display: inline-block;
  padding: 12px 28px;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--r);
  font-weight: 600;
  transition: background var(--ease), transform var(--ease);
}

.btn-read:hover {
  background: var(--rust);
  transform: translateY(-2px);
}

.chapters-section {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--mist);
}

.chapters-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 20px;
}

.chapters-header h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 700;
}

.chapters-count {
  font-size: 0.85rem;
  color: var(--dim);
}

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

.chapter-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--card);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--ease);
  border-left: 3px solid transparent;
}

.chapter-entry:hover {
  border-left-color: var(--gold);
  transform: translateX(4px);
  box-shadow: var(--shadow-md);
}

.chapter-entry-title {
  font-weight: 500;
}

.chapter-entry-num {
  font-family: var(--serif);
  font-size: 0.9rem;
  color: var(--gold);
  margin-right: 12px;
}

.chapter-entry-meta {
  font-size: 0.78rem;
  color: var(--dim);
  display: flex;
  gap: 12px;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }

  .sec-hd {
    padding: 36px 16px 16px;
  }

  .sec-hd h2 {
    font-size: 1.4rem;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 36px;
    padding: 48px 16px 36px;
  }

  .hero-visual {
    display: none;
  }

  .novel-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .ch-list {
    grid-template-columns: 1fr;
  }

  .novel-main {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .novel-cover-large {
    width: 100%;
    max-width: 200px;
    margin: 0 auto;
  }
}
