:root {
    --bg-main: #0f0f0f;
    --bg-header: #202020;
    --bg-card: #181818;
    --text-main: #f1f1f1;
    --text-sub: #aaaaaa;
    --accent: #ff0000;
    --border-soft: #303030;
}

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

body {
    background: var(--bg-main);
    color: var(--text-main);
    font-family: "Roboto", "Noto Sans JP", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ヘッダー */
.header {
    height: 56px;
    background: var(--bg-header);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-soft);
    position: sticky;
    top: 0;
    z-index: 10;
}


/* メニューバー、ロゴ */
.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-icon,
.header-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 700;
    font-size: 18px;
}

.logo-mark {
    width: 24px;
    height: 18px;
    background: var(--accent);
    border-radius: 4px;
    position: relative;
}

.logo-mark::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-35%, -50%);
    border-style: solid;
    border-width: 6px 0 6px 10px;
    border-color: transparent transparent transparent #fff;
}


/* 検索欄 */
.header-center {
    flex: 0 1 600px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-box {
    flex: 1;
    display: flex;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    overflow: hidden;
    background: transparent;
}

.search-box input {
    flex: 1;
    background: #121212;
    border: none;
    padding: 8px 12px;
    color: var(--text-main);
    font-size: 14px;
    outline: none;
}

.search-button {
    width: 60px;
    background: #222;
    border-left: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-sub);
}

.mic-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #272727;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-sub);
}


/* アイコン */
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #888;
}


/* メインレイアウト */
.page {
    display: flex;
    gap: 24px;
    padding: 20px 20px 0px 20px; /* 上右下左 */
}
/* メイン動画 */
.main-column {
    flex: 2;
    min-width: 0;
}
/* オススメ動画 */
.side-column {
    flex: 1;
    min-width: 280px;
}

/* メイン動画 */
.video-player {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-size: 14px;
}

/* 動画タイトル */
.video-title {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 5px;
}
/* 視聴回数 */
.video-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    font-size: 13px;
    color: var(--text-sub);
}

/* アクションバー全体 */
.video-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

/* チャンネル */
.channel-info {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 5px 0px 5px 0px;
}
.main-channel {
    display: flex;
    flex-direction: row; /* ← 横並び固定 */
    gap: 8px;
    width: 100%;
    max-width: 100%;
}
    /* アイコン */
    .channel-icon {
        width: 40px;
        height: 40px;
        border-radius: 50%; /* ← 丸くする */
        object-fit: cover;  /* ← 画像が潰れない */
        cursor: pointer;
    }
    /* 写真が見つからない時のアバター */
    .channel-avatar {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: #777;
    }
    /* チャンネル名、チャンネル登録者 */
    .channel-text {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }
    /* チャンネル名-個別 */
    .channel-name {
        font-size: 14px;
        font-weight: 500;
    }
    .channel-name-row {
        display: flex;
        align-items: center;
        gap: 6px; /* ← アイコンとの距離 */
    }
    /* チャンネル登録者数-個別 */
    .channel-subs {
        font-size: 12px;
        color: var(--text-sub);
    }
    /* ベル、もっと見る */
    .bell-icon,
    .arrow-icon {
        width: 20px;
        height: 20px;
        object-fit: cover;
        cursor: pointer;
    }

/* アクションバー */
.action-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 5px;
}
    /* 高評価 */
    .action-item {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 8px 14px;
        background: #272727;
        border: 1px solid #333;
        border-radius: 999px;
        color: #fff;
        font-size: 14px;
        cursor: pointer;
    }
    .action-item:hover {
        background: #3a3a3a;
    }

    /* ロゴ */
    .icon {
        width: 18px;
        height: 18px;
        background-size: cover;
        background-position: center;
    }
    /* ここにアイコン画像を設定する */
    .icon.like {
        background-image: url('img/高評価.png');
    }
    .icon.share {
        background-image: url('img/共有.png');
    }
    .icon.save {
        background-image: url('img/保存.png');
    }
    .icon.thanks {
        background-image: url('img/Thanks.png');
    }
    .icon.more {
        background-image: url('img/さらに表示.png');
    }

