/* Personal Library v1: additive, scoped UI. No queue/player CSS replacement. */
#personal-library-root[hidden], #personal-library-toast[hidden] { display:none !important; }
#personal-library-root { position:fixed; inset:0; z-index:30000; display:grid; place-items:center; padding:18px; box-sizing:border-box; font-family:inherit; color:#e2f1f7; }
#personal-library-root .pl-backdrop { position:absolute; inset:0; background:rgba(1,6,17,.76); backdrop-filter:blur(8px); }
#personal-library-panel { position:relative; display:flex; flex-direction:column; min-height:0; width:min(760px,100%); max-height:88vh; max-height:88dvh; border:1px solid rgba(97,217,219,.35); border-radius:18px; overflow:hidden; background:linear-gradient(145deg,#0d2032,#0b1226); box-shadow:0 24px 90px rgba(0,0,0,.6); text-align:left; }
#personal-library-panel:focus { outline:none; }
#personal-library-panel .pl-header { flex:0 0 auto; padding:1rem 1.1rem .8rem; border-bottom:1px solid rgba(123,185,215,.16); background:rgba(21,46,65,.7); }
#personal-library-panel .pl-heading { display:flex; align-items:center; justify-content:space-between; gap:.8rem; }
#personal-library-panel .pl-kicker { margin:0 0 .2rem; color:#8acbd5; font-size:.62rem; letter-spacing:.14em; }
#personal-library-panel h2 { margin:0; font-size:1.25rem; color:#e7f8fc; }
#personal-library-panel .pl-header-actions, #personal-library-panel .pl-tabs { display:flex; align-items:center; gap:.45rem; flex-wrap:wrap; }
#personal-library-panel .pl-tabs { margin-top:.85rem; }
#personal-library-panel .pl-tabs button[aria-pressed="true"] { border-color:#56e3d2; color:#91f5e3; background:rgba(32,129,132,.25); }
#personal-library-status { min-height:2.8em; box-sizing:border-box; margin:.7rem 0 0; padding:.45rem .6rem; border-left:2px solid #5ac8c1; border-radius:7px; color:#b8e9e3; background:rgba(29,85,94,.22); font-size:.77rem; line-height:1.4; overflow-wrap:anywhere; }
#personal-library-status[data-kind="error"] { color:#ffc6d2; border-color:#e599b0; background:rgba(112,33,61,.2); }
#personal-library-content { min-height:0; flex:1 1 auto; overflow-y:auto; overscroll-behavior:contain; padding:.9rem 1rem 1.1rem; scrollbar-gutter:stable; }
#personal-library-panel .pl-footer { padding:.65rem 1rem; border-top:1px solid rgba(123,185,215,.14); color:#9bb7c9; font-size:.69rem; line-height:1.5; }
.pl-button { appearance:none; display:inline-flex; align-items:center; justify-content:center; min-height:38px; min-width:38px; padding:.4rem .65rem; border:1px solid rgba(131,181,214,.3); border-radius:9px; background:#172b43; color:#dceef8; font:inherit; font-size:.76rem; line-height:1.2; cursor:pointer; touch-action:manipulation; }
.pl-button:hover:not(:disabled) { background:#20515e; border-color:#72d9d4; }
.pl-button:disabled { opacity:.38; cursor:default; }
.pl-button:focus-visible, #personal-library-panel input:focus-visible { outline:2px solid #7befe1; outline-offset:2px; }
#personal-library-panel .pl-primary { background:#39d7c0; color:#052a33; border-color:#6cebd8; font-weight:650; }
#personal-library-panel .pl-danger { color:#f2b4c7; border-color:rgba(221,135,164,.4); }
#personal-library-panel .pl-tools { display:flex; flex-wrap:wrap; gap:.45rem; margin:.6rem 0 .9rem; }
#personal-library-panel .pl-section-title { margin:.1rem 0 .6rem; color:#c4f4f0; font-size:1rem; overflow-wrap:anywhere; }
#personal-library-panel .pl-empty { margin:.5rem 0; padding:1rem .4rem; color:#a9c2d0; font-size:.84rem; line-height:1.65; }
#personal-library-panel .pl-playlist-card { display:flex; justify-content:space-between; width:100%; margin:.45rem 0; padding:.85rem; text-align:left; overflow-wrap:anywhere; }
#personal-library-panel .pl-name-form { display:flex; align-items:flex-end; flex-wrap:wrap; gap:.5rem; margin:.8rem 0 1rem; padding:.8rem; border:1px solid rgba(133,153,218,.28); border-radius:11px; background:rgba(30,36,65,.5); }
#personal-library-panel .pl-form-label { flex:1 1 200px; display:flex; flex-direction:column; gap:.4rem; color:#b8d5e1; font-size:.76rem; }
#personal-library-panel .pl-name-input { box-sizing:border-box; min-height:40px; width:100%; padding:.55rem .65rem; border-radius:8px; border:1px solid #435d7b; background:#08182a; color:#e4f4fa; font:inherit; }
#personal-library-panel .pl-confirm { padding:.8rem; margin:.7rem 0; background:rgba(104,35,60,.22); border:1px solid rgba(230,135,164,.3); border-radius:10px; }
#personal-library-panel .pl-confirm p { margin:0 0 .65rem; font-size:.83rem; line-height:1.5; }
#personal-library-panel .pl-confirm .pl-button { margin-right:.4rem; }
#personal-library-panel .pl-track { display:grid; grid-template-columns:44px minmax(0,1fr) 40px; gap:.55rem .65rem; align-items:center; margin:.45rem 0; padding:.7rem; border-radius:12px; border:1px solid rgba(128,165,197,.13); background:rgba(17,34,53,.75); }
#personal-library-panel .pl-track.is-current { border-color:rgba(70,229,204,.5); background:rgba(18,91,100,.27); }
#personal-library-panel .pl-track-cover { width:44px; height:44px; display:flex; align-items:center; justify-content:center; background:#1e3650; color:#99e5e5; border-radius:8px; overflow:hidden; }
#personal-library-panel .pl-track-cover img { width:100%; height:100%; object-fit:cover; }
#personal-library-panel .pl-track-details { min-width:0; display:flex; flex-direction:column; gap:.25rem; }
#personal-library-panel .pl-track-details strong { overflow:hidden; white-space:nowrap; text-overflow:ellipsis; font-size:.86rem; }
#personal-library-panel .pl-track-details small { color:#a9c1d1; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; font-size:.72rem; }
#personal-library-panel .pl-track-actions { grid-column:2 / -1; display:flex; flex-wrap:wrap; justify-content:flex-end; gap:.35rem; }
.pl-heart { font-size:1.2rem; }
.pl-heart.is-favorite, #queue-panel .pl-heart.is-favorite { color:#ffadc9; border-color:rgba(245,135,178,.6); background:rgba(104,38,69,.45); }
#personal-library-count { font-size:.65rem; padding:.1rem .3rem; border-radius:5px; background:rgba(111,222,218,.15); }
#personal-library-toast { position:fixed; z-index:31000; left:50%; top:max(16px,env(safe-area-inset-top)); transform:translateX(-50%); box-sizing:border-box; width:max-content; max-width:calc(100vw - 32px); padding:.7rem 1rem; border:1px solid #4faeae; border-radius:11px; box-shadow:0 8px 30px rgba(0,0,0,.4); color:#d5fff4; background:#10333d; font:inherit; font-size:.8rem; line-height:1.5; pointer-events:none; }
#personal-library-toast[data-kind="error"] { color:#ffd2df; background:#502239; border-color:#c2839a; }
@media (max-width:600px) {
 #personal-library-root { padding:8px; }
 #personal-library-panel { width:100%; max-height:94vh; max-height:94dvh; border-radius:13px; }
 #personal-library-panel .pl-header { padding:.75rem; }
 #personal-library-content { padding:.65rem; }
 #personal-library-panel .pl-button { min-height:44px; min-width:44px; }
 #personal-library-panel .pl-track { grid-template-columns:38px minmax(0,1fr) 44px; padding:.55rem; gap:.45rem; }
 #personal-library-panel .pl-track-cover { width:38px; height:38px; }
 #personal-library-panel .pl-track-actions { grid-column:1 / -1; }
 #personal-library-panel h2 { font-size:1.1rem; }
}
@media (max-height:480px) {
 #personal-library-panel { max-height:96vh; max-height:96dvh; }
 #personal-library-panel .pl-kicker, #personal-library-panel .pl-footer { display:none; }
 #personal-library-panel .pl-header { padding:.45rem .7rem; }
 #personal-library-panel .pl-tabs { margin-top:.35rem; }
 #personal-library-status { min-height:0; margin-top:.35rem; }
}
@media (prefers-reduced-motion:reduce) { #personal-library-root *, #personal-library-toast { scroll-behavior:auto; transition:none; } }

/* Make room for the three added controls without changing other players. */
#player.has-personal-library .player-actions { flex-wrap:wrap; }
#player.has-personal-library #personal-library-toggle { width:auto; min-width:64px; padding-left:.5rem; padding-right:.5rem; display:inline-flex; align-items:center; justify-content:center; gap:.3rem; font-size:.7rem; }
#player.has-personal-library #personal-library-like, #player.has-personal-library #personal-library-add-current { display:inline-flex; align-items:center; justify-content:center; }
#personal-library-panel .pl-header-actions {
    flex-wrap: wrap;
    gap: .45rem;
}

#personal-library-panel .pl-import-options {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .45rem;
    margin-top: .6rem;
    color: #bdd6e3;
    font-size: .72rem;
}

#personal-library-panel .pl-import-options select {
    min-height: 36px;
    max-width: 100%;
    padding: .35rem .5rem;
    border: 1px solid #476580;
    border-radius: 7px;
    background: #102638;
    color: #e4f3f9;
    font: inherit;
}

#personal-library-import-file[hidden] {
    display: none !important;
}

@media (max-width: 600px) {
    #personal-library-panel .pl-heading {
        flex-wrap: wrap;
    }

    #personal-library-panel .pl-header-actions {
        width: 100%;
    }

    #personal-library-panel .pl-import-options select {
        min-height: 44px;
    }
}