/* =============================================
   BiliBite - Premium Dark Glassmorphism
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* ---- Typography ---- */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
    --text-xs: 12px;
    --text-sm: 14px;
    --text-md: 15px;
    --text-lg: 17px;
    --text-xl: 19px;
    --text-2xl: 28px;

    /* ---- Spacing ---- */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 28px;
    --space-8: 32px;

    /* ---- Motion ---- */
    --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
    --duration-fast: 0.16s;
    --duration-normal: 0.25s;
    --duration-slow: 0.35s;

    /* ---- Background ---- */
    --bg-base: #08080e;
    --bg-sidebar: rgba(14, 14, 22, 0.92);
    --bg-card: rgba(18, 18, 32, 0.72);
    --bg-card-hover: rgba(24, 24, 42, 0.82);
    --bg-input: rgba(16, 16, 30, 0.85);
    --bg-elevated: rgba(28, 28, 48, 0.6);

    /* ---- Borders ---- */
    --border: rgba(255, 255, 255, 0.05);
    --border-hover: rgba(255, 255, 255, 0.1);
    --border-focus: rgba(251, 113, 133, 0.4);
    --focus-ring: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
    --hover: rgba(255, 255, 255, 0.05);

    /* ---- Text ---- */
    --text-primary: #f0f0f8;
    --text-secondary: #9494b0;
    --text-muted: #5a5a72;

    /* ---- BiliBite-inspired accent (pink→blue gradient) ---- */
    --accent: #fb7185;
    --accent-hover: #f472b6;
    --accent-blue: #60a5fa;
    --accent-glow: rgba(251, 113, 133, 0.18);
    --accent-gradient: linear-gradient(135deg, #fb7185, #a78bfa, #60a5fa);

    /* ---- Semantic ---- */
    --success: #34d399;
    --warning: #fbbf24;
    --error: #f87171;
    --info: #60a5fa;

    /* ---- Shapes ---- */
    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(251, 113, 133, 0.08);
    --interactive-height: 40px;
    --sidebar-width: 268px;

    /* ---- Log container ---- */
    --log-bg: rgba(0, 0, 0, 0.35);
    --log-border: rgba(255, 255, 255, 0.03);
}

/* ---- Light Mode ---- */
[data-theme="light"] {
    --bg-base: #f5f5f7;
    --bg-sidebar: rgba(255, 255, 255, 0.92);
    --bg-card: rgba(255, 255, 255, 0.8);
    --bg-card-hover: rgba(245, 245, 250, 0.9);
    --bg-input: rgba(240, 240, 248, 0.9);
    --bg-elevated: rgba(250, 250, 255, 0.7);

    --border: rgba(0, 0, 0, 0.06);
    --border-hover: rgba(0, 0, 0, 0.12);
    --border-focus: rgba(219, 39, 119, 0.4);
    --focus-ring: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
    --hover: rgba(0, 0, 0, 0.04);

    --text-primary: #1a1a2e;
    --text-secondary: #4a4a68;
    --text-muted: #8888a4;

    --accent: #e11d48;
    --accent-hover: #db2777;
    --accent-glow: rgba(225, 29, 72, 0.08);
    --accent-gradient: linear-gradient(135deg, #e11d48, #7c3aed, #2563eb);

    --success: #059669;
    --warning: #d97706;
    --error: #dc2626;
    --info: #2563eb;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 40px rgba(225, 29, 72, 0.04);

    --log-bg: rgba(0, 0, 0, 0.03);
    --log-border: rgba(0, 0, 0, 0.06);
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg-base);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- Accessibility: keyboard focus ---- */
:where(button, [role="button"], a, input, textarea, select, .nav-item, .nav-parent, .nav-child, .fav-folder-item,
    .video-card, .browse-compact-item, .theme-toggle):focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* ---- Lucide Icon Base ---- */
.lucide-icon {
    width: 18px;
    height: 18px;
    stroke-width: 1.75;
    vertical-align: -3px;
    display: inline-block;
    flex-shrink: 0;
}

.lucide-icon.icon-xs {
    width: 12px;
    height: 12px;
}

.lucide-icon.icon-sm {
    width: 14px;
    height: 14px;
}

.lucide-icon.icon-md {
    width: 15px;
    height: 15px;
}

/* ---- Ambient background glow ---- */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 25% 25%, rgba(251, 113, 133, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 75% 75%, rgba(96, 165, 250, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
    transition: opacity 0.3s ease;
}

[data-theme="light"] body::before {
    opacity: 0.3;
}

/* ---- Theme Toggle Button ---- */
.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.theme-toggle {
    width: var(--interactive-height);
    height: var(--interactive-height);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-xs);
    background: var(--bg-elevated);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration-normal) var(--ease-standard);
    -webkit-app-region: no-drag;
    color: var(--text-secondary);
}

.theme-toggle .lucide-icon {
    width: 16px;
    height: 16px;
}

.theme-toggle:hover {
    background: var(--hover);
    border-color: var(--accent);
    color: var(--accent);
    transform: rotate(15deg);
    box-shadow: 0 0 12px var(--accent-glow);
}

[data-theme="light"] .theme-toggle {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
}

[data-theme="light"] .theme-toggle:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--accent);
    border-color: var(--accent);
}

/* ===================== LAYOUT ===================== */
.app {
    display: flex;
    height: 100vh;
    position: relative;
    z-index: 1;
}

/* ---- Sidebar Toggle Button ---- */
.sidebar-toggle-btn {
    width: var(--interactive-height);
    height: var(--interactive-height);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: var(--bg-elevated);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all var(--duration-normal) var(--ease-standard);
    color: var(--text-secondary);
    flex-shrink: 0;
}

.sidebar-toggle-btn .lucide-icon {
    width: 16px;
    height: 16px;
}

.sidebar-toggle-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-glow);
}

.sidebar-toggle-btn.active {
    color: var(--accent);
    border-color: var(--accent);
}

@media (max-width: 900px) {
    .sidebar-toggle-btn {
        display: none;
    }
}

