/* style.css */
/* サイトの「間取り（配置）」や「スマホでの並び順」を制御するファイルです。 */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background: linear-gradient(135deg, var(--bg-color-start), var(--bg-color-end));
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  padding-bottom: 60px;
}

/* サイト全体を囲むコンテナ（横幅を最大800pxに制限し、中央にバランス良く寄せます） */
.container,
.center-content {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 20px 16px;
}

/* 1. ヘッダーエリア */
header {
  text-align: center;
  margin-bottom: 24px;
  padding: 16px 0;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: 1px;
}

header p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 550px;
  margin: 0 auto;
}

/* 上段ナビゲーション */
.header-nav {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap; /* スマホで折り返しても崩れないようにします */
}

.nav-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none; /* 下線を消します */
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  padding: 6px 16px;
  border-radius: 20px; /* 丸みを持たせてチップ風にします */
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: #100f1d;
  background-color: var(--color-accent);
  border-color: var(--color-accent);
}

/* 2. 動画プレビュー（画面上部中央の16:9比率エリア） */
.video-preview-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background-color: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  margin-bottom: 24px; /* 動画の下の再生ボタンとの間隔を確保 */
}

.video-preview-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 動画の上に薄い闇を重ねて、全体のトーンを落ち着かせます */
.video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.12);
  pointer-events: none;
}

/* 3. 操作ボタン（再生・停止ボタン） */
.main-controls {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 28px;
}

.control-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  font-size: 1.05rem;
  font-weight: 600;
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-md);
}

.play-btn {
  background-color: var(--color-accent);
  color: #100f1d;
}

.play-btn:hover {
  background-color: var(--color-accent-hover);
  transform: translateY(-2px);
}

.stop-btn {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.stop-btn:hover {
  background-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

/* 4. 各コントロールエリア（動画・音楽・環境音）共通のデザイン */
.section-panel {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.section-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
  border-left: 3px solid var(--color-accent);
  padding-left: 10px;
}

/* スマホでも指でシュッと横にスクロールして素材を選べる並び */
.card-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 10px;
}

/* 各選択カードの基本の見た目 */
.item-card {
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  position: relative;
  user-select: none;
  box-sizing: border-box;
}

.item-card:hover {
  background-color: var(--card-bg-hover);
  border-color: rgba(255, 255, 255, 0.15);
}

/* 選択されている時のカード */
.item-card.active {
  background-color: var(--card-bg-active);
  border-color: var(--border-active);
  box-shadow: 0 0 10px rgba(183, 148, 244, 0.25);
}

/* カード右上の「選択中マーク（チェック印）」 */
.active-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 18px;
  height: 18px;
  background-color: var(--color-accent);
  color: #100f1d;
  border-radius: 50%;
  font-size: 10px;
  font-weight: bold;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.item-card.active .active-badge {
  display: flex;
}

/* ① 動画カードの調整 */
.video-card {
  width: calc((100% - 12px) / 2);
  max-width: 170px;
  height: 126px;
  min-height: 126px;
  max-height: 126px;
  padding: 10px 10px 6px 10px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 4px;
}

.thumbnail-wrapper {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 0;
  background-color: #0b0c16;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumbnail-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ② アルバムカードの調整 */
#album-list .item-card {
  width: calc((100% - 12px) / 2);
  max-width: 165px;
  height: 196px;
  min-height: 196px;
  max-height: 196px;
  padding: 10px 10px 7px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
}

#album-list .icon-wrapper {
  width: 100px;
  height: 100px;
  aspect-ratio: 1 / 1;
  margin: 0 auto 0 auto;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background-color: #0b0c16;
  display: flex;
  align-items: center;
  justify-content: center;
}

#album-list .icon-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ③ 環境音カードの調整 */
#ambience-list .item-card {
  width: calc((100% - 12px) / 2);
  max-width: 140px;
  height: 140px;
  min-height: 140px;
  max-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
}

