/* PC専用・モバイル専用の表示制御 */
@media (min-width: 769px) {
  .mobile-only {
    display: none !important;
  }

  /* PC用サムネイルボタンを表示 */
  .pc-thumbnail-button-container {
    display: block !important;
  }

  /* PC用ページ遷移ボタンを表示 */
  .pc-page-nav-container {
    display: flex !important;
  }

  /* 古いホバー領域を非表示 */
  .thumbnail-hover-area {
    display: none !important;
  }

  /* モバイル用ボタンを非表示 */
  .thumbnail-toggle-container {
    display: none !important;
  }

  /* PC表示時の見開きページサイズを自然なサイズに */
  .paper-page.spread-left,
  .paper-page.spread-right {
    width: auto !important;
    flex: 0 0 auto;
    max-width: none;
  }

  .paper-spread {
    justify-content: center;
    gap: 0;
    width: auto;
    max-width: none;
  }
}

@media (max-width: 768px) {
  .mobile-only {
    display: inline-block !important;
  }

  /* PC用サムネイルボタンを非表示 */
  .pc-thumbnail-button-container {
    display: none !important;
  }

  /* PC用ページ遷移ボタンを表示（スマホでも表示） */
  .pc-page-nav-container {
    display: flex !important;
  }

  /* スマホ表示時はズーム中にページ遷移ボタンを非表示 */
  .pc-page-nav-container.zoomed {
    display: none !important;
  }

  /* モバイル用サムネイルボタンを表示 */
  .thumbnail-toggle-container {
    display: none !important; /* ヘッダー内ボタンを使用するため非表示 */
  }

  .thumbnail-item {
    width: 100px;
    height: 130px;
  }

  .thumbnail-item.spread-thumbnail {
    width: 160px;
  }

  .paper-layer .youtube-iframe {
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
  }

  .paper-layer .youtube-container {
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
    max-height: 80vh;
    overflow: hidden;
  }

  .paper-page.spread-left,
  .paper-page.spread-right {
    width: 50%;
    align-items: center; /* 中央揃えに戻す */
  }
}

@media (max-width: 480px) {
  .mobile-only {
    display: inline-block !important;
  }

  /* PC用サムネイルボタンを非表示 */
  .pc-thumbnail-button-container {
    display: none !important;
  }

  /* PC用ページ遷移ボタンを表示（スマホでも表示） */
  .pc-page-nav-container {
    display: flex !important;
  }

  /* スマホ表示時のページ遷移ボタンサイズ調整 */
  .pc-page-nav-button {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }

  .pc-page-nav-button i {
    font-size: 14px;
  }

  /* モバイル用サムネイルボタンを表示 */
  .thumbnail-toggle-container {
    display: none !important; /* ヘッダー内ボタンを使用するため非表示 */
  }

  .thumbnail-item {
    width: 90px;
    height: 115px;
  }

  .thumbnail-item.spread-thumbnail {
    width: 140px;
  }

  .paper-viewer-header {
    padding: 10px 5px;
  }

  .date-selector {
    gap: 5px;
  }

  .page-controls {
    gap: 5px;
  }

  /* スマホ表示時のズームボタン調整 */
  .zoom-controls {
    gap: 2px;
    margin: 0 3px;
    padding: 1px;
  }

  .zoom-button {
    padding: 4px 6px !important;
    min-width: 28px;
    height: 28px;
    font-size: 11px;
  }

  .zoom-icon {
    font-size: 12px;
  }

  .nav-button,
  .page-button {
    padding: 6px 10px;
    font-size: 13px;
  }

  .date-input {
    padding: 6px 10px;
    font-size: 13px;
    min-width: 100px;
  }

  .thumbnail-dialog {
    height: 180px;
    padding: 10px;
    background: rgba(128, 128, 128, 0.9);
  }

  .single-page .paper-image {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
  }

  .paper-spread {
    width: 100%;
    height: 100%;
    max-width: 95%;
    max-height: 90%;
    display: flex;
    align-items: center; /* 中央揃えに戻す */
    justify-content: center;
    gap: 0;
    overflow: visible;
    box-sizing: border-box;
    padding: 0;
    margin: 0;
  }

  .paper-page.spread-left,
  .paper-page.spread-right {
    width: calc(50% - 1px);
    align-items: center; /* 中央揃えに戻す */
  }

  .spread-left .paper-image,
  .spread-right .paper-image {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
  }

  .paper-spread .paper-page:only-child {
    width: 50%;
    max-width: 50%;
  }

  .paper-spread .paper-page:only-child .paper-image {
    max-width: 100%;
    max-height: 90vh;
  }

  .paper-banner-title {
    padding: 8px 10px;
  }

  .paper-banner-title h3 {
    font-size: 13px;
  }

  .paper-banner-date {
    padding: 6px 10px;
    flex-direction: column;
    gap: 4px;
  }

  .date-text {
    font-size: 11px;
  }

  .day-text {
    font-size: 10px;
  }

  .paper-layer .youtube-iframe {
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
  }

  .paper-layer .youtube-container {
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
    max-height: 70vh;
    overflow: hidden;
  }

  /* スマホでのレイヤー全体のサイズ制限 */
  .paper-layer {
    max-width: 95vw !important;
    max-height: 70vh !important;
  }
}

.paper-viewer-container {
  height: 92vh;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: visible;
  background: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  position: relative;
  z-index: 1;
}

