/* Controls compartits amb Música; accent ambre propi de Segueix YouTubers. */
:root {
    /* Paleta */
    --pt-bg: #141615; /* carbó */
    --pt-surface: #202421; /* superfícies secundàries */
    --pt-surface-2: #2a2f2b;
    --pt-surface-3: #353b36;
    --pt-text: #f4f0e8; /* blanc trencat */
    --pt-muted: #b9b5ac; /* text secundari (contrast ≥ 7:1 sobre el carbó) */
    --pt-accent: #ffcf96; /* ambre suau */
    --pt-on-accent: #141615; /* text sobre ambre */
    --pt-terracotta: #d98a70; /* detalls secundaris */
    --pt-line: rgba(244, 240, 232, 0.14);

    /* Cantonades: entre 12 i 16 px */
    --pt-radius-sm: 12px;
    --pt-radius: 14px;
    --pt-radius-lg: 16px;
    --pt-radius-pill: 999px; /* xips de categoria i botons amb text (forma de càpsula) */

    --pt-display: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
    --color-surface: var(--pt-surface);
    --color-surface-border: #363c37;
    --color-surface-button: var(--pt-surface);
    --color-text-secondary: var(--pt-muted);
}

.follow-tab {
    min-height: 44px;
    border-radius: var(--pt-radius-sm);
}

.follow-tab.is-active {
    background: var(--pt-accent);
    border-color: var(--pt-accent);
    color: var(--pt-on-accent);
}

.follow-subtitle {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    color: var(--pt-muted);
    font-size: 0.9375rem;
    font-weight: 500;
}

/* Seguir un artista: el botó principal és ambre, ja no vermell */
body .follow-channel-btn,
body .follow-toggle-btn,
body .follow-btn-pill,
body .channel-actions-inline .follow-btn-pill {
    min-height: 44px;
    height: auto;
    padding: 10px 18px;
    border: 1px solid var(--pt-accent);
    border-radius: var(--pt-radius-sm);
    background: var(--pt-accent);
    color: var(--pt-on-accent);
    font-size: 0.875rem;
    font-weight: 800;
}

body .follow-channel-btn:hover,
body .follow-toggle-btn:hover,
body .follow-btn-pill:hover,
body .channel-actions-inline .follow-btn-pill:hover {
    border-color: #ffdfb8;
    background: #ffdfb8;
    color: var(--pt-on-accent);
}

body .follow-channel-btn.is-followed,
body .follow-toggle-btn.is-followed,
body .follow-btn-pill.is-followed {
    border-color: rgba(244, 240, 232, 0.4);
    background: transparent;
    color: var(--pt-text);
}

body .follow-channel-btn.is-followed:hover,
body .follow-toggle-btn.is-followed:hover,
body .follow-btn-pill.is-followed:hover {
    border-color: var(--pt-text);
    background: var(--pt-surface);
    color: var(--pt-text);
}

#channelPage .channel-profile-follow-btn {
    min-height: 44px;
    padding: 0 22px;
}

body :is(.follow-channel-btn, .follow-toggle-btn, .follow-btn-pill):focus-visible {
    outline: 2px solid var(--pt-accent);
    outline-offset: 3px;
}

/* ---------- Índex alfabètic de la pàgina d'youtubers (js/features/alphabet-index.js) ---------- */
/* Columna de lletres enganxada a la dreta: tocar-la o arrossegar-hi el dit porta a la lletra. La lletra dels youtubers
   que es veuen (o la que hi ha sota el dit) es fa gran, i les veïnes una mica (--az-scale, que posa el JS). */
