.archives-page {
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: manipulation;
}

.skip-link {
    position: absolute;
    left: 10px;
    top: -40px;
    background: var(--bg-surface);
    color: var(--text);
    border: 1px solid var(--primary);
    border-radius: 6px;
    padding: 8px 10px;
    z-index: 400;
    text-decoration: none;
}

.skip-link:focus {
    top: 10px;
}

.archives-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

.archives-topbar {
    height: 44px;
    min-height: 44px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 14px;
    gap: 12px;
}

.archives-back {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--primary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1px;
    padding: 3px 8px 3px 4px;
    border-radius: 4px;
}

.archives-back:hover {
    background: rgba(145, 71, 255, 0.1);
}

.archives-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.archives-title svg {
    color: var(--primary);
}

.archives-toolbar {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.archives-filters {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-surface);
}

.archives-filter {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.archives-filter-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--muted);
    font-weight: 700;
}

.archives-input,
.archives-select {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 8px;
    font-family: inherit;
    font-size: 12px;
}

.archives-input {
    min-width: 220px;
}

.archives-select {
    min-width: 140px;
}

.archives-btn-clear {
    align-self: end;
}

.archives-btn {
    background: var(--bg-surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 12px;
    padding: 5px 10px;
    cursor: pointer;
}

.archives-btn:hover {
    border-color: var(--primary);
}

.archives-btn:focus-visible,
.archives-input:focus-visible,
.archives-select:focus-visible,
.archives-nav-btn:focus-visible,
.archive-file-btn:focus-visible,
.archive-player-x:focus-visible,
.archives-back:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.archives-nav-btn {
    width: 30px;
    height: 30px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.archives-nav-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.archives-content {
    flex: 1;
    overflow: auto;
    padding: 16px;
}

.archives-meta {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 12px;
}

.archives-activity {
    margin-bottom: 14px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-surface);
}

.archives-activity-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.archives-activity-head .archives-section-header {
    margin-bottom: 0;
}

.archives-activity-updated {
    color: var(--muted);
    font-size: 11px;
}

.archives-activity-summary {
    color: var(--text);
    font-size: 12px;
    margin-bottom: 8px;
}

.archives-activity-log {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.archives-reencode-jobs {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.archives-reencode-job {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--muted);
    font-size: 11px;
}

.archives-reencode-cancel,
.archives-load-more {
    flex: 0 0 auto;
}

.archives-load-more {
    display: block;
    margin: 14px auto 0;
}

.archives-activity-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    background: var(--bg);
}

.archives-activity-pill {
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 8px;
    line-height: 1.4;
    min-width: 42px;
    text-align: center;
}

.archives-activity-pill-live {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.16);
}

.archives-activity-pill-idle {
    color: var(--muted);
    background: rgba(127, 127, 127, 0.14);
}

.archives-activity-body {
    min-width: 0;
    flex: 1;
}

.archives-activity-text {
    color: var(--text);
    font-size: 12px;
}

.archives-activity-sub {
    color: var(--muted);
    font-size: 11px;
    margin-top: 3px;
}

.archives-channel-list {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.archives-channel-chip {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 3px 8px;
    color: var(--text);
    font-size: 11px;
    background: var(--bg-surface);
}

.archives-channel-status-live {
    color: #ef4444;
    text-transform: uppercase;
    font-size: 10px;
    font-weight: 700;
}

.archives-channel-status-other {
    color: var(--muted);
    text-transform: uppercase;
    font-size: 10px;
    font-weight: 700;
}

.archives-section {
    margin-bottom: 22px;
}

.archives-section-header {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
}

.archives-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 14px;
}

/* ─── Archive Card (costream-card style) ──────────────────────── */
.archive-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.archive-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(145, 71, 255, 0.12);
}

/* Thumbnail row */
.archive-thumbs {
    display: flex;
    height: 140px;
    overflow: hidden;
    position: relative;
}

.archive-thumb-slot {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: var(--bg);
}

