:root {
  --bg-0: #f5efe5;
  --bg-1: #e3edf5;
  --ink-0: #1f2a37;
  --ink-1: #516375;
  --line: #c8d4df;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --panel: rgba(255, 255, 255, 0.82);
  --shadow: 0 14px 40px rgba(27, 47, 78, 0.18);
  --radius: 18px;
}

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

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

body {
  font-family: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink-0);
  background:
    radial-gradient(1200px 700px at 18% 10%, rgba(19, 128, 117, 0.15), transparent 60%),
    radial-gradient(900px 500px at 88% 88%, rgba(23, 109, 201, 0.14), transparent 62%),
    linear-gradient(150deg, var(--bg-0), var(--bg-1));
  padding: 16px;
}

.app-shell {
  max-width: 1440px;
  margin: 0 auto;
  min-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--ink-1);
  letter-spacing: 0.06em;
  font-size: 0.72rem;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1rem, 1.7vw, 1.6rem);
  line-height: 1.1;
}

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

button,
.page-input {
  font: inherit;
}

.nav-button,
.jump-button {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.nav-button {
  background: #fff;
  border-color: var(--line);
  color: var(--ink-0);
}

.jump-button {
  background: var(--accent);
  color: #fff;
}

.nav-button:hover,
.jump-button:hover {
  transform: translateY(-1px);
}

.jump-button:hover {
  background: var(--accent-strong);
}

.nav-button:disabled,
.jump-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.jump-label {
  color: var(--ink-1);
  font-size: 0.9rem;
}

.page-input {
  width: 84px;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 8px 11px;
  text-align: center;
  background: #fff;
}

.viewer-layout {
  flex: 1;
  min-height: 0;
}

.viewport {
  height: 100%;
  min-height: 72vh;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(248, 252, 255, 0.6);
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow);
  padding: 14px;
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
}

.page-track {
  height: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: center;
}

.is-mobile .page-track {
  grid-template-columns: minmax(0, 1fr);
}

.page-card {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-sheet {
  position: relative;
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 240px);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #d7e2eb;
  box-shadow: 0 8px 24px rgba(11, 24, 44, 0.17);
}

.page-sheet img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #fff;
}

.page-sheet.blank {
  background:
    linear-gradient(125deg, rgba(15, 118, 110, 0.06), rgba(15, 118, 110, 0.02)),
    #fff;
}

.page-meta {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.74rem;
  color: #334155;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid #d8e5ef;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink-1);
  font-size: 0.9rem;
}

.slide-next {
  animation: slide-next 220ms ease;
}

.slide-prev {
  animation: slide-prev 220ms ease;
}

@keyframes slide-next {
  from {
    transform: translateX(18px);
    opacity: 0.84;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slide-prev {
  from {
    transform: translateX(-18px);
    opacity: 0.84;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@media (max-width: 900px) {
  body {
    padding: 10px;
  }

  .app-shell {
    min-height: calc(100vh - 20px);
    gap: 10px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar {
    justify-content: flex-start;
  }

  .viewport {
    min-height: 65vh;
    padding: 10px;
  }

  .page-sheet {
    max-height: calc(100vh - 240px);
  }
}