.az-index {
    position: fixed;
    top: calc(var(--header-height, 64px) + 8px);
    right: calc(2px + var(--safe-right, 0px));
    bottom: calc(var(--pt-nav-h, 60px) + 8px + env(safe-area-inset-bottom, 0px));
    z-index: 40;
    display: flex;
    align-items: center;
    width: 30px;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

.az-index[hidden],
body:has(#followPage.hidden) .az-index,
body:not(:has(#followPage)) .az-index {
    display: none;
}

.az-index__letters {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-height: 660px;
    margin: 0;
    padding: 4px 0;
    list-style: none;
}

.az-index__letters li {
    display: flex;
    flex: 1 1 0;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

.az-index__letter {
    width: 30px;
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--pt-muted);
    font: 700 11px/1 system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    cursor: pointer;
    transform: translateX(calc((var(--az-scale, 1) - 1) * -12px)) scale(var(--az-scale, 1));
    transform-origin: right center;
    transition:
        transform 0.14s ease,
        color 0.14s ease;
}

.az-index__letter.is-active {
    color: var(--pt-accent);
}

.az-index__letter.is-empty {
    opacity: 0.3;
    cursor: default;
}

.az-index__letter:focus-visible {
    outline: 2px solid var(--pt-accent);
    outline-offset: 1px;
    border-radius: 8px;
}

/* Lletra gran mentre s'arrossega el dit per la columna */
.az-index__bubble {
    position: fixed;
    top: 50%;
    left: 50%;
    display: grid;
    place-items: center;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: var(--pt-accent);
    color: var(--pt-on-accent);
    font: 800 2.5rem/1 var(--pt-display);
    transform: translate(-50%, -50%);
    pointer-events: none;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.az-index__bubble[hidden] {
    display: none;
}

/* La llista deixa lloc a la columna de lletres */
.follow-grid.has-az-index {
    padding-right: 30px;
}

@media (min-width: 769px) {
    .az-index {
        bottom: 16px;
        right: calc(8px + var(--safe-right, 0px));
    }

    .follow-grid.has-az-index {
        padding-right: 40px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .az-index__letter {
        transition: none;
    }
}



/* ---------- Canals de YouTube: suggeriment ----------
   Franja integrada a la capçalera de la pàgina: icona en un disc ambre, text i crida. Deixa lloc a la columna de
   lletres (.az-index) com la graella (.follow-grid.has-az-index). Els selectors porten #followPage perquè guanyin a
   les regles antigues de #suggestChannelBtn i .follow-subtitle de styles.css. */
#followPage .page-title {
    margin-bottom: 6px;
}

#followPage .follow-subtitle {
    display: block;
    margin: 0 30px 18px 0;
    padding: 0;
    background: none;
}

#followPage .follow-suggest {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 0 30px 20px 0;
    padding: 14px 14px 14px 16px;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--pt-accent) 24%, var(--pt-line));
    border-radius: var(--pt-radius);
    background:
        radial-gradient(120% 160% at 0% 50%, color-mix(in srgb, var(--pt-accent) 13%, transparent) 0%, transparent 55%),
        var(--pt-surface);
}

#followPage .follow-suggest__icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--pt-accent) 16%, transparent);
    color: var(--pt-accent);
}

#followPage .follow-suggest__icon svg {
    width: 24px;
    height: 24px;
}

#followPage .follow-suggest__copy {
    flex: 1 1 auto;
    min-width: 0;
}

#followPage .follow-suggest__copy h2 {
    margin: 0;
    color: var(--pt-text);
    font-family: var(--pt-display);
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.2;
}

#followPage .follow-suggest__copy p {
    margin: 4px 0 0;
    color: var(--pt-muted);
    font-size: 0.9rem;
    line-height: 1.4;
}

#followPage #suggestChannelBtn.follow-suggest__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: none;
    min-height: 44px;
    margin: 0;
    padding: 10px 18px 10px 14px;
    border: 0;
    border-radius: var(--pt-radius-pill);
    background: var(--pt-accent);
    color: var(--pt-on-accent);
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.15s ease;
}

#followPage #suggestChannelBtn.follow-suggest__button svg {
    width: 20px;
    height: 20px;
    flex: none;
}

#followPage #suggestChannelBtn.follow-suggest__button:hover {
    filter: brightness(1.06);
}

#followPage #suggestChannelBtn.follow-suggest__button:active {
    transform: scale(0.98);
}

#followPage #suggestChannelBtn.follow-suggest__button:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--pt-accent) 45%, transparent);
    outline-offset: 3px;
}

@media (min-width: 769px) {
    #followPage .follow-suggest {
        margin-right: 40px;
        padding: 16px 16px 16px 18px;
    }
}

@media (max-width: 600px) {
    #followPage .follow-suggest {
        flex-wrap: wrap;
        gap: 12px 14px;
        padding: 14px;
    }

    #followPage .follow-suggest__icon {
        width: 42px;
        height: 42px;
    }

    #followPage .follow-suggest__copy {
        flex-basis: calc(100% - 56px);
    }

    #followPage #suggestChannelBtn.follow-suggest__button {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    #followPage #suggestChannelBtn.follow-suggest__button {
        transition: none;
    }
}


