*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --blue: #0068B7;
  --blue-deep: #004E8A;
  --blue-pale: #EAF4FB;
  --blue-soft: #7FC4E8;
  --ink: #1E2A33;
  --ink-soft: #2A343C;
  --gray: #55626B;
  --bg: #FFFFFF;
  --bg-tint: #F4F8FB;
  --line: #E2EAF0;
}
html, body {
  font-family: 'Inter', 'Noto Sans JP', 'Hiragino Sans', sans-serif;
  background: var(--bg);
  color: var(--ink);
  height: 100%;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

.deco { position: fixed; border-radius: 50%; pointer-events: none; z-index: 0; }
.deco-1 { width: 520px; height: 520px; top: -175px; right: -150px;
  background: radial-gradient(circle, rgba(127,196,232,.28), rgba(127,196,232,0) 70%); }
.deco-2 { width: 400px; height: 400px; bottom: 8%; left: -135px;
  background: radial-gradient(circle, rgba(0,104,183,.14), rgba(0,104,183,0) 70%); }
.deco-3 { width: 140px; height: 140px; top: 34%; right: 6%;
  border: 1.5px solid rgba(0,104,183,.15); background: none; }

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  height: 76px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
}
.header-logo {
  display: block;
  width: auto;
  height: 35px;
  max-width: calc(100% - 130px);
}
.btn {
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  white-space: nowrap;
  transition: .15s;
}
.btn:hover { border-color: var(--blue); color: var(--blue); }
#btnBack { display: none; }
#btnBack {
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 14px;
  gap: 7px;
  border-radius: 6px;
  background: #141437;
  border-color: #141437;
  color: #fff;
}
#btnBack:hover {
  background: #252555;
  border-color: #252555;
  color: #fff;
}
.close-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.button-arrow {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .15s ease;
}
.security-bar {
  position: fixed;
  top: 76px; left: 0; right: 0;
  z-index: 190;
  background: #141437;
  border-bottom: 1px solid #141437;
  padding: 7px 20px;
  font-size: 12.5px;
  color: #fff;
  text-align: center;
  line-height: 1.5;
}
.security-bar b { font-weight: 700; }

#doorPage {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding-top: var(--top-offset, 110px);
  position: relative;
  z-index: 1;
}
.door-hero {
  text-align: center;
  padding: 44px 20px 36px;
}
.door-hero .en {
  font-size: 12.5px;
  letter-spacing: .28em;
  color: var(--blue);
  font-weight: 700;
  text-transform: uppercase;
}
.door-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 10px;
}
.door-title img {
  display: block;
  width: 300px;
  height: auto;
}
.door-title span {
  font-size: 32.5px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--ink);
}
.door-hero p { font-size: 14.5px; color: var(--ink-soft); margin-top: 12px; }
.sp-break { display: none; }
.door-wave {
  width: 64px; height: 4px; border-radius: 6px;
  background: linear-gradient(90deg, var(--blue), var(--blue-soft));
  margin: 20px auto 0;
}

.section-label {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 24px 18px;
  max-width: 1080px;
  margin: 0 auto;
  width: 100%;
}
.section-label .ja { font-size: 28px; font-weight: 700; color: var(--ink); line-height: 1; }
.section-label .en { font-size:8px; letter-spacing: .2em; color: var(--blue); font-weight: 700; }

/* ===== 最新号セクション ===== */
.latest-section {
  max-width: 1080px;
  margin: 0 auto 12px;
  width: 100%;
  padding: 0 24px 36px;
}
.latest-card {
  display: flex;
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 6px 24px rgba(0,104,183,.10);
  cursor: pointer;
  transition: box-shadow .2s, transform .2s;
}
.latest-card:hover {
  box-shadow: 0 14px 40px rgba(0,104,183,.16);
  transform: translateY(-3px);
}
.latest-thumb {
  width: 35%;
  flex-shrink: 0;
  background: var(--bg-tint);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.latest-thumb img {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
  display: block; pointer-events: none;
}
.latest-body {
  flex: 1;
  padding: 26px 28px;
  display: flex;
  flex-direction: column;
}
.latest-vol { font-size: 13.5px; color: var(--blue); font-weight: 700; letter-spacing:.06em; }
.latest-date { font-size: 22px; font-weight: 700; color: var(--ink); margin-top: 4px; }
.latest-feat { font-size: 14.5px; color: var(--ink-soft); margin-top: 6px; line-height: 1.6; }
.latest-toc {
  margin-top: 14px;
  background: var(--bg-tint);
  border-radius: 6px;
  padding: 12px 16px 14px;
}
.latest-toc-title { font-size: 13px; color: var(--blue); font-weight: 700; letter-spacing: .14em; margin-bottom: 8px; }
.latest-toc ul { list-style: none; }
.latest-toc li {
  font-size: 16px; color: var(--ink-soft);
  padding: 6px 0 6px 17px;
  position: relative;
  cursor: pointer;
  line-height: 1.55;
  transition: color .15s;
}
.latest-toc li::before {
  content: '';
  position: absolute; left: 2px; top: 11px;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--blue-soft);
}
.latest-toc li:hover { color: var(--blue); }
.latest-actions { margin-top: auto; padding-top: 18px; }
.latest-read-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 38px;
  background: #141437;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14.5px; font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.latest-read-btn:hover { background: #252555; }