/* 概要欄 */
.description-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 15px;
    font-size: 14px;
    color: var(--text-main);
    margin-bottom: 20px;

    max-height: 240px; /* ← ここで高さを調整 */
    overflow-y: auto;  /* ← はみ出したらスクロール */
}

    .description-text {
        max-height: 100px;
        overflow-y: auto;
        scrollbar-width: none; /* Firefox */
    }
    .description-text::-webkit-scrollbar {
        display: none; /* Chrome, Safari */
    }




/* チャット欄全体 */
.chat-box {
    background: #111;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 20px;
    
    height: 330px;
    display: flex;
    flex-direction: column;
}

    /* チャットメッセージ表示部分 */
    .chat-messages {
        flex: 1;
        overflow-y: auto;
        padding: 10px;
        padding-right: 4px;

        display: block;
        scrollbar-width: thin;
        scrollbar-color: #606060 transparent;
    }

    /* スクロールバー全体の幅を決める */
    .chat-messages::-webkit-scrollbar {
        width: 6px;
    }
    /* スクロールバーの「つまみ（動く部分）」のデザイン */
    .chat-messages::-webkit-scrollbar-thumb {
        background: #555;
        border-radius: 3px;
    }
    /* スクロールバーの「背景（レール部分）」 */
    .chat-messages::-webkit-scrollbar-track {
        background: transparent;  /* トラック透明 */
    }
    /* ホバーしたときだけ色を明るくする */
    .chat-messages::-webkit-scrollbar-thumb:hover {
        background: #909090;     /* ホバー時に少し明るく */
    }

@keyframes chatIn {
    from {
    opacity: 0;
    transform: translateY(6px);
    }
    to {
    opacity: 1;
    transform: translateY(0);
    }
}

/* 通常メッセージ */
    /* 個別メッセージ */
    .chat-icon {
        width: 25px;
        height: 25px;
        border-radius: 50%;
        margin-right: 6px;
        flex-shrink: 0;
    }
    /* アイコン+ID+文章 */
    .chat-message {
        display: flex;
        align-items: flex-start; /* ← アイコンを1行目に揃える */
        gap: 5px;
        width: 100%;
        margin: 6px 0;
    }
    /* ユーザ名 */
    .chat-user {
        font-size:13px;
        font-weight: bold;
        flex-wrap:nowrap;
        color: #aaaaaa;
        line-height: 1.5;
    }
    /* メッセージ */
    .chat-text {
        font-size: 13px;
        color: #ffffff;
        line-height: 1.5;
        white-space: normal;
        flex: 1;
    }

/* スパチャ */
    .superchat {
        width: 100%;
        padding: 10px;
        border-radius: 8px;
        margin-bottom: 10px;
        color: #fff;
        font-size: 14px;
        box-sizing: border-box;
        margin: 10px 0;
    }
    .superchat-header {
        display: flex;
        gap:10px;
        margin-bottom: 10px;
    }
    .superchat-user {
        font-size: 13px;
        color: #dddddd;
        line-height: 1.5;
    }
    .superchat-amount {
        font-size: 13px;
        margin-left:5px;
        font:bold;
        line-height: 1.5;
    }
    .superchat-text {
        line-height: 1.5;
        white-space: normal;
    }

/* 入力欄 */
    .chat-input-area {
        display: flex;
        gap: 8px;
        margin-top: 10px;
    }
    .chat-input-area input {
        flex: 1;
        padding: 8px;
        border-radius: 6px;
        border: 1px solid #444;
        background: #222;
        color: #fff;
        outline: none;
    }
    /* 送信ボタン */
    .chat-input-area button {
        padding: 8px 12px;
        background: #3ea6ff;
        border: none;
        border-radius: 6px;
        color: #000;
        font-weight: 600;
        cursor: pointer;
    }

/* サイドバー（おすすめ動画） */
.side-video {
    display: flex;
    flex-direction: row; /* ← 横並び固定 */
    gap: 8px;
    width: 100%;
    height: 94px;
    max-width: 100%;
    margin-bottom: 10px;
}

/* サムネ全体 */
.side-thumb {
    position: relative;
    width: 150px;
    height: 84px;
    flex-shrink: 0;
    aspect-ratio: 16 / 9;
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    overflow: hidden;
}

