* {
    box-sizing: border-box;
}


/* =========================
   動画選択
========================= */

.video-select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    font-size: 15px;
}

/* プルダウンを中央寄せ */
#videoSelect {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.youtube-comparison-video {
    margin-top: 8px;
    text-align: center;
}

@media (max-width: 600px) {

    #videoSelect {
        width: calc(100% - 20px);
    }

    .youtube-comparison-video .video-select {
        width: calc(100% - 20px);
    }

}


/* =========================
   動画情報
========================= */

.video-info {

    display: flex;

    gap: 15px;

    margin-top: 20px;

    padding: 15px;

    background: white;

    border-radius: 10px;

}


.thumbnail {

    width: 180px;

    height: 100px;

    object-fit: cover;

    border-radius: 6px;

    flex-shrink: 0;

}


.video-title {

    margin: 0 0 8px;

    font-size: 17px;

    line-height: 1.5;

}


.video-meta {

    color: #777;

    font-size: 13px;

    line-height: 1.6;

}


/* =========================
   グラフ
========================= */

.chart-card {

    margin-top: 20px;

    padding: 20px;

    background: white;

    border-radius: 10px;

}


.chart-title {

    margin: 0 0 15px;

    font-size: 17px;

}


.chart-wrapper {

    position: relative;

    width: 100%;

    height: 420px;

}


/* =========================
   空表示
========================= */

.empty {

    padding: 50px 20px;

    text-align: center;

    color: #888;

}


/* =========================
   読み込み中
========================= */

.loading {

    padding: 40px;

    text-align: center;

    color: #888;

}


/* =========================
   スマホ
========================= */

@media (max-width: 600px) {


    h1 {

        font-size: 20px;

    }


    .video-info {

        gap: 10px;

    }


    .thumbnail {

        width: 120px;

        height: 67px;

    }


    .video-title {

        font-size: 14px;

    }


    .video-meta {

        font-size: 12px;

    }


    .chart-card {

        padding: 12px;

    }


    .chart-wrapper {

        height: 320px;

    }

}

.container {
    padding-bottom: 50px;
}

/* =========================
   目標チェックボックスの色
========================= */

.youtube-goal-item input[data-goal="fastest100"] {
    accent-color: #d269ff;
}

.youtube-goal-item input[data-goal="fastest200"] {
    accent-color: #f5c400;
}

.youtube-goal-item input[data-goal="fastest300"] {
    accent-color: #42ff48;
}

/* 任意の動画と比較する */
#comparisonEnabled {
    accent-color: #d8f500;
}

.youtube-goal-item input[data-goal="custom"] {
    accent-color: #888888;
}

.youtube-goal-item input[data-goal="deadline"] {
    accent-color: #ff6b6b;
}

/* =========================
   目標ライン
========================= */

.youtube-goal-controls {
    width: 600px;
    max-width: calc(100% - 20px);
    margin: 20px auto 20px;
    text-align: left;
}

.youtube-goal-title {
    margin-bottom: 10px;
    font-weight: bold;
}

/* 1行目：3つ横並び */
.youtube-goal-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 18px;
    margin-bottom: 6px;
}

/* 2行目：任意＋入力欄 */
.youtube-custom-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
}

/* 任意 */
.youtube-custom-row .youtube-goal-item {
    margin: 0;
}

/* 入力欄 */
.youtube-custom-goal {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
}

#customGoalInput {
    width: 60px;
    padding: 5px 8px;
    font-size: 16px;
}

/* =========================
   任意目標入力
========================= */

#customGoalInput {
    font-size: 16px;
}

.youtube-day-chart {
    margin-bottom: 28px;
}

.youtube-day-chart:last-child {
    margin-bottom: 0;
}

.youtube-day-chart-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 10px;
}

.youtube-day-chart-period {
    font-size: 12px;
    color: #777;
    margin-bottom: 8px;
}

.youtube-day-chart-wrapper {
    position: relative;
    width: 100%;
    height: 300px;
}

@media (max-width: 600px) {

    .youtube-day-chart {
        margin-bottom: 24px;
    }

    .youtube-day-chart-wrapper {
        height: 260px;
    }

    .youtube-day-chart-title {
        font-size: 15px;
    }

}

/* =========================
   比較動画
========================= */

.youtube-comparison-row {
    margin-top: 8px;
}

.youtube-comparison-row .youtube-goal-item {
    margin: 0;
}

.youtube-comparison-video {
    margin-top: 8px;
}


/* =========================
   期限設定付き目標
========================= */

.youtube-deadline-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    flex-wrap: wrap;
}

/* 期限目標チェックボックス */
.youtube-deadline-row .youtube-goal-item {
    margin: 0;
}

