/* ============================================================
   🌐 ベーススタイル
   ============================================================ */
html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background-color: #f4f6f9;
    color: #333;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

main.main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* スマホ汎用余白 */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
}

/* ============================================================
   🏷 見出しデザイン（h3, h5）
   ============================================================ */
h3 {
    position: relative;
    font-size: 2.3rem;
    font-weight: 700;
    color: #111;
    margin: 0.8em 0 1em;
    padding-bottom: 0.45em;
    border-bottom: 2px solid #0078d7;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 0.5em;
}

h3 i {
    color: #0078d7;
    font-size: 1.4em;
    margin-right: 4px;
}

/* 下線に軽い光沢 */
h3::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(to right, #0078d7, #66b2ff);
    opacity: 0.25;
}

h5 {
    position: relative;
    font-size: 1.35rem;
    font-weight: 600;
    color: #222;
    margin-top: 1.4em;
    margin-bottom: 0.7em;
    padding-left: 14px;
    line-height: 1.4;
}

h5::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 1.2em;
    background-color: #0078d7;
    border-radius: 2px;
}

/* 📱 スマホ用微調整 */
@media (max-width: 768px) {
    h3 {
        font-size: 1.8rem;
        margin: 0.6em 0 0.9em;
        padding-bottom: 0.35em;
    }

    h5 {
        font-size: 1.3rem;
        padding-left: 12px;
    }

    h5::before {
        width: 4px;
        height: 1.1em;
    }
}

/* ============================================================
   🧭 ナビゲーションバー
   ============================================================ */
.navbar {
    background-color: #102b47;
    color: white;
    padding: 12px 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    margin-bottom: 5px;
}

.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.navbar-title .title-link {
    color: #fff;
    font-size: 2rem;
    font-weight: bold;
    text-decoration: none;
}

.navbar-title .title-link:hover {
    text-decoration: underline;
}

/* ナビリンク */
.navbar-links {
    display: flex;
    gap: 15px;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-size: 1.2rem;
    padding: 6px 10px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.nav-link.active {
    background-color: rgba(255, 255, 255, 0.3);
    font-weight: bold;
}

/* 🍔 ハンバーガーメニュー */
.menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, color 0.2s ease;
}

.menu-toggle:hover {
    transform: scale(1.1);
    color: #66b2ff;
}

/* ✕マーク非表示（デフォルト） */
.menu-toggle .fa-xmark {
    display: none;
}

/* 開閉制御 */
.menu-toggle.active .fa-bars {
    display: none;
}

.menu-toggle.active .fa-xmark {
    display: inline;
}

@media (min-width: 769px) {
    .menu-toggle {
        display: none;
    }
}

@media (max-width: 768px) {
    .navbar-container {
        flex-wrap: wrap;
        margin: 0;
    }

    .navbar-links {
        display: none;
        flex-direction: column;
        width: 100%;
        padding: 0;
        margin: 0;
        gap: 0;
    }

    .navbar-links.show {
        display: flex;
    }

    .nav-link {
        display: block;
        width: 100%;
        padding: 14px 10px;
        margin: 0;
        text-align: center;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
    }

    .navbar-links .nav-link:first-child {
        border-top: none;
    }

    .nav-link:hover {
        background-color: rgba(255, 255, 255, 0.15);
    }
}

/* ============================================================
   📋 ページネーション
   ============================================================ */
.pagination-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 32px 0;
    font-family: "Segoe UI", "Hiragino Sans", sans-serif;
    text-align: center;
    width: 100%;
}

.pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
}

.pagination a,
.pagination .current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
    text-decoration: none;
    border: 1px solid #ddd;
    background-color: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.pagination a:hover {
    background-color: #007bff;
    color: #fff;
    border-color: #007bff;
    transform: translateY(-1px);
}

.pagination .current {
    background-color: #007bff;
    color: #fff;
    font-weight: 600;
    border-color: #007bff;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.25);
}

.page-info {
    margin-top: 10px;
    font-size: 14px;
    color: #555;
}

@media (max-width: 480px) {

    .pagination a,
    .pagination .current {
        min-width: 32px;
        height: 32px;
        font-size: 13px;
    }
}

/* ============================================================
   🧾 モダンテーブル
   ============================================================ */
.table-wrapper {
    width: 100%;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
    -webkit-overflow-scrolling: touch;
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    word-break: break-word;
    overflow-wrap: break-word;
    margin: 0;
}

.modern-table th,
.modern-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
    vertical-align: middle;
    white-space: normal;
}

.modern-table th {
    background-color: #333;
    color: #fff;
}