#ambience-list .icon-wrapper {
  width: 100px;
  height: 100px;
  aspect-ratio: 1 / 1;
  margin: 0 auto 0 auto;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background-color: #0b0c16;
  display: flex;
  align-items: center;
  justify-content: center;
}

#ambience-list .icon-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.card-title {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  text-overflow: ellipsis;
  line-height: 1.25;
  height: auto; /* 固定高さを完全に撤廃してコンテンツ量に合わせる */
  width: 100%;
  max-width: 100%;
  text-align: center;
  word-break: keep-all; /* 単語の途中改行を防ぐ */
  overflow-wrap: normal;
  line-break: strict;
  margin: 0;
  padding: 0;
}

.video-card .card-title,
#ambience-list .card-title {
  height: auto; /* 固定高さを完全に撤廃してコンテンツ量に合わせる */
  -webkit-line-clamp: 1;
}

.card-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: 0;
  padding: 0;
  display: block; /* boxからblockに変更して見切れ制限を解除 */
  overflow: visible; /* 全文表示を保証 */
  white-space: normal;
  line-height: 1.25;
  height: auto; /* コンテンツ量に合わせる */
  min-height: 0;
  max-height: none;
  width: 100%;
  max-width: 100%;
  text-align: center;
  word-break: keep-all; /* 単語の途中改行を防ぐ */
  overflow-wrap: normal;
  line-break: strict;
  white-space: pre-line; /* assets.js の \n 改行コードを反映 */
}

/* 5. 音量調整セクション */
.volume-control-group {
  margin-bottom: 16px;
}

.volume-control-group:last-child {
  margin-bottom: 0;
}

.volume-label-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.volume-slider-wrapper {
  display: flex;
  align-items: center;
}

.volume-slider {
  flex-grow: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-accent);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.volume-value {
  font-size: 0.8rem;
  font-weight: 600;
  width: 32px;
  text-align: right;
  color: var(--text-secondary);
}

/* 6. 使い方＆サイトについて */
.info-section {
  background-color: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-top: 32px;
}

.info-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
  text-align: center;
}

.steps-list {
  padding-left: 20px;
  margin-bottom: 24px;
}

.steps-list li {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.about-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-align: center;
  max-width: 580px;
  margin: 0 auto;
}

/* 7. YouTube・X（Twitter）のリンク案内 */
.promo-section {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 24px;
}

/* パソコン等の広い画面では横並びにします */
@media (min-width: 600px) {
  .promo-section {
    grid-template-columns: 1fr 1fr;
  }
  .video-card {
    width: calc((100% - 12px * 4) / 5);
  }
  #album-list .item-card {
    width: calc((100% - 12px * 4) / 5);
    max-width: 165px; /* 音楽カードの横幅を今より広めにする */
  }
  #ambience-list .item-card {
    width: calc((100% - 12px * 5) / 6); /* 環境音カードをPC表示で6列にする */
    max-width: 135px; /* 6列に合う幅に調整 */
  }
}

/* PCで5列並べた音楽カードが窮屈にならないよう、画面幅900px以上の段階でコンテンツ幅を広げる */
@media (min-width: 900px) {
  .center-content {
    max-width: 900px;
  }
}

.promo-card {
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease;
}

.promo-card:hover {
  transform: translateY(-2px);
  background-color: rgba(255, 255, 255, 0.04);
}

.promo-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.promo-card p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  flex-grow: 1;
}

