/* 攻略ガイドのビューアー（toketta.com/guide/）。ページは build-guide.py が作った画像。外部のものは読み込まない（紹介ページの CSP） */
:root {
  --navy: #1e1b4b;
  --cream: #fff7ea;
  --yellow: #ffd23f;
  --pink: #ff7ab6;
  --blue: #3d6bff;
  --body: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", "Noto Sans JP", system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--body);
  background: var(--navy);
  color: var(--navy);
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  overscroll-behavior: none;
}
.bar, .tools {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px max(12px, env(safe-area-inset-left)) 8px max(12px, env(safe-area-inset-right));
  background: var(--yellow);
  border-bottom: 3px solid var(--navy);
}
.tools { border-top: 3px solid var(--navy); border-bottom: 0; justify-content: center; flex-wrap: wrap; padding-bottom: max(8px, env(safe-area-inset-bottom)); }
.home { display: flex; align-items: center; gap: 6px; color: var(--navy); text-decoration: none; font-weight: 800; }
.home img { border-radius: 8px; border: 2px solid var(--navy); }
.bar h1 { flex: 1; margin: 0; font-size: 16px; font-weight: 800; text-align: center; }
.btn {
  font: inherit;
  font-weight: 800;
  font-size: 14px;
  color: var(--navy);
  background: #fff;
  border: 2px solid var(--navy);
  border-radius: 10px;
  box-shadow: 3px 3px 0 var(--navy);
  padding: 6px 12px;
  text-decoration: none;
  cursor: pointer;
}
.btn[aria-pressed="true"], .btn[aria-expanded="true"] { background: var(--pink); color: #fff; }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--navy); }
.btn.pdf { background: var(--navy); color: var(--yellow); }
.count { font-weight: 800; color: var(--navy); }
.count input { width: 3.2em; font: inherit; text-align: center; border: 2px solid var(--navy); border-radius: 8px; padding: 4px; }

main { flex: 1; min-height: 0; position: relative; }
.stage { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 12px 52px; touch-action: pan-y pinch-zoom; }
.sheet { height: 100%; max-width: 100%; display: flex; align-items: center; justify-content: center; gap: 0; }
.pg { display: block; max-height: 100%; max-width: 100%; height: auto; background: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); border-radius: 4px; user-select: none; -webkit-user-drag: none; }
.pg[hidden] { display: none; }
.spread .pg { max-width: 50%; }
.spread.alone .pg { max-width: 100%; }
.spread.alone #pageA { border-radius: 4px; }
.spread #pageA { border-radius: 4px 0 0 4px; }
.spread #pageB { border-radius: 0 4px 4px 0; }
.nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 64px;
  font-size: 34px;
  line-height: 1;
  color: var(--navy);
  background: var(--yellow);
  border: 2px solid var(--navy);
  border-radius: 12px;
  cursor: pointer;
  z-index: 2;
}
.nav:disabled { opacity: 0.35; cursor: default; }
.prev { left: 6px; }
.next { right: 6px; }

/* 拡大：幅に合わせて縦に読み進める */
.zoomed .stage { position: absolute; inset: 0; overflow: auto; display: block; padding: 12px; touch-action: auto; }
.zoomed .sheet { height: auto; display: block; }
.zoomed .pg { max-height: none; width: 100%; max-width: 900px; margin: 0 auto 12px; }

.thumbs { position: fixed; inset: 0; background: rgba(30, 27, 75, 0.96); z-index: 10; display: flex; flex-direction: column; }
.thumbs[hidden] { display: none; }
.thumbs-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; color: #fff; font-size: 16px; }
.thumbs-grid { flex: 1; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 14px; padding: 4px 16px 24px; }
.thumbs-grid button { background: none; border: 0; padding: 0; color: #fff; font: inherit; font-weight: 800; cursor: pointer; }
.thumbs-grid img { width: 100%; display: block; border-radius: 4px; border: 3px solid transparent; margin-bottom: 4px; background: #fff; }
.thumbs-grid button[aria-current="page"] img { border-color: var(--yellow); }
.nojs { color: #fff; text-align: center; padding: 24px; }
.nojs a { color: var(--yellow); }

@media (max-width: 520px) {
  .stage { padding: 8px 6px 8px; }
  /* スマホでは本文にかからないよう、下の角に小さく置く（スワイプでも送れる） */
  .nav { top: auto; bottom: 14px; transform: none; width: 40px; height: 40px; font-size: 24px; opacity: 0.9; }
  .bar h1 { font-size: 14px; }
  #spread, #zoom { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .pg { transition: opacity 0.12s ease; }
}
