* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

#audio-visualizer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

/* 16:9の比率を保つラッパー */
.app-wrapper {
    height: 85vh;
    aspect-ratio: 16 / 9;
    display: flex;
}

/* メインコンテナ */
.app-container {
    display: flex;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 15px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    overflow: hidden;
}

/* --- 3パネルのレイアウト --- */
.left-pane {
    flex: 3;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: transparent;
}

.center-pane {
    flex: 3;
    padding: 30px;
    border-left: 1px solid rgba(255, 255, 255, 0.18);
    border-right: 1px solid rgba(255, 255, 255, 0.18);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.right-pane {
    flex: 3;
    padding: 30px;
    display: flex;
    flex-direction: column;
}

/* --- 左パネルの要素 --- */
.artwork-container {
    width: 80%;
    aspect-ratio: 1 / 1;
    margin-bottom: 20px;
}

.artwork-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.song-info {
    text-align: center;
    margin-bottom: 20px;
    color: #f0f0f0;
}

.progress-container {
    width: 100%;
    margin-bottom: 10px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
}

/* 再生済み部分のスタイル */
.progress {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background-color: #fff;
    border-radius: inherit;
}

/* 再生位置を示すツマミ */
.progress-thumb {
    position: absolute;
    top: 50%;
    left: 0;
    width: 16px;
    height: 16px;
    background-color: #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* ホバー時にツマミを表示 */
.progress-container:hover .progress-thumb {
    opacity: 1;
}

.time-display {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    color: #ddd;
    margin-top: 5px;
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

.controls button {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

/* 再生/一時停止ボタンを大きくする */
.controls button#play-pause-btn {
    width: 65px;
    height: 65px;
    font-size: 1.8rem;
}

.controls button:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* シャッフル・ループボタンがアクティブな時のスタイル */
.controls button.active {
    background: rgba(102, 126, 234, 0.7);
    color: #fff;
}

/* --- ボリュームコントロール --- */
.volume-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80%;
    gap: 10px;
    margin-top: 20px;
}

.volume-container button {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: color 0.3s ease;
}

.volume-container button:hover {
    color: #ddd;
}

.volume-slider-container {
    flex-grow: 1;
}

.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    outline: none;
    transition: opacity 0.2s;
    cursor: pointer;
}

/* Webkit (Chrome, Safari) 用のツマミ */
.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
}

/* Mozilla (Firefox) 用のツマミ */
.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

/* --- 中央・右パネルの共通スタイル --- */
.pane-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 5px;
}

.pane-header h2 {
    margin: 0;
}

.playlist-controls {
    display: flex;
    gap: 8px;
}

.playlist-controls button {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
    cursor: pointer;
    width: 35px;
    height: 35px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: color 0.3s ease;
}

.playlist-controls button:hover {
    color: #fff;
}

.song-list {
    list-style: none;
    margin-top: 15px;
    flex-grow: 1;
    overflow-y: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.song-list::-webkit-scrollbar {
    display: none;
}

.song-list li {
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    transition: background-color 0.3s ease;
    cursor: pointer;
}

.song-list li:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* 現在再生中の曲のスタイル */
.song-list li.playing {
    background-color: #4E61D380;
    color: #fff;
    font-weight: 500;
}

/* --- ドラッグアンドドロップのスタイル --- */

/* ドラッグ中の要素のスタイル */
.song-list li.dragging {
    opacity: 0.5;
}

/* ドロップ先の候補となる要素の上部に線を表示 */
.song-list li.drag-over {
    border-top: 2px solid #fff;
    background-color: rgba(255, 255, 255, 0.2);
}

/* リスト自体がドロップ先候補の場合のスタイル */
.song-list.drag-over {
    background-color: rgba(255, 255, 255, 0.1);
}

.empty-message {
    cursor: default;
    opacity: 0.6;
}

/* --- レスポンシブ対応 (タブレット・スマホ) --- */
@media screen and (max-width: 1024px) {
    body {
        padding: 0;
    }

    .app-wrapper {
        height: 100vh;
        aspect-ratio: auto;
    }

    .app-container {
        flex-direction: column;
        border-radius: 0;
        overflow-y: auto;
    }

    .left-pane,
    .center-pane,
    .right-pane {
        flex: none;
        width: 100%;
        border-left: none;
        border-right: none;
        border-top: 1px solid rgba(255, 255, 255, 0.18);
    }

    .left-pane {
        border-top: none;
    }

    .center-pane,
    .right-pane {
        min-height: 300px;
    }

    .artwork-container {
        width: 60%;
        max-width: 250px;
        margin-top: 20px;
    }
}