.paper-viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: #f8f9fa;
  border-bottom: 1px solid #ddd;
  overflow: visible;
  position: relative;
  z-index: 10;
}

.date-selector {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-button,
.page-button {
  padding: 6px 8px;
  border: 1px solid #ddd;
  background: #fff;
  cursor: pointer;
  border-radius: 4px;
  font-size: 12px;
  transition: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  line-height: 1;
  /* 上下動作のみを無効化 */
  transform: none !important;
  animation: none !important;
}

.nav-button i,
.page-button i {
  font-size: 12px;
}

.nav-button:hover,
.page-button:hover {
  background: #e9ecef;
  border-color: #adb5bd;
  /* 動きを禁止 */
  transform: none !important;
  transition: none !important;
  animation: none !important;
}

.nav-button:disabled,
.page-button:disabled {
  opacity: 0;
  cursor: not-allowed;
}

.date-input {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  font-size: 14px;
  text-align: center;
  min-width: 120px;
  cursor: pointer;
  transition: all 0.2s;
}

.date-input:hover {
  background: #f8f9fa;
  border-color: #007cba;
}

.date-input:focus {
  outline: none;
  border-color: #007cba;
  box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
}

/* jQuery UI datepicker のカスタマイズ */
.ui-datepicker {
  font-size: 14px;
  border: 2px solid #007cba !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
  z-index: 9999999 !important;
  position: absolute !important;
  background: white !important;
  max-width: calc(100vw - 20px) !important;
  box-sizing: border-box !important;
}

/* スマホ表示時のカレンダーサイズ調整 */
@media (max-width: 768px) {
  .ui-datepicker {
    max-width: calc(100vw - 20px) !important;
    margin: 0 10px !important;
    font-size: 14px !important;
  }

  .ui-datepicker table {
    width: 100% !important;
  }

  .ui-datepicker td a {
    padding: 8px 6px !important;
    font-size: 14px !important;
  }

  /* タッチデバイスでのホバー状態制御 */
  .pc-page-nav-button:hover {
    background: #f8f9fa !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
  }

  .pc-page-nav-button:active {
    background: #e9ecef !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15) !important;
  }
}

@media (max-width: 480px) {
  .paper-viewer-container {
    height: 80vh;
  }

  .ui-datepicker {
    max-width: calc(100vw - 10px) !important;
    margin: 0 5px !important;
    font-size: 16px !important;
    min-width: 280px !important;
  }

  .ui-datepicker td a {
    padding: 10px 8px !important;
    font-size: 16px !important;
    min-width: 30px !important;
    text-align: center !important;
  }

  .ui-datepicker-header {
    padding: 8px 0 !important;
  }

  .ui-datepicker-title {
    font-size: 16px !important;
  }

  .ui-datepicker-prev,
  .ui-datepicker-next {
    width: 30px !important;
    height: 30px !important;
  }
}

.ui-datepicker-header {
  background: #007cba !important;
  color: white !important;
  border: none !important;
  border-radius: 6px 6px 0 0 !important;
}

.ui-datepicker-title {
  color: white !important;
}

.ui-datepicker-prev,
.ui-datepicker-next {
  background: rgba(255, 255, 255, 0.2) !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  border-radius: 3px !important;
}

.ui-datepicker-prev:hover,
.ui-datepicker-next:hover {
  background: rgba(255, 255, 255, 0.3) !important;
}

.ui-datepicker td a {
  text-align: center !important;
  padding: 6px !important;
  border-radius: 4px !important;
  transition: all 0.2s !important;
}

.ui-datepicker td a:hover {
  background: #007cba !important;
  color: white !important;
  border-color: #007cba !important;
}

.ui-datepicker .ui-state-active {
  background: #007cba !important;
  color: white !important;
  border-color: #007cba !important;
}

.page-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ズーム操作ボタン */
.zoom-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 5px;
  padding: 2px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #f9f9f9;
}

.zoom-button {
  padding: 6px 8px !important;
  margin: 0 !important;
  font-size: 12px;
  line-height: 1;
  min-width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}

.zoom-button i {
  font-size: 12px;
}

.zoom-button:hover {
  background: #e0e0e0;
  transform: none;
}

.zoom-button:active {
  background: #d0d0d0;
}

.zoom-button:disabled {
  opacity: 0;
  cursor: not-allowed;
  background: transparent;
}

/* 無効化されたボタンのスタイル */
.disabled-button {
  opacity: 0 !important;
  cursor: not-allowed !important;
  background-color: #ccc !important;
  color: #666 !important;
}

.disabled-button:hover {
  opacity: 0 !important;
  background-color: #ccc !important;
  color: #666 !important;
}

.zoom-icon {
  font-size: 14px;
  display: inline-block;
}

#page-info {
  font-weight: bold;
  color: #495057;
  min-width: 80px;
  text-align: center;
}

.button {
  padding: 6px 8px;
  border: 1px solid #007cba;
  background: #007cba;
  color: #fff;
  cursor: pointer;
  border-radius: 4px;
  font-size: 12px;
  text-decoration: none;
  transition: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  line-height: 1;
  /* 上下動作のみを無効化 */
  transform: none !important;
  animation: none !important;
}

.button:hover {
  background: #005a87;
  border-color: #005a87;
  /* 動きを禁止 */
  transform: none !important;
  transition: none !important;
  animation: none !important;
}

