/*
 * 配信者詳細・視聴者分析・AI解析画面の専用スタイル。
 * base.css の共通部品に、ページ固有のレイアウトやグラフ/YouTube一覧を追加します。
 */

.hero {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 28px;
    align-items: center;
}

.hero-icon {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    margin: 0 auto;
    border: 1px solid var(--line-strong);
    background: #23272d;
    box-shadow: 0 0 0 8px rgba(34, 197, 94, 0.06);
}

.hero h1 {
    margin: 0 0 14px;
    font-size: 34px;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    color: var(--sub);
    margin-bottom: 14px;
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    font-size: 13px;
    color: var(--text);
}

.topbar {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
}

.links-box {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.link-tile {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 76px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.015), rgba(255, 255, 255, 0.005)), var(--card);
    text-decoration: none;
    color: inherit;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
}

.link-tile:hover {
    transform: translateY(-1px);
    border-color: var(--accent-strong);
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.08), rgba(255, 255, 255, 0.01)), var(--card-soft);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.24);
}

.link-icon {
    width: 38px;
    height: 38px;
    min-width: 38px;
    max-width: 38px;
    min-height: 38px;
    max-height: 38px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    background: var(--accent-soft);
    border: 1px solid rgba(34, 197, 94, 0.22);
}

.link-icon-image {
    background: transparent;
    border-color: transparent;
}

.link-icon svg {
    width: 18px;
    height: 18px;
    max-width: 18px;
    max-height: 18px;
    display: block;
    flex: 0 0 auto;
    fill: #d1fae5;
}

.link-icon img {
    width: 28px;
    height: 28px;
    max-width: 28px;
    max-height: 28px;
    display: block;
    flex: 0 0 auto;
    object-fit: contain;
    border-radius: 999px;
}

.link-label {
    display: block;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
}



.calendar-section-header {
    align-items: flex-start;
}

.calendar-section-subtitle {
    margin: 6px 0 0;
    color: var(--sub);
    font-size: 14px;
}

.calendar-count-label {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border: 1px solid rgba(34, 197, 94, 0.28);
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.08);
    color: #bbf7d0;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.calendar-mini-list {
    display: grid;
    gap: 12px;
    max-height: 386px;
    overflow-y: auto;
    padding-right: 4px;
    overscroll-behavior: contain;
}

.calendar-mini-card {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 16px;
    align-items: stretch;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.018), rgba(255, 255, 255, 0.006)), var(--card);
    color: inherit;
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
}

.calendar-mini-card:hover {
    transform: translateY(-1px);
    border-color: var(--accent-strong);
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.08), rgba(255, 255, 255, 0.01)), var(--card-soft);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.24);
}

.calendar-mini-date {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    min-height: 74px;
    padding: 12px 14px;
    border: 1px solid rgba(34, 197, 94, 0.18);
    border-radius: 16px;
    background: rgba(34, 197, 94, 0.06);
}

.calendar-mini-day {
    color: #dcfce7;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.2;
}

.calendar-mini-time {
    color: var(--sub);
    font-size: 13px;
    line-height: 1.4;
}

.calendar-mini-body {
    min-width: 0;
}

.calendar-mini-body h3 {
    margin: 0 0 7px;
    color: var(--text);
    font-size: 17px;
    line-height: 1.45;
}

.calendar-mini-meta,
.calendar-mini-desc {
    margin: 0;
    color: var(--sub);
    font-size: 14px;
    line-height: 1.65;
}

.calendar-mini-desc {
    margin-top: 4px;
}

.calendar-more-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
}

.calendar-more-btn {
    border-color: rgba(34, 197, 94, 0.35);
    background: rgba(34, 197, 94, 0.10);
    color: #dcfce7;
}

.calendar-more-btn:hover {
    border-color: rgba(34, 197, 94, 0.65);
    color: #f0fdf4;
}

@media (max-width: 720px) {
    .calendar-section-header {
        flex-direction: column;
        gap: 10px;
    }

    .calendar-mini-card {
        grid-template-columns: 1fr;
    }

    .calendar-more-row {
        justify-content: stretch;
    }

    .calendar-more-btn {
        width: 100%;
        justify-content: center;
    }
}

.memo-box {
    white-space: pre-wrap;
    line-height: 1.8;
    color: var(--text);
}

.latest-summary-section {
    margin-top: 22px;
    margin-bottom: 28px;
}

.latest-summary-box {
    display: grid;
    gap: 10px;
}