/* ---- Sidebar Close Button ---- */
.sidebar-close-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--radius-xs);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration-fast) var(--ease-standard);
    color: var(--text-muted);
    flex-shrink: 0;
    margin-left: auto;
}

.sidebar-close-btn .lucide-icon {
    width: 16px;
    height: 16px;
}

.sidebar-close-btn:hover {
    color: var(--text-primary);
    background: var(--hover);
}

@media (max-width: 900px) {
    .sidebar-close-btn {
        display: none;
    }

    .sidebar:not(.collapsed) .sidebar-close-btn {
        display: flex;
    }
}

/* ===================== SIDEBAR ===================== */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--bg-sidebar) 88%, transparent), var(--bg-sidebar)),
        var(--bg-sidebar);
    border-right: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(20px) saturate(1.2);
    box-shadow: inset -1px 0 0 color-mix(in srgb, var(--border-hover) 45%, transparent), 16px 0 44px rgba(0, 0, 0, 0.28);
    position: relative;
    overflow: hidden;
    -webkit-app-region: drag;
}

.sidebar::before {
    content: '';
    position: absolute;
    inset: -10% -30% auto -35%;
    height: 240px;
    background:
        radial-gradient(circle at 24% 34%, color-mix(in srgb, var(--accent) 28%, transparent) 0%, transparent 58%),
        radial-gradient(circle at 78% 18%, color-mix(in srgb, var(--accent-blue) 26%, transparent) 0%, transparent 54%);
    pointer-events: none;
    opacity: 0.95;
}

[data-theme="light"] .sidebar::before {
    opacity: 0.65;
}

.gutter-back-btn {
    position: fixed;
    left: calc(var(--sidebar-width) + var(--space-2));
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 54px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
    transition: all var(--duration-fast) var(--ease-standard);
    z-index: 40;
    opacity: 0;
    pointer-events: none;
}

.gutter-back-btn .lucide-icon {
    width: 16px;
    height: 16px;
}

.gutter-back-btn.active {
    opacity: 1;
    pointer-events: auto;
}

.gutter-back-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    transform: translateY(-50%) translateX(2px);
    box-shadow: 0 0 14px var(--accent-glow);
}

.sidebar-header {
    margin: 12px 12px 8px;
    padding: 18px 14px 14px;
    border: 1px solid color-mix(in srgb, var(--border-hover) 58%, transparent);
    border-radius: var(--radius-md);
    background: linear-gradient(160deg, color-mix(in srgb, var(--bg-elevated) 90%, transparent), color-mix(in srgb, var(--bg-card) 90%, transparent));
    box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 8%, transparent), 0 8px 28px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 1;
}

.sidebar-header h1 {
    font-size: 19px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.02em;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-header h1 .icon {
    font-size: 22px;
    -webkit-text-fill-color: initial;
}

.brand-bite-icon {
    width: 22px;
    height: 22px;
    display: inline-block;
    vertical-align: middle;
    filter: drop-shadow(0 0 6px rgba(251, 113, 133, 0.28));
}

.sidebar-header .subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
    letter-spacing: 0.05em;
}

.sidebar-nav {
    flex: 1;
    padding: 8px 10px 14px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    z-index: 1;
    -webkit-app-region: no-drag;
}

.nav-section {
    margin-bottom: 0;
    padding: 10px;
    border: 1px solid color-mix(in srgb, var(--border-hover) 50%, transparent);
    border-radius: 14px;
    background:
        linear-gradient(155deg, color-mix(in srgb, var(--bg-card) 92%, transparent), color-mix(in srgb, var(--bg-elevated) 88%, transparent));
    box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 8%, transparent), 0 8px 20px rgba(0, 0, 0, 0.18);
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    padding: 0 6px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-section-title::before {
    content: '';
    width: 16px;
    height: 2px;
    border-radius: 999px;
    background: var(--accent-gradient);
    opacity: 0.82;
}

/* ---- Nav Items ---- */
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--duration-fast) var(--ease-standard);
    -webkit-app-region: no-drag;
    position: relative;
    margin-bottom: 4px;
}

.nav-item:hover {
    background: color-mix(in srgb, var(--hover) 90%, transparent);
    border-color: color-mix(in srgb, var(--border-hover) 64%, transparent);
    color: var(--text-primary);
    transform: translateX(3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.16);
}

.nav-item.active {
    background: linear-gradient(145deg,
            color-mix(in srgb, var(--accent) 24%, transparent),
            color-mix(in srgb, var(--accent-blue) 18%, transparent));
    border-color: color-mix(in srgb, var(--accent) 38%, transparent);
    color: var(--text-primary);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent), 0 10px 20px rgba(0, 0, 0, 0.2);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 62%, transparent);
}

.nav-item .icon {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
    color: color-mix(in srgb, var(--text-secondary) 92%, transparent);
    transition: inherit;
}

.nav-item:hover .icon {
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.nav-item.active .icon {
    color: #fff;
    background: var(--accent-gradient);
    box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 38%, transparent);
}

.nav-item .label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-item .count {
    font-size: 10px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 7px;
    border-radius: 10px;
    color: var(--text-muted);
    margin-left: 6px;
    flex-shrink: 0;
}

/* ---- Expandable Parents ---- */
.nav-parent {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: var(--text-md);
    font-weight: 400;
    color: var(--text-secondary);
    transition: all var(--duration-fast) var(--ease-standard);
    -webkit-app-region: no-drag;
    user-select: none;
}

.nav-parent:hover {
    background: color-mix(in srgb, var(--hover) 90%, transparent);
    border-color: color-mix(in srgb, var(--border-hover) 64%, transparent);
    color: var(--text-primary);
    transform: translateX(3px);
}

.nav-parent.active {
    background: linear-gradient(145deg,
            color-mix(in srgb, var(--accent) 24%, transparent),
            color-mix(in srgb, var(--accent-blue) 18%, transparent));
    border-color: color-mix(in srgb, var(--accent) 38%, transparent);
    color: var(--text-primary);
    font-weight: 500;
    position: relative;
}

