/* Tamagotchi BGM Skin */

/* 플레이어 컨테이너 */
.bgm-tama {
    position: fixed;
    right: var(--spacing-lg);
    bottom: var(--spacing-lg);
    z-index: 9999;
    width: 220px;
    padding: 0;
    font-family: "Press Start 2P", "VT323", var(--f-pre);
    transition: all var(--transition-base);
    overflow: visible;
}
.bgm-tama.edge-reveal { opacity: 1; pointer-events: auto; }

/* 최소화 */
.bgm-tama.minimized {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: var(--card-bg-color);
    border-radius: 4px;
    cursor: pointer;
    transition: transform .2s;
}
.bgm-tama.minimized:hover { transform: scale(1.05); }
.bgm-tama.minimized .player-content { display: none; }
.bgm-tama.minimized .minimized-overlay { display: block; }
.bgm-tama.minimized::before {
    content: '\f51f';
    font: 900 1.2rem 'Font Awesome 6 Free';
    color: var(--content-font-color);
}
.minimized-overlay { position: absolute; inset: 0; display: none; }

/* 플레이어 콘텐츠 */
.player-content { position: relative; }

/* 최소화 버튼 */
.minimize-btn {
    position: absolute;
    right: 50%;
    bottom: 0;
    z-index: 3;
    padding: 4px;
    background: transparent;
    border: none;
    color: var(--content-font-color);
    font-size: 12px;
    opacity: .5;
    cursor: pointer;
    transition: opacity .2s;
}
.minimize-btn:hover { opacity: .7; }

/* 타마고치 외형 */
.tama-shell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 200px;
    height: 240px;
}

.tama-frame {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 28% 18%, rgba(255,255,255,.75), transparent 32%),
        radial-gradient(circle at 72% 16%, rgba(60,60,60,.45), transparent 36%),
        radial-gradient(circle at 50% 15%, rgba(60,60,60,.3), transparent 50%),
        linear-gradient(135deg, #000 0% 25%, #1d1d1d 50%, #202020 75%, #000);
    border-radius: 52%;
    box-shadow: 0 3px 8px rgba(0,0,0,.5), 0 1px 12px rgba(0,0,0,.3);
    pointer-events: none;
}
.tama-frame::before {
    content: '';
    position: absolute;
    inset: 10px 10px 18px;
    background:
        radial-gradient(circle at 38% 28%, transparent 38%),
        radial-gradient(circle at 68% 32%, rgba(0,0,0,.2), transparent 42%),
        radial-gradient(circle at 52% 25%, rgba(0,0,0,.15), transparent 48%),
        #000;
    border-radius: 50%;
    box-shadow: inset 0 4px 12px rgba(255,255,255,.15);
    opacity: .9;
}
.tama-frame::after {
    content: '';
    position: absolute;
    inset: 16px 20px 30px;
    background: linear-gradient(135deg, rgba(255,255,255,.25), rgba(255,255,255,.1) 40%, transparent 70%);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 48% 48% 50% 50%;
    box-shadow: 0 2px 8px rgba(255,255,255,.1);
}

.tama-sparkles {
    position: absolute;
    inset: 0;
    background: var(--card-bg-color) center / cover no-repeat;
    border-radius: 50%;
    opacity: .7;
    mix-blend-mode: screen;
    pointer-events: none;
}

/* 스크린 */
.tama-screen {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40%;
    height: 44%;
    padding: 6px;
    background: radial-gradient(circle at 30% 30%, rgba(30,35,45,.9), rgba(4,6,8,.98)), rgba(4,6,8,.95);
    border: 1.5px solid rgba(255,255,255,.15);
    border-radius: 10px;
    box-shadow: inset 0 2px 12px rgba(0,0,0,.8), inset 0 -1px 4px rgba(255,255,255,.1), 0 2px 6px rgba(0,0,0,.4);
}
.tama-screen-inner {
    display: grid;
    grid-template-rows: 1fr auto;
    align-items: center;
    justify-items: center;
    gap: 4px;
    width: 100%;
    height: 100%;
}