/* ---------- Botons d'icona unificats: ràdio (+, barreja, desa, comparteix) i sota el reproductor ----------
   Mateixa forma (rodons de 44 px; els que porten text, en càpsula com els xips de categoria), mateix fons, vora i
   color, i el ambre en passar-hi per sobre. El color dels botons ja no es tria a la configuració (només el fons). */
body .mq .mq-add-style,
body .mq .mq-shuffle,
body .mq .mq-save-list,
body .mq .mq-share,
body .video-info-modern .btn-round-icon,
body .video-info-modern .btn-heart {
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--pt-line);
    border-radius: 50%;
    background: var(--pt-surface-2);
    color: var(--pt-text);
    cursor: pointer;
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease;
}

/* Els de la ràdio són graelles; els de sota el reproductor mantenen el seu «display» (el de comentar canvia entre
   escriptori i mòbil) */
body .mq .mq-add-style,
body .mq .mq-shuffle,
body .mq .mq-save-list,
body .mq .mq-share {
    display: inline-grid;
    place-items: center;
}

body .mq .mq-add-style svg,
body .mq .mq-shuffle svg,
body .mq .mq-save-list svg,
body .mq .mq-share svg,
body .video-info-modern .btn-round-icon svg,
body .video-info-modern .btn-heart svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

body .mq .mq-add-style:hover,
body .mq .mq-add-style:focus-visible,
body .mq .mq-add-style[aria-expanded='true'],
body .mq .mq-shuffle:hover,
body .mq .mq-shuffle:focus-visible,
body .mq .mq-save-list:hover,
body .mq .mq-save-list:focus-visible,
body .mq .mq-share:hover,
body .mq .mq-share:focus-visible,
body .video-info-modern .btn-round-icon:hover,
body .video-info-modern .btn-round-icon:focus-visible,
body .video-info-modern .btn-heart:hover,
body .video-info-modern .btn-heart:focus-visible {
    border-color: var(--pt-accent);
    background: var(--pt-surface-3);
    color: var(--pt-accent);
}

/* Estats «actius» en ambre: ràdio desada com a llista, m'agrada */
body .mq .mq-save-list.is-saved,
body .video-info-modern .btn-heart.is-liked,
body .video-info-modern .btn-heart.liked {
    border-color: var(--pt-accent);
    color: var(--pt-accent);
}

body .video-info-modern .btn-heart.is-liked svg,
body .video-info-modern .btn-heart.liked svg {
    fill: var(--pt-accent);
    stroke: var(--pt-accent);
}

/* «Canal YouTube» i «Obre a YouTube»: el mateix botó amb text */
body .video-info-modern .btn-pill-red,
body .mq .mq-open-ytm {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    height: 44px;
    padding: 0 18px;
    border: 1px solid var(--pt-line);
    border-radius: var(--pt-radius-pill);
    background: var(--pt-surface-2);
    color: var(--pt-text);
    font-size: 0.875rem;
    font-weight: 700;
}

body .video-info-modern .btn-pill-red:hover,
body .video-info-modern .btn-pill-red:focus-visible,
body .mq .mq-open-ytm:hover,
body .mq .mq-open-ytm:focus-visible {
    border-color: var(--pt-accent);
    background: var(--pt-surface-3);
    color: var(--pt-accent);
}

/* styles.css els pinta pel seu id (#playlistBtn, #shareBtn, #miniPlayerToggle) i #watchPage .btn-pill-red: mateix estil */
body .video-info-modern :is(#playlistBtn, #shareBtn, #miniPlayerToggle),
body #watchPage .video-info-modern .btn-pill-red {
    border: 1px solid var(--pt-line);
    background: var(--pt-surface-2);
    color: var(--pt-text);
}

body .video-info-modern :is(#playlistBtn, #shareBtn, #miniPlayerToggle):is(:hover, :focus-visible),
body #watchPage .video-info-modern .btn-pill-red:is(:hover, :focus-visible) {
    border-color: var(--pt-accent);
    background: var(--pt-surface-3);
    color: var(--pt-accent);
}

/* styles.css fixa 12 px amb #watchPage :is(.btn-round-icon, .btn-heart): rodons. «Segueix» en càpsula com «Canal YouTube» */
body #watchPage .video-info-modern :is(.btn-round-icon, .btn-heart) {
    border-radius: 50%;
}

