html.np-cat-html {
  height: 100%;
}

.np-cat-viewer {
  --np-orange: #e85d04;
  --np-ink: #1a1f2e;
  --np-muted: #5c6578;
  --np-line: rgba(26, 31, 46, 0.12);
  --np-panel: #f4f6f9;
  --np-stage: #2a3142;
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100%;
  display: flex;
  flex-direction: column;
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--np-ink);
  background: #e8ecf2;
}

.np-cat-viewer * {
  box-sizing: border-box;
}

.np-cat-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: #fff;
  border-bottom: 1px solid var(--np-line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.np-cat-bar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.np-cat-logo {
  font-weight: 700;
  color: var(--np-orange);
  text-decoration: none;
  white-space: nowrap;
}

.np-cat-sep {
  width: 1px;
  height: 1.4rem;
  background: var(--np-line);
}

.np-cat-bar h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.np-cat-bar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.np-cat-btn,
.np-cat-icon-btn,
.np-cat-page-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--np-line);
  background: #fff;
  color: var(--np-ink);
  text-decoration: none;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: 0.45rem;
  cursor: pointer;
}

.np-cat-btn--solid {
  background: var(--np-orange);
  border-color: var(--np-orange);
  color: #fff;
}

.np-cat-btn--solid:hover {
  filter: brightness(0.95);
  color: #fff;
}

.np-cat-btn--ghost:hover,
.np-cat-icon-btn:hover,
.np-cat-page-btn:hover {
  border-color: var(--np-orange);
  color: var(--np-orange);
}

.np-cat-icon-btn {
  display: none;
}

.np-cat-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
}

.np-cat-nav {
  background: var(--np-panel);
  border-right: 1px solid var(--np-line);
  padding: 1.25rem 1rem;
}

.np-cat-nav-title {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--np-muted);
}

.np-cat-nav nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.np-cat-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.5rem;
  color: var(--np-ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
}

.np-cat-nav-link em {
  font-style: normal;
  font-size: 0.75rem;
  color: var(--np-muted);
  background: rgba(26, 31, 46, 0.06);
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}

.np-cat-nav-link:hover,
.np-cat-nav-link.is-active {
  background: #fff;
  color: var(--np-orange);
  box-shadow: 0 0 0 1px var(--np-line);
}

.np-cat-nav-hint {
  margin: 1.25rem 0 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--np-muted);
}

.np-cat-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  background: var(--np-stage);
}

.np-cat-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-shrink: 0;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
}

.np-cat-page-meta {
  text-align: center;
  min-width: 12rem;
}

.np-cat-page-meta span {
  display: block;
  font-size: 0.8rem;
  opacity: 0.8;
}

.np-cat-page-meta strong {
  display: block;
  font-size: 0.95rem;
  margin-top: 0.15rem;
}

.np-cat-page-btn {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 0.5rem 0.65rem;
}

.np-cat-page-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}

.np-cat-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 1rem;
  overflow: hidden;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}

.np-cat-page {
  width: min(100%, 1100px);
  height: 100%;
  margin: 0 auto;
}

.np-cat-page[hidden] {
  display: none !important;
}

.np-cat-page.is-active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.np-cat-page img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.np-cat-fallback {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 1.5rem;
  align-items: center;
  background: #fff;
  padding: 2rem;
  min-height: 420px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.np-cat-fallback img {
  max-height: 360px;
  width: auto;
  max-width: 100%;
  margin: 0 auto;
  box-shadow: none;
  object-fit: contain;
}

.np-cat-eyebrow {
  margin: 0 0 0.5rem;
  color: var(--np-orange);
  font-weight: 700;
  font-size: 0.85rem;
}

.np-cat-fallback h2 {
  margin: 0 0 1rem;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}

.np-cat-fallback a {
  color: var(--np-orange);
  font-weight: 600;
}

.np-cat-thumbs {
  display: flex;
  gap: 0.55rem;
  flex-shrink: 0;
  padding: 0.75rem 1rem 1rem;
  overflow-x: auto;
  background: rgba(0, 0, 0, 0.28);
}

.np-cat-thumb {
  flex: 0 0 auto;
  width: 88px;
  height: 56px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 0.35rem;
  overflow: hidden;
  background: #111;
  cursor: pointer;
}

.np-cat-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.np-cat-thumb span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: #fff;
  font-weight: 700;
}

.np-cat-thumb.is-active,
.np-cat-thumb:hover {
  border-color: var(--np-orange);
}

.np-cat-empty {
  margin: auto;
  text-align: center;
  color: #fff;
  padding: 3rem 1rem;
}

.np-cat-empty a {
  color: #ffb703;
}

@media (max-width: 1366px) {
  .np-cat-icon-btn {
    display: inline-flex;
  }

  .np-cat-shell {
    grid-template-columns: 1fr;
  }

  .np-cat-nav {
    position: fixed;
    inset: 58px auto 0 0;
    width: min(300px, 86vw);
    z-index: 30;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 8px 0 30px rgba(0, 0, 0, 0.18);
    overflow-y: auto;
  }

  .np-cat-nav-open .np-cat-nav {
    transform: translateX(0);
  }

  .np-cat-nav-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(16, 20, 28, 0.4);
  }

  .np-cat-stage {
    padding: 0.75rem;
  }

  .np-cat-fallback {
    grid-template-columns: 1fr;
    text-align: center;
    min-height: 0;
    padding: 1rem;
    max-height: 100%;
    overflow: auto;
  }
}

@media (max-width: 900px) {
  .np-cat-bar {
    gap: 0.5rem;
    padding: 0.5rem 0.7rem;
  }

  .np-cat-bar h1,
  .np-cat-sep {
    display: none;
  }

  .np-cat-logo {
    max-width: 34vw;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.92rem;
  }

  .np-cat-btn,
  .np-cat-icon-btn {
    padding: 0.4rem 0.55rem;
    font-size: 0.8rem;
  }

  .np-cat-nav {
    inset: 52px auto 0 0;
  }

  .np-cat-stage {
    padding: 0.6rem;
  }

  .np-cat-toolbar {
    gap: 0.6rem;
    padding: 0.5rem 0.6rem;
  }

  .np-cat-page-meta {
    min-width: 0;
  }

  .np-cat-thumbs {
    padding: 0.5rem 0.6rem 0.7rem;
  }

  .np-cat-thumb {
    width: 64px;
    height: 42px;
  }
}

@media (max-width: 600px) {
  .np-cat-icon-btn span,
  .np-cat-btn span {
    display: none;
  }

  .np-cat-btn,
  .np-cat-icon-btn {
    min-width: 40px;
    justify-content: center;
  }
}

@media (orientation: landscape) and (max-height: 540px) {
  .np-cat-bar {
    padding: 0.35rem 0.7rem;
  }

  .np-cat-toolbar {
    padding: 0.35rem 0.6rem;
  }

  .np-cat-thumbs {
    display: none;
  }

  .np-cat-stage {
    padding: 0.4rem;
  }
}