.nav-parent.active::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 62%, transparent);
}

.nav-parent .icon {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-parent .label {
    flex: 1;
    font-weight: inherit;
}

.nav-parent .count {
    font-size: 10px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 7px;
    border-radius: 10px;
    color: var(--text-muted);
}

.nav-parent .chevron {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-parent.expanded .chevron {
    transform: rotate(90deg);
}

.nav-children {
    display: none;
    padding-left: 14px;
    margin-top: 4px;
    overflow: hidden;
}

.nav-parent.expanded+.nav-children {
    display: block;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-child {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-muted);
    transition: all var(--duration-fast) var(--ease-standard);
    -webkit-app-region: no-drag;
}

.nav-child:hover {
    background: color-mix(in srgb, var(--hover) 90%, transparent);
    border-color: color-mix(in srgb, var(--border-hover) 55%, transparent);
    color: var(--text-secondary);
    transform: translateX(3px);
}

.nav-child.active {
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    border-color: color-mix(in srgb, var(--accent) 35%, transparent);
    color: var(--text-primary);
    font-weight: 500;
}

.nav-child .child-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-child .child-count {
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.7;
}

/* ===================== SIDEBAR COLLAPSED STATE ===================== */
.sidebar.collapsed {
    width: 0;
    min-width: 0;
}

.sidebar.collapsed .sidebar-header,
.sidebar.collapsed .sidebar-nav,
.sidebar.collapsed .sidebar-footer {
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration-fast) var(--ease-standard);
}

.sidebar-header,
.sidebar-nav,
.sidebar-footer {
    transition: opacity var(--duration-normal) var(--ease-standard);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity var(--duration-normal) var(--ease-standard);
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

@media (max-width: 900px) {
    .sidebar-overlay {
        display: block;
        left: var(--sidebar-width);
        top: 0;
        width: 100%;
        height: 100%;
        pointer-events: none;
    }

    .sidebar-overlay.active {
        pointer-events: auto;
        left: var(--sidebar-width);
    }

    .sidebar:not(.collapsed) {
        transform: translateX(0);
    }
}

/* ===================== STATUS FOOTER ===================== */
.sidebar-footer {
    padding: 14px 18px;
    border-top: 1px solid var(--border);
    -webkit-app-region: no-drag;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-hint {
    font-size: var(--text-sm);
    color: var(--text-muted);
    line-height: 1.5;
}

.status-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.5);
    animation: pulse 2s ease infinite;
}

.status-dot.offline {
    background: var(--error);
    opacity: 0.6;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.status-text {
    font-size: 13px;
    color: var(--text-muted);
    letter-spacing: 0.01em;
}

.bili-profile-card {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: color-mix(in srgb, var(--bg-card) 85%, transparent);
}

.bili-profile-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-input);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.bili-profile-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bili-profile-name {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
}

.bili-profile-meta {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.3;
}

.btn-footer {
    width: 100%;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    min-height: var(--interactive-height);
    transition: all var(--duration-fast) var(--ease-standard);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.nav-item-settings {
    margin-bottom: var(--space-2);
}

.is-hidden {
    display: none;
}

.btn-footer:hover {
    background: var(--hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-footer-danger:hover {
    background: rgba(248, 113, 113, 0.1);
    border-color: rgba(248, 113, 113, 0.3);
    color: var(--error);
}

/* ===================== MODAL ===================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-lg);
    width: 420px;
    max-width: calc(100vw - 24px);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
    animation: modalIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(8px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 14px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.modal-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    padding: 0;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.modal-body.modal-body-left {
    align-items: stretch;
}

.modal-wide {
    width: min(860px, calc(100vw - 32px));
}

.profile-modal-body {
    max-height: 76vh;
    overflow-y: auto;
}

.profile-page-shell {
    display: block;
}

.profile-section-pane {
    max-width: 760px;
    margin-bottom: 0;
}

.profile-section-pane .card-title {
    margin-bottom: 14px;
}

.card-subtitle {
    font-size: 12px;
    font-weight: normal;
    color: var(--text-muted);
    margin-left: 8px;
}

.wallet-pane-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-pane-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-modal-body .card-title {
    font-size: var(--text-lg);
}

.card-tight {
    margin-bottom: 0;
    padding: var(--space-5);
}

.profile-action-row {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.profile-action-row .btn {
    min-width: 118px;
}

.skip-list-toolbar {
    margin-top: 0;
    margin-bottom: 10px;
}

.profile-notice-list {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.skip-list-container {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.skip-record-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    background: color-mix(in srgb, var(--bg-card) 86%, var(--bg-elevated) 14%);
}

.skip-record-info {
    flex: 1;
    min-width: 0;
}

.skip-record-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.skip-record-meta {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.skip-record-bvid {
    color: var(--text-muted);
}

.skip-record-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.profile-notice-item {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    background: color-mix(in srgb, var(--bg-card) 86%, var(--bg-elevated) 14%);
}

.profile-notice-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.35;
}

.profile-notice-meta {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.profile-notice-content {
    margin-top: 8px;
    color: var(--text-secondary);
    line-height: 1.65;
}

.notice-popup-modal {
    width: min(760px, calc(100vw - 28px));
}

.notice-popup-title {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text-primary);
}

.notice-popup-content {
    max-height: min(52vh, 460px);
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    background: color-mix(in srgb, var(--bg-card) 84%, transparent);
}

.quick-amount-row {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.dialog-modal {
    width: 380px;
    max-width: calc(100vw - 24px);
}

.modal-message {
    margin: 0;
    font-size: var(--text-md);
    color: var(--text-secondary);
    line-height: 1.6;
    word-break: break-word;
}

.modal-message + .modal-message {
    margin-top: 10px;
}

.modal-checkbox-row {
    margin-top: 14px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.5;
}

.modal-checkbox-row input[type="checkbox"] {
    margin-top: 2px;
    width: 14px;
    height: 14px;
    accent-color: var(--accent);
    flex-shrink: 0;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
}

.modal-actions .btn {
    min-width: 88px;
}

.platform-auth-code-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.platform-auth-code-row .input {
    flex: 1;
}

.platform-auth-code-row .btn {
    white-space: nowrap;
}

.platform-auth-legal-box {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--bg-card) 85%, var(--bg-elevated) 15%);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.platform-auth-legal-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.5;
}

.platform-auth-legal-check input[type="checkbox"] {
    margin-top: 2px;
    width: 14px;
    height: 14px;
    accent-color: var(--accent);
    flex-shrink: 0;
}

.platform-auth-forgot-row {
    text-align: right;
    margin-bottom: 8px;
}

.platform-auth-forgot-row a {
    color: var(--accent);
    font-size: var(--text-sm);
    text-decoration: none;
}

.platform-auth-forgot-row a:hover {
    text-decoration: underline;
}

.change-password-forgot-row {
    text-align: right;
    margin-bottom: 8px;
}

.change-password-forgot-row a {
    color: var(--accent);
    font-size: var(--text-sm);
    text-decoration: none;
}

.change-password-forgot-row a:hover {
    text-decoration: underline;
}

.platform-auth-legal-check a {
    color: var(--accent);
    text-decoration: none;
}

.platform-auth-legal-check a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.platform-auth-legal-hint {
    font-size: 12px;
    color: var(--text-muted);
}

.qr-container {
    width: 220px;
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.qr-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.qr-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #333;
    font-size: 13px;
}

.qr-status {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    min-height: 18px;
    transition: color 0.2s;
}

.qr-status.success {
    color: var(--success);
    font-weight: 500;
}

.qr-status.scanned {
    color: var(--accent);
}

.qr-status.error {
    color: var(--error);
}

#rechargeQrBlock {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

#billingSupportQqHint {
    margin-top: 10px;
    text-align: left;
    line-height: 1.5;
    font-size: 15px;
    font-weight: 600;
}

#billingTrialHint {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg-card) 70%, var(--bg-soft) 30%);
    text-align: left;
    line-height: 1.5;
    font-size: 14px;
    font-weight: 600;
}

#profileTrialLoginHint,
#platformAuthTrialHint {
    margin-top: 10px;
    text-align: left;
    line-height: 1.5;
    font-size: 13px;
}

/* ===================== MAIN CONTENT ===================== */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.main-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: 14px var(--space-8);
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg-card) 75%, transparent);
    -webkit-app-region: drag;
}

.main-topbar-left,
.main-topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    -webkit-app-region: no-drag;
}

