/* ======================================================
   AbobaClips — Modern Dark Glassmorphism UI
   ====================================================== */

/* ===== Reset & Variables ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #08080c;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-solid: #111117;
    --bg-input: rgba(255, 255, 255, 0.06);
    --bg-hover: rgba(255, 255, 255, 0.08);
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    --text: #e8e8ed;
    --text-muted: #8b8b9e;
    --accent: #9147ff;
    --accent-hover: #a970ff;
    --accent-glow: rgba(145, 71, 255, 0.25);
    --success: #22c55e;
    --success-glow: rgba(34, 197, 94, 0.2);
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.2);
    --warning: #f59e0b;
    --warning-glow: rgba(245, 158, 11, 0.2);
    --laugh-bar: #ff6f00;
    --glass-blur: 20px;
    --glass-border: 1px solid rgba(255, 255, 255, 0.08);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --mono: "JetBrains Mono", "SF Mono", "Fira Code", "Consolas", monospace;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

html { font-size: 15px; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
    position: relative;
}

/* Ambient background gradient mesh */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 50% at 10% 20%, rgba(145, 71, 255, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse 50% 40% at 85% 70%, rgba(59, 130, 246, 0.06) 0%, transparent 55%),
        radial-gradient(ellipse 40% 30% at 50% 90%, rgba(236, 72, 153, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

a { color: var(--accent-hover); text-decoration: none; transition: color var(--transition); }
a:hover { color: #c4a0ff; }

/* Global dark select & option (Windows fix) */
select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238b8b9e'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 24px !important;
}
select, option {
    background-color: var(--bg-card-solid);
    color: var(--text);
}
option:checked {
    background-color: var(--accent);
    color: #fff;
}
option:hover {
    background-color: var(--bg-hover);
}

/* ===== Glass Card Mixin (used by most cards) ===== */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

/* ===== Navbar ===== */
.navbar {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 0 1.5rem;
    height: 56px;
    background: rgba(8, 8, 12, 0.75);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-brand {
    font-weight: 800;
    font-size: 1.05rem;
    background: linear-gradient(135deg, #bf7aff 0%, #9147ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}
.nav-links { display: flex; gap: 0.25rem; }
.nav-links a {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-xs);
    transition: all var(--transition);
}
.nav-links a:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
}

/* ===== Container ===== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.75rem 1.5rem;
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    letter-spacing: -0.02em;
}
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}
.page-header h1 { margin-bottom: 0; }
.bulk-actions { display: flex; gap: 0.5rem; }
h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 2rem 0 1rem;
    letter-spacing: -0.01em;
}
h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.5rem; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}
.btn:hover { color: #fff; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.78rem; border-radius: var(--radius-xs); }

.btn-primary {
    background: linear-gradient(135deg, #9147ff 0%, #7b2ff2 100%);
    box-shadow: 0 2px 12px var(--accent-glow);
}
.btn-primary:hover { box-shadow: 0 4px 20px rgba(145, 71, 255, 0.4); }

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-hover);
}

.btn-success {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    box-shadow: 0 2px 12px var(--success-glow);
}
.btn-success:hover { box-shadow: 0 4px 20px rgba(34, 197, 94, 0.35); }

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 2px 12px var(--danger-glow);
}
.btn-danger:hover { box-shadow: 0 4px 20px rgba(239, 68, 68, 0.35); }

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #000;
    box-shadow: 0 2px 12px var(--warning-glow);
}
.btn-warning:hover { box-shadow: 0 4px 20px rgba(245, 158, 11, 0.35); }

/* ===== Channel Grid (Dashboard) ===== */
.channel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}
.channel-card {
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    border-radius: var(--radius);
    padding: 1.1rem;
    transition: all var(--transition);
    position: relative;
}
.channel-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius);
    padding: 1px;
    background: linear-gradient(135deg, rgba(255,255,255,0.08), transparent 50%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition);
}
.channel-card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
    transform: translateY(-2px);
}
.channel-card:hover::before { opacity: 1; }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
.channel-identity {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}
.channel-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.1);
}
.channel-name {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
    letter-spacing: -0.01em;
}
.channel-name:hover { color: var(--accent-hover); }

.stream-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.stream-game { color: var(--accent-hover); font-weight: 600; }
.stream-viewers { color: var(--success); }

.card-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 0.85rem;
}
.card-stats strong { color: var(--text); }
.stream-quality { color: var(--accent-hover); font-weight: 600; }