.latest-summary-selector {
    display: grid;
    gap: 8px;
    max-width: 520px;
    margin-bottom: 16px;
}

.latest-summary-selector-label {
    color: var(--sub);
    font-size: 13px;
    font-weight: 700;
}

.latest-summary-select {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--card-soft);
    color: var(--text);
    font: inherit;
    font-size: 15px;
}

.latest-summary-select:focus {
    outline: 2px solid rgba(34, 197, 94, 0.38);
    outline-offset: 2px;
    border-color: var(--accent-strong);
}

.latest-summary-box h3 {
    margin: 0;
    font-size: 18px;
    line-height: 1.5;
}

.latest-summary-box p {
    margin: 0;
    line-height: 1.8;
    color: var(--text);
}

.latest-summary-box .latest-summary-note {
    color: var(--sub);
    font-size: 13px;
}

.latest-chat-summary {
    display: grid;
    gap: 8px;
    margin-top: 8px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.latest-chat-summary h4 {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
}

@media (max-width: 840px) {
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-meta {
        justify-content: center;
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }
}


.hero-compact {
    grid-template-columns: 140px 1fr;
    gap: 20px;
}

.hero-icon-small {
    width: 120px;
    height: 120px;
}

.viewer-chart-wrap {
    width: 100%;
    overflow-x: auto;
    margin-bottom: 18px;
}

.viewer-chart {
    display: block;
    width: 100%;
    min-width: 720px;
    height: 280px;
}

.viewer-chart-scroll-hour {
    overflow-x: auto;
    overflow-y: visible;
    padding-bottom: 14px;
    -webkit-overflow-scrolling: touch;
}

.viewer-chart-inner-hour {
    min-width: max(100%, calc(var(--viewer-chart-point-count, 1) * 28px));
}

.viewer-chart-inner-hour .viewer-chart-wrap {
    overflow-x: visible;
}

.viewer-chart-inner-hour .viewer-chart {
    width: var(--viewer-chart-svg-width, 100%);
    max-width: none;
}

.viewer-chart-scroll-note {
    margin: 0 0 18px;
    color: var(--sub);
    font-size: 12px;
    line-height: 1.6;
}

@media (max-width: 768px) {
    .viewer-chart-inner-hour {
        min-width: max(100%, calc(var(--viewer-chart-point-count, 1) * 32px));
    }
}

.chart-grid {
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 1;
}

.chart-axis {
    stroke: rgba(255, 255, 255, 0.18);
    stroke-width: 1.5;
}

.chart-line {
    fill: none;
    stroke: var(--accent);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.chart-line-average {
    stroke: #60a5fa;
}

.chart-line-peak {
    stroke: var(--accent);
}

.chart-line-min {
    stroke: #c084fc;
}

.chart-line-new-sender {
    stroke: #f59e0b;
}

.chart-point {
    fill: #bbf7d0;
    stroke: var(--accent-strong);
    stroke-width: 2;
    cursor: pointer;
    outline: none;
    transition: r .16s ease, filter .16s ease, stroke-width .16s ease;
}

.chart-point:hover,
.chart-point:focus {
    r: 6px;
    filter: drop-shadow(0 0 8px rgba(34, 197, 94, 0.55));
    stroke-width: 2.5;
}

.chart-point-average {
    fill: #dbeafe;
    stroke: #60a5fa;
}

.chart-point-peak {
    fill: #bbf7d0;
    stroke: var(--accent-strong);
}

.chart-point-min {
    fill: #f3e8ff;
    stroke: #c084fc;
}

.chart-point-new-sender {
    fill: #fef3c7;
    stroke: #f59e0b;
}

.chart-point-value {
    fill: #d1fae5;
    font-size: 10px;
    font-weight: 700;
}

.chart-point-value-average {
    fill: #bfdbfe;
}

.chart-point-value-peak {
    fill: #d1fae5;
}

.chart-point-value-min {
    fill: #e9d5ff;
}

.chart-point-value-new-sender {
    fill: #fde68a;
}

.chart-axis-label {
    fill: var(--sub);
    font-size: 12px;
}

.chart-x-label {
    font-size: 11px;
}

.viewer-chart-tooltip {
    position: fixed;
    z-index: 1000;
    min-width: 190px;
    max-width: min(320px, calc(100vw - 24px));
    padding: 12px 14px;
    border: 1px solid rgba(74, 222, 128, 0.34);
    border-radius: 12px;
    background:
        linear-gradient(180deg, rgba(34, 197, 94, 0.13), rgba(96, 165, 250, 0.05)),
        rgba(17, 24, 39, 0.96);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    color: var(--text);
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px) scale(0.98);
    transition: opacity .14s ease, transform .14s ease;
    white-space: normal;
}

.viewer-chart-tooltip::after {
    content: "";
    position: absolute;
    left: 18px;
    bottom: -6px;
    width: 10px;
    height: 10px;
    border-right: 1px solid rgba(74, 222, 128, 0.34);
    border-bottom: 1px solid rgba(74, 222, 128, 0.34);
    background: rgba(17, 24, 39, 0.96);
    transform: rotate(45deg);
}

.viewer-chart-tooltip.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.viewer-chart-tooltip-heading {
    color: #bbf7d0;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
}

.viewer-chart-tooltip-value {
    margin-top: 4px;
    font-size: 24px;
    font-weight: 900;
    line-height: 1.15;
}

.viewer-chart-tooltip-detail {
    margin-top: 8px;
    color: var(--sub);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.55;
    white-space: pre-line;
}

.viewer-table-wrap {
    max-height: 295px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
}

.viewer-table {
    width: 100%;
    border-collapse: collapse;
    border: 0;
    border-radius: 0;
    overflow: visible;
}

.viewer-table th,
.viewer-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.viewer-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: var(--sub);
    background: #202735;
    font-weight: 700;
}

