.viewer-shell {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(57, 88, 131, 0.14);
  border-radius: 1.75rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 248, 252, 0.96));
  box-shadow: var(--shadow-soft);
  container-type: inline-size;
}

.viewer-shell::before {
  content: "";
  position: absolute;
  inset: auto -2rem -4rem auto;
  width: 11rem;
  height: 11rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(47, 122, 210, 0.18), transparent 72%);
  pointer-events: none;
}

.viewer-topbar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 2.65rem;
  padding: 0 1rem;
  border-bottom: 1px solid rgba(57, 88, 131, 0.12);
  color: var(--ink-faint);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: rgba(248, 251, 254, 0.94);
}

.viewer-toolbar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.1rem;
  padding: 0 0.8rem;
  border-bottom: 1px solid rgba(57, 88, 131, 0.08);
  background: rgba(251, 252, 254, 0.98);
}

.viewer-tool,
.viewer-tool-wide {
  display: inline-flex;
  height: 0.9rem;
  border-radius: 999px;
  background: rgba(57, 88, 131, 0.16);
}

.viewer-tool {
  width: 0.9rem;
}

.viewer-tool-wide {
  width: 1.5rem;
  margin-left: 0.35rem;
}

.viewer-zoom {
  margin-left: auto;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 700;
}

.window-dots {
  display: inline-flex;
  gap: 0.35rem;
}

.window-dots span {
  width: 0.68rem;
  height: 0.68rem;
  border-radius: 50%;
  background: rgba(146, 160, 182, 0.7);
}

.window-dots span:nth-child(1) {
  background: rgba(255, 95, 86, 0.8);
}

.window-dots span:nth-child(2) {
  background: rgba(255, 189, 46, 0.82);
}

.window-dots span:nth-child(3) {
  background: rgba(39, 201, 63, 0.82);
}

.viewer-body {
  display: grid;
  grid-template-columns: 4.75rem minmax(0, 1fr);
  min-height: 23rem;
}

.viewer-sidebar {
  display: grid;
  gap: 0.75rem;
  align-content: start;
  padding: 1rem 0.85rem;
  border-right: 1px solid rgba(57, 88, 131, 0.1);
  background: linear-gradient(180deg, rgba(246, 249, 252, 0.96), rgba(241, 246, 251, 0.98));
}

.thumb {
  position: relative;
  display: block;
  min-height: 4.8rem;
  border-radius: 0.65rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(236, 242, 249, 0.96));
  box-shadow:
    inset 0 0 0 1px rgba(57, 88, 131, 0.08),
    0 10px 24px rgba(20, 33, 53, 0.08);
}

.thumb-active {
  box-shadow:
    inset 0 0 0 2px rgba(47, 122, 210, 0.42),
    0 10px 24px rgba(20, 33, 53, 0.08);
}

.thumb::after {
  content: "";
  position: absolute;
  inset: 0.6rem auto 0.6rem 0.7rem;
  width: 58%;
  border-radius: 0.25rem;
  background:
    repeating-linear-gradient(
      180deg,
      rgba(125, 140, 161, 0.18) 0 1px,
      transparent 1px 0.42rem
    ),
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(246, 249, 252, 0.92));
}

.thumb-index {
  position: absolute;
  left: 50%;
  bottom: -1rem;
  transform: translateX(-50%);
  color: var(--accent-strong);
  font-size: 0.68rem;
  font-weight: 700;
}

.viewer-canvas {
  position: relative;
  min-height: 23rem;
  background:
    linear-gradient(125deg, rgba(250, 252, 255, 0.98), rgba(233, 241, 250, 0.94)),
    radial-gradient(circle at top right, rgba(47, 122, 210, 0.16), transparent 34%);
}

.viewer-chip {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  min-height: 1.95rem;
  padding: 0 0.8rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.viewer-chip-accent {
  top: 1.2rem;
  left: 1.1rem;
  color: var(--accent-strong);
  background: rgba(47, 122, 210, 0.14);
}

.viewer-page {
  position: absolute;
  width: min(18rem, 62%);
  aspect-ratio: 0.76;
  border-radius: 0.85rem;
  box-shadow: 0 18px 42px rgba(20, 33, 53, 0.12);
}

.viewer-page-side {
  top: 4.3rem;
  right: -1.2rem;
  width: min(13rem, 38%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(245, 248, 252, 0.92));
  overflow: hidden;
}

.viewer-page-front {
  top: 4rem;
  left: 2rem;
  display: grid;
  align-content: start;
  gap: 0.9rem;
  padding: 1.15rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(246, 249, 253, 0.98));
}

.viewer-page-shadow {
  position: absolute;
  left: 1.6rem;
  bottom: 1.1rem;
  width: 16rem;
  height: 2rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(20, 33, 53, 0.14), transparent 72%);
  filter: blur(8px);
}

.page-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 1.7rem;
  padding: 0 0.65rem;
  border-radius: 999px;
  color: var(--accent-strong);
  background: rgba(47, 122, 210, 0.12);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.viewer-page-body {
  display: grid;
  gap: 0.5rem;
}

.viewer-page-body-ghost {
  margin-top: 2rem;
  padding: 1.2rem 1rem;
  opacity: 0.72;
}

.page-title-line,
.page-line {
  display: block;
  height: 0.58rem;
  border-radius: 999px;
  background: rgba(18, 33, 51, 0.12);
}

.page-title-line {
  width: 78%;
  height: 0.72rem;
  background: rgba(18, 33, 51, 0.18);
}

.page-title-line.short {
  width: 52%;
}

.page-line {
  width: 100%;
}

.page-line.short {
  width: 72%;
}

.page-line.tiny {
  width: 40%;
}

@container (min-width: 30rem) {
  .viewer-body {
    grid-template-columns: 5rem minmax(0, 1fr);
  }
}