.button.active {
  background: #dc3545;
  border-color: #dc3545;
  /* 動きを禁止 */
  transform: none !important;
  transition: none !important;
  animation: none !important;
}

.button.active:hover {
  background: #c82333;
  border-color: #c82333;
  /* 動きを禁止 */
  transform: none !important;
  transition: none !important;
  animation: none !important;
}

/* レイヤー切り替えボタン */
.layer-toggle-button {
  display: none; /* デフォルトは非表示、JSで制御 */
  position: relative;
  min-width: 32px;
}

.layer-toggle-button i {
  font-size: 12px;
}

.layer-toggle-button:hover {
  /* 動きを禁止 */
  transform: none !important;
  transition: none !important;
  animation: none !important;
}

/* ツールチップのスタイル */
[title]:hover::after {
  content: attr(title);
  position: absolute;
  top: -35px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 99999;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

[title]:hover::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(0, 0, 0, 0.9);
  z-index: 99998;
  pointer-events: none;
}

/* ボタンに相対位置を設定 */
.nav-button,
.page-button,
.button,
.zoom-button {
  position: relative;
}

/* モバイル用サムネイルボタン（ヘッダー内） */
.mobile-thumbnail-button {
  display: none; /* デフォルトは非表示 */
}

.mobile-thumbnail-button i {
  font-size: 12px;
  margin-right: 4px;
}

.mobile-thumbnail-button .thumbnail-text {
  font-size: 12px;
}

/* PC用とモバイル用の表示制御 */
@media (min-width: 769px) {
  .mobile-thumbnail-button {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .mobile-thumbnail-button {
    display: inline-flex !important;
    align-items: center;
  }

  /* ヘッダーボタンのサイズ調整 */
  .page-controls .button {
    padding: 6px 8px;
    font-size: 12px;
    min-width: 32px;
    height: 32px;
  }

  .mobile-thumbnail-button .thumbnail-text {
    display: inline;
  }
}

@media (max-width: 480px) {
  .mobile-thumbnail-button {
    padding: 6px 8px !important;
    font-size: 12px !important;
    min-width: 32px;
    height: 32px;
  }

  .mobile-thumbnail-button i {
    font-size: 12px !important;
    margin-right: 2px !important;
  }

  .mobile-thumbnail-button .thumbnail-text {
    font-size: 11px !important;
  }

  /* 見開きボタンのテキストを短縮 */
  #toggle-spread {
    font-size: 11px !important;
  }
}

.paper-viewer-main {
  position: relative;
  height: calc(100% - 75px);
  min-height: 400px;
  overflow: hidden;
  z-index: 5;
}

.paper-display {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  cursor: grab;
  touch-action: none;
}

/* PC用サムネイルボタン */
.pc-thumbnail-button-container {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: none; /* デフォルトは非表示、PCでのみ表示 */
}

/* PC用ページ遷移ボタン */
.pc-page-nav-container {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  z-index: 10;
  pointer-events: none;
}

.pc-page-nav-container.zoomed {
  /* ズーム時も上下動作を無効化 */
  transform: translateY(-50%) !important;
  transition: none !important;
  animation: none !important;
}

.nav-button,
.page-controls .button {
  /* 上下動作のみを無効化、レイアウトは保持 */
  transform: none !important;
  transition: none !important;
  animation: none !important;
}

.pc-page-nav-button {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #ddd;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #495057;
  transition: none !important;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  pointer-events: auto;
  /* 上下動作のみを無効化 */
  transform: none !important;
  animation: none !important;
}

.nav-button,
.page-controls .button {
  /* 上下動作のみを無効化、レイアウトは保持 */
  transform: none !important;
  transition: none !important;
  animation: none !important;
}

/* ホバー・アクティブ状態でも動きを禁止 */
.pc-page-nav-button:hover,
.pc-page-nav-button:active,
.nav-button:hover,
.nav-button:active,
.page-controls .button:hover,
.page-controls .button:active {
  transform: none !important;
  transition: none !important;
  animation: none !important;
}

#pc-prev-page {
  position: absolute;
  left: 20px;
}

#pc-next-page {
  position: absolute;
  right: 20px;
}

.pc-page-nav-button:hover {
  background: #333;
  color: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  /* 動きを禁止 */
  transform: none !important;
  transition: none !important;
  animation: none !important;
}

.pc-page-nav-button:active {
  transform: none !important;
  transition: none !important;
  animation: none !important;
}

.pc-page-nav-button:disabled {
  opacity: 0 !important;
  cursor: not-allowed;
  background: #f8f9fa;
  color: #ccc;
}

.pc-page-nav-button:disabled:hover {
  opacity: 0 !important;
  background: #f8f9fa;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pc-page-nav-button i {
  font-size: 16px;
}

.pc-thumbnail-button {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #ddd;
  border-radius: 25px;
  padding: 10px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #495057;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.pc-thumbnail-button:hover {
  background: rgba(255, 255, 255, 1);
  border-color: #007cba;
  color: #007cba;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.pc-thumbnail-button:active {
  transform: translateY(0px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.pc-thumbnail-button i {
  font-size: 16px;
  margin-right: 8px;
}

.pc-thumbnail-button .thumbnail-text {
  font-weight: 500;
}

.paper-display:active {
  cursor: grabbing;
}

#paper-pages {
  width: 100%;
  height: 100%;
  position: relative;
}

/* 紙面コンテナ（ズーム・パン用） */
.paper-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  touch-action: none;
  padding: 0;
  margin: 0;
}