.viewer-table tr:last-child td {
    border-bottom: 0;
}

.viewer-collapsible-table {
    min-width: 0;
    margin-top: 14px;
}

.viewer-collapsible-table summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--sub);
    cursor: pointer;
    list-style: none;
    font-weight: 700;
}

.viewer-collapsible-table summary::-webkit-details-marker {
    display: none;
}

.viewer-collapsible-table summary::after {
    content: "表示";
    flex: 0 0 auto;
    padding: 6px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--card-soft);
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
}

.viewer-collapsible-table[open] summary {
    margin-bottom: 10px;
    border-color: rgba(34, 197, 94, 0.35);
    color: var(--text);
}

.viewer-collapsible-table[open] summary::after {
    content: "閉じる";
}

.viewer-collapsible-table > .viewer-table-actions {
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
    width: 100%;
    margin-bottom: 10px;
}

.viewer-collapsible-table > .viewer-table-actions .btn {
    width: auto;
}


.viewer-filter-form {
    margin-bottom: 20px;
}

.viewer-filter-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
}

.viewer-filter-grid label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: #bfc8d6;
}

.viewer-filter-grid input,
.viewer-filter-grid select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 12px;
    background: #1b2230;
    color: #f5f7fb;
}

.viewer-filter-grid select option {
    background: #1b2230;
    color: #f5f7fb;
}

.viewer-filter-grid select:focus,
.viewer-filter-grid input:focus {
    outline: none;
    border-color: rgba(54, 232, 123, 0.55);
    box-shadow: 0 0 0 3px rgba(54, 232, 123, 0.14);
}

.viewer-filter-actions {
    display: flex;
    gap: 8px;
}

.btn-secondary {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

@media (max-width: 840px) {
    .viewer-filter-grid {
        grid-template-columns: 1fr;
    }

    .viewer-filter-actions {
        flex-wrap: wrap;
    }
}


.category-bars {
    display: grid;
    gap: 14px;
}

.category-trend-section {
    margin-top: 34px;
}

.category-bar-card {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.02);
}

.category-bar-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.category-bar-title {
    font-weight: 700;
    color: var(--text);
}

.category-bar-values {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    color: var(--sub);
    font-size: 13px;
}

.category-bar-track {
    width: 100%;
    height: 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    overflow: hidden;
}

.category-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(34, 197, 94, 0.65), rgba(34, 197, 94, 1));
}

.heatmap-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
}

.heatmap-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
}

.heatmap-table th,
.heatmap-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
    font-size: 12px;
}

.heatmap-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #202735;
    color: var(--sub);
}

.heatmap-table tbody th {
    background: rgba(255, 255, 255, 0.03);
    color: var(--sub);
    position: sticky;
    left: 0;
    z-index: 1;
}

.heatmap-table tr:last-child td,
.heatmap-table tr:last-child th {
    border-bottom: 0;
}

.heatmap-cell {
    min-width: 36px;
    color: #f5f7fb;
    cursor: pointer;
    font-variant-numeric: tabular-nums;
    outline: none;
    transition: box-shadow .14s ease, filter .14s ease;
}

