:root {
  color-scheme: dark;
  font-family: Arial, Helvetica, sans-serif;
  background: #171717;
}

* { box-sizing: border-box; }

html, body {
  min-height: 100%;
  margin: 0;
  background: #171717;
  color: #f5f5f5;
}

.catalog-toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 10px 24px;
  background: rgba(20, 20, 20, 0.94);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
}

.catalog-home {
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-decoration: none;
}

#catalog-status {
  margin: 0;
  color: #d8d8d8;
  font-size: 14px;
}

.catalog-viewer {
  display: grid;
  gap: 24px;
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: 28px 32px 64px;
}

.catalog-page {
  position: relative;
  width: min(100%, 1080px);
  aspect-ratio: 210 / 297;
  margin: 0 auto;
  overflow: hidden;
  background: #f4f4f4;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.38);
  scroll-margin-top: 68px;
}

.catalog-page canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #fff;
}

.catalog-link-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.catalog-link {
  position: absolute;
  display: block;
  pointer-events: auto;
  cursor: pointer;
}

.catalog-link:focus-visible {
  outline: 2px solid #0a66c2;
  outline-offset: 1px;
}

.catalog-page--loading::after {
  position: absolute;
  inset: 0;
  content: '';
  background: linear-gradient(110deg, #eeeeee 28%, #fafafa 40%, #eeeeee 52%);
  background-size: 220% 100%;
  animation: catalog-loading 1.4s linear infinite;
}

.catalog-viewer--error {
  display: block;
  padding-top: 72px;
  text-align: center;
}

.catalog-error {
  max-width: 620px;
  margin: 0 auto;
  padding: 24px;
  color: #fff;
  text-align: center;
}

@keyframes catalog-loading {
  to { background-position-x: -220%; }
}

@media (max-width: 640px) {
  .catalog-toolbar { padding: 9px 12px; }
  .catalog-viewer { gap: 12px; padding: 12px 8px 32px; }
  #catalog-status { font-size: 13px; }
}
