:root {
  color-scheme: dark;
  --bg: #121212;
  --panel: #242424;
  /* 元の#1e1e1eから少し明るくして背景から浮か分ける */
  --text: #e0e0e0;
  --muted: #a0a0a0;
  --line: #4a4a4a;
  /* 元の#333333から明るくして境界線をハッキリさせる */
  --brand: #c39d5b;
  --brand-soft: #2a2212;
  --accent: #d4af37;
}

* {
  box-sizing: border-box;
}

html {}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "BIZ UDPGothic", "Yu Gothic UI", "Hiragino Kaku Gothic ProN", sans-serif;
  font-size: 18px;
  line-height: 1.8;
  position: relative;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
}

h1,
h2,
h3 {
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  line-height: 1.4;
  letter-spacing: 0.04em;
  margin-top: 0;
}

a {
  color: var(--brand);
}

a:hover,
a:focus-visible {
  color: #144148;
}

.container {
  width: min(100%, 94vw);
  max-width: 1100px;
  margin: 0 auto;
}

body[data-page="index"] .container,
body[data-page="video"] .container,
body[data-page="favorites"] .container,
body[data-page="theme"] .container,
body[data-page="operator"] .container,
body[data-page="privacy"] .container {
  width: min(100%, 97vw);
  max-width: 1720px;
}

.layout-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(250px, 18vw, 340px);
  grid-template-areas: "main right";
  padding-top: 20px;
  gap: 32px;
  align-items: start;
}



.main-content {
  grid-area: main;
}

.right-ad {
  grid-area: right;
  /* position: sticky を削除して、メインコンテンツと一緒にスクロールさせる */
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* 隙間を縮小 */
}