/* ページ要素の基本スタイル */
.paper-page {
  position: relative; /* レイヤーの絶対位置の基準点 */
  padding: 0;
  margin: 0;
}

/* 単ページ表示 */
.paper-page.single-page {
  width: auto;
  height: auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
}

.single-page .paper-image {
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  user-select: none;
  -webkit-user-drag: none;
  opacity: 1;
  display: block;
  margin: 0;
}

/* スマホでの単ページ表示時の初期サイズ改善 */
@media (max-width: 768px) {
  .single-page .paper-image {
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
  }
}

@media (max-width: 480px) {
  .single-page .paper-image {
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
  }
}

.single-page .paper-image.loaded {
  opacity: 1;
}

/* 見開き表示 */
.paper-spread {
  width: 100%;
  /*height: 100%; */
  max-width: 95%;
  /*max-height: 90%; */
  display: flex;
  align-items: center; /* 中央揃えに戻す */
  justify-content: center;
  gap: 0;
  overflow: visible;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

.paper-page.spread-left,
.paper-page.spread-right {
  width: 50%;
  height: 100%;
  position: relative; /* レイヤーの基準点としても機能 */
  display: flex;
  align-items: center; /* 中央揃えに戻す */
  justify-content: center;
  flex-shrink: 0;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

.spread-left .paper-image,
.spread-right .paper-image {
  max-width: 100%;
  /*max-height: 100%;*/
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  user-select: none;
  -webkit-user-drag: none;
  opacity: 1;
  display: block;
  margin: 0;
}

.spread-left .paper-image.loaded,
.spread-right .paper-image.loaded {
  opacity: 1;
}

/* 見開き時の左右ページの調整 */
.spread-left .paper-image {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-radius: 4px 0 0 4px;
}

.spread-right .paper-image {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-radius: 0 4px 4px 0;
}

/* 見開きモード時の調整 */
.paper-viewer-container.spread-mode #paper-pages {
  padding: 0;
  box-sizing: border-box;
}

/* 見開き表示の強制上端配置 */
.paper-viewer-container.spread-mode .paper-spread {
  align-items: flex-start !important;
  align-content: flex-start !important;
  justify-content: center !important;
}

.paper-viewer-container.spread-mode .paper-page.spread-left,
.paper-viewer-container.spread-mode .paper-page.spread-right {
  align-items: flex-start !important;
  align-self: flex-start !important;
  justify-content: center !important;
  vertical-align: top !important;
}

/* 見開きの中のページ（2ページ並び）用の追加強制設定 */
.paper-viewer-container.spread-mode .paper-spread .paper-page.spread-left,
.paper-viewer-container.spread-mode .paper-spread .paper-page.spread-right {
  align-items: flex-start !important;
  align-self: flex-start !important;
  justify-content: center !important;
  vertical-align: top !important;
  display: flex !important;
  flex-direction: column !important;
}

.paper-viewer-container.spread-mode .paper-image {
  align-self: flex-start !important; /* centerではなくflex-startに統一 */
  vertical-align: top !important;
  margin-top: 0 !important;
  margin-bottom: auto !important;
}

/* 見開きの中のページ画像用の追加強制設定 */
.paper-viewer-container.spread-mode .paper-spread .spread-left .paper-image,
.paper-viewer-container.spread-mode .paper-spread .spread-right .paper-image {
  align-self: flex-start !important;
  vertical-align: top !important;
  margin-top: 0 !important;
  margin-bottom: auto !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* 見開きページのレイヤー位置は JavaScript で動的に調整 */

/* ズーム機能関連 */
.paper-container[style*="scale"] {
  cursor: move !important;
}

.paper-container[style*="scale(1)"] {
  cursor: grab !important;
}

/* 座標エリア */
.coordinate-area {
  background: rgba(255, 0, 0, 0.1);
  border: 2px solid transparent;
  pointer-events: auto;
}

.coordinate-area:hover {
  background: rgba(255, 0, 0, 0.2);
  border-color: #ff0000;
}

/* PC用ホバー領域 */
.thumbnail-hover-area {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50px;
  z-index: 5;
  pointer-events: auto;
}

/* 一覧表示ダイアログ */
.thumbnail-dialog {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(128, 128, 128, 0.85);
  backdrop-filter: blur(10px);
  border-top: 1px solid #999;
  z-index: 15;
  padding: 20px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
}

.thumbnail-dialog-content {
  width: 100%;
  height: 150px;
  overflow: hidden;
}

/* PC表示時のサムネイルダイアログ最適化 */
@media (min-width: 769px) {
  .thumbnail-dialog {
    padding: 30px 40px;
  }

  .thumbnail-dialog-content {
    height: 210px;
    overflow: visible;
  }

  #thumbnail-slider {
    height: 100%;
    gap: 25px;
    padding: 20px 0;
    /* 見開きサムネイルが確実に表示されるよう余裕を持つ */
    min-height: 190px;
  }
}

#thumbnail-slider {
  display: flex;
  align-items: center;
  gap: 15px;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 10px 0;
  scrollbar-width: thin;
}

/* PC表示時のスクロール最適化 */
@media (min-width: 769px) {
  #thumbnail-slider {
    padding: 15px 10px;
    gap: 20px;
    /* スクロール時の余裕を追加 */
    padding-right: 40px;
  }
}