/* 아바타/썸네일 */
.tama-avatar {
    width: 100%;
    height: 100%;
    background: #000;
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 4px;
    overflow: hidden;
}
.tama-thumbnail { width: 100%; height: 100%; object-fit: cover; }

/* 트랙 정보 */
.tama-text { min-width: 0; }
.track-title,
.track-artist {
    max-width: 60px;
    color: var(--content-font-color);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 1px;
}
.track-title { margin-bottom: 2px; font-size: 6px; font-weight: 700; }
.track-artist { font-size: 5px; opacity: .7; }

/* 컨트롤 */
.tama-controls {
    position: absolute;
    bottom: 16%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tama-controls-left,
.tama-controls-right {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 버튼 공통 */
.control-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 25px;
    height: 25px;
    background: var(--btn-primary-bg);
    border: 2px solid rgba(255,255,255,.2);
    border-radius: 50%;
    box-shadow: inset 0 2px 6px rgba(255,255,255,.2), 0 2px 6px rgba(0,0,0,.3);
    color: var(--btn-primary-text);
    font-size: 11px;
    cursor: pointer;
    transition: all .2s;
}
.control-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: inset 0 3px 8px rgba(255,255,255,.8), inset 0 -3px 6px rgba(0,0,0,.25), 0 4px 12px rgba(0,0,0,.35), 0 2px 4px rgba(255,255,255,.4);
}
.control-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: inset 0 2px 6px rgba(0,0,0,.3), inset 0 -2px 4px rgba(255,255,255,.5), 0 1px 3px rgba(0,0,0,.2);
}
.control-btn:disabled { opacity: .4; cursor: not-allowed; }

/* 재생 버튼 */
.control-btn.play-pause {
    width: 30px;
    height: 30px;
    margin: 0 4px;
    background: var(--btn-primary-bg);
    border: 2.5px solid rgba(10,12,16,.7);
    color: var(--btn-primary-text);
    font-size: 13px;
    box-shadow: inset 0 4px 10px rgba(255,255,255,.8), inset 0 -4px 8px rgba(0,0,0,.25), 0 4px 12px rgba(0,0,0,.35), 0 2px 4px rgba(255,255,255,.4);
}
.control-btn.play-pause:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: inset 0 4px 10px rgba(255,255,255,.9), inset 0 -4px 8px rgba(0,0,0,.3), 0 6px 16px rgba(0,0,0,.4), 0 3px 6px rgba(255,255,255,.5);
}
.control-btn.play-pause:active {
    transform: scale(1);
    box-shadow: inset 0 3px 8px rgba(0,0,0,.35), inset 0 -3px 6px rgba(255,255,255,.6), 0 2px 6px rgba(0,0,0,.25);
}

/* 모드/리스트 버튼 */
.control-btn.mode-btn,
.list-toggle-btn {
    position: absolute;
    bottom: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--btn-primary-bg);
    border: 1.5px solid rgba(10,12,16,.65);
    border-radius: 9px;
    box-shadow: inset 0 2px 5px rgba(255,255,255,.6), inset 0 -2px 4px rgba(0,0,0,.2), 0 2px 6px rgba(0,0,0,.3);
    color: var(--btn-primary-text);
    font-size: 9px;
    cursor: pointer;
    transition: all .2s;
}
.control-btn.mode-btn#shuffle-btn { left: 25%; transform: translateX(-50%); }
.control-btn.mode-btn#repeat-btn { left: 50%; transform: translateX(-50%); }
.list-toggle-btn { left: 75%; transform: translateX(-50%); }

.control-btn.mode-btn:hover,
.list-toggle-btn:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: inset 0 2px 5px rgba(255,255,255,.7), inset 0 -2px 4px rgba(0,0,0,.25), 0 3px 8px rgba(0,0,0,.35);
}
.control-btn.mode-btn.active,
.list-toggle-btn.active {
    background: var(--primary-color);
    color: var(--content-font-color);
    box-shadow: inset 0 2px 5px rgba(83,182,184,.5), inset 0 -2px 4px rgba(0,0,0,.4), 0 2px 8px rgba(83,182,184,.6);
}