.card-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.card-actions form { display: inline; }

/* ===== Status Badge ===== */
.status-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.status-active {
    background: rgba(34, 197, 94, 0.12);
    color: var(--success);
    box-shadow: 0 0 12px var(--success-glow);
}
.status-starting {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
    box-shadow: 0 0 12px var(--warning-glow);
}
.status-paused { background: rgba(139, 139, 158, 0.1); color: var(--text-muted); }
.status-offline { background: rgba(139, 139, 158, 0.06); color: #555; }
.status-error {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
    box-shadow: 0 0 12px var(--danger-glow);
}

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
.status-starting { animation: pulse 1.5s ease-in-out infinite; }

/* ===== Laugh Meter ===== */
.laugh-meter {
    position: relative;
    height: 24px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.04);
}
.laugh-meter-wide { flex: 1; }
.laugh-bar {
    height: 100%;
    background: linear-gradient(90deg, #f59e0b, #ef4444);
    border-radius: 12px;
    transition: width 0.3s ease;
    min-width: 0;
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.3);
}
.laugh-count {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text);
    text-shadow: 0 1px 3px rgba(0,0,0,0.7);
    pointer-events: none;
}

/* ===== Clip Grid ===== */
.clip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 1rem;
}
.clip-card {
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    border-radius: var(--radius);
    padding: 0;
    display: flex;
    flex-direction: column;
    transition: all var(--transition);
    color: var(--text);
    overflow: hidden;
}
.clip-card:hover {
    border-color: var(--border-hover);
    color: var(--text);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transform: translateY(-3px);
}
.clip-thumb {
    width: 100%;
    height: 150px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.03);
}
.clip-info {
    display: flex;
    justify-content: space-between;
    padding: 0.7rem 0.85rem 0;
}
.clip-channel { font-weight: 600; font-size: 0.9rem; }
.clip-time { color: var(--text-muted); font-size: 0.8rem; }
.clip-meta {
    display: flex;
    gap: 0.6rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 0.35rem 0.85rem 0.75rem;
    flex-wrap: wrap;
}

/* ===== Filter Bar (stream list channel pills) ===== */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1.25rem;
}

/* ===== Clips Toolbar ===== */
.clips-toolbar {
    margin-bottom: 1rem;
}
.clips-toolbar-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.toolbar-right {
    margin-left: auto;
}
.toolbar-select {
    padding: 0.3rem 0.6rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    max-width: 180px;
}
.toolbar-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.toolbar-select:hover {
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.08);
}

/* ===== Channel Detail Layout ===== */
.channel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.channel-header h1 { margin-bottom: 0; }
.channel-controls { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

.channel-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 1rem;
    min-height: 500px;
}
@media (max-width: 900px) {
    .channel-layout { grid-template-columns: 1fr; }
}

/* ===== Chat Panel ===== */
.chat-panel {
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    max-height: 70vh;
    overflow: hidden;
}
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
}
.panel-header h3 { margin: 0; white-space: nowrap; }

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    font-family: var(--mono);
    font-size: 0.8rem;
    line-height: 1.5;
}
.chat-placeholder { color: var(--text-muted); padding: 2rem; text-align: center; }

