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

:root {
  --bg: #080808;
  --bg2: #0d0d0d;
  --border: #161616;
  --text: #d4d4d4;
  --text-dim: #555;
  --accent: #7c6cff;
  --accent-dim: #3d3380;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

/* NAV */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(8, 8, 8, 0.92);
  backdrop-filter: blur(8px);
  z-index: 100;
}

.nav-logo {
  font-size: 1.1rem;
  font-weight: 600;
  color: #e8e8e8;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.nav-logo span { color: var(--accent); }

.nav-right { display: flex; align-items: center; gap: 1.5rem; }
.nav-link { font-size: 0.78rem; color: var(--text-dim); text-decoration: none; letter-spacing: 0.06em; transition: color 0.15s; background: none; border: none; cursor: pointer; font-family: inherit; padding: 0; }
.nav-link:hover { color: var(--text); }
.btn-ghost { background: none; }

/* FOOTER */
.footer {
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  color: #2a2a2a;
  text-align: center;
  letter-spacing: 0.05em;
}

/* HERO */
.hero {
  padding: 5rem 1.5rem 3.5rem;
  max-width: 900px;
  margin: 0 auto;
}

.hero-label {
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--accent);
  margin-bottom: 1.2rem;
}

.hero-title {
  font-family: 'Noto Serif JP', serif;
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 700;
  line-height: 1;
  color: #f0f0f0;
  letter-spacing: -0.02em;
}

.hero-sub {
  font-size: 0.9rem;
  color: var(--text-dim);
  margin-top: 1rem;
}

/* CHAPTER GRID */
.chapter-grid {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem 6rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1px;
  background: var(--border);
  border-top: 1px solid var(--border);
}

.chapter-card {
  background: var(--bg);
  text-decoration: none;
  display: block;
  padding: 1.2rem;
  transition: background 0.15s;
}
.chapter-card:hover { background: var(--bg2); }

.chapter-cover {
  aspect-ratio: 2/3;
  overflow: hidden;
  margin-bottom: 0.8rem;
  background: #111;
}
.chapter-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.3s; }
.chapter-card:hover .chapter-cover img { transform: scale(1.03); }
.cover-placeholder { width: 100%; height: 100%; background: #111; }

.chapter-num { font-size: 0.65rem; letter-spacing: 0.15em; color: var(--accent); display: block; margin-bottom: 0.25rem; }
.chapter-title { font-size: 0.9rem; font-weight: 500; color: #ddd; margin-bottom: 0.3rem; }
.chapter-desc { font-size: 0.75rem; color: #555; margin-bottom: 0.4rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chapter-pages { font-size: 0.68rem; color: #333; }

.empty-state {
  grid-column: 1 / -1;
  padding: 4rem 1rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* AUTH */
.auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  padding: 2rem 1.5rem;
}

.auth-box {
  width: 100%;
  max-width: 360px;
}

.auth-logo {
  font-size: 2rem;
  font-family: 'Noto Serif JP', serif;
  font-weight: 700;
  color: #f0f0f0;
  margin-bottom: 0.3rem;
}
.auth-logo span { color: var(--accent); }
.auth-sub { font-size: 0.75rem; color: var(--text-dim); letter-spacing: 0.08em; margin-bottom: 2rem; }

.auth-form .field { margin-bottom: 1.2rem; }
.auth-form label { display: block; font-size: 0.73rem; color: #666; margin-bottom: 0.35rem; letter-spacing: 0.05em; }
.auth-form input {
  width: 100%; background: var(--bg2); border: 1px solid #1e1e1e;
  color: var(--text); padding: 0.65rem 0.9rem; font-size: 0.9rem;
  border-radius: 3px; font-family: inherit; transition: border-color 0.15s;
}
.auth-form input:focus { outline: none; border-color: var(--accent); }

.auth-error {
  background: #1a0a0a;
  border: 1px solid #3a1a1a;
  color: #ef5350;
  padding: 0.65rem 0.9rem;
  border-radius: 3px;
  font-size: 0.8rem;
  margin-bottom: 1.2rem;
}

/* BUTTONS */
.btn-primary {
  width: 100%;
  padding: 0.7rem 1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 3px;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: background 0.15s;
}
.btn-primary:hover { background: #6a5ce8; }

@media (max-width: 600px) {
  .chapter-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-title { font-size: 3.5rem; }
  .row-flex { flex-direction: column; }
}
