/* ===== Reset & Base ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #fdf6ec;
  --bg-warm: #fef9f0;
  --text: #3d3229;
  --text-light: #7a6b5d;
  --accent: #f4a261;
  --accent-dark: #e76f51;
  --card-bg: #ffffff;
  --shadow: 0 4px 24px rgba(61,50,41,0.10);
  --shadow-hover: 0 8px 32px rgba(61,50,41,0.18);
  --radius: 16px;
  --font-sans: 'Noto Sans SC', system-ui, sans-serif;
  --font-serif: 'Noto Serif SC', serif;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== Pages ===== */
.page { display: none; min-height: 100vh; }
.page.active { display: flex; flex-direction: column; }

/* ===== Hero ===== */
.hero {
  background: linear-gradient(135deg, #fce4b8 0%, #f8d5a3 40%, #f4b982 100%);
  padding: 60px 20px 48px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -40%; left: -20%;
  width: 140%; height: 180%;
  background: radial-gradient(ellipse, rgba(255,255,255,0.3) 0%, transparent 70%);
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; }
.hero h1 {
  font-family: var(--font-serif);
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.subtitle {
  font-size: 1.1rem;
  color: var(--text-light);
  font-weight: 300;
}

/* ===== Shelf ===== */
.shelf-container {
  flex: 1;
  padding: 40px 20px 60px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}
.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 28px;
}

/* ===== Book Card ===== */
.book-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.book-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
}
.book-card .cover {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  display: block;
}
.book-card .card-info {
  padding: 16px;
}
.book-card .card-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
  line-height: 1.4;
}
.book-card .card-author {
  font-size: 0.85rem;
  color: var(--text-light);
}
.book-card .card-pages {
  font-size: 0.75rem;
  color: var(--accent-dark);
  margin-top: 6px;
}

/* ===== Footer ===== */
.site-footer {
  text-align: center;
  padding: 24px;
  color: var(--text-light);
  font-size: 0.9rem;
}

/* ===== Reader Nav ===== */
.reader-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--card-bg);
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  position: sticky;
  top: 0;
  z-index: 10;
}
.btn-back {
  background: none;
  border: none;
  font-size: 1rem;
  color: var(--accent-dark);
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  transition: background 0.2s;
}
.btn-back:hover { background: rgba(231,111,81,0.08); }
.book-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.1rem;
}
.page-indicator {
  font-size: 0.85rem;
  color: var(--text-light);
  min-width: 60px;
  text-align: right;
}

/* ===== Reader ===== */
.reader-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 12px;
  gap: 8px;
  min-height: 0;
}
.book-canvas {
  flex: 1;
  max-width: 720px;
  perspective: 1200px;
}
.book-page {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.book-page.flip-out {
  opacity: 0;
  transform: rotateY(-8deg) scale(0.96);
}
.book-page.flip-in {
  opacity: 0;
  transform: rotateY(8deg) scale(0.96);
}
.page-image-wrap {
  width: 100%;
  aspect-ratio: 4/3;
  background: #f0e8dc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.page-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.page-text {
  padding: 28px 32px 32px;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  line-height: 1.9;
  color: var(--text);
  text-align: center;
  min-height: 80px;
}

/* ===== Nav Arrows ===== */
.nav-arrow {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--card-bg);
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  font-size: 1.6rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-arrow:hover { background: var(--accent); color: #fff; transform: scale(1.08); }
.nav-arrow:disabled { opacity: 0.3; cursor: default; transform: none; }
.nav-arrow:disabled:hover { background: var(--card-bg); color: var(--text); }

/* ===== Page Dots ===== */
.page-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 12px 0 24px;
  flex-wrap: wrap;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ddd3c5;
  transition: background 0.3s, transform 0.3s;
  cursor: pointer;
}
.dot.active {
  background: var(--accent-dark);
  transform: scale(1.3);
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
  .hero { padding: 40px 16px 32px; }
  .hero h1 { font-size: 2rem; }
  .shelf { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
  .reader-nav { padding: 10px 12px; }
  .book-title { font-size: 0.95rem; }
  .page-text { padding: 20px 20px 24px; font-size: 1rem; }
  .nav-arrow { width: 40px; height: 40px; font-size: 1.3rem; }
}
