:root {
        --text-main: #ffffff;
        --text-sub: rgba(255, 255, 255, 0.65);
        --text-dim: rgba(255, 255, 255, 0.35);
        --accent: #a5c0ee;
        --glass-bg: rgba(255, 255, 255, 0.07);
        --glass-card: rgba(255, 255, 255, 0.04);
        --glass-border: rgba(255, 255, 255, 0.12);
        --glass-hover: rgba(255, 255, 255, 0.16);
        --font-orig: 32px;
        --font-trans: 19px;
        --font-pron: 19px;
        --lyrics-gap: 36px;
        --glow-intensity: 0.35;
        --color-active-orig: #ffffff;
        --color-active-trans: #a5c0ee;
        --color-active-pron: #f2cf8f;
        /* 화면 위쪽에서 비워야 할 높이 (노치·상태바) */
        --safe-top: env(safe-area-inset-top, 0px);
    }
    /* iOS 홈 화면 앱은 상태바가 화면 위에 투명하게 겹치는데, iPad는 그 높이를 0으로 알려줄 때가 있다.
       그래서 최소 상태바 높이(24px) + 여유 6px은 항상 비운다. (class는 index.html에서 붙인다) */
    html.ios-app {
        --safe-top: calc(max(env(safe-area-inset-top, 0px), 24px) + 6px);
    }

    *, *::before, *::after {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
        scrollbar-width: none;
        -ms-overflow-style: none;
        -webkit-tap-highlight-color: transparent;
        font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto, "Helvetica Neue", "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
    }
    *::-webkit-scrollbar { display: none; }

    button, input, select, textarea, optgroup {
        font-family: inherit;
        font-size: inherit;
        color: inherit;
    }

    html, body {
        width: 100%;
        height: 100vh;
        margin: 0;
        padding: 0;
        overflow: hidden;
        background: #08080a;
        color: var(--text-main);
        font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto, "Helvetica Neue", "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-rendering: optimizeLegibility;
        user-select: none;
        -webkit-user-select: none;
        overscroll-behavior: none;
    }

    .bg-ambient {
        position: fixed;
        top: -20%;
        left: -20%;
        width: 140%;
        height: 140%;
        background-color: #121218;
        background-size: cover;
        background-position: center;
        filter: blur(85px) brightness(0.65) saturate(180%);
        transform: scale(1.1);
        z-index: 0;
        transition: background-image 1.2s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.8s ease;
        opacity: 0.85;
        pointer-events: none;
    }

    .bg-overlay {
        position: fixed;
        top: -20%;
        left: -20%;
        width: 140%;
        height: 140%;
        background: radial-gradient(ellipse at 35% 50%, rgba(0,0,0,0.15) 0%, rgba(6,6,10,0.75) 100%);
        z-index: 1;
        pointer-events: none;
    }

    /* 안드로이드 설치 앱: 상태바(theme-color)와 같은 색에서 시작해 배경으로 녹아드는 띠 (js/status-bar.js) */
    .status-blend { display: none; }
    html.android-app .status-blend {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 56px;
        z-index: 2;
        pointer-events: none;
        background: linear-gradient(to bottom, var(--status-color, #08080a) 0%, transparent 100%);
        transition: background 1.2s ease;
    }

    /* 커스텀 인터랙티브 스크롤바 (사이드바 및 모달 전용) */
    .custom-scrollbar-track {
        position: absolute;
        top: 12px;
        bottom: 12px;
        right: 3px;
        width: 28px;
        z-index: 60;
        display: flex;
        justify-content: flex-end;
        padding-right: 3px;
        touch-action: none;
        user-select: none;
        -webkit-user-select: none;
        pointer-events: auto;
        opacity: 0.88;
        transition: opacity 0.25s ease;
    }
    .custom-scrollbar-track.hidden {
        opacity: 0 !important;
        pointer-events: none !important;
    }
    body.hide-scrollbars .custom-scrollbar-track {
        display: none !important;
    }
    .custom-scrollbar-thumb {
        position: absolute;
        top: 0;
        right: 3px;
        width: 6px;
        min-height: 36px;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.28);
        border: 1px solid rgba(255, 255, 255, 0.15);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        cursor: grab;
        transition: width 0.18s cubic-bezier(0.16, 1, 0.3, 1),
                    right 0.18s cubic-bezier(0.16, 1, 0.3, 1),
                    background-color 0.18s ease,
                    box-shadow 0.18s ease,
                    border-color 0.18s ease;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .custom-scrollbar-thumb::after {
        content: '';
        width: 2px;
        height: 14px;
        border-radius: 2px;
        background: rgba(0, 0, 0, 0.4);
        opacity: 0;
        transition: opacity 0.18s ease, width 0.18s ease, height 0.18s ease;
    }
    .custom-scrollbar-track.dragging .custom-scrollbar-thumb,
    .custom-scrollbar-thumb:active {
        width: 22px;
        right: 1px;
        background: var(--accent);
        border-color: #ffffff;
        box-shadow: 0 0 18px rgba(165, 192, 238, 0.9), 0 4px 12px rgba(0, 0, 0, 0.55);
        cursor: grabbing;
    }
    .custom-scrollbar-track.dragging .custom-scrollbar-thumb::after,
    .custom-scrollbar-thumb:active::after {
        opacity: 1;
        width: 4px;
        height: 18px;
    }

    /* 스켈레톤 UI (Skeleton Shimmer UI) */
    @keyframes skeletonShimmer {
        0% { background-position: -200% 0; }
        100% { background-position: 200% 0; }
    }
    .skeleton-row {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 9px 11px;
        height: 66px;
        border-radius: 13px;
        background: rgba(255, 255, 255, 0.025);
        border: 1px solid rgba(255, 255, 255, 0.04);
        flex-shrink: 0;
        overflow: hidden;
        position: relative;
    }
    .skel-box {
        background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(165,192,238,0.14) 50%, rgba(255,255,255,0.05) 75%);
        background-size: 200% 100%;
        animation: skeletonShimmer 1.5s infinite linear;
        border-radius: 8px;
    }
    .skel-thumb {
        width: 46px;
        height: 46px;
        border-radius: 10px;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 11px;
        font-weight: 700;
        color: rgba(255, 255, 255, 0.28);
        font-variant-numeric: tabular-nums;
    }
    .skel-info {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 8px;
        min-width: 0;
    }
    .skel-title {
        height: 13px;
        width: 62%;
        border-radius: 6px;
    }
    .skel-sub {
        height: 10px;
        width: 38%;
        border-radius: 6px;
    }
    .skel-action {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        flex-shrink: 0;
    }

    /* 상단 플로팅 상태 캡슐 */
    .activity-pill {
        position: fixed;
        top: max(22px, var(--safe-top));
        left: 50%;
        transform: translateX(-50%) translateY(-15px);
        z-index: 110;
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 8px 18px;
        border-radius: 30px;
        background: rgba(18, 19, 26, 0.82);
        border: 1px solid rgba(165, 192, 238, 0.3);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 16px rgba(165, 192, 238, 0.15);
        font-size: 12.5px;
        font-weight: 600;
        color: #ffffff;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s;
    }
    .activity-pill.active {
        opacity: 1;
        visibility: visible;
        transform: translateX(-50%) translateY(0);
    }
    .activity-spinner {
        width: 13px;
        height: 13px;
        border: 2px solid rgba(255, 255, 255, 0.2);
        border-top-color: var(--accent);
        border-radius: 50%;
        animation: spin 0.8s linear infinite;
    }
    @keyframes spin { to { transform: rotate(360deg); } }

    .top-actions {
        position: fixed;
        top: max(24px, var(--safe-top));
        right: max(28px, env(safe-area-inset-right, 28px));
        z-index: 100;
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .cloud-pill {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        padding: 6px 13px;
        border-radius: 20px;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid var(--glass-border);
        font-size: 11.5px;
        font-weight: 600;
        color: var(--text-sub);
    }
    .cloud-dot {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: #06d6a0;
        box-shadow: 0 0 8px rgba(6, 214, 160, 0.6);
        transition: background 0.3s ease, box-shadow 0.3s ease;
    }
    .cloud-dot.syncing {
        background: #ffd166;
        box-shadow: 0 0 8px rgba(255, 209, 102, 0.8);
        animation: pulse 1s infinite alternate;
    }
    .cloud-dot.error {
        background: #ef476f;
        box-shadow: 0 0 8px rgba(239, 71, 111, 0.8);
    }
    @keyframes pulse { from { opacity: 0.4; } to { opacity: 1; } }

/* 반응형 미디어 쿼리 및 유틸리티 */
@media (max-width: 900px) {
        .viewport { flex-direction: column; padding: 20px 16px; gap: 20px; }
        .left-panel { width: 100%; align-items: center; text-align: center; margin-left: 0; }
        .cover-box { max-width: 220px; }
        .right-panel { width: 100%; height: 50vh; align-items: center; margin-left: 0; transform: none; padding-right: 0; }
        .lyrics-stream { align-items: center; }
        .lyric-item { align-items: center; text-align: center; transform-origin: center; width: 100%; max-width: 100%; }
        .sidebar-drawer { width: 88vw; }
    }

    canvas { display: none; }
    video { width: 1px; height: 1px; opacity: 0; position: absolute; pointer-events: none; }