.archive-thumb-slot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: brightness(0.85);
    transition: filter 0.2s;
}
.archive-card:hover .archive-thumb-slot img {
    filter: brightness(1);
}

.archive-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.88);
    background: #273144;
}
.archive-thumb-placeholder-1 { background: #334155; }
.archive-thumb-placeholder-2 { background: #3b2d4f; }
.archive-thumb-placeholder-3 { background: #1f4c4b; }

.archive-thumb-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 8px 4px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
    text-shadow: 0 1px 2px rgba(0,0,0,0.8), 0 0px 6px rgba(0,0,0,0.4);
}

.archive-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.25);
    opacity: 0;
    transition: opacity 0.2s;
}
.archive-card:hover .archive-play-overlay {
    opacity: 1;
}

.archive-play-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.4);
    transition: transform 0.15s;
}
.archive-card:hover .archive-play-btn {
    transform: scale(1.1);
}
.archive-play-btn svg {
    width: 20px;
    height: 20px;
    color: #fff;
    margin-left: 2px;
}

/* Card body */
.archive-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.archive-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.archive-date {
    font-size: 11px;
    color: var(--muted);
}

.archive-duration {
    font-size: 10px;
    font-weight: 700;
    color: rgba(145, 71, 255, 0.85);
    background: rgba(145, 71, 255, 0.08);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid rgba(145, 71, 255, 0.12);
    margin-left: auto;
}

.archive-card-badge {
    font-size: 9px;
    font-weight: 700;
    border-radius: 999px;
    padding: 1px 7px;
    letter-spacing: 0.5px;
}

.archive-card-badge-live {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.16);
}

.archive-card-badge-saved {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.16);
}

/* Avatars row */
.archive-avatars {
    display: flex;
    align-items: center;
    gap: 8px;
}

.archive-avatar-group {
    display: flex;
    align-items: center;
}

.archive-card-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--bg-surface);
    object-fit: cover;
}
.archive-card-avatar + .archive-card-avatar {
    margin-left: -8px;
}

.archive-card-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.archive-names {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Game tag */
.archive-game {
    font-size: 10px;
    color: var(--primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* File chips */
.archive-card-files {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.archive-file-chip {
    font-size: 10px;
    color: var(--muted);
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--border);
    white-space: nowrap;
}

/* Card actions */
.archive-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.archive-reencode-btn {
    font-size: 10px;
    padding: 3px 10px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.archive-reencode-btn:hover:not(:disabled) {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.archive-reencode-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.archive-card-badge-reencoded {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.16);
}

.archives-btn-reencode {
    margin-left: auto;
}

.archives-empty {
    color: var(--muted);
    padding: 12px 2px;
}

.archive-player {
    position: fixed;
    inset: 0;
    z-index: 300;
}

.archive-player.hidden {
    display: none;
}

.archive-player-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
}

.archive-player-content {
    position: absolute;
    inset: 0;
    background: var(--bg);
    display: flex;
    flex-direction: column;
}

/* ─── Top Bar ─────────────────────────────────────────────────── */
.ap-topbar {
    height: 34px;
    min-height: 34px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 10px;
    gap: 8px;
    z-index: 100;
}

.ap-back {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--primary);
    background: none;
    border: none;
    font-size: 12px;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    padding: 3px 8px 3px 4px;
    border-radius: 4px;
}
.ap-back:hover { background: rgba(145, 71, 255, 0.1); }

.ap-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ap-toolbar {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 5px;
}

.ap-toolbar-sep {
    width: 1px;
    height: 16px;
    background: var(--border);
    margin: 0 2px;
}

.ap-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 5px;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    padding: 3px 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.ap-btn:hover { border-color: var(--primary); color: var(--primary); }

.ap-btn-big {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 700;
    padding: 3px 10px;
}
.ap-btn-big:hover { opacity: 0.85; color: #fff; border-color: var(--primary); }

.ap-audio-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--muted);
    padding: 0 4px;
}
.ap-audio-indicator svg { color: var(--primary); }

/* ─── Timeline Bar ────────────────────────────────────────────── */
.ap-timeline-bar {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    min-height: 28px;
}

.ap-seek-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 700;
    font-family: inherit;
    padding: 3px 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.12s;
    user-select: none;
}
.ap-seek-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(145, 71, 255, 0.08);
}
.ap-seek-btn:active { transform: scale(0.95); }