.heatmap-cell:hover,
.heatmap-cell:focus {
    box-shadow: inset 0 0 0 2px rgba(187, 247, 208, 0.75);
    filter: brightness(1.16);
}

.heatmap-note {
    margin-top: 10px;
}

@media (max-width: 840px) {
    .category-trend-section {
        margin-top: 24px;
    }

    .category-bar-header {
        flex-direction: column;
        align-items: flex-start;
    }
}


.category-section-note {
    margin: 0 0 16px;
    color: var(--sub);
    line-height: 1.7;
    font-size: 14px;
}


.heatmap-filter-form {
    margin-bottom: 16px;
}

.heatmap-filter-grid {
    display: grid;
    grid-template-columns: minmax(260px, 360px) auto;
    gap: 12px;
    align-items: end;
}

.heatmap-filter-grid label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--sub);
}

.heatmap-filter-grid select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 12px;
    background: #1b2230;
    color: #f5f7fb;
}

.heatmap-filter-grid select option,
.heatmap-filter-grid select optgroup {
    background: #1b2230;
    color: #f5f7fb;
}

.heatmap-filter-actions {
    display: flex;
    gap: 8px;
}

@media (max-width: 840px) {
    .heatmap-filter-grid {
        grid-template-columns: 1fr;
    }
}


.viewer-table-hourly td:nth-child(3),
.viewer-table-hourly th:nth-child(3) {
    min-width: 280px;
}

.viewer-table-hourly td:nth-child(3) {
    max-width: 420px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


.viewer-table-hourly th:nth-child(3),
.viewer-table-hourly td:nth-child(3) {
    min-width: 320px;
}

.viewer-title-cell {
    max-width: 420px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.section-header-stack {
    flex-wrap: wrap;
    align-items: flex-start;
}

.aggregation-note-pill {
    display: inline-flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.03);
    color: var(--sub);
    font-size: 13px;
    line-height: 1.4;
}

.aggregate-switch {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px;
    margin-bottom: 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.02);
}

.aggregate-switch-item {
    position: relative;
    cursor: pointer;
}

.aggregate-switch-item input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.aggregate-switch-item span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 84px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid transparent;
    color: var(--sub);
    font-weight: 700;
    transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}

.aggregate-switch-item:hover span {
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.1);
}

.aggregate-switch-item input:checked + span {
    background: #232b38;
    border-color: rgba(34, 197, 94, 0.35);
    color: var(--text);
}

.viewer-filter-grid-wide {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.summary-card {
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.015), rgba(255, 255, 255, 0.005)), var(--card-soft);
}

.summary-card-label {
    margin-bottom: 10px;
    color: var(--sub);
    font-size: 13px;
    font-weight: 700;
}

.summary-card-value {
    font-size: 20px;
    font-weight: 800;
    line-height: 1.2;
}

.summary-card-value span {
    margin-left: 6px;
    font-size: 14px;
    color: var(--sub);
    font-weight: 600;
}

.summary-card-subtext {
    margin-top: 8px;
    color: var(--sub);
    font-size: 13px;
}

.summary-card-hours {
    border-color: rgba(56, 189, 248, 0.24);
}

.summary-card-high {
    border-color: rgba(34, 197, 94, 0.25);
}

.summary-card-average {
    border-color: rgba(96, 165, 250, 0.22);
}

.summary-card-low {
    border-color: rgba(192, 132, 252, 0.24);
}

.viewer-subsection-title {
    margin: 0 0 12px;
    color: var(--text);
    font-size: 17px;
    line-height: 1.4;
}

.stream-ranking-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 24px;
}

.stream-ranking-grid > * {
    min-width: 0;
}

.stream-ranking-table-actions {
    margin-bottom: 8px;
}

.stream-ranking-table-wrap {
    width: 100%;
    max-width: 100%;
    max-height: 420px;
}

.stream-ranking-table {
    min-width: 760px;
}

.stream-ranking-table th:first-child,
.stream-ranking-table td:first-child {
    width: 52px;
    text-align: right;
}

.stream-ranking-table th:nth-child(2),
.stream-ranking-table td:nth-child(2) {
    min-width: 220px;
}

.archive-analysis-section {
    display: grid;
    gap: 16px;
}

.archive-analysis-section > .section-header {
    margin-bottom: 0;
}

.archive-analysis-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.archive-analysis-panel {
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.02);
}

.archive-analysis-note {
    margin: -4px 0 14px;
    color: var(--sub);
    font-size: 13px;
    line-height: 1.6;
}

