*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top, #252a38 0, #050910 50%, #020308 100%);
    color: #f4f0e7;
    text-shadow: none;
    overflow-x: hidden;
    overflow-y: auto;
}

.app {
    min-height: 100vh;
    height: 100%;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.app-header {
    padding: 0.5rem 1.0rem;
    border-bottom: 2px solid #11151f;
    background: #050910; /* links schwarz */
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.75);
    flex: 0 0 auto;
    position: relative;
    overflow: hidden;
}

/* diagonale VHS-Farbblöcke nur rechts im Header, mit schwarzem Block am Anfang */
.app-header::before {
    content: "";
    position: absolute;
    top: -40%;
    bottom: -40%;
    left: -5%;
    right: -5%;
    background-image: linear-gradient(
        135deg,
        transparent 0 55%,
        #ffcc33 55% 63%,
        #ff9933 63% 71%,
        #ff3360 71% 79%,
        #d620b0 79% 87%,
        #7b3cff 87% 94%,
        #0078ff 94% 100%
    );
    opacity: 0.9;
}

.logo-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 1;
}

.logo {
    height: 50px;
    width: auto;
    filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.8))
            drop-shadow(-1px -1px 0 #000000)
            drop-shadow(2px 2px 0 #000000);
}

.title-wrap h1 {
    font-size: 1.4rem;
    color: #ffcc33;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    text-shadow:
        2px 2px 0 #fe3360,
        -2px -2px 0 #7b3cff;
}

.tagline {
    font-size: 0.7rem;
    color: #7b3cff;
    opacity: 1;
    font-weight: 700;
}

.app-main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    padding: 0.5rem;
    gap: 0.5rem;
    min-height: 0;
    overflow: hidden;
}

.player-panel,
.playlist-panel {
    background: #050911;
    border-radius: 8px;
    padding: 0.5rem;
    border: 1px solid #262c3a;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.9);
}

.player-panel {
    flex: 0 0 auto;
}

.playlist-panel {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    max-width: 350px;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

.playlist-panel::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    right: -20%;
    width: 65%;
    background-image: linear-gradient(
        135deg,
        #ffcc33 0 16.6%,
        #ff9933 16.6% 33.2%,
        #ff3360 33.2% 49.8%,
        #d620b0 49.8% 66.4%,
        #7b3cff 66.4% 83%,
        #0078ff 83% 100%
    );
    opacity: 0.25;
}

.playlist-panel > * {
    position: relative;
    z-index: 1;
}

.playlist-panel {
    scrollbar-width: thin;
    scrollbar-color: #ff9933 #050911;
}

.playlist-panel::-webkit-scrollbar {
    width: 8px;
}

.playlist-panel::-webkit-scrollbar-track {
    background: #050911;
}

.playlist-panel::-webkit-scrollbar-thumb {
    background-image: linear-gradient(
        135deg,
        #ffcc33 0 25%,
        #ff9933 25% 50%,
        #ff3360 50% 75%,
        #7b3cff 75% 100%
    );
    border-radius: 999px;
    box-shadow: 0 0 6px rgba(0,0,0,0.8);
}

.player-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid #303746;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.9);
    background:
        repeating-linear-gradient(
            0deg,
            #0b111f 0,
            #0b111f 3px,
            #0d1322 3px,
            #0d1322 6px
        );
}

#player {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.vhs-noise-overlay {
    position: absolute;
    inset: 0;
    z-index: 8;
    display: grid;
    place-items: center;
    background: #000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.05s ease-out;
}

.vhs-noise-overlay.vhs-active {
    opacity: 0.96;
}

.vhs-static-canvas {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;
}

.volume-osd {
    position: absolute;
    right: 4%;
    bottom: 6%;
    padding: 0.2rem 0.5rem;
    font-family: "Courier New", monospace;
    font-size: 1rem;
    letter-spacing: 0.15em;
    color: #9fff8a;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(0, 255, 180, 0.7);
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.9);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.1s ease-out, transform 0.1s ease-out;
    pointer-events: none;
    z-index: 11;
}

.volume-osd.visible {
    opacity: 1;
    transform: scale(1);
}

.player-meta {
    margin-top: 0.75rem;
    display: none;
}

.current-video-meta {
    font-size: 0.75rem;
    margin-bottom: 0.4rem;
    text-align: center;
    opacity: 0.98;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    background: #f4f0e7;
    border: 1px solid #c7c9cf;
    box-shadow: 0 2px 0 #b0b2b9;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #151926;
    position: relative;
}