body #watchPage .video-info-modern .follow-btn-pill {
    border-radius: var(--pt-radius-pill);
    padding: 0 18px;
}

/* ---------- Capçalera del reproductor: artista + Segueix; cor com a acció de cançó ---------- */
body #watchPage .channel-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-wrap: wrap;
}

body #watchPage .channel-name-row .channel-name-modern {
    min-width: 0;
    margin: 0;
}

body #watchPage .channel-name-row .follow-btn-pill {
    flex: 0 0 auto;
    min-height: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: var(--pt-radius-pill);
    font-size: 0.75rem;
    line-height: 1;
}

@media (max-width: 768px) {
    /* Capçalera compacta: avatar + (nom · Segueix), sense cap acció flotant a la dreta. */
    body #watchPage .channel-header-row {
        align-items: center;
        gap: 10px;
        flex-wrap: nowrap;
        min-height: 44px;
    }

    body #watchPage .channel-identity-modern {
        flex: 1 1 100%;
        min-width: 0;
        gap: 10px;
    }

    body #watchPage .channel-avatar-small {
        width: 42px;
        height: 42px;
        flex: 0 0 42px;
    }

    body #watchPage .channel-text-modern {
        flex: 1 1 auto;
        min-width: 0;
        gap: 2px;
    }

    body #watchPage .channel-actions-inline:empty {
        display: none;
    }

    body #watchPage .channel-name-row {
        width: 100%;
        min-width: 0;
        flex-wrap: nowrap;
        gap: 7px;
    }

    body #watchPage .channel-name-row .channel-name-modern {
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.9rem;
        line-height: 1.2;
    }

    body #watchPage .channel-name-row .follow-btn-pill {
        flex: 0 0 auto;
        min-height: 32px;
        height: 32px;
        padding-inline: 10px;
        font-size: 0.7rem;
        line-height: 1;
    }

    body #watchPage .channel-subs-modern,
    body #watchPage .channel-program-context {
        font-size: 0.68rem;
        line-height: 1.25;
    }

    /* Fila d'accions de cançó: les accions musicals van primer i sempre queden a l'inici visible. */
    body #watchPage .video-metadata-bar {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: 8px;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-padding-inline: 12px;
        overscroll-behavior-inline: contain;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 10px 12px 4px;
        margin-inline: -12px;
        mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 18px), transparent 100%);
        -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 18px), transparent 100%);
    }

    body #watchPage .video-metadata-bar::-webkit-scrollbar {
        display: none;
    }

    body #watchPage .video-metadata-bar .action-group {
        display: contents;
    }

    body #watchPage .video-metadata-bar #playlistBtn {
        order: -90;
    }

    body #watchPage .video-metadata-bar #shareBtn {
        order: -80;
    }

    body #watchPage .video-metadata-bar #miniPlayerToggle {
        order: -70;
    }

    body #watchPage .video-metadata-bar .btn-comment-youtube--mobile {
        order: -60;
    }

    body #watchPage .video-metadata-bar .btn-pill-red {
        order: 10;
    }

    body #watchPage .video-metadata-bar .btn-support-watch--mobile {
        order: 20;
    }

    body #watchPage .video-metadata-bar .btn-round-icon {
        flex-shrink: 0;
    }

    body #watchPage .video-metadata-bar .btn-round-icon {
        width: 44px;
        height: 44px;
    }

    body #watchPage .video-metadata-bar .btn-round-icon svg {
        width: 22px;
        height: 22px;
    }
}


/* ---------- Controls sota el reproductor (#playerExternalControls) ----------
   Anterior · play/pausa · següent · finestra flotant · m'agrada, fora de l'iframe de YouTube (no s'hi posa res al
   damunt). Mateix estil que els botons d'icona de l'app: rodons, superfície 2, vora fina, ambre en passar-hi per
   sobre o en estat actiu; el play/pausa és el botó principal, en ambre. Amb la finestra flotant, app.js els passa a
   <body> amb `.is-docked` (i «tanca» apareix): al mòbil (≤ 768 px), una barra petita ancorada a baix sota la finestra,
   que puja per deixar-hi lloc; a l'escriptori (`.is-floating`), una barra que segueix la finestra (a sota, o a sobre
   amb `.is-above` si no hi cap). Restaurar i tancar no van damunt del vídeo: YouTube no ho permet. */