.site-header {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.site-icon-wrapper {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.site-icon {
  width: 150%;
  /* 枠の1.5倍に拡大して余白をさらにトリミングする */
  height: 150%;
  display: block;
  object-fit: cover;
}

.site-title {
  margin: 0;
  font-size: 1.85rem;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-weight: 800;
  letter-spacing: 0.1em;
  background: linear-gradient(135deg, #e6c887 0%, #c39d5b 50%, #9a7631 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

/* フッター用レイアウト */
.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

@media (min-width: 769px) {
  .footer-inner {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.site-intro {
  margin-bottom: 16px;
  padding: 0 8px;
}

.site-desc {
  margin: 0 0 16px 0;
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.8;
}

.site-desc:last-of-type {
  margin-bottom: 0;
}

.site-disclaimer {
  display: block;
  margin-top: 24px;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1.6;
}

.header-right {
  display: flex;
  align-items: center;
}

.header-nav {
  display: flex;
  gap: 20px;
  align-items: center;
}

.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 200ms ease;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  /* 薄い背景でバッジ風に */
  border: 1px solid rgba(255, 255, 255, 0.1);
  /* うっすらとした枠線 */
}

.nav-link:hover {
  color: #fff;
  background: rgba(195, 157, 91, 0.2);
  border-color: var(--brand);
  transform: translateY(-2px);
  /* 少しだけ浮き上がる */
}

/* ヘッダーの「お気に入り」リンク専用スタイル */
.fav-link {
  background: rgba(195, 157, 91, 0.1);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.fav-link:hover {
  background: rgba(195, 157, 91, 0.3);
  box-shadow: 0 0 12px rgba(195, 157, 91, 0.5);
  transform: translateY(-3px) scale(1.05);
}

.fav-link svg {
  fill: var(--brand);
  transition: transform 300ms ease;
}

.fav-link:hover svg {
  transform: rotate(35deg) scale(1.2);
}

@media (max-width: 600px) {
  .header-inner {
    flex-direction: column;
    gap: 12px;
  }

  .header-nav {
    gap: 12px;
  }
}

/* 戻るボタン用の独立した装飾 */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: bold;
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all 200ms ease;
  flex-shrink: 0;
}

.btn-back:hover {
  background: rgba(195, 157, 91, 0.2);
  border-color: var(--brand);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ヘッダーのロゴリンク用ホバーアクション */
.home-link {
  transition: opacity 200ms ease;
}

.home-link:hover,
.home-link:focus-visible {
  opacity: 0.8;
}

/* 動画詳細ページのタイトル装飾 */
.video-title-header {
  margin: 0;
  font-size: 1.6rem;
  line-height: 1.4;
  padding: 8px 0 8px 16px;
  position: relative;
  font-weight: bold;
  /* 下にうっすらと線を引く */
  border-bottom: 2px solid rgba(255, 255, 255, 0.05);
}

/* タイトル左側の金色のアクセントライン */
.video-title-header::before {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 0;
  width: 5px;
  background: linear-gradient(180deg, #e6c887 0%, #c39d5b 50%, #9a7631 100%);
  border-radius: 4px;
}

@media (max-width: 600px) {
  .video-title-header {
    font-size: 1.3rem;
  }
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.2);
  /* 少し明るく */
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  /* 影を濃くして立体感を増す・枠線を少し明るく */
  animation: fadeSlideIn 580ms ease-out both;
  scroll-margin-top: 20px;
}

.panel> :last-child {
  margin-bottom: 0 !important;
}

@media (max-width: 768px) {
  .panel {
    border-radius: 0;
    border-left: none;
    border-right: none;
    padding: 20px 14px;
    margin-bottom: 20px;
  }
}

.panel h2 {
  font-size: 1.25rem;
  margin-bottom: 12px;
  color: #e0e0e0;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.section-note,
.search-hint {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.95rem;
}

.popular-hero {
  background: linear-gradient(180deg, rgba(18, 18, 18, 0.3) 0%, rgba(30, 30, 30, 0.8) 100%);
  margin-bottom: 20px;
  padding: 0;
  /* panelクラスのpadding(20px)を打ち消し、中身で余白を制御する */
}

.popular-hero h2 {
  color: var(--accent);
  font-size: 1.15rem;
  margin-bottom: 0;
  /* 下の.video-linksがpadding16px持っているので0にする */
  padding: 16px 16px 0 16px;
  /* h2独自にpaddingで余白を確保 */
}

.search-status {
  margin: 8px 0 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.search-status:empty {
  display: none;
}

.search-status strong {
  color: var(--text);
}

.search-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 1rem;
  background: #1a1a1a;
  color: var(--text);
}

.search-input:focus-visible {
  outline: 3px solid var(--brand-soft);
  border-color: var(--brand);
}

.theme-list {
  display: flex;
  flex-direction: column;
  gap: 48px;
  /* ブロック（時代）ごとの余白を大きくし、切り替わりを明確にする */
}

/* 時代ジャンプ用 タグチップ目次 */
.theme-toc {
  display: flex;
  flex-wrap: wrap;
  /* 折り返しを許可 */
  gap: 12px;
  margin-bottom: 0;
}

.toc-chip {
  /* PCなど十分な幅がある場合は4列（gap 12px × 3箇所分＝36px ÷ 4 ＝ 9px を引く） */
  flex: 1 1 calc(25% - 9px);
  min-width: 180px;
  /* 狭い画面でも潰れないように最小幅を設定 */
  background: linear-gradient(145deg, rgba(195, 157, 91, 0.15), rgba(195, 157, 91, 0.05));
  border: 1px solid rgba(195, 157, 91, 0.5);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  /* ボタンらしい立体感 */
  color: #e0e0e0;
  padding: 12px 16px;
  border-radius: 8px;
  /* 完全な丸から少し角丸のボタン風に変更 */
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: all 200ms ease;
  line-height: 1.3;
}

.toc-chip:hover,
.toc-chip:focus-visible {
  background: linear-gradient(145deg, rgba(195, 157, 91, 0.3), rgba(195, 157, 91, 0.15));
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(195, 157, 91, 0.2);
  color: #fff;
  border-color: rgba(195, 157, 91, 0.8);
}


/* 総合表記（※本ページにはプロモーションを含みます等） */
.ad-disclosure {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 4px;
  text-align: center;
  word-break: keep-all;
}

.ad-slot {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
}

.pr-label {
  display: inline-block;
  padding: 4px 8px;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  background: rgba(0, 0, 0, 0.2);
  border-bottom-right-radius: 8px;
  align-self: flex-start;
}

.ad-slot-body {
  padding: 8px 12px 12px;
  /* 上部の余白を削ってPRラベルに近づける */
  display: flex;
  justify-content: center;
}

.ad-code-area {
  width: min(100%, 320px);
  min-height: 90px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #121212;
  padding: 8px;
  overflow: hidden;
}

.ad-code-area iframe,
.ad-code-area img,
.ad-code-area ins,
.ad-code-area object,
.ad-code-area embed,
.ad-code-area video {
  max-width: 100% !important;
  display: block;
  margin-inline: auto;
}

.ad-code-area a {
  overflow-wrap: anywhere;
}

.ad-placeholder {
  margin: 6px 0;
}

.theme-block {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  overflow: hidden;
  /* 親枠自体のホバーアニメーション（transition, translateY等）は鬱陶しいため撤廃 */
  animation: fadeSlideIn 440ms ease-out both;
}

.theme-header {
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.2);
  /* グラデーションを廃止し、真っ黒ではない薄暗い背景にしてコンテンツと区切りをつける */
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.theme-playlist-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.theme-playlist-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.theme-name {
  margin: 0;
  padding: 0 0 8px 0;
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: transparent;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  position: relative;
  display: inline-block;
}

/* 文字長に合わせたアンダーラインを引いてメリハリをつける */
.theme-name::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--brand) 0%, transparent 100%);
}



.video-links {
  list-style: none;
  margin: 0;
  padding: 16px;
  /* 0から16pxに変更し、左右と上下に余白を作る */
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  /* gapも少し広げてカード同士のすき間も整える */
}

.video-links li {
  border-bottom: 0;
}

.video-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #1a1a1a;
  overflow: hidden;
  height: 100%;
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}

.video-card:hover,
.video-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  border-color: rgba(195, 157, 91, 0.4);
  background: #222222;
}

.video-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #111;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.video-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 300ms ease;
  will-change: transform;
}

.video-card:hover .video-thumb-wrap img {
  transform: scale(1.03);
}

/* お気に入りボタン（星マーク） */
.fav-toggle-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 0;
}

