:root {
    --accent: #ff0000;
    --surface: #030303;
    --on-surface: #ffffff;
    --sidebar-width: 350px;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

.material-icons-sharp {
    user-select: none;
    -webkit-user-select: none;
    /* Safari用 */
    -moz-user-select: none;
    /* Firefox用 */
    -ms-user-select: none;
    /* IE用 */
    pointer-events: none;
    /* アイコン自体へのクリック判定を無効化（親のripple-parentで拾うため） */
}

.btn-icon,
#menu-btn,
#lrc-toggle-btn {
    pointer-events: auto;
}

body {
    margin: 0;
    font-family: 'Roboto', sans-serif;
    background: var(--surface);
    color: var(--on-surface);
    display: flex;
    height: 100dvh;
    overflow: hidden;
}

/* --- リップルエフェクト --- */
.ripple-parent {
    position: relative;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.4);
    transform: translate(-50%, -50%) scale(0);
    pointer-events: none;
    transition: transform 2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.6s;
}

.ripple.is-active {
    transform: translate(-50%, -50%) scale(2.5);
}

.ripple.is-releasing {
    opacity: 0;
}

/* --- サイドバー --- */
#sidebar {
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-right: 1px solid #222;
    z-index: 3000;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.upload-btns {
    padding: 12px;
    display: flex;
    gap: 8px;
}

.upload-btns button {
    flex: 1;
    background: #121212;
    color: white;
    border: 1px solid #333;
    padding: 12px;
    border-radius: 12px;
    font-weight: bold;
    cursor: pointer;
    height: 44px;
}

.editing .queue-item {
    touch-action: none;
    /* ブラウザのスクロールを無効化 */
    user-select: none;
    -webkit-user-select: none;
}

#queue-list {
    overflow-y: auto;
    position: relative;
    scroll-behavior: smooth;
}

#queue-list::-webkit-scrollbar {
    width: 6px;
    /* スクロールバーの幅を細く */
}

#queue-list::-webkit-scrollbar-track {
    background: transparent;
    /* 背景は透明に */
}

#queue-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    /* 控えめな白 */
    border-radius: 10px;
}

#queue-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
    /* ホバーで少し明るく */
}

/* Firefox用（標準プロパティ） */
#queue-list {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.queue-artist {
    color: #666 !important;
    /* 少し暗めのグレーに変更 */
    font-size: 0.85rem;
    /* サイズを小さく設定 */
    margin-top: 2px;
}

#edit-mode-btn.active {
    background: var(--accent);
    color: white;
}

/* 編集モード中のみ移動可能であることを示すカーソル */
.editing .queue-item {
    cursor: grab;
}

.editing .queue-item:active {
    cursor: grabbing;
}

.queue-item.drag-over-top {
    border-top: 3px solid var(--accent) !important;
}

.queue-item.drag-over-bottom {
    border-bottom: 3px solid var(--accent) !important;
}

/* ドラッグ中の要素は少し浮かせる */
.queue-item.dragging {
    opacity: 0.2;
    transform: scale(0.98);
}

.queue-item {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #111;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: element
}

.queue-item.active {
    border-left: 4px solid var(--accent);
    background: rgba(255, 255, 255, 0.05);
}

.queue-item img {
    width: 44px;
    height: 44px;
    border-radius: 4px;
    object-fit: cover;
}

/* --- メインビュー --- */
#main-view {
    flex: 1;
    display: grid;
    grid-template-rows: 1fr 160px;
    height: 100dvh;
    overflow: hidden;
    position: relative;
    background: var(--surface);
}

/* 上段：表示エリア */
#display-container {
    grid-row: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    min-height: 0;
}

#art-view {
    position: relative;
    width: min(65vw, 300px);
    height: min(65vw, 300px);
    background: #1a1a1a;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#main-art {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2;
    /* アイコンより上 */
}

.placeholder-icon {
    font-size: 100px !important;
    color: #333;
    z-index: 1;
    /* 画像の下 */
}

/* サイドバー（クエリ）のアイコン */
.thumb-container {
    width: 44px;
    height: 44px;
    background: #1a1a1a;
    border-radius: 4px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.thumb-container .material-icons-sharp {
    font-size: 24px !important;
    color: #333;
    z-index: 1;
}

.thumb-container img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2;
}

#art-view img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#meta-info-display {
    text-align: center;
    margin-top: 15px;
    width: 100%;
}

#meta-title {
    font-size: clamp(1.1rem, 4vw, 1.8rem);
    margin: 0;
}

#meta-artist {
    color: #888 !important;
    font-size: 1rem;
    margin-top: 5px;
}

/* 歌詞ビュー */
#lyrics-view {
    position: absolute;
    inset: 0;
    display: none;

    /* 縦スクロールは許可、横スクロールは厳禁 */
    overflow-y: auto;
    overflow-x: hidden;

    text-align: center;
    padding: 45dvh 20px;
    background: rgba(0, 0, 0, 0.9);
    z-index: 100;

    /* スクロールバーを非表示にする（機能は維持） */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
}

