/* smash_live_card.css - 配信カード（個別の配信行）用スタイル */

/* 個別の配信行 */
.rsg {
    display: flex;
    width: 100%;
    height: auto;
    padding: 12px 0;
    margin: 0;
    background-color: transparent;
    border-bottom: 1px solid #e5e5e5;
    transition: background-color 0.2s;
    position: relative;
    /* 子要素の基準 */
}

.rsg:last-child {
    border-bottom: none;
}

.rsg:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

/* サムネイル容器 */
.result-youtube {
    border-radius: 8px;
    width: 45%;
    aspect-ratio: 16 / 9;
    overflow: visible;
    margin-right: 12px;
    background-color: #000;
    flex-shrink: 0;
    border: none;
    cursor: pointer;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
}

.result-youtube:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.result-youtube img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    /* inline要素特有のベースラインによる隙間を排除 */
    border-radius: 8px;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.result-youtube:hover img {
    transform: scale(1.05);
    filter: brightness(1.1);
}

/* プラットフォームタグ（アイコン化） */
.platform-tag {
    position: absolute;
    top: -10px;
    left: -10px;
    color: white;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 18px;
    z-index: 2;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.platform-tag.youtube {
    background: #ff0000;
}

.platform-tag.twitch {
    background: #9146ff;
}

/* 再生アイコン */
.result-youtube::after {
    content: '▶';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 24px;
    background: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.result-youtube:hover::after {
    opacity: 1;
}

/* 情報表示エリア */
.stream-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
    /* 隙間を個別制御にするために一旦0へ */
    position: relative;
    /* 展開時の基準点 */
}

/* プレイヤー名・キャラ・国 */
.live-player-tag {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    order: 1;
    margin-bottom: 2px;
    /* タイトルとの隙間 */
}

.player-name {
    font-size: 18px;
    font-weight: bold;
    color: #0f0f0f;
    line-height: 1.1;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    word-break: break-all;
    text-decoration: none;
    transition: color 0.2s ease;
}

.player-name:hover {
    color: #065fd4;
    text-decoration: underline;
}

.chara-icon {
    width: 15px;
    height: 15px;
    object-fit: contain;
}

/* 特定のアイコン（例：Mii / 87.svg 等の横広・特殊なもの）が大きく見えてしまうため微縮小 */
img.chara-icon[src*="87.svg"] {
    width: 12px;
    height: 12px;
}

.chara-tooltip {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #ebebeb;
    /* 背景を少し明るいグレーに */
    overflow: hidden;
    flex-shrink: 0;
}

/* キャラ名用ツールチップ（JSで動的に表示） */
.chara-name-tooltip {
    position: fixed;
    z-index: 10001;
    padding: 6px 12px;
    background: rgba(15, 15, 15, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: white;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    pointer-events: none;
    opacity: 0;
    transform: translateY(5px) scale(0.95);
    transition: opacity 0.15s ease, transform 0.15s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.chara-name-tooltip.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.chara-name-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(15, 15, 15, 0.9);
}

/* ツールチップ内でキャラと国旗が連続する場合、間隔を少し詰める */
.chara-tooltip+.flag-tooltip {
    margin-left: -4px;
    /* 親のgap(8px)を相殺して間隔を4pxにする */
}

.flag-emoji,
.flag-tooltip {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #ebebeb;
    /* 背景を少し明るいグレーに */
    overflow: visible;
    /* tooltip要素がはみ出せるようにする */
    flex-shrink: 0;
    cursor: pointer;
}

.flag-emoji img.emoji {
    width: 15px !important;
    height: 15px !important;
    vertical-align: middle !important;
    opacity: 1 !important;
    /* 白い国旗（日本など）が背景と同化しないように、極薄い影（フチの錯覚）をつける */
    filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.3)) !important;
}

/* flag-icons は background-image を使用しているため、サイズ調整のために background-size を利用 */
span.fi.fi {
    width: 15px !important;
    height: 15px !important;
    line-height: 15px !important;
    background-size: cover;
    background-position: center;
    border-radius: 2px;
}

/* ツールチップ（吹き出し） */
.description5 {
    width: max-content !important;
    min-width: auto !important;
    white-space: nowrap !important;
    padding: 4px 10px !important;
    bottom: 30px !important;
}

/* メタ情報 (視聴者数 & 配信時間) */
.stream-meta {
    order: 4;
    margin-top: 1px;
    /* タブと情報の間の隙間を極限まで狭める */
    /* タグが無い場合でも、カード全体の高さを変えずにメタ情報をカードの最下部（サムネイルの下端）に固定する */
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #606060;
}

.viewers {
    color: #cc0000;
    font-size: 15px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 4px;
}

.duration {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 配信タイトルラッパー */
.vtitle-wrapper {
    order: 2;
    min-height: calc(1.2em * 2);
    /* 2行分の高さを確保 */
    position: relative;
    margin-top: 0;
    margin-bottom: auto;
    /* タグとメタ情報をまとめてカード最下部に固定する */
}

/* 配信タイトル */
.live-vtitle {
    margin: 0 !important;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.4;
    font-weight: 600;
    color: #606060;
    cursor: default;
    transition: color 0.2s;
}

.live-vtitle:hover {
    color: #0f0f0f;
}

/* 配信タイトル展開スタイル */
.live-vtitle.is-expanded {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1000;
    -webkit-line-clamp: unset !important;
    line-clamp: unset !important;
    background: #ffffff;
    /* 下にある文字（視聴者数など）を隠すために白背景にする */
    width: 100%;
    padding-bottom: 5px;
    /* 下側に少し余裕を持たせる */
    cursor: pointer;
    color: #0f0f0f;
    height: auto !important;
    display: block !important;
}

/* 展開アイコン（下向き矢印）のスタイル */
.vtitle-expand-icon {
    position: absolute;
    right: 0;
    bottom: -1px;
    /* テキストのベースラインよりほんの少し下に配置 */
    font-size: 11px;
    color: #909090;
    background: #fdfdfd;
    border: 1px solid #d8d8d8;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    /* 丸くして上品に */
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    /* クリックを受け付けるように変更 */
    cursor: pointer;
    /* マウスを合わせた時に指マークにする */
    z-index: 1001;
    /* 展開した時もタイトルの上にくるように */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* クリック可能範囲を広げるための透明な擬似要素 */
.vtitle-expand-icon::after {
    content: '';
    position: absolute;
    top: -10px;
    right: -10px;
    bottom: -10px;
    left: -10px;
}

/* 文字が省略されているときだけ表示 */
.vtitle-wrapper.has-truncation .vtitle-expand-icon {
    opacity: 0.8;
    /* 少し透明度を入れる */
    visibility: visible;
}

/* 既に展開されている場合は隠す */
.live-vtitle.is-expanded~.vtitle-expand-icon {
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(3px);
    /* 消えるときに軽くスライド */
}

/* カードにホバーしたときにアイコンを少し強調 */
.vtitle-wrapper:hover .vtitle-expand-icon {
    color: #065fd4;
    border-color: #065fd4;
    background: #ffffff;
    opacity: 1 !important;
    /* ホバー時ははっきりと表示 */
    box-shadow: 0 2px 5px rgba(6, 95, 212, 0.15);
}

@media (max-width: 480px) {
    .live-vtitle.is-expanded {
        width: 100%;
    }
}