.current-video-meta .meta-title {
    font-weight: 700;
}

.current-video-meta .meta-playlist {
    font-size: 0.7rem;
    opacity: 0.85;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-top: 0.1rem;
}

.current-video-meta::after {
    content: "";
    position: absolute;
    left: 10%;
    right: 10%;
    bottom: 3px;
    height: 3px;
    border-radius: 999px;
    background-image: linear-gradient(
        135deg,
        #ffcc33 0 20%,
        #ff9933 20% 40%,
        #ff3360 40% 60%,
        #d620b0 60% 80%,
        #7b3cff 80% 100%
    );
}

.player-fullscreen-meta {
    display: none;
    margin-top: 0.75rem;
    text-align: center;
    opacity: 0.98;
    padding: 0.5rem 0.9rem;
    border-radius: 6px;
    background: #f4f0e7;
    border: 1px solid #c7c9cf;
    box-shadow: 0 2px 0 #b0b2b9;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #151926;
    position: relative;
}

.player-fullscreen-meta::after {
    content: "";
    position: absolute;
    left: 8%;
    right: 8%;
    bottom: 4px;
    height: 4px;
    border-radius: 999px;
    background-image: linear-gradient(
        135deg,
        #ffcc33 0 20%,
        #ff9933 20% 40%,
        #ff3360 40% 60%,
        #d620b0 60% 80%,
        #7b3cff 80% 100%
    );
}

.fs-video-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.fs-playlist-title {
    margin-top: 0.15rem;
    font-size: 0.8rem;
    opacity: 0.85;
    letter-spacing: 0.12em;
}

body.is-fullscreen .player-fullscreen-meta {
    display: block;
}

body.is-fullscreen .current-video-meta {
    display: none;
}

.player-mode-controls {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    align-items: center;
}

.mode-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    opacity: 0.9;
}

.mode-label {
    opacity: 0.9;
}

.toggle-switch {
    position: relative;
    width: 46px;
    height: 24px;
    border-radius: 999px;
    border: 1px solid #c7c9cf;
    background: #151926;
    cursor: pointer;
}

.toggle-knob {
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    left: 0px;
    top: 0px;
    background: #f4f0e7;
    box-shadow: 0 1px 0 #b0b2b9;
}

.toggle-on {
    background-image: linear-gradient(
        135deg,
        #ffcc33 0%,
        #ff3360 100%
    );
}

.toggle-on .toggle-knob {
    transform: translateX(22px);
}

.toggle-off .toggle-knob {
    transform: translateX(0);
}

.zapping-seconds {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    opacity: 0.85;
}

#input-zapping-seconds {
    width: 70px;
    padding: 0.2rem 0.4rem;
    border-radius: 999px;
    border: 1px solid #c7c9cf;
    background: #151926;
    color: #f4f0e7;
    text-align: center;
}

.playlist-controls {
    margin-bottom: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.playlist-controls-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.playlist-controls-row:first-child {
    justify-content: center;
    gap: 0.4rem;
}

.playlist-fullscreen-row {
    justify-content: center;
}

.btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    border-radius: 999px;
    border: 1px solid #c7c9cf;
    background: #151926;
    color: #f4f0e7;
    cursor: pointer;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 0 #0b0f18;
    background: #1f2532;
}

.btn-fullscreen {
    font-size: 0.7rem;
    padding: 0.25rem 1rem;
    border-radius: 999px;
    border: 2px solid #c7c9cf;
    box-shadow: 0 4px 0 #0b0f18;
}

.control-btn {
    font-size: 1.4rem;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    border-width: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.btn-search {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 50%;
    padding: 0;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 0 #0b0f18;
}

#btn-mute {
    position: relative;
    overflow: hidden;
}

#btn-mute.is-muted {
    opacity: 0.8;
}

#btn-mute.is-muted::after {
    content: "";
    position: absolute;
    left: -20%;
    top: 50%;
    width: 140%;
    height: 2px;
    background: #f4f0e7;
    box-shadow: 0 0 4px rgba(0,0,0,0.9);
    transform: rotate(-35deg);
}

#btn-play,
#btn-prev,
#btn-next,
#btn-random,
#btn-mute {
    background-image: none;
}