.ap-time {
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    min-width: 48px;
    text-align: center;
    user-select: none;
}

.ap-time-tappable {
    cursor: pointer;
    border-bottom: 1px dotted var(--muted);
    transition: color 0.12s, border-color 0.12s;
}
.ap-time-tappable:hover {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.ap-jump-input {
    width: 68px;
    min-width: 68px;
    padding: 2px 5px;
    border: 1px solid var(--primary);
    border-radius: 4px;
    background: var(--bg-surface);
    color: var(--text);
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    font-variant-numeric: tabular-nums;
    text-align: center;
    outline: none;
}
.ap-jump-input:focus { box-shadow: 0 0 0 2px rgba(145, 71, 255, 0.25); }

.ap-timeline-wrap {
    flex: 1;
    position: relative;
    min-width: 0;
    display: flex;
    align-items: center;
}

.ap-timeline-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: var(--border);
    outline: none;
    cursor: pointer;
    width: 100%;
}
.ap-timeline-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

.ap-timeline-markers {
    position: absolute;
    left: 7px;
    right: 7px;
    top: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 2;
    display: flex;
    align-items: center;
}

/* ─── Timeline Markers (reuses sync naming conventions) ──────── */
.ap-timeline-markers .timeline-marker {
    position: absolute;
    transform: translateX(-50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #3b82f6;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.35);
    cursor: pointer;
    pointer-events: auto;
    z-index: 3;
    transition: transform 0.1s, box-shadow 0.1s;
}
.ap-timeline-markers .timeline-marker:hover {
    transform: translateX(-50%) scale(1.3);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
    z-index: 4;
}

.ap-timeline-markers .timeline-marker-label {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.ap-timeline-markers .timeline-marker:hover .timeline-marker-label { opacity: 1; }

.ap-timeline-markers .timeline-marker-event {
    width: 10px;
    height: 10px;
    border-width: 1.5px;
}
.ap-timeline-markers .timeline-marker-join {
    background: #22c55e;
    border-color: rgba(255, 255, 255, 0.8);
}
.ap-timeline-markers .timeline-marker-join:hover {
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
}
.ap-timeline-markers .timeline-marker-leave {
    background: #ef4444;
    border-color: rgba(255, 255, 255, 0.8);
}
.ap-timeline-markers .timeline-marker-leave:hover {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25);
}

.ap-timeline-markers .timeline-marker-cluster {
    position: absolute;
    transform: translateX(-50%);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 6px rgba(0,0,0,0.4);
    cursor: pointer;
    pointer-events: auto;
    z-index: 5;
    transition: transform 0.12s, box-shadow 0.12s;
}
.ap-timeline-markers .timeline-marker-cluster:hover {
    transform: translateX(-50%) scale(1.25);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.2);
    z-index: 10;
}
.ap-timeline-markers .timeline-cluster-badge {
    position: absolute;
    top: -7px; right: -7px;
    min-width: 14px; height: 14px; line-height: 14px;
    text-align: center;
    background: var(--primary, #9147ff);
    color: #fff;
    font-size: 8px; font-weight: 800;
    border-radius: 7px; padding: 0 3px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    pointer-events: none;
}
.ap-timeline-markers .timeline-cluster-popup {
    position: absolute;
    top: 24px; left: 50%; transform: translateX(-50%);
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: 6px; padding: 4px 0;
    min-width: 160px; max-width: 260px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    opacity: 0; visibility: hidden;
    transition: opacity 0.12s, visibility 0.12s;
    pointer-events: none; z-index: 100; white-space: nowrap;
}
.ap-timeline-markers .timeline-marker-cluster:hover .timeline-cluster-popup {
    opacity: 1; visibility: visible; pointer-events: auto;
}
.ap-timeline-markers .timeline-cluster-row {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 10px; cursor: pointer; font-size: 11px;
    color: var(--text); transition: background 0.08s;
}
.ap-timeline-markers .timeline-cluster-row:hover {
    background: rgba(145, 71, 255, 0.1);
}
.ap-timeline-markers .tcr-icon { font-size: 11px; }
.ap-timeline-markers .tcr-time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 10px; min-width: 44px; }
.ap-timeline-markers .tcr-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* ─── Stream Grid ─────────────────────────────────────────────── */
.archive-player-grid {
    flex: 1;
    display: grid;
    gap: 2px;
    background: #000;
    min-height: 0;
    overflow: hidden;
}