.archive-scatter-wrap {
    width: 100%;
    overflow-x: auto;
}

.archive-scatter-chart {
    display: block;
    width: 100%;
    min-width: 720px;
    height: 300px;
}

.archive-scatter-point {
    fill: #dbeafe;
    stroke: #60a5fa;
}

.archive-bar-list {
    display: grid;
    gap: 10px;
}

.archive-bar-row {
    display: grid;
    grid-template-columns: minmax(84px, 110px) minmax(0, 1fr) minmax(64px, auto);
    align-items: center;
    gap: 10px;
    outline: none;
}

.archive-bar-label,
.archive-bar-value {
    color: var(--sub);
    font-size: 13px;
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
}

.archive-bar-value {
    text-align: right;
    color: var(--text);
    font-weight: 700;
}

.archive-bar-track {
    height: 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.07);
    overflow: hidden;
}

.archive-bar-fill {
    height: 100%;
    min-width: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(34, 197, 94, 0.64), rgba(34, 197, 94, 1));
}

.archive-bar-fill-duration {
    background: linear-gradient(90deg, rgba(96, 165, 250, 0.62), rgba(96, 165, 250, 1));
}

.archive-bar-fill-distribution {
    background: linear-gradient(90deg, rgba(192, 132, 252, 0.62), rgba(192, 132, 252, 1));
}

.archive-bar-row:hover .archive-bar-track,
.archive-bar-row:focus .archive-bar-track {
    box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.25);
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px 16px;
    margin-top: 8px;
    color: var(--sub);
    font-size: 13px;
    text-align: center;
}

.chart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.chart-legend-marker {
    width: 18px;
    height: 3px;
    border-radius: 999px;
    background: var(--accent);
}

.chart-legend-marker-average {
    background: #60a5fa;
}

.chart-legend-marker-peak {
    background: var(--accent);
}

.chart-legend-marker-min {
    background: #c084fc;
}

.chart-legend-marker-new-sender {
    background: #f59e0b;
}

.viewer-table-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.viewer-average-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin: 0;
}

.viewer-average-grid-in-section {
    margin-top: 18px;
}

.viewer-average-card {
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.02);
}

.viewer-average-header {
    margin-bottom: 14px;
}

.viewer-average-header h3 {
    margin: 0;
    color: var(--text);
    font-size: 17px;
    line-height: 1.4;
}

.viewer-bar-chart {
    display: grid;
    align-items: end;
    gap: 6px;
    height: 220px;
    overflow-x: auto;
    padding: 8px 2px 0;
}

.viewer-bar-chart-weekday {
    grid-template-columns: repeat(7, minmax(42px, 1fr));
}

.viewer-bar-chart-hourly {
    grid-template-columns: repeat(24, minmax(32px, 1fr));
}

.viewer-bar-item {
    display: grid;
    grid-template-rows: 22px 1fr 22px;
    align-items: end;
    min-width: 0;
    height: 100%;
    cursor: pointer;
    outline: none;
}

.viewer-bar-item .viewer-bar-track {
    transition: box-shadow .14s ease, filter .14s ease;
}

.viewer-bar-item:hover .viewer-bar-track,
.viewer-bar-item:focus .viewer-bar-track {
    box-shadow: 0 0 0 2px rgba(187, 247, 208, 0.34);
    filter: brightness(1.16);
}

.viewer-bar-value,
.viewer-bar-label {
    color: var(--sub);
    font-size: 11px;
    line-height: 1.2;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.viewer-bar-value {
    color: #d1fae5;
    font-weight: 700;
}

.viewer-bar-track {
    position: relative;
    height: 100%;
    min-height: 120px;
    border-radius: 8px 8px 4px 4px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.viewer-bar-fill {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    min-height: 2px;
    border-radius: 8px 8px 0 0;
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.98), rgba(34, 197, 94, 0.46));
}

@media (max-width: 900px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }

    .stream-ranking-grid {
        grid-template-columns: 1fr;
    }

    .archive-analysis-grid {
        grid-template-columns: 1fr;
    }

    .viewer-average-grid {
        grid-template-columns: 1fr;
    }

    .summary-grid {
        gap: 10px;
        margin-bottom: 14px;
    }

    .summary-card {
        display: grid;
        grid-template-columns: auto auto 1fr;
        align-items: center;
        gap: 8px 12px;
        padding: 14px 16px;
        border-radius: 16px;
    }

    .summary-card-label {
        margin-bottom: 0;
        font-size: 12px;
        white-space: nowrap;
    }

    .summary-card-value {
        font-size: 16px;
        line-height: 1.15;
        white-space: nowrap;
    }

    .summary-card-value span {
        margin-left: 4px;
        font-size: 12px;
    }

    .summary-card-subtext {
        margin-top: 0;
        font-size: 12px;
        line-height: 1.45;
        text-align: right;
    }
}