.topbar-switch-btn {
    min-height: 36px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 600;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-standard);
}

.topbar-switch-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    background: var(--hover);
}

.topbar-switch-btn.active {
    color: #fff;
    border-color: transparent;
    background: var(--accent-gradient);
    box-shadow: 0 8px 24px var(--accent-glow);
}


.main-header {
    padding: var(--space-6) var(--space-8) var(--space-5);
    border-bottom: 1px solid var(--border);
    -webkit-app-region: drag;
}

.main-header h2 {
    font-size: var(--text-2xl);
    font-weight: 700;
    letter-spacing: -0.03em;
}

.main-header p {
    font-size: var(--text-md);
    color: var(--text-muted);
    margin-top: var(--space-1);
}

.main-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-7) var(--space-8);
}

/* ---- Pages ---- */
.page {
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.page.active {
    display: flex;
    flex: 1;
    animation: pageIn var(--duration-normal) var(--ease-standard);
}

@keyframes pageIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===================== CARDS ===================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-5);
    backdrop-filter: blur(16px) saturate(1.1);
    transition: border-color var(--duration-normal) var(--ease-standard),
        box-shadow var(--duration-normal) var(--ease-standard);
    box-shadow: var(--shadow-sm);
}

.card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

.card-title {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    letter-spacing: -0.01em;
}

/* ===================== FORM ===================== */
.form-group {
    margin-bottom: var(--space-5);
}

.form-group label {
    display: block;
    font-size: var(--text-md);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
    letter-spacing: 0.01em;
}

.input,
textarea {
    width: 100%;
    min-height: var(--interactive-height);
    padding: 11px var(--space-4);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--text-md);
    outline: none;
    transition: border-color var(--duration-normal) var(--ease-standard),
        box-shadow var(--duration-normal) var(--ease-standard);
}

.input:focus,
textarea:focus {
    border-color: var(--border-focus);
    box-shadow: var(--focus-ring);
}

.input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

textarea {
    resize: vertical;
    min-height: 90px;
    line-height: 1.6;
}

.file-selection-hint {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-muted);
}

.input-row {
    display: flex;
    gap: var(--space-3);
}

.input-row .form-group {
    flex: 1;
}

.note-options-group {
    margin-top: var(--space-3);
}

.settings-shortcut-inline {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.settings-shortcut-hint {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-shortcut-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-shortcut-card .card-title {
    margin-bottom: 0;
}

.settings-shortcut-text {
    color: var(--text-secondary);
    line-height: 1.6;
}

.settings-shortcut-summary,
.settings-pane-status {
    text-align: left;
}

.note-style-select {
    cursor: pointer;
}

.note-format-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.note-format-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: var(--bg-input);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    user-select: none;
}

.note-format-item input[type="checkbox"] {
    accent-color: var(--accent);
}

.note-format-item.is-disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.note-format-item.is-disabled input[type="checkbox"] {
    cursor: not-allowed;
}

.note-option-hint {
    margin-top: var(--space-2);
    color: var(--text-muted);
    font-size: var(--text-sm);
}

.note-extra-input {
    min-height: 72px;
    line-height: 1.5;
}

/* ===================== BUTTONS ===================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: var(--interactive-height);
    padding: 8px var(--space-6);
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: var(--text-md);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-standard);
    letter-spacing: 0.01em;
}

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    filter: brightness(1.08);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    filter: none;
}

.btn-danger {
    background: color-mix(in srgb, var(--error) 86%, #1f2937);
    color: #fff;
    border: 1px solid color-mix(in srgb, var(--error) 70%, transparent);
}

.btn-danger:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
    box-shadow: 0 6px 18px color-mix(in srgb, var(--error) 26%, transparent);
}

/* ===================== PROGRESS ===================== */
.progress-area {
    display: none;
    margin-top: 16px;
}

.progress-area.active {
    display: block;
}

.progress-bar-container {
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 14px;
}

.progress-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    width: 0%;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
}

