*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-muted: #6b6560;
  --primary: #8b2252;
  --primary-hover: #6e1a41;
  --border: #e8e0d8;
  --border-light: #f0ebe5;
  --success: #2d7a4f;
  --error: #c44040;
  --radius: 8px;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Layout */

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 40px 20px;
}

.container--wide {
  max-width: 900px;
}

/* Nav */

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.nav__logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.nav__logo:hover {
  text-decoration: none;
}

.nav__links {
  display: flex;
  gap: 16px;
  align-items: center;
}

.nav__link {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Cards */

.card {
  background: var(--surface);
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.card--centered {
  text-align: center;
  max-width: 440px;
  margin: 80px auto;
}

/* Typography */

h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 16px;
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 12px;
}

h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 32px;
}

/* Forms */

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* Heat level selector */

.heat-levels {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.heat-level {
  flex: 1;
  min-width: 0;
}

.heat-level input {
  display: none;
}

.heat-level label {
  display: block;
  padding: 10px 8px;
  text-align: center;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1.3;
  transition: all 0.15s;
}

.heat-level label strong {
  display: block;
  font-size: 1.1rem;
  margin-bottom: 2px;
}

.heat-level input:checked + label {
  border-color: var(--primary);
  background: #f9f0f4;
  color: var(--primary);
}

/* Buttons */

.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
  text-align: center;
}

.btn:hover {
  text-decoration: none;
}

.btn--primary {
  background: var(--primary);
  color: white;
}

.btn--primary:hover {
  background: var(--primary-hover);
}

.btn--primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn--secondary {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn--secondary:hover {
  background: #f9f0f4;
}

.btn--full {
  width: 100%;
}

.btn-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Messages */

.message {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 20px;
  display: none;
}

.message--error {
  background: #fef2f2;
  color: var(--error);
  border: 1px solid #fecaca;
}

.message--success {
  background: #f0fdf4;
  color: var(--success);
  border: 1px solid #bbf7d0;
}

.message.show {
  display: block;
}

/* Novel list */

.novel-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.novel-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s;
}

.novel-item:hover {
  border-color: var(--primary);
  text-decoration: none;
}

.novel-item__title {
  font-weight: 600;
  margin-bottom: 4px;
}

.novel-item__meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.novel-item__arrow {
  color: var(--text-muted);
  font-size: 1.2rem;
}

/* Empty state */

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state p {
  margin-bottom: 24px;
}

/* Reader */

.reader {
  max-width: 640px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

.reader__header {
  text-align: center;
  margin-bottom: 48px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.reader__title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.reader__meta {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.chapter {
  margin-bottom: 48px;
}

.chapter__heading {
  font-size: 1.25rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 24px;
  color: var(--primary);
}

.chapter__content {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.1rem;
  line-height: 1.9;
}

.chapter__content p {
  margin-bottom: 1em;
  text-indent: 1.5em;
}

.chapter__content p:first-child {
  text-indent: 0;
}

.chapter-divider {
  text-align: center;
  margin: 48px 0;
  color: var(--border);
  letter-spacing: 8px;
}

/* Loading */

.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.loading__spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.generating {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-style: italic;
}

/* Landing page */

.hero {
  text-align: center;
  padding: 80px 20px 60px;
}

.hero h1 {
  font-size: 2.75rem;
  margin-bottom: 16px;
}

@media (max-width: 600px) {
  .hero h1 {
    font-size: 2rem;
  }
}

.hero .subtitle {
  font-size: 1.2rem;
  max-width: 520px;
  margin: 0 auto 40px;
}

.how-it-works {
  max-width: 700px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin-top: 32px;
}

@media (max-width: 600px) {
  .steps {
    grid-template-columns: 1fr;
  }
}

.step {
  text-align: center;
}

.step__number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-weight: 700;
  margin-bottom: 12px;
}

.step h3 {
  margin-bottom: 6px;
}

.step p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.cta-section {
  text-align: center;
  padding: 40px 20px 80px;
}

.access-form {
  max-width: 400px;
  margin: 32px auto 0;
}

.access-form .input-row {
  display: flex;
  gap: 8px;
}

.access-form input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
}

.access-form input:focus {
  outline: none;
  border-color: var(--primary);
}

/* Utility */

.hidden {
  display: none !important;
}

.mt-16 {
  margin-top: 16px;
}

.mt-24 {
  margin-top: 24px;
}

.mt-32 {
  margin-top: 32px;
}

.mb-8 {
  margin-bottom: 8px;
}

.text-center {
  text-align: center;
}

.text-muted {
  color: var(--text-muted);
}

.text-sm {
  font-size: 0.875rem;
}