/* 左ボタンが進む場合（右寄せ表示） */
#thumbnail-slider.reverse-navigation {
  flex-direction: row-reverse;
  justify-content: flex-start;
}

/* 左ボタンが戻る場合（左寄せ表示） */
#thumbnail-slider.normal-navigation {
  flex-direction: row;
  justify-content: flex-start;
}

#thumbnail-slider::-webkit-scrollbar {
  height: 6px;
}

#thumbnail-slider::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

#thumbnail-slider::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

#thumbnail-slider::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* 背景オーバーレイ */
.thumbnail-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 10;
}

.thumbnail-item {
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  width: 100px;
  height: 130px;
}

/* PC表示時のサムネイルサイズ最適化 */
@media (min-width: 769px) {
  .thumbnail-item {
    width: 130px;
    height: 170px;
    box-sizing: border-box;
    flex-shrink: 0;
  }

  .thumbnail-item.spread-thumbnail {
    width: 260px;
    height: 170px;
    box-sizing: border-box;
    flex-shrink: 0;
  }
}

.thumbnail-item:hover {
  border-color: #007cba;
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.thumbnail-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.page-number {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: bold;
}

/* ローディング表示 */
.loading-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 5;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #007cba;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 10px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* エラー・データなし表示 */
.no-data,
.error {
  text-align: center;
  padding: 40px 20px;
  color: #6c757d;
  font-size: 16px;
}

.error {
  color: #dc3545;
}

/* バナーモード用スタイル */
.paper-banner-container {
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.paper-banner-container:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.paper-banner-link {
  display: block;
  text-decoration: none;
  color: inherit;
  width: 100%;
  height: 100%;
}

.paper-banner-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.paper-banner-title {
  padding: 10px 15px;
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
}

.paper-banner-title h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #495057;
  text-align: center;
}

.paper-banner-image {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
}

.paper-banner-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.paper-banner-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 123, 186, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  z-index: 100;
}

.paper-banner-container:hover .paper-banner-overlay {
  opacity: 1;
}