.fav-toggle-btn:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: scale(1.1);
  border-color: rgba(255, 255, 255, 0.4);
}

.fav-toggle-btn svg {
  width: 20px;
  height: 20px;
  transition: all 0.2s ease;
}

/* 通常時は白抜きアウトライン */
.fav-toggle-btn .icon-star-outline {
  display: block;
  stroke: #ffffff;
}

.fav-toggle-btn .icon-star-filled {
  display: none;
  fill: #ffd700;
  /* ゴールド */
}

/* アクティブ（お気に入り済）時は塗りつぶしゴールド */
.fav-toggle-btn.is-active {
  background: rgba(0, 0, 0, 0.6);
  border-color: rgba(255, 215, 0, 0.5);
}

.fav-toggle-btn.is-active .icon-star-outline {
  display: none;
}

.fav-toggle-btn.is-active .icon-star-filled {
  display: block;
}

/* クリック時のポップアニメーション */
@keyframes favPop {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.4) rotate(10deg);
  }

  100% {
    transform: scale(1) rotate(0);
  }
}

.fav-toggle-btn.pop-anim svg {
  animation: favPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.video-info-wrap {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
}

.theme-toggle {
  display: block;
  margin: 0 16px 16px 16px;
  padding: 12px 16px;
  text-align: center;
  background: linear-gradient(135deg, rgba(138, 111, 59, 1), rgba(195, 157, 91, 1));
  border: none;
  border-radius: 30px;
  text-decoration: none;
  font-weight: 900;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  color: #000;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  transition: all 200ms ease;
}

.theme-toggle:hover {
  background: linear-gradient(135deg, rgba(195, 157, 91, 1), rgba(220, 190, 130, 1));
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.5);
}