.progress-stats {
    display: flex;
    gap: 18px;
    margin-bottom: 14px;
    font-size: 12px;
    color: var(--text-secondary);
}

.progress-stats .stat {
    display: flex;
    align-items: center;
    gap: 5px;
}

.progress-stats .stat .num {
    font-weight: 600;
    color: var(--text-primary);
}

.log-container {
    background: var(--log-bg);
    border: 1px solid var(--log-border);
    border-radius: var(--radius-sm);
    max-height: 280px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 11.5px;
    line-height: 1.8;
    padding: 14px 18px;
}

.log-entry {
    color: var(--text-muted);
    animation: logIn 0.25s ease;
}

.log-entry.success {
    color: var(--success);
}

.log-entry.error {
    color: var(--error);
}

.log-entry.warning {
    color: var(--warning);
}

.log-entry.info {
    color: var(--info);
}

.log-entry.skip {
    color: var(--text-muted);
    opacity: 0.7;
}

@keyframes logIn {
    from {
        opacity: 0;
        transform: translateX(-6px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===================== INLINE RESULTS ===================== */
.results-area {
    margin-top: 20px;
}

.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    overflow: hidden;
    animation: cardIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    transition: border-color 0.2s;
}

.result-card:hover {
    border-color: var(--border-hover);
}

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.result-card-header:hover {
    background: rgba(255, 255, 255, 0.02);
}

.result-card-header .title {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
}

.result-card-header .badge {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 6px;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.badge-success {
    background: rgba(52, 211, 153, 0.12);
    color: var(--success);
}

.badge-skip {
    background: rgba(90, 90, 114, 0.15);
    color: var(--text-muted);
}

.badge-warning {
    background: rgba(251, 191, 36, 0.12);
    color: var(--warning);
}

.badge-error {
    background: rgba(248, 113, 113, 0.12);
    color: var(--error);
}

.result-card-header .chevron {
    font-size: 12px;
    color: var(--text-muted);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.result-card.expanded .chevron {
    transform: rotate(90deg);
}

.result-card-body {
    display: none;
    padding: 0 20px 20px;
    border-top: 1px solid var(--border);
}

.result-card.expanded .result-card-body {
    display: block;
}

/* ===================== BROWSE CARD GRID ===================== */
.browse-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.browse-header-tools {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.browse-bulk-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-elevated);
}

.browse-select-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    user-select: none;
}

.browse-select-all input[type="checkbox"] {
    accent-color: var(--accent);
}

.browse-selected-count {
    font-size: var(--text-sm);
    color: var(--text-muted);
    min-width: 64px;
}

.browse-bulk-actions .btn {
    height: 30px;
}

.browse-export-format {
    min-height: 30px;
    height: 30px;
    padding: 4px 8px;
    width: 92px;
}

.browse-bulk-actions .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.fav-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.browse-view-toggle,
.fav-view-toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: var(--space-1);
    backdrop-filter: blur(8px);
}

.browse-view-btn,
.fav-view-btn {
    position: relative;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    width: var(--interactive-height);
    height: var(--interactive-height);
    border-radius: 999px;
    cursor: pointer;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration-fast) var(--ease-standard);
}

.browse-view-btn:hover,
.fav-view-btn:hover {
    background: var(--hover);
    color: var(--text-primary);
}

.browse-view-btn.active,
.fav-view-btn.active {
    background: var(--accent-glow);
    color: var(--accent);
    box-shadow: inset 0 0 0 1px rgba(251, 113, 133, 0.28);
}

.browse-view-btn::after,
.fav-view-btn::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    white-space: nowrap;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 11px;
    line-height: 1;
    padding: 6px 8px;
    border-radius: 6px;
    opacity: 0;
    pointer-events: none;
    transition: all var(--duration-fast) var(--ease-standard);
    z-index: 20;
}

.browse-view-btn:hover::after,
.fav-view-btn:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.browse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
    padding: 4px 0;
}

.browse-thumb-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.25s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.browse-thumb-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.browse-cover-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    background: rgba(255, 255, 255, 0.03);
    overflow: hidden;
}

.browse-cover-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.browse-thumb-card:hover .browse-cover-wrapper img {
    transform: scale(1.03);
}

.browse-cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.browse-status-badge {
    position: absolute;
    right: 8px;
    bottom: 8px;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 600;
    backdrop-filter: blur(8px);
}

.browse-status-badge.done {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.12));
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.28);
}

.browse-status-badge.no_subtitle {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(234, 88, 12, 0.12));
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.28);
}

.browse-thumb-info {
    padding: 10px 12px 12px;
}

.browse-thumb-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.browse-thumb-meta {
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.browse-compact-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.browse-compact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fav-compact-item {
    position: relative;
    padding-right: 34px;
}

.browse-compact-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateX(2px);
}

.browse-compact-item.is-selected {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}

.browse-select-wrap.compact-select-wrap {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}

.browse-select-wrap.compact-select-wrap input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

.browse-compact-cover {
    width: 82px;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.03);
    flex-shrink: 0;
}

.browse-compact-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.browse-compact-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.browse-compact-main {
    min-width: 0;
    flex: 1;
}

.browse-compact-title {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.browse-compact-meta {
    margin-top: 3px;
    font-size: 11px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.browse-inline-badge {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 600;
    flex-shrink: 0;
}

.browse-inline-badge.done {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(5, 150, 105, 0.1));
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.24);
}

.browse-inline-badge.no_subtitle {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(234, 88, 12, 0.12));
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.28);
}

.compact-unfav-btn {
    position: absolute;
    right: 8px;
    top: 8px;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
}

.compact-delete-btn {
    position: absolute;
    right: 34px;
    top: 8px;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
}