.archive-player-grid[data-count="1"] { grid-template-columns: 1fr; }
.archive-player-grid[data-count="2"] { grid-template-columns: 1fr 1fr; }
.archive-player-grid[data-count="3"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.archive-player-grid[data-count="4"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.archive-player-grid[data-count="5"] { grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr 1fr; }

.archive-stream-cell {
    position: relative;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 0;
}

.archive-stream-cell.archive-stream-hidden { opacity: 0.08; }

.archive-stream-cell video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.archive-stream-label {
    position: absolute;
    bottom: 6px; left: 8px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 12px; font-weight: 700;
    padding: 2px 8px; border-radius: 4px;
    pointer-events: none; z-index: 2;
}

.archive-stream-waiting {
    color: var(--muted);
    font-size: 12px;
    text-align: center;
    padding: 12px;
}

.archive-stream-mute-btn {
    position: absolute;
    top: 6px; right: 8px;
    background: rgba(0,0,0,0.6);
    border: none; color: #fff;
    font-size: 11px; padding: 3px 8px;
    border-radius: 4px; cursor: pointer;
    z-index: 2; opacity: 0;
    transition: opacity 0.15s;
}
.archive-stream-cell:hover .archive-stream-mute-btn { opacity: 1; }
.archive-stream-mute-btn.archive-stream-unmuted { color: #22c55e; }

/* ─── Bookmarks Panel ─────────────────────────────────────────── */
.ap-bookmarks-panel {
    position: absolute;
    right: 0; top: 0; bottom: 0;
    width: min(340px, 90vw);
    background: var(--bg-surface);
    border-left: 1px solid var(--border);
    z-index: 50;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0,0,0,0.3);
}
.ap-bookmarks-panel.hidden { display: none; }

.ap-bookmarks-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.ap-bookmarks-close {
    background: none; border: none;
    color: var(--muted); font-size: 22px;
    cursor: pointer; line-height: 1;
}
.ap-bookmarks-close:hover { color: var(--text); }

.ap-bookmarks-list {
    flex: 1;
    overflow: auto;
    padding: 8px;
}

.ap-bookmarks-list .bookmarks-empty {
    color: var(--muted);
    font-size: 12px;
    padding: 16px 8px;
    text-align: center;
}

.ap-bookmarks-list .bookmarks-section-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--muted);
    font-weight: 700;
    padding: 8px 4px 4px;
}

.ap-bookmarks-list .bookmark-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text);
    transition: background 0.08s;
}
.ap-bookmarks-list .bookmark-row:hover { background: rgba(145, 71, 255, 0.08); }