.neon-btn {
    padding: 0.6rem 1.6rem;
    font-size: 0.9rem;
    border-radius: 999px;
    border: 1px solid #c7c9cf;
    background: #f4f0e7;
    color: #151926;
    box-shadow: 0 3px 0 #b0b2b9;
    text-shadow: none;
}

.neon-btn:hover {
    background: #ffffff;
    box-shadow: 0 4px 0 #a4a6ad;
    transform: translateY(-1px);
}

.panel-heading {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.stats-box {
    margin-top: 0.5rem;
    padding: 0.6rem 0.9rem;
    border-radius: 8px;
    background: #151926;
    border: 1px solid #ffcc33;
    box-shadow: 0 3px 0 #b58624;
    font-size: 0.78rem;
    color: #f4f0e7;
}

.stats-header {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #ffcc33;
    text-shadow: none;
    margin-bottom: 0.3rem;
    border-bottom: 1px solid rgba(255, 204, 51, 0.6);
    padding-bottom: 0.2rem;
}

.stat-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 0;
    opacity: 0.9;
}

.stat-line strong {
    color: #9fff8a;
    text-shadow: none;
}

.playlist-groups {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1 1 auto;
    overflow-y: visible;
}

.playlist-group {
    padding: 0.5rem;
    border-radius: 8px;
    background: #10141f;
    border: 1px solid #303746;
}

.playlist-group-title {
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    opacity: 0.85;
}

.playlist-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.playlist-item {

/* WICHTIG: width auf auto, damit margin greift */
    width: auto; 
    
    /* HIER: Abstand zum Rand erzwingen (links/rechts 0.8rem) */
    /* Die 0.35rem am Ende sind der Abstand nach unten zum nächsten Button */
    margin: 0.15rem 0.3rem 0.15rem 0.3rem;

    text-align: left;
    border-radius: 5px;
    border: 1px solid #c7c9cf;
    background: #151926;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    transition: background 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
    color: #f4f0e7;
}

.playlist-item-main {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    flex: 1 1 auto;
}

.playlist-item:hover {
    background: #1f2532;
    box-shadow: 0 3px 0 #0b0f18;
    transform: translateY(-1px);
}

.playlist-item.active {
    background-image: linear-gradient(
        135deg,
        #ffcc33 0 80%,
        #ff9933 80% 84%,
        #ff3360 84% 88%,
        #d620b0 88% 92%,
        #7b3cff 92% 100%
    );
    color: #151926;
    border-color: #ffffff;
}

.playlist-title {
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: baseline;
}

.playlist-count {
    font-size: 0.7rem;
    opacity: 0.9;
    margin-left: 0.25rem;
}

.playlist-meta {
    font-size: 0.75rem;
    opacity: 0.9;
}

.app-footer {
    display: none;
}

.player-logo-overlay {
    position: absolute;
    top: 0.0%;
    left: 0.0%;
    width: 20%;
    max-width: 150px;
    opacity: 0.5;
    z-index: 10;
    pointer-events: none;
    filter: saturate(0.5)
            drop-shadow(0 0 14px rgba(255,255,255,0.9));
}

@media (min-width: 800px) {
    .app-main {
        flex-direction: row;
        align-items: stretch;
        overflow: hidden;
    }

    .player-panel {
        flex: 1 1 auto;
        order: 1;
        min-height: 0;
    }

    .playlist-panel {
        flex: 0 0 32%;
        max-width: 350px;
        order: 2;
    }
}

@media (max-width: 799px) {
    .player-logo-overlay {
        width: 20%;
        max-width: 70px;
        top: 0.0%;
        left: 0.0%;
    }

    body {
        overflow-y: auto;
    }

    .app {
        height: auto;
        min-height: 100vh;
    }

    .app-main {
        flex-direction: column;
        overflow: visible;
    }

    .playlist-panel {
        max-width: none;
        width: 100%;
        flex: 0 0 auto;
    }

    .player-panel {
        flex: 0 0 auto;
    }

    .playlist-groups {
        max-height: none;
        overflow-y: visible;
    }

    .app-header {
        text-align: center;
    }

    .logo-wrap {
        justify-content: center;
        align-items: center;
    }

    .title-wrap {
        text-align: center;
    }
}