:root {
    --pec-dock-h: 52px;
}

.player-external-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(10px, 3vw, 18px);
    width: min(960px, 100%);
    margin: 12px auto 16px;
}

.player-external-controls[hidden] {
    display: none;
}

.player-external-btn {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 52px;
    height: 52px;
    padding: 0;
    border: 1px solid var(--pt-line);
    border-radius: 50%;
    background: var(--pt-surface-2);
    color: var(--pt-text);
    box-shadow: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition:
        border-color 0.15s ease,
        background-color 0.15s ease,
        color 0.15s ease,
        transform 0.1s ease;
}

.player-external-btn .pec-icon {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.player-external-btn .pec-fill {
    fill: currentColor;
    stroke: none;
}

.player-external-btn:hover:not(:disabled),
.player-external-btn:focus-visible {
    border-color: var(--pt-accent);
    background: var(--pt-surface-3);
    color: var(--pt-accent);
}

.player-external-btn:active:not(:disabled) {
    transform: scale(0.94);
}

.player-external-btn:focus-visible {
    outline: 2px solid var(--pt-accent);
    outline-offset: 2px;
}

.player-external-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

/* Play/pausa: el principal, en ambre (com «Engega la ràdio») */
.player-external-btn--main {
    width: 64px;
    height: 64px;
    border-color: var(--pt-accent);
    background: var(--pt-accent);
    color: var(--pt-on-accent);
}

.player-external-btn--main .pec-icon {
    width: 28px;
    height: 28px;
}

.player-external-btn--main:hover:not(:disabled),
.player-external-btn--main:focus-visible {
    border-color: #ffdfb8;
    background: #ffdfb8;
    color: var(--pt-on-accent);
}

.player-external-btn--main .pec-icon--pause,
.player-external-btn--main.is-playing .pec-icon--play {
    display: none;
}

.player-external-btn--main.is-playing .pec-icon--pause {
    display: block;
}

/* Finestra flotant: el símbol canvia a «restaura» quan ja és flotant */
.player-external-btn--mini .pec-icon--restore,
.player-external-btn--mini[aria-pressed='true'] .pec-icon--mini {
    display: none;
}

.player-external-btn--mini[aria-pressed='true'] .pec-icon--restore {
    display: block;
}

/* M'agrada: ambre i ple, com el cor de sota el títol */
.player-external-btn--heart[aria-pressed='true'] {
    border-color: var(--pt-accent);
    color: var(--pt-accent);
}

.player-external-btn--heart[aria-pressed='true'] .pec-icon {
    fill: currentColor;
}

/* Barra petita enganxada sota la finestra flotant (mòbil) */
.player-external-controls.is-docked {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--segueix-player-bottom, 0px) + var(--safe-bottom, 0px));
    z-index: 2000; /* la de la finestra flotant */
    width: auto;
    height: var(--pec-dock-h);
    margin: 0;
    padding: 0 calc(12px + var(--safe-right, 0px)) 0 calc(12px + var(--safe-left, 0px));
    gap: 14px;
    border-top: 1px solid var(--pt-line);
    background: var(--pt-surface);
}

.player-external-controls.is-docked .player-external-btn {
    width: 40px;
    height: 40px;
}

.player-external-controls .player-external-btn[hidden] {
    display: none;
}