.ap-bookmarks-list .bookmark-icon { font-size: 12px; flex-shrink: 0; }
.ap-bookmarks-list .bookmark-time {
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    font-size: 11px;
    min-width: 48px;
}
.ap-bookmarks-list .bookmark-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-bookmarks-list .bookmark-actions { display: flex; gap: 4px; flex-shrink: 0; }
.ap-bookmarks-list .bookmark-del,
.ap-bookmarks-list .bookmark-edit-btn {
    background: none; border: none; color: var(--muted);
    cursor: pointer; font-size: 13px; padding: 2px 4px;
}
.ap-bookmarks-list .bookmark-del:hover { color: #ef4444; }
.ap-bookmarks-list .bookmark-edit-btn:hover { color: var(--primary); }

.ap-bookmarks-list .bookmarks-streamer-name {
    font-size: 11px; font-weight: 700; color: var(--text);
    padding: 4px 4px 2px;
}

.ap-bookmarks-list .bookmark-edit-form {
    display: flex; align-items: center; gap: 4px; width: 100%;
}
.ap-bookmarks-list .bookmark-edit-time {
    width: 60px; font-size: 11px; padding: 2px 4px;
    border: 1px solid var(--border); border-radius: 4px;
    background: var(--bg); color: var(--text); font-family: inherit;
}
.ap-bookmarks-list .bookmark-edit-title {
    flex: 1; font-size: 11px; padding: 2px 4px;
    border: 1px solid var(--border); border-radius: 4px;
    background: var(--bg); color: var(--text); font-family: inherit;
}
.ap-bookmarks-list .bookmark-edit-save,
.ap-bookmarks-list .bookmark-edit-cancel {
    background: none; border: none; color: var(--muted);
    cursor: pointer; font-size: 14px; padding: 2px 4px;
}
.ap-bookmarks-list .bookmark-edit-save:hover { color: #22c55e; }
.ap-bookmarks-list .bookmark-edit-cancel:hover { color: #ef4444; }

/* ─── Streamer Pills ──────────────────────────────────────────── */
.archive-player-streamers-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    flex-shrink: 0;
}

.archive-streamer-chip {
    display: inline-flex; align-items: center; gap: 5px;
    border: 1px solid var(--border); border-radius: 999px;
    padding: 2px 10px; font-size: 11px; color: var(--muted); background: var(--bg);
}
.archive-streamer-chip.archive-streamer-active {
    color: var(--text); border-color: var(--primary);
}
.archive-streamer-dot {
    width: 6px; height: 6px; border-radius: 50%; background: var(--border);
}
.archive-streamer-active .archive-streamer-dot { background: #22c55e; }

.archive-player-info {
    padding: 4px 14px 8px;
    color: var(--muted); font-size: 11px;
    flex-shrink: 0; background: var(--bg-surface);
}

@media (max-width: 700px) {
    .archives-topbar {
        padding: 0 8px;
        gap: 8px;
    }

    .archives-title {
        font-size: 12px;
    }

    .archives-filters {
        padding: 8px;
        gap: 8px;
    }

    .archives-activity {
        padding: 8px;
    }

    .archives-activity-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .archives-input,
    .archives-select {
        min-width: 0;
        width: 100%;
    }

    .archives-filter {
        width: 100%;
    }

    .archives-btn-clear {
        width: 100%;
    }

    .archives-reencode-job {
        align-items: flex-start;
    }

    .archives-grid {
        grid-template-columns: 1fr;
    }

    .archive-thumbs {
        height: 100px;
    }

    .archive-player-grid[data-count="2"],
    .archive-player-grid[data-count="3"],
    .archive-player-grid[data-count="4"],
    .archive-player-grid[data-count="5"] {
        grid-template-columns: 1fr;
    }

    .ap-topbar { padding: 0 6px; gap: 4px; }
    .ap-title { font-size: 11px; }
    .ap-toolbar .ap-btn:not(.ap-btn-big) { display: none; }
    .ap-toolbar-sep { display: none; }
    .ap-audio-indicator { display: none; }

    .ap-timeline-bar { padding: 3px 6px; gap: 3px; }
    .ap-seek-btn[data-seek="-120"],
    .ap-seek-btn[data-seek="120"] { display: none; }
    .ap-time { font-size: 10px; min-width: 38px; }

    .ap-bookmarks-panel { width: 100vw; }
}