/* Querformat mobile */
@media (max-width: 799px) and (orientation: landscape) {
    .player-wrapper {
        margin-bottom: 0.5rem;
    }

    .app-header {
        padding: 0.3rem 0.75rem;
    }

    .logo {
        height: 35px;
    }

    body:not(.is-fullscreen) {
        overflow-x: hidden;
        overflow-y: auto;
    }

    body:not(.is-fullscreen) .app {
        height: 100vh;
        min-height: 100vh;
    }

    body:not(.is-fullscreen) .app-main {
        padding-bottom: 0.75rem;
        flex-direction: row;
        align-items: stretch;
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
    }

    body:not(.is-fullscreen) .player-panel {
        flex: 1 1 auto;
        min-height: 0;
    }

    body:not(.is-fullscreen) .playlist-panel {
        flex: 0 0 40%;
        max-width: 320px;
        width: 100%;
        height: 100%;
        max-height: 100%;
        overflow-y: auto;
    }
}

/* PORTRAIT ONLY — LOGO MITTIG */
@media (max-width: 799px) and (orientation: portrait) {
    .logo-wrap {
        flex-direction: column;   /* Logo über Text */
        justify-content: center;
        align-items: center;
        margin: 0 auto;
    }

    .title-wrap {
        text-align: center;
    }
}

.tmdb-powered {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 0.5rem;
    opacity: 0.85;
    font-size: 0.75rem;
    letter-spacing: 0.03em;
    text-align: center;
}

.tmdb-powered span {
    white-space: nowrap;
}

.tmdb-powered img {
    height: 10px;
    width: auto;
    margin-left: 4px;
    vertical-align: middle;
    filter: none;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.tmdb-powered a:hover img {
    transform: scale(1.05);
    opacity: 1;
}

.search-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: flex-start;
    justify-content: center;
    z-index: 9000;
    background: radial-gradient(circle at top, rgba(21, 25, 38, 0.97), rgba(0, 0, 0, 0.75));
    backdrop-filter: blur(4px);
}

.search-overlay.search-open {
    display: flex;
}

.search-dialog {
    width: min(600px, 96vw);
    max-height: 80vh;
    margin-top: 4vh;
    background: #050911;
    border-radius: 12px;
    border: 1px solid #c7c9cf;
    box-shadow: 0 0 26px rgba(0, 0, 0, 0.9);
    padding: 1rem 1.2rem 1.1rem;
    position: relative;
    display: flex;
    flex-direction: column;
}

.search-close {
    position: absolute;
    right: 0.7rem;
    top: 0.6rem;
    border: none;
    background: transparent;
    color: #f4f0e7;
    font-size: 1.1rem;
    cursor: pointer;
    text-shadow: none;
    padding: 0.2rem;
}

.search-title {
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    margin-bottom: 0.6rem;
    padding-right: 2rem;
}

.search-input-wrap {
    margin-bottom: 0.6rem;
}

#search-input {
    width: 100%;
    padding: 0.5rem 0.8rem;
    border-radius: 999px;
    margin-top: 0;
    border: 1px solid #c7c9cf;
    background: #151926;
    color: #f4f0e7;
    font-size: 0.9rem;
    box-shadow: none;
}

#search-input::placeholder {
    color: rgba(200, 204, 214, 0.7);
}

.search-results {
    flex: 1 1 auto;
    min-height: 120px;
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 0.3rem;
    margin-right: -0.3rem;
    scrollbar-width: thin;
    scrollbar-color: #ff9933 transparent;
}

.search-results::-webkit-scrollbar {
    width: 6px;
}

.search-results::-webkit-scrollbar-track {
    background: transparent;
}

.search-results::-webkit-scrollbar-thumb {
    background-image: linear-gradient(
        135deg,
        #ffcc33 0 25%,
        #ff9933 25% 50%,
        #ff3360 50% 75%,
        #7b3cff 75% 100%
    );
    border-radius: 999px;
    box-shadow: 0 0 6px rgba(0,0,0,0.8);
}

.search-result-item {
    width: 100%;
    text-align: left;
    border-radius: 8px;
    border: 1px solid #303746;
    background: #151926;
    padding: 0.4rem 0.6rem;
    margin-bottom: 0.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    transition: background 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
    color: #f4f0e7;
}

.search-result-item:hover {
    background: #1f2532;
    box-shadow: 0 3px 0 #0b0f18;
    transform: translateY(-1px);
}

.search-result-title {
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    margin-bottom: 0.1rem;
}

