/* ============================================================
   style.css - WEBTOONビューワー
   ============================================================ */

:root {
  --bg:         #0d0d0d;
  --surface:    #1a1a1a;
  --accent:     #ff3c5a;
  --accent-dark:#c42d45;
  --text:       #ffffff;
  --text-sub:   #aaaaaa;
  --header-h:   48px;
}

/* ---- リセット ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans JP', 'Hiragino Sans', sans-serif;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

/* ---- ヘッダー（固定） ---- */
#viewer-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: rgba(13, 13, 13, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  padding: 0 16px;
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

#btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  color: var(--text);
  font-size: 13px;
  padding: 6px 14px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  text-decoration: none;
  white-space: nowrap;
}
#btn-back:hover,
#btn-back:active {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.3);
}

/* ---- メインコンテンツ ---- */
#viewer-wrap {
  padding-top: var(--header-h);
}

/* ---- 画像コンテナ ---- */
#manga-container {
  display: block;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  /* シームレスに見せる */
  line-height: 0;
  font-size: 0;
}

/* ---- 各画像ラッパー ---- */
.manga-page {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  /* 画像間の隙間を完全ゼロに */
  line-height: 0;
}

.manga-page img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  padding: 0;
  border: none;
  /* 保護スタイル */
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  /* Lazy Loadingのフェードイン */
  opacity: 0;
  transition: opacity 0.3s ease;
}

.manga-page img.loaded {
  opacity: 1;
}

/* ---- ローディングプレースホルダー ---- */
.manga-page .placeholder {
  display: block;
  width: 100%;
  /* アスペクト比 3:4 を想定（後でJSで調整） */
  aspect-ratio: 3 / 4;
  background: linear-gradient(135deg, #1a1a1a 25%, #222 50%, #1a1a1a 75%);
  background-size: 400% 400%;
  animation: shimmer 1.4s ease infinite;
}

@keyframes shimmer {
  0%   { background-position: 100% 50%; }
  100% { background-position: 0%   50%; }
}

/* ---- CTAセクション ---- */
#cta-section {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px 60px;
  text-align: center;
  background: linear-gradient(180deg, #0d0d0d 0%, #1a0a0f 100%);
}

#cta-section .cta-label {
  display: block;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--text-sub);
  text-transform: uppercase;
  margin-bottom: 12px;
}

#cta-section .cta-title {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 28px;
  color: var(--text);
}

#btn-cta {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 16px 40px;
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
  border: none;
  width: 100%;
  max-width: 380px;
  transition: background 0.2s, transform 0.1s;
  /* パルスアニメーション */
  animation: pulse 2.4s ease-in-out infinite;
}

#btn-cta:hover,
#btn-cta:active {
  background: var(--accent-dark);
  transform: scale(0.98);
  animation: none;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,60,90,0.4); }
  50%       { box-shadow: 0 0 0 10px rgba(255,60,90,0); }
}

/* ---- スクロールバー非表示（任意） ---- */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: #0d0d0d;
}
::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 4px;
}

/* ---- 自動スクロール コントロールバー（画面下部固定） ---- */
:root {
  --ctrl-h: 56px;
}

#auto-scroll-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--ctrl-h);
  background: rgba(13, 13, 13, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 0 20px;
  z-index: 100;
  /* セーフエリア対応（iPhone ノッチ等） */
  padding-bottom: env(safe-area-inset-bottom);
}

/* 再生/停止ボタン */
#btn-play-pause {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
#btn-play-pause:active {
  background: var(--accent-dark);
  transform: scale(0.93);
}
#btn-play-pause svg {
  width: 16px;
  height: 16px;
  fill: #fff;
  pointer-events: none;
}

/* 速度ラベル */
#speed-label {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-sub);
  white-space: nowrap;
  min-width: 28px;
  text-align: right;
}

/* スライダー */
#speed-slider {
  flex: 1;
  max-width: 200px;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(
    to right,
    var(--accent) 0%,
    var(--accent) var(--slider-pct, 30%),
    rgba(255,255,255,0.15) var(--slider-pct, 30%),
    rgba(255,255,255,0.15) 100%
  );
  outline: none;
  cursor: pointer;
}
#speed-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
  cursor: pointer;
  transition: transform 0.1s;
}
#speed-slider::-webkit-slider-thumb:active {
  transform: scale(1.2);
}
#speed-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: none;
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
  cursor: pointer;
}

/* コントロールバー分だけCTA下にパディング */
#cta-section {
  padding-bottom: calc(60px + var(--ctrl-h));
}

/* ---- スマホ最適化 ---- */
@media (max-width: 480px) {
  #btn-cta {
    font-size: 15px;
    padding: 14px 24px;
  }
  #cta-section .cta-title {
    font-size: 17px;
  }
}
