body {
    margin: 0;
    padding: 20px;
    background-color: #121212;
    color: #e0e0e0;
    font-family: 'Helvetica Neue', Arial, sans-serif;
}

h1 {
    text-align: center;
    color: #ffffff;
    margin-bottom: 20px;
}

/* プルダウンのコンテナ */
.date-selector-container {
    text-align: center;
    margin-bottom: 25px;
}

/* プルダウンメニューのデザイン */
#date-selector {
    padding: 10px 15px;
    font-size: 1.1rem;
    background-color: #2c2c2c;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 6px;
    outline: none;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

#date-selector:hover {
    border-color: #ffd700;
    background-color: #333;
}

#date-selector:focus {
    border-color: #ffd700;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

.timetable-container {
    max-width: 95%; /* 画面いっぱいに広げる */
    margin: 0 auto;
    height: 85vh; /* 高さを拡大 */
    overflow-y: auto;
    border: 1px solid #333;
    border-radius: 8px;
    background-color: #1e1e1e;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
    /* スクロールバーを非表示にする */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE, Edge */
}

.timetable-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Edge */
}

.timetable {
    display: flex;
    flex-direction: column;
    min-width: 600px; /* あまりに縮まりすぎないように */
}

/* ヘッダー行 */
.channel-header {
    display: flex;
    background-color: #2c2c2c;
    border-bottom: 2px solid #555;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* ヘッダーの時刻カラム */
.time-col-header {
    width: 60px;
    padding: 15px 10px;
    text-align: center;
    border-right: 1px solid #444;
    background-color: #2c2c2c;
    position: sticky;
    left: 0;
    z-index: 11;
}

/* テレビ放送局のカラム（1列用） */
.channel-col {
    flex: 1;
    padding: 15px 10px;
    text-align: center;
    border-right: none;
    font-size: 1.1em;
}

/* 番組表本体 (288分割グリッド: 24時間 * 12(5分単位)) */
.timetable-body {
    display: grid;
    grid-template-columns: 60px 1fr;
    grid-template-rows: repeat(288, 20px); /* 5分あたり20px (1時間=240px) */
    position: relative;
    background-color: #1e1e1e;
}

/* 時刻ラベル (1時間ごとに1マス占有) */
.time-label {
    grid-column: 1;
    background-color: #252525;
    border-right: 1px solid #333;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 10px;
    font-weight: bold;
    color: #888;
    position: sticky;
    left: 0;
    z-index: 5;
    font-family: monospace;
    font-size: 0.9rem;
}

/* 番組カード (グリッド上で結合して配置) */
.program-item-card {
    grid-column: 2;
    margin: 2px 5px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #2a2a2a 0%, #222 100%);
    border-left: 4px solid #ffd700;
    border-radius: 4px;
    color: #fff;
    font-size: 0.95rem;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    border-bottom: 1px solid #333;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    transition: 0.2s;
}

.program-item-card:hover {
    transform: scale(1.01);
    background: linear-gradient(135deg, #333 0%, #252525 100%);
    z-index: 20;
    box-shadow: 0 8px 20px rgba(0,0,0,0.5);
    border-left-width: 6px;
}

.prog-card-time {
    font-size: 0.8rem;
    color: #ffd700;
    margin-bottom: 4px;
    font-weight: bold;
}

.prog-card-title {
    font-weight: bold;
    line-height: 1.3;
}

/* 現在時刻インジケーター */
.current-time-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #ff3b3b;
    box-shadow: 0 0 8px #ff3b3b;
    z-index: 100;
    pointer-events: none;
}
.current-time-line::before {
    content: '';
    position: absolute;
    left: -5px;
    top: -4px;
    border: 5px solid transparent;
    border-left-color: #ff3b3b;
}

/* 削除済みの古いスタイル (念のため空にするか調整) */
.time-row { display: none; }
.program-cell { display: none; }

/* =========================================
   現在の時刻の行が光るハイライトスタイル
========================================= */
.time-row.highlight {
    background-color: rgba(255, 215, 0, 0.15);
    border-top: 2px solid rgba(255, 215, 0, 0.8);
    border-bottom: 2px solid rgba(255, 215, 0, 0.8);
    position: relative;
    z-index: 2;
    animation: glow 2s infinite alternate;
}

.time-row.highlight .time-label {
    background-color: rgba(255, 215, 0, 0.3);
    color: #fff;
    text-shadow: 0 0 5px rgba(255, 215, 0, 1);
}

.time-row.highlight .program-cell {
    color: #fff;
    font-weight: bold;
    text-shadow: 0 0 3px rgba(255, 255, 255, 0.6);
}

@keyframes glow {
    0% {
        box-shadow: inset 0 0 5px rgba(255, 215, 0, 0.2), 0 0 5px rgba(255, 215, 0, 0.2);
    }

    100% {
        box-shadow: inset 0 0 20px rgba(255, 215, 0, 0.6), 0 0 15px rgba(255, 215, 0, 0.4);
    }
}

.time-row.highlight::before,
.time-row.highlight::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: #ffd700;
    box-shadow: 0 0 10px #ffd700;
}

.time-row.highlight::before {
    left: 0;
    z-index: 10;
}

.time-row.highlight::after {
    right: 0;
}

/* =========================================
   モバイル対応 (スマートフォン向け)
========================================= */
@media screen and (max-width: 600px) {
    body {
        padding: 5px;
    }
    
    .timetable-container {
        max-width: 100%;
        height: 90vh;
        border-radius: 0;
    }

    .timetable {
        min-width: auto;
    }

    /* ヘッダーの幅を本体(50px)と合わせる */
    .time-col-header {
        width: 50px;
        padding: 10px 2px;
        font-size: 0.8rem;
    }
    .channel-col {
        font-size: 0.9rem;
        padding: 10px 5px;
    }

    .timetable-body {
        grid-template-columns: 50px minmax(0, 1fr); /* はみ出し防止 */
    }

    .time-label {
        font-size: 0.75rem;
        padding-top: 5px;
    }

    .program-item-card {
        padding: 4px 6px;
        font-size: 0.8rem;
        margin: 1px 2px;
        word-break: break-all; /* 長いタイトルを改行 */
    }

    .prog-card-time {
        font-size: 0.7rem;
    }

    .prog-card-title {
        display: -webkit-box;
        -webkit-line-clamp: 2; /* 2行までに制限 */
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}