@media (max-width: 840px) {
    .viewer-filter-grid-wide {
        grid-template-columns: 1fr;
    }

    .viewer-table-actions {
        flex-direction: column;
        align-items: flex-start;
    }

    .aggregate-switch {
        width: 100%;
        border-radius: 20px;
        gap: 6px;
        padding: 4px;
        margin-bottom: 10px;
    }

    .aggregate-switch-item {
        flex: 1 1 calc(50% - 6px);
    }

    .aggregate-switch-item span {
        width: 100%;
        min-width: 0;
        min-height: 40px;
        padding: 8px 10px;
        font-size: 14px;
    }

}

@media (max-width: 768px) {
    .archive-analysis-panel {
        padding: 14px;
    }

    .archive-bar-row {
        grid-template-columns: minmax(74px, 92px) minmax(0, 1fr);
        gap: 6px 10px;
    }

    .archive-bar-value {
        grid-column: 1 / -1;
        text-align: left;
    }

    .viewer-table-actions {
        align-items: stretch;
        gap: 10px;
    }

    .viewer-table-actions .btn {
        width: 100%;
        justify-content: center;
    }
}


.section-header-with-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.section-title-large {
    margin: 0;
    font-size: 30px;
}

.btn-ai {
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.22), rgba(22, 163, 74, 0.14));
    border-color: rgba(34, 197, 94, 0.55);
    color: #dcfce7;
}

.btn-ai:hover {
    border-color: rgba(34, 197, 94, 0.8);
    color: #f0fdf4;
}

.btn-ai-large {
    min-width: 180px;
    min-height: 52px;
    font-size: 16px;
}

.analysis-subtitle {
    margin: 8px 0 0;
}

.analysis-target-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.analysis-target-card {
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.02);
}

.analysis-target-label {
    font-size: 12px;
    color: var(--sub);
    margin-bottom: 6px;
}

.analysis-target-value {
    font-weight: 700;
    line-height: 1.5;
}

.analysis-target-value span {
    color: var(--sub);
    font-weight: 500;
    margin-left: 6px;
}

@media (max-width: 768px) {
    .analysis-target-grid {
        gap: 8px;
        margin-bottom: 12px;
    }

    .analysis-target-card {
        display: grid;
        grid-template-columns: 64px 1fr;
        align-items: center;
        gap: 8px 12px;
        padding: 12px 14px;
        border-radius: 16px;
    }

    .analysis-target-label {
        margin-bottom: 0;
        font-size: 11px;
        white-space: nowrap;
    }

    .analysis-target-value {
        font-size: 14px;
        line-height: 1.4;
        text-align: left;
    }

    .analysis-target-value span {
        margin-left: 4px;
        font-size: 12px;
    }
}

.analysis-form {
    margin-top: 18px;
    margin-bottom: 18px;
}

.analysis-submit-btn {
    position: relative;
    gap: 10px;
}

.analysis-submit-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(220, 252, 231, 0.28);
    border-top-color: #dcfce7;
    border-radius: 999px;
    animation: analysis-spin 0.8s linear infinite;
}

.analysis-submit-label-loading {
    display: none;
}

.analysis-submit-btn.is-loading {
    cursor: wait;
    opacity: 0.92;
}

.analysis-submit-btn.is-loading .analysis-submit-spinner,
.analysis-submit-btn.is-loading .analysis-submit-label-loading {
    display: inline-flex;
}

.analysis-submit-btn.is-loading .analysis-submit-label {
    display: none;
}

@keyframes analysis-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.analysis-source-box {
    display: grid;
    gap: 10px;
}

.analysis-source-line {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.02);
}

.analysis-source-line span {
    color: var(--sub);
}

@media (max-width: 768px) {
    .analysis-source-box {
        gap: 8px;
    }

    .analysis-source-line {
        display: grid;
        grid-template-columns: 78px 1fr;
        align-items: center;
        justify-content: initial;
        gap: 8px 12px;
        padding: 12px 14px;
        border-radius: 16px;
    }

    .analysis-source-line span {
        font-size: 11px;
        white-space: nowrap;
    }

    .analysis-source-line strong {
        text-align: left;
    }
}

