:root {
  color-scheme: light;
  --ink: #0b2545;
  --text: #1f2937;
  --muted: #667085;
  --blue: #2563eb;
  --line: #d6deea;
  --paper: #fbfdff;
  --panel: rgba(255, 255, 255, 0.82);
  --stage: #e8eef6;
  --shadow: 0 22px 70px rgba(11, 37, 69, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: Cambria, Georgia, "Times New Roman", serif;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.08), transparent 35%),
    linear-gradient(315deg, rgba(17, 132, 91, 0.10), transparent 36%),
    radial-gradient(circle at 50% 0%, #ffffff 0%, #f4f7fb 45%, #e7edf6 100%);
}

button,
a {
  font: inherit;
}

.reader-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 18px clamp(14px, 3vw, 34px);
  gap: 16px;
}

.reader-topbar,
.reader-controls {
  width: min(1280px, 100%);
  margin: 0 auto;
}

.reader-topbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border: 1px solid rgba(214, 222, 234, 0.88);
  border-radius: 18px;
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 40px rgba(11, 37, 69, 0.08);
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-dot {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 50%;
  background:
    linear-gradient(135deg, #2563eb, #11845b),
    #2563eb;
  box-shadow: inset 0 0 0 5px rgba(255, 255, 255, 0.42);
}

.brand-mark strong,
.brand-mark span {
  display: block;
}

.brand-mark strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.05;
}

.brand-mark span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.action-link,
.icon-button,
.nav-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #ffffff;
  cursor: pointer;
  text-decoration: none;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.action-link {
  display: inline-flex;
  min-width: 58px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  font-size: 17px;
}

.action-link:hover,
.icon-button:hover,
.nav-button:hover {
  transform: translateY(-1px);
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 10px 24px rgba(11, 37, 69, 0.12);
}

.magazine-stage {
  width: min(1280px, 100%);
  min-height: 0;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 64px;
  align-items: center;
  gap: 14px;
}

.book-wrap {
  position: relative;
  min-width: 0;
  display: grid;
  place-items: center;
  perspective: 1600px;
}

.book-shadow {
  position: absolute;
  width: min(1040px, 86%);
  aspect-ratio: 11 / 8.5;
  transform: translateY(20px);
  border-radius: 24px;
  background: rgba(11, 37, 69, 0.16);
  filter: blur(24px);
}

.page-card {
  position: relative;
  z-index: 1;
  width: min(1040px, 100%);
  aspect-ratio: 11 / 8.5;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(214, 222, 234, 0.95);
  background: var(--paper);
  box-shadow: var(--shadow);
  transform-origin: center;
}

.page-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(11, 37, 69, 0.08), transparent 9%, transparent 91%, rgba(11, 37, 69, 0.08)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 18%);
  mix-blend-mode: multiply;
}

.page-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #ffffff;
  opacity: 1;
  transform: translateX(0) scale(1);
  transition:
    opacity 260ms ease,
    transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.page-card.is-changing img {
  opacity: 0;
}

.page-card.slide-next img {
  transform: translateX(-10px) scale(0.995);
}

.page-card.slide-prev img {
  transform: translateX(10px) scale(0.995);
}

.nav-button {
  width: 54px;
  height: 72px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 46px;
  line-height: 1;
  color: var(--blue);
}

.nav-button:disabled {
  opacity: 0.34;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.reader-controls {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 12px;
  border: 1px solid rgba(214, 222, 234, 0.88);
  border-radius: 18px;
  background: var(--panel);
  backdrop-filter: blur(18px);
}

.progress-block {
  min-width: 0;
}

.page-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.page-meta span:last-child {
  color: var(--muted);
  font-weight: 500;
  text-align: right;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce5f2;
}

.progress-track span {
  display: block;
  width: 16.6667%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), #11845b);
  transition: width 240ms ease;
}

.thumbnail-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  max-width: min(520px, 46vw);
  padding-bottom: 2px;
}

.thumb {
  width: 76px;
  height: 54px;
  flex: 0 0 auto;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(11, 37, 69, 0.10);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb[aria-current="page"] {
  border-color: var(--blue);
}

@media (max-width: 860px) {
  .reader-shell {
    padding: 12px;
  }

  .reader-topbar {
    border-radius: 14px;
  }

  .brand-mark span {
    display: none;
  }

  .magazine-stage {
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    gap: 8px;
  }

  .nav-button {
    width: 40px;
    height: 58px;
    font-size: 36px;
  }

  .reader-controls {
    grid-template-columns: 1fr;
  }

  .thumbnail-strip {
    max-width: 100%;
  }

  .page-meta {
    font-size: 12px;
  }
}