/* Escriptori: segueix la finestra flotant (app.js hi posa left, top i width) */
.player-external-controls.is-docked.is-floating {
    right: auto;
    bottom: auto;
    gap: 8px;
    padding: 0 8px;
    border: 1px solid var(--pt-line);
    border-top: 0;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Finestra més estreta que la barra (redimensionada): la barra no s'encongeix i va arrodonida per tots costats */
.player-external-controls.is-docked.is-floating.is-wide {
    border-top: 1px solid var(--pt-line);
    border-bottom: 1px solid var(--pt-line);
    border-radius: 12px;
}

body:has(#playerExternalControls.is-floating:not(.is-above):not([hidden])) #videoPlayer.mini-player-active {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

body:has(#playerExternalControls.is-floating.is-above:not([hidden])) #videoPlayer.mini-player-active {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.player-external-controls.is-docked.is-floating.is-above {
    border-top: 1px solid var(--pt-line);
    border-bottom: 0;
    border-radius: 12px 12px 0 0;
}

.player-external-controls.is-docked .player-external-btn .pec-icon {
    width: 20px;
    height: 20px;
}

.player-external-controls.is-docked .player-external-btn--main {
    width: 44px;
    height: 44px;
}

.player-external-controls.is-docked .player-external-btn--main .pec-icon {
    width: 22px;
    height: 22px;
}

@media (max-width: 768px) {
    body:has(#playerExternalControls.is-docked:not([hidden])) #videoPlayer.mini-player-active {
        bottom: calc(var(--segueix-player-bottom, 0px) + var(--safe-bottom) + var(--pec-dock-h)) !important;
    }

    body:has(#playerExternalControls.is-docked:not([hidden])):has(#videoPlayer.mini-player-active) {
        padding-bottom: calc(var(--segueix-player-bottom, 0px) + var(--safe-bottom) + max(200px, 56.25vw) + var(--pec-dock-h));
    }

    body:has(#playerExternalControls.is-docked:not([hidden])):has(#videoPlayer.mini-player-active) .pt-toast {
        bottom: calc(var(--segueix-player-bottom, 0px) + var(--safe-bottom) + max(200px, 56.25vw) + var(--pec-dock-h) + 12px);
    }
}


@media (min-width: 769px) {
    body #videoPlayer.mini-player-active {
        box-sizing: content-box;
        width: 360px;
        min-width: 356px;
        min-height: 200px;
        padding-top: 36px;
        aspect-ratio: auto;
        background: var(--pt-surface-2);
    }

    /* height: auto perquè mani inset (amb height: 100% el vídeo baixava 36 px i els controls de YouTube quedaven
       tallats per sota) */
    body #videoPlayer.mini-player-active .video-embed-wrap {
        inset: 36px 0 0 0 !important;
        height: auto !important;
    }

    body #videoPlayer.mini-player-active .drag-handle-container {
        inset: 0 0 auto 0;
        height: 36px;
    }

    body #videoPlayer.mini-player-active .drag-surface {
        display: grid;
        place-items: center;
    }

    body #videoPlayer.mini-player-active .drag-surface::before {
        content: '';
        width: 40px;
        height: 4px;
        border-radius: var(--pt-radius-pill);
        background: var(--pt-muted);
    }

    body #videoPlayer.mini-player-active .drag-surface:active {
        cursor: grabbing;
    }

    body #videoPlayer.mini-player-active .mini-player-resize-handle {
        top: 0;
        right: 0;
        bottom: auto;
        width: 36px;
        height: 36px;
        z-index: 2002;
        cursor: ew-resize;
    }

    body #videoPlayer.mini-player-active .mini-player-resize-handle::after {
        top: 50%;
        right: 50%;
        bottom: auto;
        width: 10px;
        height: 10px;
        border-style: solid;
        border-width: 2px 2px 0 0;
        border-color: var(--pt-muted);
        transform: translate(50%, -50%);
    }

    body #videoPlayer.mini-player-active .mini-player-resize-handle:hover::after {
        border-color: var(--pt-accent);
    }
}

@media (max-width: 768px) {
    /* content-box: la vora de dalt (1 px) no es menja l'alçada del vídeo */
    body #videoPlayer.mini-player-active {
        box-sizing: content-box;
        height: max(200px, 56.25vw) !important;
        aspect-ratio: auto !important;
    }
}

/* Mateix contorn i separació que Música, limitats als reproductors. */
:root { --pt-icon-border: var(--pt-accent); }
body #watchPage .video-info-modern { padding-top: 10px; }
body #watchPage .video-info-modern .video-metadata-bar { border-top: 0; }
body .player-external-btn,
body #watchPage .video-info-modern :is(.btn-round-icon, .btn-heart, .btn-pill-red, #playlistBtn, #shareBtn, #miniPlayerToggle) {
    border: 1.5px solid var(--pt-icon-border);
}
/* La barra exterior substitueix els controls superposats, sense recrear l'iframe. */
body #videoPlayer .mini-player-controls-overlay { display: none !important; }
body #watchPage #likeToggle, body #watchPage #miniPlayerToggle { display: none; }
@media (max-width: 768px) {
    body #videoPlayer.mini-player-active .drag-handle-container { display: none; }
    .player-external-controls { gap: clamp(6px, 2vw, 14px); }
    .player-external-controls.is-docked { gap: clamp(4px, 2vw, 14px); }
}
@media (prefers-reduced-motion: reduce) {
    .player-external-btn { transition: none; }
}