.analysis-result-box {
    white-space: normal;
    line-height: 1.9;
    padding: 18px 20px;
    border: 1px solid rgba(34, 197, 94, 0.28);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.06), rgba(255, 255, 255, 0.015));
}

@media (max-width: 768px) {
    .section-header-with-action {
        flex-direction: column;
        align-items: stretch;
    }
}

/* =========================================================
   Streamer detail mobile layout
   配信情報ページをスマホ幅に合わせる調整。
   ========================================================= */
@media (max-width: 768px) {
    .topbar {
        margin-bottom: 12px;
    }

    .topbar .btn {
        width: 100%;
    }

    .hero {
        grid-template-columns: 1fr;
        gap: 16px;
        text-align: center;
    }

    .hero > div:first-child {
        display: flex;
        justify-content: center;
    }

    .hero-icon {
        width: 132px;
        height: 132px;
        box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.06);
    }

    .hero h1 {
        margin-bottom: 12px;
        font-size: 24px;
        line-height: 1.35;
    }

    .hero .muted {
        margin: 10px 0 0;
        font-size: 14px;
        line-height: 1.75;
        text-align: left;
    }

    .hero-meta {
        justify-content: center;
        gap: 8px;
        margin-bottom: 10px;
    }

    .pill {
        max-width: 100%;
        padding: 5px 10px;
        font-size: 12px;
        line-height: 1.45;
        overflow-wrap: anywhere;
    }

    .links-box {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .link-tile {
        min-height: 62px;
        padding: 13px 14px;
        border-radius: 15px;
    }

    .link-icon {
        width: 34px;
        height: 34px;
        min-width: 34px;
        max-width: 34px;
        min-height: 34px;
        max-height: 34px;
    }

    .link-icon svg {
        width: 16px;
        height: 16px;
        max-width: 16px;
        max-height: 16px;
    }

    .link-icon img {
        width: 26px;
        height: 26px;
        max-width: 26px;
        max-height: 26px;
    }

    .link-label {
        font-size: 16px;
    }

    .calendar-section-header {
        align-items: flex-start;
    }

    .calendar-section-subtitle {
        font-size: 13px;
        line-height: 1.7;
    }

    .calendar-count-label {
        padding: 5px 10px;
        font-size: 12px;
    }

    .calendar-mini-list {
        gap: 10px;
    }

    .calendar-mini-card {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 14px;
        border-radius: 16px;
    }

    .calendar-mini-date {
        min-height: 0;
        padding: 12px;
        border-radius: 14px;
    }

    .calendar-mini-day {
        font-size: 18px;
    }

    .calendar-mini-time,
    .calendar-mini-meta,
    .calendar-mini-desc {
        font-size: 13px;
        line-height: 1.7;
        overflow-wrap: anywhere;
    }

    .calendar-mini-body h3 {
        font-size: 16px;
        line-height: 1.55;
    }

    .calendar-more-row {
        justify-content: stretch;
        margin-top: 12px;
    }

    .calendar-more-btn {
        width: 100%;
        justify-content: center;
    }

    .thumb-card h3 {
        font-size: 15px;
    }

    .meta {
        font-size: 12px;
        line-height: 1.6;
    }

    .memo-box {
        font-size: 14px;
        line-height: 1.8;
    }
}

@media (max-width: 420px) {
    .hero-icon {
        width: 116px;
        height: 116px;
    }

    .hero h1 {
        font-size: 22px;
    }

    .calendar-mini-day {
        font-size: 17px;
    }
}


.media-section-subtitle {
    margin: 6px 0 0;
    color: var(--sub);
    font-size: 14px;
}

.youtube-hashtag-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.youtube-filter-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.playlist-title-search-row {
    margin-top: 12px;
}

.playlist-title-filter-row {
    margin-top: 10px;
}

