.clips-wrap {
    --card:   #20073c;
    --accent: #fec800;
    --twitch: #9146ff;
    --text:   #ffffff;
    --muted:  #b39ddb;

    display: flex;
    flex-direction: column;
    height: calc(100vh - 90px);
    margin: -18px;             /* nadpisz padding #app-content */
    max-width: 100%;
    overflow-x: hidden;
}

.clips-wrap *, .clips-wrap *::before, .clips-wrap *::after { box-sizing: border-box; }

/* ── Controls ── */
.clips-wrap .controls {
    padding: 10px 24px;
    display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
}
.clips-wrap .controls input,
.clips-wrap .controls select {
    background: var(--card); border: 1px solid #4a2070;
    color: var(--text); border-radius: 20px;
    padding: 8px 16px; font-size: .88rem; outline: none;
}
.clips-wrap .controls input { min-width: 220px; }
.clips-wrap .controls input:focus,
.clips-wrap .controls select:focus { border-color: var(--accent); }
.clips-wrap .controls select option { background: var(--card); }
.clips-wrap #clips-count { margin-left: auto; color: var(--muted); font-size: .85rem; }

/* ── Grid ── */
.clips-wrap #clips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 18px;
    padding: 4px 24px 32px;
}

.clips-wrap .clip-card {
    background: var(--card); border-radius: 12px;
    overflow: visible; text-decoration: none; color: var(--text);
    display: block; transition: transform .2s, box-shadow .2s;
    cursor: pointer;
}
.clips-wrap .clip-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,.55); }

.clips-wrap .thumb-wrap {
    position: relative; aspect-ratio: 16/9;
    overflow: hidden; background: #0a0015;
}
.clips-wrap .thumb-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.clips-wrap .duration-badge {
    position: absolute; bottom: 6px; right: 8px;
    background: rgba(0,0,0,.8); color: #fff;
    font-size: .75rem; padding: 2px 7px;
    border-radius: 4px; font-weight: 600;
}

.clips-wrap .clip-info { padding: 11px 13px; }
.clips-wrap .clip-title {
    font-size: .9rem; font-weight: 600; line-height: 1.35;
    margin-bottom: 5px;
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}
.clips-wrap .clip-meta  { font-size: .78rem; color: var(--accent); margin-bottom: 3px; }
.clips-wrap .clip-date  { font-size: .75rem; color: var(--muted); }
.clips-wrap .clip-views { font-size: .75rem; color: var(--muted); }

.clips-wrap .state-msg {
    grid-column: 1/-1; text-align: center;
    padding: 60px 20px; color: var(--muted);
}

/* ── Main content ── */
.clips-wrap #main-content { flex: 1; min-height: 0; overflow-y: auto; }

.clips-wrap #top-section { display: flex; flex-shrink: 0; }

/* ── Player pane ── */
.clips-wrap #player-pane {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column;
    background: #0a0015;
}
.clips-wrap #player-placeholder {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 12px;
    color: var(--muted); font-size: .95rem;
    background: #0a0015; z-index: 1;
    transition: opacity .2s;
}
.clips-wrap #player-placeholder.hidden { opacity: 0; pointer-events: none; }
.clips-wrap #player-placeholder svg { opacity: .25; }
.clips-wrap #player-video-wrap {
    position: relative; aspect-ratio: 16/9;
    flex-shrink: 0; background: #000;
}
.clips-wrap #vembed { width: 100%; height: 100%; border: none; display: block; background: #000; }
.clips-wrap #vplayer { display: none; }
.clips-wrap #player-info { padding: 12px 16px 10px; background: var(--card); }
.clips-wrap #player-title { font-size: 1rem; font-weight: 700; margin-bottom: 4px; line-height: 1.4; }
.clips-wrap #player-meta  { font-size: .82rem; color: var(--accent); margin-bottom: 8px; }
.clips-wrap #player-actions { display: flex; gap: 8px; }
.clips-wrap #player-actions a {
    background: transparent; border: 1px solid #4a2070;
    color: var(--muted); border-radius: 20px;
    padding: 4px 14px; font-size: .8rem;
    text-decoration: none; white-space: nowrap;
    transition: border-color .2s, color .2s;
}
.clips-wrap #player-actions a:hover { border-color: var(--accent); color: var(--accent); }