.chat-msg {
    padding: 3px 6px;
    border-radius: var(--radius-xs);
    transition: background var(--transition);
}
.chat-msg:hover { background: var(--bg-hover); }
.chat-time { color: #555; margin-right: 0.3rem; }
.chat-user { color: var(--accent-hover); font-weight: 600; margin-right: 0.4rem; }
.chat-user::after { content: ":"; }
.chat-text { color: var(--text); word-break: break-word; }

/* ===== Info Panel ===== */
.info-panel {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.panel-section {
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    border-radius: var(--radius);
    padding: 1rem;
}
.settings-table { width: 100%; font-size: 0.82rem; border-collapse: collapse; }
.settings-table td { padding: 0.3rem 0; }
.settings-table td:first-child { color: var(--text-muted); }
.settings-table td:last-child { text-align: right; font-weight: 600; color: var(--text); }

.emote-list { display: flex; flex-wrap: wrap; gap: 5px; }
.emote-tag {
    background: rgba(255, 255, 255, 0.06);
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 0.73rem;
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.mini-clip {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    font-size: 0.82rem;
    color: var(--text);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: color var(--transition);
}
.mini-clip:last-child { border-bottom: none; }
.mini-clip:hover { color: var(--accent-hover); }

/* ===== Clip Detail ===== */
.clip-header { margin-bottom: 1.25rem; }
.clip-header h1 { margin-bottom: 0.35rem; }
.clip-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 1rem;
    margin-bottom: 1rem;
}
@media (max-width: 900px) {
    .clip-layout { grid-template-columns: 1fr; }
}
.video-panel {
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
    border: var(--glass-border);
}
.video-wrap { display: block; position: relative; }
.clip-player { width: 100%; max-height: 68vh; background: #000; object-fit: contain; display: block; }

.chat-context-panel {
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    border-radius: var(--radius);
    padding: 1rem;
    max-height: 500px;
    overflow-y: auto;
}
.chat-context-messages { font-family: var(--mono); font-size: 0.78rem; }
.clip-nav {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

/* ===== Forms ===== */
.form-card {
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    max-width: 580px;
}
.form-section {
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    padding: 1rem 1rem 0.25rem;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.02);
}
.form-section legend {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0 0.5rem;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 0.75rem;
}
.form-group { margin-bottom: 0.85rem; }
.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text);
}
.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 0.55rem 0.85rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.88rem;
    transition: all var(--transition);
}
.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-group small {
    display: block;
    color: var(--text-muted);
    font-size: 0.76rem;
    margin-top: 0.3rem;
    line-height: 1.4;
}
.form-group .error { color: var(--danger); font-size: 0.78rem; display: block; margin-top: 0.2rem; }

/* Checkbox rows */
.form-group-check {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}
.form-group-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}
.form-group-check label {
    display: inline;
    margin-bottom: 0;
    cursor: pointer;
    color: var(--text);
}
.form-group-check small {
    width: 100%;
    margin-top: 0;
}

.form-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.form-danger-zone {
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(239, 68, 68, 0.15);
    max-width: 580px;
}

/* ===== Clip card with delete ===== */
.clip-card-wrap {
    position: relative;
}
.clip-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 5;
}
.btn-icon {
    width: 26px;
    height: 26px;
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: 0.75rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all var(--transition);
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.clip-card-wrap:hover .btn-icon { opacity: 1; }
.btn-icon-danger:hover { background: var(--danger); color: #fff; box-shadow: 0 0 12px var(--danger-glow); }

/* ===== Pagination ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    padding: 0.75rem 0;
}
.page-info {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ===== Toast notification ===== */
.toast-container {
    position: fixed;
    top: 68px;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.toast {
    background: rgba(17, 17, 23, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-sm);
    padding: 0.7rem 1rem;
    font-size: 0.82rem;
    color: var(--text);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    animation: slideIn 0.3s ease, fadeOut 0.5s ease 4.5s forwards;
    cursor: pointer;
}
@keyframes slideIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; transform: translateY(-10px); } }

/* ===== Utilities ===== */
.text-muted { color: var(--text-muted); }
.empty-state { text-align: center; padding: 4rem 2rem; grid-column: 1 / -1; }
.empty-state p { margin-bottom: 1rem; color: var(--text-muted); font-size: 0.95rem; }

/* ===== Laugh Graph ===== */
.laugh-graph-container {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.01);
}
.laugh-graph-container canvas {
    width: 100%;
    display: block;
    border-radius: 4px;
}

/* ===== Emote Management ===== */
.emote-manage { display: flex; gap: 6px; margin-top: 0.6rem; }
.emote-manage input {
    flex: 1;
    padding: 5px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text);
    font-size: 0.8rem;
    transition: border-color var(--transition);
}
.emote-manage input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.emote-tag-removable {
    background: rgba(255, 255, 255, 0.06);
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 0.73rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid transparent;
}
.emote-tag-removable:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