.fav-compact-item:hover .compact-unfav-btn {
    opacity: 1;
}

.browse-compact-item:hover .compact-delete-btn {
    opacity: 1;
}

.compact-delete-btn:hover {
    background: rgba(239, 68, 68, 0.85);
}

/* ===================== BROWSE LIST ===================== */
.summary-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    margin-bottom: 4px;
}

.summary-item:hover {
    background: var(--bg-card);
    border-color: var(--border);
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.summary-item .title {
    flex: 1;
    font-size: 13px;
    font-weight: 450;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.summary-item:hover .title {
    color: var(--text-primary);
}

.summary-item .icon {
    color: var(--text-muted);
    font-size: 15px;
}

/* ===================== READING VIEW ===================== */
.reading-view {
    display: none;
}

.reading-view.active {
    display: block;
    animation: pageIn 0.3s ease;
}

.reading-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
}

.reading-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.reading-view .back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    margin-bottom: 20px;
    padding: 7px 12px;
    border-radius: var(--radius-xs);
    transition: all 0.2s;
    border: 1px solid transparent;
}

.reading-view .back-btn:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border);
    color: var(--text-primary);
}

.reading-content {
    line-height: 1.85;
    font-size: 14px;
    color: var(--text-secondary);
}

.reading-content h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    letter-spacing: -0.03em;
}

.reading-content h2 {
    font-size: 18px;
    font-weight: 600;
    margin-top: 28px;
    margin-bottom: 14px;
    color: var(--text-primary);
}

.reading-content h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 22px;
    margin-bottom: 10px;
}

.reading-content p {
    margin-bottom: 14px;
    color: var(--text-secondary);
}

.reading-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.reading-content ul,
.reading-content ol {
    padding-left: 22px;
    margin-bottom: 14px;
}

.reading-content li {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.reading-content li::marker {
    color: var(--accent);
}

.reading-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

.reading-content a.ext-link,
.reading-content a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(251, 113, 133, 0.3);
    transition: all 0.2s ease;
    cursor: pointer;
}

.reading-content a.ext-link:hover,
.reading-content a:hover {
    color: var(--accent-hover);
    border-bottom-color: var(--accent-hover);
}

.reading-content a.ext-link::after {
    content: ' ↗';
    font-size: 10px;
    opacity: 0.5;
}

.reading-content a.timestamp-link {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px dashed var(--accent);
    cursor: pointer;
}

.reading-content a.timestamp-link:hover {
    color: var(--accent-hover);
    border-bottom-color: var(--accent-hover);
}

/* ===================== EMPTY STATE ===================== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 52px;
    margin-bottom: 18px;
    opacity: 0.25;
}

.empty-state p {
    font-size: 13px;
    letter-spacing: 0.01em;
}

/* ===================== REUSABLE STATES ===================== */
.ui-state {
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--bg-card) 84%, transparent);
    padding: 18px 16px;
    text-align: center;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.ui-state .spinner {
    margin-bottom: 4px;
}

.ui-state-title {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-primary);
}

.ui-state-message {
    font-size: var(--text-sm);
    color: var(--text-muted);
    line-height: 1.5;
}

.ui-state-action {
    margin-top: 4px;
}

.ui-state-error .ui-state-title {
    color: var(--error);
}

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* ===================== SPINNER ===================== */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* =============================================
   Video Grid — Favorites Browse
   ============================================= */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--space-2);
    padding: var(--space-1) 0;
}

.video-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--duration-normal) var(--ease-standard);
    position: relative;
}

.video-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.video-card .cover-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    /* 16:9 */
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
}

.video-card .cover-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--duration-slow) var(--ease-standard);
}

.video-card .cover-wrapper .cover-fallback {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.2);
}

.video-card:hover .cover-wrapper img {
    transform: scale(1.05);
}

.video-card .duration-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 10px;
    padding: 1px 4px;
    border-radius: 3px;
    font-family: var(--font-mono);
}

.video-card .unfav-btn {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--duration-fast), background var(--duration-fast);
    z-index: 2;
}

.video-card.is-selected {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent), var(--shadow-sm);
}

.browse-select-wrap.thumb-select-wrap {
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 20px;
    height: 20px;
    z-index: 3;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.browse-select-wrap.thumb-select-wrap input {
    width: 14px;
    height: 14px;
    accent-color: var(--accent);
    cursor: pointer;
}

.video-card .delete-btn {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--duration-fast), background var(--duration-fast);
    z-index: 2;
}

.video-card .unfav-btn.unfav-btn-offset {
    top: 30px;
}

.video-card:hover .unfav-btn {
    opacity: 1;
}

.video-card:hover .delete-btn {
    opacity: 1;
}

.video-card .unfav-btn:hover {
    background: rgba(239, 68, 68, 0.85);
}

.video-card .delete-btn:hover {
    background: rgba(239, 68, 68, 0.85);
}

.video-card .summary-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 9px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.video-card .summary-badge.done {
    background: rgba(52, 211, 153, 0.9);
    color: #064e3b;
}

.video-card .summary-badge.summarizing {
    background: rgba(251, 191, 36, 0.9);
    color: #78350f;
    animation: pulse 1.5s ease infinite;
}

.video-card .summary-badge.none {
    background: rgba(100, 100, 120, 0.7);
    color: #e0e0e0;
}

.video-card .summary-badge.no_subtitle {
    background: rgba(248, 113, 113, 0.8);
    color: #fff;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.video-card .card-info {
    padding: 6px 8px 8px;
}

.video-card .card-title {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}

.video-card .card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.video-card .card-meta .upper-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60%;
}

.video-card .card-meta .play-count {
    flex-shrink: 0;
}

/* Load-more & auto-progress */
.load-more-container {
    text-align: center;
    padding: 20px 0;
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
    min-height: var(--interactive-height);
    padding: 8px 28px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--text-lg);
    transition: all var(--duration-fast) var(--ease-standard);
}

.btn-secondary-compact {
    min-height: var(--interactive-height);
    padding: 6px 10px;
    font-size: var(--text-sm);
}