.youtube-filter-label {
    color: var(--sub);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.youtube-filter-input,
.youtube-filter-select {
    min-width: 220px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    background: #1b2230;
    color: #f5f7fb;
}

.youtube-filter-input::placeholder {
    color: rgba(245, 247, 251, 0.5);
}

.youtube-filter-select-wide {
    min-width: 320px;
}

.youtube-filter-input:focus,
.youtube-filter-select:focus {
    outline: none;
    border-color: rgba(54, 232, 123, 0.55);
    box-shadow: 0 0 0 3px rgba(54, 232, 123, 0.14);
}

.youtube-popular-tags {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px 12px;
    align-items: start;
}

.youtube-popular-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.youtube-popular-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 8px 11px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    color: #f5f7fb;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
    text-decoration: none;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.youtube-popular-tag span:first-child::before {
    content: "#";
    color: var(--sub);
}

.youtube-popular-tag span:last-child {
    color: var(--sub);
    font-size: 12px;
    font-weight: 700;
}

.youtube-popular-tag:hover,
.youtube-popular-tag:focus-visible,
.youtube-popular-tag.is-active {
    border-color: rgba(54, 232, 123, 0.45);
    background: rgba(54, 232, 123, 0.1);
    color: #f8fafc;
    outline: none;
}

.media-scroll-row {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 2px 2px 12px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
}

.media-scroll-row .thumb-card,
.media-horizontal-card {
    flex: 0 0 280px;
    min-width: 280px;
    scroll-snap-align: start;
}

.thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 148px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--sub);
    font-weight: 700;
}

.playlist-section-header {
    align-items: flex-start;
}


.playlist-scroll-area {
    max-height: 430px;
    overflow-y: auto;
    padding: 2px 8px 2px 2px;
    margin-top: 4px;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

.playlist-scroll-area::-webkit-scrollbar {
    width: 10px;
}

.playlist-scroll-area::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.35);
}

.playlist-scroll-area::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 999px;
}

.playlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.playlist-card {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    border: 1px solid var(--line);
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.018), rgba(255, 255, 255, 0.006)), var(--card);
    color: inherit;
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
}

.playlist-card:hover {
    transform: translateY(-1px);
    border-color: var(--accent-strong);
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.08), rgba(255, 255, 255, 0.01)), var(--card-soft);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.24);
}

.playlist-card img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    background: rgba(255, 255, 255, 0.04);
}

.playlist-card-hidden {
    display: none !important;
}

.playlist-card-body {
    padding: 14px 15px 16px;
}

.playlist-card-body h3 {
    margin: 0 0 8px;
    color: var(--text);
    font-size: 16px;
    line-height: 1.45;
}

.playlist-card-body p {
    margin: 8px 0 0;
    color: var(--sub);
    font-size: 13px;
    line-height: 1.6;
}

.playlist-sentinel {
    margin-top: 16px;
    padding: 13px 14px;
    border: 1px dashed var(--line);
    border-radius: 14px;
    color: var(--sub);
    text-align: center;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.015);
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.playlist-sentinel.is-loading {
    cursor: progress;
}

.playlist-sentinel.is-empty {
    border-style: solid;
    border-color: rgba(248, 113, 113, 0.22);
    background: rgba(248, 113, 113, 0.06);
    color: #fca5a5;
    cursor: default;
}

.playlist-sentinel:hover,
.playlist-sentinel:focus-visible {
    border-color: rgba(54, 232, 123, 0.38);
    background: rgba(54, 232, 123, 0.08);
    color: #f5f7fb;
    outline: none;
}

.playlist-sentinel.is-empty:hover,
.playlist-sentinel.is-empty:focus-visible {
    border-color: rgba(248, 113, 113, 0.22);
    background: rgba(248, 113, 113, 0.06);
    color: #fca5a5;
}

.playlist-debug-status {
    margin-top: 10px;
    color: var(--sub);
    font-size: 12px;
    line-height: 1.6;
}

.kick-archive-chat-pagination {
    flex-wrap: wrap;
}


@media (max-width: 720px) {
    .media-scroll-row .thumb-card,
    .media-horizontal-card {
        flex-basis: 240px;
        min-width: 240px;
    }

    .playlist-scroll-area {
        padding-right: 2px;
    }

    .youtube-filter-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .youtube-filter-input,
    .youtube-filter-select {
        min-width: 0;
        width: 100%;
        padding: 8px 10px;
    }

    .youtube-popular-tags {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .playlist-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .playlist-card {
        border-radius: 16px;
    }

    .playlist-card-body {
        padding: 10px 10px 12px;
    }

    .playlist-card-body h3 {
        margin-bottom: 6px;
        font-size: 13px;
        line-height: 1.45;
    }

    .playlist-card-body p {
        margin-top: 6px;
        font-size: 12px;
        line-height: 1.5;
    }

    .playlist-card .meta {
        gap: 4px 8px;
        font-size: 11px;
        line-height: 1.45;
    }

    .thumb-placeholder {
        min-height: 100px;
    }
}