/* 再生時間（右下の黒帯） */
.thumb-time {
    position: absolute;
    right: 6px;
    bottom: 6px;
    background: rgba(0, 0, 0, 0.8);
    padding: 2px 6px;
    font-size: 12px;
    border-radius: 4px;
    color: #fff;
    font-weight: 600;
}

/* 赤い再生バー（下部） */
.thumb-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.3); /* 未視聴部分 */
}

.thumb-progress-bar {
    height: 100%;
    background: #ff0000; /* YouTube の赤 */
}

/* オススメ動画 */
.side-video {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;

    width: 100%;
    margin-bottom: 10px;
    text-decoration: none; /* 下線を消す */
    color: inherit;        /* 文字色を継承 */
}


.side-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
}

.side-title {
    font-weight: 500;
    color: var(--text-main);
}

.side-channel,
.side-meta {
    color: var(--text-sub);
    font-size: 12px;
}

/* ============================
   📱 スマホ版レイアウト（〜1000px）
   ============================ */
@media (max-width: 1000px) {

    /* ページ全体を縦並びに */
    .page {
      flex-direction: column;
      padding: 10px;
      gap: 16px;
    }
  
    /* メイン動画幅をスマホに最適化 */
    .main-video-container {
      width: 100%;
      height: auto;
      padding-left: 0;
    }
  
    /* 動画プレイヤーは画面幅いっぱい */
    .video-player {
      width: 100%;
      max-width: 100%;
      border-radius: 0;
    }
  
    /* タイトルを少し大きく */
    .video-title {
      font-size: 18px;
      line-height: 1.4;
    }
  
    /* チャンネル情報を縦積みに */
    .video-actions {
      flex-direction: column;
      align-items: flex-start;
      gap: 12px;
      padding-top: 5px;
    }
  
    .channel-info {
      width: 100%;
      justify-content: flex-start;
    }
  
    /* アクションバーを横スクロールに（YouTubeアプリ風） */
    .action-bar {
      width: 100%;
      overflow-x: auto;
      padding-bottom: 6px;
    }
    .action-bar::-webkit-scrollbar {
      display: none;
    }
  
    /* ▼ メイン動画の下にチャット欄を表示 */
    .chat-box {
        height: auto;        /* ← 固定高さを解除 */
        height: 400px;   /* ← 必要なら上限だけ付ける */
        overflow: hidden;    /* ← 外に飛び出さないようにする */
    }
    
    .chat-messages {
        max-height: 340px;   /* ← 内部スクロールの高さを固定 */
        overflow-y: auto;    /* ← コメントはここでスクロール */
    }
  
    /* おすすめ動画を縦1列に */
    .side-column {
      width: 100%;
    }

    /* ▼ おすすめ動画全体：縦並びにする */
    .side-video {
        display: flex;
        flex-direction: column;   /* ← YouTubeアプリと同じ縦並び */
        width: 100%;
        gap: 6px;
        height: auto !important;  /* ← PC版の94pxを完全に無効化 */
        padding-bottom: 12px;
    }
      
    /* ▼ サムネイル：横幅100%・16:9固定 */
    .side-thumb {
        width: 100%;
        aspect-ratio: 16 / 9;     /* ← 16:9固定 */
        height: auto;
        border-radius: 8px;
        background-size: cover;
        background-position: center;
        flex-shrink: 0;
    }
      
    /* ▼ テキスト部分：横幅100% */
    .side-info {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }
      
    /* ▼ タイトル：YouTubeアプリと同じ2行制限 */
    .side-title {
        font-size: 15px;
        font-weight: 500;
        line-height: 1.3;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
      
    /* ▼ チャンネル名・投稿日：1行で省略 */
    .side-channel,
    .side-meta {
        font-size: 13px;
        color: var(--text-sub);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

      
      /* ヘッダーの検索バーを縮小（YouTubeアプリ風） */
    .header-center {
        flex: none;
        width: auto;
    }
    
    .search-box {
        display: none; /* スマホでは非表示 */
    }
    
    .mic-button {
        display: none;
    }
    
    /* 検索アイコンだけ右側に表示 */
    .header-right .header-icon:nth-child(1) {
        background-image: url('img/検索.png');
        background-size: cover;
    }

}
  