.modern-table tr:nth-child(even) {
    background-color: #fafafa;
}

/* ============================================================
   ⚠️ 警告・フォーム関連
   ============================================================ */
.alert {
    text-align: center;
    background: #ffe9b3;
    color: #333;
    padding: 1rem;
    border-radius: 8px;
}

.hidden {
    display: none !important;
}

form.search-form {
    font-family: "Segoe UI", sans-serif;
}

.toggle-group {
    display: inline-flex;
    border: 1px solid #ccc;
    border-radius: 6px;
    overflow: hidden;
    vertical-align: middle;
    padding: 0;
    margin-bottom: 10px;
}

.toggle-button {
    padding: 8px 16px;
    margin: 0;
    border: none;
    cursor: pointer;
    background: #f4f4f4;
    color: #333;
    font-size: 14px;
    line-height: 1.4;
    transition: background 0.2s, color 0.2s;
}

.toggle-button:not(:last-child) {
    border-right: 1px solid #ccc;
}

.toggle-button.active {
    background: #2c7be5;
    color: #fff;
}

.toggle-button:hover:not(.active) {
    background: #e9e9e9;
}

/* === ボタン === */
.btn-main {
    font-size: 1.6rem;
    background-color: #3b6ee0;
    color: #fff;
    border: #0056b3;
}

.button {
    font-size: 1.6rem;
    background-color: #3b6ee0;
    border: #0056b3;
}

form.search-form input[type="text"],
form.filter-form input[type="text"],
form.search-form select {
    background-color: #fff;
}

/* 📱 スマホフォーム調整 */
@media (max-width: 768px) {
    form.search-form .form-group {
        margin: 0 0 4px 0 !important;
        padding: 0;
    }

    form.button {
        font-size: 1.4rem;
    }

    form.search-form label {
        font-size: 1.4rem;
        margin-bottom: 2px;
        color: #444;
    }

    form.search-form input[type="text"],
    form.filter-form input[type="text"],
    form.search-form select {
        width: 100%;
        font-size: 1.4rem;
        padding: 6px 8px;
        border: 1px solid #ccc;
        border-radius: 4px;
        margin-bottom: 2px !important;
        background-color: #fff;
    }

    form.filter-form .btn-main,
    form.search-form .btn-main {
        width: 100%;
        font-size: 1.6rem;
        padding: 10px 12px;
        height: 42px;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: var(--color-cakephp-red);
        color: #fff;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        transition: background-color 0.2s ease;
    }

    form.search-form .btn-main:hover {
        background-color: #b32b30;
    }

    .toggle-group {
        display: flex;
        justify-content: space-between;
        width: 100%;
        margin-bottom: 4px;
    }

    .toggle-button {
        flex: 1;
        padding: 8px 0;
        font-size: 0.85rem;
        line-height: 1.2;
    }
}

/* ============================================================
   ⚓ フッター
   ============================================================ */
.footer {
    background: #fff;
    color: #555;
    text-align: center;
    padding: 30px 10px;
    margin-top: auto;
    border-top: 1px solid #ddd;
    font-size: 14px;
}

.footer-inner {
    max-width: 900px;
    margin: 0 auto;
}

.footer-links {
    margin-bottom: 8px;
    line-height: 1.8;
}

.footer-link {
    color: #007bff;
    text-decoration: none;
    margin: 0 8px;
    transition: color 0.2s ease, text-decoration 0.2s ease;
}

.footer-link:hover {
    color: #0056b3;
    text-decoration: underline;
}

.footer-copy {
    font-size: 13px;
    color: #777;
}

@media (max-width: 600px) {
    .footer {
        padding: 20px 6px;
        font-size: 13px;
    }

    .footer-link {
        display: inline-block;
        margin: 4px 6px;
    }
}

/* ============================================================
   📺 チャンネル／動画リンク共通
   ============================================================ */
.channel-heading,
.video-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3em;
    margin-bottom: 1rem;
}

.channel-link,
.video-link {
    color: #007bff;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    transition: color 0.2s, text-decoration 0.2s;
}

.channel-link:hover,
.video-link:hover {
    color: #0056b3;
    text-decoration: underline;
}