.search-result-meta {
    font-size: 0.75rem;
    opacity: 0.85;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.search-result-text-wrap {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
}

.search-empty {
    font-size: 0.8rem;
    opacity: 0.9;
    text-align: center;
    padding: 0.8rem 0.4rem;
    letter-spacing: 0.06em;
}

.btn-playlist {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 50%;
    padding: 0;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-playlist-add {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 50%;
    padding: 0;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 0 #0b0f18;
}

.btn-playlist-add.is-added {
    background: #151926;
    color: #9fff8a;
    border-color: rgba(0, 255, 180, 0.9);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.9);
    position: relative;
}

.btn-playlist-add.is-added::after {
    content: "\2713";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 900;
    color: #9fff8a;
    text-shadow: 0 0 6px rgba(0,0,0,0.9);
}

.playlist-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9001;
    background: radial-gradient(circle at top, rgba(21, 25, 38, 0.97), rgba(0, 0, 0, 0.75));
    backdrop-filter: blur(4px);
}

.playlist-overlay.playlist-open {
    display: flex;
}

.playlist-dialog {
    width: min(600px, 96vw);
    max-height: 80vh;
    background: #050911;
    border-radius: 12px;
    border: 1px solid #c7c9cf;
    box-shadow: 0 0 26px rgba(0, 0, 0, 0.9);
    padding: 1rem 1.2rem 1.1rem;
    position: relative;
    display: flex;
    flex-direction: column;
}

.playlist-close {
    position: absolute;
    right: 0.7rem;
    top: 0.6rem;
    border: none;
    background: transparent;
    color: #f4f0e7;
    font-size: 1.1rem;
    cursor: pointer;
    text-shadow: none;
    padding: 0.2rem;
}

.playlist-dialog-title {
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    margin-bottom: 0.6rem;
    padding-right: 2rem;
}

.playlist-items {
    flex: 1 1 auto;
    min-height: 120px;
    max-height: 50vh;
    overflow-y: auto;
    padding-right: 0.3rem;
    margin-right: -0.3rem;
    scrollbar-width: thin;
    scrollbar-color: #ff9933 transparent;
}

.playlist-items::-webkit-scrollbar {
    width: 6px;
}

.playlist-items::-webkit-scrollbar-track {
    background: transparent;
}

.playlist-items::-webkit-scrollbar-thumb {
    background-image: linear-gradient(
        135deg,
        #ffcc33 0 25%,
        #ff9933 25% 50%,
        #ff3360 50% 75%,
        #7b3cff 75% 100%
    );
    border-radius: 999px;
    box-shadow: 0 0 6px rgba(0,0,0,0.8);
}

.playlist-empty {
    font-size: 0.8rem;
    opacity: 0.9;
    text-align: center;
    padding: 0.8rem 0.4rem;
    letter-spacing: 0.06em;
}

.user-playlist-item {
    display: flex;
    align-items: stretch;
    gap: 0.35rem;
    margin-bottom: 0.3rem;
}