.view-button {
  background: #fff;
  color: #007cba;
  padding: 10px 20px;
  border-radius: 25px;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.paper-banner-container:hover .view-button {
  transform: scale(1);
}

.paper-banner-date {
  padding: 10px 15px;
  background: #fff;
  border-top: 1px solid #e9ecef;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.date-text {
  font-size: 14px;
  font-weight: 600;
  color: #495057;
}

.day-text {
  font-size: 12px;
  color: #6c757d;
  background: #e9ecef;
  padding: 2px 6px;
  border-radius: 3px;
}

/* データなし表示 */
.paper-banner.no-data {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: #6c757d;
  font-style: italic;
  border: 2px dashed #dee2e6;
  border-radius: 8px;
  background: #f8f9fa;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .paper-viewer-header {
    padding: 10px 15px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .date-selector,
  .page-controls {
    gap: 8px;
  }

  #page-info {
    min-width: 60px;
  }

  .thumbnail-dialog {
    height: 220px;
    padding: 15px;
    background: rgba(128, 128, 128, 0.9);
  }

  .thumbnail-dialog-content {
    height: 170px;
  }

  .nav-button,
  .page-button,
  .button {
    padding: 10px 14px;
    font-size: 16px;
  }

  .date-input {
    padding: 10px 14px;
    font-size: 16px;
  }

  /* 単ページ表示（モバイル）*/
  /*.paper-page.single-page {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
  }*/

  .single-page .paper-image {
    max-width: 100%;
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
  }

  /* 見開き表示（モバイル）*/
  .paper-spread {
    flex-direction: row;
    align-items: flex-start; /* 上端揃えに変更してレイヤー座標を正確にする */
    gap: 0;
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
  }

  .paper-page.spread-left,
  .paper-page.spread-right {
    width: 50%;
    align-items: center; /* 中央揃えに戻す */
  }

  .spread-left .paper-image,
  .spread-right .paper-image {
    max-width: 100%;
    max-height: 80vh;
    width: auto;
    height: auto;
    object-fit: contain;
  }

  /* 見開きで1ページのみの場合（表紙・最終ページ） */
  .paper-spread .paper-page:only-child {
    width: 50%;
    max-width: 50%;
    padding: 0;
    margin: 0;
  }

  .paper-spread .paper-page:only-child .paper-image {
    max-width: 100%;
    max-height: 80vh;
  }

  /* モバイルでの見開き時の角丸調整（左右配置） */
  .spread-left .paper-image {
    border-radius: 4px 0 0 4px;
  }

  .spread-right .paper-image {
    border-radius: 0 4px 4px 0;
  }

  /* バナー（モバイル）*/
  .paper-banner-title h3 {
    font-size: 14px;
  }

  .paper-banner-date {
    padding: 8px 12px;
  }

  .date-text {
    font-size: 12px;
  }

  .day-text {
    font-size: 11px;
    padding: 1px 4px;
  }

  .view-button {
    padding: 8px 16px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .paper-viewer-header {
    padding: 10px 5px;
  }

  .date-selector {
    gap: 5px;
    margin: auto;
  }

  .page-controls {
    gap: 5px;
    margin: auto;
  }

  .nav-button,
  .page-button {
    padding: 6px 10px;
    font-size: 13px;
  }

  .date-input {
    padding: 6px 10px;
    font-size: 13px;
    min-width: 100px;
  }

  .thumbnail-dialog {
    height: 200px;
    padding: 10px;
    background: rgba(128, 128, 128, 0.9);
  }

  .thumbnail-item {
    width: 90px;
    height: 115px;
  }

  .thumbnail-item.spread-thumbnail {
    width: 140px;
  }

  /* 単ページ表示（小画面）*/
  .single-page .paper-image {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
  }

  /* 見開き表示（小画面）*/
  .paper-spread {
    align-items: flex-start; /* 上端揃えに変更してレイヤー座標を正確にする */
    gap: 0;
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
  }

  .paper-page.spread-left,
  .paper-page.spread-right {
    width: calc(50% - 1px);
    align-items: center; /* 中央揃えに戻す */
  }

  .spread-left .paper-image,
  .spread-right .paper-image {
    max-width: 100%;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
  }

  /* 見開きで1ページのみの場合（表紙・最終ページ） */
  .paper-spread .paper-page:only-child {
    width: 50%;
    max-width: 50%;
    padding: 0;
    margin: 0;
  }

  .paper-spread .paper-page:only-child .paper-image {
    max-width: 100%;
    max-height: 90vh;
  }

  /* バナー（小画面）*/
  .paper-banner-title {
    padding: 8px 10px;
  }

  .paper-banner-title h3 {
    font-size: 13px;
  }

  .paper-banner-date {
    padding: 6px 10px;
    flex-direction: column;
    gap: 4px;
  }

  .date-text {
    font-size: 11px;
  }

  .day-text {
    font-size: 10px;
  }
}

/* バナーサイズのバリエーション */
.paper-banner-container.size-small {
  min-height: 150px;
}

.paper-banner-container.size-medium {
  min-height: 200px;
}

.paper-banner-container.size-large {
  min-height: 300px;
}

/* 見開きサムネイル */
.thumbnail-item.spread-thumbnail {
  width: 160px;
}

/* PC表示時の見開きサムネイル最適化 */
@media (min-width: 769px) {
  .thumbnail-item.spread-thumbnail {
    width: 260px !important;
    height: 170px !important;
    box-sizing: border-box;
  }

  .spread-thumbnail-container {
    height: 100%;
    width: 100%;
  }

  .spread-left-thumb,
  .spread-right-thumb {
    object-fit: cover;
    width: 50% !important;
    height: 100% !important;
  }
}

.spread-thumbnail-container {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 4px;
}

.spread-left-thumb,
.spread-right-thumb {
  width: 50%;
  height: 100%;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}

/* PC表示時の見開きサムネイル詳細調整 */
@media (min-width: 769px) {
  .spread-thumbnail-container {
    border-radius: 4px;
    box-sizing: border-box;
  }

  .spread-left-thumb,
  .spread-right-thumb {
    object-fit: cover;
    object-position: center;
  }
}

.spread-left-thumb {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.spread-right-thumb {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

/* レイヤー関連スタイル */
.paper-layer {
  position: absolute;
  transform-origin: top left;
  transition: transform 0.1s ease-out;
  box-sizing: border-box;
  pointer-events: auto;
  z-index: 1000;
}

/* レイヤー内のコンテンツ共通スタイル */
.paper-layer > div {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}

/* 画像レイヤー用スタイル */
.paper-layer img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

/* YouTubeレイヤー用スタイル */
.paper-layer iframe {
  border: none;
  display: block;
  width: 100%;
  height: 100%;
}

/* HTMLレイヤー用スタイル */
.paper-layer .html-content {
  word-wrap: break-word;
  overflow-wrap: break-word;
  font-size: 14px;
  line-height: 1.4;
}

/* レイヤーコンテンツの中央配置 */
.paper-layer .layer-content-center {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* 画像レイヤーの背景 */
.paper-layer .image-container {
  background: rgba(255, 255, 255, 0.9);
}

/* レイヤー編集モーダル用スタイル */
#layer-editor-modal {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#layer-editor-modal .form-table th {
  width: 100px;
  font-weight: 600;
}

#layer-editor-modal .form-table td {
  padding: 8px 0;
}

#layer-editor-modal input[type="text"],
#layer-editor-modal input[type="number"],
#layer-editor-modal input[type="url"],
#layer-editor-modal select,
#layer-editor-modal textarea {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

#layer-editor-modal .small-text {
  width: 80px;
}

#layer-editor-modal .regular-text {
  width: 200px;
}

.layer-item {
  border: 1px solid #ddd;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 4px;
  background: #f9f9f9;
}

.layer-item:hover {
  background: #f0f0f0;
}

#selection-canvas {
  cursor: crosshair;
}

#image-container {
  display: inline-block;
  position: relative;
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
}

/* YouTubeレイヤー用のiframe */
.paper-layer .youtube-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #000;
  position: absolute;
  top: 0;
  left: 0;
  object-fit: contain;
  pointer-events: auto;
  touch-action: auto;
}

/* YouTubeレイヤーコンテナ */
.paper-layer .youtube-container {
  width: 100%;
  height: 100%;
  position: relative;
  background: #000;
  overflow: hidden;
}

/* スマホでのYouTube最適化 */
@media (max-width: 768px) {
  .paper-layer .youtube-iframe {
    /* タッチイベントを確実に処理 */
    touch-action: manipulation;
  }

  /* スマホでのYouTubeコンテナ */
  .paper-layer .youtube-container {
    /* スマホでの表示を最適化 */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform;
  }
}