/* ---------- Contacte (#contactModal, la icona @ de la capçalera). Les fonts d'indexació i l'ajuda del @ surten ara
   dins la franja «Hi falta algú?» d'Artistes i grups (el formulari s'obre directament) ---------- */
#contactModal .pt-contact {
    background: var(--pt-surface);
    border: 1px solid var(--pt-line);
    border-radius: var(--pt-radius-lg);
    max-width: 460px;
}

#contactModal .pt-contact .modal-header {
    border-bottom: 1px solid var(--pt-line);
}

#contactModal .pt-contact .modal-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.pt-contact__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex: none;
    border-radius: var(--pt-radius-sm);
    background: var(--pt-accent);
    color: var(--pt-on-accent);
}

#contactModal .pt-contact__badge svg {
    width: 22px;
    height: 22px;
    color: inherit;
}

#contactModal .pt-contact .modal-title {
    font-family: var(--pt-display);
    font-size: 1.25rem;
    color: var(--pt-text);
}

.pt-contact__sources {
    border: 1px solid var(--pt-line);
    border-radius: var(--pt-radius-sm);
    background: var(--pt-surface-2);
    color: var(--pt-muted);
    font-size: 0.88rem;
}

.pt-contact__sources summary {
    cursor: pointer;
    padding: 12px 14px;
    min-height: 44px;
    display: flex;
    align-items: center;
    color: var(--pt-text);
    font-weight: 600;
}

.pt-contact__sources[open] summary {
    border-bottom: 1px solid var(--pt-line);
}

.pt-contact__sources > .pt-contact__text,
.pt-contact__chips {
    margin: 12px 14px 0;
}

.pt-contact__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.pt-contact__chips a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid var(--pt-line);
    border-radius: var(--pt-radius-sm);
    color: var(--pt-accent);
    font-weight: 600;
    text-decoration: none;
}

.pt-contact__chips a:hover {
    background: var(--pt-surface-3);
}

.pt-contact__card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    border: 1px solid var(--pt-line);
    border-radius: var(--pt-radius);
    background: var(--pt-surface-2);
}

.pt-contact__title {
    margin: 0;
    font-family: var(--pt-display);
    font-size: 1.1rem;
    color: var(--pt-text);
}

.pt-contact__text {
    margin: 0;
    color: var(--pt-muted);
    font-size: 0.92rem;
    line-height: 1.45;
}

.pt-contact__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pt-contact__row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 8px 12px;
    border: 1px solid var(--pt-line);
    border-radius: var(--pt-radius-sm);
    background: var(--pt-surface);
    color: var(--pt-text);
    text-decoration: none;
    transition:
        background 0.2s ease,
        border-color 0.2s ease;
}

.pt-contact__row:hover,
.pt-contact__row:focus-visible {
    background: var(--pt-surface-3);
    border-color: var(--pt-accent);
}

.pt-contact__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: none;
    border-radius: var(--pt-radius-sm);
    background: var(--pt-surface-3);
    color: var(--pt-accent);
}

.pt-contact__icon--telegram {
    background: #229ed9;
    color: #ffffff;
}

.pt-contact__icon svg {
    width: 22px;
    height: 22px;
}

.pt-contact__label {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.pt-contact__label strong {
    font-size: 0.98rem;
}

.pt-contact__label small {
    color: var(--pt-muted);
    font-size: 0.82rem;
    overflow-wrap: anywhere;
}

#contactModal .about-telegram-btn {
    min-width: 0;
    min-height: 40px;
    padding: 8px 14px;
    border: 1px solid var(--pt-line);
    background: transparent;
    color: var(--pt-muted);
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--pt-radius-sm);
}

#contactModal .about-telegram-btn:hover {
    background: var(--pt-surface-3);
    color: var(--pt-text);
    transform: none;
}

#contactModal .project-credit-line {
    font-family: var(--pt-display);
}

.pt-contact__sources summary {
    justify-content: space-between;
    gap: 12px;
    list-style: none;
}

.pt-contact__sources summary::-webkit-details-marker {
    display: none;
}

.pt-contact__sources summary::after {
    content: '';
    flex: none;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--pt-muted);
    border-bottom: 2px solid var(--pt-muted);
    transform: rotate(45deg);
    transition: transform 0.2s ease;
}