/* ===== Custom Video Player ===== */
.player-controls-wrap {
    background: rgba(17, 17, 23, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 0.7rem 0.95rem 0.85rem;
    user-select: none;
}

/* Timeline bar */
.player-timeline {
    position: relative;
    height: 40px;
    cursor: pointer;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
}
/* Track background */
.player-timeline::before {
    content: '';
    position: absolute;
    left: 0; right: 0;
    top: 50%; transform: translateY(-50%);
    height: 5px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    pointer-events: none;
}
/* Elapsed fill */
.tl-filled {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    left: 0;
    height: 5px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    pointer-events: none;
    transition: width 0.05s linear;
}
/* Trim region highlight */
.tl-trim-region {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    height: 5px;
    background: rgba(145, 71, 255, 0.3);
    border-left: 2px solid var(--accent);
    border-right: 2px solid var(--accent);
    pointer-events: none;
}
/* Trim handles */
.tl-handle {
    position: absolute;
    top: 50%; transform: translate(-50%, -50%);
    width: 12px;
    height: 28px;
    background: linear-gradient(135deg, #a970ff, #9147ff);
    border-radius: 4px;
    cursor: ew-resize;
    z-index: 3;
    transition: all 0.15s;
    box-shadow: 0 0 8px var(--accent-glow);
}
.tl-handle:hover {
    background: linear-gradient(135deg, #c4a0ff, #a970ff);
    height: 32px;
    box-shadow: 0 0 16px rgba(145, 71, 255, 0.5);
}
/* Playhead */
.tl-playhead {
    position: absolute;
    top: 0; bottom: 0;
    width: 2px;
    background: #fff;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 4;
    border-radius: 1px;
    box-shadow: 0 0 6px rgba(255,255,255,0.4);
}
.tl-playhead::after {
    content: '';
    position: absolute;
    top: -4px; bottom: -4px;
    left: -8px; right: -8px;
    cursor: grab;
    pointer-events: auto;
}

/* Controls row */
.player-bottom {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.player-btn {
    width: 32px; height: 32px;
    border: none;
    border-radius: var(--radius-xs);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition);
}
.player-btn:hover { background: rgba(255, 255, 255, 0.12); }
.player-time {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 84px;
}
.volume-slider {
    width: 68px;
    accent-color: var(--accent);
    cursor: pointer;
}
.player-sep {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
    margin: 0 0.2rem;
}
.trim-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.trim-label code {
    font-family: var(--mono);
    color: var(--accent-hover);
    background: rgba(145, 71, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}
.trim-status {
    font-size: 0.78rem;
    white-space: nowrap;
}

/* ===== Stats Page ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), #3b82f6);
    opacity: 0.6;
}
.stat-value {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #c4a0ff, #9147ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.stat-label { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.3rem; }

.chart-container {
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}
.chart-container h3 { margin-bottom: 0.85rem; }
.chart-container canvas { width: 100%; display: block; }

/* ===== Debug highlight for matched laugh messages ===== */
.chat-msg-laugh {
    background: rgba(245, 158, 11, 0.1);
    border-left: 2px solid var(--warning);
}

/* ===== Synced Chat ===== */
.chat-msg-active { background: rgba(145, 71, 255, 0.12); }
.chat-msg-past { opacity: 0.4; }

/* ===== Compile UI ===== */
.compile-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.clip-select-checkbox {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 18px;
    height: 18px;
    accent-color: var(--warning);
    cursor: pointer;
    z-index: 5;
    opacity: 0;
    transition: opacity var(--transition);
}
.clip-card-wrap:hover .clip-select-checkbox,
.clip-select-checkbox:checked {
    opacity: 1;
}

.compilation-badge {
    position: absolute;
    top: 10px;
    left: 36px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #000;
    font-size: 0.62rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    z-index: 5;
}

.compile-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(17, 17, 23, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(245, 158, 11, 0.3);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 200;
    font-size: 0.88rem;
}
.compile-bar span { color: var(--text); font-weight: 600; }

/* Input with inline button */
.input-with-btn {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.input-with-btn input { flex: 1; }

/* Form URL input */
.form-group input[type="url"] {
    width: 100%;
    padding: 0.55rem 0.85rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.88rem;
    transition: all var(--transition);
}
.form-group input[type="url"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-card {
    background: rgba(17, 17, 23, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    width: 500px;
    max-width: 95vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 64px rgba(0, 0, 0, 0.6);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.modal-header h2 { font-size: 1.1rem; margin: 0; }
.modal-body {
    padding: 1rem 1.25rem;
    overflow-y: auto;
    flex: 1;
}

/* ===== Search Input ===== */
.search-input {
    width: 100%;
    padding: 0.6rem 0.9rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.88rem;
    margin-bottom: 1rem;
    transition: all var(--transition);
}
.search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.modal-body .search-input { position: sticky; top: 0; z-index: 1; background: var(--bg-card-solid); }

/* ===== Follows List ===== */
.follows-list { display: flex; flex-direction: column; gap: 0.4rem; }
.follows-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 0.75rem;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    transition: all var(--transition);
}
.follows-row:hover { border-color: var(--border); background: rgba(255, 255, 255, 0.06); }
.follows-name { font-weight: 600; font-size: 0.88rem; }

/* ===== Clip Loudness Badge ===== */
.clip-loudness {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    white-space: nowrap;
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
    letter-spacing: 0.02em;
}
.clip-loudness[data-db] { background: rgba(34, 197, 94, 0.12); color: var(--success); }

/* ===== Clip Game/Category Badge ===== */
.clip-game {
    font-size: 0.72rem;
    color: var(--text-muted);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== Loud Moment Markers on Timeline ===== */
.tl-loud-marker {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    height: 5px;
    background: rgba(245, 158, 11, 0.5);
    border-radius: 3px;
    pointer-events: auto;
    cursor: help;
    z-index: 1;
    transition: all 0.15s;
}
.tl-loud-marker:hover {
    background: rgba(245, 158, 11, 0.9);
    height: 10px;
    box-shadow: 0 0 8px var(--warning-glow);
}

/* ===== Subtitle Editor ===== */
.tl-word-segment {
    position: absolute;
    top: 60%;
    height: 8px;
    background: rgba(233, 30, 99, 0.5);
    border-radius: 2px;
    cursor: pointer;
    z-index: 2;
    min-width: 3px;
    transition: background 0.15s, height 0.15s;
}
.tl-word-segment:hover, .tl-word-segment.active {
    background: rgba(233, 30, 99, 0.85);
    height: 10px;
}
.tl-word-segment.selected {
    background: #e91e63;
    box-shadow: 0 0 6px rgba(233, 30, 99, 0.6);
}
.tl-word-segment .tl-seg-handle {
    position: absolute;
    top: -4px;
    bottom: -4px;
    width: 6px;
    cursor: ew-resize;
    z-index: 3;
}
.tl-word-segment .tl-seg-handle.left { left: -3px; }
.tl-word-segment .tl-seg-handle.right { right: -3px; }

.subtitle-editor {
    padding: 0.75rem;
    background: var(--bg-card);
    border: var(--glass-border);
    border-radius: var(--radius);
    margin-top: 0.5rem;
}
.subtitle-editor-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}
.subtitle-editor-header h3 { margin: 0; font-size: 0.9rem; }
.subtitle-words {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius);
}
.subtitle-word-chip {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 3px 7px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition);
    min-width: 0;
}
.subtitle-word-chip:hover { background: rgba(255, 255, 255, 0.12); }
.subtitle-word-chip.active {
    border-color: #e91e63;
    background: rgba(233, 30, 99, 0.15);
}
.subtitle-word-chip .word-text { white-space: nowrap; }
.subtitle-word-chip .word-time {
    font-size: 0.6rem;
    color: var(--text-muted);
    font-family: var(--mono);
}
/* Delete button on word chip */
.subtitle-word-chip .word-delete {
    position: absolute;
    top: -4px; right: -4px;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
    line-height: 1;
    z-index: 2;
}
.subtitle-word-chip:hover .word-delete { opacity: 1; }

/* Add word chip */
.subtitle-add-chip {
    display: inline-flex;
    align-items: center; justify-content: center;
    padding: 3px 10px;
    border: 1px dashed rgba(255,255,255,0.2);
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.15s;
}
.subtitle-add-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(145,71,255,0.08);
}

/* Context menu */
.subtitle-context-menu {
    position: fixed;
    z-index: 400;
    background: rgba(17,17,23,0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    padding: 4px 0;
    min-width: 140px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    display: none;
}
.subtitle-context-menu button {
    display: block; width: 100%;
    padding: 6px 12px;
    background: none; border: none;
    color: var(--text); font-size: 0.82rem;
    text-align: left; cursor: pointer;
}
.subtitle-context-menu button:hover {
    background: rgba(255,255,255,0.08);
}

.subtitle-word-chip input.word-edit {
    width: 60px;
    padding: 0 2px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #e91e63;
    border-radius: 2px;
    color: var(--text);
    font-size: 0.85rem;
    outline: none;
}
.subtitle-settings {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 0.5rem;
    font-size: 0.8rem;
}
.subtitle-settings label {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}
.subtitle-settings input[type="number"] {
    width: 55px;
    padding: 2px 4px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    color: var(--text);
    font-size: 0.8rem;
}
.subtitle-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

/* ===== Filters Panel ===== */
.clips-filters-panel {
    margin-top: 0.6rem;
    background: var(--bg-card);
    border: var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
}
.filters-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: flex-end;
}
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}
.filter-group select,
.filter-group input[type="number"],
.filter-group input[type="date"] {
    padding: 0.35rem 0.55rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xs);
    color: var(--text);
    font-size: 0.82rem;
}
.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.filter-group-check label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: var(--text);
    cursor: pointer;
}
.filter-group-check input[type="checkbox"] {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
}
.filter-date-range {
    flex-direction: row;
    align-items: center;
    gap: 0.4rem;
}

/* ===== Clip Quick Preview ===== */
.clip-preview {
    position: absolute;
    z-index: 300;
    pointer-events: none;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    display: none;
}
.clip-preview video {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #000;
    display: block;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.15); }