.external-icon {
    opacity: 0.8;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.channel-link:hover .external-icon,
.video-link:hover .external-icon {
    transform: translateY(-1px) scale(1.1);
    opacity: 1;
}

@media (max-width: 768px) {

    .channel-heading,
    .video-title {
        font-size: 2rem;
    }

    .external-icon {
        font-size: 0.85rem;
    }

    .title-external-icon {
        font-size: 1.7rem;
    }
}

/* ============================================================
   ⏰ チャット時間リンク（外部リンク）
   ============================================================ */
.time-link {
    width: 100px;
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.25em;
    transition: color 0.2s, text-decoration 0.2s;
}

.time-link:hover {
    color: #0056b3;
    text-decoration: underline;
}

.time-link .fa-clock {
    font-size: 0.9rem;
    opacity: 0.7;
}

.time-link .external-icon {
    font-size: 0.8rem;
    opacity: 0.7;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.time-link:hover .external-icon {
    transform: translateY(-1px) scale(1.1);
    opacity: 1;
}

@media (max-width: 768px) {
    .time-link {
        font-size: 1.2rem;
    }

    .time-link .fa-clock,
    .time-link .external-icon {
        font-size: 0.75rem;
    }
}

/* ============================================================
   🐿️ どこリス ロゴアイコン
   ============================================================ */
.logo-icon {
    width: 28px;
    height: 28px;
    vertical-align: middle;
    margin-right: 6px;
    transition: transform 0.2s ease;
}

.title-link:hover .logo-icon {
    transform: scale(1.1);
}

/* ============================================================
   🧭 パンくずリスト
   ============================================================ */
.breadcrumb {
    font-size: 0.95rem;
    margin-bottom: 1em;
}

.breadcrumb ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4em;
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 1.3rem;
}

.breadcrumb li::after {
    content: "›";
    margin: 0 0.4em;
    color: #888;
}

.breadcrumb li:last-child::after {
    content: "";
}

.breadcrumb a {
    color: #007bff;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb span {
    color: #555;
}

/* ============================================================
   📊 チャート
   ============================================================ */
.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
    max-width: 900px;
    margin: 10px auto 0px auto;
    padding: 10px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}


#chatChart {
    display: block;
    width: 100% !important;
    height: 100% !important;
    position: relative;
    z-index: 1;
    /* ← グラフを一番上ではなく通常レベルに */
}

.filter-form {
    position: relative;
    z-index: 2;
}

@media (max-width: 600px) {
    .chart-container {
        max-width: 100%;
        margin: 10px auto 0px auto;
        padding: 0;
    }

    canvas {
        height: 300px !important;
    }
}

/* ============================================================
   🛒 アフィリエイトセクション
   ============================================================ */
.affiliate-section {
    margin: 40px auto;
    max-width: 1000px;
    text-align: center;
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.affiliate-section h3 {
    margin-bottom: 20px;
    font-size: 1.4rem;
    color: #333;
}

.affiliate-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

.affiliate-item {
    width: 160px;
    border: 1px solid #eee;
    border-radius: 10px;
    overflow: hidden;
    background: #fafafa;
    transition: transform 0.2s;
}

.affiliate-item:hover {
    transform: translateY(-4px);
}

.affiliate-item img {
    width: 100%;
    height: 130px;
    object-fit: contain;
}

.affiliate-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 6px;
    color: #333;
    height: 2.4em;
    overflow: hidden;
}

.affiliate-price {
    font-size: 0.85rem;
    color: #007b00;
    margin-bottom: 10px;
}

/* ============================================================
   🖥️ PC用2カラムレイアウト
   ============================================================ */
.page-layout {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.main-content {
    flex: 1;
    width: 100%;
    min-width: 0;
}

/* ============================================================
   📦 サイドバー広告
   ============================================================ */
.sidebar-ads {
    width: 200px;
    flex-shrink: 0;
    position: sticky;
    top: 100px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    padding: 16px;
    height: fit-content;
}

/* スマホ非表示 */
@media (max-width: 768px) {
    .page-layout {
        flex-direction: column;
    }

    .sidebar-ads {
        display: none;
    }
}

/* 内部広告デザイン */
.ads-heading {
    font-size: 1.1rem;
    margin-bottom: 12px;
    text-align: center;
    font-weight: 600;
    color: #444;
}

.ads-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ads-item {
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    background: #fafafa;
    transition: transform 0.2s;
}

.ads-item:hover {
    transform: translateY(-3px);
}

.ads-item img {
    width: 100%;
    height: 160px;
    object-fit: contain;
}

.ads-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 6px;
    color: #333;
}

.ads-price {
    font-size: 1.5rem;
    color: #007b00;
    margin: 0 6px 8px 6px;
    text-align: right;
}

/* ============================================================
   📱 スマホ専用アフィリエイトバー（上下1件）
   ============================================================ */
.affiliate-bar {
    display: none;
}