.btn-secondary-xs {
    min-height: 28px;
    padding: 4px 12px;
    font-size: var(--text-sm);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.fav-auto-progress {
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-error {
    color: var(--error);
}

.text-muted-md {
    color: var(--text-muted);
    font-size: var(--text-md);
}

.fav-auto-progress .mini-log {
    background: var(--log-bg);
    border: 1px solid var(--log-border);
    border-radius: var(--radius-xs);
    padding: 8px 12px;
    max-height: 120px;
    overflow-y: auto;
    margin-top: 8px;
}

.fav-auto-progress .mini-log .log-line {
    padding: 2px 0;
    font-size: 11px;
}

/* Sidebar favorites folder items */
.fav-folder-item {
    position: relative;
    padding: 10px 14px;
    margin: 2px 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--text-md);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
    transition: all var(--duration-fast) var(--ease-standard);
    -webkit-app-region: no-drag;
}

.fav-folder-item:hover {
    background: var(--hover);
    color: var(--text-primary);
    transform: translateX(2px);
}

.fav-folder-item.active {
    background: var(--accent-glow);
    color: var(--accent);
    font-weight: 500;
}

.fav-folder-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    background: var(--accent-gradient);
    border-radius: 2px;
}

.fav-folder-item .folder-name {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.fav-folder-item .folder-name .lucide-icon {
    width: 22px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.fav-folder-item.active .folder-name .lucide-icon {
    color: var(--accent);
}

.fav-folder-item .folder-count {
    font-size: 10px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 7px;
    border-radius: 10px;
    color: var(--text-muted);
    margin-left: 6px;
    flex-shrink: 0;
}

[data-theme="light"] .fav-folder-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .video-card .duration-badge {
    background: rgba(0, 0, 0, 0.65);
}

/* Collapsible folder list */
.fav-folder-toggle {
    padding: 10px 14px;
    font-size: var(--text-md);
    font-weight: 400;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: var(--radius-sm);
    transition: all var(--duration-fast) var(--ease-standard);
    -webkit-app-region: no-drag;
}

.fav-folder-toggle:hover {
    color: var(--text-primary);
    background: var(--hover);
    transform: translateX(2px);
}

.fav-folder-toggle .toggle-arrow {
    width: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: transform var(--duration-fast) var(--ease-standard);
}

.fav-folder-toggle.expanded .toggle-arrow {
    transform: rotate(90deg);
}

.fav-folder-list {
    padding-left: 20px;
    overflow: hidden;
    max-height: 500px;
    transition: max-height var(--duration-normal) var(--ease-standard);
}

.fav-folder-list.collapsed {
    max-height: 0;
}

/* Settings — model list */
.model-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

#profileModelOptions {
    margin-top: var(--space-3);
}

.settings-token-row {
    display: flex;
    gap: var(--space-2);
}

.settings-token-input {
    flex: 1;
}

.settings-save-status {
    margin-top: var(--space-2);
    font-size: var(--text-md);
}

.card-header-inline {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title-tight {
    margin-bottom: 0;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--space-3);
}

.admin-stat {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    padding: var(--space-3);
}

.admin-stat-label {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-bottom: 4px;
}

.admin-stat-value {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-primary);
}

.admin-toolbar {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.admin-toolbar .input {
    min-width: 220px;
}

.admin-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.admin-table th,
.admin-table td {
    border-bottom: 1px solid var(--border);
    padding: 8px 10px;
    text-align: left;
    white-space: nowrap;
}

.admin-table th {
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.admin-table td:last-child {
    width: 1%;
}

.admin-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.admin-empty {
    color: var(--text-muted);
    text-align: center !important;
    padding: 14px !important;
}

.mt-2 {
    margin-top: var(--space-2);
}

.mt-3 {
    margin-top: var(--space-3);
}

.mt-4 {
    margin-top: var(--space-4);
}

.pt-3 {
    padding-top: var(--space-3);
}

.model-item:hover {
    background: var(--hover);
}

.model-item.active {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.model-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.model-owner {
    font-size: 11px;
    color: var(--text-muted);
}

.model-check {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    margin-left: auto;
}

/* ---- Action Buttons (reading view) ---- */
.action-btn {
    min-height: 30px;
    padding: 5px 12px;
    font-size: var(--text-sm);
    border-radius: 6px;
    border: 1px solid;
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: opacity var(--duration-fast) var(--ease-standard);
    font-family: inherit;
}

.action-btn:hover {
    opacity: 0.8;
}

.action-btn-retry {
    color: var(--accent);
    border-color: var(--accent);
}

.action-btn-asr {
    color: var(--success);
    border-color: var(--success);
}

.action-btn-unfav {
    color: var(--error);
    border-color: var(--error);
}

.action-btn-open {
    color: var(--info);
    border-color: var(--info);
}

/* ---- Toast Notifications ---- */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    min-width: 280px;
    max-width: 380px;
    padding: 12px 16px;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    font-size: 13px;
    color: var(--text-primary);
    animation: toastSlideIn var(--duration-normal) var(--ease-standard);
    transition: opacity var(--duration-normal), transform var(--duration-normal);
}

.toast.toast-done {
    border-color: var(--success);
}

.toast.toast-success {
    border-color: var(--success);
}

.toast.toast-error {
    border-color: var(--error);
}

.toast.toast-info {
    border-color: var(--info);
}

.toast-title {
    font-weight: 600;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.toast-message {
    color: var(--text-primary);
}

.toast-action {
    margin-top: 10px;
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-xs);
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: var(--text-sm);
    font-family: inherit;
    font-weight: 600;
    padding: 6px 10px;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-standard);
}

.toast-action:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.toast-fadeout {
    opacity: 0;
    transform: translateX(20px);
}

.billing-panel {
    margin: 10px 0;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.billing-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-secondary);
}

.billing-row strong {
    color: var(--text-primary);
}

.billing-plan-buttons {
    display: flex;
    gap: 6px;
}

.billing-plan-buttons .btn-footer {
    width: auto;
}

