:root {
  color-scheme: light;
  --ink: #1f2933;
  --muted: #667085;
  --line: #d6dde6;
  --panel: #ffffff;
  --page: #f3f6f8;
  --accent: #0f766e;
  --accent-strong: #134e4a;
  --shadow: 0 18px 45px rgba(31, 41, 51, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--page);
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

.home-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.home-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 0 24px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.02;
}

.summary {
  color: var(--muted);
  font-size: 14px;
  text-align: right;
  white-space: nowrap;
}

.collection-tabs {
  display: flex;
  gap: 8px;
  padding: 22px 0 18px;
  overflow-x: auto;
}

.tab-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 9px 14px;
  cursor: pointer;
}

.tab-button[aria-selected="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.chapter-card {
  display: grid;
  gap: 12px;
  min-height: 172px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(31, 41, 51, 0.04);
}

.chapter-card h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.section-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: start;
}

.section-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #f9fafb;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}

.section-link:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.reader-body {
  height: 100vh;
  overflow: hidden;
  background: #e7ecef;
}

.reader-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 68px;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.reader-topbar h1 {
  font-size: 18px;
  line-height: 1.15;
}

.icon-link,
.nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}

.reader-stage {
  position: fixed;
  inset: 68px 0 58px;
  display: grid;
  place-items: center;
  padding: 16px;
}

.page-image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  background: #fff;
  box-shadow: var(--shadow);
}

.reader-hit {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 28%;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.reader-hit-left {
  left: 0;
}

.reader-hit-right {
  right: 0;
}

.page-nav {
  position: fixed;
  left: 50%;
  bottom: 10px;
  z-index: 10;
  display: grid;
  grid-template-columns: 40px minmax(160px, 420px) auto 40px;
  align-items: center;
  gap: 10px;
  width: min(720px, calc(100vw - 20px));
  padding: 8px 10px;
  border: 1px solid rgba(214, 221, 230, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 28px rgba(31, 41, 51, 0.15);
  transform: translateX(-50%);
  backdrop-filter: blur(12px);
}

.page-slider {
  width: 100%;
  accent-color: var(--accent);
}

.page-counter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.page-counter input {
  width: 48px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  text-align: center;
}

@media (max-width: 700px) {
  .home-header {
    display: block;
  }

  .summary {
    margin-top: 12px;
    text-align: left;
    white-space: normal;
  }

  .home-shell {
    width: min(100vw - 20px, 1180px);
    padding-top: 18px;
  }

  .chapter-grid {
    grid-template-columns: 1fr;
  }

  .reader-topbar {
    height: 62px;
    padding-inline: 10px;
  }

  .reader-stage {
    inset: 62px 0 58px;
    padding: 8px;
  }

  .page-nav {
    grid-template-columns: 38px minmax(96px, 1fr) auto 38px;
    gap: 6px;
  }
}