/* 日付・目標入力 */
.youtube-deadline-goal {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
}

/* 日付入力 */
#deadlineGoalDate {
    width: 190px;
    padding: 5px 8px;
    font-size: 16px;
}

/* 目標回数入力 */
#deadlineGoalInput {
    width: 60px;
    padding: 5px 8px;
    font-size: 16px;
}

/* スマホ */
@media (max-width: 600px) {

    .youtube-deadline-row {
        gap: 8px;
    }

    #deadlineGoalDate {
        width: 190px;
        padding: 5px 8px;
        font-size: 16px;
    }

    #deadlineGoalInput {
        width: 60px;
    }

}

/* =========================================================
   YouTubeランキング
========================================================= */

.ranking-view {
    width: 100%;
    margin-top: 20px;
}


.ranking-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}


.ranking-select {
    height: 42px;
    padding: 0 36px 0 12px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fff;
    font-size: 14px;
}


.ranking-checkbox {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 42px;
    padding: 0 12px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fff;
    font-size: 14px;
    cursor: pointer;
}


.ranking-checkbox input {
    width: 17px;
    height: 17px;
    margin: 0;
}


.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}


.ranking-item {
    display: grid;
    grid-template-columns: 48px 150px 1fr;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border: 1px solid #e5e5e5;
    border-radius: 14px;
    background: #fff;
}


.ranking-item.ranking-acees{
    border:2px solid #C41E3A;
    background:#fff5f6;
}


.ranking-rank {

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    font-size: 20px;

    font-weight: 700;

}

.ranking-rank-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}


.ranking-rank-1 {
    font-size: 26px;
}


.ranking-rank-2 {
    font-size: 24px;
}


.ranking-rank-3 {
    font-size: 23px;
}


.ranking-thumbnail {
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 8px;
}


.ranking-thumbnail img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}


.ranking-content {
    min-width: 0;
}


.ranking-title {
    font-size: 15px;
    line-height: 1.5;
    font-weight: 600;
}


.ranking-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 7px;
    color: #666;
    font-size: 13px;
}


.ranking-main-value {
    margin-top: 7px;
    font-size: 20px;
    font-weight: 700;
}


.ranking-gap {
    display: inline-block;
    margin-top: 7px;
    padding: 4px 9px;
    border-radius: 999px;
    background: #ffd6dc;
    color: #C41E3A;
    font-size: 13px;
    font-weight: 700;
}


.ranking-empty {
    padding: 30px 15px;
    text-align: center;
    color: #777;
}


/* =========================================================
   スマホ
========================================================= */

@media (max-width: 600px) {

    .ranking-controls {
        gap: 8px;
    }


    .ranking-select {
        flex: 0 1 auto;
        min-width: 120px;
    }


    .ranking-checkbox {
        justify-content: center;
    }


    .ranking-item {
        grid-template-columns: 34px 110px 1fr;
        gap: 9px;
        padding: 9px;
        border-radius: 12px;
    }


    .ranking-rank {
        font-size: 17px;
    }


    .ranking-rank-1 {
        font-size: 21px;
    }


    .ranking-rank-2 {
        font-size: 20px;
    }


    .ranking-rank-3 {
        font-size: 19px;
    }


    .ranking-title {
        font-size: 13px;
        line-height: 1.4;
    }


    .ranking-stats {
        display: block;
        margin-top: 5px;
        font-size: 11px;
        line-height: 1.6;
    }


    .ranking-stats span {
        display: block;
    }


    .ranking-main-value {
        margin-top: 4px;
        font-size: 16px;
    }


    .ranking-gap {
        margin-top: 5px;
        font-size: 11px;
    }

    .ranking-list {
        margin-left: 8px;
        margin-right: 8px;
    }

}

.ranking-thumbnail-wrap {
    width: 100%;
}

.ranking-thumbnail-wrap .ranking-main-value {
    margin-top: 6px;
    text-align: center;
}

/* =======================
   ランキング順位変動
======================= */

.ranking-rank-change {
    margin-top: 3px;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
}

.ranking-rank-up {
    color: #1976D2;
}

.ranking-rank-down {
    color: #C41E3A;
}

.ranking-date {
    text-align: center;
    font-size: 14px;
    margin-bottom: 10px;
    color:var(--ruby);
}

/* =========================
   7日間予想
========================= */

.seven-day-prediction {
    text-align: center;
    margin: 18px 0 24px;
    line-height: 1.8;
}

#predictionPace {
    font-size: 14px;
}

#predictionResult {
    font-size: 18px;
    font-weight: bold;
    color:var(--ruby);
}

.ranking-note {
    text-align: center;
    font-size: 12px;
    margin-bottom: 10px;
}