/* 極小画面でのYouTube最適化 */
@media (max-width: 480px) {
  .paper-layer .youtube-iframe {
    /* 小画面での最適化 */
    min-height: 100px;
  }
}

/* サムネイルトグルボタン（モバイル用） - ヘッダー内に移動済み */
.thumbnail-toggle-container {
  display: none; /* ヘッダー内ボタンを使用するため非表示 */
}

/* 新しいグリッド表示のスタイル */
.paper-grid-container {
  width: 100%;
  margin: 20px auto;
  padding: 0 10px;
}

.paper-grid-items {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: flex-start;
}

.paper-grid-item {
  position: relative;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.paper-grid-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  border-color: #007cba;
}

.paper-grid-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.paper-grid-content {
  position: relative;
}

.paper-grid-title {
  padding: 10px 15px 8px;
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
}

.paper-grid-title h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  line-height: 1.3;
}

.paper-grid-image {
  position: relative;
  overflow: hidden;
  background: #f5f5f5;
}

.paper-grid-image img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.3s ease;
}

.paper-grid-item:hover .paper-grid-image img {
  transform: scale(1.05);
}

.paper-grid-layer-indicator {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 124, 186, 0.9);
  color: white;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 12px;
  z-index: 10;
}

.paper-grid-layer-indicator .layer-icon {
  font-size: 14px;
}

.paper-grid-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 124, 186, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 100;
}

.paper-grid-item:hover .paper-grid-overlay {
  opacity: 1;
}

.paper-grid-overlay .view-button {
  background: white;
  color: #007cba;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.paper-grid-overlay .view-button:hover {
  background: #f0f8ff;
  transform: scale(1.05);
}

.paper-grid-info {
  padding: 12px 15px;
}

.paper-grid-group-name {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
  line-height: 1.3;
}

.paper-grid-date {
  font-size: 12px;
  color: #666;
  line-height: 1.2;
}

.paper-grid-date .date-text {
  margin-right: 4px;
}

.paper-grid-date .day-text {
  color: #999;
}

.paper-grid.no-data {
  text-align: center;
  padding: 40px 20px;
  color: #666;
  font-size: 16px;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
}

/* バナーモードのレイヤーインジケーター・グループ名表示 */
.paper-banner-layer-indicator {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 124, 186, 0.9);
  color: white;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 12px;
  z-index: 10;
}

.paper-banner-layer-indicator .layer-icon {
  font-size: 14px;
}

.paper-banner-info {
  padding: 15px;
}

.paper-banner-group-name {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
  line-height: 1.3;
}

.paper-banner-date {
  font-size: 14px;
  color: #666;
  line-height: 1.2;
}

/* レスポンシブ対応 */
@media (max-width: 1200px) {
  .paper-grid-items {
    gap: 12px;
  }
}