@media (max-width: 768px) {
    .affiliate-bar {
        display: flex;
        align-items: center;
        justify-content: center;
        background: #fff;
        border-top: 1px solid #eee;
        border-bottom: 1px solid #eee;
        padding: 4px 8px;
        position: sticky;
        margin-bottom: 5px;
        z-index: 100;
        width: 100%;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }

    .affiliate-bar.top-bar {
        width: 100%;
        top: 0;
    }

    .affiliate-bar.bottom-bar {
        position: static;
        margin: 0;
        width: 100%;
        z-index: 1;
        background: #fff;
        box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
        border-top: 1px solid #eee;
        padding: 6px 10px;
    }

    .affiliate-item-bar.single {
        display: flex;
        align-items: center;
        text-decoration: none;
        color: #333;
        width: 100%;
        max-width: none;
        border-radius: 8px;
        overflow: hidden;
        background: #fafafa;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        transition: transform 0.2s;
    }

    .affiliate-item-bar.single:hover {
        transform: translateY(-2px);
    }

    .affiliate-item-bar.single img {
        width: 90px;
        height: 60px;
        object-fit: contain;
        border-radius: 6px 0 0 6px;
        flex-shrink: 0;
    }

    .affiliate-info {
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: 0 8px;
        flex: 1;
        min-width: 0;
    }

    .affiliate-title-bar {
        font-size: 0.8rem;
        line-height: 1.3;
        color: #333;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        word-break: break-word;
        margin-bottom: 2px;
    }

    .affiliate-price-bar {
        font-size: 0.85rem;
        font-weight: bold;
        color: #007b00;
    }

    .footer {
        margin: 0;
    }
}

/* ============================================================
   🔄 プラットフォーム切替ボタン
   ============================================================ */
.platform-switch {
    margin-bottom: 1rem;
    display: flex;
    gap: 0.5rem;
}

.switch-btn {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 8px;
    background-color: #e0e0e0;
    color: #333;
    font-weight: bold;
    text-decoration: none;
    transition: background-color 0.2s;
}

.switch-btn:hover {
    background-color: #ccc;
}

.switch-btn.active {
    background-color: #007bff;
    color: #fff;
}

/* ============================================================
   📈 オーバーラップテーブル
   ============================================================ */
.overlap-section {
    margin-top: 2em;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    padding: 1.5em;
}

.overlap-section h4,
.overlap-section h5 {
    margin-bottom: 0.8em;
}

.overlap-section table.modern-table {
    width: 100%;
    border-collapse: collapse;
}

.overlap-section table.modern-table th,
.overlap-section table.modern-table td {
    border-bottom: 1px solid #ddd;
    padding: 8px 12px;
    text-align: left;
}

/* ============================================================
   📰 更新情報ボックス
   ============================================================ */
.update-info-box {
    background: #f8f9fc;
    border: 1px solid #d0d7e2;
    border-left: 4px solid #0056b3;
    border-radius: 8px;
    padding: 1.2em 1.5em;
    margin: 2em 0;
    color: #333;
    font-family: "Segoe UI", "Hiragino Sans", sans-serif;
}

.update-info-box h5 {
    margin-top: 0;
    margin-bottom: 0.6em;
    color: #1a1a1a;
    font-weight: 600;
    font-size: 1.6rem;
}

.update-info-box .update-period {
    font-size: 1.4rem;
    margin-bottom: 0.6em;
}

.update-info-box .platform {
    font-weight: bold;
    color: #0056b3;
}

.update-info-box .update-note {
    font-size: 1.2rem;
    color: #666;
    margin: 0;
    line-height: 1.5;
}

/* ============================================================
   🧑‍💻 配信者情報（アイコン＋名前）
   ============================================================ */
.streamer-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.streamer-icon {
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #ccc;
}

.streamer-name {
    font-weight: 500;
}

/* ============================================================
   📱 テーブル レスポンシブ最適化
   ============================================================ */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    word-break: break-word;
    overflow-wrap: break-word;
}

.modern-table th,
.modern-table td {
    white-space: normal;
    vertical-align: middle;
    word-break: break-word;
}

/* 🎯 時間列固定幅 */
.modern-table td.time-cell {
    width: 110px;
    min-width: 100px;
    max-width: 150px;
}

/* 🎯 アイコン列固定幅 */
.modern-table td.streamer-cell {
    width: 150px;
    min-width: 140px;
    max-width: 200px;
}