/* ===== Selection ===== */
::selection {
    background: rgba(145, 71, 255, 0.3);
    color: #fff;
}

/* ===== Compilation Editor ===== */
.comp-editor { display: flex; flex-direction: column; gap: 1.25rem; }

/* Glass panel base */
.comp-settings,
.comp-preview {
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

/* Comp input (shared style for all inputs/selects in the editor) */
.comp-input {
    width: 100%;
    padding: 0.55rem 0.85rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.88rem;
    font-family: var(--font);
    transition: all var(--transition);
}
.comp-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
/* date inputs need color-scheme for dark pickers */
input[type="date"].comp-input { color-scheme: dark; }
select.comp-input { padding-right: 28px !important; }
select.comp-input option { background-color: var(--bg-card-solid); color: var(--text); }

/* Settings */
.comp-settings__title { font-size: 1.1rem; margin-bottom: 0.75rem; }
.comp-settings__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
}
.comp-field { display: flex; flex-direction: column; gap: 0.25rem; }
.comp-field__label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.comp-settings__actions { display: flex; align-items: center; gap: 1rem; margin-top: 0.75rem; }

/* Progress */
.comp-progress { display: flex; align-items: center; gap: 0.75rem; flex: 1; }
.comp-progress__bar {
    flex: 1; height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
}
.comp-progress__fill {
    height: 100%; width: 0;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s;
}
.comp-progress__text { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }

/* Preview */
.comp-preview__video-wrap {
    background: #000;
    border-radius: var(--radius-sm);
    overflow: hidden;
    max-height: 400px;
    display: flex;
    justify-content: center;
}
.comp-preview__video-wrap video {
    width: 100%; max-height: 400px;
    object-fit: contain;
}
.comp-preview__controls {
    display: flex; align-items: center; gap: 0.5rem;
    margin-top: 0.5rem; flex-wrap: wrap;
}
.comp-preview__info {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--mono);
}

/* Segment list */
.comp-segments__header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 0.75rem;
}
.comp-segments__header h2 { font-size: 1rem; margin: 0; }
.comp-segments__summary { font-size: 0.85rem; color: var(--text-muted); font-family: var(--mono); }
.comp-segments__list { display: flex; flex-direction: column; gap: 0.5rem; }
.comp-segments__footer {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 1rem; gap: 0.75rem;
}

/* Individual segment */
.comp-seg {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    transition: all var(--transition);
}
.comp-seg:hover { border-color: var(--border-hover); background: var(--bg-hover); }
.comp-seg--active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
.comp-seg--dragging { opacity: 0.4; }
.comp-seg--dragover { border-color: var(--accent); border-style: dashed; }

.comp-seg__header {
    display: flex; align-items: center; gap: 0.5rem;
    margin-bottom: 0.4rem; font-size: 0.82rem;
}
.comp-seg__drag { cursor: grab; color: var(--text-muted); font-size: 1rem; user-select: none; }
.comp-seg__num {
    background: var(--accent);
    color: #fff; font-weight: 700; font-size: 0.7rem;
    width: 20px; height: 20px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.comp-seg__clip { font-weight: 600; }
.comp-seg__date { color: var(--text-muted); }
.comp-seg__db { color: var(--warning); font-family: var(--mono); font-size: 0.78rem; margin-left: auto; }
.comp-seg__remove {
    background: none; border: none; color: var(--text-muted);
    font-size: 1.2rem; cursor: pointer; padding: 0 4px;
    transition: color var(--transition);
    line-height: 1;
}
.comp-seg__remove:hover { color: var(--danger); }

/* Segment mini-timeline */
.comp-seg__timeline { padding: 4px 0; }
.seg-tl__track {
    position: relative;
    height: 18px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 4px;
    overflow: visible;
    cursor: pointer;
}
.seg-tl__loud {
    position: absolute; top: 50%; transform: translateY(-50%);
    height: 6px;
    background: rgba(245, 158, 11, 0.35);
    border-radius: 3px;
    pointer-events: none;
}
.seg-tl__region {
    position: absolute; top: 0; bottom: 0;
    background: rgba(145, 71, 255, 0.2);
    border-radius: 3px;
}
.seg-tl__handle {
    position: absolute; top: -2px; bottom: -2px;
    width: 8px;
    background: var(--accent);
    border-radius: 3px;
    cursor: ew-resize;
    transform: translateX(-50%);
    z-index: 2;
    transition: background var(--transition);
}
.seg-tl__handle:hover { background: var(--accent-hover); }
.seg-tl__handle--in { border-radius: 3px 0 0 3px; }
.seg-tl__handle--out { border-radius: 0 3px 3px 0; }

/* Segment info row */
.comp-seg__info {
    display: flex; align-items: center; gap: 0.4rem;
    font-size: 0.8rem; margin-top: 0.3rem;
}
.comp-seg__input {
    width: 60px;
    padding: 2px 5px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    color: var(--text);
    font-size: 0.78rem;
    font-family: var(--mono);
    text-align: center;
}
.comp-seg__input:focus { outline: none; border-color: var(--accent); }
.comp-seg__arrow { color: var(--text-muted); }
.comp-seg__dur { color: var(--text-muted); font-family: var(--mono); }
.comp-seg__badge {
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
    padding: 1px 6px;
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    border-radius: 10px;
    margin-left: auto;
}

/* Modal overlay (compilation-specific) */
.comp-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 500;
    display: flex; align-items: center; justify-content: center;
}
.comp-modal {
    width: 550px; max-width: 95vw; max-height: 80vh;
    display: flex; flex-direction: column;
    background: rgba(17, 17, 23, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    box-shadow: 0 16px 64px rgba(0, 0, 0, 0.6);
}
.comp-modal__header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}
.comp-modal__header h3 { margin: 0; font-size: 1rem; }
.comp-modal__close {
    background: none; border: none; color: var(--text-muted);
    font-size: 1.4rem; cursor: pointer; line-height: 1;
}
.comp-modal__close:hover { color: var(--text); }
.comp-modal__body { padding: 0.75rem 1rem; overflow-y: auto; flex: 1; }
.comp-modal__filters { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }
.comp-modal__filters input { flex: 1; }
.comp-modal__results { display: flex; flex-direction: column; gap: 0.4rem; }