/* Chrome, Safari, Edge 用のスクロールバー非表示設定 */
#lyrics-view::-webkit-scrollbar {
    display: none;
}

/* 歌詞一行の折り返し設定（横へのはみ出し防止） */
.lrc-line {
    display: block;
    font-size: clamp(1.2rem, 3vw, 1.6rem);
    margin: 30px 0;
    color: rgba(255, 255, 255, 0.2);
    transition: color 0.15s ease-out, transform 0.15s ease-out;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    /* 長い歌詞が画面を突き破らないようにする */
    white-space: pre-wrap;
    word-wrap: break-word;
    max-width: 100%;
}

.lrc-line.active {
    color: #fff;
    transform: scale(1.08);
    font-weight: 700;
}

/* --- 下段：プレイヤーバー --- */
#player-bar {
    grid-row: 2;
    background: #000;
    border-top: 1px solid #222;
    display: flex;
    flex-direction: column;
    padding: 15px 20px;
    z-index: 1000;
    align-items: center;
}

.seek-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto 10px auto;
    /* 左右をautoにして中央寄せ */
    padding: 0 10px;
    /* 左右に均等な余白を確保 */
    display: flex;
    flex-direction: column;
    align-items: center;
}

#seek-bar {
    width: calc(100% - 32px);
    /* 左右16pxずつの余白 */
    margin: 10px auto;
    /* 上下10px、左右中央 */
    display: block;
    accent-color: var(--accent);
    cursor: pointer;
    -webkit-appearance: auto;
    appearance: auto;
}

/* 3. 埋まったボタンを上に持ち上げる */
#player-bar {
    grid-row: 2;
    background: #000;
    border-top: 1px solid #222;
    display: flex;
    flex-direction: column;
    /* padding-bottomを増やして、スマホの画面下端からボタンを引き上げる */
    padding: 10px 20px 40px 20px;
    z-index: 1000;
    align-items: center;
    height: auto;
    /* 固定値ではなく中身に合わせる */
}

#time-display {
    width: 100%;
    display: flex;
    justify-content: space-between;
    /* 0:00 と 3:45 を左右に振り分けたい場合 */
    /* 中央にしたい場合は text-align: center; のまま */
    margin-bottom: 4px;
}

.bar-main {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    width: 100%;
    max-width: 800px;
    height: 70px;
    /* ボタンが動くスペースを確保 */
}

.controls-center {
    /* ここにあった padding-bottom を削除して、親の player-bar 側で制御する */
    grid-column: 2;
    display: flex;
    align-items: center;
    gap: clamp(10px, 4vw, 25px);
}

.btn-icon {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 50% !important;
    overflow: hidden;
}

#play-btn {
    width: 60px;
    height: 60px;
    font-size: 62px !important;
}

.lrc-line {
    cursor: pointer;
    /* 指の形にする */
}

#lrc-toggle-btn {
    position: relative;
    grid-column: 3;
    justify-self: end;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50% !important;
    font-size: 24px;
    color: #fff;
    z-index: 1100;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
}

#menu-btn {
    display: none;
}

/* PCでは隠す */

#lrc-toggle-btn.active-lrc {
    color: var(--accent);
    background: rgba(255, 0, 0, 0.1);
    border-color: var(--accent);
}

#lrc-toggle-btn.disabled {
    opacity: 0.1;
    pointer-events: none;
}

/* --- スマホ対応 --- */
@media (max-width: 768px) {
    #sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        width: 85%;
        transform: translateX(-100%);
    }

    #sidebar.open {
        transform: translateX(0);
    }

    #menu-btn {
        display: flex;
        position: absolute;
        top: 15px;
        left: 15px;
        z-index: 2100;
        background: rgba(0, 0, 0, 0.6);
        border-radius: 50%;
        width: 48px;
        height: 48px;
        align-items: center;
        justify-content: center;
    }

    #sidebar.open~#main-view #menu-btn {
        opacity: 0;
        pointer-events: none;
    }

    #main-view {
        grid-template-rows: 1fr 140px;
    }

    #lrc-toggle-btn {
        position: absolute !important;
        top: 15px !important;
        right: 15px !important;
        width: 44px;
        height: 44px;
        z-index: 2500;
        /* ハンバーガーボタン(2100)より手前に */
        margin-right: 0;
    }
}

/* オーバーレイ */
#drop-overlay,
#loader {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
}

#drop-overlay {
    /* 既存のスタイル... */
    pointer-events: none;
    /* マウスイベントを透過させる */
}

#drop-overlay h2 {
    /* 文字の部分だけはイベントを止めても良いが、基本は全体透過でOK */
    pointer-events: auto;
}