/* ── Queue sidebar ── */
.clips-wrap #queue-sidebar {
    width: 280px; flex-shrink: 0;
    display: flex; flex-direction: column;
    gap: 4px; padding: 6px;
    background: rgba(0,0,0,.3);
    overflow: hidden;
}
.clips-wrap .queue-card {
    flex: 1; min-height: 0;
    display: flex; flex-direction: column;
    background: var(--card); border-radius: 8px;
    cursor: pointer;
    overflow: hidden;
    transition: background .15s;
    border: 2px solid transparent;
}
.clips-wrap .queue-card:hover { background: #2d0d52; }
.clips-wrap .queue-card.active { border-color: var(--accent); background: #2d0d52; }
.clips-wrap .queue-slot-empty { flex: 1; }
.clips-wrap .queue-thumb {
    position: relative; width: 100%; aspect-ratio: 16/9; flex-shrink: 0;
}
.clips-wrap .queue-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.clips-wrap .queue-thumb .duration-badge { font-size: .62rem; padding: 1px 4px; }
.clips-wrap .queue-info {
    padding: 4px 6px; display: flex; align-items: center; gap: 4px; min-height: 0;
}
.clips-wrap .queue-info-text { flex: 1; min-width: 0; }
.clips-wrap .queue-title {
    font-size: .72rem; font-weight: 600; line-height: 1.25;
    overflow: hidden; display: -webkit-box;
    -webkit-line-clamp: 1; line-clamp: 1; -webkit-box-orient: vertical;
}
.clips-wrap .queue-meta { font-size: .65rem; color: var(--accent); }
.clips-wrap .queue-scroll-btn {
    flex-shrink: 0;
    background: transparent; border: 1px solid #4a2070;
    color: var(--muted); border-radius: 50%;
    width: 22px; height: 22px; font-size: .75rem;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: border-color .15s, color .15s;
    line-height: 1;
}
.clips-wrap .queue-scroll-btn:hover { border-color: var(--accent); color: var(--accent); }

.clips-wrap #bottom-section { flex-shrink: 0; }
.clips-wrap #clips-grid .clip-card.active { outline: 2px solid var(--accent); }

.clips-wrap #vcover {
    position: absolute; inset: 0; z-index: 2;
    background: #000 center/cover no-repeat;
    display: flex; align-items: center; justify-content: center;
    transition: opacity .3s;
}
.clips-wrap #vcover.hidden { opacity: 0; pointer-events: none; }
.clips-wrap #vcover-spinner {
    width: 52px; height: 52px; border-radius: 50%;
    border: 4px solid rgba(255,255,255,.15);
    border-top-color: #fff;
    animation: clips-spin .7s linear infinite;
}
@keyframes clips-spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
    .clips-wrap #top-section { flex-direction: column; }
    .clips-wrap #queue-sidebar { width: 100%; height: 160px; flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 6px; }
    .clips-wrap .queue-card { flex: none; width: 200px; }
}

@media (max-width: 600px) {
    .clips-wrap { height: auto; min-height: calc(100vh - 60px); margin: -10px; }
    .clips-wrap #main-content { overflow-y: visible; }

    .clips-wrap .controls {
        padding: 8px 10px;
        gap: 8px;
    }
    .clips-wrap .controls input { min-width: 0; width: 100%; }
    .clips-wrap .controls select { flex: 1; min-width: 0; }
    .clips-wrap #clips-count { margin-left: 0; }

    .clips-wrap #clips-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 10px;
        padding: 4px 10px 20px;
    }
    .clips-wrap .clip-info { padding: 8px 10px; }
    .clips-wrap .clip-title { font-size: .82rem; }
}