.user-playlist-main {
    flex: 1 1 auto;
    border-radius: 8px;
    border: 1px solid #303746;
    background: #151926;
    padding: 0.35rem 0.55rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    color: #f4f0e7;
    text-align: left;
    transition: background 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

.user-playlist-main:hover {
    background: #1f2532;
    box-shadow: 0 3px 0 #0b0f18;
    transform: translateY(-1px);
}

.user-playlist-title {
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.user-playlist-meta {
    font-size: 0.75rem;
    opacity: 0.85;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.user-playlist-delete {
    flex: 0 0 auto;
    border-radius: 8px;
    border: 1px solid rgba(255, 80, 120, 0.9);
    background: #311018;
    color: #ffb7c8;
    width: 2.1rem;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 0 #1f0b10;
    transition: background 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

.user-playlist-delete:hover {
    background: #4a1723;
    box-shadow: 0 4px 0 #1f0b10;
    transform: translateY(0);
}

.playlist-actions {
    margin-top: 2rem;
    margin-bottom: 0.8rem;
    display: flex;
    justify-content: space-between;
    gap: 0.4rem;
    align-items: center;
    font-size: 0.78rem;
}

.playlist-actions .btn {
    font-size: 0.7rem;
    padding: 0.25rem 0.8rem;
    border-radius: 999px;
}

.playlist-actions {
    flex-wrap: wrap;
}

.btn-playlist-upload-label {
    flex-basis: 100%;
}

.playlist-actions .btn-playlist-action {
    position: relative;
    transition:
        transform 0.12s ease,
        box-shadow 0.12s ease,
        border-color 0.12s ease;
}

.playlist-actions .btn-playlist-action:active {
    transform: translateY(1px) scale(0.97);
    box-shadow:
        0 1px 0 #0b0f18,
        0 0 10px rgba(159, 255, 138, 0.6);
    border-color: rgba(159, 255, 138, 0.95);
}

.playlist-actions .btn-playlist-action:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 2px #050911,
        0 0 0 4px rgba(159, 255, 138, 0.95);
    border-color: rgba(159, 255, 138, 0.95);
}

.playlist-upload-label {
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.playlist-upload-label input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.search-result-add-btn {
    flex: 0 0 auto;
    min-width: 44px;
    height: 28px;
    margin-left: 0.4rem;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    border: 1px solid #c7c9cf;
    background: #f4f0e7;
    color: #151926;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    box-shadow: 0 2px 0 #b0b2b9;
    transition: background 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.search-result-add-btn:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 3px 0 #a4a6ad;
}

.search-result-add-btn.added,
.search-result-add-btn.is-added {
    background: #151926;
    color: #9fff8a;
    border-color: rgba(0, 255, 180, 0.9);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.9);
}

.search-result-add-btn.added::after,
.search-result-add-btn.is-added::after {
    content: "\2713";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 900;
    color: #9fff8a;
    text-shadow: 0 0 6px rgba(0,0,0,0.9);
}

.search-result-add-btn.add-pop {
    animation: searchAddPop 0.28s ease-out;
}

@keyframes searchAddPop {
    0% {
        transform: scale(0.6);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
    100% {
        transform: scale(1.0);
        opacity: 1;
    }
}

@keyframes addCurrentFadeOut {
    0% { opacity: 1; }
    40% { opacity: 1; }
    100% { opacity: 0; }
}

.btn-add-current {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    width: 100px;
    height: 100px;
    padding: 0;
    border-radius: 1000px;
    border: 2px solid #c7c9cf;
    backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease-out,
                transform 0.15s ease-out,
                box-shadow 0.15s ease-out;
}

.btn-add-current.is-visible {
    opacity: 1;
    pointer-events: auto;
    animation: addCurrentFadeOut 5s ease-out forwards;
}

.player-wrapper:hover .btn-add-current {
    opacity: 1;
    pointer-events: auto;
    animation: addCurrentFadeOut 5s ease-out forwards;
}

.add-big-plus {
    font-size: 4rem;
    font-weight: 900;
    color: #f4f0e7;
    text-shadow: 0 0 6px rgba(0,0,0,0.9);
    line-height: 1;
}

.add-big-label {
    margin-top: 0.3rem;
    font-size: 1rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #f4f0e7;
    text-shadow: 0 0 6px rgba(0,0,0,0.9);
}

.btn-add-current:hover {
    transform: translate(-50%, -52%) scale(1.05);
    box-shadow: 0 0 18px rgba(0,0,0,0.9);
}

.btn-add-current.added {
    background: rgba(0, 0, 0, 0.85);
    border-color: rgba(0, 255, 180, 0.9);
    box-shadow: 0 0 18px rgba(0,0,0,0.9);
}

.btn-add-current.added .add-big-plus {
    color: #9fff8a;
    text-shadow: 0 0 6px rgba(0,0,0,0.9);
}

.btn-add-current.added .add-big-label {
    color: #9fff8a;
}

.btn-add-current.added-hide {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translate(-50%, -48%) scale(0.9);
}

@media (orientation: landscape) and (max-height: 600px) {
    body.is-fullscreen {
        overflow-y: auto;
    }

    body.is-fullscreen .app {
        height: auto;
        min-height: 100vh;
    }

    body.is-fullscreen .app-main {
        flex-direction: column;
        align-items: stretch;
        overflow: visible;
        padding-bottom: 0.75rem;
    }

    body.is-fullscreen .player-panel,
    body.is-fullscreen .playlist-panel {
        flex: 0 0 auto;
        max-width: none;
        width: 100%;
    }
}

@media (max-width: 799px) {
    .app-header {
        text-align: center;
    }

    .logo-wrap {
        justify-content: center;
        align-items: center;
    }

    .title-wrap {
        text-align: center;
    }
}

#btn-copy-link {
    padding: 0.2rem 0.2rem;
    font-size: 0.7rem;
    margin-top:    0.0rem;
    margin-right:  0;
    margin-bottom: 1rem;
    margin-left:   0;
    line-height: 0.8rem;
    border-radius: 6px;
}

/* =====================================================
   HELP BUTTON (Header, oben rechts)
   ===================================================== */

.header-help-btn {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.9);
    background: rgba(0, 0, 0, 0.55);
    color: #f4f0e7;
    font-weight: 800;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 0 rgba(0,0,0,0.75), 0 0 12px rgba(255,204,51,0.25);
    transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
    user-select: none;
}

.header-help-btn:hover {
    transform: translateY(-1px);
    background: rgba(0, 0, 0, 0.7);
    box-shadow: 0 4px 0 rgba(0,0,0,0.75), 0 0 16px rgba(255,204,51,0.35);
}

.header-help-btn:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 2px 0 rgba(0,0,0,0.75), 0 0 12px rgba(255,204,51,0.25);
}

.header-help-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #050911, 0 0 0 4px rgba(159, 255, 138, 0.95);
}

