/* ==========================================================================
   1. 基本リセット & ルート設定
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  /* モバイルでのタップ時の青いハイライトを無効化 */
  -webkit-tap-highlight-color: transparent;
}

body {
  color: white;
  font-family: sans-serif;
  /* 画面からはみ出る要素を隠し、ボディ全体のスクロールを禁止 */
  overflow: hidden;
}

/* ==========================================================================
   2. レイアウト構造 (水平スワイプ)
   ========================================================================== */
.horizontal-wrapper {
  display: flex;
  width: 100vw;
  height: 100vh;
  /* 横方向のスナップスクロールを有効化 */
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  /* スクロールバーを非表示 (Firefox) */
  scrollbar-width: none;
  scroll-behavior: smooth;
}

/* Chrome, Safari, Edge用のスクロールバー非表示設定 */
.horizontal-wrapper::-webkit-scrollbar {
  display: none;
}

.h-page {
  flex: 0 0 100vw; /* 1画面分の幅を確保 */
  height: 100vh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  position: relative;
  overflow-y: auto; /* ページ内は縦スクロール可能に */
  background: #fff;
}

#loading,
#loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(255, 255, 255, 0.8); /* 背景を少し透過させると自然です */
  z-index: 9999;
  /* デフォルトは隠す */
  display: none;
}
/* 読み込み中だけこのクラスをJSでつける */
#loader.active,
#loading.active {
  display: flex;
  justify-content: center;
  align-items: center;
}
/* 子要素：画像のサイズを指定 */
#loader img,
#loading img {
  width: 150px;
  height: 150px;
  object-fit: contain; /* 画像が歪まないように調整 */
}

/* ==========================================================================
   3. フィード & ビデオカード (垂直スワイプ)
   ========================================================================== */
.feed-container {
  width: 100%;
  height: 100vh;
  /* 縦方向のスナップスクロールを有効化 */
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}

.feed-container::-webkit-scrollbar {
  display: none;
}

.video-card {
  position: relative;
  width: 100vw;
  height: 100vh;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  overflow: hidden;
  background: #000;
}

/* 動画の埋め込みエリア（iframeを全画面に広げて調整） */
.video-wrapper {
  width: 100vw;
  height: 100vh;
}
.video-wrapper[rel=x] {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background-color: #fff;
  overflow: hidden;
}

.video-wrapper iframe {
  width: 100%;
  height: 100%;
  pointer-events: none; /* 動画への直接操作を防ぎスワイプを優先 */
  transform: scale(1.2); /* 左右の黒帯を消すための拡大調整 */
  border: none;
}
.video-wrapper[rel=x] iframe {
  width: 100%;
  height: 100%;
  pointer-events: auto; /* 動画への直接操作を防ぎスワイプを優先 */
  transform: scale(1); /* 左右の黒帯を消すための拡大調整 */
  border: none;
}

/* 2. X公式の550px制限を強制上書き */
/* ※生成されたiframeやblockquoteの幅を100%にする */
/* Xが生成するすべての要素の幅制限を解除 */
.video-wrapper .twitter-tweet,
.video-wrapper .twitter-tweet-rendered {
  width: 100% !important;   /* もしくは任意の最大幅 */
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  pointer-events: auto !important; /* 動画への直接操作を防ぎスワイプを優先 */
  transform: scale(1) !important; /* 左右の黒帯を消すための拡大調整 */
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
}

/* ==========================================================================
   4. UIレイヤー (オーバーレイ・操作系)
   ========================================================================== */
.ui-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: flex-end; /* コンテンツを下寄せ */
  padding-bottom: 30px;
  pointer-events: none; /* 背後の動画スワイプを邪魔しない */
}

/* 右側のアイコン一覧（いいね、コメント等） */
.sidebar {
  position: absolute;
  right: 12px;
  bottom: 100px;
  /*display: flex;*/
  display: none;
  flex-direction: column;
  gap: 20px;
  pointer-events: auto; /* ボタン類はクリック可能に */
}

.action-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.action-item i {
  font-size: 32px;
  margin-bottom: 4px;
}