.video-title-label {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.5;
  word-break: auto-phrase;
  line-break: strict;
  /* 禁則処理を厳格にし、記号等の行頭表示を防ぐ */
  overflow-wrap: anywhere;
  /* 行数制限を一旦解除（長文を想定しないため自然に表示させる） */
}

.video-duration-label {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: auto;
}

.is-hidden {
  display: none !important;
}

.video-links li.is-hidden {
  display: none;
}

.theme-block {
  padding: 16px 0 0;
  /* 内側の余白を用意 */
  border: 2px solid rgba(195, 157, 91, 0.4);
  /* 太めで視認性の高いゴールド系の外枠 */
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  /* 薄い背景でブロック感強調 */
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  scroll-margin-top: 80px;
  /* 固定ヘッダーに重ならないようスクロール位置を調整 */
}

.theme-block:last-child {
  /* 下の点線は撤廃したため、特別扱いは一旦不要 */
}

.video-meta {
  margin: 4px 0 0;
  color: var(--muted);
}

.video-frame-wrap {
  aspect-ratio: 16 / 9;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #111;
}

.video-frame-wrap iframe,
.video-frame-wrap video {
  width: 100%;
  height: 100%;
  border: 0;
}

.summary-block p {
  margin-top: 0;
  margin-bottom: 12px;
}

.bullet-list,
.link-list {
  margin: 0;
  padding-left: 1.2em;
}

.affiliate-list {
  display: grid;
  gap: 10px;
}

.affiliate-item {
  background: #1a1a1a;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}

.affiliate-item a {
  font-weight: 700;
}

.small {
  font-size: 0.9rem;
  color: var(--muted);
}

.strong {
  color: #574512;
  font-weight: 700;
}

/* .site-footer styles moved below */

.back-to-top {
  position: fixed;
  bottom: 24px;
  /* (全体の余白の半分)付近に配置し、最大幅1720pxのコンテンツ外（広告の右側）に出るようにする */
  right: calc(max(10px, calc((100vw - 1720px) / 2 - 80px)));
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--brand);
  /* サイトのテーマカラー（ゴールド系）で統一 */
  color: #121212;
  /* アイコン色は黒系に戻す */
  border: none;
  /* ボーダーは不要 */
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  /* シャドウも元の強さに戻す */
  cursor: pointer;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 400ms cubic-bezier(0.25, 1, 0.5, 1);
}

.back-to-top svg {
  width: 28px;
  height: 28px;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--accent);
  /* ホバー時はテーマのアクセントカラー（少し暗いゴールド）に */
  color: #121212;
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
}

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 10px;
  padding: 8px 0 64px 0;
  /* フッター下部に余白を作り、ボタンと被りにくくする */
  flex-shrink: 0;
}

.site-footer p {
  margin: 0;
  /* pタグのデフォルト余白を強制的にゼロにする */
  font-size: 0.85rem;
  color: var(--muted);
}

@media (max-width: 768px) {
  .back-to-top {
    bottom: 24px;
    right: 20px;
    /* スマホではシンプルに右下に固定 */
    width: 60px;
    /* スマホ用も少し大きく（旧48px） */
    height: 60px;
    /* モバイルでも中央配置を維持するため、rightの指定は不要 */
  }
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}



.back-link {
  text-decoration: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 768px) {
  body {
    font-size: 16px;
    line-height: 1.7;
  }

  .site-header {
    padding-top: 12px;
  }

  .layout-shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "main"
      "right";
  }

  .right-ad {
    position: static;
  }

  .panel {
    padding: 16px;
  }

  .hero-card {
    padding: 24px 16px;
  }





  .right-ad .ad-slot:nth-of-type(2) {
    display: none;
  }

  .ad-code-area {
    width: min(100%, 300px);
  }



  .theme-header {
    display: block;
  }

  .theme-count {
    margin-top: 4px;
  }
}

@media (min-width: 769px) and (max-width: 1280px) {
  body[data-page="index"] .container {
    width: min(1280px, 96vw);
  }

  .layout-shell {
    grid-template-columns: minmax(0, 1fr) 230px;
    gap: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}