.latest-read-btn:hover .button-arrow {
  transform: translateX(2px);
}

/* ===== バックナンバー ===== */
.door-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  justify-content: start;
  gap: 18px;
  padding: 0 24px 60px;
  max-width: 1080px;
  margin: 0 auto;
  width: 100%;
}
.vol-card {
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  max-width: 250px;
  box-shadow: 0 2px 12px rgba(30,42,51,.05);
  transition: box-shadow .2s, transform .2s;
  cursor: pointer;
}
.vol-card:hover {
  box-shadow: 0 10px 28px rgba(0,104,183,.13);
  transform: translateY(-3px);
}
.vol-thumb {
  width: 100%;
  aspect-ratio: 1897 / 2526;
  overflow: hidden;
  background: var(--bg-tint);
  padding: 0;
}
.vol-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block; pointer-events: none;
}
.vol-info { padding: 14px 16px 16px; }
.vol-num {
  display: inline-block;
  font-size: 11px; color: var(--blue); font-weight: 700; letter-spacing: .08em;
  border: 1px solid var(--blue-soft);
  border-radius: 6px;
  padding: 2px 10px;
}
.vol-date { font-size: 15.5px; color: var(--ink); margin-top: 7px; font-weight: 600; }
.vol-feat { font-size: 12.5px; color: var(--ink-soft); margin-top: 3px; line-height: 1.5; min-height: calc(1.5 * 12.5px); }

.door-more {
  max-width: 1080px;
  margin: -36px auto 0;
  width: 100%;
  padding: 0 24px 60px;
  text-align: center;
}
.door-more-btn {
  display: inline-block;
  padding: 12px 44px;
  background: #fff;
  color: var(--blue);
  border: 1.5px solid var(--blue);
  border-radius: 999px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.door-more-btn:hover {
  background: var(--blue);
  color: #fff;
}

.footer {
  margin-top: auto;
  padding: 13px 20px;
  background: #141437;
  color: #fff;
  text-align: center;
}
.footer p {
  font-size: 10px;
  line-height: 1.5;
}

/* ===== ビューア ===== */
#viewerPage {
  display: none;
  flex-direction: column;
  height: 100dvh;
  padding-top: var(--top-offset, 110px);
  position: relative;
  z-index: 1;
}
.viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  height: 46px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.toolbar-title {
  font-size: 13.5px; color: var(--ink-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 30vw;
}
.toolbar-nav { display: flex; align-items: center; gap: 6px; }
.nav-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 15.5px;
  transition: .15s;
}
.nav-btn:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.nav-btn:disabled { opacity: .3; cursor: default; }
.page-info { font-size: 13.5px; color: var(--ink-soft); min-width: 52px; text-align: center; }
.toc-btn {
  padding: 6px 14px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  font-size: 13.5px;
  cursor: pointer;
  transition: .15s;
}
.toc-btn:hover { border-color: var(--blue); color: var(--blue); }
.zoom-controls {
  display: flex; align-items: center; gap: 4px;
}
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
#tocBtn { visibility: hidden; }
.zoom-level {
  font-size: 12.5px; color: var(--ink-soft);
  min-width: 44px; text-align: center;
}
#pageImg.zoomed { cursor: grab; }
#pageImg.zoomed:active { cursor: grabbing; }
.viewer-body.zoom-active { overflow: auto; }

.viewer-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  background: var(--bg-tint);
}
#pageImg {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  transition: opacity .2s;
  box-shadow: 0 6px 32px rgba(30,42,51,.14);
  border-radius: 6px;
}
.tap-prev, .tap-next {
  position: absolute; top: 0; bottom: 0;
  width: 30%; z-index: 10; cursor: pointer;
}
.tap-prev { left: 0; }
.tap-next { right: 0; }
.spread-next-btn {
  display: flex;
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 30;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: #141437;
  color: #fff;
  box-shadow: 0 4px 14px rgba(20,20,55,.28);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-20px);
  transition:
    opacity .35s ease,
    transform .35s ease,
    visibility 0s linear .35s;
  cursor: pointer;
}
.spread-next-btn.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0);
  transition-delay: 0s;
}
.spread-next-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pc-next-btn, .pc-prev-btn {
  display: flex;
  position: absolute;
  top: 50%;
  z-index: 30;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: #141437;
  color: #fff;
  box-shadow: 0 4px 14px rgba(20,20,55,.28);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity .35s ease,
    transform .35s ease,
    visibility 0s linear .35s;
  cursor: pointer;
}
.pc-next-btn:hover, .pc-prev-btn:hover { background: #1c1c4d; }
.pc-next-btn {
  right: 12px;
  transform: translateY(-50%) translateX(20px);
}
.pc-prev-btn {
  left: 12px;
  transform: translateY(-50%) translateX(-20px);
}
.pc-next-btn.show, .pc-prev-btn.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}
.pc-next-btn.show { transform: translateY(-50%) translateX(0); }
.pc-prev-btn.show { transform: translateY(-50%) translateX(0); }
.pc-next-btn svg, .pc-prev-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pc-prev-btn svg { transform: rotate(180deg); }
@media (max-width: 640px) {
  .pc-next-btn, .pc-prev-btn { display: none; }
}
.swipe-hint {
  position: absolute; bottom: 12px; left: 50%;
  transform: translateX(-50%);
  font-size: 12.5px; color: var(--gray);
  pointer-events: none; white-space: nowrap;
  transition: opacity .5s;
  background: rgba(255,255,255,.85);
  padding: 4px 14px; border-radius: 6px;
}

