@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700;900&display=swap');

:root {
  --white:        #ffffff;
  --bg:           #f2f2f2;
  --panel:        #ffffff;
  --orange:       #e8650a;
  --orange-hover: #cf5608;
  --orange-light: #fff5ee;
  --orange-pale:  #fde8d8;
  --text:         #333333;
  --text-sub:     #666666;
  --text-muted:   #999999;
  --border:       #dddddd;
  --border-light: #eeeeee;
  --shadow-sm:    0 1px 4px rgba(0,0,0,.08);
  --shadow:       0 3px 12px rgba(0,0,0,.10);
  --shadow-lg:    0 8px 32px rgba(0,0,0,.14);
  --radius:       8px;
  --radius-sm:    4px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, "Yu Gothic UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
}

/* ===== ヘッダー ===== */
.topbar {
  background: var(--white);
  border-bottom: 3px solid var(--orange);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left { display: flex; align-items: center; gap: 14px; }

.topbar-logo {
  font-size: 22px;
  font-weight: 900;
  color: var(--orange);
  letter-spacing: -.01em;
  line-height: 1.1;
  white-space: nowrap;
}
.topbar-logo span {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-sub);
  letter-spacing: .04em;
  margin-top: 1px;
}

.topbar-title-block h1 {
  margin: 0 0 3px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.topbar-title-block h1 .vol {
  display: inline-block;
  background: var(--orange);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: var(--radius-sm);
  margin-left: 8px;
  vertical-align: middle;
}
.topbar-title-block p {
  margin: 0;
  color: var(--text-sub);
  font-size: 11px;
  line-height: 1.5;
}

.page-meta {
  background: var(--orange);
  color: #fff;
  padding: 7px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  letter-spacing: .02em;
}

/* ===== メインアプリ ===== */
.app {
  max-width: 1500px;
  margin: 0 auto;
  padding: 16px 18px 28px;
}

/* ===== ビューア ===== */
.viewer-wrap {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}
.viewer {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 72vh;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.page-stage {
  width: 100%;
  height: 72vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== リンクエリア ===== */
.page-link {
  position: absolute;
  display: block;
  background: transparent;
  border: none;
  text-indent: -9999px;
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background .12s, outline .12s;
}
.page-link:hover,
.page-link:focus {
  background: rgba(232,101,10,.15);
  outline: 2px solid rgba(232,101,10,.5);
  outline-offset: -1px;
}

/* ===== ナビボタン ===== */
.nav {
  appearance: none;
  border: 1px solid var(--border);
  cursor: pointer;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  background: var(--white);
  color: var(--text);
  font-size: 36px;
  line-height: 1;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  transition: background .15s, border-color .15s, color .15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav:hover {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
}
.nav:disabled { opacity: .3; cursor: default; }

/* ===== フッター / サムネイル ===== */
.footer {
  margin-top: 12px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px 14px;
  box-shadow: var(--shadow-sm);
}

.thumbs {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  justify-content: center;
  flex-wrap: wrap;
}
.thumbs::-webkit-scrollbar { height: 4px; background: var(--bg); }
.thumbs::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.thumb {
  flex: 0 0 auto;
  width: 80px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  cursor: pointer;
  color: var(--text);
  transition: border-color .15s, background .15s;
}
.thumb:hover {
  border-color: var(--orange);
  background: var(--orange-light);
}
.thumb.active {
  border-color: var(--orange);
  background: var(--orange-pale);
  box-shadow: 0 1px 6px rgba(232,101,10,.2);
}
.thumb span {
  display: block;
  font-size: 10px;
  font-weight: 700;
  margin-top: 4px;
  text-align: center;
  line-height: 1.2;
  color: var(--text-sub);
}
.thumb.active span { color: var(--orange); }

.note {
  color: var(--text-muted);
  font-size: 12px;
  margin: 12px 0 0;
  text-align: center;
  line-height: 1.7;
  border-top: 1px solid var(--border-light);
  padding-top: 10px;
}

/* ===== 複数URLポップアップ ===== */
.link-popup {
  position: fixed;
  z-index: 9999;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px 10px;
  min-width: 200px;
  max-width: 340px;
  box-shadow: var(--shadow-lg);
}
.link-popup-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 8px;
}
.link-popup a {
  display: block;
  color: var(--orange);
  font-size: 13px;
  text-decoration: none;
  padding: 5px 0;
  border-top: 1px solid var(--border-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.link-popup a:first-of-type { border-top: none; }
.link-popup a:hover { color: var(--orange-hover); text-decoration: underline; }

/* ===== スマホ ===== */
@media (max-width: 768px) {
  .topbar {
    padding: 10px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .topbar-logo { font-size: 18px; }
  .topbar-title-block h1 { font-size: 13px; }
  .topbar-title-block p  { font-size: 10px; }
  .page-meta { padding: 6px 12px; font-size: 12px; }

  .app { padding: 8px 8px 16px; }
  .viewer-wrap {
    grid-template-columns: 32px 1fr 32px;
    gap: 4px;
  }
  .viewer { padding: 6px; min-height: auto; border-radius: 10px; }
  .page-stage { height: 66vh; }
  .nav { width: 32px; height: 32px; font-size: 22px; }
  .footer { padding: 8px 10px 12px; }
  .thumb {
    width: auto; min-width: 52px; height: 36px;
    padding: 0 8px;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .thumb-page-label {
    display: block; font-size: 12px; font-weight: 700;
    line-height: 1; margin: 0; white-space: nowrap;
  }
  .thumbs { justify-content: flex-start; flex-wrap: nowrap; }
}

/* ===== PC ===== */
@media (min-width: 769px) {
  .footer { display: flex; flex-direction: column; align-items: center; }
  .thumbs { width: fit-content; max-width: 100%; margin: 0 auto; }
  .note { align-self: stretch; }
}

/* ===== ページフェードアニメーション ===== */
@keyframes page-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.page-fade-in {
  animation: page-fade-in 0.8s ease-in-out;
}