.pt-contact__sources[open] summary::after {
    transform: rotate(-135deg);
}


/* Contacte i configuració: accessos de capçalera com a Música. */
body .app-header .actions :is(#contactBtn, #backgroundBtn) {
    border: 0;
    background: transparent;
    box-shadow: none;
}

/* TV d'escriptori: deixa aire als controls en finestres de poca alçada.
   El reproductor segueix aquest contenidor amb el ResizeObserver existent. */
@media (min-width: 1025px) {
    body.segueix-tv-playback:not(:has(:fullscreen)) #watchPage .watch-main {
        width: 100%;
        max-width: min(880px, calc((100dvh - 280px) * 16 / 9));
        margin-inline: auto;
    }
}

/* Botons secundaris: carbó i vora ambre, com els controls de Música. */
body :is(.btn-round-icon, .context-tv-btn, .config-sync-btn, .font-size-btn,
    .playlist-create-btn, .category-create-btn, .hero-button, .channel-back-btn,
    .search-btn, .mobile-search-toggle, .follow-tab, .library-tab,
    .history-filter, .grid-layout-btn, .watch-grid-btn, .modal-close,
    .playlist-modal-close, .short-action-btn, .about-telegram-btn) {
    background: var(--pt-surface);
    color: var(--pt-accent);
    border: 1px solid var(--pt-accent);
    border-radius: var(--pt-radius-sm);
}
body :is(.playlist-create-btn, .category-create-btn, .hero-button,
    .follow-tab.is-active, .library-tab.is-active) {
    background: var(--pt-accent);
    color: var(--pt-on-accent);
}
body :is(.player-external-btn, .btn-round-icon, .context-tv-btn) {
    border-color: var(--pt-accent);
    color: var(--pt-accent);
}
body .player-external-btn--main { color: var(--pt-on-accent); }
body .context-tv-btn[data-context-tv='category']:not(.is-loading) {
    animation: none;
    box-shadow: 0 0 8px rgb(255 207 150 / 18%);
}
body :is(button, [role='button']):focus-visible {
    outline: 3px solid var(--pt-accent);
    outline-offset: 3px;
}
@media (hover: hover) {
    body :is(.btn-round-icon, .context-tv-btn, .config-sync-btn, .font-size-btn,
        .playlist-create-btn, .category-create-btn, .hero-button, .channel-back-btn,
        .search-btn, .mobile-search-toggle, .follow-tab, .library-tab,
        .history-filter, .grid-layout-btn, .watch-grid-btn, .modal-close,
        .playlist-modal-close, .short-action-btn, .about-telegram-btn):hover:not(:disabled) {
        background: var(--pt-accent);
        color: var(--pt-on-accent);
        border-color: var(--pt-accent);
    }
}
body .app-header .icon-btn { color: var(--pt-accent); }
body .app-header .icon-btn:hover { background: var(--pt-surface-2); }
body :is(button, [role='button']):disabled {
    opacity: .35;
    cursor: not-allowed;
}

body .playlist-queue-move {
    min-width: 30px; min-height: 34px; border: 1px solid var(--pt-accent);
    border-radius: 8px; background: var(--pt-surface); color: var(--pt-accent);
    font-size: 18px; cursor: pointer;
}
body .playlist-queue-actions { display: flex; gap: 4px; flex-wrap: wrap; }
body .playlist-queue-move:hover:not(:disabled) { background: var(--pt-accent); color: var(--pt-on-accent); }

/* Navegació immediata: accent de marca, sense flaixos blancs ni animació de càrrega. */
body .app-header .nav-trigger {
    color: var(--pt-accent);
    background: transparent;
    touch-action: manipulation;
    transition: background-color 120ms ease, color 120ms ease, transform 100ms ease;
    -webkit-tap-highlight-color: transparent;
}
body .app-header .nav-trigger.active,
body .app-header .nav-trigger.active:hover {
    color: var(--pt-accent);
    background: rgb(255 207 150 / 14%);
    box-shadow: inset 0 -2px var(--pt-accent);
}
body .app-header .nav-trigger :is(svg, i) { color: inherit; stroke: currentColor; }
body .app-header .nav-trigger:active { transform: scale(.94); }
@media (prefers-reduced-motion: reduce) {
    body .app-header .nav-trigger { transition: none; transform: none; }
}