.btn-footer-compact {
    flex: 1;
    font-size: var(--text-sm);
    padding: 6px 8px;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

@media (max-width: 1200px) {
    :root {
        --sidebar-width: 224px;
    }

    .sidebar-header {
        margin: 10px 10px 6px;
        padding: 16px 12px 12px;
    }

    .sidebar-nav {
        padding: 6px 8px 12px;
    }

    .nav-section {
        padding: 8px;
    }

    .sidebar-footer {
        padding: 14px 12px 16px;
    }

    .main-header {
        padding: var(--space-5) var(--space-6) var(--space-4);
    }

    .main-body {
        padding: var(--space-6);
    }

    .card,
    .reading-panel {
        padding: var(--space-5);
    }

    .browse-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}

@media (max-width: 1024px) {
    :root {
        --sidebar-width: 208px;
    }

    .main-header {
        padding: var(--space-5);
    }

    .main-body {
        padding: var(--space-5);
    }

    .card,
    .reading-panel {
        padding: var(--space-4);
    }

    .main-topbar,
    .input-row,
    .browse-header-row,
    .fav-header-row,
    .reading-header,
    .settings-token-row,
    .card-header-inline {
        flex-wrap: wrap;
    }

    .input-row .form-group,
    .settings-token-input {
        min-width: 180px;
    }

    .browse-header-tools,
    .browse-view-toggle,
    .fav-view-toggle {
        margin-left: auto;
    }

    .main-topbar-right {
        width: 100%;
        justify-content: flex-end;
    }

    .browse-header-tools {
        width: 100%;
        justify-content: flex-start;
    }

    .browse-bulk-actions {
        flex-wrap: wrap;
        border-radius: var(--radius-sm);
    }

    .note-format-item {
        flex: 1 1 148px;
        justify-content: center;
    }

    .browse-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 12px;
    }

    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    }

    .gutter-back-btn {
        left: calc(var(--sidebar-width) + 4px);
    }
}

@media (max-width: 900px) {
    .sidebar-toggle-btn {
        display: flex;
    }

    .app {
        position: relative;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        width: var(--sidebar-width);
        z-index: 999;
        transform: translateX(-100%);
        transition: transform var(--duration-normal) var(--ease-standard);
    }

    .sidebar:not(.collapsed) {
        transform: translateX(0);
    }

    .gutter-back-btn {
        display: none;
    }

    .main-header,
    .main-body {
        padding-left: var(--space-4);
        padding-right: var(--space-4);
    }

    .main-header h2 {
        font-size: var(--text-xl);
    }

    .main-topbar {
        padding-left: var(--space-4);
        padding-right: var(--space-4);
    }

    .main-topbar-left {
        width: 100%;
    }

    .topbar-switch-btn {
        flex: 1;
        justify-content: center;
    }

    .card,
    .reading-panel {
        padding: var(--space-4);
    }
}

@media (max-width: 700px) {
    :root {
        --sidebar-width: 280px;
        --space-6: 16px;
        --space-7: 20px;
        --space-8: 20px;
    }

    .main-topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 10px 12px;
    }

    .main-topbar-left {
        width: 100%;
        gap: 8px;
    }

    .main-topbar-right {
        width: 100%;
        justify-content: space-between;
    }

    .sidebar-toggle-btn {
        width: 34px;
        height: 34px;
    }

    .topbar-switch-btn {
        min-height: 34px;
        font-size: 13px;
        padding: 0 10px;
    }

    .main-header {
        padding: 12px 12px 10px;
    }

    .main-header h2 {
        font-size: 18px;
    }

    .main-header p {
        font-size: 13px;
    }

    .main-body {
        padding: 12px;
    }

    .card {
        padding: 14px;
        margin-bottom: 12px;
        border-radius: 12px;
    }

    .form-group {
        margin-bottom: 14px;
    }

    .form-group label {
        font-size: 13px;
        margin-bottom: 6px;
    }

    .input,
    textarea {
        min-height: 38px;
        padding: 8px 12px;
        font-size: 14px;
    }

    textarea {
        min-height: 72px;
    }

    .input-row {
        flex-direction: column;
        gap: 12px;
    }

    .input-row .form-group {
        width: 100%;
    }

    .note-format-grid {
        gap: 6px;
    }

    .note-format-item {
        flex: 1 1 calc(50% - 6px);
        padding: 6px 8px;
        font-size: 12px;
    }

    .btn {
        min-height: 38px;
        padding: 8px 16px;
        font-size: 14px;
    }

    .btn-primary {
        width: 100%;
    }

    .modal-overlay {
        align-items: flex-end;
    }

    .modal {
        width: calc(100vw - 12px);
        max-width: calc(100vw - 12px);
        border-radius: 16px 16px 0 0;
        max-height: calc(100vh - 12px);
        overflow: hidden;
    }

    .modal-wide {
        width: calc(100vw - 12px);
    }

    .modal-header {
        padding: 16px 16px 12px;
    }

    .modal-body {
        padding: 16px;
        max-height: calc(100vh - 110px);
        overflow-y: auto;
    }

    .profile-modal-body {
        max-height: calc(100vh - 110px);
    }

    .profile-action-row .btn {
        flex: 1 1 100%;
        min-width: 0;
    }

    .platform-auth-code-row {
        flex-direction: column;
        align-items: stretch;
    }

    .platform-auth-code-row .btn {
        width: 100%;
    }

    .quick-amount-row .btn {
        flex: 1 1 calc(50% - 8px);
    }

    .browse-header-row {
        flex-direction: column;
        gap: 10px;
    }

    .browse-header-tools {
        width: 100%;
        justify-content: flex-start;
    }

    .fav-header-row {
        flex-direction: column;
        gap: 10px;
    }

    .fav-view-toggle {
        align-self: flex-start;
    }

    .browse-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }

    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 8px;
    }

    .progress-stats {
        flex-wrap: wrap;
        gap: 10px;
    }

    .log-container {
        max-height: 180px;
        font-size: 10.5px;
        padding: 10px 12px;
    }
}

