.viewport {
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100%;
        z-index: 2;
        display: flex;
        justify-content: space-between;
        padding: max(20px, var(--safe-top)) 24px max(20px, env(safe-area-inset-bottom, 20px)) clamp(60px, 7vw, 120px);
        align-items: center;
        overflow: hidden;
    }

    .left-panel {
        width: clamp(280px, 40vh, 420px);
        flex-shrink: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        gap: 16px;
        z-index: 10;
        margin-left: 17px;
    }

    .cover-box {
        width: 100%;
        aspect-ratio: 1 / 1;
        border-radius: 18px;
        overflow: hidden;
        background: rgba(255, 255, 255, 0.05);
        box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--glass-border);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: transform 0.25s ease;
    }
    .cover-box:active { transform: scale(0.98); }
    .cover-box img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }
    .cover-placeholder {
        color: var(--text-dim);
        font-size: 13px;
    }

    .meta-box {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        width: 100%;
    }
    .track-title {
        font-size: clamp(20px, 2.7vh, 26px);
        font-weight: 700;
        letter-spacing: -0.5px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.25;
        cursor: pointer;
        max-width: 100%;
    }
    .track-artist {
        font-size: clamp(14px, 1.8vh, 16px);
        font-weight: 500;
        color: var(--text-sub);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        cursor: pointer;
        max-width: 100%;
        padding: 2px 6px;
        border-radius: 8px;
        transition: color 0.2s, background 0.2s;
    }
    .track-artist:active {
        color: #ffffff;
        background: rgba(255, 255, 255, 0.1);
    }

    .progress-wrap {
        width: 100%;
        display: flex;
        align-items: center;
        gap: 10px;
        margin-top: 2px;
    }
    .progress-time {
        font-size: 11px;
        font-weight: 500;
        color: var(--text-dim);
        font-variant-numeric: tabular-nums;
        width: 34px;
    }
    .progress-bar-bg {
        flex: 1;
        height: 4px;
        background: rgba(255, 255, 255, 0.12);
        border-radius: 4px;
        position: relative;
        cursor: pointer;
        transition: height 0.15s ease;
    }
    .progress-bar-fill {
        height: 100%;
        width: 0%;
        background: rgba(255, 255, 255, 0.9);
        border-radius: 4px;
        transition: width 0.1s linear;
        box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
    }

    .control-bar {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 14px;
        margin-top: 2px;
    }
    .btn-ctrl {
        width: 46px;
        height: 46px;
        border-radius: 50%;
        background: var(--glass-bg);
        border: 1px solid var(--glass-border);
        color: var(--text-main);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer !important;
        transition: transform 0.16s cubic-bezier(0.16, 1, 0.3, 1), background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        flex-shrink: 0;
        outline: none;
    }
    .btn-ctrl:focus { outline: none; }
    .btn-ctrl:active {
        transform: scale(0.92) !important;
        background: rgba(255, 255, 255, 0.22) !important;
    }
    .btn-ctrl svg {
        width: 19px;
        height: 19px;
        fill: currentColor;
        pointer-events: none;
    }
    .btn-ctrl.play-btn {
        width: 56px;
        height: 56px;
        background: rgba(255, 255, 255, 0.14);
        border: 1px solid rgba(255, 255, 255, 0.28);
        color: #ffffff;
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
    }
    .btn-ctrl.play-btn svg { width: 22px; height: 22px; }
    .btn-ctrl.play-btn:active {
        transform: scale(0.92) !important;
        background: rgba(255, 255, 255, 0.28) !important;
    }

    @media (hover: hover) and (pointer: fine) {
        .custom-scrollbar-track:hover .custom-scrollbar-thumb {
            width: 10px;
            background: rgba(255, 255, 255, 0.45);
        }
        .cover-box:hover { transform: scale(1.015); }
        .track-artist:hover { color: #ffffff; text-decoration: underline; }
        .progress-bar-bg:hover { height: 6px; }
        .btn-ctrl:hover {
            background: var(--glass-hover);
            transform: scale(1.06);
            border-color: rgba(255, 255, 255, 0.3);
        }
        .btn-ctrl.play-btn:hover {
            background: rgba(255, 255, 255, 0.24);
            border-color: rgba(255, 255, 255, 0.45);
            transform: scale(1.08);
            box-shadow: 0 0 25px rgba(255, 255, 255, 0.25);
        }
        .lyric-item:hover { opacity: 0.75 !important; }
        .tab-pill:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
        .row-item:hover {
            background: rgba(255, 255, 255, 0.09);
            border-color: var(--glass-border);
            transform: translateX(3px);
        }
        .row-action-btn:hover {
            background: #ffffff;
            color: #000000;
            transform: scale(1.08);
        }
        .btn-offset:hover { background: rgba(255, 255, 255, 0.16); }
        .btn-action:hover:not(:disabled) { background: rgba(255, 255, 255, 0.15); }
        .btn-action.primary:hover { background: #e6e6e6; }
        .log-entry:hover { background: rgba(255, 255, 255, 0.08); }
    }

    .right-panel {
        flex: 1;
        margin-left: 10vh;
        transform: none;
        padding-right: 40px;
        max-width: 860px;
        height: 100%;
        min-width: 0;
        min-height: 0;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        position: relative;
        mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
        -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
        overflow: hidden;
    }
    .lyrics-stream {
        width: 100%;
        height: 100%;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 40vh 0;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: var(--lyrics-gap);
        scroll-behavior: smooth;
    }

    .loading-card {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 24px 0;
        width: 100%;
    }
    .loading-spinner {
        width: 32px;
        height: 32px;
        border: 3px solid rgba(255, 255, 255, 0.12);
        border-top-color: var(--accent);
        border-radius: 50%;
        animation: spin 0.8s linear infinite;
    }
    .loading-title {
        font-size: 24px;
        font-weight: 700;
        color: #ffffff;
    }
    .loading-desc {
        font-size: 15px;
        color: var(--text-sub);
    }

    .loading-source {
        margin-top: 10px;
        font-size: 13px;
        color: var(--text-sub);
        opacity: 0.85;
    }
    .loading-source:empty { display: none; }

    .lyric-item {
        transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
        opacity: 0.15;
        cursor: pointer;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
        gap: 8px;
        transform-origin: left center;
        width: 92%;
        max-width: 92%;
        box-sizing: border-box;
    }
    
    .lyric-item.active {
        opacity: 1 !important;
        transform: scale(1.04);
    }
    
    .lyric-orig {
        font-size: var(--font-orig);
        font-weight: 700;
        line-height: 1.35;
        letter-spacing: -0.3px;
        color: rgba(255, 255, 255, 0.85);
        white-space: normal;
        word-break: keep-all;
        overflow-wrap: break-word;
        max-width: 100%;
        transition: color 0.3s, text-shadow 0.3s;
    }
    .lyric-item.active .lyric-orig {
        color: var(--color-active-orig);
        text-shadow: 0 0 calc(28px * var(--glow-intensity)) var(--color-active-orig);
    }

    .lyric-trans {
        font-size: var(--font-trans);
        font-weight: 500;
        line-height: 1.4;
        color: rgba(255, 255, 255, 0.55);
        white-space: normal;
        word-break: keep-all;
        overflow-wrap: break-word;
        max-width: 100%;
        transition: color 0.3s, text-shadow 0.3s;
    }
    .lyric-item.active .lyric-trans {
        color: var(--color-active-trans);
        text-shadow: 0 0 calc(24px * var(--glow-intensity)) var(--color-active-trans);
    }

    /* 한 줄의 원문·발음·번역 묶음. 기본은 full만 보이고, 모바일 하단 한 줄 모드에서 compact로 바뀐다 */
    .lyric-layers {
        display: flex;
        flex-direction: column;
        align-items: inherit;
        gap: inherit;
        width: 100%;
        max-width: 100%;
    }
    .lyric-layers-compact { display: none; }

    /* 발음은 번역과 구분되도록 별도 색상을 쓴다 */
    .lyric-pron {
        color: rgba(255, 236, 205, 0.55);
        font-size: var(--font-pron);
    }
    .lyric-item.active .lyric-pron {
        color: var(--color-active-pron);
        text-shadow: 0 0 calc(24px * var(--glow-intensity)) var(--color-active-pron);
    }

    /* YouTube 자막 디버그 패널 */
    .caption-debug-panel {
        display: none;
        position: fixed;
        top: 76px;
        right: 16px;
        bottom: 16px;
        width: 340px;
        z-index: 20;
        flex-direction: column;
        gap: 8px;
        padding: 12px;
        border-radius: 16px;
        background: rgba(12, 12, 16, 0.82);
        border: 1px solid var(--glass-border);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        font-size: 12px;
        color: var(--text-sub);
    }
    body.caption-debug-on .caption-debug-panel { display: flex; }
    body.caption-debug-on .viewport { padding-right: 372px; }
    .caption-debug-header { display: flex; justify-content: space-between; align-items: center; }
    .caption-debug-title { font-size: 13px; font-weight: 700; color: var(--text-main); }
    .caption-debug-meta { display: flex; flex-direction: column; gap: 3px; line-height: 1.45; }
    .caption-debug-video { color: var(--accent); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
    .caption-debug-ok { color: #6ee7a8; font-weight: 600; }
    .caption-debug-bad { color: #ffb703; font-weight: 600; }
    .caption-debug-empty { color: var(--text-dim); line-height: 1.5; }
    .caption-debug-list {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        gap: 2px;
        position: relative;
    }
    .caption-debug-row {
        display: grid;
        grid-template-columns: 52px 1fr;
        gap: 8px;
        padding: 5px 6px;
        border-radius: 8px;
        cursor: pointer;
        line-height: 1.4;
    }
    .caption-debug-row:hover { background: rgba(255, 255, 255, 0.06); }
    .caption-debug-row.active { background: rgba(165, 192, 238, 0.18); color: var(--text-main); }
    .caption-debug-row.noise { opacity: 0.45; }
    .caption-debug-row.dense { background: rgba(255, 183, 3, 0.1); }
    .caption-debug-row.dense.active { background: rgba(255, 183, 3, 0.25); }
    .caption-debug-time { font-family: ui-monospace, Consolas, monospace; font-size: 11px; color: var(--accent); }
    .caption-debug-time span { color: var(--text-dim); }
    .caption-debug-text { overflow-wrap: anywhere; }
    .caption-debug-text em { font-style: normal; font-size: 10.5px; color: #ffb703; }
    .lyric-debug-time {
        font-family: ui-monospace, Consolas, monospace;
        font-size: 12px;
        font-weight: 600;
        color: var(--accent);
        opacity: 0.85;
    }

    @media (max-width: 900px) {
        .caption-debug-panel { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; height: 38vh; }
        body.caption-debug-on .viewport { padding-right: 16px; padding-bottom: calc(38vh + 16px); }
    }
