:root {
    --transition-speed: 0.3s;
}

* {
    -webkit-tap-highlight-color: transparent;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(15px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes slideUp {
    from { 
        opacity: 0; 
        transform: translateY(20px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

@keyframes pulse {
    0%, 100% { 
        transform: scale(1); 
    }
    50% { 
        transform: scale(1.05); 
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.card {
    animation: slideUp 0.5s ease-out;
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.card:hover {
    transform: translateY(-2px);
}

.stat-card {
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.stat-card:hover {
    transform: scale(1.02);
}

.upload-zone {
    transition: all var(--transition-speed);
}

.upload-zone.dragover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
    transform: scale(1.02);
}

.nav-btn {
    color: #6b7280;
    position: relative;
    overflow: hidden;
}

.dark .nav-btn {
    color: rgba(156, 163, 175, 0.7);
}

.nav-btn.active {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.dark .nav-btn.active {
    color: #60a5fa;
    background: rgba(59, 130, 246, 0.15);
}

.nav-btn:hover:not(.active) {
    color: #4b5563;
    background: rgba(107, 114, 128, 0.1);
}

.dark .nav-btn:hover:not(.active) {
    color: rgba(156, 163, 175, 0.9);
    background: rgba(156, 163, 175, 0.1);
}

.nav-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6, #06b6d4);
    transition: all var(--transition-speed);
    transform: translateX(-50%);
    border-radius: 2px;
}

.nav-btn.active::after {
    width: 60%;
}

.safe-area-bottom {
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
}

.video-card {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 1rem;
    padding: 1rem;
    transition: all var(--transition-speed);
    animation: slideUp 0.4s ease-out;
}

.dark .video-card {
    background: rgba(30, 58, 95, 0.3);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.video-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.dark .video-card:hover {
    background: rgba(30, 58, 95, 0.4);
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.segment-box {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #f59e0b, #ea580c);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    color: white;
    animation: pulse 0.3s ease-out;
}

.merge-item {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    transition: all var(--transition-speed);
    animation: slideUp 0.3s ease-out;
}

.dark .merge-item {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.merge-item:hover {
    border-color: rgba(16, 185, 129, 0.4);
}

.job-card {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 1rem;
    padding: 1rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    transition: all var(--transition-speed);
    animation: slideUp 0.4s ease-out;
}

.dark .job-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.job-card.processing {
    border-color: rgba(59, 130, 246, 0.5);
}

.job-card.completed {
    border-color: rgba(16, 185, 129, 0.5);
}

.job-card.error {
    border-color: rgba(239, 68, 68, 0.5);
}

.progress-ring {
    transform: rotate(-90deg);
}

.achievement-card {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 1rem;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all var(--transition-speed);
    animation: slideUp 0.4s ease-out;
}

.dark .achievement-card {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.achievement-card.unlocked {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
}

.achievement-card:hover {
    transform: translateX(4px);
}

.achievement-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.spin {
    animation: spin 1s linear infinite;
}

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

.btn-primary {
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: left 0.5s;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:active {
    transform: scale(0.98);
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    opacity: 1;
    height: 32px;
}

.loading-skeleton {
    background: linear-gradient(
        90deg,
        rgba(156, 163, 175, 0.1) 25%,
        rgba(156, 163, 175, 0.2) 50%,
        rgba(156, 163, 175, 0.1) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.5rem;
}

.tiktok-download-card {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 0, 80, 0.2);
    border-radius: 1rem;
    padding: 1rem;
    transition: all var(--transition-speed);
    animation: slideUp 0.4s ease-out;
}

.dark .tiktok-download-card {
    background: rgba(255, 0, 80, 0.1);
    border: 1px solid rgba(255, 0, 80, 0.2);
}

.tiktok-download-card:hover {
    border-color: rgba(255, 0, 80, 0.4);
    transform: translateY(-2px);
}

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

::-webkit-scrollbar {
    width: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(156, 163, 175, 0.5);
}