@media (max-width: 799px) {
    .header-help-btn {
        top: 8px;
        right: 10px;
        width: 20px;
        height: 20px;
        font-size: 15px;
    }
}

.embed-support-box {
    margin-top: 0.6rem;
    padding: 0.6rem;
    border: 1px solid #303746;
    border-radius: 6px;
    background: #0a0e16;
}

.embed-support-title {
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    opacity: 0.85;
    margin-bottom: 0.4rem;
}

.embed-support-link {
    display: block;
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
    color: #ffcc33;
    text-decoration: none;
}

.embed-support-link:hover {
    text-decoration: underline;
}

/* =====================================================
   NEW MENU SYSTEM (Folders + Collections + Bonus)
   ===================================================== */

.menu-section {
    margin-top: 0.6rem;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #303746;
    background: rgba(5, 9, 17, 0.55);
    box-shadow: 0 2px 0 rgba(0,0,0,0.35);
}

.menu-section-title {
    padding: 0.55rem 0.7rem;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #ffcc33;
    border-bottom: 1px solid rgba(255,204,51,0.35);
    background: rgba(21,25,38,0.75);
}

/* Folder block */
.folder {
    border-top: 1px solid rgba(48,55,70,0.65);
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}

.folder.is-hidden {
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    height: 0;
    overflow: hidden;
}

/* Folder header (clickable) */
.folder-header {
    width: 100%;
    text-align: left;
    border: none;
    background: rgba(21,25,38,0.65);
    color: #f4f0e7;
    cursor: pointer;
    padding: 0.55rem 0.7rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    transition: background 0.2s ease-out, color 0.2s ease-out, box-shadow 0.2s ease-out;
}

.folder-header:hover {
    background: rgba(31,37,50,0.85);
}

