* {
  box-sizing: border-box;
}

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

body {
  --viewer-bg: #f7f6f3;

  min-height: 100vh;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--viewer-bg);
}

body.series-mr  { --viewer-bg: #fff9ef; }
body.series-m   { --viewer-bg: #f3f8fc; }
body.series-l   { --viewer-bg: #f3f8f4; }
body.series-mrk { --viewer-bg: #fbf4f8; }

.viewer {
  width: 100%;
  min-height: calc(100vh - 48px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

.viewer a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.viewer img {
  display: block;
  height: auto;
  object-fit: contain;
  box-shadow: 0 12px 38px rgba(0,0,0,.14);
}

/* 画像1枚 */
.viewer.single img {
  width: min(92vw, 1100px);
  max-height: 94vh;
}

/* 表・裏など複数画像 */
.viewer.multi a {
  flex: 1 1 0;
}

.viewer.multi img {
  width: 100%;
  max-width: 700px;
  max-height: 92vh;
}

@media (max-width: 800px) {
  body {
    padding: 12px;
    align-items: flex-start;
  }

  .viewer {
    min-height: auto;
  }

  .viewer.multi {
    flex-direction: column;
    gap: 18px;
  }

  .viewer.multi a {
    width: 100%;
  }

  .viewer.multi img,
  .viewer.single img {
    width: 100%;
    max-width: 100%;
    max-height: none;
  }
}