/* 볼륨 */
.tama-volume {
    position: absolute;
    bottom: 29%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1px;
    width: 50%;
}
.vol-label {
    min-width: 28px;
    color: var(--content-font-color);
    font-size: 8px;
    font-weight: 700;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0,0,0,.5);
    letter-spacing: 1px;
}
.volume-bar-wrap { flex: 1; display: flex; align-items: center; justify-content: center; }
.volume-slider {
    width: 100%;
    height: 4px;
    background: var(--btn-primary-bg);
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 4px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,.4), 0 1px 2px rgba(255,255,255,.2);
    opacity: .5;
    cursor: pointer;
    -webkit-appearance: none;
}
.volume-slider::-webkit-slider-thumb {
    width: 12px;
    height: 12px;
    background: var(--btn-primary-bg);
    border: 1.5px solid rgba(10,12,16,.7);
    border-radius: 50%;
    box-shadow: inset 0 2px 4px rgba(255,255,255,.7), inset 0 -2px 3px rgba(0,0,0,.2), 0 2px 6px rgba(0,0,0,.4);
    cursor: pointer;
    transition: all .2s;
    -webkit-appearance: none;
}
.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: inset 0 2px 4px rgba(255,255,255,.8), inset 0 -2px 3px rgba(0,0,0,.25), 0 3px 8px rgba(0,0,0,.5);
}
.volume-popup { display: none !important; }

/* 플레이리스트 */
.playlist-container {
    position: absolute;
    top: 68%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    width: 85%;
    max-height: 50px;
    background: radial-gradient(circle at 30% 30%, rgba(25,30,40,.92), rgba(8,10,12,.98)), rgba(8,10,12,.95);
    border: 1.5px solid rgba(255,255,255,.25);
    border-radius: 10px;
    box-shadow: inset 0 2px 8px rgba(0,0,0,.6), 0 2px 8px rgba(0,0,0,.4);
    overflow-y: auto;
}
.playlist { list-style: none; margin: 0; padding: 0; }
.playlist li {
    padding: 4px 8px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    color: var(--content-font-color);
    font-size: 7px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: .9;
    cursor: pointer;
    transition: all .2s;
}
.playlist li:last-child { border-bottom: none; }
.playlist li:hover { padding-left: 10px; background: linear-gradient(90deg, rgba(255,255,255,.15), rgba(255,255,255,.08)); opacity: 1; }
.playlist li.current { background: var(--primary-color); box-shadow: inset 0 1px 3px rgba(0,0,0,.3); font-weight: 700; opacity: 1; }

.playlist-container::-webkit-scrollbar { width: 4px; }
.playlist-container::-webkit-scrollbar-track { background: transparent; }
.playlist-container::-webkit-scrollbar-thumb { background: var(--primary-color); border-radius: 2px; opacity: .4; }

/* 반응형 */
@media (max-width: 768px) {
    .bgm-tama { width: 200px; right: var(--spacing-md); bottom: var(--spacing-md); }
    .tama-shell { width: 180px; height: 220px; }
    .tama-controls { position: static; transform: none; }
    .tama-controls-left { position: absolute; bottom: 18%; left: 50%; transform: translateX(-50%); gap: 4px; }
    .tama-controls-right { position: absolute; top: calc(12% + 4px); left: 50%; transform: translateX(-50%); gap: 2px; }
    .control-btn { width: 26px; height: 26px; font-size: 10px; }
    .control-btn.play-pause { width: 30px; height: 30px; margin: 0 3px; font-size: 11px; }
    .control-btn.mode-btn,
    .list-toggle-btn {
        position: static;
        width: 18px;
        height: 18px;
        font-size: 8px;
        transform: none;
    }
    .control-btn.mode-btn:hover,
    .list-toggle-btn:hover { transform: none; }
    .playlist-container { top: calc(28% + 10px); }
    .vol-label { min-width: 24px; font-size: 7px; }
}