/* 左下の動画情報（ユーザー名、キャプション） */
.video-footer {
  padding: 0 80px 20px 15px; /* 右側はサイドバーと被らないよう広めに余白 */
  pointer-events: auto;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

/* ==========================================================================
   5. コンポーネント (ページヘッダー、バッジ、タグ)
   ========================================================================== */
.page-header {
  padding: 50px 15px 15px;
  font-weight: bold;
  text-align: center;
  border-bottom: 0.5px solid #262626;
  position: sticky;
  top: 0;
  background: #000;
  z-index: 100;
}

/* リンクバッジ（左上の赤いタグ） */
.video-link-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #ff3b5c;
  color: white;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: bold;
  cursor: pointer;
  pointer-events: auto;
}

/* 「見つける」ページ用共通パーツ */
.section-title {
  font-size: 15px;
  margin: 20px 15px 12px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hash-tag, .area-chip {
  background: #262626;
  color: #ccc;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  flex: 0 0 auto;
}

.genre-tag {
  background: #1a1a1a;
  padding: 12px;
  border-radius: 8px;
  text-align: center;
  font-size: 13px;
  border: 0.5px solid #333;
}

.filter-tag {
  background: #f5f5f5;
  color: #333;
  padding: 4px 12px;
  border-radius: 20px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
  .filter-tag:hover,
  .filter-tag.active {
    background: #999;
    color: #fff;
  }

/* ==========================================================================
   6. コンテンツページ
   ========================================================================== */
.fixed-top {
  position: sticky;
  top: 0;
  width: 100%;
  z-index: 1000;
  background: var(--bg-color);
  border-bottom: 1px solid var(--border-light);
}
  .fixed-top header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 5%;
  }
  .fixed-top .logo {
    font-size: 1.25rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-color);
  }
  /* お気に入りボタン */
  .fixed-top .bookmark-trigger {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  /* Tabs */
  .fixed-top .tabs {
    display: flex;
    justify-content: center;
  }
    #filter .fixed-top .tabs {
      margin-top: 10px;
    }
  .fixed-top .tab-item {
    position: relative;
    padding: 0 25px 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.3s ease;
  }
  .fixed-top .tab-item.active {
    color: var(--primary-color);
    font-weight: 700;
  }
  .fixed-top .tab-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10%;
    width: 80%;
    height: 2px;
    background: var(--primary-color);
  }

  /* 絞り込み用ハッシュタグ */
  .fixed-top .tag-bar {
    display: flex;
    overflow-x: auto;
    padding: 10px 5% 5px;
    gap: 8px;
    white-space: nowrap;
    display: none;
  }
  .fixed-top .tag-bar::-webkit-scrollbar {
    display: none;
  }

  /* Viewport */
  #filter,
  #content {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
  }

  .main-viewport {
    height: calc(100vh - 88px);
    overflow: hidden;
  }
  .filter-viewport {
    height: calc(100vh - 27px);
    padding-top: 5px;
    overflow: hidden;
  }
  .filter-slider,
  .content-slider {
    display: flex;
    width: 300%;
    height: 100%;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .filter-slider {
    padding-bottom: 30px;
  }
  .page-section {
    width: 33.333%;
    height: 100%;
    overflow-y: auto;
  }

    /* Grid & Cards */
    .page-section .grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 12px;
      padding: 3px 15px;
      max-width: 800px;
      margin: 0 auto;
    }
    #section-1 {
      padding-top: 15px;
    }
    .page-section .card {
      background: #fff;
      border-radius: 12px;
      overflow: hidden;
      cursor: pointer;
      position: relative;
      padding-top: 5px;
      transition: opacity 0.3s;
    }
    .page-section .content {
      background: #fff;
      overflow: hidden;
      border-radius: 12px;
      cursor: pointer;
      position: relative;
      margin-top: 10px;
      transition: opacity 0.3s;
    }
    .page-section .snap {
      background: #fff;
      overflow: hidden;
      cursor: pointer;
      position: relative;
      padding-top: 5px;
      transition: opacity 0.3s;
    }
      .page-section .snap .card-tag {
        display: none;
      }
    .page-section .card-img {
      width: 100%;
      aspect-ratio: 1/1;
      background: #f8f8f8 center/cover;
    }
      .page-section .snap .card-img {
        border-radius: 12px;
      }
      .page-section .content .card-img {
        aspect-ratio: 1/1.2;
        background-size: auto 150%;
        background-position: center center;
        background-repeat: no-repeat;
        position: relative;
      }
      .page-section .card-img .price {
        position: absolute;
        right: 0;
        bottom: 0;
        width: 150px;
        height: 100px;
        background: url('/img/sale.png');
        background-size: 170px 170px;
        background-position: top 5px right -65px;
        background-repeat: no-repeat;
      }
        .page-section .card-img .price .text {
          position: absolute;
          bottom: 10px;
          right: 0;
          width: 150px;
        }
          .page-section .card-img .price .text div {
            text-align: right;
            padding: 0;
            margin: 0;
            line-height: 100%;
            font-family: "Helvetica Neue", Arial, "Yu Gothic", "游ゴシック", sans-serif;
          }
          .page-section .card-img .price .text .in {
            font-size: 10pt;
            color: #ffff00;
            font-weight: 900;
            padding-right: 8px;
          }
          .page-section .card-img .price .text .out {
            font-size: 45pt;
            line-height: 40%;
            font-weight: 700;
            color: #ffff00;
            text-shadow: 
              4px 4px 0 #ff0000,
              -4px 4px 0 #ff0000,
              4px -4px 0 #ff0000,
              -4px -4px 0 #ff0000;
          }
            .page-section .card-img .price .text .out span {
              font-size: 12pt;
              padding: 0 8px 0 2px;
            }
            .page-section .card-img .price .text.two .out {
              font-size: 45pt;
              line-height: 55%;
            }
            .page-section .card-img .price .text.two .in {
              padding-right: 8px;
            }
              .page-section .card-img .price .text.two .out span {
                padding: 0 8px 0 2px;
              }


    .page-section .card-body {
      padding: 2px 10px 5px;
      background-color: #f0f0f0;
    }
      .page-section .snap .card-body {
        padding: 2px 5px 0;
        background-color: transparent;
      }
      .page-section .content .card-body {
        padding: 2px 10px 0;
        border-bottom-left-radius: 12px;
        border-bottom-right-radius: 12px;
        background-color: #eee;
      }
    .page-section .card-tag {
      font-size: 0.85rem;
      color: var(--accent-color);
      font-weight: 700;
    }
      .page-section .content .card-tag {
        line-height: 25px;
      }
    .page-section .card-title {
      font-size: 0.85rem;
      margin: 0 0 4px;
      font-weight: 700;
      color: var(--primary-color);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .page-section .ad-body {
      padding: 2px 10px 0;
      background-color: #f0f0f0;
      height: 77px;
    }
    .page-section .ad-name {
      font-size: 0.95rem;
      margin: 3px 0 4px;
      font-weight: 700;
      color: var(--primary-color);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .page-section .ad-quantity,
    .page-section .ad-summary {
      font-size: 0.65rem;
      margin: 0;
      font-weight: 700;
      color: var(--text-color);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
      .page-section .snap .card-title {
        margin-top: 8px;
      }
      .page-section .content .card-title {
        margin: 0;
        line-height: 120%;
      }
    .page-section .card-author {
      font-size: 0.65rem;
      margin: 0;
      font-weight: 700;
      color: var(--text-active-color);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
      .page-section .card-author a {
        display: inline-flex; /* 横並びにする */
        align-items: center;  /* 垂直方向の中央揃え */
        gap: 2px;             /* アイコンと文字の間隔（お好みで調整） */
        text-decoration: none; /* 下線を消す場合 */
        color: inherit;        /* 文字色を継承 */
      }
      .page-section .card-author span {
        color: var(--text-active-color);
        width: 14px;
      }
    .page-section .fav-btn-icon {
      position: absolute;
      top: 10px;
      right: 10px;
      background: rgba(255,255,255,0.8);
      border-radius: 50%;
      width: 28px;
      height: 28px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      color: #ccc;
    }
    .page-section .fav-btn-icon.active {
      color: var(--heart-color);
    }



/* Detail Modal */
#sub-h-scroll {
  position: absolute;
  top: 88px;
  left: 0;
  width: 100%;
  padding: 0;
  box-sizing: border-box;
  height: calc(100% - 88px);
  overflow-y: auto;
}
#detailModal {
  padding: 15px 10px;
  box-sizing: border-box;
  background: #fff;
}
  #detailModal #modalImg {
    position: relative;
    height: 280px;
    margin-inline: auto;
    background-position: center 0%;
    background-size: cover;
    background-repeat: no-repeat; /* 意図しない繰り返しを防止 */
    background-color: rgb(238, 238, 238);
    background-image: var(--bg-url);
  }
  #detailModal .modal-body {
    padding: 10px 5px;
    box-sizing: border-box;
  }
  #detailModal .map-wrapper {
    width: 100%;
    height: 350px;
    margin: 0;
    padding: 15px 0;
    overflow: hidden;
  }
  #detailModal iframe {
    width: 100%;
    height: 100%;
    border: 0;
  }
  #detailModal .modalTag {
    color: var(--accent-color);
    font-weight: 700;
    font-size: 0.8rem;
    margin-right: 10px;
  }
  #detailModal .modalDesc {
    line-height: 1.6;
    color: #666;
    font-size: 0.95rem;
  }
  /* Navigation Button */
  #detailModal .nav-link {
    display: flex;         /* blockから変更：アイコンと文字を並べるため */
    align-items: center;   /* 上下中央揃え */
    justify-content: center; /* 左右中央揃え */
    gap: 8px;              /* アイコンと文字の間隔 */
    width: 100%;
    padding: 15px 0;
    margin-top: 10px;
    background: var(--primary-color);
    color: #fff;
    text-align: center;
    text-decoration: none;
    font-weight: 700;
    border-radius: 8px;
    transition: background 0.3s ease;
  }
  /* アイコン（span）のサイズ調整 */
  #detailModal .nav-link .icon-map {
    display: flex;
    align-items: center;
    width: 1.4em;  /* 文字より少し大きくすると視認性が上がります */
    height: 1.4em;
    flex-shrink: 0;
    color: #fff;
  }
  #detailModal .nav-link:hover {
    background: #333;
  }

  /* 基本情報リスト */
  #detailModal .info-list {
    max-width: 600px;
    margin: 20px auto;
    border-top: 1px solid #eee;
  }

  /* 行のスタイル */
  #detailModal .list-row {
    display: flex;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
    align-items: baseline; /* テキストの高さがずれないように調整 */
  }

  /* ラベル部分（左側） */
  #detailModal .list-row dt {
    width: 140px;       /* ラベルの固定幅（好みに合わせて調整） */
    flex-shrink: 0;     /* 幅を縮ませない */
    font-weight: 700;
    font-size: 0.9rem;
    color: #333;
    text-align: left;   /* 左寄せ */
  }

  /* データ部分（右側） */
  #detailModal .list-row dd {
    margin: 0;          /* デフォルトのインデントをリセット */
    flex-grow: 1;
    color: #666;
    text-align: left;   /* 左寄せ */
    line-height: 1.5;
  }
    #detailModal .list-row dd img {
      width: 36px;
      padding: 0 2px;
    }

  /* モバイル対応：画面が狭いときは縦並びにする場合 */
  @media (max-width: 480px) {
    #detailModal .list-row {
      flex-direction: column;
      gap: 8px;
    }
    #detailModal .list-row dt {
      width: 100%;
    }
  }



.visitor-list {
  display: flex;
  gap: 12px;
  padding: 15px;
  overflow-x: auto;
  scrollbar-width: none;
}

.visitor-item {
  flex: 0 0 50px;
  text-align: center;
}

.visitor-img {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  border: 2px solid #262626;
  margin-bottom: 5px;
}