.folder-title {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

.folder-badge {
    font-size: 0.55rem;          /* Etwas größer für bessere Lesbarkeit */
    font-weight: 500;            /* Fettgedruckt wirkt es mehr wie ein "Badge" */
    color: #ffffff !important;   /* Erzwingt weiße Schrift, egal welcher Status */
    letter-spacing: 0.05em;
    padding: 0.2rem 0.6rem;      /* Etwas mehr "Luft" im Bubble */
    border-radius: 999px;        /* Pillen-Form */
    border: 1px solid rgba(255, 255, 255, 0.3); /* Heller, halbtransparenter Rahmen */
    background: rgba(0, 0, 0, 0.4); /* Dunklerer Hintergrund für Kontrast */
    box-shadow: 0 1px 3px rgba(0,0,0,0.3); /* Leichter Schatten für Tiefe */
    min-width: 1.8rem;           /* Mindestbreite, damit einstellige Zahlen rund wirken */
    text-align: center;
    display: inline-flex;        /* Zentriert den Inhalt perfekt */
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Selected/pinned glow */
.folder.is-pinned .folder-header {
    background-image: linear-gradient(135deg, rgba(255,204,51,0.95) 0%, rgba(255,51,96,0.85) 100%);
    color: #151926;
    box-shadow: 0 3px 0 rgba(11,15,24,0.85), 0 0 18px rgba(255,204,51,0.18);
}

/* Folder body - smooth open/close without measuring heights */
.folder-body {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transform: translateY(-4px);
    transition:
        grid-template-rows 0.22s ease-out,
        opacity 0.22s ease-out,
        transform 0.22s ease-out;
}

.folder.is-open .folder-body {
    grid-template-rows: 1fr;
    opacity: 1;
    transform: translateY(0);
}

.folder-body-inner {
    overflow: hidden;
    padding: 0.45rem 0.6rem 0.6rem;
}

.folder-playlists {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

/* Playlist buttons inside menu: reuse your existing .playlist-item look */
.playlist-item {
    transition:
        background 0.18s ease-out,
        color 0.18s ease-out,
        transform 0.18s ease-out,
        opacity 0.18s ease-out;
}

/* Smooth show/hide in pinned view */
.playlist-item.is-hidden {
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    max-height: 0;
    overflow: hidden;
    margin: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border-width: 0 !important;
}

/* =====================================================
   SELECTION INFO BAR (Angepasst an Bubble-Design)
   ===================================================== */

.selection-info {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0.45rem 0.6rem;
    border-radius: 10px;
    background: rgba(0,0,0,0.45);
    border: 1px solid rgba(199,201,207,0.35);
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    align-items: center;
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}

/* Das ist der neue, einheitliche Bubble-Look für die oberen Zähler */
.selection-pill {
    display: inline-flex;
    align-items: center; /* Vertikal zentrieren, statt baseline */
    justify-content: center;
    gap: 0.4rem; /* Etwas mehr Abstand zwischen Zahl und Text */
    
    /* == Bubble-Design übernehmen == */
    font-size: 0.55rem;
    font-weight: 500;
    color: #ffffff !important;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    text-transform: uppercase; /* Macht SELECTED und VIDEOS groß */
    line-height: 1;
}

/* Die Zahl selbst (muss nicht mehr grün sein) */
.selection-pill span:first-child {
    transition: transform 0.18s ease-out, opacity 0.18s ease-out;
    font-weight: 700; /* Stellt sicher, dass die Zahl fett ist */
}

/* Das Label ("SELECTED", "VIDEOS") */
.selection-label {
    font-size: 0.65rem; /* Etwas kleiner als die Zahl */
    opacity: 0.9;       /* Leicht transparenter für Hierarchie */
    letter-spacing: 0.08em;
}

/* subtle pulse when numbers update (bleibt erhalten) */
.selection-info.is-bump .selection-pill span:first-child {
    transform: translateY(-1px) scale(1.04);
}


/* =====================================================
   FIX: Nicht gewählte Jahrzehnte sollen trotzdem "orange" wirken
   (Header bekommt eine leichte VHS-Orange-Gradient-Färbung)
   ===================================================== */

/* Default: alle nicht gepinnten Ordner bekommen einen warmen Orange-Tint */
.folder:not(.is-pinned) .folder-header {
    background-color: rgba(21,25,38,0.65);
    background-image: linear-gradient(
        135deg,
        rgba(255,204,51,0.38) 0%,
        rgba(255,153,51,0.28) 55%,
        rgba(255,51,96,0.20) 100%
    );
    color: #f4f0e7; /* bleibt hell */
}

/* Hover: etwas kräftiger, aber nicht wie "pinned" */
.folder:not(.is-pinned) .folder-header:hover {
    background-color: rgba(31,37,50,0.85);
    background-image: linear-gradient(
        135deg,
        rgba(255,204,51,0.55) 0%,
        rgba(255,51,96,0.35) 100%
    );
}

/* Wenn ein Ordner geöffnet ist (aber nicht gepinnt), soll er wie "aktiv" aussehen */
.folder.is-open:not(.is-pinned) .folder-header {
    background-image: linear-gradient(
        135deg,
        rgba(255,204,51,0.85) 0%,
        rgba(255,51,96,0.65) 100%
    );
    color: #151926; /* wie bei pinned: besser lesbar auf hellem Gradient */
    box-shadow: 0 3px 0 rgba(11,15,24,0.85), 0 0 18px rgba(255,204,51,0.14);
}

/* =====================================================
   Zapping Replay Button Animation
   ===================================================== */
@keyframes pulseRedGlow {
    0% {
        border-color: #ff3360; /* Rot */
        box-shadow: 0 0 0 0 rgba(255, 51, 96, 0.4);
    }
    50% {
        border-color: #ffffff; /* Der gewünschte weiße Rand */
        box-shadow: 0 0 25px 5px rgba(255, 51, 96, 0.8); /* Starker roter Glow nach außen */
    }
    100% {
        border-color: #ff3360;
        box-shadow: 0 0 0 0 rgba(255, 51, 96, 0.4);
    }
}