.promo-btn {
  display: inline-block;
  padding: 10px 20px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.youtube-btn {
  background-color: #e53e3e;
  color: #fff;
}
.youtube-btn:hover {
  background-color: #c53030;
}

.x-btn {
  background-color: #000000;
  color: #ffffff;
}
.x-btn:hover {
  background-color: #050505;
}



/* 9. フッターエリア */
footer {
  text-align: center;
  padding: 40px 0 20px 0;
  border-top: 1px solid var(--border-color);
  margin-top: 48px;
}

footer p {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.footer-links a {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--color-accent);
}

/* 10. 広告用サイドレール＆スロット設計 */

/* 通常時（スマホ・タブレット含むデフォルト）のWrapper */
.page-layout {
  width: 100%;
  margin: 0 auto;
}

.left-ad-rail,
.right-ad-rail {
  display: none; /* スマホやタブレットでは非表示 */
}

/* モバイル用上部広告スペース */
.mobile-top-ad-slot {
  display: none; /* 本番公開・AdSense申請用に一時的に非表示 */
  width: 100%;
  min-height: 90px;
  background-color: rgba(255, 255, 255, 0.02); /* 背景を少し薄くして馴染ませる */
  border: 1px dashed rgba(255, 255, 255, 0.05); /* 枠線をさらに薄くする */
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.15); /* 文字を控えめ（薄く）にする */
  font-size: 0.7rem; /* 文字サイズを少し小さく控えめにする */
  letter-spacing: 1px;
  text-align: center;
  margin-bottom: 24px;
  padding: 10px;
  user-select: none;
}

/* PC表示（画面幅1360px以上）のスタイル切り替え */
@media (min-width: 1360px) {
  .page-layout {
    display: flex;
    justify-content: center;
    align-items: stretch; /* ページ下部までサイドレールが自然に伸びる構造にする */
    gap: 40px; /* 中央コンテンツとサイドレールの距離を確保 */
    max-width: 1300px; /* 900px (コンテンツ) + 320px (サイド) + 80px (ギャップ) に調整 */
    margin: 0 auto;
  }

  .center-content {
    max-width: 900px; /* 中央コンテンツ幅を 900px 前後へ広げる */
    margin: 0; /* 横並びにするため margin をリセット */
    flex-shrink: 0;
  }

  /* 左右サイドレール領域の表示化（スクロールしても下部まで自然に伸びる） */
  .left-ad-rail,
  .right-ad-rail {
    display: block;
    flex: 0 0 160px; /* サイドレールの幅を160pxに固定 */
    /* 本番公開用に枠線と背景を完全に透明化（リセット） */
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    min-height: 0 !important;
  }

  /* PC用サイドレール内広告枠（上部に配置） */
  .desktop-ad-slot {
    display: none; /* 本番公開・AdSense申請用に一時的に非表示 */
    width: 160px;
    height: 600px;
    background-color: rgba(255, 255, 255, 0.02); /* 背景を少し薄くして馴染ませる */
    border: 1px dashed rgba(255, 255, 255, 0.05); /* 枠線をさらに薄くする */
    border-radius: var(--radius-sm);
    /* display: flex; は non-display 上書き防止のためコメントアウトします */
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.15); /* 文字を控えめ（薄く）にする */
    font-size: 0.7rem; /* 文字サイズを少し小さく控えめにする */
    letter-spacing: 1px;
    text-align: center;
    padding: 10px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    user-select: none;
    margin-top: 100px; /* コンテンツの上部に合わせるように少し余白を設ける */
  }

  .mobile-top-ad-slot {
    display: none; /* スマホ用上部広告は非表示 */
  }
}

/* PC表示（画面幅1600px以上）のスタイル切り替え */
@media (min-width: 1600px) {
  .page-layout {
    max-width: 1688px; /* 960px (コンテンツ) + 600px (サイド) + 128px (ギャップ) に調整 */
    gap: 64px; /* さらに中央コンテンツとサイドレールを離す */
  }

  .center-content {
    max-width: 960px; /* 1600px以上のときはさらに 960px まで広げる */
  }

  .left-ad-rail,
  .right-ad-rail {
    flex: 0 0 300px; /* サイドレールの幅を300pxに広げる */
  }

  .desktop-ad-slot {
    width: 300px; /* 広告枠を300pxに広げる */
    writing-mode: horizontal-tb; /* 幅が広いので横書きに戻す */
  }
}

/* 11. 素材簡易保存防止（画像と動画の選択・ドラッグコピー禁止） */
img,
video,
.item-card img {
  user-select: none;
  -webkit-user-drag: none;
}