.streamer-info {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.streamer-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

/* 📜 タイトル列：長文省略対応 */
.modern-table td a {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    line-height: 1.4;
}

/* 📱 スマホ用最適化 */
@media (max-width: 768px) {

    .modern-table th,
    .modern-table td {
        font-size: 1.2rem;
        padding: 0.45rem 0.6rem;
    }

    .streamer-info {
        flex-wrap: nowrap;
    }

    .modern-table td a {
        white-space: normal;
        word-break: break-word;
        overflow: visible;
    }

    .table-wrapper {
        overflow-x: hidden;
    }

    /* 🎯 時間列固定幅 */
    .modern-table td.time-cell {
        width: 90px;
        min-width: 80px;
        max-width: 150px;
    }

    /* 🎯 アイコン列固定幅 */
    .modern-table td.streamer-cell {
        width: 120px;
        min-width: 120px;
        max-width: 200px;
    }
}

/* --- ナビ右端の制御ボタン群（テーマ＋ハンバーガー） --- */
.navbar-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* トグル共通 */
.theme-toggle {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

/* ハンバーガー */
.menu-toggle {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.6rem;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.menu-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* アイコン切替 */
.menu-toggle .fa-xmark {
    display: none;
}

.menu-toggle.active .fa-bars {
    display: none;
}

.menu-toggle.active .fa-xmark {
    display: inline;
}

/* スマホ時の配置整理 */
@media (max-width: 768px) {
    .navbar-container {
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .navbar-controls {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-left: auto;
    }

    .theme-toggle,
    .menu-toggle {
        position: static;
        /* ✅ 右上固定を解除 */
        z-index: 1001;
    }

    .navbar-links {
        width: 100%;
        display: none;
        flex-direction: column;
        margin-top: 10px;
    }

    .navbar-links.show {
        display: flex;
    }
}

/* ============================================================
   🌗 ダークモード完全対応（html属性対応版）
   ============================================================ */

/* === ベース === */
html[data-theme="dark"],
html[data-theme="dark"] body {
    background-color: #121417;
    color: #e8ebef;
}

/* === ナビバー === */
html[data-theme="dark"] .navbar {
    background-color: #0d1828;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

html[data-theme="dark"] .navbar-title .title-link {
    color: #fff;
}

/* === 見出し === */
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5 {
    color: #f0f2f8;
}

html[data-theme="dark"] h3::after {
    background: linear-gradient(to right, #5a8cff, #9abfff);
    opacity: 0.4;
}

html[data-theme="dark"] h5::before {
    background-color: #5a8cff;
}

/* === リンク === */
html[data-theme="dark"] a,
html[data-theme="dark"] .channel-link,
html[data-theme="dark"] .video-link,
html[data-theme="dark"] .time-link,
html[data-theme="dark"] .footer-link,
html[data-theme="dark"] .breadcrumb a {
    color: #f4f4f4;
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.4);
    text-underline-offset: 2px;
    transition: text-decoration-color 0.2s ease, opacity 0.2s ease;
}

html[data-theme="dark"] .breadcrumb span {
    color: #acacac;
}

html[data-theme="dark"] a:hover,
html[data-theme="dark"] .channel-link:hover,
html[data-theme="dark"] .video-link:hover,
html[data-theme="dark"] .time-link:hover,
html[data-theme="dark"] .footer-link:hover,
html[data-theme="dark"] .breadcrumb a:hover {
    text-decoration-color: rgba(255, 255, 255, 0.8);
    opacity: 1;
}

/* === ボタン === */
html[data-theme="dark"] .btn-main,
html[data-theme="dark"] .toggle-button.active {
    background-color: #3b6ee0;
    color: #fff;
}

html[data-theme="dark"] .btn-main:hover {
    background-color: #2a57b3;
}

/* === テーブル === */
html[data-theme="dark"] .table-wrapper,
html[data-theme="dark"] .chart-container,
html[data-theme="dark"] .affiliate-section,
html[data-theme="dark"] .sidebar-ads {
    background-color: #1e2127;
    color: #e0e0e0;
    border-color: #2a2e35;
}

html[data-theme="dark"] .modern-table th {
    background-color: #2a2e35;
    color: #f0f0f0;
}

html[data-theme="dark"] .modern-table td {
    border-bottom: 1px solid #2a2e35;
    color: #dcdcdc;
}

html[data-theme="dark"] .modern-table tr:nth-child(even) {
    background-color: #15171b;
}

/* === フォーム === */
html[data-theme="dark"] form.search-form label {
    color: #d3d6dc;
}

html[data-theme="dark"] form.search-form input[type="text"],
html[data-theme="dark"] form.filter-form input[type="text"],
html[data-theme="dark"] form.search-form select {
    background-color: #393d46;
    color: #f4f4f4;
    border-color: #3b3f45;
}

/* === フッター === */
html[data-theme="dark"] .footer {
    background-color: #181a1f;
    border-top: 1px solid #2a2e35;
    color: #ccc;
}

/* === どこリスロゴ === */
html[data-theme="dark"] .logo-icon {
    filter: brightness(0.95);
}

/* ============================================================
   🎨 ダークテーマ最終微調整（update-info-box + トグル改善）
   ============================================================ */

/* --- ダークテーマ用 update-info-box --- */
html[data-theme="dark"] .update-info-box {
    background: #1b1d21;
    border: 1px solid #2a2e35;
    border-left: 4px solid #5a8cff;
    color: #e0e0e0;
}

html[data-theme="dark"] .update-info-box h5 {
    color: #f0f2f8;
}

html[data-theme="dark"] .update-info-box .platform {
    color: #9abfff;
}

html[data-theme="dark"] .update-info-box .update-note {
    color: #c7c7c7;
}

/* --- テーマトグルボタンの改善 --- */
.theme-toggle {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #fff;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    transition: background-color 0.25s ease, transform 0.25s ease, color 0.25s ease;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: scale(1.05);
}

/* ☀️ ダークテーマ時の太陽アイコンカラー */
html[data-theme="dark"] .theme-toggle i.fa-sun {
    color: #ffd966;
    /* 柔らかい黄色 */
}

/* 🌙 ライトテーマ時の月アイコンカラー */
html[data-theme="light"] .theme-toggle i.fa-moon {
    color: #f0f0f0;
}

/* ============================================================
   🌗 ダークモード - ボタン・ページネーション視認性改善
   ============================================================ */

/* --- トグルボタン群（フォーム上） --- */
html[data-theme="dark"] .toggle-group {
    border-color: #3a3a3a;
}

html[data-theme="dark"] .toggle-button {
    background: #1f2228;
    color: #ccc;
    border-right: 1px solid #2d2d2d;
}

html[data-theme="dark"] .toggle-button:hover:not(.active) {
    background: #2a2d33;
    color: #fff;
}

html[data-theme="dark"] .toggle-button.active {
    background: #3b6ee0;
    color: #fff;
}

/* --- ページネーション全体 --- */
html[data-theme="dark"] .pagination a,
html[data-theme="dark"] .pagination .current {
    border-color: #2a2e35;
    color: #e0e0e0;
    background-color: #1a1c20;
    box-shadow: 0 1px 2px rgba(255, 255, 255, 0.05);
}

html[data-theme="dark"] .pagination a:hover {
    background-color: #3b6ee0;
    color: #fff;
    border-color: #3b6ee0;
    transform: translateY(-1px);
}

html[data-theme="dark"] .pagination .current {
    background-color: #3b6ee0;
    color: #fff;
    font-weight: 600;
    border-color: #3b6ee0;
    box-shadow: 0 2px 4px rgba(59, 110, 224, 0.25);
}

/* --- ページ情報文字色 --- */
html[data-theme="dark"] .page-info {
    color: #ccc;
}

/* ============================================================
   🌗 ダークモード - プラットフォーム切替ボタン修正
   ============================================================ */

html[data-theme="dark"] .platform-switch {
    background: transparent;
}

html[data-theme="dark"] .switch-btn {
    background-color: #1f2228;
    color: #ddd;
    border: 1px solid #2a2e35;
    transition: background-color 0.25s ease, color 0.25s ease, transform 0.2s ease;
}

html[data-theme="dark"] .switch-btn:hover {
    background-color: #2c2f36;
    color: #fff;
    transform: translateY(-1px);
}

html[data-theme="dark"] .switch-btn.active {
    background-color: #3b6ee0;
    /* アクティブ青はページネーションと統一 */
    color: #fff;
    border-color: #3b6ee0;
    box-shadow: 0 2px 4px rgba(59, 110, 224, 0.3);
}

/* ============================================================
   🌗 ダークモード - ハンバーガーメニューの下線除外
   ============================================================ */

/* ダークテーマでリンク下線が不要な要素群 */
html[data-theme="dark"] .navbar a.nav-link,
html[data-theme="dark"] .navbar-links a,
html[data-theme="dark"] .menu-toggle,
html[data-theme="dark"] .platform-switch a,
html[data-theme="dark"] .theme-toggle {
    text-decoration: none !important;
}

/* ============================================================
   🧭 ナビバー最終安定版（左トグル・右ハンバーガー・下展開メニュー）
   ============================================================ */
.navbar {
    background-color: #102b47;
    color: white;
    padding: 12px 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 上部1行 */
.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 左側（ロゴ＋トグル） */
.navbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ロゴ */
.navbar-title .title-link {
    color: #fff;
    font-size: 1.8rem;
    font-weight: bold;
    text-decoration: none;
}

.navbar-title .title-link:hover {
    text-decoration: underline;
}

/* トグル */
.theme-toggle {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #fff;
    font-size: 1.3rem;
    cursor: pointer;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.25s ease, transform 0.25s ease;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: scale(1.05);
}

/* ハンバーガー */
.menu-toggle {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.8rem;
    cursor: pointer;
    padding: 8px;
}

.menu-toggle:hover {
    color: #66b2ff;
}

.menu-toggle .fa-xmark {
    display: none;
}

.menu-toggle.active .fa-bars {
    display: none;
}

.menu-toggle.active .fa-xmark {
    display: inline;
}

/* メニュー展開 */
.navbar-links {
    display: none;
    flex-direction: column;
    margin-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.navbar-links.show {
    display: flex;
}

.navbar-links a.nav-link {
    display: block;
    padding: 14px;
    color: #fff;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.navbar-links a.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* PC時は横並び */
@media (min-width: 769px) {
    .navbar-links {
        display: flex !important;
        flex-direction: row;
        margin-top: 0;
        border: none;
    }

    .navbar-links a.nav-link {
        border: none;
        padding: 8px 12px;
    }

    .menu-toggle {
        display: none;
    }
}

/* ============================================================
   📱 ハンバーガーメニュー安定版（全幅スライド展開）
   ============================================================ */

/* メニュー全体をナビ外に固定配置 */
.navbar-menu {
    display: none;
    position: absolute;
    top: 60px;
    /* ナビバーの下 */
    left: 0;
    width: 100%;
    background-color: #102b47;
    flex-direction: column;
    padding: 8px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 999;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

/* 表示中 */
.navbar-menu.show {
    display: flex;
    animation: slideDown 0.25s ease forwards;
}

/* スライドアニメーション */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

/* メニュー内リンク */
.navbar-menu a.nav-link {
    display: block;
    padding: 14px 20px;
    color: #fff;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 1.1rem;
    transition: background-color 0.2s;
}

.navbar-menu a.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* PCでは非表示 */
@media (min-width: 769px) {
    .navbar-menu {
        position: static;
        display: flex !important;
        flex-direction: row;
        box-shadow: none;
        background: transparent;
        border: none;
        top: auto;
    }

    .navbar-menu a.nav-link {
        border: none;
        padding: 8px 12px;
    }
}

/* ============================================================
   🌗 スライド式テーマトグル（少し小さめサイズ）
   ============================================================ */
.theme-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    /* ← 56px → 46px に縮小 */
    height: 24px;
    /* ← 28px → 24px に縮小 */
    cursor: pointer;
    vertical-align: middle;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* スライダー背景 */
.slider {
    position: absolute;
    inset: 0;
    background-color: #ccc;
    border-radius: 30px;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5px;
    /* ← 内側余白も少し減らす */
    box-sizing: border-box;
}

/* ノブ */
.slider::before {
    content: "";
    position: absolute;
    height: 18px;
    /* ← 22px → 18px */
    width: 18px;
    /* ← 22px → 18px */
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

/* アイコン */
.slider .moon-icon,
.slider .sun-icon {
    font-size: 0.75rem;
    /* ← 小さく調整 */
    color: #fff;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

/* ON（ダーク）時 */
.theme-switch input:checked+.slider {
    background-color: #3b6ee0;
}

.theme-switch input:checked+.slider::before {
    transform: translateX(22px);
    /* ← ノブ移動距離も短縮 */
}

.theme-switch input:checked+.slider .moon-icon {
    opacity: 1;
}

.theme-switch input:not(:checked)+.slider .sun-icon {
    opacity: 1;
}

/* ダークテーマ時の補正 */
html[data-theme="dark"] .theme-switch .slider {
    background-color: #5a8cff;
}


/* 🌗 初期読み込み時にトランジションを一時停止 */
.theme-switch.loading .slider::before {
    transition: none !important;
}

/* ============================================================
   🧭 ナビゲーションバー再調整（PC時の2段崩れ防止）
   ============================================================ */

.navbar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    /* ← 折り返し禁止 */
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* 左側（ロゴ＋トグル） */
.navbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* 右側リンク群 */
.navbar-links {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* PCではハンバーガー非表示 */
@media (min-width: 769px) {
    .menu-toggle {
        display: none !important;
    }
}

/* スマホではリンク非表示＋折り返し許可 */
@media (max-width: 768px) {
    .navbar-container {
        flex-wrap: wrap;
    }

    .navbar-links {
        display: none;
        flex-direction: column;
        width: 100%;
    }

    .navbar-links.show {
        display: flex;
    }
}

/* ============================================================
   📱 スマホ時ハンバーガーメニューの余白調整
   ============================================================ */
@media (max-width: 768px) {

    /* メニュー全体 */
    .navbar-links {
        display: none;
        flex-direction: column;
        width: 100%;
        padding: 0;
        margin: 0;
        gap: 0;
        /* ✅ 余計な間隔を消す */
    }

    /* 表示中 */
    .navbar-links.show {
        display: flex;
    }

    /* 各リンク */
    .navbar-links .nav-link {
        display: block;
        width: 100%;
        padding: 14px 0;
        /* 上下均等に */
        text-align: center;
        font-size: 1.1rem;
        color: #fff;
        text-decoration: none;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 0;
        margin: 0;
        /* ✅ marginリセット */
        background: none;
        /* ✅ 背景色重複を防止 */
    }

    /* 最初のリンクの上線だけ消す */
    .navbar-links .nav-link:first-child {
        border-top: none;
    }

    /* hover時 */
    .navbar-links .nav-link:hover {
        background-color: rgba(255, 255, 255, 0.08);
    }

    /* active時 */
    .navbar-links .nav-link.active {
        background-color: rgba(255, 255, 255, 0.2);
    }
}

/* ============================================================
   👥 視聴者の被り率セクション（テーマ対応）
   ============================================================ */
.overlap-section {
    margin-top: 2em;
    background-color: var(--panel-bg, #fff);
    border-radius: 12px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    padding: 1.5em;
    color: inherit;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* テーマ変数（共通） */
html[data-theme="light"] {
    --panel-bg: #fff;
}

html[data-theme="dark"] {
    --panel-bg: #1b2431;
    /* ← 暗めネイビーで一体感を保つ */
}

/* セクション内の表も背景に馴染ませる */
.overlap-section table.modern-table {
    background: transparent;
}

.overlap-section table.modern-table th {
    background-color: #2b3952;
    /* ダークテーマ向け少し濃いトーン */
    color: #fff;
}

html[data-theme="light"] .overlap-section table.modern-table th {
    background-color: #333;
}

/* ===============================
   🎚 select要素の矢印を明示的に上書き
   =============================== */
select {
    appearance: none;
    /* 各ブラウザ共通でネイティブ装飾を無効化 */
    -webkit-appearance: none;
    -moz-appearance: none;

    background-position: right 0.75em center;
    background-repeat: no-repeat;
    background-size: 1em;
    padding-right: 2em;
    /* 矢印分の余白 */
    border-radius: 6px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ライトテーマ */
html[data-theme="light"] select {
    background-color: #fff;
    color: #333;
    border: 1px solid #ccc;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' fill='%23333' viewBox='0 0 24 24'><path d='M7 10l5 5 5-5z'/></svg>");
}

/* ダークテーマ */
html[data-theme="dark"] select {
    background-color: #393d46;
    color: #e8ebef;
    border: 1px solid #444;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' fill='%23ffffff' viewBox='0 0 24 24'><path d='M7 10l5 5 5-5z'/></svg>");
}

/* ============================================================
   🌞 ライトテーマ時のリンク（黒＋下線付き）
   ============================================================ */
html[data-theme="light"] a,
html[data-theme="light"] .channel-link,
html[data-theme="light"] .video-link,
html[data-theme="light"] .time-link,
html[data-theme="light"] .footer-link,
html[data-theme="light"] .breadcrumb a {
    color: #111;
    text-decoration: underline;
    text-decoration-color: rgba(1, 1, 1, 0.3);
    text-underline-offset: 2px;
    transition: text-decoration-color 0.2s ease, opacity 0.2s ease;
}

html[data-theme="light"] a:hover,
html[data-theme="light"] .channel-link:hover,
html[data-theme="light"] .video-link:hover,
html[data-theme="light"] .time-link:hover,
html[data-theme="light"] .footer-link:hover,
html[data-theme="light"] .breadcrumb a:hover {
    text-decoration-color: rgba(1, 1, 1, 0.9);
    opacity: 1;
}

/* ============================================================
   🌗 ダークモード - ハンバーガーメニューの下線除外
   ============================================================ */

/* ダークテーマでリンク下線が不要な要素群 */
html[data-theme="light"] .navbar a.nav-link,
html[data-theme="light"] .navbar-links a,
html[data-theme="light"] .menu-toggle,
html[data-theme="light"] .platform-switch a,
html[data-theme="light"] .theme-toggle {
    text-decoration: none !important;
}