/* リセットとベーススタイル */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
    position: relative;
    overflow-x: hidden;
}

/* 背景スライドショー */
.background-slideshow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    background-color: #2c3e50;
}

.background-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 2s ease-in-out;
    will-change: opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.background-slide.active {
    opacity: 1;
    z-index: 2;
}

.background-slide.fadeout {
    opacity: 0;
    z-index: 1;
}

/* 背景画像の上にオーバーレイ */
.background-slideshow::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(3px);
    z-index: 10;
    pointer-events: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* ヘッダー */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    margin: -20px -20px 30px -20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.header-content {
    text-align: center;
}

.cover-image {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.title {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1rem;
    color: #7f8c8d;
}

/* ナビゲーションメニュー */
.nav-menu {
    display: flex;
    flex-direction: row;
    gap: 30px;
    align-items: center;
}

.nav-button {
    padding: 8px 4px;
    background: transparent;
    color: #666;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.nav-button:hover {
    color: #ff9b5a;
}

.nav-button.active {
    color: #2c3e50;
    font-weight: 700;
    border-bottom-color: #ff9b5a;
}

/* コンテンツセクション */
.content-section {
    min-height: calc(100vh - 180px);
    padding-top: 20px;
    scroll-margin-top: 200px;
    opacity: 0.3;
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    transform: translateY(40px);
}

.content-section.fade-in {
    opacity: 1;
    transform: translateY(0);
}

.content-section.fade-out {
    opacity: 0;
    transform: translateY(-30px);
    pointer-events: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.section-container {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

.news-content,
.introduction-content {
    line-height: 1.8;
}

.news-placeholder {
    color: #7f8c8d;
    text-align: center;
    padding: 40px 20px;
}

.introduction-text {
    margin-bottom: 15px;
    font-size: 1.05rem;
    color: #555;
}

/* 検索セクション */
.search-section {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.search-input {
    flex: 1;
    padding: 12px 20px;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: border-color 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: #ff9b5a;
}

.search-button {
    padding: 12px 30px;
    background: #ff9b5a;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.search-button:hover {
    background: #f58742;
}

/* メインコンテンツ */
.main-content {
    display: grid;
    gap: 30px;
}

.section-title {
    font-size: 1.5rem;
    color: #2c3e50;
    margin-bottom: 20px;
}

/* エピソード一覧 */
.episodes-section {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.episodes-list {
    display: grid;
    gap: 15px;
}

.episode-card {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #ff9b5a;
    cursor: pointer;
    transition: all 0.3s;
}

.episode-card:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.episode-card.active {
    background: #fff5f0;
    border-left-color: #ffa76e;
}

.episode-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.episode-number {
    background: #ff9b5a;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.episode-title {
    font-size: 1.1rem;
    color: #2c3e50;
    font-weight: 600;
    flex: 1;
}

.episode-meta {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 8px;
}

.episode-summary {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: pre-line;
}

/* ローディング */
.loading {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
    font-size: 1.1rem;
}

/* ページネーション */
.pagination {
    text-align: center;
    margin-top: 20px;
}

.load-more-button {
    padding: 12px 40px;
    background: #ecf0f1;
    color: #2c3e50;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.load-more-button:hover {
    background: #d5dbdb;
}

/* プレーヤーセクション */
.player-section {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 20px;
}

.player-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.player-info {
    border-bottom: 1px solid #ecf0f1;
    padding-bottom: 20px;
}

.player-info .episode-number {
    display: inline-block;
    margin-bottom: 10px;
}

.player-title {
    font-size: 1.3rem;
    color: #2c3e50;
    margin-bottom: 10px;
}

.player-summary {
    font-size: 0.95rem;
    color: #7f8c8d;
    line-height: 1.5;
    white-space: pre-line;
}

/* 概要内のリンク */
.description-link {
    color: #ff9b5a;
    text-decoration: underline;
    word-break: break-all;
}

.description-link:hover {
    color: #f58742;
}

/* オーディオプレーヤー */
.audio-player {
    width: 100%;
    border-radius: 8px;
}

/* 再生速度コントロール */
.speed-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.speed-buttons-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.speed-label {
    font-weight: 600;
    color: #2c3e50;
    writing-mode: horizontal-tb;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: fit-content;
    display: inline-block;
}

.speed-button {
    padding: 8px 16px;
    background: white;
    color: #2c3e50;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.speed-button:hover {
    border-color: #ff9b5a;
    color: #ff9b5a;
}

.speed-button.active {
    background: #ff9b5a;
    color: white;
    border-color: #ff9b5a;
}

/* 字幕コンテナ */
.subtitle-container {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.subtitle-title {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
}

.subtitle-display {
    height: 300px;
    padding: 15px;
    background: white;
    border-radius: 6px;
    font-size: 1rem;
    color: #2c3e50;
    line-height: 1.8;
    text-align: center;
    overflow-y: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* フッター */
.footer {
    text-align: center;
    padding: 30px 20px;
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-top: 40px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        padding: 15px;
        gap: 20px;
    }

    .cover-image {
        width: 100px;
        height: 100px;
    }

    .title {
        font-size: 2rem;
    }

    .nav-menu {
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: center;
        width: 100%;
        gap: 15px;
    }

    .nav-button {
        padding: 8px 4px;
        font-size: 0.9rem;
    }

    .search-section {
        flex-direction: column;
    }

    .episodes-section,
    .player-section {
        padding: 20px;
    }

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

    /* スマホ表示時：エピソード一覧を固定範囲でスクロール */
    .episodes-section {
        max-height: 50vh;
        overflow-y: auto;
    }

    /* スマホ表示時：プレイヤーは通常のフロー（画面下部に表示） */
    .player-section {
        margin-top: 20px;
    }

    /* プレイヤーのタイトルをコンパクトに */
    .player-title {
        font-size: 1.1rem;
    }

    /* 字幕表示エリアをコンパクトに */
    .subtitle-display {
        height: 200px;
    }
}

@media (min-width: 769px) {
    .main-content {
        grid-template-columns: 1fr 400px;
        align-items: start;
    }

    /* PC表示時：エピソード一覧を固定高さでスクロール可能に */
    .episodes-section {
        max-height: calc(100vh - 200px);
        overflow-y: auto;
        position: sticky;
        top: 20px;
    }

    /* PC表示時：プレイヤーは通常のフロー（画面右側に表示） */
    .player-section {
        position: relative;
    }
}