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

body {
  font-family: "Georgia", "Times New Roman", serif;
  background-color: #1a1a2e;
  color: #e0e0e0;
  min-height: 100vh;
}

.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 60px 24px;
  max-width: 800px;
  margin: 0 auto;
}

.header {
  text-align: center;
  margin-bottom: 40px;
}

.header h1 {
  font-size: 3rem;
  font-weight: 300;
  letter-spacing: 2px;
  color: #ffffff;
  margin-bottom: 8px;
}

.subtitle {
  font-size: 1.1rem;
  color: #a0a0b0;
  font-style: italic;
  letter-spacing: 1px;
}

.welcome-text {
  max-width: 560px;
  text-align: center;
  margin-bottom: 60px;
}

.welcome-text p {
  font-size: 1.1rem;
  line-height: 1.8;
  color: #c0c0d0;
}

.works-section {
  width: 100%;
  max-width: 560px;
}

.works-section h2 {
  font-size: 1.4rem;
  font-weight: 400;
  color: #ffffff;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid #333355;
  letter-spacing: 1px;
}

.works-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.work-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: #16213e;
  border: 1px solid #2a2a4a;
  border-radius: 8px;
  text-decoration: none;
  color: #e0e0e0;
  transition:
    background 0.2s,
    border-color 0.2s,
    transform 0.2s;
}

.work-card:hover {
  background: #1f2f50;
  border-color: #4a4a7a;
  transform: translateY(-2px);
}

.work-icon {
  font-size: 1.8rem;
}

.work-title {
  flex: 1;
  font-size: 1.1rem;
  font-weight: 400;
}

.work-format {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #808090;
  background: #2a2a4a;
  padding: 4px 10px;
  border-radius: 4px;
}

.footer {
  margin-top: 80px;
  text-align: center;
}

.footer p {
  font-size: 0.85rem;
  color: #606070;
}

@media screen and (max-width: 600px) {
  .header h1 {
    font-size: 2rem;
  }

  .container {
    padding: 40px 16px;
  }

  .work-card {
    padding: 16px;
  }
}

/* Reader layout */
.reader {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: #1a1a2e;
  transition:
    background-color 0.3s,
    color 0.3s;
}

.reader.light-mode {
  background-color: #f5f0e8;
}

.reader.light-mode .reader-nav {
  background: #ede8df;
  border-bottom-color: #d0c8b8;
}

.reader.light-mode .back-btn {
  color: #555;
}

.reader.light-mode .back-btn:hover {
  background: #d8d0c4;
  color: #222;
}

.reader.light-mode .book-title {
  color: #333;
}

.reader.light-mode .chapter-indicator {
  color: #666;
}

.reader.light-mode .chapter-content p {
  color: #2a2a2a;
}

.reader.light-mode .chapter-content p:first-child {
  color: #111;
}

.reader.light-mode .chapter-controls {
  background: #ede8df;
  border-top-color: #d0c8b8;
}

.reader.light-mode .chapter-btn {
  background: #d8d0c4;
  color: #333;
  border-color: #c0b8a8;
}

.reader.light-mode .chapter-btn:hover:not(:disabled) {
  background: #c8c0b4;
}

.reader.light-mode .chapter-label {
  color: #666;
}

.reader.light-mode .settings-btn {
  background: #d8d0c4;
  color: #333;
  border-color: #c0b8a8;
}

.reader.light-mode .settings-btn:hover {
  background: #c8c0b4;
}

.reader.light-mode .font-size-label {
  color: #555;
}

.reader.light-mode .settings-panel {
  background: #ede8df;
  border-color: #c0b8a8;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.reader.light-mode .settings-row-label,
.reader.light-mode .settings-value {
  color: #666;
}

.reader-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 32px;
  background: #16213e;
  border-bottom: 1px solid #2a2a4a;
  backdrop-filter: blur(8px);
  transition:
    background 0.3s,
    border-color 0.3s;
}

.reader-settings {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.settings-panel {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 100;
  background: #16213e;
  border: 1px solid #3a3a5a;
  border-radius: 8px;
  padding: 16px;
  min-width: 220px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  flex-direction: column;
  gap: 12px;
}

.settings-panel.open {
  display: flex;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-row-label {
  font-size: 0.85rem;
  color: #a0a0b0;
  white-space: nowrap;
}

.settings-row-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.settings-value {
  font-size: 0.8rem;
  color: #a0a0b0;
  min-width: 28px;
  text-align: center;
}

.settings-btn {
  background: #2a2a4a;
  color: #e0e0e0;
  border: 1px solid #3a3a5a;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}

.settings-btn:hover {
  background: #3a3a5a;
}

.font-size-label {
  font-size: 0.8rem;
  color: #a0a0b0;
  min-width: 20px;
  text-align: center;
}

.back-btn {
  color: #a0a0b0;
  text-decoration: none;
  font-size: 0.9rem;
  padding: 6px 12px;
  border-radius: 4px;
  transition:
    background 0.2s,
    color 0.2s;
}

.back-btn:hover {
  background: #2a2a4a;
  color: #ffffff;
}

.book-title {
  flex: 1;
  font-size: 1rem;
  color: #ffffff;
  font-weight: 400;
}

.chapter-indicator {
  font-size: 0.85rem;
  color: #808090;
}

.reader-body {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 48px var(--reader-side-padding, 24px) 80px;
}

.chapter-content {
  max-width: 680px;
  width: 100%;
}

.chapter-content {
  --reader-font-size: 18px;
  --reader-line-height: 2;
}

.chapter-content p {
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: var(--reader-font-size);
  line-height: var(--reader-line-height);
  color: #d8d8e8;
  margin-bottom: 1.2em;
  transition: color 0.3s;
}

.chapter-content p:first-child {
  text-indent: 0;
  font-size: 1.3rem;
  color: #ffffff;
  font-weight: 500;
  margin-bottom: 1.5em;
  transition: color 0.3s;
}

.chapter-content .loading,
.chapter-content .error {
  text-align: center;
  color: #808090;
  font-style: italic;
  text-indent: 0;
}

.chapter-controls {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: #16213e;
  border-top: 1px solid #2a2a4a;
}

.chapter-btn {
  background: #2a2a4a;
  color: #e0e0e0;
  border: 1px solid #3a3a5a;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
  transition:
    background 0.2s,
    border-color 0.2s;
}

.chapter-btn:hover:not(:disabled) {
  background: #3a3a5a;
  border-color: #5a5a7a;
}

.chapter-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.chapter-label {
  font-size: 0.85rem;
  color: #808090;
}

@media screen and (max-width: 600px) {
  .reader-nav {
    padding: 12px 16px;
  }

  .reader-body {
    padding: 32px var(--reader-side-padding, 24px) 60px;
  }

  .chapter-content p {
    font-size: var(--reader-font-size);
    line-height: var(--reader-line-height);
  }

  .chapter-controls {
    padding: 12px 16px;
  }

  .chapter-btn {
    padding: 8px 14px;
    font-size: 0.8rem;
  }

  .book-title {
    display: none;
  }

  .settings-panel {
    position: fixed;
    top: 57px;
    left: 16px;
    right: 16px;
    width: auto;
    min-width: 0;
  }
}