/* Picker clip row */
.picker-clip {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.5rem 0.6rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    border-radius: var(--radius-xs);
    font-size: 0.82rem;
    transition: all var(--transition);
}
.picker-clip:hover { border-color: var(--border-hover); background: var(--bg-hover); }
.picker-clip__id { font-weight: 600; color: var(--accent-hover); min-width: 50px; }
.picker-clip__date { color: var(--text-muted); }
.picker-clip__dur { font-family: var(--mono); }
.picker-clip__db { color: var(--warning); font-family: var(--mono); }
.picker-clip__add { margin-left: auto; }

/* Build overlay */
.comp-modal--build { width: 350px; padding: 2rem; align-items: center; }
.comp-build-status { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.comp-build-spinner {
    width: 40px; height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Loading/empty states */
.comp-loading, .comp-empty {
    padding: 2rem; text-align: center;
    color: var(--text-muted); font-size: 0.88rem;
}

/* Extra button sizes (compilation editor) */
.btn-lg { padding: 0.6rem 1.5rem; font-size: 0.95rem; }

/* Volume control */
.comp-volume {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.comp-volume__slider {
    -webkit-appearance: none;
    appearance: none;
    width: 80px;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
.comp-volume__slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}
.comp-volume__slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

/* Playhead marker on segment timeline */
.seg-tl__playhead {
    position: absolute; top: -2px; bottom: -2px;
    width: 2px;
    background: #fff;
    border-radius: 1px;
    z-index: 3;
    pointer-events: none;
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.5);
    transition: left 0.05s linear;
}

/* Picker clip — rich layout with thumbnail + subtitles */
.picker-clip__thumb {
    width: 80px; height: 45px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.04);
}
.picker-clip__meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.picker-clip__top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.picker-clip__subs {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-style: italic;
}

.btn-danger-text { color: var(--danger); }
.btn-danger-text:hover { color: #fff; background: var(--danger); border-color: var(--danger); }

/* ===== Compilation Workspace: two-column sticky layout ===== */
.comp-workspace {
    display: flex;
    gap: 1.25rem;
    align-items: flex-start;
}
.comp-workspace__player {
    flex: 0 0 45%;
    position: sticky;
    top: 1rem;
}
.comp-workspace__segments {
    flex: 1;
    min-width: 0;
}

/* Build options (checkboxes row) */
.comp-build-options {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.comp-build-options__item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    transition: color var(--transition);
}
.comp-build-options__item:hover { color: var(--text); }
.comp-build-options__item input[type="checkbox"] {
    accent-color: var(--accent);
    width: 15px;
    height: 15px;
    cursor: pointer;
}

/* Responsive: stack on narrow screens */
@media (max-width: 1100px) {
    .comp-workspace {
        flex-direction: column;
    }
    .comp-workspace__player {
        flex: none;
        width: 100%;
        position: sticky;
        top: 0;
        z-index: 10;
    }
    .comp-workspace__segments {
        width: 100%;
    }
}

/* ===== Analysis Panel ===== */
.analysis-panel {
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1rem 1.25rem;
    margin-top: 0.75rem;
}
.analysis-header {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}
.analysis-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}
.analysis-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.analysis-top-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.analysis-rating {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    flex-shrink: 0;
    border: 2px solid;
}
.analysis-rating.rating-high {
    color: var(--success);
    border-color: var(--success);
    background: var(--success-glow);
}
.analysis-rating.rating-mid {
    color: var(--warning);
    border-color: var(--warning);
    background: var(--warning-glow);
}
.analysis-rating.rating-low {
    color: var(--danger);
    border-color: var(--danger);
    background: var(--danger-glow);
}
.analysis-meta {
    flex: 1;
    min-width: 0;
}
.analysis-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
}
.analysis-rating-reason {
    font-size: 0.8rem;
}
.analysis-trim {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
}
.analysis-moments {
    font-size: 0.85rem;
}
.analysis-moments strong {
    display: block;
    margin-bottom: 0.35rem;
}
.analysis-moment {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.5rem;
    border-radius: var(--radius-xs);
    transition: background var(--transition);
}
.analysis-moment:hover {
    background: var(--bg-hover);
}
.moment-time {
    font-family: var(--mono);
    color: var(--accent-hover);
    white-space: nowrap;
    font-size: 0.8rem;
}
.moment-desc {
    color: var(--text-muted);
}
.analysis-transcript-details {
    font-size: 0.85rem;
}
.analysis-transcript-details summary {
    cursor: pointer;
    font-weight: 600;
    padding: 0.3rem 0;
}
.analysis-transcript {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg-input);
    border-radius: var(--radius-xs);
    padding: 0.75rem;
    margin-top: 0.35rem;
    white-space: pre-wrap;
    max-height: 300px;
    overflow-y: auto;
}

/* ===== AI Compilation Editor ===== */

.ai-seg__rating {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px; height: 24px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.ai-seg__title {
    font-size: 0.82rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

.ai-seg__meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0 0.75rem 0.35rem;
    flex-wrap: wrap;
}

.ai-seg__channel {
    font-size: 0.72rem;
    color: var(--accent);
    font-weight: 600;
}

.ai-seg__game {
    font-size: 0.72rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.06);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

.ai-seg__transcript {
    padding: 0.35rem 0.75rem 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
    cursor: pointer;
    font-style: italic;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    margin-top: 0.25rem;
}

.ai-seg__transcript:hover {
    color: var(--text);
}

/* Rating slider value display */
.comp-field__value {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--accent);
    min-width: 1.5em;
    text-align: center;
}

/* Checkbox field style */
.comp-field--checkbox {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}
.comp-field--checkbox .comp-field__label {
    margin-bottom: 0;
}

/* Compact input variant */
.comp-input--sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.78rem;
    min-width: 70px;
    width: auto;
}