@media (max-width: 768px) {
  .paper-grid-container {
    padding: 0 5px;
  }

  .paper-grid-items {
    gap: 10px;
  }

  .paper-grid-item {
    min-width: calc(50% - 5px) !important;
    flex: 0 0 calc(50% - 5px) !important;
  }

  .paper-grid-title h4 {
    font-size: 13px;
  }

  .paper-grid-group-name {
    font-size: 13px;
  }

  .paper-grid-date {
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .paper-grid-item {
    min-width: 100% !important;
    flex: 0 0 100% !important;
  }

  .paper-grid-info {
    padding: 10px 12px;
  }

  .paper-grid-overlay .view-button {
    padding: 6px 12px;
    font-size: 13px;
  }
}

/* サムネイル内レイヤー表示 */
.paper-grid-thumbnail-container,
.paper-banner-thumbnail-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.paper-grid-base-image,
.paper-banner-base-image {
  width: 100%;
  height: auto;
  display: block;
  position: relative;
  z-index: 1;
}

.paper-grid-layers,
.paper-banner-layers {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.paper-grid-layer,
.paper-banner-layer {
  position: absolute;
  box-sizing: border-box;
  overflow: hidden;
  font-family: inherit;
  z-index: 2;
}

.paper-grid-layer .layer-html-content,
.paper-banner-layer .layer-html-content {
  width: 100%;
  height: 100%;
  overflow: hidden;
  word-wrap: break-word;
  color: inherit;
  background: rgba(255, 255, 255, 0.9);
  padding: 2px;
}

.paper-grid-layer .layer-youtube-placeholder,
.paper-banner-layer .layer-youtube-placeholder,
.youtube-small-trigger,
.layer-youtube-placeholder {
  width: 100%;
  height: 100%;
  min-height: 20px;
  background: #000 !important;
  color: #fff !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  font-weight: bold !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  box-sizing: border-box !important;
  border: none !important;
  outline: none !important;
}

/* YouTubeレイヤーのクリック状態でも背景色を維持 */
.youtube-small-trigger:active,
.youtube-small-trigger:focus,
.youtube-small-trigger:visited,
.youtube-small-trigger:hover,
.layer-youtube-placeholder:active,
.layer-youtube-placeholder:focus,
.layer-youtube-placeholder:visited,
.layer-youtube-placeholder:hover {
  background: #000 !important;
  color: #fff !important;
}

/* YouTubeレイヤー内のテキスト */
.youtube-small-trigger span,
.layer-youtube-placeholder span {
  color: #fff !important;
  pointer-events: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
}

.paper-grid-layer .layer-link-placeholder,
.paper-banner-layer .layer-link-placeholder {
  width: 100%;
  height: 100%;
  min-height: 10px;
}

.paper-grid-layer .layer-mask-placeholder,
.paper-banner-layer .layer-mask-placeholder {
  width: 100%;
  height: 100%;
  min-height: 15px;
  box-sizing: border-box;
  font-weight: bold;
  text-align: center;
}

/* トグル可能レイヤーの視覚的表示 */
.paper-grid-layer[data-toggleable="true"],
.paper-banner-layer[data-toggleable="true"] {
  opacity: 0.8;
  box-shadow: 0 0 0 1px rgba(255, 165, 0, 0.6);
}

/* ページング機能のスタイル */
.paper-grid-pagination {
  margin: 20px 0;
  text-align: center;
}

.pagination-info {
  margin-bottom: 15px;
  font-size: 14px;
  color: #666;
}

.pagination-list {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.pagination-list li {
  margin: 0;
}

.pagination-link {
  display: inline-block;
  padding: 8px 12px;
  text-decoration: none;
  border: 1px solid #ddd;
  border-radius: 4px;
  color: #007cba;
  background: #fff;
  transition: all 0.2s ease;
  font-size: 14px;
  line-height: 1;
}

.pagination-link:hover {
  background: #007cba;
  color: #fff;
  border-color: #007cba;
  text-decoration: none;
}

.pagination-link.pagination-current {
  background: #007cba;
  color: #fff;
  border-color: #007cba;
  cursor: default;
}

.pagination-link.pagination-prev,
.pagination-link.pagination-next {
  font-weight: 600;
}

.pagination-ellipsis {
  display: inline-block;
  padding: 8px 4px;
  color: #999;
  font-size: 14px;
}

/* ページング：レスポンシブ対応 */
@media (max-width: 768px) {
  .pagination-info {
    font-size: 13px;
  }

  .pagination-link {
    padding: 6px 10px;
    font-size: 13px;
  }

  .pagination-list {
    gap: 3px;
  }
}

@media (max-width: 480px) {
  .paper-grid-pagination {
    margin: 15px 0;
  }

  .pagination-info {
    font-size: 12px;
    margin-bottom: 10px;
  }

  .pagination-link {
    padding: 5px 8px;
    font-size: 12px;
  }

  .pagination-ellipsis {
    padding: 5px 2px;
    font-size: 12px;
  }

  /* 小さい画面では前後のリンクを短縮 */
  .pagination-link.pagination-prev::before {
    content: "‹";
  }
  .pagination-link.pagination-next::before {
    content: "›";
  }
  .pagination-link.pagination-prev,
  .pagination-link.pagination-next {
    font-size: 16px;
    padding: 5px 10px;
  }
  .pagination-link.pagination-prev {
    text-indent: -9999px;
    overflow: hidden;
    position: relative;
  }
  .pagination-link.pagination-next {
    text-indent: -9999px;
    overflow: hidden;
    position: relative;
  }
}

/* 記事レイヤー用スタイル */
.paper-layer .article-layer-trigger {
  transition: all 0.2s ease;
}

.paper-layer .article-layer-trigger:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.paper-layer .article-layer-trigger img {
  transition: transform 0.2s ease;
}

.paper-layer .article-layer-trigger:hover img {
  transform: scale(1.05);
}

/* 記事モーダルのスタイル */
.article-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.article-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
}

.article-modal-content {
  position: relative;
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 320px;
  animation: articleModalFadeIn 0.3s ease-out;
}

@keyframes articleModalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.article-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #e5e5e5;
  background: #f8f9fa;
}

.article-modal-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #333;
  flex-grow: 1;
}

.article-modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  margin-left: 16px;
}

.article-modal-close:hover {
  background: #e5e5e5;
  color: #333;
  transform: scale(1.1);
}

.article-modal-body {
  flex: 1;
  overflow: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.article-modal-image-container {
  flex: 1;
  min-height: 200px;
  max-height: 60vh;
  overflow: hidden;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.article-modal-image-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.article-modal-info {
  padding: 24px;
  background: white;
  border-top: 1px solid #e5e5e5;
}

.article-modal-info h4 {
  margin: 0 0 12px 0;
  font-size: 18px;
  font-weight: 600;
  color: #333;
  line-height: 1.4;
}

.article-modal-info p {
  margin: 0;
  font-size: 14px;
  color: #666;
  line-height: 1.6;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .article-modal {
    padding: 10px;
  }

  .article-modal-content {
    min-width: 280px;
    max-width: 95vw;
    max-height: 95vh;
  }

  .article-modal-header {
    padding: 16px 20px 12px;
  }

  .article-modal-title {
    font-size: 18px;
  }

  .article-modal-close {
    font-size: 24px;
    width: 28px;
    height: 28px;
  }

  .article-modal-image-container {
    max-height: 50vh;
  }

  .article-modal-info {
    padding: 20px;
  }

  .article-modal-info h4 {
    font-size: 16px;
    margin-bottom: 10px;
  }

  .article-modal-info p {
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .article-modal {
    padding: 5px;
  }

  .article-modal-content {
    border-radius: 8px;
  }

  .article-modal-header {
    padding: 12px 16px 10px;
  }

  .article-modal-title {
    font-size: 16px;
  }

  .article-modal-info {
    padding: 16px;
  }

  .article-modal-info h4 {
    font-size: 15px;
  }

  .article-modal-info p {
    font-size: 12px;
  }
}