.toc-drawer {
  position: absolute;
  top: 0; right: -300px; bottom: 0;
  width: 280px;
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -6px 0 24px rgba(30,42,51,.08);
  z-index: 60;
  transition: right .25s ease;
  display: flex;
  flex-direction: column;
}
.toc-drawer.open { right: 0; }
.toc-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.toc-head .t { font-size: 17px; font-weight: 700; color: var(--ink); }
.toc-head .t small { font-size: 10px; color: var(--blue); letter-spacing: .15em; margin-left: 8px; }
.toc-close {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--line); background: #fff;
  cursor: pointer; color: var(--gray); font-size: 14.5px;
}
.toc-list { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 0; }
.toc-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  cursor: pointer;
  font-size: 12px;
  color: var(--ink-soft);
  transition: background .15s;
  line-height: 1.5;
}
.toc-item:hover { background: var(--blue-pale); color: var(--blue-deep); }
.toc-item.active { background: var(--blue-pale); color: var(--blue); font-weight: 600; }
.toc-item .pg {
  font-size: 11px; color: var(--blue);
  border: 1px solid var(--blue-soft);
  border-radius: 6px;
  padding: 1px 8px;
  width: 42px;
  text-align: center;
  box-sizing: border-box;
  flex-shrink: 0;
}
.toc-item .pg:empty { border-color: transparent; }

.thumb-bar {
  display: flex; gap: 5px;
  padding: 7px 12px;
  overflow-x: auto;
  background: #fff;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  align-items: center;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.thumb-bar::-webkit-scrollbar { display: none; }
.thumb {
  width: 64px; height: 45px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  background: var(--bg-tint);
  transition: border-color .15s;
}
.thumb img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center top;
  display: block; pointer-events: none;
}
.thumb.active { border-color: var(--blue); }
.thumb:hover { border-color: var(--blue-soft); }

#pageWrap {
  overflow: auto;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  scrollbar-width: thin;
}
#pageImg { transform-origin: center center; }

@media (max-width: 640px) {
  .sp-break { display: block; }
  .header {
    height: 45px;
    padding: 10px 20px;
  }
  .header-logo { height: 25px; }
  .security-bar {
    top: 45px;
    font-size: 11px;
    padding: 6px 12px;
  }
  .security-bar b { display: block; }
  #doorPage,
  #viewerPage { padding-top: var(--top-offset, 90px); }
  .latest-toc li { font-size: 14px; }
  .door-title { gap: 8px; }
  .door-title img { width: min(300px, 62vw); }
  .door-title span { font-size: 26.5px; }
  .latest-card { flex-direction: column; }
  .latest-thumb { width: 100%; aspect-ratio: 1.41/1; padding: 16px; }
  .latest-body { padding: 18px 18px 20px; }
  .latest-date { font-size: 19px; }
  .door-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .viewer-toolbar { height: 42px; padding: 0 8px; }
  .nav-btn { width: 30px; height: 30px; font-size: 13.5px; }
  .page-info { font-size: 12.5px; min-width: 44px; }
  .thumb { width: 52px; height: 37px; }
  .toc-drawer { width: 82vw; right: -84vw; }
  .toolbar-title { display: none; }
  #pageWrap.mobile-scroll {
    align-items: flex-start;
    justify-content: flex-start;
    overscroll-behavior: contain;
    touch-action: pan-x pan-y;
    -webkit-overflow-scrolling: touch;
  }
  #pageWrap.mobile-scroll #pageImg {
    max-width: none;
    max-height: none;
    flex: 0 0 auto;
  }
}
img { -webkit-user-drag: none; }

.print-blocked {
  display: none;
}

@media print {
  html,
  body {
    height: auto !important;
    background: #fff !important;
  }

  body > :not(.print-blocked) {
    display: none !important;
  }

  .print-blocked {
    display: flex !important;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    color: #1e2a33;
    font-family: 'Noto Sans JP', sans-serif;
    text-align: center;
  }

  .print-blocked strong {
    font-size: 18pt;
  }

  .print-blocked span {
    font-size: 11pt;
  }
}
